@zgfe/modules-dm 1.0.26-alpha.2 → 1.1.0

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.
@@ -5,7 +5,6 @@ import '@zgfe/business-lib/es/assets/iconfont/iconfont.css';
5
5
  import { DemoWrapper } from '@zgfe/business-lib';
6
6
  import { ConfigProvider } from 'antd';
7
7
  import zhCN from 'antd/es/locale/zh_CN';
8
-
9
8
  var DemoWrapper2 = function DemoWrapper2(props) {
10
9
  return /*#__PURE__*/React.createElement(ConfigProvider, {
11
10
  locale: zhCN
@@ -19,5 +18,4 @@ var DemoWrapper2 = function DemoWrapper2(props) {
19
18
  needMeta: true
20
19
  }, props.children)));
21
20
  };
22
-
23
21
  export default DemoWrapper2;
@@ -47,12 +47,12 @@ var apis = {
47
47
  queryControlSwitch: '/zg/web/v2/managementPlan/queryControlSwitch',
48
48
  // 更新 埋点方案控制开关状态
49
49
  updateControlSwitch: '/zg/web/v2/managementPlan/updateControlSwitch'
50
- }; // for (const api in apis) {
50
+ };
51
+ // for (const api in apis) {
51
52
  // if (api != 'propUpload') {
52
53
  // (apis as { [prop: string]: string })[api] = `/analysis/api/${
53
54
  // (apis as { [prop: string]: string })[api]
54
55
  // }`;
55
56
  // }
56
57
  // }
57
-
58
58
  export default apis;
@@ -1,21 +1,15 @@
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); }
1
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; }
2
-
3
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
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
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
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
-
9
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."); }
10
-
11
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); }
12
-
13
- 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; }
14
-
15
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
16
-
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; } }
17
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
-
19
13
  import { BizGlobalDataContext, IconFont } from '@zgfe/business-lib';
20
14
  import { Input, Button, Select, Table, message, Modal, Upload, Popover } from 'antd';
21
15
  import React, { useEffect, useState, useContext } from 'react';
@@ -24,50 +18,41 @@ import request from '../../utils/ajax';
24
18
  import apis from '../../constants/api';
25
19
  import { DmContext } from '../../store';
26
20
  import { getAppID } from '../../utils';
27
-
28
21
  var CollectionAttributeList = function CollectionAttributeList(props) {
29
22
  var classPrefix = 'attr-list';
30
-
31
23
  var _useContext = useContext(BizGlobalDataContext),
32
- currentApp = _useContext.currentApp,
33
- isDemo = _useContext.isDemo;
34
-
24
+ currentApp = _useContext.currentApp,
25
+ isDemo = _useContext.isDemo;
35
26
  var isOpen = props.isOpen,
36
- queryPlanData = props.queryPlanData,
37
- source = props.source,
38
- eventAttrsData = props.eventAttrsData; // 属性列表加载中
39
-
27
+ queryPlanData = props.queryPlanData,
28
+ source = props.source,
29
+ eventAttrsData = props.eventAttrsData;
30
+ // 属性列表加载中
40
31
  var _useState = useState(true),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- loading = _useState2[0],
43
- setLoading = _useState2[1]; // 属性值弹窗列表加载中
44
-
45
-
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ loading = _useState2[0],
34
+ setLoading = _useState2[1];
35
+ // 属性值弹窗列表加载中
46
36
  var _useState3 = useState(false),
47
- _useState4 = _slicedToArray(_useState3, 2),
48
- valueLoading = _useState4[0],
49
- setValueLoading = _useState4[1];
50
-
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ valueLoading = _useState4[0],
39
+ setValueLoading = _useState4[1];
51
40
  var _useContext2 = useContext(DmContext),
52
- state = _useContext2.state; // 判断是否在方案中: 处理表格class添加异常样式 | 处理表格行异常信息展示, true异常
53
-
54
-
41
+ state = _useContext2.state;
42
+ // 判断是否在方案中: 处理表格class添加异常样式 | 处理表格行异常信息展示, true异常
55
43
  var rowRenderHandle = function rowRenderHandle(name) {
56
44
  if (source == 'event' && eventAttrsData.owner == 'zg_abp') {
57
45
  // 内置事件属性
58
46
  return false;
59
47
  }
60
-
61
48
  if (source == 'user') {
62
49
  var _queryPlanData$unexpe;
63
-
64
50
  return (queryPlanData === null || queryPlanData === void 0 ? void 0 : (_queryPlanData$unexpe = queryPlanData.unexpectedPropList) === null || _queryPlanData$unexpe === void 0 ? void 0 : _queryPlanData$unexpe.indexOf(name)) != -1 && isOpen == 1 ? true : false;
65
51
  } else {
66
52
  if (isOpen != 1) {
67
53
  return false;
68
54
  } else {
69
55
  var _temp2, _temp2$attrList;
70
-
71
56
  var _temp = {};
72
57
  queryPlanData.eventPlanAndRealDataDiff.map(function (item) {
73
58
  if (item.eventName == (eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_name)) _temp = item;
@@ -75,14 +60,12 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
75
60
  return Object.keys(_temp).length <= 0 ? true : ((_temp2 = _temp) === null || _temp2 === void 0 ? void 0 : (_temp2$attrList = _temp2.attrList) === null || _temp2$attrList === void 0 ? void 0 : _temp2$attrList.indexOf(name)) == -1 ? true : false;
76
61
  }
77
62
  }
78
- }; // 用户属性列表
79
-
80
-
63
+ };
64
+ // 用户属性列表
81
65
  var _useState5 = useState([]),
82
- _useState6 = _slicedToArray(_useState5, 2),
83
- userAttrData = _useState6[0],
84
- setUserAttrData = _useState6[1];
85
-
66
+ _useState6 = _slicedToArray(_useState5, 2),
67
+ userAttrData = _useState6[0],
68
+ setUserAttrData = _useState6[1];
86
69
  var queryUserPropMeta = function queryUserPropMeta() {
87
70
  request(apis.getUserPropMeta, {
88
71
  method: 'post',
@@ -101,7 +84,6 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
101
84
  setLoading(false);
102
85
  }).catch(function (err) {}).finally(function () {});
103
86
  };
104
-
105
87
  useEffect(function () {
106
88
  // console.log('eventAttrsData', eventAttrsData);
107
89
  if (source == 'user') {
@@ -112,12 +94,11 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
112
94
  item.type = item.prop_type;
113
95
  return item;
114
96
  });
115
-
116
97
  setUserAttrData(_temp);
117
98
  setLoading(false);
118
99
  }
119
- }, [source, eventAttrsData]); // 复制属性名称
120
-
100
+ }, [source, eventAttrsData]);
101
+ // 复制属性名称
121
102
  var copyAttrName = function copyAttrName(name) {
122
103
  if (navigator.clipboard) {
123
104
  navigator.clipboard.writeText(name);
@@ -127,30 +108,24 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
127
108
  event.preventDefault();
128
109
  event.clipboardData.setData('text/plain', name);
129
110
  };
130
-
131
111
  document.addEventListener('copy', eventCopyer);
132
112
  document.execCommand('copy');
133
113
  document.removeEventListener('copy', eventCopyer);
134
114
  message.success('复制成功');
135
115
  }
136
- }; // 别名foucs
137
-
138
-
116
+ };
117
+ // 别名foucs
139
118
  var _useState7 = useState(''),
140
- _useState8 = _slicedToArray(_useState7, 2),
141
- aliasFocusData = _useState8[0],
142
- setAliasFocusData = _useState8[1];
143
-
119
+ _useState8 = _slicedToArray(_useState7, 2),
120
+ aliasFocusData = _useState8[0],
121
+ setAliasFocusData = _useState8[1];
144
122
  var aliasFocus = function aliasFocus(e) {
145
123
  setAliasFocusData(e.currentTarget.value);
146
- }; // 修改属性
147
-
148
-
124
+ };
125
+ // 修改属性
149
126
  var attrChangeHandle = function attrChangeHandle(value, record, type) {
150
127
  var _params;
151
-
152
128
  if (aliasFocusData == value && type == 'alias_name') return; // 失焦判断,内容无修改不请求接口
153
-
154
129
  request(source == 'event' ? apis.updateEventAttr : apis.updateUserAttr, {
155
130
  method: 'post',
156
131
  params: (_params = {
@@ -160,19 +135,16 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
160
135
  }).then(function (res) {
161
136
  if (res) {
162
137
  message.success('修改成功');
163
-
164
138
  if (source == 'user') {
165
139
  queryUserPropMeta();
166
140
  } else {
167
141
  props.Refresh();
168
142
  }
169
-
170
143
  state.updateEventMetas && state.updateEventMetas(); // 更新store
171
144
  }
172
145
  }).catch(function (err) {}).finally(function () {});
173
- }; // 表格列
174
-
175
-
146
+ };
147
+ // 表格列
176
148
  var columns = [{
177
149
  title: '属性名称',
178
150
  dataIndex: 'name',
@@ -246,12 +218,10 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
246
218
  className: "attr_alias_name ".concat(isDemo || record.isIdMappingProp ? 'disabled' : ''),
247
219
  onClick: function onClick() {
248
220
  if (record.isIdMappingProp) return;
249
-
250
221
  if (isDemo) {
251
222
  message.error('demo环境,无法编辑');
252
223
  return;
253
224
  }
254
-
255
225
  setattrId(source == 'event' ? record.attr_id : record.id);
256
226
  setAttrAliasNameShow(true);
257
227
  }
@@ -342,8 +312,8 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
342
312
  }]
343
313
  }), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.encryption_type]));
344
314
  }
345
- }]; // 属性值别名 - 表格列
346
-
315
+ }];
316
+ // 属性值别名 - 表格列
347
317
  var attrColumns = [{
348
318
  title: '属性值',
349
319
  dataIndex: 'original_value'
@@ -351,27 +321,22 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
351
321
  title: '属性值别名',
352
322
  dataIndex: 'mapping_value'
353
323
  }];
354
-
355
324
  var _useState9 = useState([]),
356
- _useState10 = _slicedToArray(_useState9, 2),
357
- attrExcelData = _useState10[0],
358
- setAttrExcelData = _useState10[1];
359
-
325
+ _useState10 = _slicedToArray(_useState9, 2),
326
+ attrExcelData = _useState10[0],
327
+ setAttrExcelData = _useState10[1];
360
328
  var _useState11 = useState(false),
361
- _useState12 = _slicedToArray(_useState11, 2),
362
- attrAliasNameShow = _useState12[0],
363
- setAttrAliasNameShow = _useState12[1];
364
-
329
+ _useState12 = _slicedToArray(_useState11, 2),
330
+ attrAliasNameShow = _useState12[0],
331
+ setAttrAliasNameShow = _useState12[1];
365
332
  var _useState13 = useState(0),
366
- _useState14 = _slicedToArray(_useState13, 2),
367
- attrId = _useState14[0],
368
- setattrId = _useState14[1];
369
-
333
+ _useState14 = _slicedToArray(_useState13, 2),
334
+ attrId = _useState14[0],
335
+ setattrId = _useState14[1];
370
336
  var _useState15 = useState(0),
371
- _useState16 = _slicedToArray(_useState15, 2),
372
- batchId = _useState16[0],
373
- setBatchId = _useState16[1];
374
-
337
+ _useState16 = _slicedToArray(_useState15, 2),
338
+ batchId = _useState16[0],
339
+ setBatchId = _useState16[1];
375
340
  var uploadProps = {
376
341
  maxCount: 1,
377
342
  showUploadList: false,
@@ -399,19 +364,17 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
399
364
  }).catch(function (err) {});
400
365
  return false;
401
366
  }
402
- }; // 清空属性值别名excel数据
403
-
367
+ };
368
+ // 清空属性值别名excel数据
404
369
  var _useState17 = useState(false),
405
- _useState18 = _slicedToArray(_useState17, 2),
406
- clearFlag = _useState18[0],
407
- setClearFlag = _useState18[1];
408
-
370
+ _useState18 = _slicedToArray(_useState17, 2),
371
+ clearFlag = _useState18[0],
372
+ setClearFlag = _useState18[1];
409
373
  var clearData = function clearData() {
410
374
  setAttrExcelData([]);
411
375
  setClearFlag(true);
412
- }; // 添加&修改用户属性值别名
413
-
414
-
376
+ };
377
+ // 添加&修改用户属性值别名
415
378
  var attrAliasNameEdit = function attrAliasNameEdit() {
416
379
  setValueLoading(true);
417
380
  request(apis.addPropDict, {
@@ -430,9 +393,8 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
430
393
  closeHandle();
431
394
  }
432
395
  }).catch(function (err) {});
433
- }; // 获取已设置的属性值别名列表
434
-
435
-
396
+ };
397
+ // 获取已设置的属性值别名列表
436
398
  var getAttrAliasList = function getAttrAliasList() {
437
399
  setValueLoading(true);
438
400
  request(apis.queryPropDict, {
@@ -449,13 +411,11 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
449
411
  }
450
412
  });
451
413
  };
452
-
453
414
  useEffect(function () {
454
415
  if (attrId) {
455
416
  getAttrAliasList();
456
417
  }
457
418
  }, [attrId]);
458
-
459
419
  var closeHandle = function closeHandle() {
460
420
  setattrId(0);
461
421
  setAttrAliasNameShow(false);
@@ -463,7 +423,6 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
463
423
  setValueLoading(false);
464
424
  setAttrExcelData([]);
465
425
  };
466
-
467
426
  return /*#__PURE__*/React.createElement("div", {
468
427
  className: classPrefix
469
428
  }, /*#__PURE__*/React.createElement(Table, {
@@ -516,5 +475,4 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
516
475
  pagination: false
517
476
  })));
518
477
  };
519
-
520
478
  export default CollectionAttributeList;