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