@zgfe/modules-dm 1.0.57-zhongyuan.8 → 1.0.57-zhongyuan.80

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 (33) hide show
  1. package/es/constants/api.d.ts +9 -1
  2. package/es/constants/api.js +11 -2
  3. package/es/modules/CutsModal.d.ts +8 -0
  4. package/es/modules/clearRule/addRule.d.ts +1 -0
  5. package/es/modules/clearRule/addRule.js +313 -171
  6. package/es/modules/clearRule/css/index.css +265 -256
  7. package/es/modules/clearRule/css/index.less +279 -270
  8. package/es/modules/clearRule/index.js +172 -89
  9. package/es/modules/dataManage/collectionAttributeList.d.ts +2 -0
  10. package/es/modules/dataManage/collectionAttributeList.js +56 -29
  11. package/es/modules/dataManage/collectionEventList.js +72 -21
  12. package/es/modules/dataManage/components/createMetaDrawer.js +98 -9
  13. package/es/modules/dataManage/components/developModal/index.js +5 -5
  14. package/es/modules/dataManage/components/eventFilter/index.js +7 -5
  15. package/es/modules/dataManage/components/eventGroupingDrawer.js +1 -4
  16. package/es/modules/dataManage/components/panelList.js +4 -2
  17. package/es/modules/dataManage/components/tablePlus.d.ts +8 -0
  18. package/es/modules/dataManage/components/tablePlus.js +364 -163
  19. package/es/modules/dataManage/detailedData/useColumns.js +1 -1
  20. package/es/modules/dataManage/styles/index.less +1210 -1205
  21. package/es/modules/dataManage/types.d.ts +4 -0
  22. package/es/modules/dataMap/component/drawerAdd.js +3 -2
  23. package/es/modules/dataMap/component/leftTree.js +7 -5
  24. package/es/modules/dataMap/component/rightDetail.js +94 -57
  25. package/es/modules/dataPlan/addPlan.js +5 -4
  26. package/es/modules/formulateRule/addFormulate.d.ts +1 -0
  27. package/es/modules/formulateRule/addFormulate.js +141 -36
  28. package/es/modules/formulateRule/addRule.d.ts +2 -0
  29. package/es/modules/formulateRule/addRule.js +201 -27
  30. package/es/modules/formulateRule/index.js +108 -64
  31. package/es/utils/index.d.ts +2 -0
  32. package/es/utils/index.js +9 -0
  33. package/package.json +3 -3
@@ -84,3 +84,7 @@ export interface CreateMetaDrawerProps {
84
84
  }
85
85
  export interface DevelopModelProps {
86
86
  }
87
+ export interface eventTag {
88
+ label: string;
89
+ value: number;
90
+ }
@@ -33,7 +33,8 @@ var DrawerAdd = function DrawerAdd(props) {
33
33
  name: ''
34
34
  };
35
35
  var _useContext = useContext(BizGlobalDataContext),
36
- currentApp = _useContext.currentApp;
36
+ currentApp = _useContext.currentApp,
37
+ envs = _useContext.envs;
37
38
  // 关闭抽屉并重置表单
38
39
  useEffect(function () {
39
40
  setIsOpen(props.open);
@@ -304,7 +305,7 @@ var DrawerAdd = function DrawerAdd(props) {
304
305
  eventIdList: [event.id],
305
306
  onChange: onChangeFilters,
306
307
  onConditionsCount: setCount
307
- }), count < 10 ? (/*#__PURE__*/React.createElement(Link, {
308
+ }), count < ((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 10) ? (/*#__PURE__*/React.createElement(Link, {
308
309
  target: "_blank",
309
310
  onClick: function onClick() {
310
311
  return onAdd();
@@ -20,6 +20,7 @@ import { mapContext } from '../../CutsModal';
20
20
  import { ValuesList, BizGlobalDataContext } from '@zgfe/business-lib';
21
21
  import apis from '../../../constants/api';
22
22
  import request from '../../../utils/ajax';
23
+ var DirectoryTree = Tree.DirectoryTree;
23
24
  var pageClassName = 'leftTreePage';
24
25
  var LeftTree = function LeftTree(props) {
25
26
  var _mapData$, _mapData$2;
@@ -190,7 +191,7 @@ var LeftTree = function LeftTree(props) {
190
191
  }), "\u57CB\u70B9\u5730\u56FE")
191
192
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
192
193
  placeholder: "\u8BF7\u9009\u62E9\u5730\u56FE",
193
- allowClear: true,
194
+ // allowClear
194
195
  value: currentMap.id,
195
196
  fieldNames: {
196
197
  label: 'mapName',
@@ -232,17 +233,18 @@ var LeftTree = function LeftTree(props) {
232
233
  }
233
234
  }, /*#__PURE__*/React.createElement(Spin, {
234
235
  tip: "\u67E5\u8BE2\u4E2D"
235
- }))) : (/*#__PURE__*/React.createElement(Tree, {
236
+ }))) : (/*#__PURE__*/React.createElement(DirectoryTree, {
236
237
  blockNode: true,
237
- showLine: true,
238
+ // showLine={{showLeafIcon:false}}
239
+ showLine: false,
240
+ showIcon: false,
238
241
  switcherIcon: /*#__PURE__*/React.createElement(CaretDownOutlined, {
239
242
  onPointerEnterCapture: undefined,
240
243
  onPointerLeaveCapture: undefined
241
244
  }),
242
245
  autoExpandParent: true,
243
246
  selectedKeys: [(currentTree === null || currentTree === void 0 ? void 0 : currentTree.key) || ''],
244
- expandedKeys: [(currentTree === null || currentTree === void 0 ? void 0 : currentTree.key) || ''],
245
- defaultExpandedKeys: [(currentTree === null || currentTree === void 0 ? void 0 : currentTree.key) || ''],
247
+ multiple: true,
246
248
  onSelect: onSelect,
247
249
  fieldNames: {
248
250
  title: 'pageAttrName'
@@ -21,6 +21,7 @@ import { Card, Form, Input, Upload, message, Table, Button, Space, Empty, Spin }
21
21
  import { LoadingOutlined, PlusOutlined, SlidersTwoTone } from '@ant-design/icons';
22
22
  import React, { useState, useContext, useEffect } from 'react';
23
23
  import { IconFont, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
24
+ import { fetchEventAttrs } from '@zgfe/business-lib/es/utils/eventApi';
24
25
  import apis from '../../../constants/api';
25
26
  import request from '../../../utils/ajax';
26
27
  import { guid } from '../../../utils/index';
@@ -264,7 +265,7 @@ var RightDetail = function RightDetail(props) {
264
265
  }();
265
266
  var handleButtonPage = /*#__PURE__*/function () {
266
267
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(flag) {
267
- var filterJsonList, obj, xifenList, attrFilterJsonList, modulePageJsonList, _eventNameMap$current, _eventNameMap$current2, _eventNameMap$current3, _eventNameMap$current4, moduleAttrObj, pageAttrObj, _obj, obj1, allFilterObj, globalDimensionsList, resultParams;
268
+ var filterJsonList, obj, xifenList, attrFilterJsonList, modulePageJsonList, _attrListApi$filter, _attrListApi$filter2, attrListApi, moduleAttrObj, pageAttrObj, _obj, obj1, allFilterObj, globalDimensionsList, resultParams;
268
269
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
269
270
  while (1) switch (_context3.prev = _context3.next) {
270
271
  case 0:
@@ -300,55 +301,65 @@ var RightDetail = function RightDetail(props) {
300
301
  });
301
302
  // page module 的值拼接
302
303
  modulePageJsonList = [];
303
- if (eventNameMap && (currentMap === null || currentMap === void 0 ? void 0 : currentMap.eventName)) {
304
- moduleAttrObj = (_eventNameMap$current = eventNameMap[currentMap === null || currentMap === void 0 ? void 0 : currentMap.eventName]) === null || _eventNameMap$current === void 0 ? void 0 : (_eventNameMap$current2 = _eventNameMap$current.attrList.filter(function (o) {
305
- return o.label == (currentMap === null || currentMap === void 0 ? void 0 : currentMap.moduleAttrName);
306
- })) === null || _eventNameMap$current2 === void 0 ? void 0 : _eventNameMap$current2[0];
307
- pageAttrObj = (_eventNameMap$current3 = eventNameMap[currentMap === null || currentMap === void 0 ? void 0 : currentMap.eventName]) === null || _eventNameMap$current3 === void 0 ? void 0 : (_eventNameMap$current4 = _eventNameMap$current3.attrList.filter(function (o) {
308
- return o.label == (currentMap === null || currentMap === void 0 ? void 0 : currentMap.pageAttrName);
309
- })) === null || _eventNameMap$current4 === void 0 ? void 0 : _eventNameMap$current4[0];
310
- if (moduleAttrObj) {
311
- _obj = {
312
- attrId: moduleAttrObj.id,
313
- attrName: moduleAttrObj.label,
314
- dimensionSub: moduleAttrObj.dimensionSub,
315
- label: moduleAttrObj.label,
316
- operator: 'equal',
317
- propCategory: 'eventProp',
318
- type: moduleAttrObj.type,
319
- values: moduleAttrObj === null || moduleAttrObj === void 0 ? void 0 : moduleAttrObj.values
320
- };
321
- modulePageJsonList.push(_obj);
322
- }
323
- if (pageAttrObj) {
324
- obj1 = {
325
- attrId: pageAttrObj.id,
326
- attrName: pageAttrObj.label,
327
- dimensionSub: pageAttrObj.dimensionSub,
328
- label: pageAttrObj.label,
329
- operator: 'equal',
330
- propCategory: 'eventProp',
331
- type: pageAttrObj.type,
332
- values: pageAttrObj === null || pageAttrObj === void 0 ? void 0 : pageAttrObj.values
333
- };
334
- modulePageJsonList.push(obj1);
335
- }
304
+ if (!(eventNameMap && (currentMap === null || currentMap === void 0 ? void 0 : currentMap.eventName))) {
305
+ _context3.next = 14;
306
+ break;
336
307
  }
308
+ _context3.next = 9;
309
+ return fetchEventAttrs(currentMap === null || currentMap === void 0 ? void 0 : currentMap.eventId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId);
310
+ case 9:
311
+ attrListApi = _context3.sent;
312
+ // 事件下的细分
313
+ moduleAttrObj = (_attrListApi$filter = attrListApi.filter(function (o) {
314
+ return o.label == (currentMap === null || currentMap === void 0 ? void 0 : currentMap.moduleAttrName);
315
+ })) === null || _attrListApi$filter === void 0 ? void 0 : _attrListApi$filter[0];
316
+ pageAttrObj = (_attrListApi$filter2 = attrListApi.filter(function (o) {
317
+ return o.label == (currentMap === null || currentMap === void 0 ? void 0 : currentMap.pageAttrName);
318
+ })) === null || _attrListApi$filter2 === void 0 ? void 0 : _attrListApi$filter2[0];
319
+ if (moduleAttrObj) {
320
+ _obj = {
321
+ attrId: moduleAttrObj.id,
322
+ attrName: moduleAttrObj.label,
323
+ dimensionSub: moduleAttrObj.dimensionSub,
324
+ label: moduleAttrObj.label,
325
+ operator: 'equal',
326
+ propCategory: 'eventProp',
327
+ type: moduleAttrObj.type,
328
+ values: [currentTreeData === null || currentTreeData === void 0 ? void 0 : currentTreeData.moduleAttrName]
329
+ };
330
+ modulePageJsonList.push(_obj);
331
+ }
332
+ if (pageAttrObj) {
333
+ obj1 = {
334
+ attrId: pageAttrObj.id,
335
+ attrName: pageAttrObj.label,
336
+ dimensionSub: pageAttrObj.dimensionSub,
337
+ label: pageAttrObj.label,
338
+ operator: 'equal',
339
+ propCategory: 'eventProp',
340
+ type: pageAttrObj.type,
341
+ values: [currentTreeData === null || currentTreeData === void 0 ? void 0 : currentTreeData.pageAttrName]
342
+ };
343
+ modulePageJsonList.push(obj1);
344
+ }
345
+ case 14:
337
346
  allFilterObj = {
338
347
  relation: 'and',
339
348
  conditions: [].concat(_toConsumableArray(filterJsonList), attrFilterJsonList, modulePageJsonList)
340
349
  }; // console.log(allFilterObj, 'allFilterObj');
341
350
  // 细分的 属性值
342
351
  globalDimensionsList = [];
343
- xifenList.forEach(function (o) {
344
- var obj = {
345
- propCategory: o.inquire.propCategory,
346
- type: o.inquire.type,
347
- attrId: o.inquire.id,
348
- attrName: o.inquire.label
349
- };
350
- globalDimensionsList.push(obj);
351
- });
352
+ if (xifenList) {
353
+ xifenList.forEach(function (o) {
354
+ var obj = {
355
+ propCategory: o.inquire.propCategory,
356
+ type: o.inquire.type,
357
+ attrId: o.inquire.id,
358
+ attrName: o.inquire.label
359
+ };
360
+ globalDimensionsList.push(obj);
361
+ });
362
+ }
352
363
  resultParams = {
353
364
  data: {
354
365
  chartType: 'line',
@@ -376,7 +387,7 @@ var RightDetail = function RightDetail(props) {
376
387
  }
377
388
  });
378
389
  });
379
- case 12:
390
+ case 19:
380
391
  case "end":
381
392
  return _context3.stop();
382
393
  }
@@ -396,31 +407,57 @@ var RightDetail = function RightDetail(props) {
396
407
  }, [currentTreeData]);
397
408
  var xunapi = /*#__PURE__*/function () {
398
409
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
399
- var haveEventName, haveModuleAttr, havePageAttr, objConditions, b1, b7, b30;
410
+ var haveEventName, attrListApi, haveModuleAttr, havePageAttr, filterJsonList, obj, xifenList, attrFilterJsonList, objConditions, b1, b7, b30;
400
411
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
401
412
  while (1) switch (_context4.prev = _context4.next) {
402
413
  case 0:
403
414
  // console.log(currentTreeData, currentMap, eventGroupList,eventNameMap, 'currentTreeData');
404
415
  haveEventName = eventNameMap === null || eventNameMap === void 0 ? void 0 : eventNameMap[currentTreeData.eventName]; // 查找事件
405
- haveModuleAttr = haveEventName === null || haveEventName === void 0 ? void 0 : haveEventName.attrList.find(function (o) {
416
+ _context4.next = 3;
417
+ return fetchEventAttrs(currentTreeData === null || currentTreeData === void 0 ? void 0 : currentTreeData.eventId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId);
418
+ case 3:
419
+ attrListApi = _context4.sent;
420
+ // 事件下的细分
421
+ haveModuleAttr = attrListApi.find(function (o) {
406
422
  return o.label == (currentMap === null || currentMap === void 0 ? void 0 : currentMap.moduleAttrName);
407
423
  }); // 事件模块的属性
408
424
  if (haveModuleAttr) {
409
425
  haveModuleAttr['values'] = [currentTreeData.moduleAttrName];
410
426
  }
411
- havePageAttr = haveEventName === null || haveEventName === void 0 ? void 0 : haveEventName.attrList.find(function (o) {
427
+ havePageAttr = attrListApi.find(function (o) {
412
428
  return o.label == (currentMap === null || currentMap === void 0 ? void 0 : currentMap.pageAttrName);
413
429
  }); // 事件页面的属性
414
430
  if (havePageAttr) {
415
431
  havePageAttr['values'] = [currentTreeData.pageAttrName];
416
432
  }
417
433
  if (haveModuleAttr) {
418
- _context4.next = 8;
434
+ _context4.next = 11;
419
435
  break;
420
436
  }
421
437
  message.warning("".concat(currentMap === null || currentMap === void 0 ? void 0 : currentMap.moduleAttrName, "\u4E0B\u7684").concat(currentMap === null || currentMap === void 0 ? void 0 : currentMap.pageAttrName, "\u6CA1\u6709"));
422
438
  return _context4.abrupt("return");
423
- case 8:
439
+ case 11:
440
+ filterJsonList = (currentMap === null || currentMap === void 0 ? void 0 : currentMap.filterJson) ? JSON.parse(currentMap === null || currentMap === void 0 ? void 0 : currentMap.filterJson).conditions : []; // 搜索的值 细分的值
441
+ obj = _objectSpread({}, props.filterValue); // 查询是的值
442
+ xifenList = (currentMap === null || currentMap === void 0 ? void 0 : currentMap.attributeJson) && JSON.parse(currentMap === null || currentMap === void 0 ? void 0 : currentMap.attributeJson);
443
+ attrFilterJsonList = [];
444
+ Object.keys(obj).forEach(function (o) {
445
+ if (o != 'mapId') {
446
+ if (obj[o]) {
447
+ var indexNum = toNumber(o.substr(o.length - 1, 1));
448
+ attrFilterJsonList.push({
449
+ attrId: xifenList[indexNum - 1].inquire.id,
450
+ attrName: xifenList[indexNum - 1].inquire.label,
451
+ dimensionSub: xifenList[indexNum - 1].inquire.dimensionSub,
452
+ label: xifenList[indexNum - 1].inquire.label,
453
+ operator: 'equal',
454
+ propCategory: 'eventProp',
455
+ type: xifenList[indexNum - 1].inquire.type,
456
+ values: [obj[o]]
457
+ });
458
+ }
459
+ }
460
+ });
424
461
  objConditions = [{
425
462
  attrId: haveModuleAttr === null || haveModuleAttr === void 0 ? void 0 : haveModuleAttr.id,
426
463
  propCategory: 'eventProp',
@@ -439,19 +476,19 @@ var RightDetail = function RightDetail(props) {
439
476
  dimensionSub: 'event_attr',
440
477
  label: havePageAttr === null || havePageAttr === void 0 ? void 0 : havePageAttr.label,
441
478
  attrName: havePageAttr === null || havePageAttr === void 0 ? void 0 : havePageAttr.label
442
- }]; // console.log(objConditions, 'kkk');
479
+ }].concat(attrFilterJsonList, _toConsumableArray(filterJsonList)); // console.log(objConditions, 'kkk');
443
480
  setInterviewLoading(true);
444
- _context4.next = 12;
481
+ _context4.next = 20;
445
482
  return dayValues(objConditions, moment().subtract(1, 'days').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD'), [1, 0]);
446
- case 12:
483
+ case 20:
447
484
  b1 = _context4.sent;
448
- _context4.next = 15;
485
+ _context4.next = 23;
449
486
  return dayValues(objConditions, moment().subtract(7, 'days').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD'), [7, 0]);
450
- case 15:
487
+ case 23:
451
488
  b7 = _context4.sent;
452
- _context4.next = 18;
489
+ _context4.next = 26;
453
490
  return dayValues(objConditions, moment().subtract(30, 'days').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD'), [30, 0]);
454
- case 18:
491
+ case 26:
455
492
  b30 = _context4.sent;
456
493
  setInterviewLoading(false);
457
494
  setData([{
@@ -461,7 +498,7 @@ var RightDetail = function RightDetail(props) {
461
498
  nearlyDays: b7,
462
499
  nearlyDays1: b30
463
500
  }]);
464
- case 21:
501
+ case 29:
465
502
  case "end":
466
503
  return _context4.stop();
467
504
  }
@@ -27,7 +27,8 @@ var AddPlan = function AddPlan(props) {
27
27
  var classPrefix = 'add-plan';
28
28
  var _useContext = useContext(BizGlobalDataContext),
29
29
  currentApp = _useContext.currentApp,
30
- isDemo = _useContext.isDemo;
30
+ isDemo = _useContext.isDemo,
31
+ showProdDownload = _useContext.showProdDownload;
31
32
  var _useState = useState(false),
32
33
  _useState2 = _slicedToArray(_useState, 2),
33
34
  spinning = _useState2[0],
@@ -636,7 +637,7 @@ var AddPlan = function AddPlan(props) {
636
637
  value: "0"
637
638
  }, "\u6240\u6709\u884C"), /*#__PURE__*/React.createElement(Option, {
638
639
  value: "1"
639
- }, "\u5F53\u524D\u884C"))), /*#__PURE__*/React.createElement(Button, {
640
+ }, "\u5F53\u524D\u884C"))), showProdDownload && (/*#__PURE__*/React.createElement(Button, {
640
641
  loading: downloadingPlanTemp,
641
642
  onClick: function onClick() {
642
643
  setDownloadingPlanTemp(true);
@@ -654,11 +655,11 @@ var AddPlan = function AddPlan(props) {
654
655
  }
655
656
  }, /*#__PURE__*/React.createElement(IconFont, {
656
657
  type: "xiazai1"
657
- }), "\u4E0B\u8F7D\u6A21\u677F"), /*#__PURE__*/React.createElement(Upload, _objectSpread({}, uploadProps), /*#__PURE__*/React.createElement(Button, {
658
+ }), "\u4E0B\u8F7D\u6A21\u677F")), showProdDownload && (/*#__PURE__*/React.createElement(Upload, _objectSpread({}, uploadProps), /*#__PURE__*/React.createElement(Button, {
658
659
  disabled: isDemo
659
660
  }, /*#__PURE__*/React.createElement(IconFont, {
660
661
  type: "daochu"
661
- }), "\u6587\u4EF6\u4E0A\u4F20")))), /*#__PURE__*/React.createElement(Search, {
662
+ }), "\u6587\u4EF6\u4E0A\u4F20"))))), /*#__PURE__*/React.createElement(Search, {
662
663
  type: listTab == '1' ? 'event' : 'user',
663
664
  total: searchTotal,
664
665
  searchData: searchData,
@@ -16,5 +16,6 @@ declare const AddFormulate: React.FC<{
16
16
  addruleShow: boolean;
17
17
  onSetclose: Function;
18
18
  detailData: Result | null;
19
+ ruleRowView?: boolean;
19
20
  }>;
20
21
  export default AddFormulate;
@@ -1,3 +1,5 @@
1
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
+ 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); }
1
3
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
5
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
@@ -17,12 +19,13 @@ import AddRule from './addRule';
17
19
  import request from '../../utils/ajax';
18
20
  import apis from '../../constants/api';
19
21
  import UseModal from '../CutsModal';
20
- import { typeArr } from './data';
22
+ import { typeArr, shuzhiArr } from './data';
21
23
  var TextArea = Input.TextArea;
22
24
  var AddFormulate = function AddFormulate(_ref) {
23
25
  var addruleShow = _ref.addruleShow,
24
26
  onSetclose = _ref.onSetclose,
25
- detailData = _ref.detailData;
27
+ detailData = _ref.detailData,
28
+ ruleRowView = _ref.ruleRowView;
26
29
  var _useContext = useContext(BizGlobalDataContext),
27
30
  currentApp = _useContext.currentApp;
28
31
  // 关闭抽屉框
@@ -44,8 +47,8 @@ var AddFormulate = function AddFormulate(_ref) {
44
47
  var arr = dataSource.map(function (o) {
45
48
  return {
46
49
  ruleType: o.currentType,
47
- sourceValue: o.sourceValue,
48
- targetValue: o.targetValue
50
+ sourceValue: o.currentType == 3 ? o.sourceValueId : o.sourceValue,
51
+ targetValue: o.currentType == 3 ? o.targetValueId : o.targetValue
49
52
  };
50
53
  });
51
54
  var api = detailData ? apis.clearRule.modifyRule : apis.clearRule.addRule;
@@ -76,9 +79,6 @@ var AddFormulate = function AddFormulate(_ref) {
76
79
  }
77
80
  });
78
81
  };
79
- var handleSave = function handleSave() {
80
- ruleForm.submit();
81
- };
82
82
  var _useState3 = useState([]),
83
83
  _useState4 = _slicedToArray(_useState3, 2),
84
84
  dataSource = _useState4[0],
@@ -87,7 +87,19 @@ var AddFormulate = function AddFormulate(_ref) {
87
87
  _useState6 = _slicedToArray(_useState5, 2),
88
88
  dataSourceItemEdit = _useState6[0],
89
89
  setDataSoureItemEdit = _useState6[1];
90
- var columns = [{
90
+ var columns = ruleRowView ? [{
91
+ title: '类型',
92
+ dataIndex: 'currentTypeName',
93
+ key: 'currentTypeName'
94
+ }, {
95
+ title: '原属性',
96
+ dataIndex: 'sourceValue',
97
+ key: 'sourceValue'
98
+ }, {
99
+ title: '清洗后属性',
100
+ dataIndex: 'targetValue',
101
+ key: 'targetValue'
102
+ }] : [{
91
103
  title: '类型',
92
104
  dataIndex: 'currentTypeName',
93
105
  key: 'currentTypeName'
@@ -141,7 +153,7 @@ var AddFormulate = function AddFormulate(_ref) {
141
153
  _useState10 = _slicedToArray(_useState9, 2),
142
154
  openRule = _useState10[0],
143
155
  setOpenRule = _useState10[1];
144
- var _useState11 = useState([]),
156
+ var _useState11 = useState(),
145
157
  _useState12 = _slicedToArray(_useState11, 2),
146
158
  ruleList = _useState12[0],
147
159
  setRuleList = _useState12[1];
@@ -155,6 +167,20 @@ var AddFormulate = function AddFormulate(_ref) {
155
167
  _useState14 = _slicedToArray(_useState13, 2),
156
168
  tableParams = _useState14[0],
157
169
  setTableParams = _useState14[1];
170
+ var typeValue = function typeValue(detailRow, tag) {
171
+ var str = tag == 1 ? detailRow.sourceValue : detailRow.targetValue;
172
+ //类型转换
173
+ if (detailRow.ruleType == 3) {
174
+ var _shuzhiArr$find;
175
+ // if (!detailRow.sourceValue || !detailRow.targetValue) {
176
+ // return str;
177
+ // }
178
+ str = (_shuzhiArr$find = shuzhiArr.find(function (o) {
179
+ return o.value == (tag == 1 ? detailRow === null || detailRow === void 0 ? void 0 : detailRow.sourceValue : detailRow === null || detailRow === void 0 ? void 0 : detailRow.targetValue);
180
+ })) === null || _shuzhiArr$find === void 0 ? void 0 : _shuzhiArr$find.label;
181
+ }
182
+ return str;
183
+ };
158
184
  var getList = function getList() {
159
185
  var searchName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
160
186
  request(apis.rule.getRuleList, {
@@ -169,6 +195,42 @@ var AddFormulate = function AddFormulate(_ref) {
169
195
  if (!res) return;
170
196
  if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
171
197
  setRuleList(res.data.data);
198
+ // 回显
199
+ if (detailData) {
200
+ var _detailData$rinseObje2, _detailData$rinseShif;
201
+ var currentTargetObj = res.data.data.find(function (o) {
202
+ var _detailData$rinseObje;
203
+ return (detailData === null || detailData === void 0 ? void 0 : (_detailData$rinseObje = detailData.rinseObjects) === null || _detailData$rinseObje === void 0 ? void 0 : _detailData$rinseObje[0]) == o.ruleId;
204
+ });
205
+ ruleForm.setFieldsValue({
206
+ name: detailData.ruleName,
207
+ description: detailData === null || detailData === void 0 ? void 0 : detailData.ruleDescription,
208
+ target: currentTargetObj ? detailData === null || detailData === void 0 ? void 0 : (_detailData$rinseObje2 = detailData.rinseObjects) === null || _detailData$rinseObje2 === void 0 ? void 0 : _detailData$rinseObje2[0] : undefined,
209
+ ruleArr: detailData === null || detailData === void 0 ? void 0 : detailData.rinseShiftRuleDetails
210
+ });
211
+ currentTargetObj && setCurrentBizAttributeSelectorValue(JSON.parse(currentTargetObj === null || currentTargetObj === void 0 ? void 0 : currentTargetObj.extraMes));
212
+ var arr = detailData === null || detailData === void 0 ? void 0 : (_detailData$rinseShif = detailData.rinseShiftRuleDetails) === null || _detailData$rinseShif === void 0 ? void 0 : _detailData$rinseShif.map(function (o) {
213
+ var _shuzhiArr$find2, _shuzhiArr$find3;
214
+ return {
215
+ currentType: o.ruleType,
216
+ currentTypeName: typeArr.filter(function (j) {
217
+ return j.value == o.ruleType;
218
+ })[0].label,
219
+ sourceValue: o.ruleType == 5 ? '' : typeValue(o, 1),
220
+ targetValue: typeValue(o, 2),
221
+ sourceValueId: o.ruleType == 3 && ((_shuzhiArr$find2 = shuzhiArr.find(function (j) {
222
+ return j.value == o.sourceValue;
223
+ })) === null || _shuzhiArr$find2 === void 0 ? void 0 : _shuzhiArr$find2.value),
224
+ targetValueId: o.ruleType == 3 && ((_shuzhiArr$find3 = shuzhiArr.find(function (j) {
225
+ return j.value == o.targetValue;
226
+ })) === null || _shuzhiArr$find3 === void 0 ? void 0 : _shuzhiArr$find3.value),
227
+ key: o.id
228
+ };
229
+ });
230
+ setDataSoure(function () {
231
+ return arr || [];
232
+ });
233
+ }
172
234
  }
173
235
  });
174
236
  };
@@ -196,34 +258,65 @@ var AddFormulate = function AddFormulate(_ref) {
196
258
  });
197
259
  }
198
260
  };
199
- // 回显
200
- useEffect(function () {
201
- if (detailData) {
202
- ruleForm.setFieldsValue({
203
- name: detailData.ruleName,
204
- description: detailData.ruleDescription,
205
- target: detailData.rinseObjects[0],
206
- ruleArr: detailData.rinseShiftRuleDetails
207
- });
208
- var arr = detailData.rinseShiftRuleDetails.map(function (o) {
209
- return {
210
- currentType: o.ruleType,
211
- currentTypeName: typeArr.filter(function (j) {
212
- return j.value == o.ruleType;
213
- })[0].label,
214
- sourceValue: o.ruleType == 5 ? '' : o.sourceValue,
215
- targetValue: o.targetValue,
216
- key: o.id
217
- };
218
- });
219
- setDataSoure(arr);
261
+ var _useState15 = useState(),
262
+ _useState16 = _slicedToArray(_useState15, 2),
263
+ currentBizAttributeSelectorValue = _useState16[0],
264
+ setCurrentBizAttributeSelectorValue = _useState16[1];
265
+ // 判断是否都包含
266
+ var isAllTypeIncluded = function isAllTypeIncluded(arrA, arrB) {
267
+ // 边界处理:arrA 为空数组 → 默认全包含(无需要检查的 type)
268
+ if (!arrA || arrA.length === 0) return true;
269
+ // 边界处理:arrB 为空数组 → 不可能包含任何 type → 返回 false
270
+ if (!arrB || arrB.length === 0) return false;
271
+ // 步骤 1:提取 arrA 中所有不重复的 type(去重后检查更高效)
272
+ var arrATypes = new Set(arrA.map(function (item) {
273
+ return item;
274
+ })); // 去重,避免重复检查
275
+ // 步骤 2:提取 arrB 中所有的“有效对比值”(支持 arrB 是字符串数组或对象数组)
276
+ var arrBValues = new Set(arrB.map(function (item) {
277
+ // 若 arrB 元素是对象,取其 type 属性;若为字符串,直接用元素本身
278
+ return _typeof(item) === 'object' && item !== null ? item.currentType : item;
279
+ }));
280
+ // 步骤 3:检查 arrA 的每个 type 是否都在 arrB 的值中
281
+ var _iterator = _createForOfIteratorHelper(arrATypes),
282
+ _step;
283
+ try {
284
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
285
+ var type = _step.value;
286
+ if (!arrBValues.has(type)) {
287
+ return false; // 找到一个不包含的 type,直接返回 false
288
+ }
289
+ }
290
+ } catch (err) {
291
+ _iterator.e(err);
292
+ } finally {
293
+ _iterator.f();
220
294
  }
221
- }, []);
295
+ return true; // 所有 type 都包含,返回 true
296
+ };
297
+ // 添加校验规则按钮禁用状态
298
+ var addBtndisabled = function addBtndisabled() {
299
+ var type = [1, 2, 3, 4];
300
+ // 查看数据时禁用按钮
301
+ if (ruleRowView) {
302
+ return true;
303
+ }
304
+ if (dataSource.length >= 1 && dataSource.find(function (j) {
305
+ return j.currentType == 5;
306
+ })) {
307
+ return true;
308
+ }
309
+ // 值类型也限制了
310
+ // if (isAllTypeIncluded(type, dataSource)) {
311
+ // return true;
312
+ // }
313
+ return false;
314
+ };
222
315
  return /*#__PURE__*/React.createElement("div", {
223
316
  className: "addRule"
224
317
  }, /*#__PURE__*/React.createElement(Drawer, {
225
318
  className: "addRuleForm",
226
- title: /*#__PURE__*/React.createElement("div", null, detailData ? '修改自定义校验规则清洗' : '新建自定义校验规则清洗', /*#__PURE__*/React.createElement("div", {
319
+ title: /*#__PURE__*/React.createElement("div", null, ruleRowView ? '查看自定义校验规则清洗' : detailData ? '修改自定义校验规则清洗' : '新建自定义校验规则清洗', /*#__PURE__*/React.createElement("div", {
227
320
  className: "drawerCloseIcon",
228
321
  onClick: onClose
229
322
  }, /*#__PURE__*/React.createElement(CloseOutlined, {
@@ -237,12 +330,15 @@ var AddFormulate = function AddFormulate(_ref) {
237
330
  width: "700px",
238
331
  footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
239
332
  onClick: onClose
240
- }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
333
+ }, "\u53D6\u6D88"), ruleRowView === false && (/*#__PURE__*/React.createElement(Button, {
241
334
  type: "primary",
242
- onClick: handleSave
243
- }, "\u786E\u5B9A")))
335
+ onClick: function onClick() {
336
+ return ruleForm.submit();
337
+ }
338
+ }, "\u786E\u5B9A"))))
244
339
  }, /*#__PURE__*/React.createElement(Form, {
245
340
  form: ruleForm,
341
+ disabled: ruleRowView,
246
342
  labelCol: {
247
343
  span: 4
248
344
  },
@@ -252,7 +348,8 @@ var AddFormulate = function AddFormulate(_ref) {
252
348
  initialValues: {
253
349
  name: '',
254
350
  desctiption: '',
255
- ruleobj: []
351
+ ruleobj: [],
352
+ target: ''
256
353
  },
257
354
  onFinish: onFinish,
258
355
  labelAlign: "left"
@@ -286,6 +383,11 @@ var AddFormulate = function AddFormulate(_ref) {
286
383
  style: {
287
384
  width: '320px'
288
385
  },
386
+ onChange: function onChange(value) {
387
+ setCurrentBizAttributeSelectorValue(JSON.parse(ruleList === null || ruleList === void 0 ? void 0 : ruleList.find(function (o) {
388
+ return o.ruleId == value;
389
+ }).extraMes));
390
+ },
289
391
  placeholder: "\u8BF7\u9009\u62E9\u6E05\u6D17\u7684\u89C4\u5219\u5BF9\u8C61",
290
392
  fieldNames: {
291
393
  label: 'ruleName',
@@ -303,6 +405,7 @@ var AddFormulate = function AddFormulate(_ref) {
303
405
  onPointerEnterCapture: undefined,
304
406
  onPointerLeaveCapture: undefined
305
407
  }),
408
+ disabled: addBtndisabled(),
306
409
  type: "link",
307
410
  onClick: function onClick() {
308
411
  setOpenRule(true);
@@ -318,6 +421,8 @@ var AddFormulate = function AddFormulate(_ref) {
318
421
  }, "*\u6CE8\uFF1A\u6E05\u6D17\u53EA\u9488\u5BF9\u6CA1\u901A\u8FC7\u81EA\u5B9A\u4E49\u6821\u9A8C\u89C4\u5219\u7684\u6570\u636E\u8FDB\u884C\u6E05\u6D17\uFF0C\u4E0D\u4F1A\u5BF9\u5DF2\u5165\u5E93\u6570\u636E\u8FDB\u884C\u6E05\u6D17")), openRule && (/*#__PURE__*/React.createElement(AddRule, {
319
422
  addruleShow: openRule,
320
423
  oneRow: oneRow,
424
+ allDataSource: dataSource,
425
+ currentBizAttributeSelectorValue: currentBizAttributeSelectorValue,
321
426
  editStatus: dataSourceItemEdit,
322
427
  onSetclose: function onSetclose() {
323
428
  return setOpenRule(false);
@@ -15,5 +15,7 @@ declare const AddRule: React.FC<{
15
15
  onSave: Function;
16
16
  oneRow: null | TypeRule;
17
17
  editStatus: boolean;
18
+ currentBizAttributeSelectorValue?: any;
19
+ allDataSource?: TypeRule[];
18
20
  }>;
19
21
  export default AddRule;