@zgfe/modules-dm 1.0.33 → 1.0.34-heyh.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/demo.js +2 -1
- package/es/constants/api.d.ts +11 -0
- package/es/constants/api.js +27 -12
- package/es/modules/dataCollection/collectionAttributeList.js +52 -28
- package/es/modules/dataCollection/collectionEventList.js +52 -81
- package/es/modules/dataCollection/components/createVirtualDrawer.d.ts +4 -0
- package/es/modules/dataCollection/components/createVirtualDrawer.js +227 -0
- package/es/modules/dataCollection/components/eventFilter/index.d.ts +5 -0
- package/es/modules/dataCollection/components/eventFilter/index.js +145 -0
- package/es/modules/dataCollection/components/eventFilter/styles/index.less +64 -0
- package/es/modules/dataCollection/components/eventFilter/types.d.ts +51 -0
- package/es/modules/dataCollection/components/eventFilter/types.js +1 -0
- package/es/modules/dataCollection/components/eventGroupingDrawer.d.ts +4 -0
- package/es/modules/dataCollection/components/eventGroupingDrawer.js +388 -0
- package/es/modules/dataCollection/components/selectAttributes.d.ts +3 -0
- package/es/modules/dataCollection/components/selectAttributes.js +210 -0
- package/es/modules/dataCollection/components/sortableComponnet.d.ts +3 -0
- package/es/modules/dataCollection/components/sortableComponnet.js +109 -0
- package/es/modules/dataCollection/{tablePlus.d.ts → components/tablePlus.d.ts} +2 -1
- package/es/modules/dataCollection/{tablePlus.js → components/tablePlus.js} +150 -140
- package/es/modules/dataCollection/components/virtualTablePlus.d.ts +5 -0
- package/es/modules/dataCollection/components/virtualTablePlus.js +383 -0
- package/es/modules/dataCollection/index.js +7 -6
- package/es/modules/dataCollection/styles/index.less +390 -18
- package/es/modules/dataCollection/types.d.ts +76 -0
- package/es/modules/dataCollection/types.js +1 -0
- package/es/modules/dataCollection/virtualEventList.d.ts +4 -0
- package/es/modules/dataCollection/virtualEventList.js +337 -0
- package/es/modules/dataManage/demo/index.js +16 -12
- package/es/modules/dataPlan/addEventOrUser.js +1 -2
- package/es/modules/dataPlan/addPlan.js +3 -12
- package/es/modules/dataPlan/eventList.js +0 -1
- package/es/modules/dataPlan/index.js +8 -9
- package/es/modules/dataPlan/tablePlus.js +0 -1
- package/es/modules/dataPlan/userAttributeList.js +0 -1
- package/es/utils/index.d.ts +48 -0
- package/es/utils/index.js +247 -0
- package/package.json +7 -4
- package/es/modules/dataCollection/demo/index.d.ts +0 -2
- package/es/modules/dataCollection/demo/index.js +0 -7
- package/es/modules/dataPlan/demo/index.d.ts +0 -2
- package/es/modules/dataPlan/demo/index.js +0 -6
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { BizGlobalDataContext, IconFont, BizLoading } from '@zgfe/business-lib';
|
|
14
|
+
import { Input, Modal, message, Drawer, Popover, Checkbox, Select, Button } from 'antd';
|
|
15
|
+
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
16
|
+
import request from '../../../utils/ajax';
|
|
17
|
+
import apis from '../../../constants/api';
|
|
18
|
+
import { eventListHandle, groupListSort, eventCheckedAll, openChangeData, groupDeleteData, eventShowOrHiddenData, eventMoveData, getAppID } from '../../../utils/index';
|
|
19
|
+
import React, { Fragment, useContext, useEffect, useState } from 'react';
|
|
20
|
+
import _ from 'lodash';
|
|
21
|
+
import SortableComponnet from './sortableComponnet';
|
|
22
|
+
var EventGroupingDrawer = function EventGroupingDrawer(props) {
|
|
23
|
+
var classPrefix = 'event-grouping-drawer';
|
|
24
|
+
var eventGroupingShow = props.eventGroupingShow,
|
|
25
|
+
setEventGroupingShow = props.setEventGroupingShow,
|
|
26
|
+
refresh = props.refresh;
|
|
27
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
28
|
+
currentApp = _useContext.currentApp;
|
|
29
|
+
var _useState = useState([]),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
groupingData = _useState2[0],
|
|
32
|
+
setGroupingData = _useState2[1];
|
|
33
|
+
var _useState3 = useState(false),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
isDragDisabled = _useState4[0],
|
|
36
|
+
setIsDragDisabled = _useState4[1];
|
|
37
|
+
var _useState5 = useState(false),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
loading = _useState6[0],
|
|
40
|
+
setLoading = _useState6[1];
|
|
41
|
+
var queryList = function queryList() {
|
|
42
|
+
setLoading(true);
|
|
43
|
+
request(apis.queryCollectionEventList, {
|
|
44
|
+
method: 'post',
|
|
45
|
+
data: {
|
|
46
|
+
appId: getAppID(currentApp),
|
|
47
|
+
platform: 0,
|
|
48
|
+
isAll: true
|
|
49
|
+
}
|
|
50
|
+
}).then(function (res) {
|
|
51
|
+
if (res && res.data) {
|
|
52
|
+
eventListHandle(res.data);
|
|
53
|
+
setGroupingData(res.data);
|
|
54
|
+
}
|
|
55
|
+
setLoading(false);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
if (eventGroupingShow) queryList();
|
|
60
|
+
}, [eventGroupingShow]);
|
|
61
|
+
var onChangeAll = function onChangeAll(groupId) {
|
|
62
|
+
setGroupingData(_.cloneDeep(eventCheckedAll(groupId, groupingData)));
|
|
63
|
+
};
|
|
64
|
+
var openChange = function openChange(groupId) {
|
|
65
|
+
setGroupingData(_.cloneDeep(openChangeData(groupId, groupingData)));
|
|
66
|
+
};
|
|
67
|
+
// 拖拽之后改变对应数据
|
|
68
|
+
var onDragEnd = function onDragEnd(result) {
|
|
69
|
+
// console.log('拖拽之后改变对应数据: ', result);
|
|
70
|
+
// 分组移动
|
|
71
|
+
if (result.source.droppableId.indexOf('item') === -1) {
|
|
72
|
+
var ids = groupListSort(result, groupingData, setGroupingData);
|
|
73
|
+
request(apis.orderEventGroup, {
|
|
74
|
+
method: 'post',
|
|
75
|
+
data: {
|
|
76
|
+
appId: getAppID(currentApp),
|
|
77
|
+
ids: ids
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
setIsDragDisabled(false);
|
|
82
|
+
};
|
|
83
|
+
// 删除事件分组
|
|
84
|
+
var groupDelete = function groupDelete(groupId) {
|
|
85
|
+
Modal.confirm({
|
|
86
|
+
centered: true,
|
|
87
|
+
title: '提示',
|
|
88
|
+
content: '是否确认删除?',
|
|
89
|
+
className: 'group-delete-modal',
|
|
90
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
91
|
+
type: "tishi1"
|
|
92
|
+
}),
|
|
93
|
+
okText: '确认',
|
|
94
|
+
cancelText: '取消',
|
|
95
|
+
maskClosable: false,
|
|
96
|
+
onOk: function onOk() {
|
|
97
|
+
request(apis.deleteEventGroup, {
|
|
98
|
+
method: 'post',
|
|
99
|
+
data: {
|
|
100
|
+
appId: getAppID(currentApp),
|
|
101
|
+
eventGroupId: groupId
|
|
102
|
+
}
|
|
103
|
+
}).then(function (res) {
|
|
104
|
+
if (res) {
|
|
105
|
+
message.success('删除成功');
|
|
106
|
+
groupDeleteData(groupId, groupingData, setGroupingData);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
// 显示或隐藏
|
|
113
|
+
var eventShowOrHidden = function eventShowOrHidden(type, groupId) {
|
|
114
|
+
var ids = eventShowOrHiddenData(type, groupId, groupingData, setGroupingData);
|
|
115
|
+
if (ids !== '') {
|
|
116
|
+
request(apis.hiddenEvent, {
|
|
117
|
+
method: 'post',
|
|
118
|
+
data: {
|
|
119
|
+
appId: getAppID(currentApp),
|
|
120
|
+
hidden: type,
|
|
121
|
+
ids: ids
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
// 移动
|
|
127
|
+
var _useState7 = useState(undefined),
|
|
128
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
129
|
+
eventMoveShow = _useState8[0],
|
|
130
|
+
setEventMoveShow = _useState8[1];
|
|
131
|
+
var _useState9 = useState(-1),
|
|
132
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
133
|
+
eventMoveChangeId = _useState10[0],
|
|
134
|
+
setEventMoveChangeId = _useState10[1];
|
|
135
|
+
var _useState11 = useState([]),
|
|
136
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
137
|
+
eventMoveOption = _useState12[0],
|
|
138
|
+
setEventMoveOption = _useState12[1];
|
|
139
|
+
var _useState13 = useState(0),
|
|
140
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
141
|
+
eventMoveLength = _useState14[0],
|
|
142
|
+
setEventMoveLength = _useState14[1];
|
|
143
|
+
var _useState15 = useState(''),
|
|
144
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
145
|
+
eventMoveIds = _useState16[0],
|
|
146
|
+
setEventMoveIds = _useState16[1];
|
|
147
|
+
var eventMove = function eventMove(groupId) {
|
|
148
|
+
var data = eventMoveData(groupId, groupingData, setGroupingData);
|
|
149
|
+
setEventMoveOption(data.groupingOption);
|
|
150
|
+
setEventMoveLength(data.length);
|
|
151
|
+
setEventMoveIds(data.ids);
|
|
152
|
+
if (data.length > 0) {
|
|
153
|
+
setEventMoveShow(groupId);
|
|
154
|
+
setEventMoveChangeId(data.groupingOption[0].value);
|
|
155
|
+
} else {
|
|
156
|
+
setEventMoveShow(undefined);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var eventMoveChange = function eventMoveChange() {
|
|
160
|
+
request(apis.operateGroupRelations, {
|
|
161
|
+
method: 'post',
|
|
162
|
+
data: {
|
|
163
|
+
appId: getAppID(currentApp),
|
|
164
|
+
platform: 0,
|
|
165
|
+
hasPublicAttrView: true,
|
|
166
|
+
eventIds: eventMoveIds,
|
|
167
|
+
eventGroupId: eventMoveChangeId,
|
|
168
|
+
oldEventGroupId: eventMoveShow
|
|
169
|
+
}
|
|
170
|
+
}).then(function (res) {
|
|
171
|
+
if (res.code == '00') {
|
|
172
|
+
queryList();
|
|
173
|
+
}
|
|
174
|
+
}).finally(function () {
|
|
175
|
+
setEventMoveShow(undefined);
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
var moveContent = function moveContent() {
|
|
179
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
180
|
+
className: "move-content"
|
|
181
|
+
}, /*#__PURE__*/React.createElement("div", null, "\u5C06", eventMoveLength, "\u4E2A\u6307\u6807\u79FB\u52A8\u5230\u4EE5\u4E0B\u5206\u7EC4"), /*#__PURE__*/React.createElement("div", null, "\u9009\u62E9\u5206\u7EC4", ' ', /*#__PURE__*/React.createElement(Select, {
|
|
182
|
+
defaultValue: eventMoveOption[0].value,
|
|
183
|
+
style: {
|
|
184
|
+
width: 120
|
|
185
|
+
},
|
|
186
|
+
onChange: function onChange(id) {
|
|
187
|
+
setEventMoveChangeId(id);
|
|
188
|
+
},
|
|
189
|
+
options: eventMoveOption
|
|
190
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
191
|
+
type: "text",
|
|
192
|
+
size: "small",
|
|
193
|
+
onClick: function onClick() {
|
|
194
|
+
return setEventMoveShow(false);
|
|
195
|
+
}
|
|
196
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
197
|
+
type: "primary",
|
|
198
|
+
size: "small",
|
|
199
|
+
onClick: eventMoveChange
|
|
200
|
+
}, "\u786E\u5B9A")));
|
|
201
|
+
};
|
|
202
|
+
// 创建分组 & 修改分组名
|
|
203
|
+
var _useState17 = useState(null),
|
|
204
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
205
|
+
createOrEditGrpup = _useState18[0],
|
|
206
|
+
setCreateOrEditGrpup = _useState18[1];
|
|
207
|
+
var _useState19 = useState(-1),
|
|
208
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
209
|
+
grpupModalSelectGrpupId = _useState20[0],
|
|
210
|
+
setGrpupModalSelectGrpupId = _useState20[1];
|
|
211
|
+
var _useState21 = useState(''),
|
|
212
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
213
|
+
grpupNameInput = _useState22[0],
|
|
214
|
+
setGrpupNameInput = _useState22[1];
|
|
215
|
+
var GrpupModalHandle = function GrpupModalHandle() {
|
|
216
|
+
if (grpupNameInput === '') {
|
|
217
|
+
message.error('请填写分组名');
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
var _data = {};
|
|
221
|
+
if (createOrEditGrpup === 'edit') {
|
|
222
|
+
_data.eventGroupId = grpupModalSelectGrpupId;
|
|
223
|
+
}
|
|
224
|
+
request(apis.upsertEventGroup, {
|
|
225
|
+
method: 'post',
|
|
226
|
+
data: _objectSpread(_objectSpread({
|
|
227
|
+
eventGroupName: grpupNameInput,
|
|
228
|
+
appId: getAppID(currentApp)
|
|
229
|
+
}, _data), {}, {
|
|
230
|
+
platform: 0
|
|
231
|
+
})
|
|
232
|
+
}).then(function (res) {
|
|
233
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '01') {
|
|
234
|
+
message.error('事件组名称已存在');
|
|
235
|
+
}
|
|
236
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '00') {
|
|
237
|
+
message.success("".concat(createOrEditGrpup === 'create' ? '创建' : '编辑', "'\u6210\u529F'"));
|
|
238
|
+
queryList();
|
|
239
|
+
GrpupModalClose();
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
var GrpupModalClose = function GrpupModalClose() {
|
|
244
|
+
setCreateOrEditGrpup(null);
|
|
245
|
+
setGrpupModalSelectGrpupId(-1);
|
|
246
|
+
setGrpupNameInput('');
|
|
247
|
+
};
|
|
248
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Drawer, {
|
|
249
|
+
className: classPrefix,
|
|
250
|
+
width: 700,
|
|
251
|
+
title: /*#__PURE__*/React.createElement("div", null, "\u4E8B\u4EF6\u5206\u7EC4\u7BA1\u7406", /*#__PURE__*/React.createElement("span", null, "\u7EDF\u4E00\u7BA1\u7406\u57CB\u70B9\u4E8B\u4EF6\u548C\u865A\u62DF\u4E8B\u4EF6\u4E1A\u52A1\u5206\u7EC4\uFF0C\u652F\u6301\u5BF9\u4E8B\u4EF6\u8C03\u6574\u6392\u5E8F\u548C\u9690\u85CF")),
|
|
252
|
+
placement: "right",
|
|
253
|
+
onClose: function onClose() {
|
|
254
|
+
setEventGroupingShow(false);
|
|
255
|
+
setEventMoveShow(undefined);
|
|
256
|
+
refresh();
|
|
257
|
+
},
|
|
258
|
+
destroyOnClose: true,
|
|
259
|
+
open: eventGroupingShow,
|
|
260
|
+
extra: /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
261
|
+
type: "primary",
|
|
262
|
+
size: "small",
|
|
263
|
+
onClick: function onClick() {
|
|
264
|
+
setCreateOrEditGrpup('create');
|
|
265
|
+
}
|
|
266
|
+
}, "\u521B\u5EFA\u5206\u7EC4"), /*#__PURE__*/React.createElement(IconFont, {
|
|
267
|
+
type: "qingchu",
|
|
268
|
+
onClick: function onClick() {
|
|
269
|
+
setEventGroupingShow(false);
|
|
270
|
+
setEventMoveShow(undefined);
|
|
271
|
+
}
|
|
272
|
+
}))
|
|
273
|
+
}, /*#__PURE__*/React.createElement(BizLoading, {
|
|
274
|
+
spinning: loading
|
|
275
|
+
}, /*#__PURE__*/React.createElement(DragDropContext, {
|
|
276
|
+
onDragEnd: onDragEnd
|
|
277
|
+
}, groupingData.map(function (item, index) {
|
|
278
|
+
return /*#__PURE__*/React.createElement(Droppable, {
|
|
279
|
+
droppableId: index.toString(),
|
|
280
|
+
key: index,
|
|
281
|
+
type: "person",
|
|
282
|
+
isDragDisabled: false,
|
|
283
|
+
direction: "vertical"
|
|
284
|
+
}, function (provided) {
|
|
285
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
|
286
|
+
key: index,
|
|
287
|
+
ref: provided.innerRef
|
|
288
|
+
}, provided.droppableProps), /*#__PURE__*/React.createElement(Draggable, {
|
|
289
|
+
isDragDisabled: isDragDisabled,
|
|
290
|
+
key: item.groupId.toString(),
|
|
291
|
+
draggableId: item.groupId.toString(),
|
|
292
|
+
index: index
|
|
293
|
+
}, function (provided) {
|
|
294
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
|
295
|
+
ref: provided.innerRef
|
|
296
|
+
}, provided.draggableProps), /*#__PURE__*/React.createElement("div", {
|
|
297
|
+
className: "".concat(classPrefix, "-box")
|
|
298
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
299
|
+
className: "".concat(classPrefix, "-box-header")
|
|
300
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: "operate-left"
|
|
302
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
303
|
+
id: "create-or-edit-grpup-modal"
|
|
304
|
+
}, item.open && /*#__PURE__*/React.createElement(IconFont, {
|
|
305
|
+
type: "fangxiangxia",
|
|
306
|
+
onClick: function onClick() {
|
|
307
|
+
return openChange(item.groupId);
|
|
308
|
+
}
|
|
309
|
+
}), !item.open && /*#__PURE__*/React.createElement(IconFont, {
|
|
310
|
+
type: "fangxiangshang",
|
|
311
|
+
onClick: function onClick() {
|
|
312
|
+
return openChange(item.groupId);
|
|
313
|
+
}
|
|
314
|
+
}), /*#__PURE__*/React.createElement("div", null, item.groupName ? item.groupName : '未分组'), /*#__PURE__*/React.createElement(IconFont, {
|
|
315
|
+
type: "zhongmingming",
|
|
316
|
+
onClick: function onClick() {
|
|
317
|
+
setCreateOrEditGrpup('edit');
|
|
318
|
+
setGrpupNameInput(item.groupName ? item.groupName : '未分组');
|
|
319
|
+
setGrpupModalSelectGrpupId(item.groupId);
|
|
320
|
+
}
|
|
321
|
+
})), /*#__PURE__*/React.createElement("div", null, item.eventList.length, "\u4E2A\u6307\u6807")), /*#__PURE__*/React.createElement("div", {
|
|
322
|
+
className: "operate-right"
|
|
323
|
+
}, item.eventList.length > 0 && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
324
|
+
checked: item.checked,
|
|
325
|
+
onChange: function onChange() {
|
|
326
|
+
return onChangeAll(item.groupId);
|
|
327
|
+
}
|
|
328
|
+
}, "\u5168\u9009"), /*#__PURE__*/React.createElement(Popover, {
|
|
329
|
+
overlayClassName: "move-popover ".concat(eventMoveLength ? 'show' : 'hidden'),
|
|
330
|
+
placement: "bottomRight",
|
|
331
|
+
open: eventMoveShow === item.groupId,
|
|
332
|
+
title: null,
|
|
333
|
+
content: moveContent
|
|
334
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
335
|
+
className: "".concat(groupingData.length > 1 ? '' : 'not-operable'),
|
|
336
|
+
onClick: function onClick() {
|
|
337
|
+
if (groupingData.length > 1) {
|
|
338
|
+
eventMove(item.groupId);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}, "\u79FB\u52A8")), /*#__PURE__*/React.createElement("span", {
|
|
342
|
+
onClick: function onClick() {
|
|
343
|
+
return eventShowOrHidden(0, item.groupId);
|
|
344
|
+
}
|
|
345
|
+
}, "\u663E\u793A"), /*#__PURE__*/React.createElement("span", {
|
|
346
|
+
onClick: function onClick() {
|
|
347
|
+
return eventShowOrHidden(1, item.groupId);
|
|
348
|
+
}
|
|
349
|
+
}, "\u9690\u85CF")), /*#__PURE__*/React.createElement("span", {
|
|
350
|
+
onClick: function onClick() {
|
|
351
|
+
return groupDelete(item.groupId);
|
|
352
|
+
}
|
|
353
|
+
}, "\u5220\u9664"), /*#__PURE__*/React.createElement(IconFont, _objectSpread(_objectSpread({}, provided.dragHandleProps), {}, {
|
|
354
|
+
type: "tuozhuai1"
|
|
355
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
356
|
+
className: "".concat(classPrefix, "-box-content ").concat(item.open ? 'open' : 'close')
|
|
357
|
+
}, /*#__PURE__*/React.createElement(SortableComponnet, {
|
|
358
|
+
componnetData: item.eventList,
|
|
359
|
+
componnetIndex: index,
|
|
360
|
+
groupId: item.groupId,
|
|
361
|
+
groupingData: groupingData,
|
|
362
|
+
setGroupingData: setGroupingData
|
|
363
|
+
}))));
|
|
364
|
+
}));
|
|
365
|
+
});
|
|
366
|
+
})))), /*#__PURE__*/React.createElement(Modal, {
|
|
367
|
+
wrapClassName: "create-or-edit-grpup-modal",
|
|
368
|
+
title: "".concat(createOrEditGrpup === 'create' ? '创建分组' : '修改分组名'),
|
|
369
|
+
bodyStyle: {
|
|
370
|
+
padding: '0 24px 24px 24px'
|
|
371
|
+
},
|
|
372
|
+
destroyOnClose: true,
|
|
373
|
+
open: createOrEditGrpup === null ? false : true,
|
|
374
|
+
getContainer: function getContainer() {
|
|
375
|
+
return document.getElementById("create-or-edit-grpup-modal");
|
|
376
|
+
},
|
|
377
|
+
onOk: GrpupModalHandle,
|
|
378
|
+
onCancel: GrpupModalClose
|
|
379
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
380
|
+
placeholder: "\u8BF7\u8F93\u5165\u5206\u7EC4\u540D",
|
|
381
|
+
value: grpupNameInput,
|
|
382
|
+
maxLength: 20,
|
|
383
|
+
onChange: function onChange(e) {
|
|
384
|
+
return setGrpupNameInput(e.currentTarget.value);
|
|
385
|
+
}
|
|
386
|
+
})));
|
|
387
|
+
};
|
|
388
|
+
export default EventGroupingDrawer;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { IconFont, BizSearchInput } from '@zgfe/business-lib';
|
|
12
|
+
import { Select, Modal, Dropdown, Checkbox, message } from 'antd';
|
|
13
|
+
import { useEffect } from 'react';
|
|
14
|
+
import React, { useState } from 'react';
|
|
15
|
+
var SelectAttributes = function SelectAttributes(props) {
|
|
16
|
+
var classPrefix = 'select-attributes';
|
|
17
|
+
var selectAttributesShow = props.selectAttributesShow,
|
|
18
|
+
setSelectAttributesShow = props.setSelectAttributesShow,
|
|
19
|
+
selectAttributesData = props.selectAttributesData,
|
|
20
|
+
selectAttributesHandle = props.selectAttributesHandle;
|
|
21
|
+
// 下拉菜单是否显示
|
|
22
|
+
var _useState = useState(false),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
visible = _useState2[0],
|
|
25
|
+
setVisible = _useState2[1];
|
|
26
|
+
// select选项
|
|
27
|
+
var _useState3 = useState([]),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
options = _useState4[0],
|
|
30
|
+
setOptions = _useState4[1];
|
|
31
|
+
// select选中项
|
|
32
|
+
var _useState5 = useState([]),
|
|
33
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
+
selectValue = _useState6[0],
|
|
35
|
+
setSelectValue = _useState6[1];
|
|
36
|
+
// 当前选中的事件id
|
|
37
|
+
var _useState7 = useState(-999),
|
|
38
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
39
|
+
selectEventId = _useState8[0],
|
|
40
|
+
setSelectEventId = _useState8[1];
|
|
41
|
+
// 搜索属性名称
|
|
42
|
+
var _useState9 = useState(''),
|
|
43
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
44
|
+
searchValue = _useState10[0],
|
|
45
|
+
setSearchValue = _useState10[1];
|
|
46
|
+
// 属性展示列表(属性名称,搜索过滤使用)
|
|
47
|
+
var _useState11 = useState([]),
|
|
48
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
49
|
+
attrShowList = _useState12[0],
|
|
50
|
+
setAttrShowList = _useState12[1];
|
|
51
|
+
// 属性展示列表 - 原数据(属性名称,搜索过滤使用)
|
|
52
|
+
var _useState13 = useState([]),
|
|
53
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
54
|
+
attrShowListOriginalData = _useState14[0],
|
|
55
|
+
setAttrShowListOriginalData = _useState14[1];
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
if (!selectAttributesShow) return;
|
|
58
|
+
var _options = [];
|
|
59
|
+
var _selectValue = [];
|
|
60
|
+
var _attrShowList = [];
|
|
61
|
+
selectAttributesData[0].attrList.map(function (item) {
|
|
62
|
+
_options.push({
|
|
63
|
+
label: item.label,
|
|
64
|
+
value: item.label,
|
|
65
|
+
ofEventId: item.ofEventId
|
|
66
|
+
});
|
|
67
|
+
_attrShowList.push(item.label);
|
|
68
|
+
if (_selectValue.length < 100) {
|
|
69
|
+
_selectValue.push(item.label);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
setOptions(_options);
|
|
73
|
+
setSelectValue(_selectValue);
|
|
74
|
+
setAttrShowList(_attrShowList);
|
|
75
|
+
setAttrShowListOriginalData(_attrShowList);
|
|
76
|
+
}, [selectAttributesData, selectAttributesShow]);
|
|
77
|
+
// 下拉菜单显示隐藏改变
|
|
78
|
+
var onVisibleChange = function onVisibleChange(show) {
|
|
79
|
+
setVisible(show);
|
|
80
|
+
setSearchValue('');
|
|
81
|
+
};
|
|
82
|
+
// 保存
|
|
83
|
+
var handleOk = function handleOk() {
|
|
84
|
+
if (selectValue.length > 100) {
|
|
85
|
+
message.error('最多可选择100个属性');
|
|
86
|
+
} else {
|
|
87
|
+
selectAttributesHandle(selectValue);
|
|
88
|
+
setSelectAttributesShow(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// 取消
|
|
92
|
+
var handleCancel = function handleCancel() {
|
|
93
|
+
setSelectAttributesShow(false);
|
|
94
|
+
};
|
|
95
|
+
// select选中的数据变化
|
|
96
|
+
var handleSelectChange = function handleSelectChange(data) {
|
|
97
|
+
setSelectValue(data);
|
|
98
|
+
};
|
|
99
|
+
// 左侧事件id变化
|
|
100
|
+
var onSelectEventIdChange = function onSelectEventIdChange(id) {
|
|
101
|
+
setSelectEventId(id);
|
|
102
|
+
};
|
|
103
|
+
// 右侧事件属性变化
|
|
104
|
+
var onSelectAttributesChange = function onSelectAttributesChange(label) {
|
|
105
|
+
if (selectValue.indexOf(label) !== -1) {
|
|
106
|
+
setSelectValue(selectValue.filter(function (_label) {
|
|
107
|
+
return _label !== label;
|
|
108
|
+
}));
|
|
109
|
+
} else {
|
|
110
|
+
setSelectValue([].concat(_toConsumableArray(selectValue), [label]));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
if (searchValue) {
|
|
115
|
+
var _attrShowList = [];
|
|
116
|
+
attrShowListOriginalData.map(function (name) {
|
|
117
|
+
if (name.indexOf(searchValue) !== -1) {
|
|
118
|
+
_attrShowList.push(name);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
setAttrShowList(_attrShowList);
|
|
122
|
+
} else {
|
|
123
|
+
setAttrShowList(attrShowListOriginalData);
|
|
124
|
+
}
|
|
125
|
+
}, [searchValue]);
|
|
126
|
+
// 渲染属性列表
|
|
127
|
+
var selectAttributesRender = function selectAttributesRender() {
|
|
128
|
+
return selectAttributesData.map(function (item) {
|
|
129
|
+
if (item.id === selectEventId) {
|
|
130
|
+
return item.attrList.map(function (_item) {
|
|
131
|
+
return attrShowList.indexOf(_item.label) !== -1 ? /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
className: "".concat(selectValue.indexOf(_item.id) !== -1 ? 'active' : ''),
|
|
133
|
+
key: _item.id
|
|
134
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
135
|
+
checked: selectValue.indexOf(_item.label) !== -1,
|
|
136
|
+
onChange: function onChange() {
|
|
137
|
+
return onSelectAttributesChange(_item.label);
|
|
138
|
+
}
|
|
139
|
+
}, _item.label)) : null;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
145
|
+
title: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconFont, {
|
|
146
|
+
type: "tishi1"
|
|
147
|
+
}), "\u63D0\u793A", /*#__PURE__*/React.createElement(IconFont, {
|
|
148
|
+
type: "qingchu",
|
|
149
|
+
onClick: handleCancel
|
|
150
|
+
})),
|
|
151
|
+
wrapClassName: "".concat(classPrefix, "-modal-box"),
|
|
152
|
+
closeIcon: null,
|
|
153
|
+
open: selectAttributesShow,
|
|
154
|
+
onOk: handleOk,
|
|
155
|
+
onCancel: handleCancel
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
157
|
+
dropdownRender: function dropdownRender() {
|
|
158
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "".concat(classPrefix, "-box")
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: "".concat(classPrefix, "-box-left")
|
|
162
|
+
}, selectAttributesData.map(function (item) {
|
|
163
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
key: item.id,
|
|
165
|
+
className: "".concat(selectEventId === item.id ? 'active' : ''),
|
|
166
|
+
onClick: function onClick() {
|
|
167
|
+
return onSelectEventIdChange(item.id);
|
|
168
|
+
}
|
|
169
|
+
}, /*#__PURE__*/React.createElement("span", null, item.name), /*#__PURE__*/React.createElement("span", null, item.attrList.length));
|
|
170
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "".concat(classPrefix, "-box-right")
|
|
172
|
+
}, /*#__PURE__*/React.createElement(BizSearchInput, {
|
|
173
|
+
className: "".concat(classPrefix, "-search"),
|
|
174
|
+
onChange: function onChange(val) {
|
|
175
|
+
return setSearchValue(val);
|
|
176
|
+
},
|
|
177
|
+
placeholder: "\u641C\u7D22\u5C5E\u6027"
|
|
178
|
+
}), /*#__PURE__*/React.createElement("div", null, selectAttributesRender())));
|
|
179
|
+
},
|
|
180
|
+
trigger: ['click'],
|
|
181
|
+
overlayStyle: {
|
|
182
|
+
minWidth: 0,
|
|
183
|
+
paddingLeft: 8
|
|
184
|
+
},
|
|
185
|
+
open: visible,
|
|
186
|
+
onOpenChange: onVisibleChange,
|
|
187
|
+
getPopupContainer: props.popupContainer ? function () {
|
|
188
|
+
return document.getElementById("".concat(classPrefix, "-select"));
|
|
189
|
+
} : undefined,
|
|
190
|
+
destroyPopupOnHide: props.defaultSelectAble
|
|
191
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
className: "".concat(classPrefix, "-select"),
|
|
193
|
+
id: "".concat(classPrefix, "-select")
|
|
194
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
195
|
+
mode: "tags",
|
|
196
|
+
maxTagCount: 3,
|
|
197
|
+
maxTagTextLength: 5,
|
|
198
|
+
style: {
|
|
199
|
+
width: '100%'
|
|
200
|
+
},
|
|
201
|
+
placeholder: "Please select",
|
|
202
|
+
getPopupContainer: function getPopupContainer() {
|
|
203
|
+
return document.getElementById("".concat(classPrefix, "-select"));
|
|
204
|
+
},
|
|
205
|
+
value: selectValue,
|
|
206
|
+
onChange: handleSelectChange,
|
|
207
|
+
options: options
|
|
208
|
+
}))));
|
|
209
|
+
};
|
|
210
|
+
export default SelectAttributes;
|