@bit-sun/business-component 2.4.31 → 2.4.32
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.
- package/.editorconfig +16 -16
- package/.fatherrc.ts +5 -5
- package/.gitlab-ci.yml +179 -179
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -74
- package/README.md +27 -27
- package/dist/index.esm.js +189 -244
- package/dist/index.js +195 -250
- package/dist/utils/utils.d.ts +1 -1
- package/docs/index.md +21 -21
- package/lib/assets/drag.svg +17 -17
- package/lib/assets/exportFail.svg +37 -37
- package/lib/assets/exportProcessing.svg +28 -28
- package/lib/assets/exportSuccess.svg +34 -34
- package/lib/assets/label_icon_bottom.svg +25 -25
- package/lib/assets/upExport.svg +22 -22
- package/package.json +80 -80
- package/src/assets/32.svg +27 -27
- package/src/assets/addIcon.svg +17 -17
- package/src/assets/allfunc.svg +27 -27
- package/src/assets/arrowRight.svg +24 -24
- package/src/assets/btn-delete.svg +29 -29
- package/src/assets/btn-edit.svg +19 -19
- package/src/assets/btn-more.svg +17 -17
- package/src/assets/btn-submit.svg +19 -19
- package/src/assets/caidan.svg +11 -11
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/exportFail.svg +37 -37
- package/src/assets/exportProcessing.svg +28 -28
- package/src/assets/exportSuccess.svg +34 -34
- package/src/assets/fixed-left-active.svg +11 -11
- package/src/assets/fixed-left.svg +15 -15
- package/src/assets/fixed-right-active.svg +11 -11
- package/src/assets/fixed-right.svg +15 -15
- package/src/assets/guanbi.svg +15 -15
- package/src/assets/icon-quanping.svg +15 -15
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/list-no-img.svg +21 -21
- package/src/assets/morentouxiang-32.svg +23 -23
- package/src/assets/scanning.svg +24 -24
- package/src/assets/upExport.svg +22 -22
- package/src/common/ENUM.ts +41 -41
- package/src/components/Business/AddSelectBusiness/index.md +162 -162
- package/src/components/Business/AddSelectBusiness/index.tsx +1062 -1062
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +112 -112
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +158 -158
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
- package/src/components/Business/BsLayouts/index.less +79 -79
- package/src/components/Business/BsLayouts/index.tsx +1484 -1484
- package/src/components/Business/BsLayouts/service.ts +10 -10
- package/src/components/Business/BsLayouts/utils.tsx +203 -203
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -566
- package/src/components/Business/BsSulaQueryTable/index.less +221 -221
- package/src/components/Business/BsSulaQueryTable/index.tsx +606 -606
- package/src/components/Business/BsSulaQueryTable/setting.tsx +854 -854
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
- package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -690
- package/src/components/Business/CommodityEntry/index.md +70 -70
- package/src/components/Business/CommodityEntry/index.tsx +81 -81
- package/src/components/Business/CommonAlert/index.tsx +23 -23
- package/src/components/Business/CommonGuideWrapper/index.less +111 -111
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
- package/src/components/Business/DetailPageWrapper/index.less +79 -79
- package/src/components/Business/DetailPageWrapper/index.tsx +315 -315
- package/src/components/Business/DetailPageWrapper/utils.tsx +164 -164
- package/src/components/Business/HomePageWrapper/index.less +33 -33
- package/src/components/Business/HomePageWrapper/index.md +45 -45
- package/src/components/Business/HomePageWrapper/index.tsx +162 -162
- package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +206 -206
- package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
- package/src/components/Business/JsonQueryTable/function.ts +62 -62
- package/src/components/Business/JsonQueryTable/index.less +16 -16
- package/src/components/Business/JsonQueryTable/index.md +328 -328
- package/src/components/Business/JsonQueryTable/index.tsx +537 -537
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
- package/src/components/Business/JsonQueryTable/static.ts +450 -450
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +2120 -2120
- package/src/components/Business/SearchSelect/common.ts +134 -134
- package/src/components/Business/SearchSelect/index.md +1503 -1503
- package/src/components/Business/SearchSelect/index.tsx +55 -55
- package/src/components/Business/SearchSelect/utils.ts +101 -101
- package/src/components/Business/StateFlow/index.less +130 -130
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/TreeSearchSelect/index.md +185 -185
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
- package/src/components/Business/TreeSearchSelect/utils.ts +104 -104
- package/src/components/Business/columnSettingTable/columnSetting.tsx +766 -766
- package/src/components/Business/columnSettingTable/index.less +247 -247
- package/src/components/Business/columnSettingTable/index.md +357 -357
- package/src/components/Business/columnSettingTable/index.tsx +235 -235
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +243 -243
- package/src/components/Business/columnSettingTable/utils.tsx +71 -71
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
- package/src/components/Business/moreTreeTable/index.less +99 -99
- package/src/components/Business/moreTreeTable/index.md +448 -448
- package/src/components/Business/moreTreeTable/index.tsx +387 -387
- package/src/components/Business/moreTreeTable/utils.ts +126 -126
- package/src/components/Functional/AddSelect/helps.ts +80 -80
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.md +155 -155
- package/src/components/Functional/AddSelect/index.tsx +1171 -1171
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +39 -39
- package/src/components/Functional/BillEntry/index.tsx +773 -773
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
- package/src/components/Functional/BsAntdSula/index.ts +2 -2
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +696 -696
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +39 -39
- package/src/components/Functional/DataValidation/index.tsx +688 -688
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
- package/src/components/Functional/EllipsisTooltip/index.js +36 -36
- package/src/components/Functional/EllipsisTooltip/index.md +30 -30
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +60 -60
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
- package/src/components/Functional/SearchSelect/index.less +115 -115
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +897 -896
- package/src/components/Functional/SearchSelect/utils.ts +3 -3
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +204 -204
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
- package/src/components/Solution/RuleComponent/index.d.ts +29 -29
- package/src/components/Solution/RuleComponent/index.js +2103 -2103
- package/src/components/Solution/RuleComponent/index.less +229 -229
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/ruleFiled.js +2293 -2293
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/components/Solution/RuleComponent/util.js +143 -143
- package/src/components/Solution/RuleSetter/RuleInstance.tsx +6 -6
- package/src/components/Solution/RuleSetter/baseRule.tsx +368 -368
- package/src/components/Solution/RuleSetter/function.ts +336 -336
- package/src/components/Solution/RuleSetter/index.less +221 -221
- package/src/components/Solution/RuleSetter/index.tsx +208 -208
- package/src/components/Solution/RuleSetter/service.js +276 -276
- package/src/index.ts +40 -40
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +725 -725
- package/src/plugin/TableColumnSetting/utils.ts +19 -19
- package/src/styles/bsDefault.less +1912 -1912
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/CustomLoginInfo.ts +55 -55
- package/src/utils/LocalstorageUtils.ts +128 -128
- package/src/utils/TableUtils.tsx +18 -18
- package/src/utils/auth.ts +32 -32
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/enumConfig.ts +16 -16
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +12 -12
- package/src/utils/requestUtils.ts +166 -166
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +195 -195
- package/tsconfig.json +29 -29
- package/typings.d.ts +4 -4
|
@@ -1,368 +1,368 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useEffect,
|
|
3
|
-
useState,
|
|
4
|
-
forwardRef,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useCallback,
|
|
7
|
-
useMemo,
|
|
8
|
-
} from 'react';
|
|
9
|
-
import _ from 'lodash';
|
|
10
|
-
import RuleObjectComponent from '../RuleComponent/index.js';
|
|
11
|
-
import { Spin, Space, Modal, message } from 'antd';
|
|
12
|
-
import styles from './index.less';
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import { history } from 'umi';
|
|
15
|
-
import { request } from 'bssula';
|
|
16
|
-
import {
|
|
17
|
-
handleRuleResultList,
|
|
18
|
-
handleRuleShowBack,
|
|
19
|
-
handleRuleRequireCheck,
|
|
20
|
-
getInitClassData,
|
|
21
|
-
} from './function';
|
|
22
|
-
|
|
23
|
-
export default forwardRef((props: any, ref) => {
|
|
24
|
-
const {
|
|
25
|
-
scenceParams,
|
|
26
|
-
operationList = [],
|
|
27
|
-
regularDataList = [],
|
|
28
|
-
baseRuleDetailList = [],
|
|
29
|
-
systemVariableList = [],
|
|
30
|
-
defRuleDetail = {},
|
|
31
|
-
} = props;
|
|
32
|
-
const sceneId = scenceParams?.sceneId;
|
|
33
|
-
const sceneName = scenceParams?.sceneName;
|
|
34
|
-
const type = scenceParams?.type;
|
|
35
|
-
const ruleGroupList = scenceParams?.ruleGroupList;
|
|
36
|
-
const isGetDefRuleDataRes = scenceParams?.isGetDefRuleDataRes;
|
|
37
|
-
const isGetRuleDataRes = scenceParams?.isGetRuleDataRes;
|
|
38
|
-
const groupOtherPriorityList = scenceParams?.groupOtherPriorityList;
|
|
39
|
-
const extStrField01 = scenceParams?.extStrField01;
|
|
40
|
-
const instanceName = scenceParams?.instanceName;
|
|
41
|
-
|
|
42
|
-
const initialThresholdQuery = {};
|
|
43
|
-
|
|
44
|
-
const [loading, setLoading] = useState(false);
|
|
45
|
-
const [baseClassData, setBaseClassData] = useState<any>([]);
|
|
46
|
-
const [callbackData, setCallbackData] = useState<any>([]);
|
|
47
|
-
const [ruleTypeData, setRuleTypeData] = useState<any>([]);
|
|
48
|
-
const [ruleReturnConfig, setRuleReturnConfig] = useState<any>({});
|
|
49
|
-
const [templateData, setTemplateData] = useState<any>({});
|
|
50
|
-
|
|
51
|
-
const loadRuleReturnConfig = (currentSceneId: string) => {
|
|
52
|
-
request({
|
|
53
|
-
url: `/basic/ruleTemplate/${currentSceneId}`,
|
|
54
|
-
method: 'GET',
|
|
55
|
-
converter: (res: any) => {
|
|
56
|
-
return res;
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
.then(({ response }: any) => {
|
|
60
|
-
const rRConfig =
|
|
61
|
-
(response?.data?.ext && JSON.parse(response?.data?.ext)?.config) ||
|
|
62
|
-
{};
|
|
63
|
-
setRuleReturnConfig(rRConfig);
|
|
64
|
-
})
|
|
65
|
-
.catch(() => {});
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const loadRuleConfigList = (currentSceneId: string) => {
|
|
69
|
-
request({
|
|
70
|
-
url: '/basic/ruleTemplate/result',
|
|
71
|
-
method: 'GET',
|
|
72
|
-
convertParams: () => {
|
|
73
|
-
return {
|
|
74
|
-
templateId: currentSceneId,
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
converter: (res: any) => {
|
|
78
|
-
return res;
|
|
79
|
-
},
|
|
80
|
-
})
|
|
81
|
-
.then(({ response }: any) => {
|
|
82
|
-
const functionRuleConfigList =
|
|
83
|
-
(Array.isArray(response?.data) &&
|
|
84
|
-
response?.data?.length &&
|
|
85
|
-
response.data.map((i: any) => {
|
|
86
|
-
const item = { ...i };
|
|
87
|
-
const ruleConfigList =
|
|
88
|
-
(Array.isArray(i.valueList) &&
|
|
89
|
-
i.valueList?.length &&
|
|
90
|
-
i.valueList.map((s: any) => JSON.parse(s))) ||
|
|
91
|
-
[];
|
|
92
|
-
if (ruleConfigList?.length) {
|
|
93
|
-
item.valueList = ruleConfigList.sort(
|
|
94
|
-
(a: any, b: any) => a.priority - b.priority,
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
return item;
|
|
98
|
-
})) ||
|
|
99
|
-
[];
|
|
100
|
-
setRuleTypeData(functionRuleConfigList);
|
|
101
|
-
})
|
|
102
|
-
.catch(() => {});
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (sceneId) {
|
|
107
|
-
loadRuleReturnConfig(sceneId);
|
|
108
|
-
loadRuleConfigList(sceneId);
|
|
109
|
-
}
|
|
110
|
-
}, [sceneId]);
|
|
111
|
-
|
|
112
|
-
const defRuleDetailId = defRuleDetail?.id;
|
|
113
|
-
const baseRuleDetailListFirstId = baseRuleDetailList?.[0]?.id;
|
|
114
|
-
// 处理规则设计器/规则实例 差异
|
|
115
|
-
const handleDiff = () => {
|
|
116
|
-
let diffResult: any = {};
|
|
117
|
-
if (!type) {
|
|
118
|
-
diffResult = {
|
|
119
|
-
title: `规则设计器${sceneName ? `【${sceneName}】` : ''}`,
|
|
120
|
-
onlyOneRule: true,
|
|
121
|
-
ruleList: (defRuleDetailId && [defRuleDetail]) || [],
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
if (type == 'instance') {
|
|
125
|
-
diffResult = {
|
|
126
|
-
title: sceneName || '规则实例',
|
|
127
|
-
onlyOneRule: false,
|
|
128
|
-
ruleList:
|
|
129
|
-
baseRuleDetailList?.sort(
|
|
130
|
-
(a: any, b: any) => a.priority - b.priority,
|
|
131
|
-
) || [],
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return diffResult;
|
|
135
|
-
};
|
|
136
|
-
const ruleList = useMemo(() => {
|
|
137
|
-
const rList = handleDiff().ruleList;
|
|
138
|
-
return rList;
|
|
139
|
-
}, [defRuleDetailId, baseRuleDetailListFirstId]);
|
|
140
|
-
|
|
141
|
-
const isTemplateRuleEdit = ruleList?.length;
|
|
142
|
-
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
// 新增设计器模板
|
|
145
|
-
if (isGetDefRuleDataRes && !defRuleDetailId && !type) {
|
|
146
|
-
const initData = getInitClassData(ruleTypeData);
|
|
147
|
-
setCallbackData(initData);
|
|
148
|
-
setBaseClassData(initData);
|
|
149
|
-
}
|
|
150
|
-
// 新增规则实例
|
|
151
|
-
if (
|
|
152
|
-
isGetRuleDataRes &&
|
|
153
|
-
isGetDefRuleDataRes &&
|
|
154
|
-
!baseRuleDetailList?.[0]?.id &&
|
|
155
|
-
type == 'instance'
|
|
156
|
-
) {
|
|
157
|
-
const templateList =
|
|
158
|
-
(defRuleDetail && defRuleDetailId && [defRuleDetail]) || [];
|
|
159
|
-
const isExitTemplateOne = templateList?.length;
|
|
160
|
-
const temp = handleRuleShowBack(
|
|
161
|
-
_.cloneDeep(templateList),
|
|
162
|
-
ruleTypeData,
|
|
163
|
-
)[0];
|
|
164
|
-
const templateInitOne = [_.omit(_.cloneDeep(temp), ['id', 'ruleId'])]; // 自动显示一条规则实例不能过滤ruleName,防止删除报错
|
|
165
|
-
const initData = isExitTemplateOne
|
|
166
|
-
? templateInitOne
|
|
167
|
-
: getInitClassData(ruleTypeData);
|
|
168
|
-
setCallbackData(initData);
|
|
169
|
-
setBaseClassData(initData);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// 编辑
|
|
173
|
-
if (isTemplateRuleEdit) {
|
|
174
|
-
const newData = handleRuleShowBack(ruleList, ruleTypeData);
|
|
175
|
-
setCallbackData(newData);
|
|
176
|
-
setBaseClassData(newData);
|
|
177
|
-
}
|
|
178
|
-
// 设置规则实例模板数据
|
|
179
|
-
if (defRuleDetailId && type == 'instance') {
|
|
180
|
-
const templateList = (defRuleDetailId && [defRuleDetail]) || [];
|
|
181
|
-
const isExitTemplateOne = templateList?.length;
|
|
182
|
-
if (isExitTemplateOne) {
|
|
183
|
-
const temp = handleRuleShowBack(
|
|
184
|
-
_.cloneDeep(templateList),
|
|
185
|
-
ruleTypeData,
|
|
186
|
-
)[0];
|
|
187
|
-
setTemplateData(
|
|
188
|
-
_.omit(_.cloneDeep(temp), ['id', 'ruleId', 'ruleName']),
|
|
189
|
-
); // 设置默认模板数据需要带上ruleName,因为这个ruleName不准确,在点击新增按钮还会重新生成
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}, [
|
|
193
|
-
isTemplateRuleEdit,
|
|
194
|
-
ruleTypeData?.length,
|
|
195
|
-
isGetDefRuleDataRes,
|
|
196
|
-
isGetRuleDataRes,
|
|
197
|
-
]);
|
|
198
|
-
|
|
199
|
-
const upDateData = (newData: any) => {
|
|
200
|
-
const upNewData = _.cloneDeep(newData);
|
|
201
|
-
setCallbackData(upNewData);
|
|
202
|
-
const handleBaseClassData = upNewData.map((item: any, index: string) => {
|
|
203
|
-
const itemData = {
|
|
204
|
-
...item,
|
|
205
|
-
extraInfo: {
|
|
206
|
-
response: {
|
|
207
|
-
inputType: item?.extraInfo?.response?.inputType,
|
|
208
|
-
formulaName: item?.extraInfo?.response?.formulaName,
|
|
209
|
-
enable: item?.extraInfo?.response?.enable !== false,
|
|
210
|
-
value: item?.extraInfo?.response?.value || '',
|
|
211
|
-
},
|
|
212
|
-
execute: ruleTypeData.map((s: any) => {
|
|
213
|
-
const mItem = (item?.extraInfo?.execute || []).find(
|
|
214
|
-
(u: any) => u.code === s.code,
|
|
215
|
-
);
|
|
216
|
-
if (mItem) {
|
|
217
|
-
return mItem;
|
|
218
|
-
}
|
|
219
|
-
return {
|
|
220
|
-
priority: 1,
|
|
221
|
-
code: s.code,
|
|
222
|
-
properties: {
|
|
223
|
-
configPropertyCode: 'configPropertyValue',
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
}),
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
return itemData;
|
|
230
|
-
});
|
|
231
|
-
setBaseClassData(handleBaseClassData);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
const handleSave = (needCheckOnlyOne: boolean = false) => {
|
|
235
|
-
const ruleResultList = handleRuleResultList(callbackData, ruleTypeData);
|
|
236
|
-
if (needCheckOnlyOne && ruleResultList?.length === 0) {
|
|
237
|
-
message.warning('请至少配置一个规则!');
|
|
238
|
-
return Promise.reject();
|
|
239
|
-
}
|
|
240
|
-
const actionRequiredCheckObject = handleRuleRequireCheck(
|
|
241
|
-
ruleResultList,
|
|
242
|
-
ruleTypeData,
|
|
243
|
-
);
|
|
244
|
-
if (actionRequiredCheckObject?.checkResult) {
|
|
245
|
-
const modal = Modal.warning({
|
|
246
|
-
title: '保存校验提示',
|
|
247
|
-
content: actionRequiredCheckObject.checkInfo.map((i: any) => (
|
|
248
|
-
<div>{i}</div>
|
|
249
|
-
)),
|
|
250
|
-
});
|
|
251
|
-
setTimeout(() => {
|
|
252
|
-
modal.destroy();
|
|
253
|
-
}, 10000);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// setLoading(true);
|
|
258
|
-
|
|
259
|
-
// 兼容没有规则组的情况
|
|
260
|
-
const params = ruleGroupList?.length
|
|
261
|
-
? ruleGroupList.map((groupItem: any) => ({
|
|
262
|
-
ruleDetailList: ruleResultList.map((i: any) => ({
|
|
263
|
-
...i,
|
|
264
|
-
status: i.status || 0, // 状态:0-待发布,1-已发布,2-停用
|
|
265
|
-
ruleId: groupItem.id,
|
|
266
|
-
templateId: sceneId, // 模板id
|
|
267
|
-
...(extStrField01
|
|
268
|
-
? { extStrField01: extStrField01 || i?.extStrField01 }
|
|
269
|
-
: {}),
|
|
270
|
-
...(instanceName ? { name: instanceName || i?.name } : {}),
|
|
271
|
-
})),
|
|
272
|
-
...(extStrField01 ? { extStrField01 } : {}),
|
|
273
|
-
ruleId: groupItem.id,
|
|
274
|
-
templateId: sceneId,
|
|
275
|
-
}))
|
|
276
|
-
: [
|
|
277
|
-
{
|
|
278
|
-
ruleDetailList: ruleResultList.map((i: any) => ({
|
|
279
|
-
...i,
|
|
280
|
-
status: i.status || 0,
|
|
281
|
-
templateId: sceneId,
|
|
282
|
-
...(extStrField01
|
|
283
|
-
? { extStrField01: extStrField01 || i?.extStrField01 }
|
|
284
|
-
: {}),
|
|
285
|
-
...(instanceName ? { name: instanceName || i?.name } : {}),
|
|
286
|
-
})),
|
|
287
|
-
...(extStrField01 ? { extStrField01 } : {}),
|
|
288
|
-
templateId: sceneId,
|
|
289
|
-
},
|
|
290
|
-
];
|
|
291
|
-
|
|
292
|
-
const handleUrl = `/basic/ruleDetail/addAndUpdate`;
|
|
293
|
-
const handleMethod = 'POST';
|
|
294
|
-
|
|
295
|
-
return request({
|
|
296
|
-
url: handleUrl,
|
|
297
|
-
method: handleMethod,
|
|
298
|
-
convertParams: () => {
|
|
299
|
-
return params;
|
|
300
|
-
},
|
|
301
|
-
converter: (res: any) => {
|
|
302
|
-
return res;
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
// .then(({ response }: any) => {
|
|
306
|
-
// setLoading(false);
|
|
307
|
-
// if (handleError(response)) {
|
|
308
|
-
// message.success('保存成功');
|
|
309
|
-
// !type ? loadDefRuleData(sceneId) : loadRuleData(sceneId,extStrField01);
|
|
310
|
-
// }
|
|
311
|
-
// })
|
|
312
|
-
// .catch(() => {
|
|
313
|
-
// setLoading(false);
|
|
314
|
-
// });
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
useImperativeHandle(ref, () => ({
|
|
318
|
-
handleSave,
|
|
319
|
-
}));
|
|
320
|
-
|
|
321
|
-
return (
|
|
322
|
-
<Spin spinning={loading}>
|
|
323
|
-
<div className={styles.base_rule}>
|
|
324
|
-
<div className={styles.base_rule_content}>
|
|
325
|
-
<p className={styles.base_rule_line_title}>
|
|
326
|
-
<span className={styles.rule_title}>{handleDiff()?.title}</span>
|
|
327
|
-
<p style={{ float: 'right' }} />
|
|
328
|
-
</p>
|
|
329
|
-
<div>
|
|
330
|
-
{/* @ts-ignore */}
|
|
331
|
-
{sceneId ? (<RuleObjectComponent
|
|
332
|
-
{...props?.RuleObjectComponentProps}
|
|
333
|
-
onlyOneRule={handleDiff()?.onlyOneRule}
|
|
334
|
-
ruleGroupInfo={{
|
|
335
|
-
ruleGroupList,
|
|
336
|
-
type,
|
|
337
|
-
templateData,
|
|
338
|
-
groupOtherPriorityList,
|
|
339
|
-
}}
|
|
340
|
-
ruleClassData={baseClassData}
|
|
341
|
-
initialThresholdQuery={initialThresholdQuery}
|
|
342
|
-
ruleTypeData={ruleTypeData}
|
|
343
|
-
ruleReturnConfig={ruleReturnConfig}
|
|
344
|
-
operationList={operationList}
|
|
345
|
-
regularDataList={regularDataList}
|
|
346
|
-
systemVariableList={systemVariableList}
|
|
347
|
-
callBack={(newData: any) => {
|
|
348
|
-
upDateData(newData);
|
|
349
|
-
}}
|
|
350
|
-
/>
|
|
351
|
-
) : (
|
|
352
|
-
<div style={{ padding: 20 }}>
|
|
353
|
-
请先选择
|
|
354
|
-
<a
|
|
355
|
-
onClick={() =>
|
|
356
|
-
history.push('/rules-center/rules-of-the-scene')
|
|
357
|
-
}
|
|
358
|
-
>
|
|
359
|
-
模板
|
|
360
|
-
</a>
|
|
361
|
-
</div>
|
|
362
|
-
)}
|
|
363
|
-
</div>
|
|
364
|
-
</div>
|
|
365
|
-
</div>
|
|
366
|
-
</Spin>
|
|
367
|
-
);
|
|
368
|
-
});
|
|
1
|
+
import React, {
|
|
2
|
+
useEffect,
|
|
3
|
+
useState,
|
|
4
|
+
forwardRef,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useCallback,
|
|
7
|
+
useMemo,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import RuleObjectComponent from '../RuleComponent/index.js';
|
|
11
|
+
import { Spin, Space, Modal, message } from 'antd';
|
|
12
|
+
import styles from './index.less';
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import { history } from 'umi';
|
|
15
|
+
import { request } from 'bssula';
|
|
16
|
+
import {
|
|
17
|
+
handleRuleResultList,
|
|
18
|
+
handleRuleShowBack,
|
|
19
|
+
handleRuleRequireCheck,
|
|
20
|
+
getInitClassData,
|
|
21
|
+
} from './function';
|
|
22
|
+
|
|
23
|
+
export default forwardRef((props: any, ref) => {
|
|
24
|
+
const {
|
|
25
|
+
scenceParams,
|
|
26
|
+
operationList = [],
|
|
27
|
+
regularDataList = [],
|
|
28
|
+
baseRuleDetailList = [],
|
|
29
|
+
systemVariableList = [],
|
|
30
|
+
defRuleDetail = {},
|
|
31
|
+
} = props;
|
|
32
|
+
const sceneId = scenceParams?.sceneId;
|
|
33
|
+
const sceneName = scenceParams?.sceneName;
|
|
34
|
+
const type = scenceParams?.type;
|
|
35
|
+
const ruleGroupList = scenceParams?.ruleGroupList;
|
|
36
|
+
const isGetDefRuleDataRes = scenceParams?.isGetDefRuleDataRes;
|
|
37
|
+
const isGetRuleDataRes = scenceParams?.isGetRuleDataRes;
|
|
38
|
+
const groupOtherPriorityList = scenceParams?.groupOtherPriorityList;
|
|
39
|
+
const extStrField01 = scenceParams?.extStrField01;
|
|
40
|
+
const instanceName = scenceParams?.instanceName;
|
|
41
|
+
|
|
42
|
+
const initialThresholdQuery = {};
|
|
43
|
+
|
|
44
|
+
const [loading, setLoading] = useState(false);
|
|
45
|
+
const [baseClassData, setBaseClassData] = useState<any>([]);
|
|
46
|
+
const [callbackData, setCallbackData] = useState<any>([]);
|
|
47
|
+
const [ruleTypeData, setRuleTypeData] = useState<any>([]);
|
|
48
|
+
const [ruleReturnConfig, setRuleReturnConfig] = useState<any>({});
|
|
49
|
+
const [templateData, setTemplateData] = useState<any>({});
|
|
50
|
+
|
|
51
|
+
const loadRuleReturnConfig = (currentSceneId: string) => {
|
|
52
|
+
request({
|
|
53
|
+
url: `/basic/ruleTemplate/${currentSceneId}`,
|
|
54
|
+
method: 'GET',
|
|
55
|
+
converter: (res: any) => {
|
|
56
|
+
return res;
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
.then(({ response }: any) => {
|
|
60
|
+
const rRConfig =
|
|
61
|
+
(response?.data?.ext && JSON.parse(response?.data?.ext)?.config) ||
|
|
62
|
+
{};
|
|
63
|
+
setRuleReturnConfig(rRConfig);
|
|
64
|
+
})
|
|
65
|
+
.catch(() => {});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const loadRuleConfigList = (currentSceneId: string) => {
|
|
69
|
+
request({
|
|
70
|
+
url: '/basic/ruleTemplate/result',
|
|
71
|
+
method: 'GET',
|
|
72
|
+
convertParams: () => {
|
|
73
|
+
return {
|
|
74
|
+
templateId: currentSceneId,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
converter: (res: any) => {
|
|
78
|
+
return res;
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
.then(({ response }: any) => {
|
|
82
|
+
const functionRuleConfigList =
|
|
83
|
+
(Array.isArray(response?.data) &&
|
|
84
|
+
response?.data?.length &&
|
|
85
|
+
response.data.map((i: any) => {
|
|
86
|
+
const item = { ...i };
|
|
87
|
+
const ruleConfigList =
|
|
88
|
+
(Array.isArray(i.valueList) &&
|
|
89
|
+
i.valueList?.length &&
|
|
90
|
+
i.valueList.map((s: any) => JSON.parse(s))) ||
|
|
91
|
+
[];
|
|
92
|
+
if (ruleConfigList?.length) {
|
|
93
|
+
item.valueList = ruleConfigList.sort(
|
|
94
|
+
(a: any, b: any) => a.priority - b.priority,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return item;
|
|
98
|
+
})) ||
|
|
99
|
+
[];
|
|
100
|
+
setRuleTypeData(functionRuleConfigList);
|
|
101
|
+
})
|
|
102
|
+
.catch(() => {});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (sceneId) {
|
|
107
|
+
loadRuleReturnConfig(sceneId);
|
|
108
|
+
loadRuleConfigList(sceneId);
|
|
109
|
+
}
|
|
110
|
+
}, [sceneId]);
|
|
111
|
+
|
|
112
|
+
const defRuleDetailId = defRuleDetail?.id;
|
|
113
|
+
const baseRuleDetailListFirstId = baseRuleDetailList?.[0]?.id;
|
|
114
|
+
// 处理规则设计器/规则实例 差异
|
|
115
|
+
const handleDiff = () => {
|
|
116
|
+
let diffResult: any = {};
|
|
117
|
+
if (!type) {
|
|
118
|
+
diffResult = {
|
|
119
|
+
title: `规则设计器${sceneName ? `【${sceneName}】` : ''}`,
|
|
120
|
+
onlyOneRule: true,
|
|
121
|
+
ruleList: (defRuleDetailId && [defRuleDetail]) || [],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (type == 'instance') {
|
|
125
|
+
diffResult = {
|
|
126
|
+
title: sceneName || '规则实例',
|
|
127
|
+
onlyOneRule: false,
|
|
128
|
+
ruleList:
|
|
129
|
+
baseRuleDetailList?.sort(
|
|
130
|
+
(a: any, b: any) => a.priority - b.priority,
|
|
131
|
+
) || [],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return diffResult;
|
|
135
|
+
};
|
|
136
|
+
const ruleList = useMemo(() => {
|
|
137
|
+
const rList = handleDiff().ruleList;
|
|
138
|
+
return rList;
|
|
139
|
+
}, [defRuleDetailId, baseRuleDetailListFirstId]);
|
|
140
|
+
|
|
141
|
+
const isTemplateRuleEdit = ruleList?.length;
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
// 新增设计器模板
|
|
145
|
+
if (isGetDefRuleDataRes && !defRuleDetailId && !type) {
|
|
146
|
+
const initData = getInitClassData(ruleTypeData);
|
|
147
|
+
setCallbackData(initData);
|
|
148
|
+
setBaseClassData(initData);
|
|
149
|
+
}
|
|
150
|
+
// 新增规则实例
|
|
151
|
+
if (
|
|
152
|
+
isGetRuleDataRes &&
|
|
153
|
+
isGetDefRuleDataRes &&
|
|
154
|
+
!baseRuleDetailList?.[0]?.id &&
|
|
155
|
+
type == 'instance'
|
|
156
|
+
) {
|
|
157
|
+
const templateList =
|
|
158
|
+
(defRuleDetail && defRuleDetailId && [defRuleDetail]) || [];
|
|
159
|
+
const isExitTemplateOne = templateList?.length;
|
|
160
|
+
const temp = handleRuleShowBack(
|
|
161
|
+
_.cloneDeep(templateList),
|
|
162
|
+
ruleTypeData,
|
|
163
|
+
)[0];
|
|
164
|
+
const templateInitOne = [_.omit(_.cloneDeep(temp), ['id', 'ruleId'])]; // 自动显示一条规则实例不能过滤ruleName,防止删除报错
|
|
165
|
+
const initData = isExitTemplateOne
|
|
166
|
+
? templateInitOne
|
|
167
|
+
: getInitClassData(ruleTypeData);
|
|
168
|
+
setCallbackData(initData);
|
|
169
|
+
setBaseClassData(initData);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 编辑
|
|
173
|
+
if (isTemplateRuleEdit) {
|
|
174
|
+
const newData = handleRuleShowBack(ruleList, ruleTypeData);
|
|
175
|
+
setCallbackData(newData);
|
|
176
|
+
setBaseClassData(newData);
|
|
177
|
+
}
|
|
178
|
+
// 设置规则实例模板数据
|
|
179
|
+
if (defRuleDetailId && type == 'instance') {
|
|
180
|
+
const templateList = (defRuleDetailId && [defRuleDetail]) || [];
|
|
181
|
+
const isExitTemplateOne = templateList?.length;
|
|
182
|
+
if (isExitTemplateOne) {
|
|
183
|
+
const temp = handleRuleShowBack(
|
|
184
|
+
_.cloneDeep(templateList),
|
|
185
|
+
ruleTypeData,
|
|
186
|
+
)[0];
|
|
187
|
+
setTemplateData(
|
|
188
|
+
_.omit(_.cloneDeep(temp), ['id', 'ruleId', 'ruleName']),
|
|
189
|
+
); // 设置默认模板数据需要带上ruleName,因为这个ruleName不准确,在点击新增按钮还会重新生成
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}, [
|
|
193
|
+
isTemplateRuleEdit,
|
|
194
|
+
ruleTypeData?.length,
|
|
195
|
+
isGetDefRuleDataRes,
|
|
196
|
+
isGetRuleDataRes,
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
const upDateData = (newData: any) => {
|
|
200
|
+
const upNewData = _.cloneDeep(newData);
|
|
201
|
+
setCallbackData(upNewData);
|
|
202
|
+
const handleBaseClassData = upNewData.map((item: any, index: string) => {
|
|
203
|
+
const itemData = {
|
|
204
|
+
...item,
|
|
205
|
+
extraInfo: {
|
|
206
|
+
response: {
|
|
207
|
+
inputType: item?.extraInfo?.response?.inputType,
|
|
208
|
+
formulaName: item?.extraInfo?.response?.formulaName,
|
|
209
|
+
enable: item?.extraInfo?.response?.enable !== false,
|
|
210
|
+
value: item?.extraInfo?.response?.value || '',
|
|
211
|
+
},
|
|
212
|
+
execute: ruleTypeData.map((s: any) => {
|
|
213
|
+
const mItem = (item?.extraInfo?.execute || []).find(
|
|
214
|
+
(u: any) => u.code === s.code,
|
|
215
|
+
);
|
|
216
|
+
if (mItem) {
|
|
217
|
+
return mItem;
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
priority: 1,
|
|
221
|
+
code: s.code,
|
|
222
|
+
properties: {
|
|
223
|
+
configPropertyCode: 'configPropertyValue',
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}),
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
return itemData;
|
|
230
|
+
});
|
|
231
|
+
setBaseClassData(handleBaseClassData);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const handleSave = (needCheckOnlyOne: boolean = false) => {
|
|
235
|
+
const ruleResultList = handleRuleResultList(callbackData, ruleTypeData);
|
|
236
|
+
if (needCheckOnlyOne && ruleResultList?.length === 0) {
|
|
237
|
+
message.warning('请至少配置一个规则!');
|
|
238
|
+
return Promise.reject();
|
|
239
|
+
}
|
|
240
|
+
const actionRequiredCheckObject = handleRuleRequireCheck(
|
|
241
|
+
ruleResultList,
|
|
242
|
+
ruleTypeData,
|
|
243
|
+
);
|
|
244
|
+
if (actionRequiredCheckObject?.checkResult) {
|
|
245
|
+
const modal = Modal.warning({
|
|
246
|
+
title: '保存校验提示',
|
|
247
|
+
content: actionRequiredCheckObject.checkInfo.map((i: any) => (
|
|
248
|
+
<div>{i}</div>
|
|
249
|
+
)),
|
|
250
|
+
});
|
|
251
|
+
setTimeout(() => {
|
|
252
|
+
modal.destroy();
|
|
253
|
+
}, 10000);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// setLoading(true);
|
|
258
|
+
|
|
259
|
+
// 兼容没有规则组的情况
|
|
260
|
+
const params = ruleGroupList?.length
|
|
261
|
+
? ruleGroupList.map((groupItem: any) => ({
|
|
262
|
+
ruleDetailList: ruleResultList.map((i: any) => ({
|
|
263
|
+
...i,
|
|
264
|
+
status: i.status || 0, // 状态:0-待发布,1-已发布,2-停用
|
|
265
|
+
ruleId: groupItem.id,
|
|
266
|
+
templateId: sceneId, // 模板id
|
|
267
|
+
...(extStrField01
|
|
268
|
+
? { extStrField01: extStrField01 || i?.extStrField01 }
|
|
269
|
+
: {}),
|
|
270
|
+
...(instanceName ? { name: instanceName || i?.name } : {}),
|
|
271
|
+
})),
|
|
272
|
+
...(extStrField01 ? { extStrField01 } : {}),
|
|
273
|
+
ruleId: groupItem.id,
|
|
274
|
+
templateId: sceneId,
|
|
275
|
+
}))
|
|
276
|
+
: [
|
|
277
|
+
{
|
|
278
|
+
ruleDetailList: ruleResultList.map((i: any) => ({
|
|
279
|
+
...i,
|
|
280
|
+
status: i.status || 0,
|
|
281
|
+
templateId: sceneId,
|
|
282
|
+
...(extStrField01
|
|
283
|
+
? { extStrField01: extStrField01 || i?.extStrField01 }
|
|
284
|
+
: {}),
|
|
285
|
+
...(instanceName ? { name: instanceName || i?.name } : {}),
|
|
286
|
+
})),
|
|
287
|
+
...(extStrField01 ? { extStrField01 } : {}),
|
|
288
|
+
templateId: sceneId,
|
|
289
|
+
},
|
|
290
|
+
];
|
|
291
|
+
|
|
292
|
+
const handleUrl = `/basic/ruleDetail/addAndUpdate`;
|
|
293
|
+
const handleMethod = 'POST';
|
|
294
|
+
|
|
295
|
+
return request({
|
|
296
|
+
url: handleUrl,
|
|
297
|
+
method: handleMethod,
|
|
298
|
+
convertParams: () => {
|
|
299
|
+
return params;
|
|
300
|
+
},
|
|
301
|
+
converter: (res: any) => {
|
|
302
|
+
return res;
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
// .then(({ response }: any) => {
|
|
306
|
+
// setLoading(false);
|
|
307
|
+
// if (handleError(response)) {
|
|
308
|
+
// message.success('保存成功');
|
|
309
|
+
// !type ? loadDefRuleData(sceneId) : loadRuleData(sceneId,extStrField01);
|
|
310
|
+
// }
|
|
311
|
+
// })
|
|
312
|
+
// .catch(() => {
|
|
313
|
+
// setLoading(false);
|
|
314
|
+
// });
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
useImperativeHandle(ref, () => ({
|
|
318
|
+
handleSave,
|
|
319
|
+
}));
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<Spin spinning={loading}>
|
|
323
|
+
<div className={styles.base_rule}>
|
|
324
|
+
<div className={styles.base_rule_content}>
|
|
325
|
+
<p className={styles.base_rule_line_title}>
|
|
326
|
+
<span className={styles.rule_title}>{handleDiff()?.title}</span>
|
|
327
|
+
<p style={{ float: 'right' }} />
|
|
328
|
+
</p>
|
|
329
|
+
<div>
|
|
330
|
+
{/* @ts-ignore */}
|
|
331
|
+
{sceneId ? (<RuleObjectComponent
|
|
332
|
+
{...props?.RuleObjectComponentProps}
|
|
333
|
+
onlyOneRule={handleDiff()?.onlyOneRule}
|
|
334
|
+
ruleGroupInfo={{
|
|
335
|
+
ruleGroupList,
|
|
336
|
+
type,
|
|
337
|
+
templateData,
|
|
338
|
+
groupOtherPriorityList,
|
|
339
|
+
}}
|
|
340
|
+
ruleClassData={baseClassData}
|
|
341
|
+
initialThresholdQuery={initialThresholdQuery}
|
|
342
|
+
ruleTypeData={ruleTypeData}
|
|
343
|
+
ruleReturnConfig={ruleReturnConfig}
|
|
344
|
+
operationList={operationList}
|
|
345
|
+
regularDataList={regularDataList}
|
|
346
|
+
systemVariableList={systemVariableList}
|
|
347
|
+
callBack={(newData: any) => {
|
|
348
|
+
upDateData(newData);
|
|
349
|
+
}}
|
|
350
|
+
/>
|
|
351
|
+
) : (
|
|
352
|
+
<div style={{ padding: 20 }}>
|
|
353
|
+
请先选择
|
|
354
|
+
<a
|
|
355
|
+
onClick={() =>
|
|
356
|
+
history.push('/rules-center/rules-of-the-scene')
|
|
357
|
+
}
|
|
358
|
+
>
|
|
359
|
+
模板
|
|
360
|
+
</a>
|
|
361
|
+
</div>
|
|
362
|
+
)}
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
</Spin>
|
|
367
|
+
);
|
|
368
|
+
});
|