@zgfe/modules-dm 1.0.23-alpha.1 → 1.0.23-alpha.2

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',
@@ -221,6 +249,7 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
221
249
  message.error('demo环境,无法编辑');
222
250
  return;
223
251
  }
252
+
224
253
  setattrId(source == 'event' ? record.attr_id : record.id);
225
254
  setAttrAliasNameShow(true);
226
255
  }
@@ -311,8 +340,8 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
311
340
  }]
312
341
  }), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.encryption_type]));
313
342
  }
314
- }];
315
- // 属性值别名 - 表格列
343
+ }]; // 属性值别名 - 表格列
344
+
316
345
  var attrColumns = [{
317
346
  title: '属性值',
318
347
  dataIndex: 'original_value'
@@ -320,22 +349,27 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
320
349
  title: '属性值别名',
321
350
  dataIndex: 'mapping_value'
322
351
  }];
352
+
323
353
  var _useState9 = useState([]),
324
- _useState10 = _slicedToArray(_useState9, 2),
325
- attrExcelData = _useState10[0],
326
- setAttrExcelData = _useState10[1];
354
+ _useState10 = _slicedToArray(_useState9, 2),
355
+ attrExcelData = _useState10[0],
356
+ setAttrExcelData = _useState10[1];
357
+
327
358
  var _useState11 = useState(false),
328
- _useState12 = _slicedToArray(_useState11, 2),
329
- attrAliasNameShow = _useState12[0],
330
- setAttrAliasNameShow = _useState12[1];
359
+ _useState12 = _slicedToArray(_useState11, 2),
360
+ attrAliasNameShow = _useState12[0],
361
+ setAttrAliasNameShow = _useState12[1];
362
+
331
363
  var _useState13 = useState(0),
332
- _useState14 = _slicedToArray(_useState13, 2),
333
- attrId = _useState14[0],
334
- setattrId = _useState14[1];
364
+ _useState14 = _slicedToArray(_useState13, 2),
365
+ attrId = _useState14[0],
366
+ setattrId = _useState14[1];
367
+
335
368
  var _useState15 = useState(0),
336
- _useState16 = _slicedToArray(_useState15, 2),
337
- batchId = _useState16[0],
338
- setBatchId = _useState16[1];
369
+ _useState16 = _slicedToArray(_useState15, 2),
370
+ batchId = _useState16[0],
371
+ setBatchId = _useState16[1];
372
+
339
373
  var uploadProps = {
340
374
  maxCount: 1,
341
375
  showUploadList: false,
@@ -363,17 +397,19 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
363
397
  }).catch(function (err) {});
364
398
  return false;
365
399
  }
366
- };
367
- // 清空属性值别名excel数据
400
+ }; // 清空属性值别名excel数据
401
+
368
402
  var _useState17 = useState(false),
369
- _useState18 = _slicedToArray(_useState17, 2),
370
- clearFlag = _useState18[0],
371
- setClearFlag = _useState18[1];
403
+ _useState18 = _slicedToArray(_useState17, 2),
404
+ clearFlag = _useState18[0],
405
+ setClearFlag = _useState18[1];
406
+
372
407
  var clearData = function clearData() {
373
408
  setAttrExcelData([]);
374
409
  setClearFlag(true);
375
- };
376
- // 添加&修改用户属性值别名
410
+ }; // 添加&修改用户属性值别名
411
+
412
+
377
413
  var attrAliasNameEdit = function attrAliasNameEdit() {
378
414
  setValueLoading(true);
379
415
  request(apis.addPropDict, {
@@ -392,8 +428,9 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
392
428
  closeHandle();
393
429
  }
394
430
  }).catch(function (err) {});
395
- };
396
- // 获取已设置的属性值别名列表
431
+ }; // 获取已设置的属性值别名列表
432
+
433
+
397
434
  var getAttrAliasList = function getAttrAliasList() {
398
435
  setValueLoading(true);
399
436
  request(apis.queryPropDict, {
@@ -410,11 +447,13 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
410
447
  }
411
448
  });
412
449
  };
450
+
413
451
  useEffect(function () {
414
452
  if (attrId) {
415
453
  getAttrAliasList();
416
454
  }
417
455
  }, [attrId]);
456
+
418
457
  var closeHandle = function closeHandle() {
419
458
  setattrId(0);
420
459
  setAttrAliasNameShow(false);
@@ -422,6 +461,7 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
422
461
  setValueLoading(false);
423
462
  setAttrExcelData([]);
424
463
  };
464
+
425
465
  return /*#__PURE__*/React.createElement("div", {
426
466
  className: classPrefix
427
467
  }, /*#__PURE__*/React.createElement(Table, {
@@ -474,4 +514,5 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
474
514
  pagination: false
475
515
  })));
476
516
  };
517
+
477
518
  export default CollectionAttributeList;