@bit-sun/business-component 2.3.21 → 2.3.23
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/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
- package/dist/components/Functional/AddSelect/helps.d.ts +13 -0
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
- package/dist/index.esm.js +1338 -1258
- package/dist/index.js +1344 -1264
- 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 +78 -78
- 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 +1060 -895
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
- 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 +157 -157
- 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 +564 -564
- package/src/components/Business/BsSulaQueryTable/index.less +221 -221
- package/src/components/Business/BsSulaQueryTable/index.tsx +535 -535
- package/src/components/Business/BsSulaQueryTable/setting.tsx +852 -852
- 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 +80 -80
- 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 +313 -313
- package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
- 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 +205 -205
- 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 +535 -535
- 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 +390 -390
- package/src/components/Business/SearchSelect/BusinessUtils.ts +1762 -1762
- package/src/components/Business/SearchSelect/common.ts +75 -75
- package/src/components/Business/SearchSelect/index.md +1329 -1329
- package/src/components/Business/SearchSelect/index.tsx +55 -55
- package/src/components/Business/SearchSelect/utils.ts +100 -100
- 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 +156 -156
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
- package/src/components/Business/TreeSearchSelect/utils.ts +75 -75
- package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -764
- 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 +232 -232
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +240 -240
- 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 +79 -14
- 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 +1170 -1282
- 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 +772 -772
- 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 +695 -695
- 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 +687 -687
- 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 +59 -59
- 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 +879 -879
- 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 +199 -199
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/index.d.ts +29 -29
- package/src/components/Solution/RuleComponent/index.js +2032 -2032
- package/src/components/Solution/RuleComponent/index.less +230 -230
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/ruleFiled.js +2107 -2107
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/components/Solution/RuleComponent/util.js +139 -139
- package/src/index.ts +38 -38
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +724 -724
- 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/LocalstorageUtils.ts +95 -95
- package/src/utils/TableUtils.tsx +18 -18
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/enumConfig.ts +11 -11
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +4 -4
- package/src/utils/requestUtils.ts +34 -34
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +212 -212
- package/tsconfig.json +29 -29
- package/typings.d.ts +4 -4
|
@@ -1,2032 +1,2032 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
import RuleField from './ruleFiled';
|
|
5
|
-
import {
|
|
6
|
-
Select,
|
|
7
|
-
Button,
|
|
8
|
-
Radio,
|
|
9
|
-
Switch,
|
|
10
|
-
Checkbox,
|
|
11
|
-
InputNumber,
|
|
12
|
-
TreeSelect,
|
|
13
|
-
Popover,
|
|
14
|
-
Input,
|
|
15
|
-
DatePicker,
|
|
16
|
-
Table,
|
|
17
|
-
Divider,
|
|
18
|
-
Space,
|
|
19
|
-
Form as AntdForm,
|
|
20
|
-
Modal,
|
|
21
|
-
message,
|
|
22
|
-
} from 'antd';
|
|
23
|
-
import {
|
|
24
|
-
PlusCircleOutlined,
|
|
25
|
-
MinusCircleOutlined,
|
|
26
|
-
DownOutlined,
|
|
27
|
-
} from '@ant-design/icons';
|
|
28
|
-
import './index.less';
|
|
29
|
-
import {
|
|
30
|
-
relateItems,
|
|
31
|
-
getSpecialPropertyCode,
|
|
32
|
-
getPropertyCode,
|
|
33
|
-
isObj,
|
|
34
|
-
} from './util';
|
|
35
|
-
import { getDictionarySource, uuid } from '../../../utils/utils';
|
|
36
|
-
import {
|
|
37
|
-
BusinessSearchSelect,
|
|
38
|
-
BusinessTreeSearchSelect,
|
|
39
|
-
EllipsisTooltip,
|
|
40
|
-
BsCascader,
|
|
41
|
-
} from '../../../index';
|
|
42
|
-
import { request } from 'bssula';
|
|
43
|
-
import Formula from './Formula';
|
|
44
|
-
import RenderSpecificAction from './renderSpecificAction';
|
|
45
|
-
|
|
46
|
-
const { RangePicker } = DatePicker;
|
|
47
|
-
|
|
48
|
-
class RuleObjectComponent extends Component {
|
|
49
|
-
constructor(props) {
|
|
50
|
-
super(props);
|
|
51
|
-
this.state = {
|
|
52
|
-
editNameIndex: 0,
|
|
53
|
-
isEdit: false,
|
|
54
|
-
ruleTreeData: [],
|
|
55
|
-
initialRegularList: [],
|
|
56
|
-
operationList: [],
|
|
57
|
-
ruleClassData: [],
|
|
58
|
-
modalParams: {
|
|
59
|
-
visible: false,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
this.propertyCodeToRangeIdMap = {};
|
|
63
|
-
this.dictCodeToRangeIdMap = {};
|
|
64
|
-
this.dynamicDictCodeToRangeIdMap = {};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
componentDidMount(props) {
|
|
68
|
-
const { ruleClassData, operationList, regularDataList } = this.props;
|
|
69
|
-
this.setRegularData(regularDataList);
|
|
70
|
-
this.setState({
|
|
71
|
-
ruleClassData,
|
|
72
|
-
operationList,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
componentWillReceiveProps(nextProps) {
|
|
77
|
-
const { ruleClassData, operationList, regularDataList } = this.state;
|
|
78
|
-
if (
|
|
79
|
-
nextProps.ruleClassData &&
|
|
80
|
-
this.props.ruleClassData != nextProps.ruleClassData &&
|
|
81
|
-
JSON.stringify(nextProps.ruleClassData) != JSON.stringify(ruleClassData)
|
|
82
|
-
) {
|
|
83
|
-
this.setState({
|
|
84
|
-
ruleClassData: nextProps.ruleClassData,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
nextProps.operationList &&
|
|
90
|
-
this.props.operationList != nextProps.operationList
|
|
91
|
-
) {
|
|
92
|
-
this.setState({
|
|
93
|
-
operationList: nextProps.operationList,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
nextProps.regularDataList &&
|
|
99
|
-
this.props.regularDataList != nextProps.regularDataList
|
|
100
|
-
) {
|
|
101
|
-
this.setRegularData(nextProps.regularDataList);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
setRegularData = (regularDataList) => {
|
|
106
|
-
this.propertyCodeToRangeIdMap = {};
|
|
107
|
-
this.dictCodeToRangeIdMap = {};
|
|
108
|
-
this.dynamicDictCodeToRangeIdMap = {};
|
|
109
|
-
const finalTreeDatas = regularDataList.map((item) => {
|
|
110
|
-
return {
|
|
111
|
-
title: item.name,
|
|
112
|
-
key: item.id,
|
|
113
|
-
value: item.code,
|
|
114
|
-
...(item?.propertyList?.length
|
|
115
|
-
? {
|
|
116
|
-
children: item.propertyList.map((element) => {
|
|
117
|
-
const infoVo = (element.info && JSON.parse(element.info)) || {};
|
|
118
|
-
if (element.choiceType === 30) {
|
|
119
|
-
this.dynamicDictCodeToRangeIdMap[
|
|
120
|
-
`${item.code}.${element.code}`
|
|
121
|
-
] = infoVo?.dictionaryCode;
|
|
122
|
-
} else if (element.choiceType === 20) {
|
|
123
|
-
this.dictCodeToRangeIdMap[`${item.code}.${element.code}`] =
|
|
124
|
-
infoVo?.dictionaryCode;
|
|
125
|
-
} else if (element.choiceType === 10) {
|
|
126
|
-
const list =
|
|
127
|
-
(Object.keys(infoVo).length &&
|
|
128
|
-
infoVo.enumeration &&
|
|
129
|
-
Object.keys(infoVo.enumeration).map((i) => ({
|
|
130
|
-
code: i,
|
|
131
|
-
name: infoVo.enumeration[i],
|
|
132
|
-
}))) ||
|
|
133
|
-
undefined;
|
|
134
|
-
this.propertyCodeToRangeIdMap[
|
|
135
|
-
`${item.code}.${element.code}`
|
|
136
|
-
] = list;
|
|
137
|
-
} else {
|
|
138
|
-
this.propertyCodeToRangeIdMap[
|
|
139
|
-
`${item.code}.${element.code}`
|
|
140
|
-
] = Object.keys(infoVo).length ? infoVo : undefined;
|
|
141
|
-
}
|
|
142
|
-
let child = {
|
|
143
|
-
title: `${item.name}-${element.name}`,
|
|
144
|
-
key: element.id,
|
|
145
|
-
value: `${element.code}`,
|
|
146
|
-
id: element.id,
|
|
147
|
-
dataTypeCode: element.valueType,
|
|
148
|
-
dataChoiceBusinessType: element.choiceType,
|
|
149
|
-
dataInputBusinessType: element.inputType,
|
|
150
|
-
info: element.info,
|
|
151
|
-
};
|
|
152
|
-
if (element?.propertyList?.length) {
|
|
153
|
-
child.children = this.parseChildTreeData(
|
|
154
|
-
element.propertyList,
|
|
155
|
-
`${element.code}`,
|
|
156
|
-
`${item.name}-${element.name}`,
|
|
157
|
-
item.code,
|
|
158
|
-
);
|
|
159
|
-
child.isLeaf = false;
|
|
160
|
-
} else {
|
|
161
|
-
child.isLeaf = true;
|
|
162
|
-
child.metaObjectCode = item.code;
|
|
163
|
-
}
|
|
164
|
-
return child;
|
|
165
|
-
}),
|
|
166
|
-
}
|
|
167
|
-
: {}),
|
|
168
|
-
};
|
|
169
|
-
});
|
|
170
|
-
this.setState({
|
|
171
|
-
initialRegularList: [...regularDataList],
|
|
172
|
-
ruleTreeData: finalTreeDatas,
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
parseChildTreeData = (list, parentKey, parentTitle, rootObjCode) => {
|
|
177
|
-
return list.map((element) => {
|
|
178
|
-
const infoVo = (element.info && JSON.parse(element.info)) || {};
|
|
179
|
-
if (element.choiceType === 30) {
|
|
180
|
-
this.dynamicDictCodeToRangeIdMap[
|
|
181
|
-
`${rootObjCode}.${parentKey}.${element.code}`
|
|
182
|
-
] = infoVo?.dictionaryCode;
|
|
183
|
-
} else if (element.choiceType === 20) {
|
|
184
|
-
this.dictCodeToRangeIdMap[
|
|
185
|
-
`${rootObjCode}.${parentKey}.${element.code}`
|
|
186
|
-
] = infoVo?.dictionaryCode;
|
|
187
|
-
} else if (element.choiceType === 10) {
|
|
188
|
-
const list =
|
|
189
|
-
(Object.keys(infoVo).length &&
|
|
190
|
-
infoVo.enumeration &&
|
|
191
|
-
Object.keys(infoVo.enumeration).map((i) => ({
|
|
192
|
-
code: i,
|
|
193
|
-
name: infoVo.enumeration[i],
|
|
194
|
-
}))) ||
|
|
195
|
-
undefined;
|
|
196
|
-
this.propertyCodeToRangeIdMap[
|
|
197
|
-
`${rootObjCode}.${parentKey}.${element.code}`
|
|
198
|
-
] = list;
|
|
199
|
-
} else {
|
|
200
|
-
this.propertyCodeToRangeIdMap[
|
|
201
|
-
`${rootObjCode}.${parentKey}.${element.code}`
|
|
202
|
-
] = Object.keys(infoVo).length ? infoVo : undefined;
|
|
203
|
-
}
|
|
204
|
-
let child = {
|
|
205
|
-
title: `${parentTitle}-${element.name}`,
|
|
206
|
-
key: `${parentKey}.${element.id}`,
|
|
207
|
-
value: `${parentKey}.${element.code}`,
|
|
208
|
-
id: element.id,
|
|
209
|
-
dataTypeCode: element.valueType,
|
|
210
|
-
dataChoiceBusinessType: element.choiceType,
|
|
211
|
-
dataInputBusinessType: element.inputType,
|
|
212
|
-
info: element.info,
|
|
213
|
-
};
|
|
214
|
-
if (element.propertyList) {
|
|
215
|
-
child.children = this.parseChildTreeData(
|
|
216
|
-
element.propertyList,
|
|
217
|
-
`${parentKey}.${element.code}`,
|
|
218
|
-
`${parentTitle}-${element.name}`,
|
|
219
|
-
rootObjCode,
|
|
220
|
-
);
|
|
221
|
-
child.isLeaf = false;
|
|
222
|
-
} else {
|
|
223
|
-
child.isLeaf = true;
|
|
224
|
-
child.metaObjectCode = rootObjCode;
|
|
225
|
-
}
|
|
226
|
-
return child;
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
getDataTypeOperateList = (id) => {
|
|
231
|
-
const { operationList, initialRegularList } = this.state;
|
|
232
|
-
// let typeId = '';
|
|
233
|
-
// initialRegularList.forEach(item => {
|
|
234
|
-
// item.metaObjectResDto.elementResDtos.forEach(element => {
|
|
235
|
-
// if (element.id == id) {
|
|
236
|
-
// typeId = element.dataTypeCode;
|
|
237
|
-
// }
|
|
238
|
-
// })
|
|
239
|
-
// })
|
|
240
|
-
const list =
|
|
241
|
-
operationList.find((item) => item.code == id)?.operationList || [];
|
|
242
|
-
return list;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
handleValuesChange = (itemDetail, newValues, newValueNames) => {
|
|
246
|
-
const { ruleClassData } = this.state;
|
|
247
|
-
const { callBack } = this.props;
|
|
248
|
-
itemDetail.params = [...newValues];
|
|
249
|
-
itemDetail.paramNames = [...newValueNames];
|
|
250
|
-
this.setState(
|
|
251
|
-
{
|
|
252
|
-
ruleClassData,
|
|
253
|
-
},
|
|
254
|
-
() => {
|
|
255
|
-
callBack(ruleClassData);
|
|
256
|
-
},
|
|
257
|
-
);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
setRelateDataList = (classDataItem) => {
|
|
261
|
-
let relateDatas = {};
|
|
262
|
-
relateItems.forEach((relateItem) => {
|
|
263
|
-
this.getRelateData(
|
|
264
|
-
relateItem,
|
|
265
|
-
classDataItem.subExpression || {},
|
|
266
|
-
relateDatas,
|
|
267
|
-
);
|
|
268
|
-
});
|
|
269
|
-
return relateDatas;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
getRelateData = (relateItem, classDataItem, relateDatas) => {
|
|
273
|
-
if (
|
|
274
|
-
classDataItem?.propertyPath &&
|
|
275
|
-
getPropertyCode(classDataItem.propertyPath) == relateItem.propertyCode
|
|
276
|
-
) {
|
|
277
|
-
relateDatas[relateItem.propertyCode] = classDataItem.params;
|
|
278
|
-
} else {
|
|
279
|
-
if (classDataItem.subExpression && classDataItem.subExpression.length) {
|
|
280
|
-
classDataItem.subExpression.forEach((classData) => {
|
|
281
|
-
this.getRelateData(relateItem, classData, relateDatas);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
renderRuleContent = () => {
|
|
288
|
-
const { ruleClassData, currentRuleName, isEdit, editNameIndex } =
|
|
289
|
-
this.state;
|
|
290
|
-
const {
|
|
291
|
-
ruleType,
|
|
292
|
-
callBack,
|
|
293
|
-
accountList = [],
|
|
294
|
-
disabled,
|
|
295
|
-
ruleTypeData,
|
|
296
|
-
canDelete = false,
|
|
297
|
-
ruleReturnConfig = {},
|
|
298
|
-
onlyOneRule,
|
|
299
|
-
onlyCondition,
|
|
300
|
-
onlyAction,
|
|
301
|
-
handleOperatingAction,
|
|
302
|
-
ruleGroupInfo,
|
|
303
|
-
} = this.props;
|
|
304
|
-
const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1;
|
|
305
|
-
const ruleGroupName = ruleGroupInfo?.ruleGroupList?.[0]?.name || '规则分组';
|
|
306
|
-
const priorityList = (ruleGroupInfo?.groupOtherPriorityList || []).concat(ruleClassData|| []);
|
|
307
|
-
const canChangePriority = ruleGroupInfo?.canChangePriority;
|
|
308
|
-
const titlePre = {
|
|
309
|
-
position: 'relative',
|
|
310
|
-
top: '-10px',
|
|
311
|
-
left: '20px',
|
|
312
|
-
background: '#fff',
|
|
313
|
-
width: '160px',
|
|
314
|
-
textAlign: 'center',
|
|
315
|
-
};
|
|
316
|
-
const titleSubPre = {
|
|
317
|
-
...titlePre,
|
|
318
|
-
top: '-33px',
|
|
319
|
-
left: '280px',
|
|
320
|
-
width: '160px',
|
|
321
|
-
}
|
|
322
|
-
const ruleListBox = (!onlyOneRule || ruleGroupInfo) ? { border: '1px dashed #d9d9d9', marginBottom: 10 } : {};
|
|
323
|
-
const isRuleActionConfig =
|
|
324
|
-
ruleTypeData?.length || Object.keys(ruleReturnConfig)?.length;
|
|
325
|
-
return (
|
|
326
|
-
<div>
|
|
327
|
-
{ruleClassData.map((item, classDataIndex) => {
|
|
328
|
-
let extraInfo = {};
|
|
329
|
-
if (isRuleActionConfig) {
|
|
330
|
-
extraInfo = {
|
|
331
|
-
...item.extraInfo,
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
let relateDatas = this.setRelateDataList(item);
|
|
335
|
-
const sActionProps = {
|
|
336
|
-
extraInfo,
|
|
337
|
-
ruleTypeData,
|
|
338
|
-
item,
|
|
339
|
-
classDataIndex,
|
|
340
|
-
handleOperatingAction,
|
|
341
|
-
disabled,
|
|
342
|
-
};
|
|
343
|
-
return (
|
|
344
|
-
<div style={ruleListBox}>
|
|
345
|
-
{!onlyOneRule && !ruleGroupInfo && (
|
|
346
|
-
<div style={titlePre}>规则{classDataIndex + 1}</div>
|
|
347
|
-
)}
|
|
348
|
-
{ruleGroupInfo && (
|
|
349
|
-
<>
|
|
350
|
-
<div style={titlePre}>
|
|
351
|
-
<EllipsisTooltip
|
|
352
|
-
visible={true}
|
|
353
|
-
maxLength={10}
|
|
354
|
-
title={ruleGroupName}
|
|
355
|
-
/>
|
|
356
|
-
</div>
|
|
357
|
-
{isRuleInstance && (
|
|
358
|
-
<div style={titleSubPre}>
|
|
359
|
-
<span style={{ marginRight: 10 }}>优先级</span>
|
|
360
|
-
<Select
|
|
361
|
-
disabled={canChangePriority ? !canChangePriority : disabled}
|
|
362
|
-
style={{ width: 100 }}
|
|
363
|
-
value={item.priority}
|
|
364
|
-
onChange={(v) => {
|
|
365
|
-
// 因为存在页签,前端校验不准确;而且若选择优先级之后想交换改也不方便,故交由后端校验
|
|
366
|
-
// const isRepeate = priorityList.some((r) => r.priority == v)
|
|
367
|
-
// if(isRepeate) {
|
|
368
|
-
// message.warn('优先级不允许重复')
|
|
369
|
-
// }
|
|
370
|
-
// item.priority = isRepeate ? (item.priority||null) : v;
|
|
371
|
-
item.priority = v
|
|
372
|
-
this.setState(
|
|
373
|
-
{
|
|
374
|
-
ruleClassData,
|
|
375
|
-
},
|
|
376
|
-
() => {
|
|
377
|
-
callBack(ruleClassData);
|
|
378
|
-
},
|
|
379
|
-
);
|
|
380
|
-
}}
|
|
381
|
-
>
|
|
382
|
-
{priorityList?.map((s,sindex) => (
|
|
383
|
-
<Option key={sindex+1} value={sindex+1}>{sindex+1}</Option>
|
|
384
|
-
))}
|
|
385
|
-
</Select>
|
|
386
|
-
</div>
|
|
387
|
-
) || null}
|
|
388
|
-
</>
|
|
389
|
-
)}
|
|
390
|
-
<div
|
|
391
|
-
style={{
|
|
392
|
-
textAlign: 'right',
|
|
393
|
-
marginTop: '-24px',
|
|
394
|
-
display: canDelete ? 'block' : 'none',
|
|
395
|
-
}}
|
|
396
|
-
>
|
|
397
|
-
<Button
|
|
398
|
-
disabled={disabled}
|
|
399
|
-
onClick={() => {
|
|
400
|
-
const { ruleClassData } = this.state;
|
|
401
|
-
ruleClassData.splice(classDataIndex, 1);
|
|
402
|
-
this.setState(
|
|
403
|
-
{
|
|
404
|
-
ruleClassData,
|
|
405
|
-
},
|
|
406
|
-
() => {
|
|
407
|
-
callBack(ruleClassData);
|
|
408
|
-
},
|
|
409
|
-
);
|
|
410
|
-
}}
|
|
411
|
-
type="link"
|
|
412
|
-
danger
|
|
413
|
-
>
|
|
414
|
-
删除规则
|
|
415
|
-
</Button>
|
|
416
|
-
</div>
|
|
417
|
-
<div>
|
|
418
|
-
{/* <div style={{ display: isEdit && editNameIndex == index ? 'none' : 'block' }}>
|
|
419
|
-
<span className={'rule_name_title}>
|
|
420
|
-
{item.ruleName}
|
|
421
|
-
</span>
|
|
422
|
-
<EditOutlined
|
|
423
|
-
onClick={() => {
|
|
424
|
-
this.setState({
|
|
425
|
-
editNameIndex: index,
|
|
426
|
-
currentRuleName: item.ruleName,
|
|
427
|
-
isEdit: true
|
|
428
|
-
})
|
|
429
|
-
}}
|
|
430
|
-
/>
|
|
431
|
-
</div> */}
|
|
432
|
-
<div
|
|
433
|
-
style={{
|
|
434
|
-
display:
|
|
435
|
-
isEdit && editNameIndex == index ? 'block' : 'none',
|
|
436
|
-
marginTop: '10px',
|
|
437
|
-
}}
|
|
438
|
-
>
|
|
439
|
-
<Input
|
|
440
|
-
value={currentRuleName}
|
|
441
|
-
style={{ width: '200px' }}
|
|
442
|
-
onChange={(e) => {
|
|
443
|
-
this.setState({
|
|
444
|
-
currentRuleName: e.target.value,
|
|
445
|
-
});
|
|
446
|
-
}}
|
|
447
|
-
/>
|
|
448
|
-
<Button
|
|
449
|
-
type="link"
|
|
450
|
-
onClick={() => {
|
|
451
|
-
const { ruleClassData, currentRuleName } = this.state;
|
|
452
|
-
ruleClassData[editNameIndex].ruleName = currentRuleName;
|
|
453
|
-
this.setState({
|
|
454
|
-
ruleClassData,
|
|
455
|
-
isEdit: false,
|
|
456
|
-
});
|
|
457
|
-
}}
|
|
458
|
-
>
|
|
459
|
-
保存
|
|
460
|
-
</Button>
|
|
461
|
-
<Button
|
|
462
|
-
type="link"
|
|
463
|
-
onClick={() => {
|
|
464
|
-
this.setState({
|
|
465
|
-
isEdit: false,
|
|
466
|
-
});
|
|
467
|
-
}}
|
|
468
|
-
>
|
|
469
|
-
取消
|
|
470
|
-
</Button>
|
|
471
|
-
</div>
|
|
472
|
-
</div>
|
|
473
|
-
<div>
|
|
474
|
-
{(onlyAction && <RenderSpecificAction {...sActionProps} />) || (
|
|
475
|
-
<div className={'base_rule_line_content'}>
|
|
476
|
-
<div className={'base_rule_item2'}>
|
|
477
|
-
{item.subExpression &&
|
|
478
|
-
this.renderRuleItem(
|
|
479
|
-
item.subExpression,
|
|
480
|
-
item,
|
|
481
|
-
1,
|
|
482
|
-
classDataIndex,
|
|
483
|
-
relateDatas,
|
|
484
|
-
)}
|
|
485
|
-
</div>
|
|
486
|
-
<div className={'base_rule_item3'}>
|
|
487
|
-
{(extraInfo &&
|
|
488
|
-
isRuleActionConfig &&
|
|
489
|
-
(!onlyCondition || !onlyAction) &&
|
|
490
|
-
this.renderRuleTypeItem(
|
|
491
|
-
extraInfo,
|
|
492
|
-
item,
|
|
493
|
-
1,
|
|
494
|
-
classDataIndex,
|
|
495
|
-
ruleTypeData,
|
|
496
|
-
ruleReturnConfig,
|
|
497
|
-
isRuleInstance
|
|
498
|
-
)) ||
|
|
499
|
-
null}
|
|
500
|
-
</div>
|
|
501
|
-
</div>
|
|
502
|
-
)}
|
|
503
|
-
</div>
|
|
504
|
-
</div>
|
|
505
|
-
);
|
|
506
|
-
})}
|
|
507
|
-
</div>
|
|
508
|
-
);
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
handleAddRule = () => {
|
|
512
|
-
const { ruleClassData } = this.state;
|
|
513
|
-
const { callBack, ruleTypeData, ruleGroupInfo } = this.props;
|
|
514
|
-
const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1;
|
|
515
|
-
const initKongData = {
|
|
516
|
-
ruleName: `规则${ruleClassData?.length + 1}`,
|
|
517
|
-
subExpression: {
|
|
518
|
-
// "expressionType": "relation",
|
|
519
|
-
operationType: 'relation',
|
|
520
|
-
propertyPath: '',
|
|
521
|
-
params: [],
|
|
522
|
-
paramNames: [],
|
|
523
|
-
},
|
|
524
|
-
extraInfo: {
|
|
525
|
-
response: {
|
|
526
|
-
enable: false,
|
|
527
|
-
value: '',
|
|
528
|
-
},
|
|
529
|
-
execute: ruleTypeData.map((s) => {
|
|
530
|
-
return {
|
|
531
|
-
priority: 1,
|
|
532
|
-
code: s.code,
|
|
533
|
-
properties: {
|
|
534
|
-
configPropertyCode: 'configPropertyValue',
|
|
535
|
-
},
|
|
536
|
-
};
|
|
537
|
-
}),
|
|
538
|
-
},
|
|
539
|
-
}
|
|
540
|
-
const initTemplateData = ruleGroupInfo?.templateData && Object.keys(ruleGroupInfo?.templateData)?.length ? {
|
|
541
|
-
ruleName: `规则${ruleClassData?.length + 1}`,
|
|
542
|
-
..._.cloneDeep(ruleGroupInfo?.templateData)
|
|
543
|
-
} : initKongData;
|
|
544
|
-
const initNewData = isRuleInstance ? initTemplateData : initKongData
|
|
545
|
-
ruleClassData.push(initNewData);
|
|
546
|
-
this.setState(
|
|
547
|
-
{
|
|
548
|
-
ruleClassData,
|
|
549
|
-
},
|
|
550
|
-
() => {
|
|
551
|
-
callBack(ruleClassData);
|
|
552
|
-
},
|
|
553
|
-
);
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// 树结构 转化成 平行树 (递归函数)
|
|
557
|
-
coverToParallel = (treeData, result) => {
|
|
558
|
-
treeData.forEach((el) => {
|
|
559
|
-
result.push(el);
|
|
560
|
-
if (el.children && el.children.length > 0) {
|
|
561
|
-
// 子级递归
|
|
562
|
-
this.coverToParallel(el.children, result);
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
return result;
|
|
566
|
-
};
|
|
567
|
-
|
|
568
|
-
renderRuleItem = (
|
|
569
|
-
itemDetail,
|
|
570
|
-
parentDetail,
|
|
571
|
-
floorIndex,
|
|
572
|
-
classDataIndex,
|
|
573
|
-
relateDatas,
|
|
574
|
-
) => {
|
|
575
|
-
const { ruleTreeData } = this.state;
|
|
576
|
-
const {
|
|
577
|
-
callBack,
|
|
578
|
-
initialThresholdQuery = {},
|
|
579
|
-
disabled,
|
|
580
|
-
systemVariableList,
|
|
581
|
-
} = this.props;
|
|
582
|
-
let thresholdQuery = {
|
|
583
|
-
...initialThresholdQuery,
|
|
584
|
-
...relateDatas,
|
|
585
|
-
};
|
|
586
|
-
let finalIndex = floorIndex + 1;
|
|
587
|
-
let queryIdentify = '';
|
|
588
|
-
let queryIdentifyType = '';
|
|
589
|
-
if (
|
|
590
|
-
this.propertyCodeToRangeIdMap[
|
|
591
|
-
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
592
|
-
]
|
|
593
|
-
) {
|
|
594
|
-
queryIdentify =
|
|
595
|
-
this.propertyCodeToRangeIdMap[
|
|
596
|
-
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
597
|
-
];
|
|
598
|
-
queryIdentifyType = Array.isArray(queryIdentify)
|
|
599
|
-
? 'objectPropertyListIdentify'
|
|
600
|
-
: 'objectPropertyCodeIdentify';
|
|
601
|
-
} else if (
|
|
602
|
-
getSpecialPropertyCode(getPropertyCode(itemDetail.propertyPath))
|
|
603
|
-
) {
|
|
604
|
-
queryIdentify = getSpecialPropertyCode(
|
|
605
|
-
getPropertyCode(itemDetail.propertyPath),
|
|
606
|
-
);
|
|
607
|
-
queryIdentifyType = 'specialPropertyIdentify';
|
|
608
|
-
} else if (
|
|
609
|
-
this.dictCodeToRangeIdMap[
|
|
610
|
-
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
611
|
-
]
|
|
612
|
-
) {
|
|
613
|
-
queryIdentify =
|
|
614
|
-
this.dictCodeToRangeIdMap[
|
|
615
|
-
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
616
|
-
];
|
|
617
|
-
queryIdentifyType = 'dictCodeIdentify';
|
|
618
|
-
} else if (
|
|
619
|
-
this.dynamicDictCodeToRangeIdMap[
|
|
620
|
-
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
621
|
-
]
|
|
622
|
-
) {
|
|
623
|
-
queryIdentify =
|
|
624
|
-
this.dynamicDictCodeToRangeIdMap[
|
|
625
|
-
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
626
|
-
];
|
|
627
|
-
queryIdentifyType = 'dynamicDictCodeIdentify';
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
const parallelTreeData = this.coverToParallel(ruleTreeData, []) || [];
|
|
631
|
-
const currentTreeItem =
|
|
632
|
-
itemDetail?.elementId &&
|
|
633
|
-
parallelTreeData.find((i) => (i?.key?.indexOf('.') > -1 ? i.id : i.key) === itemDetail?.elementId);
|
|
634
|
-
const dataChoiceBusinessType = currentTreeItem?.dataChoiceBusinessType;
|
|
635
|
-
const dataInputBusinessType = currentTreeItem?.dataInputBusinessType;
|
|
636
|
-
return (
|
|
637
|
-
<div
|
|
638
|
-
className={'rule_line_content'}
|
|
639
|
-
style={{ display: 'flex', marginBottom: '0px', padding: '10px 0px' }}
|
|
640
|
-
>
|
|
641
|
-
<div
|
|
642
|
-
className={'logical_operate_content'}
|
|
643
|
-
style={{
|
|
644
|
-
display: itemDetail.operationType == 'logic' ? 'block' : 'none',
|
|
645
|
-
width: '60px',
|
|
646
|
-
zIndex: 20,
|
|
647
|
-
}}
|
|
648
|
-
>
|
|
649
|
-
<Popover
|
|
650
|
-
content={
|
|
651
|
-
<div>
|
|
652
|
-
<p
|
|
653
|
-
className={'choose_logical_type'}
|
|
654
|
-
onClick={() => {
|
|
655
|
-
this.handleLogicalTypeChange(itemDetail, 'or');
|
|
656
|
-
}}
|
|
657
|
-
>
|
|
658
|
-
OR
|
|
659
|
-
</p>
|
|
660
|
-
<p
|
|
661
|
-
className={'choose_logical_type'}
|
|
662
|
-
onClick={() => {
|
|
663
|
-
this.handleLogicalTypeChange(itemDetail, 'and');
|
|
664
|
-
}}
|
|
665
|
-
>
|
|
666
|
-
AND
|
|
667
|
-
</p>
|
|
668
|
-
</div>
|
|
669
|
-
}
|
|
670
|
-
trigger="focus"
|
|
671
|
-
>
|
|
672
|
-
<Button
|
|
673
|
-
disabled={disabled}
|
|
674
|
-
type="link"
|
|
675
|
-
className={'logical_item_btn'}
|
|
676
|
-
>
|
|
677
|
-
{itemDetail?.operationCode == 'or' ? 'OR' : 'AND'}
|
|
678
|
-
<DownOutlined style={{ marginLeft: '6px' }} />
|
|
679
|
-
</Button>
|
|
680
|
-
</Popover>
|
|
681
|
-
<span className={'top_line'}></span>
|
|
682
|
-
<span className={'bottom_line'}></span>
|
|
683
|
-
</div>
|
|
684
|
-
|
|
685
|
-
<div style={{ flexGrow: 1 }}>
|
|
686
|
-
{itemDetail.operationType == 'logic' ? (
|
|
687
|
-
itemDetail?.subExpression?.map((item1) => {
|
|
688
|
-
return this.renderRuleItem(
|
|
689
|
-
item1,
|
|
690
|
-
itemDetail,
|
|
691
|
-
finalIndex,
|
|
692
|
-
classDataIndex,
|
|
693
|
-
relateDatas,
|
|
694
|
-
);
|
|
695
|
-
})
|
|
696
|
-
) : (
|
|
697
|
-
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
698
|
-
<TreeSelect
|
|
699
|
-
value={itemDetail.propertyPath}
|
|
700
|
-
disabled={disabled}
|
|
701
|
-
onChange={(value, name, nodeInfo) => {
|
|
702
|
-
if (!nodeInfo.triggerNode.props.isLeaf) return; //只有最末端叶子节点可选中
|
|
703
|
-
const { ruleClassData } = this.state;
|
|
704
|
-
itemDetail.propertyPath = value;
|
|
705
|
-
itemDetail.params = [];
|
|
706
|
-
itemDetail.paramNames = [];
|
|
707
|
-
itemDetail.operationCode = '';
|
|
708
|
-
itemDetail.elementId = nodeInfo.triggerNode.props.id;
|
|
709
|
-
itemDetail.elementName = nodeInfo.triggerNode.props.title;
|
|
710
|
-
itemDetail.dataTypeCode =
|
|
711
|
-
nodeInfo.triggerNode.props.dataTypeCode;
|
|
712
|
-
itemDetail.metaObjectCode =
|
|
713
|
-
nodeInfo.triggerNode.props.metaObjectCode;
|
|
714
|
-
itemDetail.isInsertParam = false;
|
|
715
|
-
this.setState(
|
|
716
|
-
{
|
|
717
|
-
ruleClassData,
|
|
718
|
-
},
|
|
719
|
-
() => {
|
|
720
|
-
callBack(ruleClassData);
|
|
721
|
-
},
|
|
722
|
-
);
|
|
723
|
-
}}
|
|
724
|
-
style={{ width: '200px' }}
|
|
725
|
-
treeData={ruleTreeData}
|
|
726
|
-
/>
|
|
727
|
-
<Select
|
|
728
|
-
value={itemDetail?.operationCode || ''}
|
|
729
|
-
disabled={disabled}
|
|
730
|
-
style={{ width: '150px', marginLeft: '10px' }}
|
|
731
|
-
onChange={(value) => {
|
|
732
|
-
const { ruleClassData } = this.state;
|
|
733
|
-
itemDetail.operationCode = value;
|
|
734
|
-
this.setState(
|
|
735
|
-
{
|
|
736
|
-
ruleClassData,
|
|
737
|
-
},
|
|
738
|
-
() => {
|
|
739
|
-
callBack(ruleClassData);
|
|
740
|
-
},
|
|
741
|
-
);
|
|
742
|
-
}}
|
|
743
|
-
>
|
|
744
|
-
{this.getDataTypeOperateList(itemDetail.dataTypeCode).map(
|
|
745
|
-
(item) => (
|
|
746
|
-
<Select.Option value={item.code} key={item.code}>
|
|
747
|
-
{item.name}
|
|
748
|
-
</Select.Option>
|
|
749
|
-
),
|
|
750
|
-
)}
|
|
751
|
-
</Select>
|
|
752
|
-
{!itemDetail?.isInsertParam ? (
|
|
753
|
-
<RuleField
|
|
754
|
-
selectOperation={itemDetail?.operationCode || ''}
|
|
755
|
-
disabled={disabled}
|
|
756
|
-
initialThresholdQuery={thresholdQuery}
|
|
757
|
-
dataTypeCode={itemDetail?.dataTypeCode || ''}
|
|
758
|
-
dataChoiceBusinessType={dataChoiceBusinessType || ''}
|
|
759
|
-
dataInputBusinessType={dataInputBusinessType || ''}
|
|
760
|
-
itemDetail={itemDetail}
|
|
761
|
-
queryIdentifyType={queryIdentifyType}
|
|
762
|
-
queryIdentify={queryIdentify}
|
|
763
|
-
propertyCode={getPropertyCode(itemDetail.propertyPath)}
|
|
764
|
-
// propertyCode={`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`}
|
|
765
|
-
relateDatas={relateDatas}
|
|
766
|
-
values={itemDetail.params || []}
|
|
767
|
-
valueNames={itemDetail.paramNames || []}
|
|
768
|
-
callback={(newValues, newValueNames) => {
|
|
769
|
-
this.handleValuesChange(
|
|
770
|
-
itemDetail,
|
|
771
|
-
newValues,
|
|
772
|
-
newValueNames,
|
|
773
|
-
);
|
|
774
|
-
}}
|
|
775
|
-
/>
|
|
776
|
-
) : null}
|
|
777
|
-
<Select
|
|
778
|
-
disabled={disabled}
|
|
779
|
-
value={
|
|
780
|
-
itemDetail?.params?.[0]?.replace('{', '').replace('}', '') ||
|
|
781
|
-
''
|
|
782
|
-
}
|
|
783
|
-
style={{
|
|
784
|
-
width: '150px',
|
|
785
|
-
marginLeft: '10px',
|
|
786
|
-
display: itemDetail?.isInsertParam ? '' : 'none',
|
|
787
|
-
}}
|
|
788
|
-
onChange={(value) => {
|
|
789
|
-
const { ruleClassData } = this.state;
|
|
790
|
-
console.log(itemDetail);
|
|
791
|
-
itemDetail.params = [(value && `{${value}}`) || ''];
|
|
792
|
-
const name = systemVariableList.find(
|
|
793
|
-
(i) => i.code == value,
|
|
794
|
-
)?.name;
|
|
795
|
-
itemDetail.paramNames = [name || ''];
|
|
796
|
-
this.setState(
|
|
797
|
-
{
|
|
798
|
-
ruleClassData,
|
|
799
|
-
},
|
|
800
|
-
() => {
|
|
801
|
-
callBack(ruleClassData);
|
|
802
|
-
},
|
|
803
|
-
);
|
|
804
|
-
}}
|
|
805
|
-
>
|
|
806
|
-
{systemVariableList
|
|
807
|
-
? systemVariableList.map((item) => (
|
|
808
|
-
<Select.Option value={item.code} key={item.code}>
|
|
809
|
-
{item.name}
|
|
810
|
-
</Select.Option>
|
|
811
|
-
))
|
|
812
|
-
: null}
|
|
813
|
-
</Select>
|
|
814
|
-
<PlusCircleOutlined
|
|
815
|
-
className={'icon_btn_style'}
|
|
816
|
-
onClick={() => {
|
|
817
|
-
this.addChildRules(itemDetail);
|
|
818
|
-
}}
|
|
819
|
-
style={{
|
|
820
|
-
color: '#008fe0',
|
|
821
|
-
marginLeft: '15px',
|
|
822
|
-
display: floorIndex > 4 || disabled ? 'none' : 'inline-block',
|
|
823
|
-
}}
|
|
824
|
-
/>
|
|
825
|
-
<MinusCircleOutlined
|
|
826
|
-
className={'icon_btn_style'}
|
|
827
|
-
onClick={() => {
|
|
828
|
-
this.handleDeleteRule(
|
|
829
|
-
itemDetail,
|
|
830
|
-
parentDetail,
|
|
831
|
-
classDataIndex,
|
|
832
|
-
);
|
|
833
|
-
}}
|
|
834
|
-
style={{
|
|
835
|
-
color: 'gray',
|
|
836
|
-
display: disabled ? 'none' : 'inline-block',
|
|
837
|
-
}}
|
|
838
|
-
/>
|
|
839
|
-
<Button
|
|
840
|
-
type="link"
|
|
841
|
-
disabled={
|
|
842
|
-
disabled || itemDetail.operationCode === '' || !itemDetail.operationCode
|
|
843
|
-
? true
|
|
844
|
-
: false
|
|
845
|
-
}
|
|
846
|
-
onClick={() => {
|
|
847
|
-
const { ruleClassData } = this.state;
|
|
848
|
-
if (systemVariableList?.length) {
|
|
849
|
-
itemDetail.isInsertParam = !itemDetail.isInsertParam;
|
|
850
|
-
delete itemDetail.params;
|
|
851
|
-
delete itemDetail.paramNames;
|
|
852
|
-
this.setState(
|
|
853
|
-
{
|
|
854
|
-
ruleClassData,
|
|
855
|
-
},
|
|
856
|
-
() => {
|
|
857
|
-
callBack(ruleClassData);
|
|
858
|
-
},
|
|
859
|
-
);
|
|
860
|
-
} else {
|
|
861
|
-
message.warn('未配置规则变量');
|
|
862
|
-
}
|
|
863
|
-
}}
|
|
864
|
-
>
|
|
865
|
-
{itemDetail?.isInsertParam ? '取消插入参数' : '插入参数'}
|
|
866
|
-
</Button>
|
|
867
|
-
</div>
|
|
868
|
-
)}
|
|
869
|
-
<div
|
|
870
|
-
style={{
|
|
871
|
-
display:
|
|
872
|
-
itemDetail.operationType == 'logic' && !disabled
|
|
873
|
-
? 'block'
|
|
874
|
-
: 'none',
|
|
875
|
-
}}
|
|
876
|
-
>
|
|
877
|
-
<span
|
|
878
|
-
style={{ color: '#008fe0', cursor: 'pointer' }}
|
|
879
|
-
type="link"
|
|
880
|
-
onClick={() => {
|
|
881
|
-
this.addPeerRule(itemDetail);
|
|
882
|
-
}}
|
|
883
|
-
>
|
|
884
|
-
<PlusCircleOutlined
|
|
885
|
-
style={{
|
|
886
|
-
color: '#008fe0',
|
|
887
|
-
fontSize: '14px',
|
|
888
|
-
marginRight: '5px',
|
|
889
|
-
}}
|
|
890
|
-
/>
|
|
891
|
-
添加条件
|
|
892
|
-
</span>
|
|
893
|
-
</div>
|
|
894
|
-
</div>
|
|
895
|
-
</div>
|
|
896
|
-
);
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
handleEditExtraInfoResponse = (code, val, parentDetail,classDataIndex) => {
|
|
900
|
-
const { ruleClassData } = this.state;
|
|
901
|
-
const { callBack } = this.props;
|
|
902
|
-
parentDetail.extraInfo.response[code] = val;
|
|
903
|
-
ruleClassData[classDataIndex].extraInfo.response[code] = val;
|
|
904
|
-
|
|
905
|
-
this.setState(
|
|
906
|
-
{
|
|
907
|
-
ruleClassData,
|
|
908
|
-
},
|
|
909
|
-
() => {
|
|
910
|
-
callBack(ruleClassData);
|
|
911
|
-
},
|
|
912
|
-
);
|
|
913
|
-
};
|
|
914
|
-
// 场景需要返回值2022.11.15
|
|
915
|
-
renderResItem = (
|
|
916
|
-
itemDetail,
|
|
917
|
-
parentDetail,
|
|
918
|
-
ruleReturnConfig,
|
|
919
|
-
classDataIndex,
|
|
920
|
-
disabled,
|
|
921
|
-
boxStyle,
|
|
922
|
-
) => {
|
|
923
|
-
const isShowResponse = itemDetail.response['enable'];
|
|
924
|
-
const isRightText = ruleReturnConfig?.rightText?.length;
|
|
925
|
-
|
|
926
|
-
const showValue = (code, type, functionItem, configItem) => {
|
|
927
|
-
let defaultValue = configItem.defaultValue;
|
|
928
|
-
const pCode = itemDetail.response['value'];
|
|
929
|
-
if (type === 'input') {
|
|
930
|
-
return pCode === undefined ? pCode : pCode || defaultValue;
|
|
931
|
-
}
|
|
932
|
-
return pCode || defaultValue;
|
|
933
|
-
};
|
|
934
|
-
const handleEdit = (code, val) => {
|
|
935
|
-
let value = val;
|
|
936
|
-
if (isObj(code)) {
|
|
937
|
-
Object.keys(code).forEach((ite) => {
|
|
938
|
-
this.handleEditExtraInfoResponse(ite, code[ite], parentDetail,classDataIndex);
|
|
939
|
-
});
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
if (Array.isArray(val)) {
|
|
943
|
-
value = val.map((m) => m.value || m).join(',');
|
|
944
|
-
}
|
|
945
|
-
if (isObj(val)) {
|
|
946
|
-
value = val.value || val.PCDCode?.join('/');
|
|
947
|
-
}
|
|
948
|
-
this.handleEditExtraInfoResponse('value', value, parentDetail,classDataIndex);
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
return (
|
|
952
|
-
(isShowResponse && (
|
|
953
|
-
<div style={{ display: 'flex' }}>
|
|
954
|
-
{this.renderFormCompItem(
|
|
955
|
-
ruleReturnConfig,
|
|
956
|
-
showValue,
|
|
957
|
-
handleEdit,
|
|
958
|
-
{},
|
|
959
|
-
boxStyle,
|
|
960
|
-
disabled
|
|
961
|
-
)}
|
|
962
|
-
<MinusCircleOutlined
|
|
963
|
-
className={'icon_btn_style'}
|
|
964
|
-
onClick={() => {
|
|
965
|
-
this.handleEditExtraInfoResponse('enable', false, parentDetail,classDataIndex);
|
|
966
|
-
}}
|
|
967
|
-
style={{
|
|
968
|
-
color: 'gray',
|
|
969
|
-
marginLeft: isRightText ? '100px' : '15px',
|
|
970
|
-
marginTop: '15px',
|
|
971
|
-
display: disabled ? 'none' : 'inline-block',
|
|
972
|
-
}}
|
|
973
|
-
/>
|
|
974
|
-
</div>
|
|
975
|
-
)) ||
|
|
976
|
-
null
|
|
977
|
-
);
|
|
978
|
-
};
|
|
979
|
-
|
|
980
|
-
renderCompItem = (ites, showValue, handleEdit,disabled) => {
|
|
981
|
-
const { regularDataList } = this.props;
|
|
982
|
-
let fieldListGroup = regularDataList.map((item) => {
|
|
983
|
-
const Item = {
|
|
984
|
-
id: item.id,
|
|
985
|
-
code: item.code,
|
|
986
|
-
name: item.name,
|
|
987
|
-
value: item.code,
|
|
988
|
-
};
|
|
989
|
-
if (item.propertyList) {
|
|
990
|
-
Item.propertyList = item.propertyList.map((field) => ({
|
|
991
|
-
id: field.id,
|
|
992
|
-
code: field.code,
|
|
993
|
-
name: field.name,
|
|
994
|
-
value: `${item.code}.${field.code}`,
|
|
995
|
-
valueText: `${item.name}.${field.name}`,
|
|
996
|
-
}));
|
|
997
|
-
}
|
|
998
|
-
return Item;
|
|
999
|
-
});
|
|
1000
|
-
if (!ites) return;
|
|
1001
|
-
const styleCommon = {
|
|
1002
|
-
width: '200px',
|
|
1003
|
-
...(ites?.rightText ? { marginLeft: 10 } : {}),
|
|
1004
|
-
};
|
|
1005
|
-
const style2 = {
|
|
1006
|
-
width: '100px',
|
|
1007
|
-
};
|
|
1008
|
-
return (
|
|
1009
|
-
<>
|
|
1010
|
-
{/* 输入/字符串 */}
|
|
1011
|
-
{(ites?.inputType === 10 && ites?.valueType === 21 && (
|
|
1012
|
-
<Input
|
|
1013
|
-
disabled={disabled}
|
|
1014
|
-
allowClear={true}
|
|
1015
|
-
onClear={() => {
|
|
1016
|
-
handleEdit(ites.code, undefined);
|
|
1017
|
-
}}
|
|
1018
|
-
defaultValue={showValue(ites.code, 'input')}
|
|
1019
|
-
style={styleCommon}
|
|
1020
|
-
onBlur={(e) => {
|
|
1021
|
-
handleEdit(
|
|
1022
|
-
ites.code,
|
|
1023
|
-
String(e.target.value).trim() == ''
|
|
1024
|
-
? undefined
|
|
1025
|
-
: e.target.value,
|
|
1026
|
-
);
|
|
1027
|
-
}}
|
|
1028
|
-
/>
|
|
1029
|
-
)) ||
|
|
1030
|
-
null}
|
|
1031
|
-
{/* 输入 / 长整数23/小数22 */}
|
|
1032
|
-
{(ites?.inputType === 10 &&
|
|
1033
|
-
(ites?.valueType === 23 || ites?.valueType === 22) && (
|
|
1034
|
-
<InputNumber
|
|
1035
|
-
disabled={disabled}
|
|
1036
|
-
max={Number.MAX_SAFE_INTEGER}
|
|
1037
|
-
min={ites?.valueType === 23 ? 0 : Number.MIN_SAFE_INTEGER}
|
|
1038
|
-
precision={ites?.valueType === 23 ? 0 : 2}
|
|
1039
|
-
defaultValue={ites.defaultValue}
|
|
1040
|
-
style={style2}
|
|
1041
|
-
value={showValue(ites.code)}
|
|
1042
|
-
onChange={(value) => {
|
|
1043
|
-
handleEdit(ites.code, value);
|
|
1044
|
-
}}
|
|
1045
|
-
/>
|
|
1046
|
-
)) ||
|
|
1047
|
-
null}
|
|
1048
|
-
{/* 输入/日期 */}
|
|
1049
|
-
{(ites?.inputType === 10 && ites?.valueType === 41 && (
|
|
1050
|
-
<DatePicker
|
|
1051
|
-
disabled={disabled}
|
|
1052
|
-
defaultValue={ites.defaultValue}
|
|
1053
|
-
style={style2}
|
|
1054
|
-
value={showValue(ites.code)}
|
|
1055
|
-
onChange={(value) => {
|
|
1056
|
-
handleEdit(ites.code, value);
|
|
1057
|
-
}}
|
|
1058
|
-
/>
|
|
1059
|
-
)) ||
|
|
1060
|
-
null}
|
|
1061
|
-
{/* 输入/时间 */}
|
|
1062
|
-
{(ites?.inputType === 10 && ites?.valueType === 40 && (
|
|
1063
|
-
<RangePicker
|
|
1064
|
-
showTime
|
|
1065
|
-
disabled={disabled}
|
|
1066
|
-
defaultValue={ites.defaultValue}
|
|
1067
|
-
style={style2}
|
|
1068
|
-
value={showValue(ites.code)}
|
|
1069
|
-
onChange={(value) => {
|
|
1070
|
-
handleEdit(ites.code, value);
|
|
1071
|
-
}}
|
|
1072
|
-
/>
|
|
1073
|
-
)) ||
|
|
1074
|
-
null}
|
|
1075
|
-
{/* 输入/布尔值 */}
|
|
1076
|
-
{(ites?.inputType === 10 && ites?.valueType === 24 && (
|
|
1077
|
-
<Switch
|
|
1078
|
-
disabled={disabled}
|
|
1079
|
-
defaultChecked={!!ites.defaultValue}
|
|
1080
|
-
style={style2}
|
|
1081
|
-
checked={showValue(ites.code)}
|
|
1082
|
-
onChange={(value) => {
|
|
1083
|
-
handleEdit(ites.code, value);
|
|
1084
|
-
}}
|
|
1085
|
-
/>
|
|
1086
|
-
)) ||
|
|
1087
|
-
null}
|
|
1088
|
-
{/* 单选/多选 自定义 */}
|
|
1089
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1090
|
-
ites?.choiceType === 10 && (
|
|
1091
|
-
<Select
|
|
1092
|
-
disabled={disabled}
|
|
1093
|
-
allowClear
|
|
1094
|
-
showArrow
|
|
1095
|
-
{...(ites?.inputType === 30
|
|
1096
|
-
? {
|
|
1097
|
-
mode: 'multiple',
|
|
1098
|
-
}
|
|
1099
|
-
: {})}
|
|
1100
|
-
defaultValue={ites.defaultValue}
|
|
1101
|
-
style={styleCommon}
|
|
1102
|
-
value={showValue(ites.code)}
|
|
1103
|
-
onChange={(value) => {
|
|
1104
|
-
handleEdit(ites.code, value);
|
|
1105
|
-
}}
|
|
1106
|
-
>
|
|
1107
|
-
{Object.keys(ites.enumeration).map((it) => (
|
|
1108
|
-
<Select.Option key={it} value={it}>
|
|
1109
|
-
{ites.enumeration[it]}
|
|
1110
|
-
</Select.Option>
|
|
1111
|
-
))}
|
|
1112
|
-
</Select>
|
|
1113
|
-
)) ||
|
|
1114
|
-
null}
|
|
1115
|
-
{/* 单选/多选 数据字典 */}
|
|
1116
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1117
|
-
ites?.choiceType === 20 && (
|
|
1118
|
-
<Select
|
|
1119
|
-
disabled={disabled}
|
|
1120
|
-
{...(ites?.inputType === 30
|
|
1121
|
-
? {
|
|
1122
|
-
mode: 'multiple',
|
|
1123
|
-
}
|
|
1124
|
-
: {})}
|
|
1125
|
-
defaultValue={ites.defaultValue}
|
|
1126
|
-
style={styleCommon}
|
|
1127
|
-
value={showValue(ites.code)}
|
|
1128
|
-
onChange={(value) => {
|
|
1129
|
-
handleEdit(ites.code, value);
|
|
1130
|
-
}}
|
|
1131
|
-
>
|
|
1132
|
-
{getDictionarySource(ites?.dictionaryCode).map((it) => (
|
|
1133
|
-
<Select.Option key={it.value} value={it.value}>
|
|
1134
|
-
{it.text}
|
|
1135
|
-
</Select.Option>
|
|
1136
|
-
))}
|
|
1137
|
-
</Select>
|
|
1138
|
-
)) ||
|
|
1139
|
-
null}
|
|
1140
|
-
{/* 单选/多选 仓库选择器(物理仓) */}
|
|
1141
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1142
|
-
ites?.choiceType === 110 && (
|
|
1143
|
-
<BusinessSearchSelect
|
|
1144
|
-
selectBusinessType="physicalWarehouse"
|
|
1145
|
-
selectProps={{
|
|
1146
|
-
style: styleCommon,
|
|
1147
|
-
placeholder: '请选择物理仓',
|
|
1148
|
-
...(ites?.inputType === 30
|
|
1149
|
-
? {
|
|
1150
|
-
mode: 'multiple',
|
|
1151
|
-
maxTagCount: 1,
|
|
1152
|
-
}
|
|
1153
|
-
: {}),
|
|
1154
|
-
}}
|
|
1155
|
-
disabled={disabled}
|
|
1156
|
-
labelInValue={true}
|
|
1157
|
-
value={showValue(ites.code)}
|
|
1158
|
-
requestConfig={{
|
|
1159
|
-
mappingValueField: 'physicalWarehouseCode',
|
|
1160
|
-
filterInit: 'qp-physicalWarehouseCode-in',
|
|
1161
|
-
}}
|
|
1162
|
-
onChange={(value) => {
|
|
1163
|
-
handleEdit(ites.code, value);
|
|
1164
|
-
}}
|
|
1165
|
-
getPopupContainer={() => document.body}
|
|
1166
|
-
/>
|
|
1167
|
-
)) ||
|
|
1168
|
-
null}
|
|
1169
|
-
{/* 单选/多选 仓库选择器(逻辑仓) */}
|
|
1170
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1171
|
-
ites?.choiceType === 120 && (
|
|
1172
|
-
<BusinessSearchSelect
|
|
1173
|
-
selectBusinessType="realWarehouse"
|
|
1174
|
-
selectProps={{
|
|
1175
|
-
style: styleCommon,
|
|
1176
|
-
placeholder: '请选择逻辑仓',
|
|
1177
|
-
...(ites?.inputType === 30
|
|
1178
|
-
? {
|
|
1179
|
-
mode: 'multiple',
|
|
1180
|
-
maxTagCount: 1,
|
|
1181
|
-
}
|
|
1182
|
-
: {}),
|
|
1183
|
-
}}
|
|
1184
|
-
disabled={disabled}
|
|
1185
|
-
labelInValue={true}
|
|
1186
|
-
value={showValue(ites.code)}
|
|
1187
|
-
requestConfig={{
|
|
1188
|
-
mappingValueField: 'realWarehouseCode',
|
|
1189
|
-
filterInit: 'qp-realWarehouseCode-in',
|
|
1190
|
-
}}
|
|
1191
|
-
onChange={(value) => {
|
|
1192
|
-
handleEdit(ites.code, value);
|
|
1193
|
-
}}
|
|
1194
|
-
getPopupContainer={() => document.body}
|
|
1195
|
-
/>
|
|
1196
|
-
)) ||
|
|
1197
|
-
null}
|
|
1198
|
-
{/* 单选/多选 仓库选择器(虚拟仓) */}
|
|
1199
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1200
|
-
ites?.choiceType === 130 && (
|
|
1201
|
-
<BusinessSearchSelect
|
|
1202
|
-
selectBusinessType="virtualWarehouse"
|
|
1203
|
-
selectProps={{
|
|
1204
|
-
style: styleCommon,
|
|
1205
|
-
placeholder: '请选择虚拟仓',
|
|
1206
|
-
...(ites?.inputType === 30
|
|
1207
|
-
? {
|
|
1208
|
-
mode: 'multiple',
|
|
1209
|
-
maxTagCount: 1,
|
|
1210
|
-
}
|
|
1211
|
-
: {}),
|
|
1212
|
-
}}
|
|
1213
|
-
disabled={disabled}
|
|
1214
|
-
labelInValue={true}
|
|
1215
|
-
value={showValue(ites.code)}
|
|
1216
|
-
requestConfig={{
|
|
1217
|
-
mappingValueField: 'virtualWarehouseCode',
|
|
1218
|
-
filterInit: 'qp-virtualWarehouseCode-in',
|
|
1219
|
-
}}
|
|
1220
|
-
onChange={(value) => {
|
|
1221
|
-
handleEdit(ites.code, value);
|
|
1222
|
-
}}
|
|
1223
|
-
getPopupContainer={() => document.body}
|
|
1224
|
-
/>
|
|
1225
|
-
)) ||
|
|
1226
|
-
null}
|
|
1227
|
-
{/* 单选/多选 仓库选择器(渠道仓) */}
|
|
1228
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1229
|
-
ites?.choiceType === 140 && (
|
|
1230
|
-
<BusinessSearchSelect
|
|
1231
|
-
selectBusinessType="channelWarehouse"
|
|
1232
|
-
selectProps={{
|
|
1233
|
-
style: styleCommon,
|
|
1234
|
-
placeholder: '请选择渠道仓',
|
|
1235
|
-
...(ites?.inputType === 30
|
|
1236
|
-
? {
|
|
1237
|
-
mode: 'multiple',
|
|
1238
|
-
maxTagCount: 1,
|
|
1239
|
-
}
|
|
1240
|
-
: {}),
|
|
1241
|
-
}}
|
|
1242
|
-
disabled={disabled}
|
|
1243
|
-
labelInValue={true}
|
|
1244
|
-
value={showValue(ites.code)}
|
|
1245
|
-
requestConfig={{
|
|
1246
|
-
mappingValueField: 'channelWarehouseCode',
|
|
1247
|
-
filterInit: 'qp-channelWarehouseCode-in',
|
|
1248
|
-
}}
|
|
1249
|
-
onChange={(value) => {
|
|
1250
|
-
handleEdit(ites.code, value);
|
|
1251
|
-
}}
|
|
1252
|
-
getPopupContainer={() => document.body}
|
|
1253
|
-
/>
|
|
1254
|
-
)) ||
|
|
1255
|
-
null}
|
|
1256
|
-
{/* 单选/多选 商品SPU选择器 */}
|
|
1257
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1258
|
-
ites?.choiceType === 150 && (
|
|
1259
|
-
<BusinessSearchSelect
|
|
1260
|
-
selectBusinessType="spuCommodity"
|
|
1261
|
-
selectProps={{
|
|
1262
|
-
style: styleCommon,
|
|
1263
|
-
placeholder: '请选择SPU',
|
|
1264
|
-
...(ites?.inputType === 30
|
|
1265
|
-
? {
|
|
1266
|
-
mode: 'multiple',
|
|
1267
|
-
maxTagCount: 1,
|
|
1268
|
-
}
|
|
1269
|
-
: {}),
|
|
1270
|
-
}}
|
|
1271
|
-
disabled={disabled}
|
|
1272
|
-
labelInValue={true}
|
|
1273
|
-
value={showValue(ites.code)}
|
|
1274
|
-
requestConfig={{
|
|
1275
|
-
filterInit: 'qp-itemCode-in',
|
|
1276
|
-
}}
|
|
1277
|
-
onChange={(value) => {
|
|
1278
|
-
handleEdit(ites.code, value);
|
|
1279
|
-
}}
|
|
1280
|
-
getPopupContainer={() => document.body}
|
|
1281
|
-
/>
|
|
1282
|
-
)) ||
|
|
1283
|
-
null}
|
|
1284
|
-
{/* 单选/多选 商品SKU选择器 */}
|
|
1285
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1286
|
-
ites?.choiceType === 160 && (
|
|
1287
|
-
<BusinessSearchSelect
|
|
1288
|
-
selectBusinessType="skuCommodity"
|
|
1289
|
-
selectProps={{
|
|
1290
|
-
style: styleCommon,
|
|
1291
|
-
placeholder: '请选择商品',
|
|
1292
|
-
...(ites?.inputType === 30
|
|
1293
|
-
? {
|
|
1294
|
-
mode: 'multiple',
|
|
1295
|
-
maxTagCount: 1,
|
|
1296
|
-
}
|
|
1297
|
-
: {}),
|
|
1298
|
-
}}
|
|
1299
|
-
disabled={disabled}
|
|
1300
|
-
labelInValue={true}
|
|
1301
|
-
value={showValue(ites.code)}
|
|
1302
|
-
requestConfig={{
|
|
1303
|
-
filterInit: 'qp-skuCode-in',
|
|
1304
|
-
}}
|
|
1305
|
-
onChange={(value) => {
|
|
1306
|
-
handleEdit(ites.code, value);
|
|
1307
|
-
}}
|
|
1308
|
-
getPopupContainer={() => document.body}
|
|
1309
|
-
/>
|
|
1310
|
-
)) ||
|
|
1311
|
-
null}
|
|
1312
|
-
{/* 单选/多选 省市区 */}
|
|
1313
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1314
|
-
ites?.choiceType === 190 && (
|
|
1315
|
-
<BsCascader
|
|
1316
|
-
disabled={disabled}
|
|
1317
|
-
isAll={true}
|
|
1318
|
-
needNameAndCode={true}
|
|
1319
|
-
notChangeOnSelect={true}
|
|
1320
|
-
initRequestSource={async () => {
|
|
1321
|
-
return await request({
|
|
1322
|
-
url: '/basic/bscArea/getBscAreaList?qp-level-eq=1&qp-pid-eq=100000',
|
|
1323
|
-
method: 'get',
|
|
1324
|
-
converter: ({ data }) => {
|
|
1325
|
-
const handleData =
|
|
1326
|
-
data && data[0]
|
|
1327
|
-
? data?.map((item) => {
|
|
1328
|
-
return {
|
|
1329
|
-
text: item.name,
|
|
1330
|
-
value: item.id,
|
|
1331
|
-
level: item.level,
|
|
1332
|
-
id: item.id,
|
|
1333
|
-
};
|
|
1334
|
-
})
|
|
1335
|
-
: [];
|
|
1336
|
-
return handleData;
|
|
1337
|
-
},
|
|
1338
|
-
});
|
|
1339
|
-
}}
|
|
1340
|
-
value={showValue(ites.code)}
|
|
1341
|
-
onChange={(value) => {
|
|
1342
|
-
handleEdit(ites.code, value);
|
|
1343
|
-
}}
|
|
1344
|
-
getPopupContainer={() => document.body}
|
|
1345
|
-
/>
|
|
1346
|
-
)) ||
|
|
1347
|
-
null}
|
|
1348
|
-
{/* 单选/多选 行政组织选择器 */}
|
|
1349
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1350
|
-
ites?.choiceType === 210 && (
|
|
1351
|
-
<BusinessTreeSearchSelect
|
|
1352
|
-
disabled={disabled}
|
|
1353
|
-
treeCheckable={ites?.inputType === 30}
|
|
1354
|
-
businessType="department"
|
|
1355
|
-
labelInValue={true}
|
|
1356
|
-
value={showValue(ites.code)}
|
|
1357
|
-
style={styleCommon}
|
|
1358
|
-
onChange={(value) => {
|
|
1359
|
-
handleEdit(ites.code, value);
|
|
1360
|
-
}}
|
|
1361
|
-
getPopupContainer={() => document.body}
|
|
1362
|
-
/>
|
|
1363
|
-
)) ||
|
|
1364
|
-
null}
|
|
1365
|
-
{/* 单选/多选 采购组织选择器 */}
|
|
1366
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1367
|
-
ites?.choiceType === 220 && (
|
|
1368
|
-
<BusinessTreeSearchSelect
|
|
1369
|
-
disabled={disabled}
|
|
1370
|
-
treeCheckable={ites?.inputType === 30}
|
|
1371
|
-
businessType="purchase-organization"
|
|
1372
|
-
labelInValue={true}
|
|
1373
|
-
value={showValue(ites.code)}
|
|
1374
|
-
style={styleCommon}
|
|
1375
|
-
onChange={(value) => {
|
|
1376
|
-
handleEdit(ites.code, value);
|
|
1377
|
-
}}
|
|
1378
|
-
getPopupContainer={() => document.body}
|
|
1379
|
-
/>
|
|
1380
|
-
)) ||
|
|
1381
|
-
null}
|
|
1382
|
-
{/* 单选/多选 销售组织选择器 */}
|
|
1383
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1384
|
-
ites?.choiceType === 230 && (
|
|
1385
|
-
<BusinessTreeSearchSelect
|
|
1386
|
-
disabled={disabled}
|
|
1387
|
-
treeCheckable={ites?.inputType === 30}
|
|
1388
|
-
businessType="sales-organization"
|
|
1389
|
-
labelInValue={true}
|
|
1390
|
-
value={showValue(ites.code)}
|
|
1391
|
-
style={styleCommon}
|
|
1392
|
-
onChange={(value) => {
|
|
1393
|
-
handleEdit(ites.code, value);
|
|
1394
|
-
}}
|
|
1395
|
-
getPopupContainer={() => document.body}
|
|
1396
|
-
/>
|
|
1397
|
-
)) ||
|
|
1398
|
-
null}
|
|
1399
|
-
{/* 单选/多选 供应商选择器 */}
|
|
1400
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1401
|
-
ites?.choiceType === 240 && (
|
|
1402
|
-
<BusinessSearchSelect
|
|
1403
|
-
selectBusinessType="supplier2"
|
|
1404
|
-
selectProps={{
|
|
1405
|
-
style: styleCommon,
|
|
1406
|
-
placeholder: '请选择供应商',
|
|
1407
|
-
...(ites?.inputType === 30
|
|
1408
|
-
? {
|
|
1409
|
-
mode: 'multiple',
|
|
1410
|
-
maxTagCount: 1,
|
|
1411
|
-
}
|
|
1412
|
-
: {}),
|
|
1413
|
-
}}
|
|
1414
|
-
disabled={disabled}
|
|
1415
|
-
labelInValue={true}
|
|
1416
|
-
value={showValue(ites.code)}
|
|
1417
|
-
requestConfig={{
|
|
1418
|
-
filterInit: 'qp-code-in',
|
|
1419
|
-
}}
|
|
1420
|
-
onChange={(value) => {
|
|
1421
|
-
handleEdit(ites.code, value);
|
|
1422
|
-
}}
|
|
1423
|
-
getPopupContainer={() => document.body}
|
|
1424
|
-
/>
|
|
1425
|
-
)) ||
|
|
1426
|
-
null}
|
|
1427
|
-
{/* 单选/多选 客户选择器 */}
|
|
1428
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1429
|
-
ites?.choiceType === 250 && (
|
|
1430
|
-
<BusinessSearchSelect
|
|
1431
|
-
selectBusinessType="customer2"
|
|
1432
|
-
selectProps={{
|
|
1433
|
-
style: styleCommon,
|
|
1434
|
-
placeholder: '请选择客户',
|
|
1435
|
-
...(ites?.inputType === 30
|
|
1436
|
-
? {
|
|
1437
|
-
mode: 'multiple',
|
|
1438
|
-
maxTagCount: 1,
|
|
1439
|
-
}
|
|
1440
|
-
: {}),
|
|
1441
|
-
}}
|
|
1442
|
-
disabled={disabled}
|
|
1443
|
-
labelInValue={true}
|
|
1444
|
-
value={showValue(ites.code)}
|
|
1445
|
-
requestConfig={{
|
|
1446
|
-
filterInit: 'qp-code-in',
|
|
1447
|
-
}}
|
|
1448
|
-
onChange={(value) => {
|
|
1449
|
-
handleEdit(ites.code, value);
|
|
1450
|
-
}}
|
|
1451
|
-
getPopupContainer={() => document.body}
|
|
1452
|
-
/>
|
|
1453
|
-
)) ||
|
|
1454
|
-
null}
|
|
1455
|
-
{/* 单选/多选 店铺选择器 */}
|
|
1456
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1457
|
-
ites?.choiceType === 260 && (
|
|
1458
|
-
<BusinessSearchSelect
|
|
1459
|
-
selectBusinessType="shopFile2"
|
|
1460
|
-
selectProps={{
|
|
1461
|
-
style: styleCommon,
|
|
1462
|
-
placeholder: '请选择店铺',
|
|
1463
|
-
...(ites?.inputType === 30
|
|
1464
|
-
? {
|
|
1465
|
-
mode: 'multiple',
|
|
1466
|
-
maxTagCount: 1,
|
|
1467
|
-
}
|
|
1468
|
-
: {}),
|
|
1469
|
-
}}
|
|
1470
|
-
disabled={disabled}
|
|
1471
|
-
labelInValue={true}
|
|
1472
|
-
value={showValue(ites.code)}
|
|
1473
|
-
requestConfig={{
|
|
1474
|
-
filterInit: 'qp-code-in',
|
|
1475
|
-
}}
|
|
1476
|
-
onChange={(value) => {
|
|
1477
|
-
handleEdit(ites.code, value);
|
|
1478
|
-
}}
|
|
1479
|
-
getPopupContainer={() => document.body}
|
|
1480
|
-
/>
|
|
1481
|
-
)) ||
|
|
1482
|
-
null}
|
|
1483
|
-
{/* 单选/多选 员工选择器 */}
|
|
1484
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1485
|
-
ites?.choiceType === 270 && (
|
|
1486
|
-
<BusinessSearchSelect
|
|
1487
|
-
selectBusinessType="employee2"
|
|
1488
|
-
selectProps={{
|
|
1489
|
-
style: styleCommon,
|
|
1490
|
-
placeholder: '请选择员工',
|
|
1491
|
-
...(ites?.inputType === 30
|
|
1492
|
-
? {
|
|
1493
|
-
mode: 'multiple',
|
|
1494
|
-
maxTagCount: 1,
|
|
1495
|
-
}
|
|
1496
|
-
: {}),
|
|
1497
|
-
}}
|
|
1498
|
-
disabled={disabled}
|
|
1499
|
-
labelInValue={true}
|
|
1500
|
-
value={showValue(ites.code)}
|
|
1501
|
-
requestConfig={{
|
|
1502
|
-
filterInit: 'qp-id-in',
|
|
1503
|
-
}}
|
|
1504
|
-
onChange={(value) => {
|
|
1505
|
-
handleEdit(ites.code, value);
|
|
1506
|
-
}}
|
|
1507
|
-
getPopupContainer={() => document.body}
|
|
1508
|
-
/>
|
|
1509
|
-
)) ||
|
|
1510
|
-
null}
|
|
1511
|
-
{/* 单选/多选 库存组织选择器 */}
|
|
1512
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1513
|
-
ites?.choiceType === 280 && (
|
|
1514
|
-
<BusinessTreeSearchSelect
|
|
1515
|
-
disabled={disabled}
|
|
1516
|
-
treeCheckable={ites?.inputType === 30}
|
|
1517
|
-
businessType="stock-organization"
|
|
1518
|
-
labelInValue={true}
|
|
1519
|
-
value={showValue(ites.code)}
|
|
1520
|
-
style={styleCommon}
|
|
1521
|
-
onChange={(value) => {
|
|
1522
|
-
handleEdit(ites.code, value);
|
|
1523
|
-
}}
|
|
1524
|
-
getPopupContainer={() => document.body}
|
|
1525
|
-
/>
|
|
1526
|
-
)) ||
|
|
1527
|
-
null}
|
|
1528
|
-
{/* 单选/多选 配送方式选择器 */}
|
|
1529
|
-
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1530
|
-
ites?.choiceType === 310 && (
|
|
1531
|
-
<BusinessSearchSelect
|
|
1532
|
-
selectBusinessType="deliveryMode"
|
|
1533
|
-
selectProps={{
|
|
1534
|
-
style: styleCommon,
|
|
1535
|
-
placeholder: '请选择配送方式',
|
|
1536
|
-
...(ites?.inputType === 30
|
|
1537
|
-
? {
|
|
1538
|
-
mode: 'multiple',
|
|
1539
|
-
maxTagCount: 1,
|
|
1540
|
-
}
|
|
1541
|
-
: {}),
|
|
1542
|
-
}}
|
|
1543
|
-
disabled={disabled}
|
|
1544
|
-
labelInValue={true}
|
|
1545
|
-
value={showValue(ites.code)}
|
|
1546
|
-
requestConfig={{
|
|
1547
|
-
filterInit: 'qp-code-in',
|
|
1548
|
-
}}
|
|
1549
|
-
onChange={(value) => {
|
|
1550
|
-
handleEdit(ites.code, value);
|
|
1551
|
-
}}
|
|
1552
|
-
getPopupContainer={() => document.body}
|
|
1553
|
-
/>
|
|
1554
|
-
)) ||
|
|
1555
|
-
null}
|
|
1556
|
-
{/* 表达式 */}
|
|
1557
|
-
{ites?.inputType === 40 && (
|
|
1558
|
-
<div style={{ display: 'flex' }}>
|
|
1559
|
-
<Formula
|
|
1560
|
-
disabled={disabled}
|
|
1561
|
-
key={showValue(ites.code)}
|
|
1562
|
-
setValue={(val, formulaName) => {
|
|
1563
|
-
console.log(val, 'val');
|
|
1564
|
-
const value = val.map((item) => {
|
|
1565
|
-
return item.value.replace(
|
|
1566
|
-
/[a-zA-Z_]+\.\w+/g,
|
|
1567
|
-
(i) => '{' + i + '}',
|
|
1568
|
-
);
|
|
1569
|
-
});
|
|
1570
|
-
handleEdit(ites.code, value.join(''));
|
|
1571
|
-
handleEdit({
|
|
1572
|
-
inputType: 40,
|
|
1573
|
-
formulaName,
|
|
1574
|
-
});
|
|
1575
|
-
}}
|
|
1576
|
-
record={{ expression: showValue(ites.code) }}
|
|
1577
|
-
sourceData={fieldListGroup}
|
|
1578
|
-
/>
|
|
1579
|
-
</div>
|
|
1580
|
-
)}
|
|
1581
|
-
</>
|
|
1582
|
-
);
|
|
1583
|
-
};
|
|
1584
|
-
|
|
1585
|
-
renderFormCompItem = (
|
|
1586
|
-
config,
|
|
1587
|
-
showValue,
|
|
1588
|
-
handleEdit,
|
|
1589
|
-
parentItem,
|
|
1590
|
-
boxStyle,
|
|
1591
|
-
disabled
|
|
1592
|
-
) => {
|
|
1593
|
-
if (!config) return;
|
|
1594
|
-
return (
|
|
1595
|
-
<div style={boxStyle}>
|
|
1596
|
-
{(config?.leftText && (
|
|
1597
|
-
<div style={{ flex: 'none', marginRight: 10 }}>
|
|
1598
|
-
{config?.required && <span className="requiredMark" />}
|
|
1599
|
-
{config.leftText}
|
|
1600
|
-
</div>
|
|
1601
|
-
)) ||
|
|
1602
|
-
null}
|
|
1603
|
-
{(!config?.leftText && config?.rightText && config?.required && (
|
|
1604
|
-
<div style={{ flex: 'none', marginRight: 10 }}>
|
|
1605
|
-
<span className="requiredMark" />
|
|
1606
|
-
</div>
|
|
1607
|
-
)) ||
|
|
1608
|
-
null}
|
|
1609
|
-
{this.renderCompItem(
|
|
1610
|
-
config,
|
|
1611
|
-
(a, b, c = parentItem, d = config) => showValue(a, b, c, d),
|
|
1612
|
-
(a, b, c = parentItem, d = config) => handleEdit(a, b, c, d),
|
|
1613
|
-
disabled
|
|
1614
|
-
)}
|
|
1615
|
-
{(config?.rightText && (
|
|
1616
|
-
<div style={{ flex: 'none', marginLeft: 10 }}>{config.rightText}</div>
|
|
1617
|
-
)) ||
|
|
1618
|
-
null}
|
|
1619
|
-
</div>
|
|
1620
|
-
);
|
|
1621
|
-
};
|
|
1622
|
-
|
|
1623
|
-
renderActionList = (
|
|
1624
|
-
itemDetail,
|
|
1625
|
-
parentDetail,
|
|
1626
|
-
handleRuleTypeData,
|
|
1627
|
-
sRuleActionData,
|
|
1628
|
-
classDataIndex,
|
|
1629
|
-
disabled,
|
|
1630
|
-
boxStyle,
|
|
1631
|
-
) => {
|
|
1632
|
-
const showValue = (code, type, functionItem, configItem) => {
|
|
1633
|
-
const functionIndex = handleRuleTypeData.findIndex(
|
|
1634
|
-
(m) => m.code === functionItem.code,
|
|
1635
|
-
);
|
|
1636
|
-
const pCode =
|
|
1637
|
-
itemDetail.execute[functionIndex] &&
|
|
1638
|
-
itemDetail.execute[functionIndex].properties[code];
|
|
1639
|
-
let defaultValue = configItem.defaultValue;
|
|
1640
|
-
if (type === 'input') {
|
|
1641
|
-
return pCode === undefined ? pCode : pCode || defaultValue;
|
|
1642
|
-
}
|
|
1643
|
-
return pCode || defaultValue;
|
|
1644
|
-
};
|
|
1645
|
-
const handleEdit = (code, val, functionItem) => {
|
|
1646
|
-
const functionIndex = handleRuleTypeData.findIndex(
|
|
1647
|
-
(m) => m.code === functionItem.code,
|
|
1648
|
-
);
|
|
1649
|
-
const { ruleClassData } = this.state;
|
|
1650
|
-
const { callBack } = this.props;
|
|
1651
|
-
parentDetail.extraInfo.execute[functionIndex]['properties'][code] = val;
|
|
1652
|
-
parentDetail.extraInfo.execute[functionIndex]['code'] = functionItem.code;
|
|
1653
|
-
|
|
1654
|
-
this.setState(
|
|
1655
|
-
{
|
|
1656
|
-
ruleClassData,
|
|
1657
|
-
},
|
|
1658
|
-
() => {
|
|
1659
|
-
callBack(ruleClassData);
|
|
1660
|
-
},
|
|
1661
|
-
);
|
|
1662
|
-
};
|
|
1663
|
-
|
|
1664
|
-
return (
|
|
1665
|
-
<>
|
|
1666
|
-
{sRuleActionData.map((i, index) => (
|
|
1667
|
-
<div>
|
|
1668
|
-
<div style={{ display: 'flex' }}>
|
|
1669
|
-
{(i.valueList?.length &&
|
|
1670
|
-
i.valueList.map((s) => {
|
|
1671
|
-
return this.renderFormCompItem(
|
|
1672
|
-
s,
|
|
1673
|
-
showValue,
|
|
1674
|
-
handleEdit,
|
|
1675
|
-
i,
|
|
1676
|
-
boxStyle,
|
|
1677
|
-
disabled
|
|
1678
|
-
);
|
|
1679
|
-
})) || (
|
|
1680
|
-
<div style={boxStyle} key={i.functionName}>
|
|
1681
|
-
<div>{i.functionName}</div>
|
|
1682
|
-
</div>
|
|
1683
|
-
)}
|
|
1684
|
-
<MinusCircleOutlined
|
|
1685
|
-
className={'icon_btn_style'}
|
|
1686
|
-
onClick={() => {
|
|
1687
|
-
this.handleDeleteRuleAction(classDataIndex, i.code);
|
|
1688
|
-
}}
|
|
1689
|
-
style={{
|
|
1690
|
-
color: 'gray',
|
|
1691
|
-
marginLeft: '15px',
|
|
1692
|
-
marginTop: '15px',
|
|
1693
|
-
display: disabled ? 'none' : 'inline-block',
|
|
1694
|
-
}}
|
|
1695
|
-
/>
|
|
1696
|
-
</div>
|
|
1697
|
-
</div>
|
|
1698
|
-
))}
|
|
1699
|
-
</>
|
|
1700
|
-
);
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
|
-
renderRuleTypeItem = (
|
|
1704
|
-
itemDetail,
|
|
1705
|
-
parentDetail,
|
|
1706
|
-
floorIndex,
|
|
1707
|
-
classDataIndex,
|
|
1708
|
-
ruleTypeData,
|
|
1709
|
-
ruleReturnConfig,
|
|
1710
|
-
isRuleInstance
|
|
1711
|
-
) => {
|
|
1712
|
-
const { modalParams } = this.state;
|
|
1713
|
-
const { disabled } = this.props;
|
|
1714
|
-
const isHaveRuleTypeData = ruleTypeData?.length;
|
|
1715
|
-
const isHaveRuleReturnConfig = Object.keys(ruleReturnConfig)?.length;
|
|
1716
|
-
const handleRuleTypeData = isHaveRuleTypeData
|
|
1717
|
-
? ruleTypeData.sort((a, b) => a.priority - b.priority)
|
|
1718
|
-
: [];
|
|
1719
|
-
|
|
1720
|
-
const selectRuleActionCode = isHaveRuleTypeData
|
|
1721
|
-
? itemDetail.execute.filter((i) => i.isSelected).map((s) => s.code)
|
|
1722
|
-
: [];
|
|
1723
|
-
const selectRuleActionData = isHaveRuleTypeData
|
|
1724
|
-
? handleRuleTypeData.filter((r) =>
|
|
1725
|
-
selectRuleActionCode.some((s) => s === r.code),
|
|
1726
|
-
)
|
|
1727
|
-
: [];
|
|
1728
|
-
|
|
1729
|
-
const RuleActionItemStyle = {
|
|
1730
|
-
display: 'flex',
|
|
1731
|
-
height: '30px',
|
|
1732
|
-
lineHeight: '30px',
|
|
1733
|
-
margin: '10px 0px',
|
|
1734
|
-
};
|
|
1735
|
-
return (
|
|
1736
|
-
<div>
|
|
1737
|
-
<div style={{ textAlign: 'right', display: isRuleInstance ? 'none' : 'flex' }}>
|
|
1738
|
-
<Button
|
|
1739
|
-
type="link"
|
|
1740
|
-
onClick={() => {
|
|
1741
|
-
if (isHaveRuleTypeData) {
|
|
1742
|
-
this.setState({
|
|
1743
|
-
modalParams: {
|
|
1744
|
-
...modalParams,
|
|
1745
|
-
ruleActionData: handleRuleTypeData,
|
|
1746
|
-
classDataIndex,
|
|
1747
|
-
visible: true,
|
|
1748
|
-
},
|
|
1749
|
-
});
|
|
1750
|
-
} else {
|
|
1751
|
-
message.warn('未配置执行动作');
|
|
1752
|
-
}
|
|
1753
|
-
}}
|
|
1754
|
-
>
|
|
1755
|
-
新增动作
|
|
1756
|
-
</Button>
|
|
1757
|
-
<Button
|
|
1758
|
-
type="link"
|
|
1759
|
-
onClick={() => {
|
|
1760
|
-
if (isHaveRuleReturnConfig) {
|
|
1761
|
-
this.handleEditExtraInfoResponse('enable', true, parentDetail,classDataIndex);
|
|
1762
|
-
} else {
|
|
1763
|
-
message.warn('未配置返回');
|
|
1764
|
-
}
|
|
1765
|
-
}}
|
|
1766
|
-
>
|
|
1767
|
-
新增返回值
|
|
1768
|
-
</Button>
|
|
1769
|
-
</div>
|
|
1770
|
-
{(isHaveRuleReturnConfig &&
|
|
1771
|
-
this.renderResItem(
|
|
1772
|
-
itemDetail,
|
|
1773
|
-
parentDetail,
|
|
1774
|
-
ruleReturnConfig,
|
|
1775
|
-
classDataIndex,
|
|
1776
|
-
disabled,
|
|
1777
|
-
RuleActionItemStyle,
|
|
1778
|
-
)) ||
|
|
1779
|
-
null}
|
|
1780
|
-
{(isHaveRuleTypeData &&
|
|
1781
|
-
this.renderActionList(
|
|
1782
|
-
itemDetail,
|
|
1783
|
-
parentDetail,
|
|
1784
|
-
handleRuleTypeData,
|
|
1785
|
-
selectRuleActionData,
|
|
1786
|
-
classDataIndex,
|
|
1787
|
-
disabled,
|
|
1788
|
-
RuleActionItemStyle,
|
|
1789
|
-
)) ||
|
|
1790
|
-
null}
|
|
1791
|
-
</div>
|
|
1792
|
-
);
|
|
1793
|
-
};
|
|
1794
|
-
|
|
1795
|
-
//添加同一层级条件
|
|
1796
|
-
addPeerRule = (itemDetail) => {
|
|
1797
|
-
const { ruleClassData } = this.state;
|
|
1798
|
-
const { callBack, disabled } = this.props;
|
|
1799
|
-
if (disabled) return;
|
|
1800
|
-
itemDetail.subExpression.push({
|
|
1801
|
-
// "expressionType": "relation",
|
|
1802
|
-
operationType: 'relation',
|
|
1803
|
-
operationCode: '',
|
|
1804
|
-
propertyPath: '',
|
|
1805
|
-
params: [],
|
|
1806
|
-
paramNames: [],
|
|
1807
|
-
});
|
|
1808
|
-
this.setState(
|
|
1809
|
-
{
|
|
1810
|
-
ruleClassData,
|
|
1811
|
-
},
|
|
1812
|
-
() => {
|
|
1813
|
-
callBack(ruleClassData);
|
|
1814
|
-
},
|
|
1815
|
-
);
|
|
1816
|
-
};
|
|
1817
|
-
|
|
1818
|
-
//添加子层级条件
|
|
1819
|
-
addChildRules = (itemDetail) => {
|
|
1820
|
-
const { ruleClassData } = this.state;
|
|
1821
|
-
const { callBack } = this.props;
|
|
1822
|
-
const initialData = JSON.parse(JSON.stringify(itemDetail));
|
|
1823
|
-
delete itemDetail.propertyPath;
|
|
1824
|
-
delete itemDetail.params;
|
|
1825
|
-
delete itemDetail.paramNames;
|
|
1826
|
-
delete itemDetail.dataTypeCode;
|
|
1827
|
-
delete itemDetail.elementId;
|
|
1828
|
-
delete itemDetail.elementName;
|
|
1829
|
-
delete itemDetail.metaObjectCode;
|
|
1830
|
-
// itemDetail.expressionType = 'logic';
|
|
1831
|
-
itemDetail.operationType = 'logic';
|
|
1832
|
-
itemDetail.operationCode = 'and';
|
|
1833
|
-
itemDetail.subExpression = [
|
|
1834
|
-
initialData,
|
|
1835
|
-
{
|
|
1836
|
-
// "expressionType": "relation",
|
|
1837
|
-
operationType: 'relation',
|
|
1838
|
-
operationCode: '',
|
|
1839
|
-
propertyPath: '',
|
|
1840
|
-
params: [],
|
|
1841
|
-
paramNames: [],
|
|
1842
|
-
},
|
|
1843
|
-
];
|
|
1844
|
-
this.setState(
|
|
1845
|
-
{
|
|
1846
|
-
ruleClassData,
|
|
1847
|
-
},
|
|
1848
|
-
() => {
|
|
1849
|
-
callBack(ruleClassData);
|
|
1850
|
-
},
|
|
1851
|
-
);
|
|
1852
|
-
};
|
|
1853
|
-
|
|
1854
|
-
handleDeleteRule = (itemDetail, parentDetail, classDataIndex) => {
|
|
1855
|
-
const { ruleClassData } = this.state;
|
|
1856
|
-
const { callBack } = this.props;
|
|
1857
|
-
if (parentDetail.ruleName) {
|
|
1858
|
-
//删除根规则层级最后一条时整个规则项删除
|
|
1859
|
-
ruleClassData.splice(classDataIndex, 1);
|
|
1860
|
-
} else {
|
|
1861
|
-
let deleteItemIndex = parentDetail.subExpression.findIndex(
|
|
1862
|
-
(detailItem) =>
|
|
1863
|
-
JSON.stringify(itemDetail) == JSON.stringify(detailItem),
|
|
1864
|
-
);
|
|
1865
|
-
if (parentDetail.subExpression.length > 2) {
|
|
1866
|
-
parentDetail.subExpression.splice(deleteItemIndex, 1);
|
|
1867
|
-
} else {
|
|
1868
|
-
parentDetail.subExpression.splice(deleteItemIndex, 1);
|
|
1869
|
-
// parentDetail.expressionType = parentDetail.subExpression[0].expressionType;
|
|
1870
|
-
parentDetail.operationCode =
|
|
1871
|
-
parentDetail.subExpression[0].operationCode;
|
|
1872
|
-
parentDetail.operationType =
|
|
1873
|
-
parentDetail.subExpression[0].operationType;
|
|
1874
|
-
|
|
1875
|
-
if (parentDetail.subExpression[0].operationType == 'logic') {
|
|
1876
|
-
parentDetail.subExpression = [
|
|
1877
|
-
...parentDetail.subExpression[0].subExpression,
|
|
1878
|
-
];
|
|
1879
|
-
} else {
|
|
1880
|
-
parentDetail.propertyPath =
|
|
1881
|
-
parentDetail.subExpression[0].propertyPath;
|
|
1882
|
-
parentDetail.params = [...parentDetail.subExpression[0].params];
|
|
1883
|
-
parentDetail.paramNames = parentDetail.subExpression[0].paramNames
|
|
1884
|
-
? [...parentDetail.subExpression[0].paramNames]
|
|
1885
|
-
: [];
|
|
1886
|
-
parentDetail.metaObjectCode =
|
|
1887
|
-
parentDetail.subExpression[0].metaObjectCode;
|
|
1888
|
-
parentDetail.elementId = parentDetail.subExpression[0].elementId;
|
|
1889
|
-
parentDetail.elementName = parentDetail.subExpression[0].elementName;
|
|
1890
|
-
parentDetail.dataTypeCode =
|
|
1891
|
-
parentDetail.subExpression[0].dataTypeCode;
|
|
1892
|
-
delete parentDetail.subExpression;
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
this.setState(
|
|
1897
|
-
{
|
|
1898
|
-
ruleClassData,
|
|
1899
|
-
},
|
|
1900
|
-
() => {
|
|
1901
|
-
callBack(ruleClassData);
|
|
1902
|
-
},
|
|
1903
|
-
);
|
|
1904
|
-
};
|
|
1905
|
-
|
|
1906
|
-
handleLogicalTypeChange = (itemDetail, type) => {
|
|
1907
|
-
const { ruleClassData } = this.state;
|
|
1908
|
-
const { callBack } = this.props;
|
|
1909
|
-
itemDetail.operationCode = type;
|
|
1910
|
-
this.setState(
|
|
1911
|
-
{
|
|
1912
|
-
ruleClassData,
|
|
1913
|
-
},
|
|
1914
|
-
() => {
|
|
1915
|
-
callBack(ruleClassData);
|
|
1916
|
-
},
|
|
1917
|
-
);
|
|
1918
|
-
};
|
|
1919
|
-
|
|
1920
|
-
// 新增执行顺序
|
|
1921
|
-
handleSelectRuleAction = (keys, classDataIndex, callback) => {
|
|
1922
|
-
callback();
|
|
1923
|
-
const { callBack } = this.props;
|
|
1924
|
-
const { ruleClassData } = this.state;
|
|
1925
|
-
ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
|
|
1926
|
-
classDataIndex
|
|
1927
|
-
].extraInfo.execute.map((i) => {
|
|
1928
|
-
if (i.code && keys.some((r) => r === i.code) && !i.isSelected) {
|
|
1929
|
-
return { ...i, isSelected: true };
|
|
1930
|
-
}
|
|
1931
|
-
return i;
|
|
1932
|
-
});
|
|
1933
|
-
// 处理数据
|
|
1934
|
-
this.setState(
|
|
1935
|
-
{
|
|
1936
|
-
ruleClassData,
|
|
1937
|
-
},
|
|
1938
|
-
() => {
|
|
1939
|
-
callBack(ruleClassData);
|
|
1940
|
-
},
|
|
1941
|
-
);
|
|
1942
|
-
};
|
|
1943
|
-
|
|
1944
|
-
handleDeleteRuleAction = (classDataIndex, functionCode) => {
|
|
1945
|
-
const { callBack } = this.props;
|
|
1946
|
-
const { ruleClassData } = this.state;
|
|
1947
|
-
ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
|
|
1948
|
-
classDataIndex
|
|
1949
|
-
].extraInfo.execute.map((i) => {
|
|
1950
|
-
if (i.code && functionCode === i.code && i.isSelected) {
|
|
1951
|
-
return { ...i, isSelected: false };
|
|
1952
|
-
}
|
|
1953
|
-
return i;
|
|
1954
|
-
});
|
|
1955
|
-
// 处理数据
|
|
1956
|
-
this.setState(
|
|
1957
|
-
{
|
|
1958
|
-
ruleClassData,
|
|
1959
|
-
},
|
|
1960
|
-
() => {
|
|
1961
|
-
callBack(ruleClassData);
|
|
1962
|
-
},
|
|
1963
|
-
);
|
|
1964
|
-
};
|
|
1965
|
-
|
|
1966
|
-
render() {
|
|
1967
|
-
const { onlyOneRule, callBack } = this.props;
|
|
1968
|
-
const { ruleClassData, modalParams } = this.state;
|
|
1969
|
-
return (
|
|
1970
|
-
<div className={'base_rule'}>
|
|
1971
|
-
<div className={'base_rule_content'}>
|
|
1972
|
-
<div
|
|
1973
|
-
style={{
|
|
1974
|
-
display: onlyOneRule ? 'none' : 'block',
|
|
1975
|
-
}}
|
|
1976
|
-
className={'base_rule_line_title'}
|
|
1977
|
-
>
|
|
1978
|
-
<Button
|
|
1979
|
-
onClick={this.handleAddRule}
|
|
1980
|
-
className={'base_rule_btn_style'}
|
|
1981
|
-
type="link"
|
|
1982
|
-
>
|
|
1983
|
-
新增规则
|
|
1984
|
-
</Button>
|
|
1985
|
-
</div>
|
|
1986
|
-
<div>{this.renderRuleContent()}</div>
|
|
1987
|
-
</div>
|
|
1988
|
-
{(modalParams.visible && (
|
|
1989
|
-
<Modal
|
|
1990
|
-
title={`新增动作`}
|
|
1991
|
-
visible={modalParams.visible}
|
|
1992
|
-
onCancel={() => {
|
|
1993
|
-
this.setState({
|
|
1994
|
-
modalParams: { ...modalParams, visible: false },
|
|
1995
|
-
});
|
|
1996
|
-
}}
|
|
1997
|
-
maskClosable={false}
|
|
1998
|
-
destroyOnClose
|
|
1999
|
-
footer={null}
|
|
2000
|
-
>
|
|
2001
|
-
<Table
|
|
2002
|
-
rowSelection={{
|
|
2003
|
-
onChange: (keys, selectRows) => {
|
|
2004
|
-
this.handleSelectRuleAction(
|
|
2005
|
-
keys,
|
|
2006
|
-
modalParams.classDataIndex,
|
|
2007
|
-
() => {
|
|
2008
|
-
this.setState({
|
|
2009
|
-
modalParams: { ...modalParams, visible: false },
|
|
2010
|
-
});
|
|
2011
|
-
},
|
|
2012
|
-
);
|
|
2013
|
-
},
|
|
2014
|
-
}}
|
|
2015
|
-
columns={[
|
|
2016
|
-
{
|
|
2017
|
-
title: '执行动作名称',
|
|
2018
|
-
key: 'functionName',
|
|
2019
|
-
dataIndex: 'functionName',
|
|
2020
|
-
},
|
|
2021
|
-
]}
|
|
2022
|
-
dataSource={modalParams?.ruleActionData}
|
|
2023
|
-
rowKey={'code'}
|
|
2024
|
-
/>
|
|
2025
|
-
</Modal>
|
|
2026
|
-
)) ||
|
|
2027
|
-
null}
|
|
2028
|
-
</div>
|
|
2029
|
-
);
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
export default RuleObjectComponent;
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import RuleField from './ruleFiled';
|
|
5
|
+
import {
|
|
6
|
+
Select,
|
|
7
|
+
Button,
|
|
8
|
+
Radio,
|
|
9
|
+
Switch,
|
|
10
|
+
Checkbox,
|
|
11
|
+
InputNumber,
|
|
12
|
+
TreeSelect,
|
|
13
|
+
Popover,
|
|
14
|
+
Input,
|
|
15
|
+
DatePicker,
|
|
16
|
+
Table,
|
|
17
|
+
Divider,
|
|
18
|
+
Space,
|
|
19
|
+
Form as AntdForm,
|
|
20
|
+
Modal,
|
|
21
|
+
message,
|
|
22
|
+
} from 'antd';
|
|
23
|
+
import {
|
|
24
|
+
PlusCircleOutlined,
|
|
25
|
+
MinusCircleOutlined,
|
|
26
|
+
DownOutlined,
|
|
27
|
+
} from '@ant-design/icons';
|
|
28
|
+
import './index.less';
|
|
29
|
+
import {
|
|
30
|
+
relateItems,
|
|
31
|
+
getSpecialPropertyCode,
|
|
32
|
+
getPropertyCode,
|
|
33
|
+
isObj,
|
|
34
|
+
} from './util';
|
|
35
|
+
import { getDictionarySource, uuid } from '../../../utils/utils';
|
|
36
|
+
import {
|
|
37
|
+
BusinessSearchSelect,
|
|
38
|
+
BusinessTreeSearchSelect,
|
|
39
|
+
EllipsisTooltip,
|
|
40
|
+
BsCascader,
|
|
41
|
+
} from '../../../index';
|
|
42
|
+
import { request } from 'bssula';
|
|
43
|
+
import Formula from './Formula';
|
|
44
|
+
import RenderSpecificAction from './renderSpecificAction';
|
|
45
|
+
|
|
46
|
+
const { RangePicker } = DatePicker;
|
|
47
|
+
|
|
48
|
+
class RuleObjectComponent extends Component {
|
|
49
|
+
constructor(props) {
|
|
50
|
+
super(props);
|
|
51
|
+
this.state = {
|
|
52
|
+
editNameIndex: 0,
|
|
53
|
+
isEdit: false,
|
|
54
|
+
ruleTreeData: [],
|
|
55
|
+
initialRegularList: [],
|
|
56
|
+
operationList: [],
|
|
57
|
+
ruleClassData: [],
|
|
58
|
+
modalParams: {
|
|
59
|
+
visible: false,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
this.propertyCodeToRangeIdMap = {};
|
|
63
|
+
this.dictCodeToRangeIdMap = {};
|
|
64
|
+
this.dynamicDictCodeToRangeIdMap = {};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
componentDidMount(props) {
|
|
68
|
+
const { ruleClassData, operationList, regularDataList } = this.props;
|
|
69
|
+
this.setRegularData(regularDataList);
|
|
70
|
+
this.setState({
|
|
71
|
+
ruleClassData,
|
|
72
|
+
operationList,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
componentWillReceiveProps(nextProps) {
|
|
77
|
+
const { ruleClassData, operationList, regularDataList } = this.state;
|
|
78
|
+
if (
|
|
79
|
+
nextProps.ruleClassData &&
|
|
80
|
+
this.props.ruleClassData != nextProps.ruleClassData &&
|
|
81
|
+
JSON.stringify(nextProps.ruleClassData) != JSON.stringify(ruleClassData)
|
|
82
|
+
) {
|
|
83
|
+
this.setState({
|
|
84
|
+
ruleClassData: nextProps.ruleClassData,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (
|
|
89
|
+
nextProps.operationList &&
|
|
90
|
+
this.props.operationList != nextProps.operationList
|
|
91
|
+
) {
|
|
92
|
+
this.setState({
|
|
93
|
+
operationList: nextProps.operationList,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
nextProps.regularDataList &&
|
|
99
|
+
this.props.regularDataList != nextProps.regularDataList
|
|
100
|
+
) {
|
|
101
|
+
this.setRegularData(nextProps.regularDataList);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
setRegularData = (regularDataList) => {
|
|
106
|
+
this.propertyCodeToRangeIdMap = {};
|
|
107
|
+
this.dictCodeToRangeIdMap = {};
|
|
108
|
+
this.dynamicDictCodeToRangeIdMap = {};
|
|
109
|
+
const finalTreeDatas = regularDataList.map((item) => {
|
|
110
|
+
return {
|
|
111
|
+
title: item.name,
|
|
112
|
+
key: item.id,
|
|
113
|
+
value: item.code,
|
|
114
|
+
...(item?.propertyList?.length
|
|
115
|
+
? {
|
|
116
|
+
children: item.propertyList.map((element) => {
|
|
117
|
+
const infoVo = (element.info && JSON.parse(element.info)) || {};
|
|
118
|
+
if (element.choiceType === 30) {
|
|
119
|
+
this.dynamicDictCodeToRangeIdMap[
|
|
120
|
+
`${item.code}.${element.code}`
|
|
121
|
+
] = infoVo?.dictionaryCode;
|
|
122
|
+
} else if (element.choiceType === 20) {
|
|
123
|
+
this.dictCodeToRangeIdMap[`${item.code}.${element.code}`] =
|
|
124
|
+
infoVo?.dictionaryCode;
|
|
125
|
+
} else if (element.choiceType === 10) {
|
|
126
|
+
const list =
|
|
127
|
+
(Object.keys(infoVo).length &&
|
|
128
|
+
infoVo.enumeration &&
|
|
129
|
+
Object.keys(infoVo.enumeration).map((i) => ({
|
|
130
|
+
code: i,
|
|
131
|
+
name: infoVo.enumeration[i],
|
|
132
|
+
}))) ||
|
|
133
|
+
undefined;
|
|
134
|
+
this.propertyCodeToRangeIdMap[
|
|
135
|
+
`${item.code}.${element.code}`
|
|
136
|
+
] = list;
|
|
137
|
+
} else {
|
|
138
|
+
this.propertyCodeToRangeIdMap[
|
|
139
|
+
`${item.code}.${element.code}`
|
|
140
|
+
] = Object.keys(infoVo).length ? infoVo : undefined;
|
|
141
|
+
}
|
|
142
|
+
let child = {
|
|
143
|
+
title: `${item.name}-${element.name}`,
|
|
144
|
+
key: element.id,
|
|
145
|
+
value: `${element.code}`,
|
|
146
|
+
id: element.id,
|
|
147
|
+
dataTypeCode: element.valueType,
|
|
148
|
+
dataChoiceBusinessType: element.choiceType,
|
|
149
|
+
dataInputBusinessType: element.inputType,
|
|
150
|
+
info: element.info,
|
|
151
|
+
};
|
|
152
|
+
if (element?.propertyList?.length) {
|
|
153
|
+
child.children = this.parseChildTreeData(
|
|
154
|
+
element.propertyList,
|
|
155
|
+
`${element.code}`,
|
|
156
|
+
`${item.name}-${element.name}`,
|
|
157
|
+
item.code,
|
|
158
|
+
);
|
|
159
|
+
child.isLeaf = false;
|
|
160
|
+
} else {
|
|
161
|
+
child.isLeaf = true;
|
|
162
|
+
child.metaObjectCode = item.code;
|
|
163
|
+
}
|
|
164
|
+
return child;
|
|
165
|
+
}),
|
|
166
|
+
}
|
|
167
|
+
: {}),
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
this.setState({
|
|
171
|
+
initialRegularList: [...regularDataList],
|
|
172
|
+
ruleTreeData: finalTreeDatas,
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
parseChildTreeData = (list, parentKey, parentTitle, rootObjCode) => {
|
|
177
|
+
return list.map((element) => {
|
|
178
|
+
const infoVo = (element.info && JSON.parse(element.info)) || {};
|
|
179
|
+
if (element.choiceType === 30) {
|
|
180
|
+
this.dynamicDictCodeToRangeIdMap[
|
|
181
|
+
`${rootObjCode}.${parentKey}.${element.code}`
|
|
182
|
+
] = infoVo?.dictionaryCode;
|
|
183
|
+
} else if (element.choiceType === 20) {
|
|
184
|
+
this.dictCodeToRangeIdMap[
|
|
185
|
+
`${rootObjCode}.${parentKey}.${element.code}`
|
|
186
|
+
] = infoVo?.dictionaryCode;
|
|
187
|
+
} else if (element.choiceType === 10) {
|
|
188
|
+
const list =
|
|
189
|
+
(Object.keys(infoVo).length &&
|
|
190
|
+
infoVo.enumeration &&
|
|
191
|
+
Object.keys(infoVo.enumeration).map((i) => ({
|
|
192
|
+
code: i,
|
|
193
|
+
name: infoVo.enumeration[i],
|
|
194
|
+
}))) ||
|
|
195
|
+
undefined;
|
|
196
|
+
this.propertyCodeToRangeIdMap[
|
|
197
|
+
`${rootObjCode}.${parentKey}.${element.code}`
|
|
198
|
+
] = list;
|
|
199
|
+
} else {
|
|
200
|
+
this.propertyCodeToRangeIdMap[
|
|
201
|
+
`${rootObjCode}.${parentKey}.${element.code}`
|
|
202
|
+
] = Object.keys(infoVo).length ? infoVo : undefined;
|
|
203
|
+
}
|
|
204
|
+
let child = {
|
|
205
|
+
title: `${parentTitle}-${element.name}`,
|
|
206
|
+
key: `${parentKey}.${element.id}`,
|
|
207
|
+
value: `${parentKey}.${element.code}`,
|
|
208
|
+
id: element.id,
|
|
209
|
+
dataTypeCode: element.valueType,
|
|
210
|
+
dataChoiceBusinessType: element.choiceType,
|
|
211
|
+
dataInputBusinessType: element.inputType,
|
|
212
|
+
info: element.info,
|
|
213
|
+
};
|
|
214
|
+
if (element.propertyList) {
|
|
215
|
+
child.children = this.parseChildTreeData(
|
|
216
|
+
element.propertyList,
|
|
217
|
+
`${parentKey}.${element.code}`,
|
|
218
|
+
`${parentTitle}-${element.name}`,
|
|
219
|
+
rootObjCode,
|
|
220
|
+
);
|
|
221
|
+
child.isLeaf = false;
|
|
222
|
+
} else {
|
|
223
|
+
child.isLeaf = true;
|
|
224
|
+
child.metaObjectCode = rootObjCode;
|
|
225
|
+
}
|
|
226
|
+
return child;
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
getDataTypeOperateList = (id) => {
|
|
231
|
+
const { operationList, initialRegularList } = this.state;
|
|
232
|
+
// let typeId = '';
|
|
233
|
+
// initialRegularList.forEach(item => {
|
|
234
|
+
// item.metaObjectResDto.elementResDtos.forEach(element => {
|
|
235
|
+
// if (element.id == id) {
|
|
236
|
+
// typeId = element.dataTypeCode;
|
|
237
|
+
// }
|
|
238
|
+
// })
|
|
239
|
+
// })
|
|
240
|
+
const list =
|
|
241
|
+
operationList.find((item) => item.code == id)?.operationList || [];
|
|
242
|
+
return list;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
handleValuesChange = (itemDetail, newValues, newValueNames) => {
|
|
246
|
+
const { ruleClassData } = this.state;
|
|
247
|
+
const { callBack } = this.props;
|
|
248
|
+
itemDetail.params = [...newValues];
|
|
249
|
+
itemDetail.paramNames = [...newValueNames];
|
|
250
|
+
this.setState(
|
|
251
|
+
{
|
|
252
|
+
ruleClassData,
|
|
253
|
+
},
|
|
254
|
+
() => {
|
|
255
|
+
callBack(ruleClassData);
|
|
256
|
+
},
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
setRelateDataList = (classDataItem) => {
|
|
261
|
+
let relateDatas = {};
|
|
262
|
+
relateItems.forEach((relateItem) => {
|
|
263
|
+
this.getRelateData(
|
|
264
|
+
relateItem,
|
|
265
|
+
classDataItem.subExpression || {},
|
|
266
|
+
relateDatas,
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
return relateDatas;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
getRelateData = (relateItem, classDataItem, relateDatas) => {
|
|
273
|
+
if (
|
|
274
|
+
classDataItem?.propertyPath &&
|
|
275
|
+
getPropertyCode(classDataItem.propertyPath) == relateItem.propertyCode
|
|
276
|
+
) {
|
|
277
|
+
relateDatas[relateItem.propertyCode] = classDataItem.params;
|
|
278
|
+
} else {
|
|
279
|
+
if (classDataItem.subExpression && classDataItem.subExpression.length) {
|
|
280
|
+
classDataItem.subExpression.forEach((classData) => {
|
|
281
|
+
this.getRelateData(relateItem, classData, relateDatas);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
renderRuleContent = () => {
|
|
288
|
+
const { ruleClassData, currentRuleName, isEdit, editNameIndex } =
|
|
289
|
+
this.state;
|
|
290
|
+
const {
|
|
291
|
+
ruleType,
|
|
292
|
+
callBack,
|
|
293
|
+
accountList = [],
|
|
294
|
+
disabled,
|
|
295
|
+
ruleTypeData,
|
|
296
|
+
canDelete = false,
|
|
297
|
+
ruleReturnConfig = {},
|
|
298
|
+
onlyOneRule,
|
|
299
|
+
onlyCondition,
|
|
300
|
+
onlyAction,
|
|
301
|
+
handleOperatingAction,
|
|
302
|
+
ruleGroupInfo,
|
|
303
|
+
} = this.props;
|
|
304
|
+
const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1;
|
|
305
|
+
const ruleGroupName = ruleGroupInfo?.ruleGroupList?.[0]?.name || '规则分组';
|
|
306
|
+
const priorityList = (ruleGroupInfo?.groupOtherPriorityList || []).concat(ruleClassData|| []);
|
|
307
|
+
const canChangePriority = ruleGroupInfo?.canChangePriority;
|
|
308
|
+
const titlePre = {
|
|
309
|
+
position: 'relative',
|
|
310
|
+
top: '-10px',
|
|
311
|
+
left: '20px',
|
|
312
|
+
background: '#fff',
|
|
313
|
+
width: '160px',
|
|
314
|
+
textAlign: 'center',
|
|
315
|
+
};
|
|
316
|
+
const titleSubPre = {
|
|
317
|
+
...titlePre,
|
|
318
|
+
top: '-33px',
|
|
319
|
+
left: '280px',
|
|
320
|
+
width: '160px',
|
|
321
|
+
}
|
|
322
|
+
const ruleListBox = (!onlyOneRule || ruleGroupInfo) ? { border: '1px dashed #d9d9d9', marginBottom: 10 } : {};
|
|
323
|
+
const isRuleActionConfig =
|
|
324
|
+
ruleTypeData?.length || Object.keys(ruleReturnConfig)?.length;
|
|
325
|
+
return (
|
|
326
|
+
<div>
|
|
327
|
+
{ruleClassData.map((item, classDataIndex) => {
|
|
328
|
+
let extraInfo = {};
|
|
329
|
+
if (isRuleActionConfig) {
|
|
330
|
+
extraInfo = {
|
|
331
|
+
...item.extraInfo,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
let relateDatas = this.setRelateDataList(item);
|
|
335
|
+
const sActionProps = {
|
|
336
|
+
extraInfo,
|
|
337
|
+
ruleTypeData,
|
|
338
|
+
item,
|
|
339
|
+
classDataIndex,
|
|
340
|
+
handleOperatingAction,
|
|
341
|
+
disabled,
|
|
342
|
+
};
|
|
343
|
+
return (
|
|
344
|
+
<div style={ruleListBox}>
|
|
345
|
+
{!onlyOneRule && !ruleGroupInfo && (
|
|
346
|
+
<div style={titlePre}>规则{classDataIndex + 1}</div>
|
|
347
|
+
)}
|
|
348
|
+
{ruleGroupInfo && (
|
|
349
|
+
<>
|
|
350
|
+
<div style={titlePre}>
|
|
351
|
+
<EllipsisTooltip
|
|
352
|
+
visible={true}
|
|
353
|
+
maxLength={10}
|
|
354
|
+
title={ruleGroupName}
|
|
355
|
+
/>
|
|
356
|
+
</div>
|
|
357
|
+
{isRuleInstance && (
|
|
358
|
+
<div style={titleSubPre}>
|
|
359
|
+
<span style={{ marginRight: 10 }}>优先级</span>
|
|
360
|
+
<Select
|
|
361
|
+
disabled={canChangePriority ? !canChangePriority : disabled}
|
|
362
|
+
style={{ width: 100 }}
|
|
363
|
+
value={item.priority}
|
|
364
|
+
onChange={(v) => {
|
|
365
|
+
// 因为存在页签,前端校验不准确;而且若选择优先级之后想交换改也不方便,故交由后端校验
|
|
366
|
+
// const isRepeate = priorityList.some((r) => r.priority == v)
|
|
367
|
+
// if(isRepeate) {
|
|
368
|
+
// message.warn('优先级不允许重复')
|
|
369
|
+
// }
|
|
370
|
+
// item.priority = isRepeate ? (item.priority||null) : v;
|
|
371
|
+
item.priority = v
|
|
372
|
+
this.setState(
|
|
373
|
+
{
|
|
374
|
+
ruleClassData,
|
|
375
|
+
},
|
|
376
|
+
() => {
|
|
377
|
+
callBack(ruleClassData);
|
|
378
|
+
},
|
|
379
|
+
);
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
{priorityList?.map((s,sindex) => (
|
|
383
|
+
<Option key={sindex+1} value={sindex+1}>{sindex+1}</Option>
|
|
384
|
+
))}
|
|
385
|
+
</Select>
|
|
386
|
+
</div>
|
|
387
|
+
) || null}
|
|
388
|
+
</>
|
|
389
|
+
)}
|
|
390
|
+
<div
|
|
391
|
+
style={{
|
|
392
|
+
textAlign: 'right',
|
|
393
|
+
marginTop: '-24px',
|
|
394
|
+
display: canDelete ? 'block' : 'none',
|
|
395
|
+
}}
|
|
396
|
+
>
|
|
397
|
+
<Button
|
|
398
|
+
disabled={disabled}
|
|
399
|
+
onClick={() => {
|
|
400
|
+
const { ruleClassData } = this.state;
|
|
401
|
+
ruleClassData.splice(classDataIndex, 1);
|
|
402
|
+
this.setState(
|
|
403
|
+
{
|
|
404
|
+
ruleClassData,
|
|
405
|
+
},
|
|
406
|
+
() => {
|
|
407
|
+
callBack(ruleClassData);
|
|
408
|
+
},
|
|
409
|
+
);
|
|
410
|
+
}}
|
|
411
|
+
type="link"
|
|
412
|
+
danger
|
|
413
|
+
>
|
|
414
|
+
删除规则
|
|
415
|
+
</Button>
|
|
416
|
+
</div>
|
|
417
|
+
<div>
|
|
418
|
+
{/* <div style={{ display: isEdit && editNameIndex == index ? 'none' : 'block' }}>
|
|
419
|
+
<span className={'rule_name_title}>
|
|
420
|
+
{item.ruleName}
|
|
421
|
+
</span>
|
|
422
|
+
<EditOutlined
|
|
423
|
+
onClick={() => {
|
|
424
|
+
this.setState({
|
|
425
|
+
editNameIndex: index,
|
|
426
|
+
currentRuleName: item.ruleName,
|
|
427
|
+
isEdit: true
|
|
428
|
+
})
|
|
429
|
+
}}
|
|
430
|
+
/>
|
|
431
|
+
</div> */}
|
|
432
|
+
<div
|
|
433
|
+
style={{
|
|
434
|
+
display:
|
|
435
|
+
isEdit && editNameIndex == index ? 'block' : 'none',
|
|
436
|
+
marginTop: '10px',
|
|
437
|
+
}}
|
|
438
|
+
>
|
|
439
|
+
<Input
|
|
440
|
+
value={currentRuleName}
|
|
441
|
+
style={{ width: '200px' }}
|
|
442
|
+
onChange={(e) => {
|
|
443
|
+
this.setState({
|
|
444
|
+
currentRuleName: e.target.value,
|
|
445
|
+
});
|
|
446
|
+
}}
|
|
447
|
+
/>
|
|
448
|
+
<Button
|
|
449
|
+
type="link"
|
|
450
|
+
onClick={() => {
|
|
451
|
+
const { ruleClassData, currentRuleName } = this.state;
|
|
452
|
+
ruleClassData[editNameIndex].ruleName = currentRuleName;
|
|
453
|
+
this.setState({
|
|
454
|
+
ruleClassData,
|
|
455
|
+
isEdit: false,
|
|
456
|
+
});
|
|
457
|
+
}}
|
|
458
|
+
>
|
|
459
|
+
保存
|
|
460
|
+
</Button>
|
|
461
|
+
<Button
|
|
462
|
+
type="link"
|
|
463
|
+
onClick={() => {
|
|
464
|
+
this.setState({
|
|
465
|
+
isEdit: false,
|
|
466
|
+
});
|
|
467
|
+
}}
|
|
468
|
+
>
|
|
469
|
+
取消
|
|
470
|
+
</Button>
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
<div>
|
|
474
|
+
{(onlyAction && <RenderSpecificAction {...sActionProps} />) || (
|
|
475
|
+
<div className={'base_rule_line_content'}>
|
|
476
|
+
<div className={'base_rule_item2'}>
|
|
477
|
+
{item.subExpression &&
|
|
478
|
+
this.renderRuleItem(
|
|
479
|
+
item.subExpression,
|
|
480
|
+
item,
|
|
481
|
+
1,
|
|
482
|
+
classDataIndex,
|
|
483
|
+
relateDatas,
|
|
484
|
+
)}
|
|
485
|
+
</div>
|
|
486
|
+
<div className={'base_rule_item3'}>
|
|
487
|
+
{(extraInfo &&
|
|
488
|
+
isRuleActionConfig &&
|
|
489
|
+
(!onlyCondition || !onlyAction) &&
|
|
490
|
+
this.renderRuleTypeItem(
|
|
491
|
+
extraInfo,
|
|
492
|
+
item,
|
|
493
|
+
1,
|
|
494
|
+
classDataIndex,
|
|
495
|
+
ruleTypeData,
|
|
496
|
+
ruleReturnConfig,
|
|
497
|
+
isRuleInstance
|
|
498
|
+
)) ||
|
|
499
|
+
null}
|
|
500
|
+
</div>
|
|
501
|
+
</div>
|
|
502
|
+
)}
|
|
503
|
+
</div>
|
|
504
|
+
</div>
|
|
505
|
+
);
|
|
506
|
+
})}
|
|
507
|
+
</div>
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
handleAddRule = () => {
|
|
512
|
+
const { ruleClassData } = this.state;
|
|
513
|
+
const { callBack, ruleTypeData, ruleGroupInfo } = this.props;
|
|
514
|
+
const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1;
|
|
515
|
+
const initKongData = {
|
|
516
|
+
ruleName: `规则${ruleClassData?.length + 1}`,
|
|
517
|
+
subExpression: {
|
|
518
|
+
// "expressionType": "relation",
|
|
519
|
+
operationType: 'relation',
|
|
520
|
+
propertyPath: '',
|
|
521
|
+
params: [],
|
|
522
|
+
paramNames: [],
|
|
523
|
+
},
|
|
524
|
+
extraInfo: {
|
|
525
|
+
response: {
|
|
526
|
+
enable: false,
|
|
527
|
+
value: '',
|
|
528
|
+
},
|
|
529
|
+
execute: ruleTypeData.map((s) => {
|
|
530
|
+
return {
|
|
531
|
+
priority: 1,
|
|
532
|
+
code: s.code,
|
|
533
|
+
properties: {
|
|
534
|
+
configPropertyCode: 'configPropertyValue',
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
}),
|
|
538
|
+
},
|
|
539
|
+
}
|
|
540
|
+
const initTemplateData = ruleGroupInfo?.templateData && Object.keys(ruleGroupInfo?.templateData)?.length ? {
|
|
541
|
+
ruleName: `规则${ruleClassData?.length + 1}`,
|
|
542
|
+
..._.cloneDeep(ruleGroupInfo?.templateData)
|
|
543
|
+
} : initKongData;
|
|
544
|
+
const initNewData = isRuleInstance ? initTemplateData : initKongData
|
|
545
|
+
ruleClassData.push(initNewData);
|
|
546
|
+
this.setState(
|
|
547
|
+
{
|
|
548
|
+
ruleClassData,
|
|
549
|
+
},
|
|
550
|
+
() => {
|
|
551
|
+
callBack(ruleClassData);
|
|
552
|
+
},
|
|
553
|
+
);
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// 树结构 转化成 平行树 (递归函数)
|
|
557
|
+
coverToParallel = (treeData, result) => {
|
|
558
|
+
treeData.forEach((el) => {
|
|
559
|
+
result.push(el);
|
|
560
|
+
if (el.children && el.children.length > 0) {
|
|
561
|
+
// 子级递归
|
|
562
|
+
this.coverToParallel(el.children, result);
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
return result;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
renderRuleItem = (
|
|
569
|
+
itemDetail,
|
|
570
|
+
parentDetail,
|
|
571
|
+
floorIndex,
|
|
572
|
+
classDataIndex,
|
|
573
|
+
relateDatas,
|
|
574
|
+
) => {
|
|
575
|
+
const { ruleTreeData } = this.state;
|
|
576
|
+
const {
|
|
577
|
+
callBack,
|
|
578
|
+
initialThresholdQuery = {},
|
|
579
|
+
disabled,
|
|
580
|
+
systemVariableList,
|
|
581
|
+
} = this.props;
|
|
582
|
+
let thresholdQuery = {
|
|
583
|
+
...initialThresholdQuery,
|
|
584
|
+
...relateDatas,
|
|
585
|
+
};
|
|
586
|
+
let finalIndex = floorIndex + 1;
|
|
587
|
+
let queryIdentify = '';
|
|
588
|
+
let queryIdentifyType = '';
|
|
589
|
+
if (
|
|
590
|
+
this.propertyCodeToRangeIdMap[
|
|
591
|
+
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
592
|
+
]
|
|
593
|
+
) {
|
|
594
|
+
queryIdentify =
|
|
595
|
+
this.propertyCodeToRangeIdMap[
|
|
596
|
+
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
597
|
+
];
|
|
598
|
+
queryIdentifyType = Array.isArray(queryIdentify)
|
|
599
|
+
? 'objectPropertyListIdentify'
|
|
600
|
+
: 'objectPropertyCodeIdentify';
|
|
601
|
+
} else if (
|
|
602
|
+
getSpecialPropertyCode(getPropertyCode(itemDetail.propertyPath))
|
|
603
|
+
) {
|
|
604
|
+
queryIdentify = getSpecialPropertyCode(
|
|
605
|
+
getPropertyCode(itemDetail.propertyPath),
|
|
606
|
+
);
|
|
607
|
+
queryIdentifyType = 'specialPropertyIdentify';
|
|
608
|
+
} else if (
|
|
609
|
+
this.dictCodeToRangeIdMap[
|
|
610
|
+
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
611
|
+
]
|
|
612
|
+
) {
|
|
613
|
+
queryIdentify =
|
|
614
|
+
this.dictCodeToRangeIdMap[
|
|
615
|
+
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
616
|
+
];
|
|
617
|
+
queryIdentifyType = 'dictCodeIdentify';
|
|
618
|
+
} else if (
|
|
619
|
+
this.dynamicDictCodeToRangeIdMap[
|
|
620
|
+
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
621
|
+
]
|
|
622
|
+
) {
|
|
623
|
+
queryIdentify =
|
|
624
|
+
this.dynamicDictCodeToRangeIdMap[
|
|
625
|
+
`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
|
|
626
|
+
];
|
|
627
|
+
queryIdentifyType = 'dynamicDictCodeIdentify';
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const parallelTreeData = this.coverToParallel(ruleTreeData, []) || [];
|
|
631
|
+
const currentTreeItem =
|
|
632
|
+
itemDetail?.elementId &&
|
|
633
|
+
parallelTreeData.find((i) => (i?.key?.indexOf('.') > -1 ? i.id : i.key) === itemDetail?.elementId);
|
|
634
|
+
const dataChoiceBusinessType = currentTreeItem?.dataChoiceBusinessType;
|
|
635
|
+
const dataInputBusinessType = currentTreeItem?.dataInputBusinessType;
|
|
636
|
+
return (
|
|
637
|
+
<div
|
|
638
|
+
className={'rule_line_content'}
|
|
639
|
+
style={{ display: 'flex', marginBottom: '0px', padding: '10px 0px' }}
|
|
640
|
+
>
|
|
641
|
+
<div
|
|
642
|
+
className={'logical_operate_content'}
|
|
643
|
+
style={{
|
|
644
|
+
display: itemDetail.operationType == 'logic' ? 'block' : 'none',
|
|
645
|
+
width: '60px',
|
|
646
|
+
zIndex: 20,
|
|
647
|
+
}}
|
|
648
|
+
>
|
|
649
|
+
<Popover
|
|
650
|
+
content={
|
|
651
|
+
<div>
|
|
652
|
+
<p
|
|
653
|
+
className={'choose_logical_type'}
|
|
654
|
+
onClick={() => {
|
|
655
|
+
this.handleLogicalTypeChange(itemDetail, 'or');
|
|
656
|
+
}}
|
|
657
|
+
>
|
|
658
|
+
OR
|
|
659
|
+
</p>
|
|
660
|
+
<p
|
|
661
|
+
className={'choose_logical_type'}
|
|
662
|
+
onClick={() => {
|
|
663
|
+
this.handleLogicalTypeChange(itemDetail, 'and');
|
|
664
|
+
}}
|
|
665
|
+
>
|
|
666
|
+
AND
|
|
667
|
+
</p>
|
|
668
|
+
</div>
|
|
669
|
+
}
|
|
670
|
+
trigger="focus"
|
|
671
|
+
>
|
|
672
|
+
<Button
|
|
673
|
+
disabled={disabled}
|
|
674
|
+
type="link"
|
|
675
|
+
className={'logical_item_btn'}
|
|
676
|
+
>
|
|
677
|
+
{itemDetail?.operationCode == 'or' ? 'OR' : 'AND'}
|
|
678
|
+
<DownOutlined style={{ marginLeft: '6px' }} />
|
|
679
|
+
</Button>
|
|
680
|
+
</Popover>
|
|
681
|
+
<span className={'top_line'}></span>
|
|
682
|
+
<span className={'bottom_line'}></span>
|
|
683
|
+
</div>
|
|
684
|
+
|
|
685
|
+
<div style={{ flexGrow: 1 }}>
|
|
686
|
+
{itemDetail.operationType == 'logic' ? (
|
|
687
|
+
itemDetail?.subExpression?.map((item1) => {
|
|
688
|
+
return this.renderRuleItem(
|
|
689
|
+
item1,
|
|
690
|
+
itemDetail,
|
|
691
|
+
finalIndex,
|
|
692
|
+
classDataIndex,
|
|
693
|
+
relateDatas,
|
|
694
|
+
);
|
|
695
|
+
})
|
|
696
|
+
) : (
|
|
697
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
698
|
+
<TreeSelect
|
|
699
|
+
value={itemDetail.propertyPath}
|
|
700
|
+
disabled={disabled}
|
|
701
|
+
onChange={(value, name, nodeInfo) => {
|
|
702
|
+
if (!nodeInfo.triggerNode.props.isLeaf) return; //只有最末端叶子节点可选中
|
|
703
|
+
const { ruleClassData } = this.state;
|
|
704
|
+
itemDetail.propertyPath = value;
|
|
705
|
+
itemDetail.params = [];
|
|
706
|
+
itemDetail.paramNames = [];
|
|
707
|
+
itemDetail.operationCode = '';
|
|
708
|
+
itemDetail.elementId = nodeInfo.triggerNode.props.id;
|
|
709
|
+
itemDetail.elementName = nodeInfo.triggerNode.props.title;
|
|
710
|
+
itemDetail.dataTypeCode =
|
|
711
|
+
nodeInfo.triggerNode.props.dataTypeCode;
|
|
712
|
+
itemDetail.metaObjectCode =
|
|
713
|
+
nodeInfo.triggerNode.props.metaObjectCode;
|
|
714
|
+
itemDetail.isInsertParam = false;
|
|
715
|
+
this.setState(
|
|
716
|
+
{
|
|
717
|
+
ruleClassData,
|
|
718
|
+
},
|
|
719
|
+
() => {
|
|
720
|
+
callBack(ruleClassData);
|
|
721
|
+
},
|
|
722
|
+
);
|
|
723
|
+
}}
|
|
724
|
+
style={{ width: '200px' }}
|
|
725
|
+
treeData={ruleTreeData}
|
|
726
|
+
/>
|
|
727
|
+
<Select
|
|
728
|
+
value={itemDetail?.operationCode || ''}
|
|
729
|
+
disabled={disabled}
|
|
730
|
+
style={{ width: '150px', marginLeft: '10px' }}
|
|
731
|
+
onChange={(value) => {
|
|
732
|
+
const { ruleClassData } = this.state;
|
|
733
|
+
itemDetail.operationCode = value;
|
|
734
|
+
this.setState(
|
|
735
|
+
{
|
|
736
|
+
ruleClassData,
|
|
737
|
+
},
|
|
738
|
+
() => {
|
|
739
|
+
callBack(ruleClassData);
|
|
740
|
+
},
|
|
741
|
+
);
|
|
742
|
+
}}
|
|
743
|
+
>
|
|
744
|
+
{this.getDataTypeOperateList(itemDetail.dataTypeCode).map(
|
|
745
|
+
(item) => (
|
|
746
|
+
<Select.Option value={item.code} key={item.code}>
|
|
747
|
+
{item.name}
|
|
748
|
+
</Select.Option>
|
|
749
|
+
),
|
|
750
|
+
)}
|
|
751
|
+
</Select>
|
|
752
|
+
{!itemDetail?.isInsertParam ? (
|
|
753
|
+
<RuleField
|
|
754
|
+
selectOperation={itemDetail?.operationCode || ''}
|
|
755
|
+
disabled={disabled}
|
|
756
|
+
initialThresholdQuery={thresholdQuery}
|
|
757
|
+
dataTypeCode={itemDetail?.dataTypeCode || ''}
|
|
758
|
+
dataChoiceBusinessType={dataChoiceBusinessType || ''}
|
|
759
|
+
dataInputBusinessType={dataInputBusinessType || ''}
|
|
760
|
+
itemDetail={itemDetail}
|
|
761
|
+
queryIdentifyType={queryIdentifyType}
|
|
762
|
+
queryIdentify={queryIdentify}
|
|
763
|
+
propertyCode={getPropertyCode(itemDetail.propertyPath)}
|
|
764
|
+
// propertyCode={`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`}
|
|
765
|
+
relateDatas={relateDatas}
|
|
766
|
+
values={itemDetail.params || []}
|
|
767
|
+
valueNames={itemDetail.paramNames || []}
|
|
768
|
+
callback={(newValues, newValueNames) => {
|
|
769
|
+
this.handleValuesChange(
|
|
770
|
+
itemDetail,
|
|
771
|
+
newValues,
|
|
772
|
+
newValueNames,
|
|
773
|
+
);
|
|
774
|
+
}}
|
|
775
|
+
/>
|
|
776
|
+
) : null}
|
|
777
|
+
<Select
|
|
778
|
+
disabled={disabled}
|
|
779
|
+
value={
|
|
780
|
+
itemDetail?.params?.[0]?.replace('{', '').replace('}', '') ||
|
|
781
|
+
''
|
|
782
|
+
}
|
|
783
|
+
style={{
|
|
784
|
+
width: '150px',
|
|
785
|
+
marginLeft: '10px',
|
|
786
|
+
display: itemDetail?.isInsertParam ? '' : 'none',
|
|
787
|
+
}}
|
|
788
|
+
onChange={(value) => {
|
|
789
|
+
const { ruleClassData } = this.state;
|
|
790
|
+
console.log(itemDetail);
|
|
791
|
+
itemDetail.params = [(value && `{${value}}`) || ''];
|
|
792
|
+
const name = systemVariableList.find(
|
|
793
|
+
(i) => i.code == value,
|
|
794
|
+
)?.name;
|
|
795
|
+
itemDetail.paramNames = [name || ''];
|
|
796
|
+
this.setState(
|
|
797
|
+
{
|
|
798
|
+
ruleClassData,
|
|
799
|
+
},
|
|
800
|
+
() => {
|
|
801
|
+
callBack(ruleClassData);
|
|
802
|
+
},
|
|
803
|
+
);
|
|
804
|
+
}}
|
|
805
|
+
>
|
|
806
|
+
{systemVariableList
|
|
807
|
+
? systemVariableList.map((item) => (
|
|
808
|
+
<Select.Option value={item.code} key={item.code}>
|
|
809
|
+
{item.name}
|
|
810
|
+
</Select.Option>
|
|
811
|
+
))
|
|
812
|
+
: null}
|
|
813
|
+
</Select>
|
|
814
|
+
<PlusCircleOutlined
|
|
815
|
+
className={'icon_btn_style'}
|
|
816
|
+
onClick={() => {
|
|
817
|
+
this.addChildRules(itemDetail);
|
|
818
|
+
}}
|
|
819
|
+
style={{
|
|
820
|
+
color: '#008fe0',
|
|
821
|
+
marginLeft: '15px',
|
|
822
|
+
display: floorIndex > 4 || disabled ? 'none' : 'inline-block',
|
|
823
|
+
}}
|
|
824
|
+
/>
|
|
825
|
+
<MinusCircleOutlined
|
|
826
|
+
className={'icon_btn_style'}
|
|
827
|
+
onClick={() => {
|
|
828
|
+
this.handleDeleteRule(
|
|
829
|
+
itemDetail,
|
|
830
|
+
parentDetail,
|
|
831
|
+
classDataIndex,
|
|
832
|
+
);
|
|
833
|
+
}}
|
|
834
|
+
style={{
|
|
835
|
+
color: 'gray',
|
|
836
|
+
display: disabled ? 'none' : 'inline-block',
|
|
837
|
+
}}
|
|
838
|
+
/>
|
|
839
|
+
<Button
|
|
840
|
+
type="link"
|
|
841
|
+
disabled={
|
|
842
|
+
disabled || itemDetail.operationCode === '' || !itemDetail.operationCode
|
|
843
|
+
? true
|
|
844
|
+
: false
|
|
845
|
+
}
|
|
846
|
+
onClick={() => {
|
|
847
|
+
const { ruleClassData } = this.state;
|
|
848
|
+
if (systemVariableList?.length) {
|
|
849
|
+
itemDetail.isInsertParam = !itemDetail.isInsertParam;
|
|
850
|
+
delete itemDetail.params;
|
|
851
|
+
delete itemDetail.paramNames;
|
|
852
|
+
this.setState(
|
|
853
|
+
{
|
|
854
|
+
ruleClassData,
|
|
855
|
+
},
|
|
856
|
+
() => {
|
|
857
|
+
callBack(ruleClassData);
|
|
858
|
+
},
|
|
859
|
+
);
|
|
860
|
+
} else {
|
|
861
|
+
message.warn('未配置规则变量');
|
|
862
|
+
}
|
|
863
|
+
}}
|
|
864
|
+
>
|
|
865
|
+
{itemDetail?.isInsertParam ? '取消插入参数' : '插入参数'}
|
|
866
|
+
</Button>
|
|
867
|
+
</div>
|
|
868
|
+
)}
|
|
869
|
+
<div
|
|
870
|
+
style={{
|
|
871
|
+
display:
|
|
872
|
+
itemDetail.operationType == 'logic' && !disabled
|
|
873
|
+
? 'block'
|
|
874
|
+
: 'none',
|
|
875
|
+
}}
|
|
876
|
+
>
|
|
877
|
+
<span
|
|
878
|
+
style={{ color: '#008fe0', cursor: 'pointer' }}
|
|
879
|
+
type="link"
|
|
880
|
+
onClick={() => {
|
|
881
|
+
this.addPeerRule(itemDetail);
|
|
882
|
+
}}
|
|
883
|
+
>
|
|
884
|
+
<PlusCircleOutlined
|
|
885
|
+
style={{
|
|
886
|
+
color: '#008fe0',
|
|
887
|
+
fontSize: '14px',
|
|
888
|
+
marginRight: '5px',
|
|
889
|
+
}}
|
|
890
|
+
/>
|
|
891
|
+
添加条件
|
|
892
|
+
</span>
|
|
893
|
+
</div>
|
|
894
|
+
</div>
|
|
895
|
+
</div>
|
|
896
|
+
);
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
handleEditExtraInfoResponse = (code, val, parentDetail,classDataIndex) => {
|
|
900
|
+
const { ruleClassData } = this.state;
|
|
901
|
+
const { callBack } = this.props;
|
|
902
|
+
parentDetail.extraInfo.response[code] = val;
|
|
903
|
+
ruleClassData[classDataIndex].extraInfo.response[code] = val;
|
|
904
|
+
|
|
905
|
+
this.setState(
|
|
906
|
+
{
|
|
907
|
+
ruleClassData,
|
|
908
|
+
},
|
|
909
|
+
() => {
|
|
910
|
+
callBack(ruleClassData);
|
|
911
|
+
},
|
|
912
|
+
);
|
|
913
|
+
};
|
|
914
|
+
// 场景需要返回值2022.11.15
|
|
915
|
+
renderResItem = (
|
|
916
|
+
itemDetail,
|
|
917
|
+
parentDetail,
|
|
918
|
+
ruleReturnConfig,
|
|
919
|
+
classDataIndex,
|
|
920
|
+
disabled,
|
|
921
|
+
boxStyle,
|
|
922
|
+
) => {
|
|
923
|
+
const isShowResponse = itemDetail.response['enable'];
|
|
924
|
+
const isRightText = ruleReturnConfig?.rightText?.length;
|
|
925
|
+
|
|
926
|
+
const showValue = (code, type, functionItem, configItem) => {
|
|
927
|
+
let defaultValue = configItem.defaultValue;
|
|
928
|
+
const pCode = itemDetail.response['value'];
|
|
929
|
+
if (type === 'input') {
|
|
930
|
+
return pCode === undefined ? pCode : pCode || defaultValue;
|
|
931
|
+
}
|
|
932
|
+
return pCode || defaultValue;
|
|
933
|
+
};
|
|
934
|
+
const handleEdit = (code, val) => {
|
|
935
|
+
let value = val;
|
|
936
|
+
if (isObj(code)) {
|
|
937
|
+
Object.keys(code).forEach((ite) => {
|
|
938
|
+
this.handleEditExtraInfoResponse(ite, code[ite], parentDetail,classDataIndex);
|
|
939
|
+
});
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
if (Array.isArray(val)) {
|
|
943
|
+
value = val.map((m) => m.value || m).join(',');
|
|
944
|
+
}
|
|
945
|
+
if (isObj(val)) {
|
|
946
|
+
value = val.value || val.PCDCode?.join('/');
|
|
947
|
+
}
|
|
948
|
+
this.handleEditExtraInfoResponse('value', value, parentDetail,classDataIndex);
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
return (
|
|
952
|
+
(isShowResponse && (
|
|
953
|
+
<div style={{ display: 'flex' }}>
|
|
954
|
+
{this.renderFormCompItem(
|
|
955
|
+
ruleReturnConfig,
|
|
956
|
+
showValue,
|
|
957
|
+
handleEdit,
|
|
958
|
+
{},
|
|
959
|
+
boxStyle,
|
|
960
|
+
disabled
|
|
961
|
+
)}
|
|
962
|
+
<MinusCircleOutlined
|
|
963
|
+
className={'icon_btn_style'}
|
|
964
|
+
onClick={() => {
|
|
965
|
+
this.handleEditExtraInfoResponse('enable', false, parentDetail,classDataIndex);
|
|
966
|
+
}}
|
|
967
|
+
style={{
|
|
968
|
+
color: 'gray',
|
|
969
|
+
marginLeft: isRightText ? '100px' : '15px',
|
|
970
|
+
marginTop: '15px',
|
|
971
|
+
display: disabled ? 'none' : 'inline-block',
|
|
972
|
+
}}
|
|
973
|
+
/>
|
|
974
|
+
</div>
|
|
975
|
+
)) ||
|
|
976
|
+
null
|
|
977
|
+
);
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
renderCompItem = (ites, showValue, handleEdit,disabled) => {
|
|
981
|
+
const { regularDataList } = this.props;
|
|
982
|
+
let fieldListGroup = regularDataList.map((item) => {
|
|
983
|
+
const Item = {
|
|
984
|
+
id: item.id,
|
|
985
|
+
code: item.code,
|
|
986
|
+
name: item.name,
|
|
987
|
+
value: item.code,
|
|
988
|
+
};
|
|
989
|
+
if (item.propertyList) {
|
|
990
|
+
Item.propertyList = item.propertyList.map((field) => ({
|
|
991
|
+
id: field.id,
|
|
992
|
+
code: field.code,
|
|
993
|
+
name: field.name,
|
|
994
|
+
value: `${item.code}.${field.code}`,
|
|
995
|
+
valueText: `${item.name}.${field.name}`,
|
|
996
|
+
}));
|
|
997
|
+
}
|
|
998
|
+
return Item;
|
|
999
|
+
});
|
|
1000
|
+
if (!ites) return;
|
|
1001
|
+
const styleCommon = {
|
|
1002
|
+
width: '200px',
|
|
1003
|
+
...(ites?.rightText ? { marginLeft: 10 } : {}),
|
|
1004
|
+
};
|
|
1005
|
+
const style2 = {
|
|
1006
|
+
width: '100px',
|
|
1007
|
+
};
|
|
1008
|
+
return (
|
|
1009
|
+
<>
|
|
1010
|
+
{/* 输入/字符串 */}
|
|
1011
|
+
{(ites?.inputType === 10 && ites?.valueType === 21 && (
|
|
1012
|
+
<Input
|
|
1013
|
+
disabled={disabled}
|
|
1014
|
+
allowClear={true}
|
|
1015
|
+
onClear={() => {
|
|
1016
|
+
handleEdit(ites.code, undefined);
|
|
1017
|
+
}}
|
|
1018
|
+
defaultValue={showValue(ites.code, 'input')}
|
|
1019
|
+
style={styleCommon}
|
|
1020
|
+
onBlur={(e) => {
|
|
1021
|
+
handleEdit(
|
|
1022
|
+
ites.code,
|
|
1023
|
+
String(e.target.value).trim() == ''
|
|
1024
|
+
? undefined
|
|
1025
|
+
: e.target.value,
|
|
1026
|
+
);
|
|
1027
|
+
}}
|
|
1028
|
+
/>
|
|
1029
|
+
)) ||
|
|
1030
|
+
null}
|
|
1031
|
+
{/* 输入 / 长整数23/小数22 */}
|
|
1032
|
+
{(ites?.inputType === 10 &&
|
|
1033
|
+
(ites?.valueType === 23 || ites?.valueType === 22) && (
|
|
1034
|
+
<InputNumber
|
|
1035
|
+
disabled={disabled}
|
|
1036
|
+
max={Number.MAX_SAFE_INTEGER}
|
|
1037
|
+
min={ites?.valueType === 23 ? 0 : Number.MIN_SAFE_INTEGER}
|
|
1038
|
+
precision={ites?.valueType === 23 ? 0 : 2}
|
|
1039
|
+
defaultValue={ites.defaultValue}
|
|
1040
|
+
style={style2}
|
|
1041
|
+
value={showValue(ites.code)}
|
|
1042
|
+
onChange={(value) => {
|
|
1043
|
+
handleEdit(ites.code, value);
|
|
1044
|
+
}}
|
|
1045
|
+
/>
|
|
1046
|
+
)) ||
|
|
1047
|
+
null}
|
|
1048
|
+
{/* 输入/日期 */}
|
|
1049
|
+
{(ites?.inputType === 10 && ites?.valueType === 41 && (
|
|
1050
|
+
<DatePicker
|
|
1051
|
+
disabled={disabled}
|
|
1052
|
+
defaultValue={ites.defaultValue}
|
|
1053
|
+
style={style2}
|
|
1054
|
+
value={showValue(ites.code)}
|
|
1055
|
+
onChange={(value) => {
|
|
1056
|
+
handleEdit(ites.code, value);
|
|
1057
|
+
}}
|
|
1058
|
+
/>
|
|
1059
|
+
)) ||
|
|
1060
|
+
null}
|
|
1061
|
+
{/* 输入/时间 */}
|
|
1062
|
+
{(ites?.inputType === 10 && ites?.valueType === 40 && (
|
|
1063
|
+
<RangePicker
|
|
1064
|
+
showTime
|
|
1065
|
+
disabled={disabled}
|
|
1066
|
+
defaultValue={ites.defaultValue}
|
|
1067
|
+
style={style2}
|
|
1068
|
+
value={showValue(ites.code)}
|
|
1069
|
+
onChange={(value) => {
|
|
1070
|
+
handleEdit(ites.code, value);
|
|
1071
|
+
}}
|
|
1072
|
+
/>
|
|
1073
|
+
)) ||
|
|
1074
|
+
null}
|
|
1075
|
+
{/* 输入/布尔值 */}
|
|
1076
|
+
{(ites?.inputType === 10 && ites?.valueType === 24 && (
|
|
1077
|
+
<Switch
|
|
1078
|
+
disabled={disabled}
|
|
1079
|
+
defaultChecked={!!ites.defaultValue}
|
|
1080
|
+
style={style2}
|
|
1081
|
+
checked={showValue(ites.code)}
|
|
1082
|
+
onChange={(value) => {
|
|
1083
|
+
handleEdit(ites.code, value);
|
|
1084
|
+
}}
|
|
1085
|
+
/>
|
|
1086
|
+
)) ||
|
|
1087
|
+
null}
|
|
1088
|
+
{/* 单选/多选 自定义 */}
|
|
1089
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1090
|
+
ites?.choiceType === 10 && (
|
|
1091
|
+
<Select
|
|
1092
|
+
disabled={disabled}
|
|
1093
|
+
allowClear
|
|
1094
|
+
showArrow
|
|
1095
|
+
{...(ites?.inputType === 30
|
|
1096
|
+
? {
|
|
1097
|
+
mode: 'multiple',
|
|
1098
|
+
}
|
|
1099
|
+
: {})}
|
|
1100
|
+
defaultValue={ites.defaultValue}
|
|
1101
|
+
style={styleCommon}
|
|
1102
|
+
value={showValue(ites.code)}
|
|
1103
|
+
onChange={(value) => {
|
|
1104
|
+
handleEdit(ites.code, value);
|
|
1105
|
+
}}
|
|
1106
|
+
>
|
|
1107
|
+
{Object.keys(ites.enumeration).map((it) => (
|
|
1108
|
+
<Select.Option key={it} value={it}>
|
|
1109
|
+
{ites.enumeration[it]}
|
|
1110
|
+
</Select.Option>
|
|
1111
|
+
))}
|
|
1112
|
+
</Select>
|
|
1113
|
+
)) ||
|
|
1114
|
+
null}
|
|
1115
|
+
{/* 单选/多选 数据字典 */}
|
|
1116
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1117
|
+
ites?.choiceType === 20 && (
|
|
1118
|
+
<Select
|
|
1119
|
+
disabled={disabled}
|
|
1120
|
+
{...(ites?.inputType === 30
|
|
1121
|
+
? {
|
|
1122
|
+
mode: 'multiple',
|
|
1123
|
+
}
|
|
1124
|
+
: {})}
|
|
1125
|
+
defaultValue={ites.defaultValue}
|
|
1126
|
+
style={styleCommon}
|
|
1127
|
+
value={showValue(ites.code)}
|
|
1128
|
+
onChange={(value) => {
|
|
1129
|
+
handleEdit(ites.code, value);
|
|
1130
|
+
}}
|
|
1131
|
+
>
|
|
1132
|
+
{getDictionarySource(ites?.dictionaryCode).map((it) => (
|
|
1133
|
+
<Select.Option key={it.value} value={it.value}>
|
|
1134
|
+
{it.text}
|
|
1135
|
+
</Select.Option>
|
|
1136
|
+
))}
|
|
1137
|
+
</Select>
|
|
1138
|
+
)) ||
|
|
1139
|
+
null}
|
|
1140
|
+
{/* 单选/多选 仓库选择器(物理仓) */}
|
|
1141
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1142
|
+
ites?.choiceType === 110 && (
|
|
1143
|
+
<BusinessSearchSelect
|
|
1144
|
+
selectBusinessType="physicalWarehouse"
|
|
1145
|
+
selectProps={{
|
|
1146
|
+
style: styleCommon,
|
|
1147
|
+
placeholder: '请选择物理仓',
|
|
1148
|
+
...(ites?.inputType === 30
|
|
1149
|
+
? {
|
|
1150
|
+
mode: 'multiple',
|
|
1151
|
+
maxTagCount: 1,
|
|
1152
|
+
}
|
|
1153
|
+
: {}),
|
|
1154
|
+
}}
|
|
1155
|
+
disabled={disabled}
|
|
1156
|
+
labelInValue={true}
|
|
1157
|
+
value={showValue(ites.code)}
|
|
1158
|
+
requestConfig={{
|
|
1159
|
+
mappingValueField: 'physicalWarehouseCode',
|
|
1160
|
+
filterInit: 'qp-physicalWarehouseCode-in',
|
|
1161
|
+
}}
|
|
1162
|
+
onChange={(value) => {
|
|
1163
|
+
handleEdit(ites.code, value);
|
|
1164
|
+
}}
|
|
1165
|
+
getPopupContainer={() => document.body}
|
|
1166
|
+
/>
|
|
1167
|
+
)) ||
|
|
1168
|
+
null}
|
|
1169
|
+
{/* 单选/多选 仓库选择器(逻辑仓) */}
|
|
1170
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1171
|
+
ites?.choiceType === 120 && (
|
|
1172
|
+
<BusinessSearchSelect
|
|
1173
|
+
selectBusinessType="realWarehouse"
|
|
1174
|
+
selectProps={{
|
|
1175
|
+
style: styleCommon,
|
|
1176
|
+
placeholder: '请选择逻辑仓',
|
|
1177
|
+
...(ites?.inputType === 30
|
|
1178
|
+
? {
|
|
1179
|
+
mode: 'multiple',
|
|
1180
|
+
maxTagCount: 1,
|
|
1181
|
+
}
|
|
1182
|
+
: {}),
|
|
1183
|
+
}}
|
|
1184
|
+
disabled={disabled}
|
|
1185
|
+
labelInValue={true}
|
|
1186
|
+
value={showValue(ites.code)}
|
|
1187
|
+
requestConfig={{
|
|
1188
|
+
mappingValueField: 'realWarehouseCode',
|
|
1189
|
+
filterInit: 'qp-realWarehouseCode-in',
|
|
1190
|
+
}}
|
|
1191
|
+
onChange={(value) => {
|
|
1192
|
+
handleEdit(ites.code, value);
|
|
1193
|
+
}}
|
|
1194
|
+
getPopupContainer={() => document.body}
|
|
1195
|
+
/>
|
|
1196
|
+
)) ||
|
|
1197
|
+
null}
|
|
1198
|
+
{/* 单选/多选 仓库选择器(虚拟仓) */}
|
|
1199
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1200
|
+
ites?.choiceType === 130 && (
|
|
1201
|
+
<BusinessSearchSelect
|
|
1202
|
+
selectBusinessType="virtualWarehouse"
|
|
1203
|
+
selectProps={{
|
|
1204
|
+
style: styleCommon,
|
|
1205
|
+
placeholder: '请选择虚拟仓',
|
|
1206
|
+
...(ites?.inputType === 30
|
|
1207
|
+
? {
|
|
1208
|
+
mode: 'multiple',
|
|
1209
|
+
maxTagCount: 1,
|
|
1210
|
+
}
|
|
1211
|
+
: {}),
|
|
1212
|
+
}}
|
|
1213
|
+
disabled={disabled}
|
|
1214
|
+
labelInValue={true}
|
|
1215
|
+
value={showValue(ites.code)}
|
|
1216
|
+
requestConfig={{
|
|
1217
|
+
mappingValueField: 'virtualWarehouseCode',
|
|
1218
|
+
filterInit: 'qp-virtualWarehouseCode-in',
|
|
1219
|
+
}}
|
|
1220
|
+
onChange={(value) => {
|
|
1221
|
+
handleEdit(ites.code, value);
|
|
1222
|
+
}}
|
|
1223
|
+
getPopupContainer={() => document.body}
|
|
1224
|
+
/>
|
|
1225
|
+
)) ||
|
|
1226
|
+
null}
|
|
1227
|
+
{/* 单选/多选 仓库选择器(渠道仓) */}
|
|
1228
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1229
|
+
ites?.choiceType === 140 && (
|
|
1230
|
+
<BusinessSearchSelect
|
|
1231
|
+
selectBusinessType="channelWarehouse"
|
|
1232
|
+
selectProps={{
|
|
1233
|
+
style: styleCommon,
|
|
1234
|
+
placeholder: '请选择渠道仓',
|
|
1235
|
+
...(ites?.inputType === 30
|
|
1236
|
+
? {
|
|
1237
|
+
mode: 'multiple',
|
|
1238
|
+
maxTagCount: 1,
|
|
1239
|
+
}
|
|
1240
|
+
: {}),
|
|
1241
|
+
}}
|
|
1242
|
+
disabled={disabled}
|
|
1243
|
+
labelInValue={true}
|
|
1244
|
+
value={showValue(ites.code)}
|
|
1245
|
+
requestConfig={{
|
|
1246
|
+
mappingValueField: 'channelWarehouseCode',
|
|
1247
|
+
filterInit: 'qp-channelWarehouseCode-in',
|
|
1248
|
+
}}
|
|
1249
|
+
onChange={(value) => {
|
|
1250
|
+
handleEdit(ites.code, value);
|
|
1251
|
+
}}
|
|
1252
|
+
getPopupContainer={() => document.body}
|
|
1253
|
+
/>
|
|
1254
|
+
)) ||
|
|
1255
|
+
null}
|
|
1256
|
+
{/* 单选/多选 商品SPU选择器 */}
|
|
1257
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1258
|
+
ites?.choiceType === 150 && (
|
|
1259
|
+
<BusinessSearchSelect
|
|
1260
|
+
selectBusinessType="spuCommodity"
|
|
1261
|
+
selectProps={{
|
|
1262
|
+
style: styleCommon,
|
|
1263
|
+
placeholder: '请选择SPU',
|
|
1264
|
+
...(ites?.inputType === 30
|
|
1265
|
+
? {
|
|
1266
|
+
mode: 'multiple',
|
|
1267
|
+
maxTagCount: 1,
|
|
1268
|
+
}
|
|
1269
|
+
: {}),
|
|
1270
|
+
}}
|
|
1271
|
+
disabled={disabled}
|
|
1272
|
+
labelInValue={true}
|
|
1273
|
+
value={showValue(ites.code)}
|
|
1274
|
+
requestConfig={{
|
|
1275
|
+
filterInit: 'qp-itemCode-in',
|
|
1276
|
+
}}
|
|
1277
|
+
onChange={(value) => {
|
|
1278
|
+
handleEdit(ites.code, value);
|
|
1279
|
+
}}
|
|
1280
|
+
getPopupContainer={() => document.body}
|
|
1281
|
+
/>
|
|
1282
|
+
)) ||
|
|
1283
|
+
null}
|
|
1284
|
+
{/* 单选/多选 商品SKU选择器 */}
|
|
1285
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1286
|
+
ites?.choiceType === 160 && (
|
|
1287
|
+
<BusinessSearchSelect
|
|
1288
|
+
selectBusinessType="skuCommodity"
|
|
1289
|
+
selectProps={{
|
|
1290
|
+
style: styleCommon,
|
|
1291
|
+
placeholder: '请选择商品',
|
|
1292
|
+
...(ites?.inputType === 30
|
|
1293
|
+
? {
|
|
1294
|
+
mode: 'multiple',
|
|
1295
|
+
maxTagCount: 1,
|
|
1296
|
+
}
|
|
1297
|
+
: {}),
|
|
1298
|
+
}}
|
|
1299
|
+
disabled={disabled}
|
|
1300
|
+
labelInValue={true}
|
|
1301
|
+
value={showValue(ites.code)}
|
|
1302
|
+
requestConfig={{
|
|
1303
|
+
filterInit: 'qp-skuCode-in',
|
|
1304
|
+
}}
|
|
1305
|
+
onChange={(value) => {
|
|
1306
|
+
handleEdit(ites.code, value);
|
|
1307
|
+
}}
|
|
1308
|
+
getPopupContainer={() => document.body}
|
|
1309
|
+
/>
|
|
1310
|
+
)) ||
|
|
1311
|
+
null}
|
|
1312
|
+
{/* 单选/多选 省市区 */}
|
|
1313
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1314
|
+
ites?.choiceType === 190 && (
|
|
1315
|
+
<BsCascader
|
|
1316
|
+
disabled={disabled}
|
|
1317
|
+
isAll={true}
|
|
1318
|
+
needNameAndCode={true}
|
|
1319
|
+
notChangeOnSelect={true}
|
|
1320
|
+
initRequestSource={async () => {
|
|
1321
|
+
return await request({
|
|
1322
|
+
url: '/basic/bscArea/getBscAreaList?qp-level-eq=1&qp-pid-eq=100000',
|
|
1323
|
+
method: 'get',
|
|
1324
|
+
converter: ({ data }) => {
|
|
1325
|
+
const handleData =
|
|
1326
|
+
data && data[0]
|
|
1327
|
+
? data?.map((item) => {
|
|
1328
|
+
return {
|
|
1329
|
+
text: item.name,
|
|
1330
|
+
value: item.id,
|
|
1331
|
+
level: item.level,
|
|
1332
|
+
id: item.id,
|
|
1333
|
+
};
|
|
1334
|
+
})
|
|
1335
|
+
: [];
|
|
1336
|
+
return handleData;
|
|
1337
|
+
},
|
|
1338
|
+
});
|
|
1339
|
+
}}
|
|
1340
|
+
value={showValue(ites.code)}
|
|
1341
|
+
onChange={(value) => {
|
|
1342
|
+
handleEdit(ites.code, value);
|
|
1343
|
+
}}
|
|
1344
|
+
getPopupContainer={() => document.body}
|
|
1345
|
+
/>
|
|
1346
|
+
)) ||
|
|
1347
|
+
null}
|
|
1348
|
+
{/* 单选/多选 行政组织选择器 */}
|
|
1349
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1350
|
+
ites?.choiceType === 210 && (
|
|
1351
|
+
<BusinessTreeSearchSelect
|
|
1352
|
+
disabled={disabled}
|
|
1353
|
+
treeCheckable={ites?.inputType === 30}
|
|
1354
|
+
businessType="department"
|
|
1355
|
+
labelInValue={true}
|
|
1356
|
+
value={showValue(ites.code)}
|
|
1357
|
+
style={styleCommon}
|
|
1358
|
+
onChange={(value) => {
|
|
1359
|
+
handleEdit(ites.code, value);
|
|
1360
|
+
}}
|
|
1361
|
+
getPopupContainer={() => document.body}
|
|
1362
|
+
/>
|
|
1363
|
+
)) ||
|
|
1364
|
+
null}
|
|
1365
|
+
{/* 单选/多选 采购组织选择器 */}
|
|
1366
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1367
|
+
ites?.choiceType === 220 && (
|
|
1368
|
+
<BusinessTreeSearchSelect
|
|
1369
|
+
disabled={disabled}
|
|
1370
|
+
treeCheckable={ites?.inputType === 30}
|
|
1371
|
+
businessType="purchase-organization"
|
|
1372
|
+
labelInValue={true}
|
|
1373
|
+
value={showValue(ites.code)}
|
|
1374
|
+
style={styleCommon}
|
|
1375
|
+
onChange={(value) => {
|
|
1376
|
+
handleEdit(ites.code, value);
|
|
1377
|
+
}}
|
|
1378
|
+
getPopupContainer={() => document.body}
|
|
1379
|
+
/>
|
|
1380
|
+
)) ||
|
|
1381
|
+
null}
|
|
1382
|
+
{/* 单选/多选 销售组织选择器 */}
|
|
1383
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1384
|
+
ites?.choiceType === 230 && (
|
|
1385
|
+
<BusinessTreeSearchSelect
|
|
1386
|
+
disabled={disabled}
|
|
1387
|
+
treeCheckable={ites?.inputType === 30}
|
|
1388
|
+
businessType="sales-organization"
|
|
1389
|
+
labelInValue={true}
|
|
1390
|
+
value={showValue(ites.code)}
|
|
1391
|
+
style={styleCommon}
|
|
1392
|
+
onChange={(value) => {
|
|
1393
|
+
handleEdit(ites.code, value);
|
|
1394
|
+
}}
|
|
1395
|
+
getPopupContainer={() => document.body}
|
|
1396
|
+
/>
|
|
1397
|
+
)) ||
|
|
1398
|
+
null}
|
|
1399
|
+
{/* 单选/多选 供应商选择器 */}
|
|
1400
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1401
|
+
ites?.choiceType === 240 && (
|
|
1402
|
+
<BusinessSearchSelect
|
|
1403
|
+
selectBusinessType="supplier2"
|
|
1404
|
+
selectProps={{
|
|
1405
|
+
style: styleCommon,
|
|
1406
|
+
placeholder: '请选择供应商',
|
|
1407
|
+
...(ites?.inputType === 30
|
|
1408
|
+
? {
|
|
1409
|
+
mode: 'multiple',
|
|
1410
|
+
maxTagCount: 1,
|
|
1411
|
+
}
|
|
1412
|
+
: {}),
|
|
1413
|
+
}}
|
|
1414
|
+
disabled={disabled}
|
|
1415
|
+
labelInValue={true}
|
|
1416
|
+
value={showValue(ites.code)}
|
|
1417
|
+
requestConfig={{
|
|
1418
|
+
filterInit: 'qp-code-in',
|
|
1419
|
+
}}
|
|
1420
|
+
onChange={(value) => {
|
|
1421
|
+
handleEdit(ites.code, value);
|
|
1422
|
+
}}
|
|
1423
|
+
getPopupContainer={() => document.body}
|
|
1424
|
+
/>
|
|
1425
|
+
)) ||
|
|
1426
|
+
null}
|
|
1427
|
+
{/* 单选/多选 客户选择器 */}
|
|
1428
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1429
|
+
ites?.choiceType === 250 && (
|
|
1430
|
+
<BusinessSearchSelect
|
|
1431
|
+
selectBusinessType="customer2"
|
|
1432
|
+
selectProps={{
|
|
1433
|
+
style: styleCommon,
|
|
1434
|
+
placeholder: '请选择客户',
|
|
1435
|
+
...(ites?.inputType === 30
|
|
1436
|
+
? {
|
|
1437
|
+
mode: 'multiple',
|
|
1438
|
+
maxTagCount: 1,
|
|
1439
|
+
}
|
|
1440
|
+
: {}),
|
|
1441
|
+
}}
|
|
1442
|
+
disabled={disabled}
|
|
1443
|
+
labelInValue={true}
|
|
1444
|
+
value={showValue(ites.code)}
|
|
1445
|
+
requestConfig={{
|
|
1446
|
+
filterInit: 'qp-code-in',
|
|
1447
|
+
}}
|
|
1448
|
+
onChange={(value) => {
|
|
1449
|
+
handleEdit(ites.code, value);
|
|
1450
|
+
}}
|
|
1451
|
+
getPopupContainer={() => document.body}
|
|
1452
|
+
/>
|
|
1453
|
+
)) ||
|
|
1454
|
+
null}
|
|
1455
|
+
{/* 单选/多选 店铺选择器 */}
|
|
1456
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1457
|
+
ites?.choiceType === 260 && (
|
|
1458
|
+
<BusinessSearchSelect
|
|
1459
|
+
selectBusinessType="shopFile2"
|
|
1460
|
+
selectProps={{
|
|
1461
|
+
style: styleCommon,
|
|
1462
|
+
placeholder: '请选择店铺',
|
|
1463
|
+
...(ites?.inputType === 30
|
|
1464
|
+
? {
|
|
1465
|
+
mode: 'multiple',
|
|
1466
|
+
maxTagCount: 1,
|
|
1467
|
+
}
|
|
1468
|
+
: {}),
|
|
1469
|
+
}}
|
|
1470
|
+
disabled={disabled}
|
|
1471
|
+
labelInValue={true}
|
|
1472
|
+
value={showValue(ites.code)}
|
|
1473
|
+
requestConfig={{
|
|
1474
|
+
filterInit: 'qp-code-in',
|
|
1475
|
+
}}
|
|
1476
|
+
onChange={(value) => {
|
|
1477
|
+
handleEdit(ites.code, value);
|
|
1478
|
+
}}
|
|
1479
|
+
getPopupContainer={() => document.body}
|
|
1480
|
+
/>
|
|
1481
|
+
)) ||
|
|
1482
|
+
null}
|
|
1483
|
+
{/* 单选/多选 员工选择器 */}
|
|
1484
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1485
|
+
ites?.choiceType === 270 && (
|
|
1486
|
+
<BusinessSearchSelect
|
|
1487
|
+
selectBusinessType="employee2"
|
|
1488
|
+
selectProps={{
|
|
1489
|
+
style: styleCommon,
|
|
1490
|
+
placeholder: '请选择员工',
|
|
1491
|
+
...(ites?.inputType === 30
|
|
1492
|
+
? {
|
|
1493
|
+
mode: 'multiple',
|
|
1494
|
+
maxTagCount: 1,
|
|
1495
|
+
}
|
|
1496
|
+
: {}),
|
|
1497
|
+
}}
|
|
1498
|
+
disabled={disabled}
|
|
1499
|
+
labelInValue={true}
|
|
1500
|
+
value={showValue(ites.code)}
|
|
1501
|
+
requestConfig={{
|
|
1502
|
+
filterInit: 'qp-id-in',
|
|
1503
|
+
}}
|
|
1504
|
+
onChange={(value) => {
|
|
1505
|
+
handleEdit(ites.code, value);
|
|
1506
|
+
}}
|
|
1507
|
+
getPopupContainer={() => document.body}
|
|
1508
|
+
/>
|
|
1509
|
+
)) ||
|
|
1510
|
+
null}
|
|
1511
|
+
{/* 单选/多选 库存组织选择器 */}
|
|
1512
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1513
|
+
ites?.choiceType === 280 && (
|
|
1514
|
+
<BusinessTreeSearchSelect
|
|
1515
|
+
disabled={disabled}
|
|
1516
|
+
treeCheckable={ites?.inputType === 30}
|
|
1517
|
+
businessType="stock-organization"
|
|
1518
|
+
labelInValue={true}
|
|
1519
|
+
value={showValue(ites.code)}
|
|
1520
|
+
style={styleCommon}
|
|
1521
|
+
onChange={(value) => {
|
|
1522
|
+
handleEdit(ites.code, value);
|
|
1523
|
+
}}
|
|
1524
|
+
getPopupContainer={() => document.body}
|
|
1525
|
+
/>
|
|
1526
|
+
)) ||
|
|
1527
|
+
null}
|
|
1528
|
+
{/* 单选/多选 配送方式选择器 */}
|
|
1529
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
1530
|
+
ites?.choiceType === 310 && (
|
|
1531
|
+
<BusinessSearchSelect
|
|
1532
|
+
selectBusinessType="deliveryMode"
|
|
1533
|
+
selectProps={{
|
|
1534
|
+
style: styleCommon,
|
|
1535
|
+
placeholder: '请选择配送方式',
|
|
1536
|
+
...(ites?.inputType === 30
|
|
1537
|
+
? {
|
|
1538
|
+
mode: 'multiple',
|
|
1539
|
+
maxTagCount: 1,
|
|
1540
|
+
}
|
|
1541
|
+
: {}),
|
|
1542
|
+
}}
|
|
1543
|
+
disabled={disabled}
|
|
1544
|
+
labelInValue={true}
|
|
1545
|
+
value={showValue(ites.code)}
|
|
1546
|
+
requestConfig={{
|
|
1547
|
+
filterInit: 'qp-code-in',
|
|
1548
|
+
}}
|
|
1549
|
+
onChange={(value) => {
|
|
1550
|
+
handleEdit(ites.code, value);
|
|
1551
|
+
}}
|
|
1552
|
+
getPopupContainer={() => document.body}
|
|
1553
|
+
/>
|
|
1554
|
+
)) ||
|
|
1555
|
+
null}
|
|
1556
|
+
{/* 表达式 */}
|
|
1557
|
+
{ites?.inputType === 40 && (
|
|
1558
|
+
<div style={{ display: 'flex' }}>
|
|
1559
|
+
<Formula
|
|
1560
|
+
disabled={disabled}
|
|
1561
|
+
key={showValue(ites.code)}
|
|
1562
|
+
setValue={(val, formulaName) => {
|
|
1563
|
+
console.log(val, 'val');
|
|
1564
|
+
const value = val.map((item) => {
|
|
1565
|
+
return item.value.replace(
|
|
1566
|
+
/[a-zA-Z_]+\.\w+/g,
|
|
1567
|
+
(i) => '{' + i + '}',
|
|
1568
|
+
);
|
|
1569
|
+
});
|
|
1570
|
+
handleEdit(ites.code, value.join(''));
|
|
1571
|
+
handleEdit({
|
|
1572
|
+
inputType: 40,
|
|
1573
|
+
formulaName,
|
|
1574
|
+
});
|
|
1575
|
+
}}
|
|
1576
|
+
record={{ expression: showValue(ites.code) }}
|
|
1577
|
+
sourceData={fieldListGroup}
|
|
1578
|
+
/>
|
|
1579
|
+
</div>
|
|
1580
|
+
)}
|
|
1581
|
+
</>
|
|
1582
|
+
);
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
renderFormCompItem = (
|
|
1586
|
+
config,
|
|
1587
|
+
showValue,
|
|
1588
|
+
handleEdit,
|
|
1589
|
+
parentItem,
|
|
1590
|
+
boxStyle,
|
|
1591
|
+
disabled
|
|
1592
|
+
) => {
|
|
1593
|
+
if (!config) return;
|
|
1594
|
+
return (
|
|
1595
|
+
<div style={boxStyle}>
|
|
1596
|
+
{(config?.leftText && (
|
|
1597
|
+
<div style={{ flex: 'none', marginRight: 10 }}>
|
|
1598
|
+
{config?.required && <span className="requiredMark" />}
|
|
1599
|
+
{config.leftText}
|
|
1600
|
+
</div>
|
|
1601
|
+
)) ||
|
|
1602
|
+
null}
|
|
1603
|
+
{(!config?.leftText && config?.rightText && config?.required && (
|
|
1604
|
+
<div style={{ flex: 'none', marginRight: 10 }}>
|
|
1605
|
+
<span className="requiredMark" />
|
|
1606
|
+
</div>
|
|
1607
|
+
)) ||
|
|
1608
|
+
null}
|
|
1609
|
+
{this.renderCompItem(
|
|
1610
|
+
config,
|
|
1611
|
+
(a, b, c = parentItem, d = config) => showValue(a, b, c, d),
|
|
1612
|
+
(a, b, c = parentItem, d = config) => handleEdit(a, b, c, d),
|
|
1613
|
+
disabled
|
|
1614
|
+
)}
|
|
1615
|
+
{(config?.rightText && (
|
|
1616
|
+
<div style={{ flex: 'none', marginLeft: 10 }}>{config.rightText}</div>
|
|
1617
|
+
)) ||
|
|
1618
|
+
null}
|
|
1619
|
+
</div>
|
|
1620
|
+
);
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
renderActionList = (
|
|
1624
|
+
itemDetail,
|
|
1625
|
+
parentDetail,
|
|
1626
|
+
handleRuleTypeData,
|
|
1627
|
+
sRuleActionData,
|
|
1628
|
+
classDataIndex,
|
|
1629
|
+
disabled,
|
|
1630
|
+
boxStyle,
|
|
1631
|
+
) => {
|
|
1632
|
+
const showValue = (code, type, functionItem, configItem) => {
|
|
1633
|
+
const functionIndex = handleRuleTypeData.findIndex(
|
|
1634
|
+
(m) => m.code === functionItem.code,
|
|
1635
|
+
);
|
|
1636
|
+
const pCode =
|
|
1637
|
+
itemDetail.execute[functionIndex] &&
|
|
1638
|
+
itemDetail.execute[functionIndex].properties[code];
|
|
1639
|
+
let defaultValue = configItem.defaultValue;
|
|
1640
|
+
if (type === 'input') {
|
|
1641
|
+
return pCode === undefined ? pCode : pCode || defaultValue;
|
|
1642
|
+
}
|
|
1643
|
+
return pCode || defaultValue;
|
|
1644
|
+
};
|
|
1645
|
+
const handleEdit = (code, val, functionItem) => {
|
|
1646
|
+
const functionIndex = handleRuleTypeData.findIndex(
|
|
1647
|
+
(m) => m.code === functionItem.code,
|
|
1648
|
+
);
|
|
1649
|
+
const { ruleClassData } = this.state;
|
|
1650
|
+
const { callBack } = this.props;
|
|
1651
|
+
parentDetail.extraInfo.execute[functionIndex]['properties'][code] = val;
|
|
1652
|
+
parentDetail.extraInfo.execute[functionIndex]['code'] = functionItem.code;
|
|
1653
|
+
|
|
1654
|
+
this.setState(
|
|
1655
|
+
{
|
|
1656
|
+
ruleClassData,
|
|
1657
|
+
},
|
|
1658
|
+
() => {
|
|
1659
|
+
callBack(ruleClassData);
|
|
1660
|
+
},
|
|
1661
|
+
);
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
return (
|
|
1665
|
+
<>
|
|
1666
|
+
{sRuleActionData.map((i, index) => (
|
|
1667
|
+
<div>
|
|
1668
|
+
<div style={{ display: 'flex' }}>
|
|
1669
|
+
{(i.valueList?.length &&
|
|
1670
|
+
i.valueList.map((s) => {
|
|
1671
|
+
return this.renderFormCompItem(
|
|
1672
|
+
s,
|
|
1673
|
+
showValue,
|
|
1674
|
+
handleEdit,
|
|
1675
|
+
i,
|
|
1676
|
+
boxStyle,
|
|
1677
|
+
disabled
|
|
1678
|
+
);
|
|
1679
|
+
})) || (
|
|
1680
|
+
<div style={boxStyle} key={i.functionName}>
|
|
1681
|
+
<div>{i.functionName}</div>
|
|
1682
|
+
</div>
|
|
1683
|
+
)}
|
|
1684
|
+
<MinusCircleOutlined
|
|
1685
|
+
className={'icon_btn_style'}
|
|
1686
|
+
onClick={() => {
|
|
1687
|
+
this.handleDeleteRuleAction(classDataIndex, i.code);
|
|
1688
|
+
}}
|
|
1689
|
+
style={{
|
|
1690
|
+
color: 'gray',
|
|
1691
|
+
marginLeft: '15px',
|
|
1692
|
+
marginTop: '15px',
|
|
1693
|
+
display: disabled ? 'none' : 'inline-block',
|
|
1694
|
+
}}
|
|
1695
|
+
/>
|
|
1696
|
+
</div>
|
|
1697
|
+
</div>
|
|
1698
|
+
))}
|
|
1699
|
+
</>
|
|
1700
|
+
);
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
renderRuleTypeItem = (
|
|
1704
|
+
itemDetail,
|
|
1705
|
+
parentDetail,
|
|
1706
|
+
floorIndex,
|
|
1707
|
+
classDataIndex,
|
|
1708
|
+
ruleTypeData,
|
|
1709
|
+
ruleReturnConfig,
|
|
1710
|
+
isRuleInstance
|
|
1711
|
+
) => {
|
|
1712
|
+
const { modalParams } = this.state;
|
|
1713
|
+
const { disabled } = this.props;
|
|
1714
|
+
const isHaveRuleTypeData = ruleTypeData?.length;
|
|
1715
|
+
const isHaveRuleReturnConfig = Object.keys(ruleReturnConfig)?.length;
|
|
1716
|
+
const handleRuleTypeData = isHaveRuleTypeData
|
|
1717
|
+
? ruleTypeData.sort((a, b) => a.priority - b.priority)
|
|
1718
|
+
: [];
|
|
1719
|
+
|
|
1720
|
+
const selectRuleActionCode = isHaveRuleTypeData
|
|
1721
|
+
? itemDetail.execute.filter((i) => i.isSelected).map((s) => s.code)
|
|
1722
|
+
: [];
|
|
1723
|
+
const selectRuleActionData = isHaveRuleTypeData
|
|
1724
|
+
? handleRuleTypeData.filter((r) =>
|
|
1725
|
+
selectRuleActionCode.some((s) => s === r.code),
|
|
1726
|
+
)
|
|
1727
|
+
: [];
|
|
1728
|
+
|
|
1729
|
+
const RuleActionItemStyle = {
|
|
1730
|
+
display: 'flex',
|
|
1731
|
+
height: '30px',
|
|
1732
|
+
lineHeight: '30px',
|
|
1733
|
+
margin: '10px 0px',
|
|
1734
|
+
};
|
|
1735
|
+
return (
|
|
1736
|
+
<div>
|
|
1737
|
+
<div style={{ textAlign: 'right', display: isRuleInstance ? 'none' : 'flex' }}>
|
|
1738
|
+
<Button
|
|
1739
|
+
type="link"
|
|
1740
|
+
onClick={() => {
|
|
1741
|
+
if (isHaveRuleTypeData) {
|
|
1742
|
+
this.setState({
|
|
1743
|
+
modalParams: {
|
|
1744
|
+
...modalParams,
|
|
1745
|
+
ruleActionData: handleRuleTypeData,
|
|
1746
|
+
classDataIndex,
|
|
1747
|
+
visible: true,
|
|
1748
|
+
},
|
|
1749
|
+
});
|
|
1750
|
+
} else {
|
|
1751
|
+
message.warn('未配置执行动作');
|
|
1752
|
+
}
|
|
1753
|
+
}}
|
|
1754
|
+
>
|
|
1755
|
+
新增动作
|
|
1756
|
+
</Button>
|
|
1757
|
+
<Button
|
|
1758
|
+
type="link"
|
|
1759
|
+
onClick={() => {
|
|
1760
|
+
if (isHaveRuleReturnConfig) {
|
|
1761
|
+
this.handleEditExtraInfoResponse('enable', true, parentDetail,classDataIndex);
|
|
1762
|
+
} else {
|
|
1763
|
+
message.warn('未配置返回');
|
|
1764
|
+
}
|
|
1765
|
+
}}
|
|
1766
|
+
>
|
|
1767
|
+
新增返回值
|
|
1768
|
+
</Button>
|
|
1769
|
+
</div>
|
|
1770
|
+
{(isHaveRuleReturnConfig &&
|
|
1771
|
+
this.renderResItem(
|
|
1772
|
+
itemDetail,
|
|
1773
|
+
parentDetail,
|
|
1774
|
+
ruleReturnConfig,
|
|
1775
|
+
classDataIndex,
|
|
1776
|
+
disabled,
|
|
1777
|
+
RuleActionItemStyle,
|
|
1778
|
+
)) ||
|
|
1779
|
+
null}
|
|
1780
|
+
{(isHaveRuleTypeData &&
|
|
1781
|
+
this.renderActionList(
|
|
1782
|
+
itemDetail,
|
|
1783
|
+
parentDetail,
|
|
1784
|
+
handleRuleTypeData,
|
|
1785
|
+
selectRuleActionData,
|
|
1786
|
+
classDataIndex,
|
|
1787
|
+
disabled,
|
|
1788
|
+
RuleActionItemStyle,
|
|
1789
|
+
)) ||
|
|
1790
|
+
null}
|
|
1791
|
+
</div>
|
|
1792
|
+
);
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1795
|
+
//添加同一层级条件
|
|
1796
|
+
addPeerRule = (itemDetail) => {
|
|
1797
|
+
const { ruleClassData } = this.state;
|
|
1798
|
+
const { callBack, disabled } = this.props;
|
|
1799
|
+
if (disabled) return;
|
|
1800
|
+
itemDetail.subExpression.push({
|
|
1801
|
+
// "expressionType": "relation",
|
|
1802
|
+
operationType: 'relation',
|
|
1803
|
+
operationCode: '',
|
|
1804
|
+
propertyPath: '',
|
|
1805
|
+
params: [],
|
|
1806
|
+
paramNames: [],
|
|
1807
|
+
});
|
|
1808
|
+
this.setState(
|
|
1809
|
+
{
|
|
1810
|
+
ruleClassData,
|
|
1811
|
+
},
|
|
1812
|
+
() => {
|
|
1813
|
+
callBack(ruleClassData);
|
|
1814
|
+
},
|
|
1815
|
+
);
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1818
|
+
//添加子层级条件
|
|
1819
|
+
addChildRules = (itemDetail) => {
|
|
1820
|
+
const { ruleClassData } = this.state;
|
|
1821
|
+
const { callBack } = this.props;
|
|
1822
|
+
const initialData = JSON.parse(JSON.stringify(itemDetail));
|
|
1823
|
+
delete itemDetail.propertyPath;
|
|
1824
|
+
delete itemDetail.params;
|
|
1825
|
+
delete itemDetail.paramNames;
|
|
1826
|
+
delete itemDetail.dataTypeCode;
|
|
1827
|
+
delete itemDetail.elementId;
|
|
1828
|
+
delete itemDetail.elementName;
|
|
1829
|
+
delete itemDetail.metaObjectCode;
|
|
1830
|
+
// itemDetail.expressionType = 'logic';
|
|
1831
|
+
itemDetail.operationType = 'logic';
|
|
1832
|
+
itemDetail.operationCode = 'and';
|
|
1833
|
+
itemDetail.subExpression = [
|
|
1834
|
+
initialData,
|
|
1835
|
+
{
|
|
1836
|
+
// "expressionType": "relation",
|
|
1837
|
+
operationType: 'relation',
|
|
1838
|
+
operationCode: '',
|
|
1839
|
+
propertyPath: '',
|
|
1840
|
+
params: [],
|
|
1841
|
+
paramNames: [],
|
|
1842
|
+
},
|
|
1843
|
+
];
|
|
1844
|
+
this.setState(
|
|
1845
|
+
{
|
|
1846
|
+
ruleClassData,
|
|
1847
|
+
},
|
|
1848
|
+
() => {
|
|
1849
|
+
callBack(ruleClassData);
|
|
1850
|
+
},
|
|
1851
|
+
);
|
|
1852
|
+
};
|
|
1853
|
+
|
|
1854
|
+
handleDeleteRule = (itemDetail, parentDetail, classDataIndex) => {
|
|
1855
|
+
const { ruleClassData } = this.state;
|
|
1856
|
+
const { callBack } = this.props;
|
|
1857
|
+
if (parentDetail.ruleName) {
|
|
1858
|
+
//删除根规则层级最后一条时整个规则项删除
|
|
1859
|
+
ruleClassData.splice(classDataIndex, 1);
|
|
1860
|
+
} else {
|
|
1861
|
+
let deleteItemIndex = parentDetail.subExpression.findIndex(
|
|
1862
|
+
(detailItem) =>
|
|
1863
|
+
JSON.stringify(itemDetail) == JSON.stringify(detailItem),
|
|
1864
|
+
);
|
|
1865
|
+
if (parentDetail.subExpression.length > 2) {
|
|
1866
|
+
parentDetail.subExpression.splice(deleteItemIndex, 1);
|
|
1867
|
+
} else {
|
|
1868
|
+
parentDetail.subExpression.splice(deleteItemIndex, 1);
|
|
1869
|
+
// parentDetail.expressionType = parentDetail.subExpression[0].expressionType;
|
|
1870
|
+
parentDetail.operationCode =
|
|
1871
|
+
parentDetail.subExpression[0].operationCode;
|
|
1872
|
+
parentDetail.operationType =
|
|
1873
|
+
parentDetail.subExpression[0].operationType;
|
|
1874
|
+
|
|
1875
|
+
if (parentDetail.subExpression[0].operationType == 'logic') {
|
|
1876
|
+
parentDetail.subExpression = [
|
|
1877
|
+
...parentDetail.subExpression[0].subExpression,
|
|
1878
|
+
];
|
|
1879
|
+
} else {
|
|
1880
|
+
parentDetail.propertyPath =
|
|
1881
|
+
parentDetail.subExpression[0].propertyPath;
|
|
1882
|
+
parentDetail.params = [...parentDetail.subExpression[0].params];
|
|
1883
|
+
parentDetail.paramNames = parentDetail.subExpression[0].paramNames
|
|
1884
|
+
? [...parentDetail.subExpression[0].paramNames]
|
|
1885
|
+
: [];
|
|
1886
|
+
parentDetail.metaObjectCode =
|
|
1887
|
+
parentDetail.subExpression[0].metaObjectCode;
|
|
1888
|
+
parentDetail.elementId = parentDetail.subExpression[0].elementId;
|
|
1889
|
+
parentDetail.elementName = parentDetail.subExpression[0].elementName;
|
|
1890
|
+
parentDetail.dataTypeCode =
|
|
1891
|
+
parentDetail.subExpression[0].dataTypeCode;
|
|
1892
|
+
delete parentDetail.subExpression;
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
this.setState(
|
|
1897
|
+
{
|
|
1898
|
+
ruleClassData,
|
|
1899
|
+
},
|
|
1900
|
+
() => {
|
|
1901
|
+
callBack(ruleClassData);
|
|
1902
|
+
},
|
|
1903
|
+
);
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
handleLogicalTypeChange = (itemDetail, type) => {
|
|
1907
|
+
const { ruleClassData } = this.state;
|
|
1908
|
+
const { callBack } = this.props;
|
|
1909
|
+
itemDetail.operationCode = type;
|
|
1910
|
+
this.setState(
|
|
1911
|
+
{
|
|
1912
|
+
ruleClassData,
|
|
1913
|
+
},
|
|
1914
|
+
() => {
|
|
1915
|
+
callBack(ruleClassData);
|
|
1916
|
+
},
|
|
1917
|
+
);
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
// 新增执行顺序
|
|
1921
|
+
handleSelectRuleAction = (keys, classDataIndex, callback) => {
|
|
1922
|
+
callback();
|
|
1923
|
+
const { callBack } = this.props;
|
|
1924
|
+
const { ruleClassData } = this.state;
|
|
1925
|
+
ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
|
|
1926
|
+
classDataIndex
|
|
1927
|
+
].extraInfo.execute.map((i) => {
|
|
1928
|
+
if (i.code && keys.some((r) => r === i.code) && !i.isSelected) {
|
|
1929
|
+
return { ...i, isSelected: true };
|
|
1930
|
+
}
|
|
1931
|
+
return i;
|
|
1932
|
+
});
|
|
1933
|
+
// 处理数据
|
|
1934
|
+
this.setState(
|
|
1935
|
+
{
|
|
1936
|
+
ruleClassData,
|
|
1937
|
+
},
|
|
1938
|
+
() => {
|
|
1939
|
+
callBack(ruleClassData);
|
|
1940
|
+
},
|
|
1941
|
+
);
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
handleDeleteRuleAction = (classDataIndex, functionCode) => {
|
|
1945
|
+
const { callBack } = this.props;
|
|
1946
|
+
const { ruleClassData } = this.state;
|
|
1947
|
+
ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
|
|
1948
|
+
classDataIndex
|
|
1949
|
+
].extraInfo.execute.map((i) => {
|
|
1950
|
+
if (i.code && functionCode === i.code && i.isSelected) {
|
|
1951
|
+
return { ...i, isSelected: false };
|
|
1952
|
+
}
|
|
1953
|
+
return i;
|
|
1954
|
+
});
|
|
1955
|
+
// 处理数据
|
|
1956
|
+
this.setState(
|
|
1957
|
+
{
|
|
1958
|
+
ruleClassData,
|
|
1959
|
+
},
|
|
1960
|
+
() => {
|
|
1961
|
+
callBack(ruleClassData);
|
|
1962
|
+
},
|
|
1963
|
+
);
|
|
1964
|
+
};
|
|
1965
|
+
|
|
1966
|
+
render() {
|
|
1967
|
+
const { onlyOneRule, callBack } = this.props;
|
|
1968
|
+
const { ruleClassData, modalParams } = this.state;
|
|
1969
|
+
return (
|
|
1970
|
+
<div className={'base_rule'}>
|
|
1971
|
+
<div className={'base_rule_content'}>
|
|
1972
|
+
<div
|
|
1973
|
+
style={{
|
|
1974
|
+
display: onlyOneRule ? 'none' : 'block',
|
|
1975
|
+
}}
|
|
1976
|
+
className={'base_rule_line_title'}
|
|
1977
|
+
>
|
|
1978
|
+
<Button
|
|
1979
|
+
onClick={this.handleAddRule}
|
|
1980
|
+
className={'base_rule_btn_style'}
|
|
1981
|
+
type="link"
|
|
1982
|
+
>
|
|
1983
|
+
新增规则
|
|
1984
|
+
</Button>
|
|
1985
|
+
</div>
|
|
1986
|
+
<div>{this.renderRuleContent()}</div>
|
|
1987
|
+
</div>
|
|
1988
|
+
{(modalParams.visible && (
|
|
1989
|
+
<Modal
|
|
1990
|
+
title={`新增动作`}
|
|
1991
|
+
visible={modalParams.visible}
|
|
1992
|
+
onCancel={() => {
|
|
1993
|
+
this.setState({
|
|
1994
|
+
modalParams: { ...modalParams, visible: false },
|
|
1995
|
+
});
|
|
1996
|
+
}}
|
|
1997
|
+
maskClosable={false}
|
|
1998
|
+
destroyOnClose
|
|
1999
|
+
footer={null}
|
|
2000
|
+
>
|
|
2001
|
+
<Table
|
|
2002
|
+
rowSelection={{
|
|
2003
|
+
onChange: (keys, selectRows) => {
|
|
2004
|
+
this.handleSelectRuleAction(
|
|
2005
|
+
keys,
|
|
2006
|
+
modalParams.classDataIndex,
|
|
2007
|
+
() => {
|
|
2008
|
+
this.setState({
|
|
2009
|
+
modalParams: { ...modalParams, visible: false },
|
|
2010
|
+
});
|
|
2011
|
+
},
|
|
2012
|
+
);
|
|
2013
|
+
},
|
|
2014
|
+
}}
|
|
2015
|
+
columns={[
|
|
2016
|
+
{
|
|
2017
|
+
title: '执行动作名称',
|
|
2018
|
+
key: 'functionName',
|
|
2019
|
+
dataIndex: 'functionName',
|
|
2020
|
+
},
|
|
2021
|
+
]}
|
|
2022
|
+
dataSource={modalParams?.ruleActionData}
|
|
2023
|
+
rowKey={'code'}
|
|
2024
|
+
/>
|
|
2025
|
+
</Modal>
|
|
2026
|
+
)) ||
|
|
2027
|
+
null}
|
|
2028
|
+
</div>
|
|
2029
|
+
);
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
export default RuleObjectComponent;
|