@zgfe/modules-dm 1.0.42-alpha.8 → 1.0.56-zhongyuan.1

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.
Files changed (130) hide show
  1. package/es/components/demo.js +1 -1
  2. package/es/constants/api.d.ts +37 -0
  3. package/es/constants/api.js +62 -1
  4. package/es/index.d.ts +4 -3
  5. package/es/index.js +4 -3
  6. package/es/modules/CutsModal.d.ts +66 -0
  7. package/es/modules/CutsModal.js +52 -0
  8. package/es/modules/{dataCollection → dataManage}/collectionAttributeList.d.ts +3 -0
  9. package/es/modules/dataManage/collectionAttributeList.js +943 -0
  10. package/es/modules/{dataCollection → dataManage}/collectionEventList.d.ts +6 -0
  11. package/es/modules/dataManage/collectionEventList.js +883 -0
  12. package/es/modules/dataManage/components/createAttrDrawer.d.ts +4 -0
  13. package/es/modules/dataManage/components/createAttrDrawer.js +264 -0
  14. package/es/modules/dataManage/components/createMetaDrawer.d.ts +4 -0
  15. package/es/modules/dataManage/components/createMetaDrawer.js +618 -0
  16. package/es/modules/{dataCollection → dataManage}/components/createVirtualDrawer.js +20 -20
  17. package/es/modules/dataManage/components/creditPop/imgs/link.png +0 -0
  18. package/es/modules/dataManage/components/creditPop/imgs/png01.png +0 -0
  19. package/es/modules/dataManage/components/creditPop/imgs/png02.png +0 -0
  20. package/es/modules/dataManage/components/creditPop/imgs/png03.png +0 -0
  21. package/es/modules/dataManage/components/creditPop/imgs/png04.png +0 -0
  22. package/es/modules/dataManage/components/creditPop/index.d.ts +5 -0
  23. package/es/modules/dataManage/components/creditPop/index.js +89 -0
  24. package/es/modules/dataManage/components/creditPop/index.less +121 -0
  25. package/es/modules/dataManage/components/deleteConfirm.d.ts +9 -0
  26. package/es/modules/dataManage/components/deleteConfirm.js +36 -0
  27. package/es/modules/dataManage/components/deleteUserAttrConfirm.d.ts +9 -0
  28. package/es/modules/dataManage/components/deleteUserAttrConfirm.js +57 -0
  29. package/es/modules/dataManage/components/depositPop/imgs/link.png +0 -0
  30. package/es/modules/dataManage/components/depositPop/imgs/png01.png +0 -0
  31. package/es/modules/dataManage/components/depositPop/imgs/png02.png +0 -0
  32. package/es/modules/dataManage/components/depositPop/index.d.ts +5 -0
  33. package/es/modules/dataManage/components/depositPop/index.js +89 -0
  34. package/es/modules/dataManage/components/depositPop/index.less +115 -0
  35. package/es/modules/dataManage/components/developModal/index.css +36 -0
  36. package/es/modules/dataManage/components/developModal/index.d.ts +5 -0
  37. package/es/modules/dataManage/components/developModal/index.js +224 -0
  38. package/es/modules/dataManage/components/developModal/index.less +36 -0
  39. package/es/modules/dataManage/components/editTxt/index.d.ts +5 -0
  40. package/es/modules/dataManage/components/editTxt/index.js +123 -0
  41. package/es/modules/dataManage/components/editTxt/index.less +44 -0
  42. package/es/modules/dataManage/components/editTxt/types.d.ts +48 -0
  43. package/es/modules/{dataCollection → dataManage}/components/eventFilter/index.js +13 -13
  44. package/es/modules/{dataCollection → dataManage}/components/eventFilter/styles/index.less +1 -1
  45. package/es/modules/{dataCollection → dataManage}/components/eventGroupingDrawer.js +44 -47
  46. package/es/modules/dataManage/components/importAttrDialog/demo/index.d.ts +2 -0
  47. package/es/modules/dataManage/components/importAttrDialog/demo/index.js +28 -0
  48. package/es/modules/dataManage/components/importAttrDialog/index.d.ts +7 -0
  49. package/es/modules/dataManage/components/importAttrDialog/index.js +157 -0
  50. package/es/modules/dataManage/components/importAttrDialog/styles/index.less +90 -0
  51. package/es/modules/dataManage/components/importMetaDialog/demo/index.d.ts +2 -0
  52. package/es/modules/dataManage/components/importMetaDialog/demo/index.js +28 -0
  53. package/es/modules/dataManage/components/importMetaDialog/index.d.ts +7 -0
  54. package/es/modules/dataManage/components/importMetaDialog/index.js +157 -0
  55. package/es/modules/dataManage/components/importMetaDialog/styles/index.less +91 -0
  56. package/es/modules/{dataCollection → dataManage}/components/selectAttributes.js +10 -10
  57. package/es/modules/{dataCollection → dataManage}/components/tablePlus.d.ts +4 -0
  58. package/es/modules/dataManage/components/tablePlus.js +1207 -0
  59. package/es/modules/{dataCollection → dataManage}/components/virtualTablePlus.js +10 -10
  60. package/es/modules/dataManage/demo/index.js +79 -16
  61. package/es/modules/dataManage/detailedData/DetailedDataForm.d.ts +5 -0
  62. package/es/modules/dataManage/detailedData/DetailedDataForm.js +216 -0
  63. package/es/modules/dataManage/detailedData/index.d.ts +24 -0
  64. package/es/modules/dataManage/detailedData/index.js +403 -0
  65. package/es/modules/dataManage/detailedData/useColumns.d.ts +34 -0
  66. package/es/modules/dataManage/detailedData/useColumns.js +135 -0
  67. package/es/modules/dataManage/index.d.ts +9 -19
  68. package/es/modules/dataManage/index.js +176 -17
  69. package/es/modules/dataManage/styles/detailed.less +74 -0
  70. package/es/modules/dataManage/styles/index.less +1177 -18
  71. package/es/modules/{dataCollection → dataManage}/types.d.ts +8 -0
  72. package/es/modules/dataManage/types.js +1 -0
  73. package/es/modules/{dataCollection → dataManage}/virtualEventList.js +13 -13
  74. package/es/modules/dataMap/component/data.d.ts +7 -0
  75. package/es/modules/dataMap/component/data.js +257 -0
  76. package/es/modules/dataMap/component/drawerAdd.d.ts +6 -0
  77. package/es/modules/dataMap/component/drawerAdd.js +376 -0
  78. package/es/modules/dataMap/component/leftTree.d.ts +6 -0
  79. package/es/modules/dataMap/component/leftTree.js +227 -0
  80. package/es/modules/dataMap/component/rightDetail.d.ts +7 -0
  81. package/es/modules/dataMap/component/rightDetail.js +680 -0
  82. package/es/modules/dataMap/component/selectAttr.d.ts +7 -0
  83. package/es/modules/dataMap/component/selectAttr.js +92 -0
  84. package/es/modules/dataMap/css/index.css +163 -0
  85. package/es/modules/dataMap/css/index.less +177 -0
  86. package/es/modules/dataMap/demo/index.d.ts +2 -0
  87. package/es/modules/dataMap/demo/index.js +6 -0
  88. package/es/modules/dataMap/img/empty-data.png +0 -0
  89. package/es/modules/dataMap/index.d.ts +2 -0
  90. package/es/modules/dataMap/index.js +80 -0
  91. package/es/modules/dataMap/mapDetail.d.ts +3 -0
  92. package/es/modules/dataMap/mapDetail.js +44 -0
  93. package/es/modules/dataMap/mapSetting.d.ts +6 -0
  94. package/es/modules/dataMap/mapSetting.js +148 -0
  95. package/es/modules/dataPlan/addEventOrUser.js +31 -30
  96. package/es/modules/dataPlan/addPlan.js +29 -27
  97. package/es/modules/dataPlan/eventList.js +2 -2
  98. package/es/modules/dataPlan/index.js +10 -10
  99. package/es/modules/dataPlan/search.js +6 -5
  100. package/es/modules/dataPlan/tablePlus.js +3 -3
  101. package/es/modules/dataPlan/userAttributeList.js +5 -5
  102. package/es/modules/dataReal/css/index.css +48 -0
  103. package/es/modules/dataReal/css/index.less +51 -0
  104. package/es/modules/dataReal/demo/index.d.ts +2 -0
  105. package/es/modules/dataReal/demo/index.js +6 -0
  106. package/es/modules/dataReal/index1.d.ts +28 -0
  107. package/es/modules/dataReal/index1.js +215 -0
  108. package/es/modules/dataReal/table.d.ts +5 -0
  109. package/es/modules/dataReal/table.js +258 -0
  110. package/es/store/index.js +11 -11
  111. package/es/utils/index.d.ts +1 -0
  112. package/es/utils/index.js +9 -1
  113. package/package.json +8 -4
  114. package/es/modules/dataCollection/collectionAttributeList.js +0 -508
  115. package/es/modules/dataCollection/collectionEventList.js +0 -466
  116. package/es/modules/dataCollection/components/tablePlus.js +0 -676
  117. package/es/modules/dataCollection/index.d.ts +0 -19
  118. package/es/modules/dataCollection/index.js +0 -93
  119. package/es/modules/dataCollection/styles/index.less +0 -842
  120. /package/es/modules/{dataCollection → dataManage}/components/createVirtualDrawer.d.ts +0 -0
  121. /package/es/modules/{dataCollection/components/eventFilter → dataManage/components/editTxt}/types.js +0 -0
  122. /package/es/modules/{dataCollection → dataManage}/components/eventFilter/index.d.ts +0 -0
  123. /package/es/modules/{dataCollection → dataManage}/components/eventFilter/types.d.ts +0 -0
  124. /package/es/modules/{dataCollection → dataManage/components/eventFilter}/types.js +0 -0
  125. /package/es/modules/{dataCollection → dataManage}/components/eventGroupingDrawer.d.ts +0 -0
  126. /package/es/modules/{dataCollection → dataManage}/components/eventItem.d.ts +0 -0
  127. /package/es/modules/{dataCollection → dataManage}/components/eventItem.js +0 -0
  128. /package/es/modules/{dataCollection → dataManage}/components/selectAttributes.d.ts +0 -0
  129. /package/es/modules/{dataCollection → dataManage}/components/virtualTablePlus.d.ts +0 -0
  130. /package/es/modules/{dataCollection → dataManage}/virtualEventList.d.ts +0 -0
package/es/store/index.js CHANGED
@@ -1,15 +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); }
2
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
3
  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."); }
4
- 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); }
5
- 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; }
6
- 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; } }
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
- 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; }
9
- 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; }
10
- 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; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- 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
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
13
  import { useReducer, createContext } from 'react';
14
14
  import { initState } from './state';
15
15
  import { ActionType } from './action';
@@ -54,3 +54,4 @@ export declare const nullToEmptyString: (data: any) => any;
54
54
  * @param {*} id 当前页面中有多个table时需要制定table的id
55
55
  */
56
56
  export declare function getTableScroll(extraHeight?: any, id?: any): string;
57
+ export declare const guid: () => string;
package/es/utils/index.js CHANGED
@@ -40,6 +40,8 @@ export var getVirtualContentChange = function getVirtualContentChange(oldData, n
40
40
  if (oldData.eventName != newData.eventName) {
41
41
  return true;
42
42
  }
43
+ //数据兼容,部分数据返回的是null,应统一使用 -1,做未分组情况的判断
44
+ if (oldData.groupId === null) oldData.groupId = -1;
43
45
  if (oldData.groupId != newData.eventGroupId) {
44
46
  return true;
45
47
  }
@@ -347,4 +349,10 @@ export function getTableScroll(extraHeight, id) {
347
349
  // let height = document.body.clientHeight - tHeaderBottom - extraHeight
348
350
  var height = "calc(100vh - ".concat(tHeaderBottom + extraHeight, "px)");
349
351
  return height;
350
- }
352
+ }
353
+ export var guid = function guid() {
354
+ function s4() {
355
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
356
+ }
357
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
358
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-dm",
3
- "version": "1.0.42-alpha.8",
3
+ "version": "1.0.56-zhongyuan.1",
4
4
  "license": "ISC",
5
5
  "module": "es/index.js",
6
6
  "typings": "es/index.d.ts",
@@ -28,7 +28,12 @@
28
28
  ]
29
29
  },
30
30
  "dependencies": {
31
+ "@types/lodash-es": "^4.17.12",
32
+ "@visactor/react-vtable": "^1.12.0",
33
+ "@visactor/vtable": "^1.12.0",
31
34
  "array-move": "^4.0.0",
35
+ "lodash-es": "^4.17.21",
36
+ "moment": "^2.30.1",
32
37
  "react": "^16.12.0 || ^17.0.0",
33
38
  "react-sortable-hoc": "^2.0.0"
34
39
  },
@@ -39,19 +44,18 @@
39
44
  "@types/lodash": "^4.14.182",
40
45
  "@umijs/fabric": "^2.8.1",
41
46
  "@umijs/test": "^3.0.5",
42
- "@zgfe/business-lib": "1.2.3-heyh.1",
47
+ "@zgfe/business-lib": "1.2.70-hxd.1",
43
48
  "antd": "4.24.10",
44
49
  "dumi": "^1.1.0",
45
50
  "father-build": "^1.17.2",
46
51
  "gh-pages": "^3.0.0",
47
52
  "lerna": "^4.0.0",
48
53
  "lint-staged": "^10.0.7",
49
- "lodash": "^4.17.21",
50
54
  "prettier": "^2.2.1",
51
55
  "umi-request": "^1.4.0",
52
56
  "yorkie": "^2.0.0"
53
57
  },
54
- "gitHead": "951170e644a46fd388269e91dea5d98e9f52bb2b",
58
+ "gitHead": "a358e3ffa8b44e9ce46e788f59aa7d2dee507b67",
55
59
  "gitHooks": {
56
60
  "pre-commit": "lint-staged"
57
61
  }
@@ -1,508 +0,0 @@
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, ajax } from '@zgfe/business-lib';
14
- import { Input, Button, Select, Table, message, Modal, Upload, Popover } from 'antd';
15
- import React, { useEffect, useState, useContext } from 'react';
16
- import './styles/index.less';
17
- import request from '../../utils/ajax';
18
- import apis from '../../constants/api';
19
- import { DmContext } from '../../store';
20
- import { getAppID } from '../../utils';
21
- var CollectionAttributeList = function CollectionAttributeList(props) {
22
- var classPrefix = 'attr-list';
23
- var _useContext = useContext(BizGlobalDataContext),
24
- currentApp = _useContext.currentApp,
25
- isDemo = _useContext.isDemo;
26
- var isOpen = props.isOpen,
27
- queryPlanData = props.queryPlanData,
28
- source = props.source,
29
- eventAttrsData = props.eventAttrsData;
30
- // 属性列表加载中
31
- var _useState = useState(true),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- loading = _useState2[0],
34
- setLoading = _useState2[1];
35
- // 属性值弹窗列表加载中
36
- var _useState3 = useState(false),
37
- _useState4 = _slicedToArray(_useState3, 2),
38
- valueLoading = _useState4[0],
39
- setValueLoading = _useState4[1];
40
- var _useContext2 = useContext(DmContext),
41
- state = _useContext2.state;
42
- // 内置属性(名称, 用户id)可编辑加密状态
43
- var uniqueAttrs = ['name', 'app_user_id'];
44
- // 判断是否在方案中: 处理表格class添加异常样式 | 处理表格行异常信息展示, true异常
45
- var rowRenderHandle = function rowRenderHandle(name) {
46
- if (source == 'event' && eventAttrsData.owner == 'zg_abp') {
47
- // 内置事件属性
48
- return false;
49
- }
50
- if (source == 'user') {
51
- var _queryPlanData$unexpe;
52
- 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;
53
- } else {
54
- if (isOpen != 1) {
55
- return false;
56
- } else {
57
- var _temp2, _temp2$attrList;
58
- var _temp = {};
59
- queryPlanData.eventPlanAndRealDataDiff.map(function (item) {
60
- if (item.eventName == (eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_name)) _temp = item;
61
- });
62
- 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;
63
- }
64
- }
65
- };
66
- // 用户属性列表
67
- var _useState5 = useState([]),
68
- _useState6 = _slicedToArray(_useState5, 2),
69
- userAttrData = _useState6[0],
70
- setUserAttrData = _useState6[1];
71
- var queryUserPropMeta = function queryUserPropMeta() {
72
- request(apis.getUserPropMeta, {
73
- method: 'post',
74
- data: {
75
- appId: getAppID(currentApp),
76
- platform: 0
77
- }
78
- }).then(function (res) {
79
- if (!res) throw new Error();
80
- var afterData = res.data.filter(function (item) {
81
- if (item.dimension_sub == 'user_attr' || uniqueAttrs.includes(item.dimension_sub)) {
82
- return item;
83
- }
84
- });
85
- setUserAttrData(afterData);
86
- setLoading(false);
87
- });
88
- };
89
- useEffect(function () {
90
- if (source == 'user') {
91
- queryUserPropMeta();
92
- } else {
93
- var _temp = eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_attrs.map(function (item) {
94
- item.name = item.attr_name;
95
- item.type = item.prop_type;
96
- return item;
97
- });
98
- setUserAttrData(_temp);
99
- setLoading(false);
100
- }
101
- }, [source, eventAttrsData]);
102
- // 复制属性名称
103
- var copyAttrName = function copyAttrName(name) {
104
- if (navigator.clipboard) {
105
- navigator.clipboard.writeText(name);
106
- message.success('复制成功');
107
- } else {
108
- var eventCopyer = function eventCopyer(event) {
109
- event.preventDefault();
110
- event.clipboardData.setData('text/plain', name);
111
- };
112
- document.addEventListener('copy', eventCopyer);
113
- document.execCommand('copy');
114
- document.removeEventListener('copy', eventCopyer);
115
- message.success('复制成功');
116
- }
117
- };
118
- // 别名foucs
119
- var _useState7 = useState(''),
120
- _useState8 = _slicedToArray(_useState7, 2),
121
- aliasFocusData = _useState8[0],
122
- setAliasFocusData = _useState8[1];
123
- var aliasFocus = function aliasFocus(e) {
124
- setAliasFocusData(e.currentTarget.value);
125
- };
126
- // 修改属性
127
- var attrChangeHandle = function attrChangeHandle(value, record, type) {
128
- if (aliasFocusData == value && type == 'alias_name') return; // 失焦判断,内容无修改不请求接口
129
- if (source == 'event') {
130
- var _data;
131
- request(apis.updateEventAttr, {
132
- method: 'post',
133
- data: (_data = {
134
- appId: getAppID(currentApp),
135
- attrId: record.attr_id
136
- }, _defineProperty(_data, type, value), _defineProperty(_data, "eventId", eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id), _data)
137
- }).then(function (res) {
138
- if (res) {
139
- message.success('修改成功');
140
- props.Refresh();
141
- state.updateEventMetas && state.updateEventMetas(); // 更新store
142
- }
143
- });
144
- } else {
145
- var _params;
146
- request(apis.updateUserAttr, {
147
- method: 'post',
148
- params: (_params = {
149
- app_id: getAppID(currentApp),
150
- attr_id: record.id
151
- }, _defineProperty(_params, type, value), _defineProperty(_params, "event_id", null), _params)
152
- }).then(function (res) {
153
- if (res) {
154
- message.success('修改成功');
155
- queryUserPropMeta();
156
- state.updateEventMetas && state.updateEventMetas(); // 更新store
157
- }
158
- });
159
- }
160
- };
161
- // 表格列
162
- var columns = [{
163
- title: '属性名称',
164
- dataIndex: 'name',
165
- width: 200,
166
- render: function render(text, record, index) {
167
- return /*#__PURE__*/React.createElement("div", {
168
- className: "attr-name"
169
- }, rowRenderHandle(record.name) && /*#__PURE__*/React.createElement(Popover, {
170
- content: /*#__PURE__*/React.createElement("div", {
171
- style: {
172
- color: 'red'
173
- }
174
- }, "\u4E0D\u5728\u65B9\u6848\u4E2D")
175
- }, /*#__PURE__*/React.createElement(IconFont, {
176
- type: "tishiicon"
177
- })), /*#__PURE__*/React.createElement(Popover, {
178
- content: text
179
- }, /*#__PURE__*/React.createElement("span", {
180
- className: "attr-name-text"
181
- }, text)), /*#__PURE__*/React.createElement(IconFont, {
182
- onClick: function onClick() {
183
- return copyAttrName(record.name);
184
- },
185
- type: "fuzhi"
186
- }));
187
- }
188
- }, {
189
- title: '别名',
190
- dataIndex: 'alias_name',
191
- width: 180,
192
- render: function render(text, record, index) {
193
- if (!record.alias_name) {
194
- return /*#__PURE__*/React.createElement(Input, {
195
- className: "alias_name",
196
- placeholder: "\u7F16\u8F91\u522B\u540D",
197
- disabled: isDemo || record.isIdMappingProp || record.category === 'fixed',
198
- defaultValue: record.alias_name,
199
- onFocus: aliasFocus,
200
- onBlur: function onBlur(e) {
201
- attrChangeHandle(e.currentTarget.value, record, 'alias_name');
202
- }
203
- });
204
- } else {
205
- return /*#__PURE__*/React.createElement(Popover, {
206
- content: /*#__PURE__*/React.createElement("div", {
207
- style: {
208
- width: '200px',
209
- wordBreak: 'break-all'
210
- }
211
- }, record.alias_name),
212
- trigger: "hover",
213
- placement: "top"
214
- }, /*#__PURE__*/React.createElement(Input, {
215
- className: "alias_name",
216
- placeholder: "\u7F16\u8F91\u522B\u540D",
217
- disabled: isDemo || record.isIdMappingProp || record.category === 'fixed',
218
- defaultValue: record.alias_name,
219
- onFocus: aliasFocus,
220
- onBlur: function onBlur(e) {
221
- attrChangeHandle(e.currentTarget.value, record, 'alias_name');
222
- }
223
- }));
224
- }
225
- }
226
- }, {
227
- title: '属性值别名',
228
- dataIndex: 'attr_alias_name',
229
- width: 120,
230
- render: function render(text, record, index) {
231
- return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("span", {
232
- className: "attr_alias_name ".concat(isDemo || record.isIdMappingProp || record.category === 'fixed' ? 'disabled' : ''),
233
- onClick: function onClick() {
234
- if (record.isIdMappingProp || record.category === 'fixed') return;
235
- if (isDemo) {
236
- message.error('demo环境,无法编辑');
237
- return;
238
- }
239
- setattrId(source == 'event' ? record.attr_id : record.id);
240
- setAttrAliasNameShow(true);
241
- }
242
- }, "\u7F16\u8F91"));
243
- }
244
- }, {
245
- title: '属性类型',
246
- dataIndex: 'type',
247
- width: 120,
248
- render: function render(text, record, index) {
249
- var json = {
250
- 1: '字符串',
251
- 2: '数值',
252
- 3: '日期'
253
- };
254
- return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && /*#__PURE__*/React.createElement(Select, {
255
- defaultValue: record.type,
256
- style: {
257
- width: '100%'
258
- },
259
- disabled: isDemo || record.isIdMappingProp || record.category === 'fixed',
260
- onChange: function onChange(e) {
261
- return attrChangeHandle(e, record, 'type');
262
- },
263
- options: [{
264
- value: 1,
265
- label: '字符串'
266
- }, {
267
- value: 2,
268
- label: '数值'
269
- }, {
270
- value: 3,
271
- label: '日期'
272
- }]
273
- }), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.type]));
274
- }
275
- }, {
276
- title: '显示状态',
277
- dataIndex: 'hidden',
278
- width: 120,
279
- render: function render(text, record, index) {
280
- return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && /*#__PURE__*/React.createElement(Select, {
281
- defaultValue: record.hidden || 0,
282
- style: {
283
- width: '100%'
284
- },
285
- disabled: isDemo || record.isIdMappingProp || record.category === 'fixed',
286
- onChange: function onChange(e) {
287
- return attrChangeHandle(e, record, 'hidden');
288
- },
289
- options: [{
290
- value: 1,
291
- label: '隐藏'
292
- }, {
293
- value: 0,
294
- label: '显示'
295
- }]
296
- }), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, record.hidden == 1 ? '隐藏' : '显示'));
297
- }
298
- }, {
299
- title: '加密',
300
- dataIndex: 'encryption_type',
301
- width: 120,
302
- render: function render(text, record, index) {
303
- var json = {
304
- 0: '不加密',
305
- 1: '半加密',
306
- 2: '全加密'
307
- };
308
- return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && /*#__PURE__*/React.createElement(Select, {
309
- defaultValue: record.encryption_type,
310
- style: {
311
- width: '100%'
312
- },
313
- disabled: isDemo || record.isIdMappingProp,
314
- onChange: function onChange(e) {
315
- return attrChangeHandle(e, record, 'encryption_type');
316
- },
317
- options: [{
318
- value: 0,
319
- label: '不加密'
320
- }, {
321
- value: 1,
322
- label: '半加密'
323
- }, {
324
- value: 2,
325
- label: '全加密'
326
- }]
327
- }), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.encryption_type]));
328
- }
329
- }];
330
- // 属性值别名 - 表格列
331
- var attrColumns = [{
332
- title: '属性值',
333
- dataIndex: 'original_value'
334
- }, {
335
- title: '属性值别名',
336
- dataIndex: 'mapping_value'
337
- }];
338
- var _useState9 = useState([]),
339
- _useState10 = _slicedToArray(_useState9, 2),
340
- attrExcelData = _useState10[0],
341
- setAttrExcelData = _useState10[1];
342
- var _useState11 = useState(false),
343
- _useState12 = _slicedToArray(_useState11, 2),
344
- attrAliasNameShow = _useState12[0],
345
- setAttrAliasNameShow = _useState12[1];
346
- var _useState13 = useState(0),
347
- _useState14 = _slicedToArray(_useState13, 2),
348
- attrId = _useState14[0],
349
- setattrId = _useState14[1];
350
- var _useState15 = useState(0),
351
- _useState16 = _slicedToArray(_useState15, 2),
352
- batchId = _useState16[0],
353
- setBatchId = _useState16[1];
354
- var _useState17 = useState(false),
355
- _useState18 = _slicedToArray(_useState17, 2),
356
- exportAliasTmp = _useState18[0],
357
- setExportAliasTmp = _useState18[1];
358
- var uploadProps = {
359
- maxCount: 1,
360
- showUploadList: false,
361
- beforeUpload: function beforeUpload(file) {
362
- setValueLoading(true);
363
- var formData = new FormData();
364
- formData.append('file', file, file.name);
365
- var data = new FormData();
366
- data.append('upload', file);
367
- data.append('attr_id', attrId);
368
- data.append('app_id', getAppID(currentApp));
369
- source == 'event' ? data.append('event_id', eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id) : null;
370
- request(apis.propUpload, {
371
- method: 'post',
372
- data: data
373
- }).then(function (res) {
374
- if (res.code == 10001) {
375
- message.success('上传成功');
376
- setBatchId(res.batch_id);
377
- setAttrExcelData(res.values);
378
- setValueLoading(false);
379
- } else {
380
- message.error(res.msg);
381
- }
382
- });
383
- return false;
384
- }
385
- };
386
- // 清空属性值别名excel数据
387
- var _useState19 = useState(false),
388
- _useState20 = _slicedToArray(_useState19, 2),
389
- clearFlag = _useState20[0],
390
- setClearFlag = _useState20[1];
391
- var clearData = function clearData() {
392
- setAttrExcelData([]);
393
- setClearFlag(true);
394
- };
395
- // 添加&修改用户属性值别名
396
- var attrAliasNameEdit = function attrAliasNameEdit() {
397
- setValueLoading(true);
398
- request(apis.addPropDict, {
399
- method: 'post',
400
- params: {
401
- app_id: getAppID(currentApp),
402
- attr_id: attrId,
403
- batch_id: batchId,
404
- event_id: source == 'event' ? eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id : null,
405
- status: 'ok',
406
- clear: clearFlag
407
- }
408
- }).then(function (res) {
409
- if (res) {
410
- message.success('操作成功');
411
- closeHandle();
412
- }
413
- });
414
- };
415
- // 获取已设置的属性值别名列表
416
- var getAttrAliasList = function getAttrAliasList() {
417
- setValueLoading(true);
418
- request(apis.queryPropDict, {
419
- method: 'post',
420
- params: {
421
- app_id: getAppID(currentApp),
422
- attr_id: attrId,
423
- event_id: source == 'event' ? eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id : null
424
- }
425
- }).then(function (res) {
426
- if (res) {
427
- setAttrExcelData(res.values);
428
- setValueLoading(false);
429
- }
430
- });
431
- };
432
- useEffect(function () {
433
- if (attrId) {
434
- getAttrAliasList();
435
- }
436
- }, [attrId]);
437
- var closeHandle = function closeHandle() {
438
- setattrId(0);
439
- setAttrAliasNameShow(false);
440
- setClearFlag(false);
441
- setValueLoading(false);
442
- setAttrExcelData([]);
443
- };
444
- return /*#__PURE__*/React.createElement("div", {
445
- className: classPrefix
446
- }, /*#__PURE__*/React.createElement(Table, {
447
- className: "".concat(classPrefix, "-table"),
448
- columns: columns,
449
- rowKey: "name",
450
- loading: loading,
451
- scroll: {
452
- y: 550
453
- },
454
- rowClassName: function rowClassName(record, index) {
455
- return rowRenderHandle(record.name) ? 'error-row' : '';
456
- },
457
- dataSource: userAttrData,
458
- pagination: false
459
- }), /*#__PURE__*/React.createElement(Modal, {
460
- title: "\u5C5E\u6027\u503C\u522B\u540D",
461
- getContainer: false,
462
- open: attrAliasNameShow,
463
- onOk: attrAliasNameEdit,
464
- onCancel: closeHandle
465
- }, /*#__PURE__*/React.createElement("div", {
466
- className: "button-box"
467
- }, /*#__PURE__*/React.createElement(Upload, _objectSpread({}, uploadProps), /*#__PURE__*/React.createElement(Button, {
468
- size: "small",
469
- icon: /*#__PURE__*/React.createElement(IconFont, {
470
- type: "daochu1"
471
- })
472
- }, "\u4E0A\u4F20 excel \u6587\u4EF6")), /*#__PURE__*/React.createElement(Button, {
473
- loading: exportAliasTmp,
474
- icon: /*#__PURE__*/React.createElement(IconFont, {
475
- type: "xiazai1"
476
- }),
477
- size: "small",
478
- onClick: function onClick() {
479
- setExportAliasTmp(true);
480
- ajax(apis.exportAliasTmp, {
481
- method: 'get',
482
- responseType: 'blob',
483
- fileName: "".concat(source == 'user' ? '用户' : '事件', "\u5C5E\u6027\u503C\u6A21\u677F"),
484
- getResponse: true,
485
- params: {
486
- fileName: '事件属性值模板.xlsx'
487
- }
488
- }).finally(function () {
489
- setExportAliasTmp(false);
490
- });
491
- }
492
- }, "\u6A21\u677F\u4E0B\u8F7D")), attrExcelData.length > 0 && /*#__PURE__*/React.createElement("div", {
493
- className: "clearData",
494
- onClick: clearData
495
- }, /*#__PURE__*/React.createElement(IconFont, {
496
- type: "qingchu"
497
- }), "\u6E05\u7A7A\u6570\u636E"), /*#__PURE__*/React.createElement(Table, {
498
- scroll: {
499
- y: 200
500
- },
501
- loading: valueLoading,
502
- columns: attrColumns,
503
- rowKey: "mapping_value",
504
- dataSource: attrExcelData,
505
- pagination: false
506
- })));
507
- };
508
- export default CollectionAttributeList;