@zgfe/modules-dm 1.0.18-nav.2 → 1.0.18

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;
@@ -18,7 +18,7 @@ var apis = {
18
18
  // 用户属性列表 - 修改:属性名别 | 数值类型 | 显示状态 | 加密类型
19
19
  updateUserAttr: '/analysis/api/common/proxy/data/updateUserAttr.jsp',
20
20
  // 用户属性文件上传
21
- propUpload: '/user/propUpload.jsp',
21
+ propUpload: '/analysis/api/common/proxy/user/propUpload.jsp',
22
22
  // 埋点管理&埋点方案管理 基础数据
23
23
  queryPlan: '/analysis/api/managementPlan/queryPlan',
24
24
  // 添加&修改用户属性值别名
@@ -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,36 +24,44 @@ 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];
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ loading = _useState2[0],
43
+ setLoading = _useState2[1];
44
+
35
45
  var _useContext2 = useContext(DmContext),
36
- state = _useContext2.state;
37
- // 判断是否在方案中: 处理表格class添加异常样式 | 处理表格行异常信息展示, true异常
46
+ state = _useContext2.state; // 判断是否在方案中: 处理表格class添加异常样式 | 处理表格行异常信息展示, true异常
47
+
48
+
38
49
  var rowRenderHandle = function rowRenderHandle(name) {
39
50
  if (source == 'event' && eventAttrsData.owner == 'zg_abp') {
40
51
  // 内置事件属性
41
52
  return false;
42
53
  }
54
+
43
55
  if (source == 'user') {
44
56
  var _queryPlanData$unexpe;
57
+
45
58
  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;
46
59
  } else {
47
60
  if (isOpen != 1) {
48
61
  return false;
49
62
  } else {
50
63
  var _temp2, _temp2$attrList;
64
+
51
65
  var _temp = {};
52
66
  queryPlanData.eventPlanAndRealDataDiff.map(function (item) {
53
67
  if (item.eventName == (eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_name)) _temp = item;
@@ -55,12 +69,14 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
55
69
  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;
56
70
  }
57
71
  }
58
- };
59
- // 用户属性列表
72
+ }; // 用户属性列表
73
+
74
+
60
75
  var _useState3 = useState([]),
61
- _useState4 = _slicedToArray(_useState3, 2),
62
- userAttrData = _useState4[0],
63
- setUserAttrData = _useState4[1];
76
+ _useState4 = _slicedToArray(_useState3, 2),
77
+ userAttrData = _useState4[0],
78
+ setUserAttrData = _useState4[1];
79
+
64
80
  var queryUserPropMeta = function queryUserPropMeta() {
65
81
  request(apis.getUserPropMeta, {
66
82
  method: 'post',
@@ -79,6 +95,7 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
79
95
  setLoading(false);
80
96
  }).catch(function (err) {}).finally(function () {});
81
97
  };
98
+
82
99
  useEffect(function () {
83
100
  // console.log('eventAttrsData', eventAttrsData);
84
101
  if (source == 'user') {
@@ -89,11 +106,12 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
89
106
  item.type = item.prop_type;
90
107
  return item;
91
108
  });
109
+
92
110
  setUserAttrData(_temp);
93
111
  setLoading(false);
94
112
  }
95
- }, [source, eventAttrsData]);
96
- // 复制属性名称
113
+ }, [source, eventAttrsData]); // 复制属性名称
114
+
97
115
  var copyAttrName = function copyAttrName(name) {
98
116
  if (navigator.clipboard) {
99
117
  navigator.clipboard.writeText(name);
@@ -103,24 +121,30 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
103
121
  event.preventDefault();
104
122
  event.clipboardData.setData('text/plain', name);
105
123
  };
124
+
106
125
  document.addEventListener('copy', eventCopyer);
107
126
  document.execCommand('copy');
108
127
  document.removeEventListener('copy', eventCopyer);
109
128
  message.success('复制成功');
110
129
  }
111
- };
112
- // 别名foucs
130
+ }; // 别名foucs
131
+
132
+
113
133
  var _useState5 = useState(''),
114
- _useState6 = _slicedToArray(_useState5, 2),
115
- aliasFocusData = _useState6[0],
116
- setAliasFocusData = _useState6[1];
134
+ _useState6 = _slicedToArray(_useState5, 2),
135
+ aliasFocusData = _useState6[0],
136
+ setAliasFocusData = _useState6[1];
137
+
117
138
  var aliasFocus = function aliasFocus(e) {
118
139
  setAliasFocusData(e.currentTarget.value);
119
- };
120
- // 修改属性
140
+ }; // 修改属性
141
+
142
+
121
143
  var attrChangeHandle = function attrChangeHandle(value, record, type) {
122
144
  var _params;
145
+
123
146
  if (aliasFocusData == value && type == 'alias_name') return; // 失焦判断,内容无修改不请求接口
147
+
124
148
  request(source == 'event' ? apis.updateEventAttr : apis.updateUserAttr, {
125
149
  method: 'post',
126
150
  params: (_params = {
@@ -130,16 +154,19 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
130
154
  }).then(function (res) {
131
155
  if (res) {
132
156
  message.success('修改成功');
157
+
133
158
  if (source == 'user') {
134
159
  queryUserPropMeta();
135
160
  } else {
136
161
  props.Refresh();
137
162
  }
163
+
138
164
  state.updateEventMetas && state.updateEventMetas(); // 更新store
139
165
  }
140
166
  }).catch(function (err) {}).finally(function () {});
141
- };
142
- // 表格列
167
+ }; // 表格列
168
+
169
+
143
170
  var columns = [{
144
171
  title: '属性名称',
145
172
  dataIndex: 'name',
@@ -216,6 +243,7 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
216
243
  message.error('demo环境,无法编辑');
217
244
  return;
218
245
  }
246
+
219
247
  setattrId(source == 'event' ? record.attr_id : record.id);
220
248
  setAttrAliasNameShow(true);
221
249
  }
@@ -306,8 +334,8 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
306
334
  }]
307
335
  }), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.encryption_type]));
308
336
  }
309
- }];
310
- // 属性值别名 - 表格列
337
+ }]; // 属性值别名 - 表格列
338
+
311
339
  var attrColumns = [{
312
340
  title: '属性值',
313
341
  dataIndex: 'original_value'
@@ -315,22 +343,27 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
315
343
  title: '属性值别名',
316
344
  dataIndex: 'mapping_value'
317
345
  }];
346
+
318
347
  var _useState7 = useState([]),
319
- _useState8 = _slicedToArray(_useState7, 2),
320
- attrExcelData = _useState8[0],
321
- setAttrExcelData = _useState8[1];
348
+ _useState8 = _slicedToArray(_useState7, 2),
349
+ attrExcelData = _useState8[0],
350
+ setAttrExcelData = _useState8[1];
351
+
322
352
  var _useState9 = useState(false),
323
- _useState10 = _slicedToArray(_useState9, 2),
324
- attrAliasNameShow = _useState10[0],
325
- setAttrAliasNameShow = _useState10[1];
353
+ _useState10 = _slicedToArray(_useState9, 2),
354
+ attrAliasNameShow = _useState10[0],
355
+ setAttrAliasNameShow = _useState10[1];
356
+
326
357
  var _useState11 = useState(0),
327
- _useState12 = _slicedToArray(_useState11, 2),
328
- attrId = _useState12[0],
329
- setattrId = _useState12[1];
358
+ _useState12 = _slicedToArray(_useState11, 2),
359
+ attrId = _useState12[0],
360
+ setattrId = _useState12[1];
361
+
330
362
  var _useState13 = useState(0),
331
- _useState14 = _slicedToArray(_useState13, 2),
332
- batchId = _useState14[0],
333
- setBatchId = _useState14[1];
363
+ _useState14 = _slicedToArray(_useState13, 2),
364
+ batchId = _useState14[0],
365
+ setBatchId = _useState14[1];
366
+
334
367
  var uploadProps = {
335
368
  maxCount: 1,
336
369
  showUploadList: false,
@@ -356,17 +389,19 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
356
389
  }).catch(function (err) {});
357
390
  return false;
358
391
  }
359
- };
360
- // 清空属性值别名excel数据
392
+ }; // 清空属性值别名excel数据
393
+
361
394
  var _useState15 = useState(false),
362
- _useState16 = _slicedToArray(_useState15, 2),
363
- clearFlag = _useState16[0],
364
- setClearFlag = _useState16[1];
395
+ _useState16 = _slicedToArray(_useState15, 2),
396
+ clearFlag = _useState16[0],
397
+ setClearFlag = _useState16[1];
398
+
365
399
  var clearData = function clearData() {
366
400
  setAttrExcelData([]);
367
401
  setClearFlag(true);
368
- };
369
- // 添加&修改用户属性值别名
402
+ }; // 添加&修改用户属性值别名
403
+
404
+
370
405
  var attrAliasNameEdit = function attrAliasNameEdit() {
371
406
  request(apis.addPropDict, {
372
407
  method: 'post',
@@ -384,8 +419,9 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
384
419
  setAttrAliasNameShow(false);
385
420
  }
386
421
  }).catch(function (err) {});
387
- };
388
- // 获取已设置的属性值别名列表
422
+ }; // 获取已设置的属性值别名列表
423
+
424
+
389
425
  var getAttrAliasList = function getAttrAliasList() {
390
426
  request(apis.queryPropDict, {
391
427
  method: 'post',
@@ -400,6 +436,7 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
400
436
  }
401
437
  });
402
438
  };
439
+
403
440
  useEffect(function () {
404
441
  if (attrId) {
405
442
  getAttrAliasList();
@@ -453,8 +490,10 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
453
490
  y: 200
454
491
  },
455
492
  columns: attrColumns,
493
+ rowKey: "mapping_value",
456
494
  dataSource: attrExcelData,
457
495
  pagination: false
458
496
  })));
459
497
  };
498
+
460
499
  export default CollectionAttributeList;