@zgfe/modules-dm 1.0.57-zhongyuan.32 → 1.0.57-zhongyuan.34

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.
@@ -20,6 +20,7 @@ import React, { useContext, useEffect, useState } from 'react';
20
20
  import { BizEventSelector, BizAttributeSelector, BizGlobalDataContext } from '@zgfe/business-lib';
21
21
  import './css/index.less';
22
22
  import request from '../../utils/ajax';
23
+ import { generateUniqueId } from '../../utils/index';
23
24
  import apis from '../../constants/api';
24
25
  var TextArea = Input.TextArea;
25
26
  var AddRule = function AddRule(_ref) {
@@ -61,7 +62,7 @@ var AddRule = function AddRule(_ref) {
61
62
  }, 300);
62
63
  };
63
64
  var onFinish = function onFinish(values) {
64
- console.log('Success:', values);
65
+ console.log('Success:', values, optionsRule);
65
66
  if (currentRuleDetail) {
66
67
  // currentRuleDetail 有值为修改状态
67
68
  request(apis.rule.updateRule, {
@@ -170,25 +171,28 @@ var AddRule = function AddRule(_ref) {
170
171
  if (type === 3) {
171
172
  setOptionsRule([].concat(_toConsumableArray(optionsRule), [{
172
173
  ruleType: type,
173
- content: '(1,1)'
174
+ content: '(1,1)',
175
+ uniqueId: generateUniqueId()
174
176
  }]));
175
177
  return;
176
178
  }
177
179
  if (type === 1) {
178
180
  setOptionsRule([].concat(_toConsumableArray(optionsRule), [{
179
181
  ruleType: type,
180
- content: bizAttributeSelectorValue.type
182
+ content: bizAttributeSelectorValue.type,
183
+ uniqueId: generateUniqueId()
181
184
  }]));
182
185
  return;
183
186
  }
184
187
  setOptionsRule([].concat(_toConsumableArray(optionsRule), [{
185
188
  ruleType: type,
186
- content: undefined
189
+ content: undefined,
190
+ uniqueId: generateUniqueId()
187
191
  }]));
188
192
  };
189
- var handleRuleDel = function handleRuleDel(index) {
193
+ var handleRuleDel = function handleRuleDel(uniqueId) {
190
194
  setOptionsRule(optionsRule.filter(function (o, i) {
191
- return i !== index;
195
+ return o.uniqueId !== uniqueId;
192
196
  }));
193
197
  };
194
198
  // 校验对象的类型 eventProp:事件校验 user:用户校验
@@ -238,12 +242,12 @@ var AddRule = function AddRule(_ref) {
238
242
  value: _value
239
243
  }));
240
244
  // 初始化属性基础类型
241
- var newArr = optionsRule.map(function (o) {
242
- if (o.ruleType == 1) {
243
- o.content = attr.type;
244
- }
245
- });
246
- setOptionsRule(newArr);
245
+ // const newArr = optionsRule.map((o) => {
246
+ // if (o.ruleType == 1) {
247
+ // o.content = attr.type;
248
+ // }
249
+ // });
250
+ // setOptionsRule(newArr);
247
251
  setOptions(attr.type != '3' ? [].concat(initOptions, [{
248
252
  label: '字典校验',
249
253
  value: 6
@@ -386,13 +390,14 @@ var AddRule = function AddRule(_ref) {
386
390
  }, /*#__PURE__*/React.createElement("div", null, (bizAttributeSelectorValue === null || bizAttributeSelectorValue === void 0 ? void 0 : bizAttributeSelectorValue.label) || bizAttributeSelectorValue.name), /*#__PURE__*/React.createElement(TypeComponent, {
387
391
  type: o.ruleType,
388
392
  optionsValue: optionsRule,
393
+ id: o.uniqueId,
389
394
  editStatus: currentRuleDetail ? true : false
390
395
  }), /*#__PURE__*/React.createElement("div", {
391
396
  style: {
392
397
  cursor: 'pointer'
393
398
  },
394
399
  onClick: function onClick() {
395
- return handleRuleDel(index);
400
+ return handleRuleDel(o.uniqueId);
396
401
  }
397
402
  }, "X"));
398
403
  }))), /*#__PURE__*/React.createElement(Space, null, options.map(function (item, index) {
@@ -422,9 +427,11 @@ function parseRange(str) {
422
427
  };
423
428
  }
424
429
  var TypeComponent = function TypeComponent(_ref2) {
430
+ var _optionsValue$find;
425
431
  var type = _ref2.type,
426
432
  optionsValue = _ref2.optionsValue,
427
- editStatus = _ref2.editStatus;
433
+ editStatus = _ref2.editStatus,
434
+ id = _ref2.id;
428
435
  // type:1 string 2:正则 3:数字区间 4:枚举
429
436
  var Component = null;
430
437
  var _useContext2 = useContext(BizGlobalDataContext),
@@ -437,7 +444,7 @@ var TypeComponent = function TypeComponent(_ref2) {
437
444
  var handleEnumChange = function handleEnumChange(value) {
438
445
  setEnumValue(value);
439
446
  optionsValue.filter(function (r) {
440
- return r.ruleType == type;
447
+ return r.uniqueId == id;
441
448
  })[0].content = value;
442
449
  };
443
450
  // 区间
@@ -485,9 +492,6 @@ var TypeComponent = function TypeComponent(_ref2) {
485
492
  useEffect(function () {
486
493
  if (editStatus) {
487
494
  var _optionsValue$filter, _optionsValue$filter$;
488
- console.log(optionsValue, 'optionsValue', optionsValue.filter(function (o) {
489
- return o.ruleType == 3;
490
- }));
491
495
  if ((_optionsValue$filter = optionsValue.filter(function (o) {
492
496
  return o.ruleType == 3;
493
497
  })) === null || _optionsValue$filter === void 0 ? void 0 : (_optionsValue$filter$ = _optionsValue$filter[0]) === null || _optionsValue$filter$ === void 0 ? void 0 : _optionsValue$filter$.content) {
@@ -505,12 +509,16 @@ var TypeComponent = function TypeComponent(_ref2) {
505
509
  getDictList();
506
510
  }
507
511
  }, []);
512
+ var _useState27 = useState((_optionsValue$find = optionsValue.find(function (o) {
513
+ return o.uniqueId == id;
514
+ })) === null || _optionsValue$find === void 0 ? void 0 : _optionsValue$find.content),
515
+ _useState28 = _slicedToArray(_useState27, 2),
516
+ typeValue = _useState28[0],
517
+ setTypeValue = _useState28[1];
508
518
  switch (type) {
509
519
  case 1:
510
520
  Component = /*#__PURE__*/React.createElement(Select, {
511
- value: Number(optionsValue.filter(function (r) {
512
- return r.ruleType == type;
513
- })[0].content),
521
+ value: Number(typeValue),
514
522
  // disabled={true}
515
523
  options: [{
516
524
  value: 1,
@@ -523,8 +531,9 @@ var TypeComponent = function TypeComponent(_ref2) {
523
531
  label: '日期类型'
524
532
  }],
525
533
  onChange: function onChange(value) {
534
+ setTypeValue(value);
526
535
  optionsValue.filter(function (r) {
527
- return r.ruleType == type;
536
+ return r.uniqueId == id;
528
537
  })[0].content = value;
529
538
  }
530
539
  });
@@ -533,11 +542,11 @@ var TypeComponent = function TypeComponent(_ref2) {
533
542
  Component = /*#__PURE__*/React.createElement(Input, {
534
543
  placeholder: "\u8BF7\u8F93\u5165\u6B63\u5219\u8868\u5355\u5F0F",
535
544
  value: optionsValue.filter(function (r) {
536
- return r.ruleType == type;
545
+ return r.uniqueId == id;
537
546
  })[0].content,
538
547
  onChange: function onChange(event) {
539
548
  optionsValue.filter(function (r) {
540
- return r.ruleType == type;
549
+ return r.uniqueId == id;
541
550
  })[0].content = event.target.value;
542
551
  }
543
552
  });
@@ -554,7 +563,7 @@ var TypeComponent = function TypeComponent(_ref2) {
554
563
  onClick: function onClick() {
555
564
  setIncludedMinState(function (pre) {
556
565
  optionsValue.filter(function (r) {
557
- return r.ruleType == type;
566
+ return r.uniqueId == id;
558
567
  })[0].content = "".concat(!includedMinState ? '[' : '(').concat(minNum, ",").concat(maxNum).concat(includedMaxState ? ']' : ')');
559
568
  return !pre;
560
569
  });
@@ -566,7 +575,7 @@ var TypeComponent = function TypeComponent(_ref2) {
566
575
  onChange: function onChange(value) {
567
576
  setMinNum(value);
568
577
  optionsValue.filter(function (r) {
569
- return r.ruleType == type;
578
+ return r.uniqueId == id;
570
579
  })[0].content = "".concat(includedMinState ? '[' : '(').concat(value, ",").concat(maxNum).concat(includedMaxState ? ']' : ')');
571
580
  }
572
581
  }), "-", /*#__PURE__*/React.createElement(InputNumber, {
@@ -576,7 +585,7 @@ var TypeComponent = function TypeComponent(_ref2) {
576
585
  onChange: function onChange(value) {
577
586
  setMaxNum(value);
578
587
  optionsValue.filter(function (r) {
579
- return r.ruleType == type;
588
+ return r.uniqueId == id;
580
589
  })[0].content = "".concat(includedMinState ? '[' : '(').concat(minNum, ",").concat(value).concat(includedMaxState ? ']' : ')');
581
590
  }
582
591
  }), /*#__PURE__*/React.createElement(Tooltip, {
@@ -588,7 +597,7 @@ var TypeComponent = function TypeComponent(_ref2) {
588
597
  onClick: function onClick() {
589
598
  setIncludedMaxState(function (pre) {
590
599
  optionsValue.filter(function (r) {
591
- return r.ruleType == type;
600
+ return r.uniqueId == id;
592
601
  })[0].content = "".concat(includedMinState ? '[' : '(').concat(minNum, ",").concat(maxNum).concat(!includedMaxState ? ']' : ')');
593
602
  return !pre;
594
603
  });
@@ -603,7 +612,7 @@ var TypeComponent = function TypeComponent(_ref2) {
603
612
  },
604
613
  placeholder: "\u8BF7\u8F93\u5165",
605
614
  value: optionsValue.filter(function (r) {
606
- return r.ruleType == type;
615
+ return r.uniqueId == id;
607
616
  })[0].content,
608
617
  onChange: handleEnumChange,
609
618
  options: optionsEnum
@@ -612,14 +621,14 @@ var TypeComponent = function TypeComponent(_ref2) {
612
621
  case 6:
613
622
  Component = /*#__PURE__*/React.createElement(Select, {
614
623
  defaultValue: Number(optionsValue.filter(function (r) {
615
- return r.ruleType == type;
624
+ return r.uniqueId == id;
616
625
  })[0].content),
617
626
  // value={optionsValue.filter((r) => r.ruleType == type)[0].content}
618
627
  placeholder: "\u9009\u62E9\u5B57\u5178\u89C4\u5219",
619
628
  options: dictList,
620
629
  onChange: function onChange(value) {
621
630
  optionsValue.filter(function (r) {
622
- return r.ruleType == type;
631
+ return r.uniqueId == id;
623
632
  })[0].content = value;
624
633
  }
625
634
  });
@@ -27,7 +27,8 @@ var className = 'clearRule';
27
27
  var ClearRule = function ClearRule() {
28
28
  var _useContext = useContext(BizGlobalDataContext),
29
29
  currentApp = _useContext.currentApp,
30
- authority = _useContext.authority;
30
+ authority = _useContext.authority,
31
+ showProdDownload = _useContext.showProdDownload;
31
32
  var columns = [{
32
33
  title: '规则名',
33
34
  dataIndex: 'ruleName',
@@ -430,7 +431,7 @@ var ClearRule = function ClearRule() {
430
431
  }, /*#__PURE__*/React.createElement(Switch, {
431
432
  checked: allOpenRule,
432
433
  onChange: handleAllOpenStatus
433
- }))), authority[170928557418] && (/*#__PURE__*/React.createElement(Button, {
434
+ }))), authority[170928557418] && showProdDownload && (/*#__PURE__*/React.createElement(Button, {
434
435
  icon: /*#__PURE__*/React.createElement(DiffOutlined, {
435
436
  onPointerEnterCapture: undefined,
436
437
  onPointerLeaveCapture: undefined
@@ -438,7 +439,7 @@ var ClearRule = function ClearRule() {
438
439
  onClick: function onClick() {
439
440
  return setIsModalOpen(true);
440
441
  }
441
- }, "\u751F\u6210\u62A5\u544A")), authority[170928557417] && (/*#__PURE__*/React.createElement(Button, {
442
+ }, "\u751F\u6210\u62A5\u544A")), authority[170928557417] && showProdDownload && (/*#__PURE__*/React.createElement(Button, {
442
443
  icon: /*#__PURE__*/React.createElement(DownloadOutlined, {
443
444
  onPointerEnterCapture: undefined,
444
445
  onPointerLeaveCapture: undefined
@@ -448,7 +449,7 @@ var ClearRule = function ClearRule() {
448
449
  type: "primary",
449
450
  onClick: handleAddRule,
450
451
  disabled: !authority[170928557411]
451
- }, "\u65B0\u5EFA\u89C4\u5219"), authority[170928557415] && (/*#__PURE__*/React.createElement(Button, {
452
+ }, "\u65B0\u5EFA\u89C4\u5219"), authority[170928557415] && showProdDownload && (/*#__PURE__*/React.createElement(Button, {
452
453
  type: "primary",
453
454
  onClick: function onClick() {
454
455
  return setOpenImportModal(true);
@@ -34,7 +34,8 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
34
34
  var _useContext = useContext(BizGlobalDataContext),
35
35
  currentApp = _useContext.currentApp,
36
36
  isDemo = _useContext.isDemo,
37
- authority = _useContext.authority;
37
+ authority = _useContext.authority,
38
+ showProdDownload = _useContext.showProdDownload;
38
39
  var isOpen = props.isOpen,
39
40
  queryPlanData = props.queryPlanData,
40
41
  source = props.source,
@@ -1171,14 +1172,14 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
1171
1172
  onClick: function onClick() {
1172
1173
  return setCreateAttrShow(true);
1173
1174
  }
1174
- }, "\u521B\u5EFA\u5C5E\u6027"), /*#__PURE__*/React.createElement(Button, {
1175
+ }, "\u521B\u5EFA\u5C5E\u6027"), showProdDownload && (/*#__PURE__*/React.createElement(Button, {
1175
1176
  shape: "round",
1176
1177
  className: "button",
1177
1178
  disabled: isDemo || !authority[1722838544],
1178
1179
  onClick: function onClick() {
1179
1180
  return setOpenImportModal(true);
1180
1181
  }
1181
- }, "\u5BFC\u5165\u5C5E\u6027")))), /*#__PURE__*/React.createElement(Table, {
1182
+ }, "\u5BFC\u5165\u5C5E\u6027"))))), /*#__PURE__*/React.createElement(Table, {
1182
1183
  className: "".concat(classPrefix, "-table"),
1183
1184
  columns: columns,
1184
1185
  id: 'dataManageAttrTable',
@@ -37,7 +37,8 @@ var CollectionEventList = function CollectionEventList(props) {
37
37
  currentApp = _useContext.currentApp,
38
38
  authority = _useContext.authority,
39
39
  route = _useContext.route,
40
- isDemo = _useContext.isDemo;
40
+ isDemo = _useContext.isDemo,
41
+ showProdDownload = _useContext.showProdDownload;
41
42
  var _useContext2 = useContext(DmContext),
42
43
  state = _useContext2.state;
43
44
  var _useState = useState(0),
@@ -474,7 +475,7 @@ var CollectionEventList = function CollectionEventList(props) {
474
475
  }), /*#__PURE__*/React.createElement("span", null, "\u4E8B\u4EF6\u5206\u7EC4\u7BA1\u7406")))
475
476
  }, {
476
477
  key: '3',
477
- disabled: isDemo || !authority[1722837260],
478
+ disabled: (isDemo || !authority[1722837260]) && !showProdDownload,
478
479
  label: (/*#__PURE__*/React.createElement("a", {
479
480
  className: "".concat(classPrefix, "-downItems"),
480
481
  onClick: function onClick() {
@@ -487,7 +488,7 @@ var CollectionEventList = function CollectionEventList(props) {
487
488
  }), " ", /*#__PURE__*/React.createElement("span", null, "\u5BFC\u5165\u4E8B\u4EF6")))
488
489
  }, {
489
490
  key: '4',
490
- disabled: isDemo || !authority[1722837261],
491
+ disabled: (isDemo || !authority[1722837261]) && !showProdDownload,
491
492
  label: (/*#__PURE__*/React.createElement("a", {
492
493
  className: "".concat(classPrefix, "-downItems"),
493
494
  onClick: exportEvent
@@ -510,6 +511,7 @@ var CollectionEventList = function CollectionEventList(props) {
510
511
  }), ' ', /*#__PURE__*/React.createElement("span", null, "\u5F00\u53D1\u7BA1\u7406")))
511
512
  }, {
512
513
  key: '6',
514
+ disabled: !showProdDownload,
513
515
  label: (/*#__PURE__*/React.createElement("a", {
514
516
  className: "".concat(classPrefix, "-downItems"),
515
517
  onClick: function onClick() {
@@ -522,6 +524,7 @@ var CollectionEventList = function CollectionEventList(props) {
522
524
  }), ' ', /*#__PURE__*/React.createElement("span", null, "\u751F\u6210\u6D4B\u8BD5\u62A5\u544A")))
523
525
  }, {
524
526
  key: '7',
527
+ disabled: !showProdDownload,
525
528
  label: (/*#__PURE__*/React.createElement("a", {
526
529
  className: "".concat(classPrefix, "-downItems"),
527
530
  onClick: function onClick() {
@@ -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,
@@ -26,7 +26,8 @@ var className = 'formulateRule';
26
26
  var FormulateRule = function FormulateRule() {
27
27
  var _useContext = useContext(BizGlobalDataContext),
28
28
  currentApp = _useContext.currentApp,
29
- authority = _useContext.authority;
29
+ authority = _useContext.authority,
30
+ showProdDownload = _useContext.showProdDownload;
30
31
  var columns = [{
31
32
  title: '任务名',
32
33
  dataIndex: 'ruleName',
@@ -391,7 +392,7 @@ var FormulateRule = function FormulateRule() {
391
392
  }, /*#__PURE__*/React.createElement(Switch, {
392
393
  checked: allOpenRule,
393
394
  onChange: handleAllOpenStatus
394
- }))), authority[170928557426] && (/*#__PURE__*/React.createElement(Button, {
395
+ }))), authority[170928557426] && showProdDownload && (/*#__PURE__*/React.createElement(Button, {
395
396
  icon: /*#__PURE__*/React.createElement(DiffOutlined, {
396
397
  onPointerEnterCapture: undefined,
397
398
  onPointerLeaveCapture: undefined
@@ -1,3 +1,5 @@
1
+ /**随机id */
2
+ export declare const generateUniqueId: () => string;
1
3
  /**
2
4
  * 虚拟事件编辑 判断内容是否有改动;有改动返回true
3
5
  */
package/es/utils/index.js CHANGED
@@ -1,3 +1,12 @@
1
+ /**随机id */
2
+ export var generateUniqueId = function generateUniqueId() {
3
+ // 时间戳(毫秒级,确保随时间递增)
4
+ var timestamp = Date.now().toString(36); // 转为36进制,缩短长度
5
+ // 随机数(36进制,6位,约100万种可能)
6
+ var random = Math.random().toString(36).substring(2, 8);
7
+ // 拼接为唯一ID(如:"1h8z5a-xyz789")
8
+ return "".concat(timestamp, "-").concat(random);
9
+ };
1
10
  /**
2
11
  * 虚拟事件编辑 判断内容是否有改动;有改动返回true
3
12
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-dm",
3
- "version": "1.0.57-zhongyuan.32",
3
+ "version": "1.0.57-zhongyuan.34",
4
4
  "license": "ISC",
5
5
  "module": "es/index.js",
6
6
  "typings": "es/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "@types/lodash": "^4.14.182",
47
47
  "@umijs/fabric": "^2.8.1",
48
48
  "@umijs/test": "^3.0.5",
49
- "@zgfe/business-lib": "1.2.70-hxd.1",
49
+ "@zgfe/business-lib": "1.2.70-hxd.31",
50
50
  "antd": "4.24.10",
51
51
  "dumi": "^1.1.0",
52
52
  "father-build": "^1.17.2",
@@ -57,7 +57,7 @@
57
57
  "umi-request": "^1.4.0",
58
58
  "yorkie": "^2.0.0"
59
59
  },
60
- "gitHead": "d2142aab2ab62aa1975346e1a7b6211ba0f360b7",
60
+ "gitHead": "13acec8ea76fa8e9ce7f1b9384ac66e9fa4304ba",
61
61
  "gitHooks": {
62
62
  "pre-commit": "lint-staged"
63
63
  }