@zgfe/modules-dm 1.0.57-zhongyuan.38 → 1.0.57-zhongyuan.41
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.
|
@@ -63,6 +63,10 @@ var AddRule = function AddRule(_ref) {
|
|
|
63
63
|
};
|
|
64
64
|
var onFinish = function onFinish(values) {
|
|
65
65
|
console.log('Success:', values, optionsRule);
|
|
66
|
+
if (hasEvent) {
|
|
67
|
+
message.error('该属性的规则已存在,请重新选择属性!');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
66
70
|
if (currentRuleDetail) {
|
|
67
71
|
// currentRuleDetail 有值为修改状态
|
|
68
72
|
request(apis.rule.updateRule, {
|
|
@@ -226,12 +230,17 @@ var AddRule = function AddRule(_ref) {
|
|
|
226
230
|
setEvent(val === null || val === void 0 ? void 0 : val.event);
|
|
227
231
|
};
|
|
228
232
|
// 细分属性初始值
|
|
229
|
-
var _useState13 = useState(
|
|
233
|
+
var _useState13 = useState(false),
|
|
230
234
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
hasEvent = _useState14[0],
|
|
236
|
+
setHasEvent = _useState14[1];
|
|
237
|
+
var _useState15 = useState(currentRuleDetail ? JSON.parse(currentRuleDetail === null || currentRuleDetail === void 0 ? void 0 : currentRuleDetail.extraMes) : undefined),
|
|
238
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
239
|
+
bizAttributeSelectorValue = _useState16[0],
|
|
240
|
+
setBizAttributeSelectorValue = _useState16[1];
|
|
233
241
|
// 细分属性
|
|
234
242
|
var onChangeAttr = function onChangeAttr(attr) {
|
|
243
|
+
setHasEvent(false);
|
|
235
244
|
if (attr === undefined) {
|
|
236
245
|
// 删除细分属性
|
|
237
246
|
setBizAttributeSelectorValue(undefined);
|
|
@@ -246,11 +255,15 @@ var AddRule = function AddRule(_ref) {
|
|
|
246
255
|
attr: attr === null || attr === void 0 ? void 0 : attr.id
|
|
247
256
|
}
|
|
248
257
|
}).then(function (res) {
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
258
|
+
// if (res?.code == '100000') {
|
|
259
|
+
// // 判断属性是否已经存在
|
|
260
|
+
// const exists = res.data; // 假设后端返回的数据结构中有一个字段表示是否存在
|
|
261
|
+
// !exists && message.error('该属性的规则已存在,请重新选择属性!');
|
|
262
|
+
// return;
|
|
263
|
+
// }
|
|
264
|
+
if ((res === null || res === void 0 ? void 0 : res.code) != '100000') {
|
|
265
|
+
message.error(res.msg);
|
|
266
|
+
setHasEvent(true);
|
|
254
267
|
return;
|
|
255
268
|
}
|
|
256
269
|
});
|
|
@@ -258,13 +271,6 @@ var AddRule = function AddRule(_ref) {
|
|
|
258
271
|
setBizAttributeSelectorValue(_objectSpread(_objectSpread({}, attr), {}, {
|
|
259
272
|
value: _value
|
|
260
273
|
}));
|
|
261
|
-
// 初始化属性基础类型
|
|
262
|
-
// const newArr = optionsRule.map((o) => {
|
|
263
|
-
// if (o.ruleType == 1) {
|
|
264
|
-
// o.content = attr.type;
|
|
265
|
-
// }
|
|
266
|
-
// });
|
|
267
|
-
// setOptionsRule(newArr);
|
|
268
274
|
setOptions(attr.type != '3' ? [].concat(initOptions, [{
|
|
269
275
|
label: '字典校验',
|
|
270
276
|
value: 6
|
|
@@ -294,13 +300,54 @@ var AddRule = function AddRule(_ref) {
|
|
|
294
300
|
description: currentRuleDetail === null || currentRuleDetail === void 0 ? void 0 : currentRuleDetail.ruleDescription,
|
|
295
301
|
status: (currentRuleDetail === null || currentRuleDetail === void 0 ? void 0 : currentRuleDetail.status) == 1 ? true : false
|
|
296
302
|
});
|
|
297
|
-
setOptionsRule(currentRuleDetail.verifyDetailVo);
|
|
298
|
-
setOptions(
|
|
303
|
+
// setOptionsRule(currentRuleDetail.verifyDetailVo);
|
|
304
|
+
// setOptions(
|
|
305
|
+
// currentRuleDetail.verifyDetailVo[0] && currentRuleDetail.verifyDetailVo[0].content != '3'
|
|
306
|
+
// ? [...initOptions, { label: '字典校验', value: 6 }]
|
|
307
|
+
// : [...initOptions],
|
|
308
|
+
// );
|
|
309
|
+
var newarr = currentRuleDetail.verifyDetailVo.map(function (r) {
|
|
310
|
+
return _objectSpread(_objectSpread({}, r), {}, {
|
|
311
|
+
uniqueId: generateUniqueId()
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
setOptionsRule(newarr);
|
|
315
|
+
// 回显数据时要加入一个随机id
|
|
316
|
+
setOptions(newarr[0] && newarr[0].content != '3' ? [].concat(initOptions, [{
|
|
299
317
|
label: '字典校验',
|
|
300
318
|
value: 6
|
|
301
319
|
}]) : [].concat(initOptions));
|
|
302
320
|
}
|
|
303
321
|
}, []);
|
|
322
|
+
// 禁用按钮规则
|
|
323
|
+
// { label: '属性类型', value: 1 },
|
|
324
|
+
// { label: '正则匹配', value: 2 },
|
|
325
|
+
// { label: '数值区间', value: 3 },
|
|
326
|
+
// { label: '枚举', value: 4 },
|
|
327
|
+
// { label: '非空', value: 5 },
|
|
328
|
+
// 1字符串类型 2数值类型 3日期类型
|
|
329
|
+
var handleDisabled = function handleDisabled(btnItem) {
|
|
330
|
+
var result = true;
|
|
331
|
+
// 数值类型只有 数值区间规则 / 枚举 / 字典 / 非空 /属性类型
|
|
332
|
+
if ((bizAttributeSelectorValue === null || bizAttributeSelectorValue === void 0 ? void 0 : bizAttributeSelectorValue.type) == 2 && (btnItem.value >= 3 || btnItem.value == 1)) {
|
|
333
|
+
result = false;
|
|
334
|
+
}
|
|
335
|
+
// 日期属性类型 非空/正则/属性类型
|
|
336
|
+
if ((bizAttributeSelectorValue === null || bizAttributeSelectorValue === void 0 ? void 0 : bizAttributeSelectorValue.type) == 3 && (btnItem.value == 2 || btnItem.value == 5 || btnItem.value == 1)) {
|
|
337
|
+
result = false;
|
|
338
|
+
}
|
|
339
|
+
// 字符串类型 正则 /枚举 / 非空/属性类型
|
|
340
|
+
if ((bizAttributeSelectorValue === null || bizAttributeSelectorValue === void 0 ? void 0 : bizAttributeSelectorValue.type) == 1 && (btnItem.value == 2 || btnItem.value == 5 || btnItem.value == 4 || btnItem.value == 1)) {
|
|
341
|
+
result = false;
|
|
342
|
+
}
|
|
343
|
+
// 类型只能添加一个
|
|
344
|
+
if (optionsRule.find(function (o) {
|
|
345
|
+
return o.ruleType == btnItem.value;
|
|
346
|
+
})) {
|
|
347
|
+
result = true;
|
|
348
|
+
}
|
|
349
|
+
return result;
|
|
350
|
+
};
|
|
304
351
|
return /*#__PURE__*/React.createElement("div", {
|
|
305
352
|
className: "addRule"
|
|
306
353
|
}, /*#__PURE__*/React.createElement(Drawer, {
|
|
@@ -419,6 +466,7 @@ var AddRule = function AddRule(_ref) {
|
|
|
419
466
|
return /*#__PURE__*/React.createElement(Button, {
|
|
420
467
|
key: index,
|
|
421
468
|
type: "primary",
|
|
469
|
+
disabled: handleDisabled(item),
|
|
422
470
|
onClick: function onClick() {
|
|
423
471
|
return onChangeType(item.value);
|
|
424
472
|
}
|
|
@@ -452,10 +500,10 @@ var TypeComponent = function TypeComponent(_ref2) {
|
|
|
452
500
|
var _useContext2 = useContext(BizGlobalDataContext),
|
|
453
501
|
currentApp = _useContext2.currentApp;
|
|
454
502
|
// 枚举
|
|
455
|
-
var
|
|
456
|
-
|
|
457
|
-
enumValue =
|
|
458
|
-
setEnumValue =
|
|
503
|
+
var _useState17 = useState([]),
|
|
504
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
505
|
+
enumValue = _useState18[0],
|
|
506
|
+
setEnumValue = _useState18[1];
|
|
459
507
|
var handleEnumChange = function handleEnumChange(value) {
|
|
460
508
|
setEnumValue(value);
|
|
461
509
|
optionsValue.filter(function (r) {
|
|
@@ -463,27 +511,27 @@ var TypeComponent = function TypeComponent(_ref2) {
|
|
|
463
511
|
})[0].content = value;
|
|
464
512
|
};
|
|
465
513
|
// 区间
|
|
466
|
-
var _useState17 = useState(1),
|
|
467
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
468
|
-
minNum = _useState18[0],
|
|
469
|
-
setMinNum = _useState18[1];
|
|
470
514
|
var _useState19 = useState(1),
|
|
471
515
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
var _useState21 = useState(
|
|
516
|
+
minNum = _useState20[0],
|
|
517
|
+
setMinNum = _useState20[1];
|
|
518
|
+
var _useState21 = useState(1),
|
|
475
519
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
476
|
-
|
|
477
|
-
|
|
520
|
+
maxNum = _useState22[0],
|
|
521
|
+
setMaxNum = _useState22[1];
|
|
478
522
|
var _useState23 = useState(false),
|
|
479
523
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
var _useState25 = useState([]),
|
|
524
|
+
includedMinState = _useState24[0],
|
|
525
|
+
setIncludedMinState = _useState24[1];
|
|
526
|
+
var _useState25 = useState(false),
|
|
484
527
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
485
|
-
|
|
486
|
-
|
|
528
|
+
includedMaxState = _useState26[0],
|
|
529
|
+
setIncludedMaxState = _useState26[1];
|
|
530
|
+
//字典
|
|
531
|
+
var _useState27 = useState([]),
|
|
532
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
533
|
+
dictList = _useState28[0],
|
|
534
|
+
setDictList = _useState28[1];
|
|
487
535
|
var getDictList = function getDictList() {
|
|
488
536
|
request(apis.dict.dictList, {
|
|
489
537
|
method: 'post',
|
|
@@ -496,8 +544,8 @@ var TypeComponent = function TypeComponent(_ref2) {
|
|
|
496
544
|
setDictList((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
|
|
497
545
|
return {
|
|
498
546
|
label: item.dictName,
|
|
499
|
-
value: item.id
|
|
500
|
-
id: item.id
|
|
547
|
+
value: String(item.id),
|
|
548
|
+
id: String(item.id)
|
|
501
549
|
};
|
|
502
550
|
}));
|
|
503
551
|
}
|
|
@@ -524,25 +572,38 @@ var TypeComponent = function TypeComponent(_ref2) {
|
|
|
524
572
|
getDictList();
|
|
525
573
|
}
|
|
526
574
|
}, []);
|
|
527
|
-
var
|
|
575
|
+
var _useState29 = useState((_optionsValue$find = optionsValue.find(function (o) {
|
|
528
576
|
return o.uniqueId == id;
|
|
529
577
|
})) === null || _optionsValue$find === void 0 ? void 0 : _optionsValue$find.content),
|
|
530
|
-
|
|
531
|
-
typeValue =
|
|
532
|
-
setTypeValue =
|
|
578
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
579
|
+
typeValue = _useState30[0],
|
|
580
|
+
setTypeValue = _useState30[1];
|
|
581
|
+
var _useState31 = useState(optionsValue.filter(function (r) {
|
|
582
|
+
return r.uniqueId == id;
|
|
583
|
+
})[0].content),
|
|
584
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
585
|
+
testValue = _useState32[0],
|
|
586
|
+
setTestValue = _useState32[1];
|
|
587
|
+
var _useState33 = useState(optionsValue.filter(function (r) {
|
|
588
|
+
return r.uniqueId == id;
|
|
589
|
+
})[0].content),
|
|
590
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
591
|
+
ziduanValue = _useState34[0],
|
|
592
|
+
setZiduanValue = _useState34[1];
|
|
593
|
+
// 域分类:零售、公司、同业、风险、内部管理、其他
|
|
533
594
|
switch (type) {
|
|
534
595
|
case 1:
|
|
535
596
|
Component = /*#__PURE__*/React.createElement(Select, {
|
|
536
|
-
value:
|
|
537
|
-
|
|
597
|
+
value: String(typeValue),
|
|
598
|
+
disabled: true,
|
|
538
599
|
options: [{
|
|
539
|
-
value: 1,
|
|
600
|
+
value: '1',
|
|
540
601
|
label: '字符串类型'
|
|
541
602
|
}, {
|
|
542
|
-
value: 2,
|
|
603
|
+
value: '2',
|
|
543
604
|
label: '数值类型'
|
|
544
605
|
}, {
|
|
545
|
-
value: 3,
|
|
606
|
+
value: '3',
|
|
546
607
|
label: '日期类型'
|
|
547
608
|
}],
|
|
548
609
|
onChange: function onChange(value) {
|
|
@@ -556,10 +617,9 @@ var TypeComponent = function TypeComponent(_ref2) {
|
|
|
556
617
|
case 2:
|
|
557
618
|
Component = /*#__PURE__*/React.createElement(Input, {
|
|
558
619
|
placeholder: "\u8BF7\u8F93\u5165\u6B63\u5219\u8868\u5355\u5F0F",
|
|
559
|
-
value:
|
|
560
|
-
return r.uniqueId == id;
|
|
561
|
-
})[0].content,
|
|
620
|
+
value: testValue,
|
|
562
621
|
onChange: function onChange(event) {
|
|
622
|
+
setTestValue(event.target.value);
|
|
563
623
|
optionsValue.filter(function (r) {
|
|
564
624
|
return r.uniqueId == id;
|
|
565
625
|
})[0].content = event.target.value;
|
|
@@ -634,14 +694,15 @@ var TypeComponent = function TypeComponent(_ref2) {
|
|
|
634
694
|
});
|
|
635
695
|
break;
|
|
636
696
|
case 6:
|
|
637
|
-
Component = /*#__PURE__*/React.createElement(Select
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
697
|
+
Component = /*#__PURE__*/React.createElement(Select
|
|
698
|
+
// defaultValue={optionsValue.filter((r) => r.uniqueId == id)[0].content}
|
|
699
|
+
, {
|
|
700
|
+
// defaultValue={optionsValue.filter((r) => r.uniqueId == id)[0].content}
|
|
701
|
+
value: ziduanValue,
|
|
642
702
|
placeholder: "\u9009\u62E9\u5B57\u5178\u89C4\u5219",
|
|
643
703
|
options: dictList,
|
|
644
704
|
onChange: function onChange(value) {
|
|
705
|
+
setZiduanValue(value);
|
|
645
706
|
optionsValue.filter(function (r) {
|
|
646
707
|
return r.uniqueId == id;
|
|
647
708
|
})[0].content = value;
|
|
@@ -11,8 +11,8 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
13
|
import { Tooltip, message } from 'antd';
|
|
14
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
15
|
-
import { BizEventSelector, BizAttrConditionGroup, IconFont } from '@zgfe/business-lib';
|
|
14
|
+
import React, { useEffect, useRef, useState, useContext } from 'react';
|
|
15
|
+
import { BizEventSelector, BizAttrConditionGroup, IconFont, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
16
16
|
import './styles/index.less';
|
|
17
17
|
var classPrefix = 'virtual-event-eventfilter-box';
|
|
18
18
|
var EventFilter = function EventFilter(props) {
|
|
@@ -20,6 +20,8 @@ var EventFilter = function EventFilter(props) {
|
|
|
20
20
|
index = props.index,
|
|
21
21
|
virtualDrawerType = props.virtualDrawerType,
|
|
22
22
|
selectList = props.selectList;
|
|
23
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
24
|
+
envs = _useContext.envs;
|
|
23
25
|
// 筛选条件个数
|
|
24
26
|
var _useState = useState(props.value && props.value.filters && props.value.filters.conditions ? props.value.filters.conditions.length : 0),
|
|
25
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -56,8 +58,8 @@ var EventFilter = function EventFilter(props) {
|
|
|
56
58
|
// 添加筛选
|
|
57
59
|
var onAdd = function onAdd() {
|
|
58
60
|
// 最多可添加5条属性筛选
|
|
59
|
-
if (count >= 5) {
|
|
60
|
-
message.error(
|
|
61
|
+
if (count >= ((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 5)) {
|
|
62
|
+
message.error("\u6700\u591A\u53EF\u6DFB\u52A0".concat((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 5, "\u6761\u5C5E\u6027\u7B5B\u9009"));
|
|
61
63
|
return;
|
|
62
64
|
}
|
|
63
65
|
if (selectList.length <= 0) {
|
|
@@ -122,7 +124,7 @@ var EventFilter = function EventFilter(props) {
|
|
|
122
124
|
placement: "top",
|
|
123
125
|
title: '添加属性筛选'
|
|
124
126
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
125
|
-
className: "".concat(count < 5 && selectList.length > 0 ? '' : 'disable'),
|
|
127
|
+
className: "".concat(count < ((envs === null || envs === void 0 ? void 0 : envs.propertyNum) || 5) && selectList.length > 0 ? '' : 'disable'),
|
|
126
128
|
type: "shaixuan",
|
|
127
129
|
onClick: function onClick() {
|
|
128
130
|
return onAdd();
|
|
@@ -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();
|
|
@@ -165,7 +165,8 @@ var FormulateRule = function FormulateRule() {
|
|
|
165
165
|
method: 'post',
|
|
166
166
|
data: {
|
|
167
167
|
ruleId: ruleObj.ruleId,
|
|
168
|
-
status: ruleObj.status ? 0 : 1
|
|
168
|
+
status: ruleObj.status ? 0 : 1,
|
|
169
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
|
|
169
170
|
}
|
|
170
171
|
}).then(function (res) {
|
|
171
172
|
if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-dm",
|
|
3
|
-
"version": "1.0.57-zhongyuan.
|
|
3
|
+
"version": "1.0.57-zhongyuan.41",
|
|
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.
|
|
49
|
+
"@zgfe/business-lib": "1.2.70-hxd.1",
|
|
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": "
|
|
60
|
+
"gitHead": "a6a0e1f2cb0745c2000d35f02f15c63557f9a624",
|
|
61
61
|
"gitHooks": {
|
|
62
62
|
"pre-commit": "lint-staged"
|
|
63
63
|
}
|