@bit-sun/business-component 3.1.6 → 3.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +5 -5
  3. package/.gitlab-ci.yml +179 -179
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +74 -74
  7. package/README.md +27 -27
  8. package/dist/index.esm.js +210 -154
  9. package/dist/index.js +210 -153
  10. package/dist/utils/utils.d.ts +1 -0
  11. package/docs/index.md +21 -21
  12. package/lib/assets/drag.svg +17 -17
  13. package/lib/assets/exportFail.svg +37 -37
  14. package/lib/assets/exportProcessing.svg +28 -28
  15. package/lib/assets/exportSuccess.svg +34 -34
  16. package/lib/assets/label_icon_bottom.svg +25 -25
  17. package/lib/assets/upExport.svg +22 -22
  18. package/package.json +88 -88
  19. package/src/assets/32.svg +27 -27
  20. package/src/assets/addIcon.svg +17 -17
  21. package/src/assets/allfunc.svg +27 -27
  22. package/src/assets/arrowRight.svg +24 -24
  23. package/src/assets/arrow_top.svg +17 -17
  24. package/src/assets/btn-delete.svg +29 -29
  25. package/src/assets/btn-edit.svg +19 -19
  26. package/src/assets/btn-more.svg +17 -17
  27. package/src/assets/btn-submit.svg +19 -19
  28. package/src/assets/caidan.svg +11 -11
  29. package/src/assets/close.svg +26 -26
  30. package/src/assets/drag.svg +17 -17
  31. package/src/assets/exportFail.svg +37 -37
  32. package/src/assets/exportProcessing.svg +28 -28
  33. package/src/assets/exportSuccess.svg +34 -34
  34. package/src/assets/fixed-left-active.svg +11 -11
  35. package/src/assets/fixed-left.svg +15 -15
  36. package/src/assets/fixed-right-active.svg +11 -11
  37. package/src/assets/fixed-right.svg +15 -15
  38. package/src/assets/guanbi.svg +15 -15
  39. package/src/assets/icon-quanping.svg +15 -15
  40. package/src/assets/icon-shezhi.svg +17 -17
  41. package/src/assets/label_icon_bottom.svg +25 -25
  42. package/src/assets/list-no-img.svg +21 -21
  43. package/src/assets/morentouxiang-32.svg +23 -23
  44. package/src/assets/scanning.svg +24 -24
  45. package/src/assets/upExport.svg +22 -22
  46. package/src/common/ENUM.ts +41 -41
  47. package/src/components/Business/AddSelectBusiness/index.md +398 -398
  48. package/src/components/Business/AddSelectBusiness/index.tsx +1116 -1116
  49. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +112 -112
  50. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  51. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  52. package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +193 -193
  53. package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +10 -10
  54. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  55. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  56. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  58. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  59. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  60. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  61. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  62. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  63. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  64. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +163 -163
  65. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  66. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  67. package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +8 -8
  68. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +172 -172
  69. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  70. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  71. package/src/components/Business/BsLayouts/index.less +79 -79
  72. package/src/components/Business/BsLayouts/index.tsx +1606 -1606
  73. package/src/components/Business/BsLayouts/service.ts +10 -10
  74. package/src/components/Business/BsLayouts/utils.tsx +205 -205
  75. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -566
  76. package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +5 -5
  77. package/src/components/Business/BsSulaQueryTable/index.less +227 -227
  78. package/src/components/Business/BsSulaQueryTable/index.tsx +765 -772
  79. package/src/components/Business/BsSulaQueryTable/setting.tsx +888 -888
  80. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  81. package/src/components/Business/BsSulaQueryTable/utils.tsx +709 -709
  82. package/src/components/Business/CommodityEntry/index.md +84 -84
  83. package/src/components/Business/CommodityEntry/index.tsx +82 -82
  84. package/src/components/Business/CommonAlert/index.tsx +23 -23
  85. package/src/components/Business/CommonGuideWrapper/index.less +121 -121
  86. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  87. package/src/components/Business/CommonGuideWrapper/index.tsx +94 -94
  88. package/src/components/Business/DetailPageWrapper/index.less +87 -87
  89. package/src/components/Business/DetailPageWrapper/index.tsx +327 -327
  90. package/src/components/Business/DetailPageWrapper/utils.tsx +166 -166
  91. package/src/components/Business/HomePageWrapper/index.less +33 -33
  92. package/src/components/Business/HomePageWrapper/index.md +45 -45
  93. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  94. package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +823 -823
  95. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
  96. package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -205
  97. package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
  98. package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
  99. package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
  100. package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
  101. package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
  102. package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
  103. package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
  104. package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
  105. package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
  106. package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
  107. package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
  108. package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
  109. package/src/components/Business/JsonQueryTable/function.ts +62 -62
  110. package/src/components/Business/JsonQueryTable/index.less +16 -16
  111. package/src/components/Business/JsonQueryTable/index.md +328 -328
  112. package/src/components/Business/JsonQueryTable/index.tsx +534 -534
  113. package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
  114. package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
  115. package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
  116. package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
  117. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
  118. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
  119. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
  120. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
  121. package/src/components/Business/JsonQueryTable/static.ts +450 -450
  122. package/src/components/Business/SearchSelect/BusinessUtils.tsx +2162 -2162
  123. package/src/components/Business/SearchSelect/common.ts +134 -134
  124. package/src/components/Business/SearchSelect/index.md +1512 -1512
  125. package/src/components/Business/SearchSelect/index.tsx +55 -55
  126. package/src/components/Business/SearchSelect/utils.ts +125 -125
  127. package/src/components/Business/StateFlow/index.less +130 -130
  128. package/src/components/Business/StateFlow/index.md +60 -60
  129. package/src/components/Business/StateFlow/index.tsx +29 -29
  130. package/src/components/Business/TreeSearchSelect/index.md +211 -211
  131. package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
  132. package/src/components/Business/TreeSearchSelect/utils.ts +104 -104
  133. package/src/components/Business/columnSettingTable/columnSetting.tsx +816 -816
  134. package/src/components/Business/columnSettingTable/index.less +253 -253
  135. package/src/components/Business/columnSettingTable/index.md +357 -357
  136. package/src/components/Business/columnSettingTable/index.tsx +225 -226
  137. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +232 -233
  138. package/src/components/Business/columnSettingTable/utils.tsx +87 -87
  139. package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
  140. package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
  141. package/src/components/Business/moreTreeTable/index.less +99 -99
  142. package/src/components/Business/moreTreeTable/index.md +448 -448
  143. package/src/components/Business/moreTreeTable/index.tsx +387 -387
  144. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  145. package/src/components/Functional/AccessWrapper/index.tsx +33 -33
  146. package/src/components/Functional/AddSelect/helps.ts +81 -81
  147. package/src/components/Functional/AddSelect/index.less +367 -367
  148. package/src/components/Functional/AddSelect/index.md +155 -155
  149. package/src/components/Functional/AddSelect/index.tsx +1064 -1065
  150. package/src/components/Functional/AuthButton/index.tsx +15 -15
  151. package/src/components/Functional/BillEntry/index.less +371 -371
  152. package/src/components/Functional/BillEntry/index.md +39 -39
  153. package/src/components/Functional/BillEntry/index.tsx +771 -772
  154. package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
  155. package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
  156. package/src/components/Functional/BsAntdSula/index.ts +2 -2
  157. package/src/components/Functional/DataImport/index.less +63 -63
  158. package/src/components/Functional/DataImport/index.md +44 -44
  159. package/src/components/Functional/DataImport/index.tsx +783 -783
  160. package/src/components/Functional/DataValidation/index.less +63 -63
  161. package/src/components/Functional/DataValidation/index.md +52 -52
  162. package/src/components/Functional/DataValidation/index.tsx +788 -788
  163. package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
  164. package/src/components/Functional/EllipsisTooltip/index.js +36 -36
  165. package/src/components/Functional/EllipsisTooltip/index.md +30 -30
  166. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  167. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +65 -65
  168. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  169. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  170. package/src/components/Functional/QueryMutipleInput/index.tsx +129 -129
  171. package/src/components/Functional/SearchSelect/index.less +121 -121
  172. package/src/components/Functional/SearchSelect/index.md +141 -141
  173. package/src/components/Functional/SearchSelect/index.tsx +1041 -1034
  174. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  175. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  176. package/src/components/Functional/TreeSearchSelect/index.tsx +224 -224
  177. package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
  178. package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
  179. package/src/components/Solution/RuleComponent/RenderCompItem.tsx +670 -670
  180. package/src/components/Solution/RuleComponent/index.d.ts +29 -29
  181. package/src/components/Solution/RuleComponent/index.js +1601 -1601
  182. package/src/components/Solution/RuleComponent/index.less +247 -247
  183. package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
  184. package/src/components/Solution/RuleComponent/ruleFiled.js +2293 -2293
  185. package/src/components/Solution/RuleComponent/services.ts +13 -13
  186. package/src/components/Solution/RuleComponent/util.js +143 -143
  187. package/src/components/Solution/RuleSetter/RuleInstance.tsx +6 -6
  188. package/src/components/Solution/RuleSetter/baseRule.tsx +394 -394
  189. package/src/components/Solution/RuleSetter/function.ts +437 -437
  190. package/src/components/Solution/RuleSetter/index.less +221 -221
  191. package/src/components/Solution/RuleSetter/index.tsx +208 -208
  192. package/src/components/Solution/RuleSetter/service.js +276 -276
  193. package/src/index.ts +41 -41
  194. package/src/plugin/TableColumnSetting/index.less +247 -247
  195. package/src/plugin/TableColumnSetting/index.md +50 -50
  196. package/src/plugin/TableColumnSetting/index.tsx +725 -725
  197. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  198. package/src/styles/bsDefault.less +1933 -1933
  199. package/src/utils/CheckOneUser/index.md +39 -39
  200. package/src/utils/CheckOneUser/index.ts +51 -51
  201. package/src/utils/CustomLoginInfo.ts +55 -55
  202. package/src/utils/LocalstorageUtils.ts +134 -134
  203. package/src/utils/TableUtils.less +51 -51
  204. package/src/utils/TableUtils.tsx +691 -691
  205. package/src/utils/auth.ts +38 -38
  206. package/src/utils/businessUtils.ts +434 -434
  207. package/src/utils/checkUtils.ts +39 -39
  208. package/src/utils/constant.ts +38 -38
  209. package/src/utils/enumConfig.ts +17 -17
  210. package/src/utils/getFormMode.js +12 -12
  211. package/src/utils/index.ts +19 -19
  212. package/src/utils/request.ts +53 -53
  213. package/src/utils/requestUtils.ts +193 -193
  214. package/src/utils/serialize.js +7 -7
  215. package/src/utils/utils.ts +245 -238
  216. package/src/utils/xlsxUtil.tsx +145 -145
  217. package/tsconfig.json +29 -29
  218. package/typings.d.ts +4 -4
  219. package/.yarnclean +0 -45
@@ -1,1601 +1,1601 @@
1
- import React, { Component } from 'react';
2
- // @ts-ignore
3
- import _ from 'lodash';
4
- import moment from 'moment';
5
- import RuleField from './ruleFiled';
6
- import {
7
- Select,
8
- Button,
9
- Radio,
10
- Switch,
11
- Checkbox,
12
- InputNumber,
13
- TreeSelect,
14
- Popover,
15
- Input,
16
- DatePicker,
17
- Table,
18
- Divider,
19
- Space,
20
- Form as AntdForm,
21
- Modal,
22
- message,
23
- } from 'antd';
24
- import {
25
- PlusCircleOutlined,
26
- MinusCircleOutlined,
27
- DownOutlined,
28
- } from '@ant-design/icons';
29
- import './index.less';
30
- import {
31
- relateItems,
32
- getSpecialPropertyCode,
33
- getPropertyCode,
34
- isObj,
35
- } from './util';
36
- import { getDictionarySource, uuid } from '../../../utils/utils';
37
- import {
38
- BusinessSearchSelect,
39
- BusinessTreeSearchSelect,
40
- EllipsisTooltip,
41
- BsCascader,
42
- } from '../../../index';
43
- import { request } from 'bssula';
44
- import Formula from './Formula';
45
- import RenderSpecificAction from './renderSpecificAction';
46
- import RenderCompItem from './RenderCompItem';
47
-
48
- const { RangePicker } = DatePicker;
49
-
50
- class RuleObjectComponent extends Component {
51
- constructor(props) {
52
- super(props);
53
- this.state = {
54
- editNameIndex: 0,
55
- isEdit: false,
56
- ruleTreeData: [],
57
- initialRegularList: [],
58
- operationList: [],
59
- ruleClassData: [],
60
- modalParams: {
61
- visible: false,
62
- },
63
- };
64
- this.propertyCodeToRangeIdMap = {};
65
- this.dictCodeToRangeIdMap = {};
66
- this.dynamicDictCodeToRangeIdMap = {};
67
- }
68
-
69
- componentDidMount(props) {
70
- const { ruleClassData, operationList, regularDataList } = this.props;
71
- this.setRegularData(regularDataList);
72
- this.setState({
73
- ruleClassData,
74
- operationList,
75
- });
76
- }
77
-
78
- componentWillReceiveProps(nextProps) {
79
- const { ruleClassData, operationList, regularDataList } = this.state;
80
- if (
81
- nextProps.ruleClassData &&
82
- this.props.ruleClassData != nextProps.ruleClassData &&
83
- JSON.stringify(nextProps.ruleClassData) != JSON.stringify(ruleClassData)
84
- ) {
85
- this.setState({
86
- ruleClassData: nextProps.ruleClassData,
87
- });
88
- }
89
-
90
- if (
91
- nextProps.operationList &&
92
- this.props.operationList != nextProps.operationList
93
- ) {
94
- this.setState({
95
- operationList: nextProps.operationList,
96
- });
97
- }
98
-
99
- if (
100
- nextProps.regularDataList &&
101
- this.props.regularDataList != nextProps.regularDataList
102
- ) {
103
- this.setRegularData(nextProps.regularDataList);
104
- }
105
- }
106
-
107
- setRegularData = (regularDataList) => {
108
- this.propertyCodeToRangeIdMap = {};
109
- this.dictCodeToRangeIdMap = {};
110
- this.dynamicDictCodeToRangeIdMap = {};
111
- const finalTreeDatas = regularDataList.map((item) => {
112
- return {
113
- title: item.name,
114
- key: item.id,
115
- pValue: item.code, // 后端存path key, children同理
116
- value: item.id, // 前端选中唯一key, children同理
117
- id: item.id, // 前端选中回显示唯一key, children同理
118
- ...(item?.propertyList?.length
119
- ? {
120
- children: item.propertyList.map((element) => {
121
- const infoVo = (element.info && JSON.parse(element.info)) || {};
122
- if (element.choiceType === 30) {
123
- this.dynamicDictCodeToRangeIdMap[
124
- `${item.code}.${element.code}`
125
- ] = infoVo?.dictionaryCode;
126
- } else if (element.choiceType === 20) {
127
- this.dictCodeToRangeIdMap[`${item.code}.${element.code}`] =
128
- infoVo?.dictionaryCode;
129
- } else if (element.choiceType === 10) {
130
- const list =
131
- (Object.keys(infoVo).length &&
132
- infoVo.enumeration &&
133
- Object.keys(infoVo.enumeration).map((i) => ({
134
- code: i,
135
- name: infoVo.enumeration[i],
136
- }))) ||
137
- undefined;
138
- this.propertyCodeToRangeIdMap[
139
- `${item.code}.${element.code}`
140
- ] = list;
141
- } else {
142
- // this.propertyCodeToRangeIdMap[
143
- // `${item.code}.${element.code}`
144
- // ] = Object.keys(infoVo).length ? infoVo : undefined;
145
- }
146
- let child = {
147
- title: `${item.name}-${element.name}`,
148
- key: element.id,
149
- pValue: this.props.isRouteProperty ? `${item.code}.${element.code}` : element.code,
150
- value: element.id,
151
- id: element.id,
152
- dataTypeCode: element.valueType,
153
- dataChoiceBusinessType: element.choiceType,
154
- dataInputBusinessType: element.inputType,
155
- info: element.info,
156
- };
157
- if (element?.propertyList?.length) {
158
- child.children = this.parseChildTreeData(
159
- element.propertyList,
160
- `${element.code}`,
161
- `${item.name}-${element.name}`,
162
- item.code,
163
- );
164
- child.isLeaf = false;
165
- } else {
166
- child.isLeaf = true;
167
- child.metaObjectCode = item.code;
168
- }
169
- return child;
170
- }),
171
- }
172
- : {
173
- isLeaf: this.props.metaObjectCode ? true : false,
174
- metaObjectCode: this.props.metaObjectCode || item.code,
175
- ...item,
176
- dataTypeCode: item.valueType,
177
- dataChoiceBusinessType: item.choiceType,
178
- dataInputBusinessType: item.inputType,
179
- }),
180
- };
181
- });
182
- this.setState({
183
- initialRegularList: [...regularDataList],
184
- ruleTreeData: finalTreeDatas,
185
- });
186
- };
187
-
188
- parseChildTreeData = (list, parentKey, parentTitle, rootObjCode) => {
189
- return list.map((element) => {
190
- const infoVo = (element.info && JSON.parse(element.info)) || {};
191
- if (element.choiceType === 30) {
192
- this.dynamicDictCodeToRangeIdMap[
193
- `${rootObjCode}.${parentKey}.${element.code}`
194
- ] = infoVo?.dictionaryCode;
195
- } else if (element.choiceType === 20) {
196
- this.dictCodeToRangeIdMap[
197
- `${rootObjCode}.${parentKey}.${element.code}`
198
- ] = infoVo?.dictionaryCode;
199
- } else if (element.choiceType === 10) {
200
- // FIXME http://192.168.13.78/mep-fed-group/web/libs/business-component/-/merge_requests/45#note_115669
201
- const list =
202
- (Object.keys(infoVo).length &&
203
- infoVo.enumeration &&
204
- Object.keys(infoVo.enumeration).map((i) => ({
205
- code: i,
206
- name: infoVo.enumeration[i],
207
- }))) ||
208
- undefined;
209
- this.propertyCodeToRangeIdMap[
210
- `${rootObjCode}.${parentKey}.${element.code}`
211
- ] = list;
212
- } else {
213
- // this.propertyCodeToRangeIdMap[
214
- // `${rootObjCode}.${parentKey}.${element.code}`
215
- // ] = Object.keys(infoVo).length ? infoVo : undefined;
216
- }
217
- let child = {
218
- title: `${parentTitle}-${element.name}`,
219
- key: `${parentKey}.${element.id}`,
220
- pValue: `${parentKey}.${element.code}`,
221
- value: element.id,
222
- id: element.id,
223
- dataTypeCode: element.valueType,
224
- dataChoiceBusinessType: element.choiceType,
225
- dataInputBusinessType: element.inputType,
226
- info: element.info,
227
- };
228
- if (element.propertyList) {
229
- child.children = this.parseChildTreeData(
230
- element.propertyList,
231
- `${parentKey}.${element.code}`,
232
- `${parentTitle}-${element.name}`,
233
- rootObjCode,
234
- );
235
- child.isLeaf = false;
236
- } else {
237
- child.isLeaf = true;
238
- child.metaObjectCode = rootObjCode;
239
- }
240
- return child;
241
- });
242
- };
243
-
244
- getDataTypeOperateList = (id) => {
245
- const { operationList, initialRegularList } = this.state;
246
- // let typeId = '';
247
- // initialRegularList.forEach(item => {
248
- // item.metaObjectResDto.elementResDtos.forEach(element => {
249
- // if (element.id == id) {
250
- // typeId = element.dataTypeCode;
251
- // }
252
- // })
253
- // })
254
- const list =
255
- operationList.find((item) => item.code == id)?.operationList || [];
256
- return this.props.isShowAllOperationList ? operationList : list;
257
- };
258
-
259
- handleValuesChange = (itemDetail, newValues, newValueNames) => {
260
- const { ruleClassData } = this.state;
261
- const { callBack } = this.props;
262
- itemDetail.params = [...newValues];
263
- itemDetail.paramNames = [...newValueNames];
264
- this.setState(
265
- {
266
- ruleClassData,
267
- },
268
- () => {
269
- callBack(ruleClassData);
270
- },
271
- );
272
- };
273
-
274
- setRelateDataList = (classDataItem) => {
275
- let relateDatas = {};
276
- relateItems.forEach((relateItem) => {
277
- this.getRelateData(
278
- relateItem,
279
- classDataItem.subExpression || {},
280
- relateDatas,
281
- );
282
- });
283
- return relateDatas;
284
- };
285
-
286
- getRelateData = (relateItem, classDataItem, relateDatas) => {
287
- if (
288
- classDataItem?.propertyPath &&
289
- getPropertyCode(classDataItem.propertyPath) == relateItem.propertyCode
290
- ) {
291
- relateDatas[relateItem.propertyCode] = classDataItem.params;
292
- } else {
293
- if (classDataItem.subExpression && classDataItem.subExpression.length) {
294
- classDataItem.subExpression.forEach((classData) => {
295
- this.getRelateData(relateItem, classData, relateDatas);
296
- });
297
- }
298
- }
299
- };
300
-
301
- renderRuleContent = () => {
302
- const { ruleClassData, currentRuleName, isEdit, editNameIndex } =
303
- this.state;
304
- const {
305
- ruleType,
306
- callBack,
307
- accountList = [],
308
- disabled,
309
- ruleTypeData,
310
- canDelete = false,
311
- ruleReturnConfig = [],
312
- onlyOneRule,
313
- onlyCondition,
314
- onlyAction,
315
- handleOperatingAction,
316
- ruleGroupInfo,
317
- needShowAction = true,
318
- } = this.props;
319
- const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1; // 业务调用规则实例设计器
320
- const ruleGroupName = ruleGroupInfo?.ruleGroupList?.[0]?.name || '规则分组';
321
- const priorityList = (ruleGroupInfo?.groupOtherPriorityList || []).concat(ruleClassData|| []);
322
- const canChangePriority = ruleGroupInfo?.canChangePriority;
323
- const isRuleGroupInstance = ruleGroupInfo?.type == 'group-instance'; // 规则组展示规则实例设计器
324
- const titlePre = {
325
- position: 'relative',
326
- top: '-10px',
327
- left: '20px',
328
- background: '#fff',
329
- width: '160px',
330
- textAlign: 'center',
331
- }; // height:22
332
- const titleSubCommon = {
333
- display: 'flex',
334
- justifyContent: 'center',
335
- }
336
- const titleSubPre = {
337
- ...titlePre,
338
- ...titleSubCommon,
339
- width: '166px',
340
- top: '-32px', // titlePre(height + top)
341
- left: '200px', // titlePre(2 * left + width) 左右间距为titlePre的left: 20px
342
- }; // height: 24
343
- const titleSubPre2 = {
344
- ...titlePre,
345
- ...titleSubCommon,
346
- width: '240px',
347
- top: '-56px', // titleSubPre(top + height)
348
- left: '386px', // titlePre(left + width + 20)
349
- }
350
- const ruleListBox = (!onlyOneRule || ruleGroupInfo) ? { border: '1px dashed #d9d9d9', marginBottom: 10, overflowX: 'clip' } : {};
351
- const isRuleActionConfig =
352
- ruleTypeData?.length || ruleReturnConfig?.length;
353
- return (
354
- <div>
355
- {ruleClassData.map((item, classDataIndex) => {
356
- let extraInfo = {};
357
- if (isRuleActionConfig) {
358
- const { response = [] } = item.extraInfo;
359
- extraInfo = {
360
- ...item.extraInfo,
361
- response:
362
- Object.prototype.toString.call(response) === '[object Object]'
363
- ? [response]
364
- : Array.isArray(response)
365
- ? response
366
- : [],
367
- };
368
- }
369
- let relateDatas = this.setRelateDataList(item);
370
- const sActionProps = {
371
- extraInfo,
372
- ruleTypeData,
373
- item,
374
- classDataIndex,
375
- handleOperatingAction,
376
- disabled,
377
- };
378
- return (
379
- <div style={ruleListBox}>
380
- {!onlyOneRule && !ruleGroupInfo && (
381
- <div style={titlePre}>规则{classDataIndex + 1}</div>
382
- )}
383
- {ruleGroupInfo && (
384
- <>
385
- <div style={titlePre}>
386
- <EllipsisTooltip
387
- visible={true}
388
- maxLength={10}
389
- title={ruleGroupName}
390
- />
391
- </div>
392
- {isRuleInstance && (
393
- <div style={titleSubPre}>
394
- <span style={{ marginRight: 10, display: 'block' }}>优先级</span>
395
- <Select
396
- size='small'
397
- disabled={canChangePriority ? !canChangePriority : disabled}
398
- style={{ width: 100 }}
399
- value={item.priority}
400
- onChange={(v) => {
401
- // 因为存在页签,前端校验不准确;而且若选择优先级之后想交换改也不方便,故交由后端校验
402
- // const isRepeate = priorityList.some((r) => r.priority == v)
403
- // if(isRepeate) {
404
- // message.warn('优先级不允许重复')
405
- // }
406
- // item.priority = isRepeate ? (item.priority||null) : v;
407
- item.priority = v
408
- this.setState(
409
- {
410
- ruleClassData,
411
- },
412
- () => {
413
- callBack(ruleClassData);
414
- },
415
- );
416
- }}
417
- >
418
- {priorityList?.map((s,sindex) => (
419
- <Option key={sindex+1} value={sindex+1}>{sindex+1}</Option>
420
- ))}
421
- </Select>
422
- </div>
423
- ) || null}
424
- {isRuleGroupInstance && (
425
- <div style={titleSubPre2}>
426
- <span style={{ marginRight: 10 }}>业务编码</span>
427
- <EllipsisTooltip
428
- visible={true}
429
- maxLength={24}
430
- title={item.extStrField01}
431
- />
432
- </div>
433
- )}
434
- </>
435
- )}
436
- <div
437
- style={{
438
- textAlign: 'right',
439
- marginTop: '-24px',
440
- display: canDelete ? 'block' : 'none',
441
- }}
442
- >
443
- <Button
444
- disabled={disabled}
445
- onClick={() => {
446
- const { ruleClassData } = this.state;
447
- ruleClassData.splice(classDataIndex, 1);
448
- this.setState(
449
- {
450
- ruleClassData,
451
- },
452
- () => {
453
- callBack(ruleClassData);
454
- },
455
- );
456
- }}
457
- type="link"
458
- danger
459
- >
460
- 删除规则
461
- </Button>
462
- </div>
463
- <div>
464
- {/* <div style={{ display: isEdit && editNameIndex == index ? 'none' : 'block' }}>
465
- <span className={'rule_name_title}>
466
- {item.ruleName}
467
- </span>
468
- <EditOutlined
469
- onClick={() => {
470
- this.setState({
471
- editNameIndex: index,
472
- currentRuleName: item.ruleName,
473
- isEdit: true
474
- })
475
- }}
476
- />
477
- </div> */}
478
- <div
479
- style={{
480
- display:
481
- isEdit && editNameIndex == index ? 'block' : 'none',
482
- marginTop: '10px',
483
- }}
484
- >
485
- <Input
486
- disabled={disabled}
487
- value={currentRuleName}
488
- style={{ width: '200px' }}
489
- onChange={(e) => {
490
- this.setState({
491
- currentRuleName: e.target.value,
492
- });
493
- }}
494
- />
495
- <Button
496
- disabled={disabled}
497
- type="link"
498
- onClick={() => {
499
- const { ruleClassData, currentRuleName } = this.state;
500
- ruleClassData[editNameIndex].ruleName = currentRuleName;
501
- this.setState({
502
- ruleClassData,
503
- isEdit: false,
504
- });
505
- }}
506
- >
507
- 保存
508
- </Button>
509
- <Button
510
- disabled={disabled}
511
- type="link"
512
- onClick={() => {
513
- this.setState({
514
- isEdit: false,
515
- });
516
- }}
517
- >
518
- 取消
519
- </Button>
520
- </div>
521
- </div>
522
- <div>
523
- {(onlyAction && <RenderSpecificAction {...sActionProps} />) || (
524
- <div className={'base_rule_line_content'}>
525
- <div className={'base_rule_item2'}>
526
- {item.subExpression &&
527
- this.renderRuleItem(
528
- item.subExpression,
529
- item,
530
- 1,
531
- classDataIndex,
532
- relateDatas,
533
- )}
534
- </div>
535
- {needShowAction && (
536
- <div className={'base_rule_item3'}>
537
- {(extraInfo &&
538
- isRuleActionConfig &&
539
- (!onlyCondition || !onlyAction) &&
540
- this.renderRuleTypeItem(
541
- extraInfo,
542
- item,
543
- 1,
544
- classDataIndex,
545
- ruleTypeData,
546
- ruleReturnConfig,
547
- isRuleInstance
548
- )) ||
549
- null}
550
- </div>
551
- ) || null}
552
- </div>
553
- )}
554
- </div>
555
- </div>
556
- );
557
- })}
558
- </div>
559
- );
560
- };
561
-
562
- handleAddRule = () => {
563
- const { ruleClassData } = this.state;
564
- const { callBack, ruleTypeData=[], ruleGroupInfo, ruleReturnConfig=[] } = this.props;
565
- const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1;
566
- const initKongData = {
567
- ruleName: `规则${ruleClassData?.length + 1}`,
568
- subExpression: {
569
- // "expressionType": "relation",
570
- operationType: 'relation',
571
- propertyPath: '',
572
- params: [],
573
- paramNames: [],
574
- },
575
- extraInfo: {
576
- response: ruleReturnConfig?.map((s) => {
577
- return {
578
- code: s?.code,
579
- value: s?.defaultValue || '',
580
- enable: false,
581
- };
582
- })||[],
583
- execute: ruleTypeData?.map((s) => {
584
- return {
585
- priority: 1,
586
- code: s.code,
587
- properties: {
588
- configPropertyCode: 'configPropertyValue',
589
- },
590
- };
591
- })||[],
592
- },
593
- }
594
- const initTemplateData = ruleGroupInfo?.templateData && Object.keys(ruleGroupInfo?.templateData)?.length ? {
595
- ruleName: `规则${ruleClassData?.length + 1}`,
596
- ..._.cloneDeep(ruleGroupInfo?.templateData)
597
- } : initKongData;
598
- const initNewData = isRuleInstance ? initTemplateData : initKongData
599
- ruleClassData.push(initNewData);
600
- this.setState(
601
- {
602
- ruleClassData,
603
- },
604
- () => {
605
- callBack(ruleClassData);
606
- },
607
- );
608
- };
609
-
610
- // 树结构 转化成 平行树 (递归函数)
611
- coverToParallel = (treeData, result) => {
612
- treeData.forEach((el) => {
613
- result.push(el);
614
- if (el.children && el.children.length > 0) {
615
- // 子级递归
616
- this.coverToParallel(el.children, result);
617
- }
618
- });
619
- return result;
620
- };
621
-
622
- renderRuleItem = (
623
- itemDetail,
624
- parentDetail,
625
- floorIndex,
626
- classDataIndex,
627
- relateDatas,
628
- ) => {
629
- const { ruleTreeData } = this.state;
630
- const {
631
- callBack,
632
- initialThresholdQuery = {},
633
- disabled,
634
- systemVariableList,
635
- } = this.props;
636
- let thresholdQuery = {
637
- ...initialThresholdQuery,
638
- ...relateDatas,
639
- };
640
- let finalIndex = floorIndex + 1;
641
- let queryIdentify = '';
642
- let queryIdentifyType = '';
643
- if (
644
- this.propertyCodeToRangeIdMap[
645
- `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
646
- ]
647
- ) {
648
- queryIdentify =
649
- this.propertyCodeToRangeIdMap[
650
- `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
651
- ];
652
- queryIdentifyType = Array.isArray(queryIdentify)
653
- ? 'objectPropertyListIdentify'
654
- : 'objectPropertyCodeIdentify';
655
- } else if (
656
- getSpecialPropertyCode(getPropertyCode(itemDetail.propertyPath))
657
- ) {
658
- queryIdentify = getSpecialPropertyCode(
659
- getPropertyCode(itemDetail.propertyPath),
660
- );
661
- queryIdentifyType = 'specialPropertyIdentify';
662
- } else if (
663
- this.dictCodeToRangeIdMap[
664
- `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
665
- ]
666
- ) {
667
- queryIdentify =
668
- this.dictCodeToRangeIdMap[
669
- `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
670
- ];
671
- queryIdentifyType = 'dictCodeIdentify';
672
- } else if (
673
- this.dynamicDictCodeToRangeIdMap[
674
- `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
675
- ]
676
- ) {
677
- queryIdentify =
678
- this.dynamicDictCodeToRangeIdMap[
679
- `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
680
- ];
681
- queryIdentifyType = 'dynamicDictCodeIdentify';
682
- }
683
-
684
- const parallelTreeData = this.coverToParallel(ruleTreeData, []) || [];
685
- const currentTreeItem =
686
- itemDetail?.elementId &&
687
- parallelTreeData.find((i) => (i?.key?.indexOf('.') > -1 ? i.id : i.key) === itemDetail?.elementId);
688
- const dataChoiceBusinessType = currentTreeItem?.dataChoiceBusinessType;
689
- const dataInputBusinessType = currentTreeItem?.dataInputBusinessType;
690
- return (
691
- <div
692
- className={'rule_line_content'}
693
- style={{ display: 'flex', marginBottom: '0px', padding: '10px 0px' }}
694
- >
695
- <div
696
- className={'logical_operate_content'}
697
- style={{
698
- display: itemDetail.operationType == 'logic' ? 'block' : 'none',
699
- width: '60px',
700
- zIndex: 20,
701
- }}
702
- >
703
- <Popover
704
- content={
705
- <div>
706
- <p
707
- className={'choose_logical_type'}
708
- onClick={() => {
709
- this.handleLogicalTypeChange(itemDetail, 'or');
710
- }}
711
- >
712
- 或者
713
- </p>
714
- <p
715
- className={'choose_logical_type'}
716
- onClick={() => {
717
- this.handleLogicalTypeChange(itemDetail, 'and');
718
- }}
719
- >
720
- 并且
721
- </p>
722
- </div>
723
- }
724
- trigger="focus"
725
- >
726
- <Button
727
- disabled={disabled}
728
- type="link"
729
- className={'logical_item_btn'}
730
- >
731
- {itemDetail?.operationCode == 'or' ? '或者' : '并且'}
732
- <DownOutlined style={{ marginLeft: '6px' }} />
733
- </Button>
734
- </Popover>
735
- <span className={'top_line'}></span>
736
- <span className={'bottom_line'}></span>
737
- </div>
738
-
739
- <div style={{ flexGrow: 1 }}>
740
- {itemDetail.operationType == 'logic' ? (
741
- itemDetail?.subExpression?.map((item1) => {
742
- return this.renderRuleItem(
743
- item1,
744
- itemDetail,
745
- finalIndex,
746
- classDataIndex,
747
- relateDatas,
748
- );
749
- })
750
- ) : (
751
- <div style={{ display: 'flex', alignItems: 'center' }}>
752
- {/* todo */}
753
- <TreeSelect
754
- value={itemDetail.elementId}
755
- disabled={disabled}
756
- onChange={(value, name, nodeInfo) => {
757
- if (!nodeInfo.triggerNode.props.isLeaf) return; //只有最末端叶子节点可选中
758
- const { ruleClassData } = this.state;
759
- itemDetail.propertyPath = nodeInfo.triggerNode.props.pValue;
760
- itemDetail.params = [];
761
- itemDetail.paramNames = [];
762
- itemDetail.operationCode = '';
763
- itemDetail.elementId = nodeInfo.triggerNode.props.id;
764
- itemDetail.elementName = nodeInfo.triggerNode.props.title;
765
- itemDetail.dataTypeCode =
766
- nodeInfo.triggerNode.props.dataTypeCode;
767
- itemDetail.metaObjectCode =
768
- nodeInfo.triggerNode.props.metaObjectCode;
769
- itemDetail.isInsertParam = false;
770
- this.setState(
771
- {
772
- ruleClassData,
773
- },
774
- () => {
775
- callBack(ruleClassData);
776
- },
777
- );
778
- }}
779
- style={{ width: '200px' }}
780
- treeData={ruleTreeData}
781
- />
782
- <Select
783
- value={itemDetail?.operationCode || ''}
784
- disabled={disabled}
785
- style={{ width: '150px', marginLeft: '10px' }}
786
- onChange={(value) => {
787
- const { ruleClassData } = this.state;
788
- itemDetail.operationCode = value;
789
- this.setState(
790
- {
791
- ruleClassData,
792
- },
793
- () => {
794
- callBack(ruleClassData);
795
- },
796
- );
797
- }}
798
- >
799
- {this.getDataTypeOperateList(itemDetail.dataTypeCode).map(
800
- (item) => (
801
- <Select.Option value={item.code} key={item.code}>
802
- {item.name}
803
- </Select.Option>
804
- ),
805
- )}
806
- </Select>
807
- {!itemDetail?.isInsertParam ? (
808
- <RuleField
809
- customerWidth={this.props.customerWidth}
810
- selectOperation={itemDetail?.operationCode || ''}
811
- disabled={disabled}
812
- initialThresholdQuery={thresholdQuery}
813
- dataTypeCode={itemDetail?.dataTypeCode || ''}
814
- dataChoiceBusinessType={dataChoiceBusinessType || ''}
815
- dataInputBusinessType={dataInputBusinessType || ''}
816
- itemDetail={itemDetail}
817
- queryIdentifyType={queryIdentifyType}
818
- queryIdentify={queryIdentify}
819
- propertyCode={getPropertyCode(itemDetail.propertyPath)}
820
- // propertyCode={`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`}
821
- relateDatas={relateDatas}
822
- values={itemDetail.params || []}
823
- valueNames={itemDetail.paramNames || []}
824
- callback={(newValues, newValueNames) => {
825
- this.handleValuesChange(
826
- itemDetail,
827
- newValues,
828
- newValueNames,
829
- );
830
- }}
831
- />
832
- ) : null}
833
- <Select
834
- disabled={disabled}
835
- value={
836
- itemDetail?.systemCode || itemDetail?.params?.[0]?.replace('{', '').replace('}', '') ||
837
- ''
838
- } // systemCode兼容用户结算组织那边使用规则
839
- style={{
840
- width: '250px',
841
- marginLeft: '10px',
842
- display: itemDetail?.isInsertParam ? '' : 'none',
843
- }}
844
- onChange={(value) => {
845
- const { ruleClassData } = this.state;
846
- itemDetail.params = [(value && `{${value}}`) || ''];
847
- const name = systemVariableList.find(
848
- (i) => i.code == value,
849
- )?.name;
850
- itemDetail.paramNames = [name || ''];
851
- itemDetail.systemCode = value;
852
- this.setState(
853
- {
854
- ruleClassData,
855
- },
856
- () => {
857
- callBack(ruleClassData);
858
- },
859
- );
860
- }}
861
- >
862
- {systemVariableList?.length
863
- ? systemVariableList.map((item) => (
864
- <Select.Option value={item.code} key={item.code}>
865
- {item.name}
866
- </Select.Option>
867
- ))
868
- : null}
869
- </Select>
870
- <PlusCircleOutlined
871
- className={'icon_btn_style'}
872
- onClick={() => {
873
- this.addChildRules(itemDetail);
874
- }}
875
- style={{
876
- color: '#008fe0',
877
- marginLeft: '15px',
878
- display: floorIndex > 4 || disabled ? 'none' : 'inline-block',
879
- }}
880
- />
881
- <MinusCircleOutlined
882
- className={'icon_btn_style'}
883
- onClick={() => {
884
- this.handleDeleteRule(
885
- itemDetail,
886
- parentDetail,
887
- classDataIndex,
888
- );
889
- }}
890
- style={{
891
- color: 'gray',
892
- display: disabled ? 'none' : 'inline-block',
893
- }}
894
- />
895
- <Button
896
- type="link"
897
- disabled={
898
- disabled || (itemDetail.operationCode === '' || !itemDetail.operationCode
899
- ? true
900
- : false)
901
- }
902
- onClick={() => {
903
- const { ruleClassData } = this.state;
904
- if (systemVariableList && Array.isArray(systemVariableList) && systemVariableList.length && systemVariableList[0].code!== '-1' ) {
905
- itemDetail.isInsertParam = !itemDetail.isInsertParam;
906
- if (itemDetail.isInsertParam) {
907
- itemDetail.type = 10;
908
- itemDetail.paramNames = [];
909
- itemDetail.params = [];
910
- } else {
911
- itemDetail.systemCode = null;
912
- }
913
-
914
- this.setState(
915
- {
916
- ruleClassData,
917
- },
918
- () => {
919
- callBack(ruleClassData);
920
- },
921
- );
922
- } else {
923
- message.warn('未配置规则变量');
924
- }
925
- }}
926
- >
927
- {itemDetail?.isInsertParam ? '取消插入参数' : '插入参数'}
928
- </Button>
929
- </div>
930
- )}
931
- <div
932
- style={{
933
- display:
934
- itemDetail.operationType == 'logic' && !disabled
935
- ? 'block'
936
- : 'none',
937
- }}
938
- >
939
- <span
940
- style={{ color: '#008fe0', cursor: 'pointer' }}
941
- type="link"
942
- onClick={() => {
943
- this.addPeerRule(itemDetail);
944
- }}
945
- >
946
- <PlusCircleOutlined
947
- style={{
948
- color: '#008fe0',
949
- fontSize: '14px',
950
- marginRight: '5px',
951
- }}
952
- />
953
- 添加条件
954
- </span>
955
- </div>
956
- </div>
957
- </div>
958
- );
959
- };
960
-
961
- handleEditExtraInfoResponse = (code, val, parentDetail,classDataIndex, key) => {
962
- const { ruleClassData } = this.state;
963
- const { callBack } = this.props;
964
- parentDetail.extraInfo.response = parentDetail.extraInfo.response.map((i) => {
965
- if (i.code && key === i.code) {
966
- i[code] = val;
967
- return i;
968
- }
969
- return i;
970
- });
971
- ruleClassData[classDataIndex].extraInfo.response = ruleClassData[
972
- classDataIndex
973
- ].extraInfo.response.map((i) => {
974
- if (i.code && key === i.code) {
975
- i[code] = val;
976
- return i;
977
- }
978
- return i;
979
- });
980
-
981
- this.setState(
982
- {
983
- ruleClassData,
984
- },
985
- () => {
986
- callBack(ruleClassData);
987
- },
988
- );
989
- };
990
- // 场景需要返回值2022.11.15
991
- renderResItem = (
992
- itemDetail,
993
- parentDetail,
994
- ruleReturnConfig,
995
- selectRuleReturnData,
996
- classDataIndex,
997
- disabled,
998
- boxStyle,
999
- ) => {
1000
- const isRightText = ruleReturnConfig?.rightText?.length;
1001
-
1002
- const showValue = (code, type, functionItem, configItem) => {
1003
- let defaultValue = configItem.defaultValue;
1004
- const pCode = itemDetail.response?.find((i) => i.code == code)?.value;
1005
- if (type === 'input') {
1006
- return pCode === undefined ? pCode : pCode || defaultValue;
1007
- }
1008
- if(['date','dateTime','rangeTime'].includes(type)) {
1009
- if(['date','dateTime'].includes(type)) return pCode ? moment(pCode) : pCode;
1010
- if(['rangeTime'].includes(type)) {
1011
- const newPCode = Array.isArray(pCode) ? pCode : pCode?.split(',');
1012
- return pCode ? newPCode?.map((i) => moment(i)) : pCode;
1013
- }
1014
- }
1015
- return pCode || defaultValue;
1016
- };
1017
- const handleEdit = (code, val, functionItem) => {
1018
- let value = val;
1019
- if (isObj(code)) {
1020
- Object.keys(code).forEach((ite) => {
1021
- this.handleEditExtraInfoResponse(ite, code[ite], parentDetail,classDataIndex);
1022
- });
1023
- return;
1024
- }
1025
- if (Array.isArray(val)) {
1026
- value = val.map((m) => m.value || m).join(',');
1027
- }
1028
- if (isObj(val)) {
1029
- value = val.value || val.PCDCode?.join('/');
1030
- }
1031
- this.handleEditExtraInfoResponse('value', value, parentDetail,classDataIndex,code);
1032
- };
1033
-
1034
- return (
1035
- <>
1036
- {selectRuleReturnData && selectRuleReturnData.length ? (
1037
- <div>
1038
- <div className={'rule_action_return_border'}>
1039
- <div className={'rule_border_title'}>返回值</div>
1040
- <div>
1041
- {selectRuleReturnData.map((item) => (
1042
- <div style={{ display: 'flex' }}>
1043
- {this.renderFormCompItem(
1044
- item,
1045
- showValue,
1046
- handleEdit,
1047
- {},
1048
- boxStyle,
1049
- disabled,
1050
- )}
1051
- <MinusCircleOutlined
1052
- className={'icon_btn_style'}
1053
- onClick={() => {
1054
- this.handleEditExtraInfoResponse(
1055
- 'enable',
1056
- false,
1057
- parentDetail,
1058
- classDataIndex,
1059
- item.code,
1060
- );
1061
- }}
1062
- style={{
1063
- color: 'gray',
1064
- marginLeft: isRightText ? '100px' : '15px',
1065
- marginTop: '15px',
1066
- display: disabled ? 'none' : 'inline-block',
1067
- }}
1068
- />
1069
- </div>
1070
- ))}
1071
- </div>
1072
- </div>
1073
- </div>
1074
- ) : (
1075
- <></>
1076
- )}
1077
- </>
1078
- );
1079
- };
1080
-
1081
-
1082
- renderFormCompItem = (
1083
- config,
1084
- showValue,
1085
- handleEdit,
1086
- parentItem,
1087
- boxStyle,
1088
- disabled
1089
- ) => {
1090
- if (!config) return;
1091
- return (
1092
- <div style={boxStyle}>
1093
- {(config?.leftText && (
1094
- <div style={{ flex: 'none', marginRight: 10 }}>
1095
- {config?.required && <span className="requiredMark" />}
1096
- {config.leftText}
1097
- </div>
1098
- )) ||
1099
- null}
1100
- {(!config?.leftText && config?.rightText && config?.required && (
1101
- <div style={{ flex: 'none', marginRight: 10 }}>
1102
- <span className="requiredMark" />
1103
- </div>
1104
- )) ||
1105
- null}
1106
- <RenderCompItem regularDataList={this.props.regularDataList} ites={config} showValue={(a, b, c = parentItem, d = config) => showValue(a, b, c, d)} handleEdit={(a, b, c = parentItem, d = config) => handleEdit(a, b, c, d)} disabled={disabled}></RenderCompItem>
1107
- {(config?.rightText && (
1108
- <div style={{ flex: 'none', marginLeft: 10 }}>{config.rightText}</div>
1109
- )) ||
1110
- null}
1111
- </div>
1112
- );
1113
- };
1114
-
1115
- renderActionList = (
1116
- itemDetail,
1117
- parentDetail,
1118
- handleRuleTypeData,
1119
- sRuleActionData,
1120
- classDataIndex,
1121
- disabled,
1122
- boxStyle,
1123
- ) => {
1124
- const showValue = (code, type, functionItem, configItem) => {
1125
- const functionIndex = handleRuleTypeData.findIndex(
1126
- (m) => m.code === functionItem.code,
1127
- );
1128
- const pCode =
1129
- itemDetail.execute[functionIndex] &&
1130
- itemDetail.execute[functionIndex].properties[code];
1131
- let defaultValue = configItem.defaultValue;
1132
- if (type === 'input') {
1133
- return pCode === undefined ? pCode : pCode || defaultValue;
1134
- }
1135
- return pCode || defaultValue;
1136
- };
1137
- const handleEdit = (code, val, functionItem) => {
1138
- const functionIndex = handleRuleTypeData.findIndex(
1139
- (m) => m.code === functionItem.code,
1140
- );
1141
- const { ruleClassData } = this.state;
1142
- const { callBack } = this.props;
1143
- parentDetail.extraInfo.execute[functionIndex]['properties'][code] = val;
1144
- parentDetail.extraInfo.execute[functionIndex]['code'] = functionItem.code;
1145
-
1146
- this.setState(
1147
- {
1148
- ruleClassData,
1149
- },
1150
- () => {
1151
- callBack(ruleClassData);
1152
- },
1153
- );
1154
- };
1155
-
1156
- return (
1157
- <>
1158
- {sRuleActionData && sRuleActionData.length ? (
1159
- <div>
1160
- <div className={'rule_action_return_border'}>
1161
- <div className={'rule_border_title'}>动作</div>
1162
- <div>
1163
- {sRuleActionData.map((i, index) => (
1164
- <div>
1165
- <div className={'rule_action_item'}>
1166
- {(i.valueList?.length &&
1167
- i.valueList.map((s) => {
1168
- return this.renderFormCompItem(
1169
- s,
1170
- showValue,
1171
- handleEdit,
1172
- i,
1173
- boxStyle,
1174
- disabled,
1175
- );
1176
- })) || (
1177
- <div style={boxStyle} key={i.functionName}>
1178
- <div>{i.functionName}</div>
1179
- </div>
1180
- )}
1181
- <MinusCircleOutlined
1182
- className={'icon_btn_style'}
1183
- onClick={() => {
1184
- this.handleDeleteRuleAction(classDataIndex, i.code);
1185
- }}
1186
- style={{
1187
- color: 'gray',
1188
- marginLeft: '15px',
1189
- marginTop: '15px',
1190
- display: disabled ? 'none' : 'inline-block',
1191
- }}
1192
- />
1193
- </div>
1194
- </div>
1195
- ))}
1196
- </div>
1197
- </div>
1198
- </div>
1199
- ) : (
1200
- <></>
1201
- )}
1202
- </>
1203
- );
1204
- };
1205
-
1206
- renderRuleTypeItem = (
1207
- itemDetail,
1208
- parentDetail,
1209
- floorIndex,
1210
- classDataIndex,
1211
- ruleTypeData,
1212
- ruleReturnConfig,
1213
- isRuleInstance
1214
- ) => {
1215
- const { modalParams } = this.state;
1216
- const { disabled } = this.props;
1217
- const isHaveRuleTypeData = ruleTypeData?.length;
1218
- const isHaveRuleReturnConfig = ruleReturnConfig?.length;
1219
- const handleRuleTypeData = isHaveRuleTypeData
1220
- ? ruleTypeData.sort((a, b) => a.priority - b.priority)
1221
- : [];
1222
-
1223
- const selectRuleActionCode = isHaveRuleTypeData
1224
- ? itemDetail.execute.filter((i) => i.isSelected).map((s) => s.code)
1225
- : [];
1226
-
1227
- const selectRuleReturnCode = isHaveRuleReturnConfig
1228
- ? _.compact(
1229
- itemDetail.response.filter((i) => i?.enable).map((s) => s?.code),
1230
- )
1231
- : [];
1232
-
1233
- const selectRuleActionData = isHaveRuleTypeData
1234
- ? handleRuleTypeData.filter((r) =>
1235
- selectRuleActionCode.some((s) => s === r.code),
1236
- )
1237
- : [];
1238
-
1239
- const selectRuleReturnData = isHaveRuleReturnConfig
1240
- ? itemDetail.response.length === 1 &&
1241
- !itemDetail.response[0]?.code &&
1242
- itemDetail.response[0]?.enable
1243
- ? [{ ...ruleReturnConfig[0], value: itemDetail.response[0]?.value }]
1244
- : ruleReturnConfig.filter((r) =>
1245
- selectRuleReturnCode.some((s) => s === r.code),
1246
- )
1247
- : [];
1248
-
1249
- const RuleActionItemStyle = {
1250
- display: 'flex',
1251
- // height: '30px',
1252
- // lineHeight: '30px',
1253
- margin: '10px 0px',
1254
- };
1255
-
1256
- const displayNoneActionStyle = (isRuleInstance && !isHaveRuleTypeData)? { display: 'none' }: {};
1257
- const displayNoneReturnValueStyle = (isRuleInstance && !isHaveRuleReturnConfig)? { display: 'none' }: {};
1258
-
1259
- return (
1260
- <div>
1261
- <div style={{ textAlign: 'right', display: 'flex', marginBottom: 10 }}>
1262
- <Button
1263
- disabled={disabled}
1264
- type="link"
1265
- style={displayNoneActionStyle}
1266
- onClick={() => {
1267
- if (isHaveRuleTypeData) {
1268
- this.setState({
1269
- modalParams: {
1270
- ...modalParams,
1271
- type: 'action',
1272
- dataSource: handleRuleTypeData,
1273
- classDataIndex,
1274
- visible: true,
1275
- },
1276
- });
1277
- } else {
1278
- message.warn('未配置执行动作');
1279
- }
1280
- }}
1281
- >
1282
- 新增动作
1283
- </Button>
1284
- <Button
1285
- disabled={disabled}
1286
- type="link"
1287
- style={displayNoneReturnValueStyle}
1288
- onClick={() => {
1289
- if (isHaveRuleReturnConfig) {
1290
- this.setState({
1291
- modalParams: {
1292
- ...modalParams,
1293
- type: 'returnResponse',
1294
- dataSource: ruleReturnConfig,
1295
- classDataIndex,
1296
- visible: true,
1297
- },
1298
- });
1299
- } else {
1300
- message.warn('未配置返回');
1301
- }
1302
- }}
1303
- >
1304
- 新增返回值
1305
- </Button>
1306
- </div>
1307
- {(isHaveRuleTypeData &&
1308
- this.renderActionList(
1309
- itemDetail,
1310
- parentDetail,
1311
- handleRuleTypeData,
1312
- selectRuleActionData,
1313
- classDataIndex,
1314
- disabled,
1315
- RuleActionItemStyle,
1316
- )) ||
1317
- null}
1318
- {(isHaveRuleReturnConfig &&
1319
- this.renderResItem(
1320
- itemDetail,
1321
- parentDetail,
1322
- ruleReturnConfig,
1323
- selectRuleReturnData,
1324
- classDataIndex,
1325
- disabled,
1326
- RuleActionItemStyle,
1327
- )) ||
1328
- null}
1329
- </div>
1330
- );
1331
- };
1332
-
1333
- //添加同一层级条件
1334
- addPeerRule = (itemDetail) => {
1335
- const { ruleClassData } = this.state;
1336
- const { callBack, disabled } = this.props;
1337
- if (disabled) return;
1338
- itemDetail.subExpression.push({
1339
- // "expressionType": "relation",
1340
- operationType: 'relation',
1341
- operationCode: '',
1342
- propertyPath: '',
1343
- params: [],
1344
- paramNames: [],
1345
- });
1346
- this.setState(
1347
- {
1348
- ruleClassData,
1349
- },
1350
- () => {
1351
- callBack(ruleClassData);
1352
- },
1353
- );
1354
- };
1355
-
1356
- //添加子层级条件
1357
- addChildRules = (itemDetail) => {
1358
- const { ruleClassData } = this.state;
1359
- const { callBack } = this.props;
1360
- const initialData = JSON.parse(JSON.stringify(itemDetail));
1361
- delete itemDetail.propertyPath;
1362
- delete itemDetail.params;
1363
- delete itemDetail.paramNames;
1364
- delete itemDetail.dataTypeCode;
1365
- delete itemDetail.elementId;
1366
- delete itemDetail.elementName;
1367
- delete itemDetail.metaObjectCode;
1368
- // itemDetail.expressionType = 'logic';
1369
- itemDetail.operationType = 'logic';
1370
- itemDetail.operationCode = 'and';
1371
- itemDetail.subExpression = [
1372
- initialData,
1373
- {
1374
- // "expressionType": "relation",
1375
- operationType: 'relation',
1376
- type: 20,
1377
- operationCode: '',
1378
- propertyPath: '',
1379
- params: [],
1380
- paramNames: [],
1381
- },
1382
- ];
1383
- this.setState(
1384
- {
1385
- ruleClassData,
1386
- },
1387
- () => {
1388
- callBack(ruleClassData);
1389
- },
1390
- );
1391
- };
1392
-
1393
- handleDeleteRule = (itemDetail, parentDetail, classDataIndex) => {
1394
- const { ruleClassData } = this.state;
1395
- const { callBack, metaObjectCode } = this.props;
1396
- if (parentDetail.ruleName) {
1397
- //删除根规则层级最后一条时整个规则项删除
1398
- ruleClassData.splice(classDataIndex, 1);
1399
- } else {
1400
- let deleteItemIndex = parentDetail.subExpression.findIndex(
1401
- (detailItem) =>
1402
- JSON.stringify(itemDetail) == JSON.stringify(detailItem),
1403
- );
1404
- if (parentDetail.subExpression.length > 2) {
1405
- parentDetail.subExpression.splice(deleteItemIndex, 1);
1406
- } else {
1407
- parentDetail.subExpression.splice(deleteItemIndex, 1);
1408
- // parentDetail.expressionType = parentDetail.subExpression[0].expressionType;
1409
- parentDetail.operationCode =
1410
- parentDetail.subExpression[0].operationCode;
1411
- parentDetail.operationType =
1412
- parentDetail.subExpression[0].operationType;
1413
-
1414
- if (parentDetail.subExpression[0].operationType == 'logic') {
1415
- parentDetail.subExpression = [
1416
- ...parentDetail.subExpression[0].subExpression,
1417
- ];
1418
- } else {
1419
- parentDetail.propertyPath =
1420
- parentDetail.subExpression[0].propertyPath;
1421
- parentDetail.params = [...parentDetail.subExpression[0].params];
1422
- parentDetail.paramNames = parentDetail.subExpression[0].paramNames
1423
- ? [...parentDetail.subExpression[0].paramNames]
1424
- : [];
1425
- parentDetail.metaObjectCode = metaObjectCode || parentDetail.subExpression[0].metaObjectCode;
1426
- parentDetail.elementId = parentDetail.subExpression[0].elementId;
1427
- parentDetail.elementName = parentDetail.subExpression[0].elementName;
1428
- parentDetail.dataTypeCode =
1429
- parentDetail.subExpression[0].dataTypeCode;
1430
- delete parentDetail.subExpression;
1431
- }
1432
- }
1433
- }
1434
- this.setState(
1435
- {
1436
- ruleClassData,
1437
- },
1438
- () => {
1439
- callBack(ruleClassData);
1440
- },
1441
- );
1442
- };
1443
-
1444
- handleLogicalTypeChange = (itemDetail, type) => {
1445
- const { ruleClassData } = this.state;
1446
- const { callBack } = this.props;
1447
- itemDetail.operationCode = type;
1448
- this.setState(
1449
- {
1450
- ruleClassData,
1451
- },
1452
- () => {
1453
- callBack(ruleClassData);
1454
- },
1455
- );
1456
- };
1457
-
1458
- // 新增执行顺序
1459
- handleSelectRuleAction = (keys, classDataIndex, type, callback) => {
1460
- callback();
1461
- const { callBack } = this.props;
1462
- const { ruleClassData } = this.state;
1463
- if (type === 'action') {
1464
- ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
1465
- classDataIndex
1466
- ].extraInfo.execute.map((i) => {
1467
- if (i.code && keys.some((r) => r === i.code) && !i.isSelected) {
1468
- return { ...i, isSelected: true };
1469
- }
1470
- return i;
1471
- });
1472
- } else {
1473
- ruleClassData[classDataIndex].extraInfo.response = ruleClassData[
1474
- classDataIndex
1475
- ].extraInfo.response.map((i) => {
1476
- if (i.code && keys.some((r) => r === i.code) && !i.enable) {
1477
- console.log('i', i);
1478
- return { ...i, enable: true };
1479
- }
1480
- return i;
1481
- });
1482
- }
1483
- // 处理数据
1484
- this.setState(
1485
- {
1486
- ruleClassData,
1487
- },
1488
- () => {
1489
- callBack(ruleClassData);
1490
- },
1491
- );
1492
- };
1493
-
1494
- handleDeleteRuleAction = (classDataIndex, functionCode) => {
1495
- const { callBack } = this.props;
1496
- const { ruleClassData } = this.state;
1497
- ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
1498
- classDataIndex
1499
- ].extraInfo.execute.map((i) => {
1500
- if (i.code && functionCode === i.code && i.isSelected) {
1501
- return { ...i, isSelected: false };
1502
- }
1503
- return i;
1504
- });
1505
- // 处理数据
1506
- this.setState(
1507
- {
1508
- ruleClassData,
1509
- },
1510
- () => {
1511
- callBack(ruleClassData);
1512
- },
1513
- );
1514
- };
1515
-
1516
- render() {
1517
- const { onlyOneRule, callBack, disabled, headerButtonComponentFun } = this.props;
1518
- const { ruleClassData, modalParams } = this.state;
1519
- return (
1520
- <div className={'base_rule'}>
1521
- <div className={'base_rule_content'}>
1522
- {headerButtonComponentFun?headerButtonComponentFun(this.handleAddRule): (
1523
- <div
1524
- disabled={disabled}
1525
- style={{
1526
- display: onlyOneRule ? 'none' : 'block',
1527
- }}
1528
- className={'base_rule_line_title'}
1529
- >
1530
- <Button
1531
- onClick={this.handleAddRule}
1532
- className={'base_rule_btn_style'}
1533
- type="link"
1534
- >
1535
- 新增规则
1536
- </Button>
1537
- </div>
1538
- )}
1539
- <div>{this.renderRuleContent()}</div>
1540
- </div>
1541
- {(modalParams.visible && (
1542
- <Modal
1543
- title={modalParams.type === 'action' ? '新增动作' : '新增返回值'}
1544
- visible={modalParams.visible}
1545
- onCancel={() => {
1546
- this.setState({
1547
- modalParams: { ...modalParams, visible: false },
1548
- });
1549
- }}
1550
- maskClosable={false}
1551
- destroyOnClose
1552
- footer={null}
1553
- >
1554
- <Table
1555
- rowSelection={{
1556
- onChange: (keys, selectRows) => {
1557
- this.handleSelectRuleAction(
1558
- keys,
1559
- modalParams.classDataIndex,
1560
- modalParams?.type,
1561
- () => {
1562
- this.setState({
1563
- modalParams: { ...modalParams, visible: false },
1564
- });
1565
- },
1566
- );
1567
- },
1568
- }}
1569
- columns={
1570
- modalParams.type === 'action'
1571
- ? [
1572
- {
1573
- title: '执行动作名称',
1574
- key: 'functionName',
1575
- dataIndex: 'functionName',
1576
- },
1577
- ]
1578
- : [
1579
- {
1580
- title: '字段名称',
1581
- key: 'name',
1582
- dataIndex: 'name',
1583
- },
1584
- {
1585
- title: '字段编码',
1586
- key: 'code',
1587
- dataIndex: 'code',
1588
- },
1589
- ]
1590
- }
1591
- dataSource={modalParams?.dataSource}
1592
- rowKey={'code'}
1593
- />
1594
- </Modal>
1595
- )) ||
1596
- null}
1597
- </div>
1598
- );
1599
- }
1600
- }
1601
- export default RuleObjectComponent;
1
+ import React, { Component } from 'react';
2
+ // @ts-ignore
3
+ import _ from 'lodash';
4
+ import moment from 'moment';
5
+ import RuleField from './ruleFiled';
6
+ import {
7
+ Select,
8
+ Button,
9
+ Radio,
10
+ Switch,
11
+ Checkbox,
12
+ InputNumber,
13
+ TreeSelect,
14
+ Popover,
15
+ Input,
16
+ DatePicker,
17
+ Table,
18
+ Divider,
19
+ Space,
20
+ Form as AntdForm,
21
+ Modal,
22
+ message,
23
+ } from 'antd';
24
+ import {
25
+ PlusCircleOutlined,
26
+ MinusCircleOutlined,
27
+ DownOutlined,
28
+ } from '@ant-design/icons';
29
+ import './index.less';
30
+ import {
31
+ relateItems,
32
+ getSpecialPropertyCode,
33
+ getPropertyCode,
34
+ isObj,
35
+ } from './util';
36
+ import { getDictionarySource, uuid } from '../../../utils/utils';
37
+ import {
38
+ BusinessSearchSelect,
39
+ BusinessTreeSearchSelect,
40
+ EllipsisTooltip,
41
+ BsCascader,
42
+ } from '../../../index';
43
+ import { request } from 'bssula';
44
+ import Formula from './Formula';
45
+ import RenderSpecificAction from './renderSpecificAction';
46
+ import RenderCompItem from './RenderCompItem';
47
+
48
+ const { RangePicker } = DatePicker;
49
+
50
+ class RuleObjectComponent extends Component {
51
+ constructor(props) {
52
+ super(props);
53
+ this.state = {
54
+ editNameIndex: 0,
55
+ isEdit: false,
56
+ ruleTreeData: [],
57
+ initialRegularList: [],
58
+ operationList: [],
59
+ ruleClassData: [],
60
+ modalParams: {
61
+ visible: false,
62
+ },
63
+ };
64
+ this.propertyCodeToRangeIdMap = {};
65
+ this.dictCodeToRangeIdMap = {};
66
+ this.dynamicDictCodeToRangeIdMap = {};
67
+ }
68
+
69
+ componentDidMount(props) {
70
+ const { ruleClassData, operationList, regularDataList } = this.props;
71
+ this.setRegularData(regularDataList);
72
+ this.setState({
73
+ ruleClassData,
74
+ operationList,
75
+ });
76
+ }
77
+
78
+ componentWillReceiveProps(nextProps) {
79
+ const { ruleClassData, operationList, regularDataList } = this.state;
80
+ if (
81
+ nextProps.ruleClassData &&
82
+ this.props.ruleClassData != nextProps.ruleClassData &&
83
+ JSON.stringify(nextProps.ruleClassData) != JSON.stringify(ruleClassData)
84
+ ) {
85
+ this.setState({
86
+ ruleClassData: nextProps.ruleClassData,
87
+ });
88
+ }
89
+
90
+ if (
91
+ nextProps.operationList &&
92
+ this.props.operationList != nextProps.operationList
93
+ ) {
94
+ this.setState({
95
+ operationList: nextProps.operationList,
96
+ });
97
+ }
98
+
99
+ if (
100
+ nextProps.regularDataList &&
101
+ this.props.regularDataList != nextProps.regularDataList
102
+ ) {
103
+ this.setRegularData(nextProps.regularDataList);
104
+ }
105
+ }
106
+
107
+ setRegularData = (regularDataList) => {
108
+ this.propertyCodeToRangeIdMap = {};
109
+ this.dictCodeToRangeIdMap = {};
110
+ this.dynamicDictCodeToRangeIdMap = {};
111
+ const finalTreeDatas = regularDataList.map((item) => {
112
+ return {
113
+ title: item.name,
114
+ key: item.id,
115
+ pValue: item.code, // 后端存path key, children同理
116
+ value: item.id, // 前端选中唯一key, children同理
117
+ id: item.id, // 前端选中回显示唯一key, children同理
118
+ ...(item?.propertyList?.length
119
+ ? {
120
+ children: item.propertyList.map((element) => {
121
+ const infoVo = (element.info && JSON.parse(element.info)) || {};
122
+ if (element.choiceType === 30) {
123
+ this.dynamicDictCodeToRangeIdMap[
124
+ `${item.code}.${element.code}`
125
+ ] = infoVo?.dictionaryCode;
126
+ } else if (element.choiceType === 20) {
127
+ this.dictCodeToRangeIdMap[`${item.code}.${element.code}`] =
128
+ infoVo?.dictionaryCode;
129
+ } else if (element.choiceType === 10) {
130
+ const list =
131
+ (Object.keys(infoVo).length &&
132
+ infoVo.enumeration &&
133
+ Object.keys(infoVo.enumeration).map((i) => ({
134
+ code: i,
135
+ name: infoVo.enumeration[i],
136
+ }))) ||
137
+ undefined;
138
+ this.propertyCodeToRangeIdMap[
139
+ `${item.code}.${element.code}`
140
+ ] = list;
141
+ } else {
142
+ // this.propertyCodeToRangeIdMap[
143
+ // `${item.code}.${element.code}`
144
+ // ] = Object.keys(infoVo).length ? infoVo : undefined;
145
+ }
146
+ let child = {
147
+ title: `${item.name}-${element.name}`,
148
+ key: element.id,
149
+ pValue: this.props.isRouteProperty ? `${item.code}.${element.code}` : element.code,
150
+ value: element.id,
151
+ id: element.id,
152
+ dataTypeCode: element.valueType,
153
+ dataChoiceBusinessType: element.choiceType,
154
+ dataInputBusinessType: element.inputType,
155
+ info: element.info,
156
+ };
157
+ if (element?.propertyList?.length) {
158
+ child.children = this.parseChildTreeData(
159
+ element.propertyList,
160
+ `${element.code}`,
161
+ `${item.name}-${element.name}`,
162
+ item.code,
163
+ );
164
+ child.isLeaf = false;
165
+ } else {
166
+ child.isLeaf = true;
167
+ child.metaObjectCode = item.code;
168
+ }
169
+ return child;
170
+ }),
171
+ }
172
+ : {
173
+ isLeaf: this.props.metaObjectCode ? true : false,
174
+ metaObjectCode: this.props.metaObjectCode || item.code,
175
+ ...item,
176
+ dataTypeCode: item.valueType,
177
+ dataChoiceBusinessType: item.choiceType,
178
+ dataInputBusinessType: item.inputType,
179
+ }),
180
+ };
181
+ });
182
+ this.setState({
183
+ initialRegularList: [...regularDataList],
184
+ ruleTreeData: finalTreeDatas,
185
+ });
186
+ };
187
+
188
+ parseChildTreeData = (list, parentKey, parentTitle, rootObjCode) => {
189
+ return list.map((element) => {
190
+ const infoVo = (element.info && JSON.parse(element.info)) || {};
191
+ if (element.choiceType === 30) {
192
+ this.dynamicDictCodeToRangeIdMap[
193
+ `${rootObjCode}.${parentKey}.${element.code}`
194
+ ] = infoVo?.dictionaryCode;
195
+ } else if (element.choiceType === 20) {
196
+ this.dictCodeToRangeIdMap[
197
+ `${rootObjCode}.${parentKey}.${element.code}`
198
+ ] = infoVo?.dictionaryCode;
199
+ } else if (element.choiceType === 10) {
200
+ // FIXME http://192.168.13.78/mep-fed-group/web/libs/business-component/-/merge_requests/45#note_115669
201
+ const list =
202
+ (Object.keys(infoVo).length &&
203
+ infoVo.enumeration &&
204
+ Object.keys(infoVo.enumeration).map((i) => ({
205
+ code: i,
206
+ name: infoVo.enumeration[i],
207
+ }))) ||
208
+ undefined;
209
+ this.propertyCodeToRangeIdMap[
210
+ `${rootObjCode}.${parentKey}.${element.code}`
211
+ ] = list;
212
+ } else {
213
+ // this.propertyCodeToRangeIdMap[
214
+ // `${rootObjCode}.${parentKey}.${element.code}`
215
+ // ] = Object.keys(infoVo).length ? infoVo : undefined;
216
+ }
217
+ let child = {
218
+ title: `${parentTitle}-${element.name}`,
219
+ key: `${parentKey}.${element.id}`,
220
+ pValue: `${parentKey}.${element.code}`,
221
+ value: element.id,
222
+ id: element.id,
223
+ dataTypeCode: element.valueType,
224
+ dataChoiceBusinessType: element.choiceType,
225
+ dataInputBusinessType: element.inputType,
226
+ info: element.info,
227
+ };
228
+ if (element.propertyList) {
229
+ child.children = this.parseChildTreeData(
230
+ element.propertyList,
231
+ `${parentKey}.${element.code}`,
232
+ `${parentTitle}-${element.name}`,
233
+ rootObjCode,
234
+ );
235
+ child.isLeaf = false;
236
+ } else {
237
+ child.isLeaf = true;
238
+ child.metaObjectCode = rootObjCode;
239
+ }
240
+ return child;
241
+ });
242
+ };
243
+
244
+ getDataTypeOperateList = (id) => {
245
+ const { operationList, initialRegularList } = this.state;
246
+ // let typeId = '';
247
+ // initialRegularList.forEach(item => {
248
+ // item.metaObjectResDto.elementResDtos.forEach(element => {
249
+ // if (element.id == id) {
250
+ // typeId = element.dataTypeCode;
251
+ // }
252
+ // })
253
+ // })
254
+ const list =
255
+ operationList.find((item) => item.code == id)?.operationList || [];
256
+ return this.props.isShowAllOperationList ? operationList : list;
257
+ };
258
+
259
+ handleValuesChange = (itemDetail, newValues, newValueNames) => {
260
+ const { ruleClassData } = this.state;
261
+ const { callBack } = this.props;
262
+ itemDetail.params = [...newValues];
263
+ itemDetail.paramNames = [...newValueNames];
264
+ this.setState(
265
+ {
266
+ ruleClassData,
267
+ },
268
+ () => {
269
+ callBack(ruleClassData);
270
+ },
271
+ );
272
+ };
273
+
274
+ setRelateDataList = (classDataItem) => {
275
+ let relateDatas = {};
276
+ relateItems.forEach((relateItem) => {
277
+ this.getRelateData(
278
+ relateItem,
279
+ classDataItem.subExpression || {},
280
+ relateDatas,
281
+ );
282
+ });
283
+ return relateDatas;
284
+ };
285
+
286
+ getRelateData = (relateItem, classDataItem, relateDatas) => {
287
+ if (
288
+ classDataItem?.propertyPath &&
289
+ getPropertyCode(classDataItem.propertyPath) == relateItem.propertyCode
290
+ ) {
291
+ relateDatas[relateItem.propertyCode] = classDataItem.params;
292
+ } else {
293
+ if (classDataItem.subExpression && classDataItem.subExpression.length) {
294
+ classDataItem.subExpression.forEach((classData) => {
295
+ this.getRelateData(relateItem, classData, relateDatas);
296
+ });
297
+ }
298
+ }
299
+ };
300
+
301
+ renderRuleContent = () => {
302
+ const { ruleClassData, currentRuleName, isEdit, editNameIndex } =
303
+ this.state;
304
+ const {
305
+ ruleType,
306
+ callBack,
307
+ accountList = [],
308
+ disabled,
309
+ ruleTypeData,
310
+ canDelete = false,
311
+ ruleReturnConfig = [],
312
+ onlyOneRule,
313
+ onlyCondition,
314
+ onlyAction,
315
+ handleOperatingAction,
316
+ ruleGroupInfo,
317
+ needShowAction = true,
318
+ } = this.props;
319
+ const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1; // 业务调用规则实例设计器
320
+ const ruleGroupName = ruleGroupInfo?.ruleGroupList?.[0]?.name || '规则分组';
321
+ const priorityList = (ruleGroupInfo?.groupOtherPriorityList || []).concat(ruleClassData|| []);
322
+ const canChangePriority = ruleGroupInfo?.canChangePriority;
323
+ const isRuleGroupInstance = ruleGroupInfo?.type == 'group-instance'; // 规则组展示规则实例设计器
324
+ const titlePre = {
325
+ position: 'relative',
326
+ top: '-10px',
327
+ left: '20px',
328
+ background: '#fff',
329
+ width: '160px',
330
+ textAlign: 'center',
331
+ }; // height:22
332
+ const titleSubCommon = {
333
+ display: 'flex',
334
+ justifyContent: 'center',
335
+ }
336
+ const titleSubPre = {
337
+ ...titlePre,
338
+ ...titleSubCommon,
339
+ width: '166px',
340
+ top: '-32px', // titlePre(height + top)
341
+ left: '200px', // titlePre(2 * left + width) 左右间距为titlePre的left: 20px
342
+ }; // height: 24
343
+ const titleSubPre2 = {
344
+ ...titlePre,
345
+ ...titleSubCommon,
346
+ width: '240px',
347
+ top: '-56px', // titleSubPre(top + height)
348
+ left: '386px', // titlePre(left + width + 20)
349
+ }
350
+ const ruleListBox = (!onlyOneRule || ruleGroupInfo) ? { border: '1px dashed #d9d9d9', marginBottom: 10, overflowX: 'clip' } : {};
351
+ const isRuleActionConfig =
352
+ ruleTypeData?.length || ruleReturnConfig?.length;
353
+ return (
354
+ <div>
355
+ {ruleClassData.map((item, classDataIndex) => {
356
+ let extraInfo = {};
357
+ if (isRuleActionConfig) {
358
+ const { response = [] } = item.extraInfo;
359
+ extraInfo = {
360
+ ...item.extraInfo,
361
+ response:
362
+ Object.prototype.toString.call(response) === '[object Object]'
363
+ ? [response]
364
+ : Array.isArray(response)
365
+ ? response
366
+ : [],
367
+ };
368
+ }
369
+ let relateDatas = this.setRelateDataList(item);
370
+ const sActionProps = {
371
+ extraInfo,
372
+ ruleTypeData,
373
+ item,
374
+ classDataIndex,
375
+ handleOperatingAction,
376
+ disabled,
377
+ };
378
+ return (
379
+ <div style={ruleListBox}>
380
+ {!onlyOneRule && !ruleGroupInfo && (
381
+ <div style={titlePre}>规则{classDataIndex + 1}</div>
382
+ )}
383
+ {ruleGroupInfo && (
384
+ <>
385
+ <div style={titlePre}>
386
+ <EllipsisTooltip
387
+ visible={true}
388
+ maxLength={10}
389
+ title={ruleGroupName}
390
+ />
391
+ </div>
392
+ {isRuleInstance && (
393
+ <div style={titleSubPre}>
394
+ <span style={{ marginRight: 10, display: 'block' }}>优先级</span>
395
+ <Select
396
+ size='small'
397
+ disabled={canChangePriority ? !canChangePriority : disabled}
398
+ style={{ width: 100 }}
399
+ value={item.priority}
400
+ onChange={(v) => {
401
+ // 因为存在页签,前端校验不准确;而且若选择优先级之后想交换改也不方便,故交由后端校验
402
+ // const isRepeate = priorityList.some((r) => r.priority == v)
403
+ // if(isRepeate) {
404
+ // message.warn('优先级不允许重复')
405
+ // }
406
+ // item.priority = isRepeate ? (item.priority||null) : v;
407
+ item.priority = v
408
+ this.setState(
409
+ {
410
+ ruleClassData,
411
+ },
412
+ () => {
413
+ callBack(ruleClassData);
414
+ },
415
+ );
416
+ }}
417
+ >
418
+ {priorityList?.map((s,sindex) => (
419
+ <Option key={sindex+1} value={sindex+1}>{sindex+1}</Option>
420
+ ))}
421
+ </Select>
422
+ </div>
423
+ ) || null}
424
+ {isRuleGroupInstance && (
425
+ <div style={titleSubPre2}>
426
+ <span style={{ marginRight: 10 }}>业务编码</span>
427
+ <EllipsisTooltip
428
+ visible={true}
429
+ maxLength={24}
430
+ title={item.extStrField01}
431
+ />
432
+ </div>
433
+ )}
434
+ </>
435
+ )}
436
+ <div
437
+ style={{
438
+ textAlign: 'right',
439
+ marginTop: '-24px',
440
+ display: canDelete ? 'block' : 'none',
441
+ }}
442
+ >
443
+ <Button
444
+ disabled={disabled}
445
+ onClick={() => {
446
+ const { ruleClassData } = this.state;
447
+ ruleClassData.splice(classDataIndex, 1);
448
+ this.setState(
449
+ {
450
+ ruleClassData,
451
+ },
452
+ () => {
453
+ callBack(ruleClassData);
454
+ },
455
+ );
456
+ }}
457
+ type="link"
458
+ danger
459
+ >
460
+ 删除规则
461
+ </Button>
462
+ </div>
463
+ <div>
464
+ {/* <div style={{ display: isEdit && editNameIndex == index ? 'none' : 'block' }}>
465
+ <span className={'rule_name_title}>
466
+ {item.ruleName}
467
+ </span>
468
+ <EditOutlined
469
+ onClick={() => {
470
+ this.setState({
471
+ editNameIndex: index,
472
+ currentRuleName: item.ruleName,
473
+ isEdit: true
474
+ })
475
+ }}
476
+ />
477
+ </div> */}
478
+ <div
479
+ style={{
480
+ display:
481
+ isEdit && editNameIndex == index ? 'block' : 'none',
482
+ marginTop: '10px',
483
+ }}
484
+ >
485
+ <Input
486
+ disabled={disabled}
487
+ value={currentRuleName}
488
+ style={{ width: '200px' }}
489
+ onChange={(e) => {
490
+ this.setState({
491
+ currentRuleName: e.target.value,
492
+ });
493
+ }}
494
+ />
495
+ <Button
496
+ disabled={disabled}
497
+ type="link"
498
+ onClick={() => {
499
+ const { ruleClassData, currentRuleName } = this.state;
500
+ ruleClassData[editNameIndex].ruleName = currentRuleName;
501
+ this.setState({
502
+ ruleClassData,
503
+ isEdit: false,
504
+ });
505
+ }}
506
+ >
507
+ 保存
508
+ </Button>
509
+ <Button
510
+ disabled={disabled}
511
+ type="link"
512
+ onClick={() => {
513
+ this.setState({
514
+ isEdit: false,
515
+ });
516
+ }}
517
+ >
518
+ 取消
519
+ </Button>
520
+ </div>
521
+ </div>
522
+ <div>
523
+ {(onlyAction && <RenderSpecificAction {...sActionProps} />) || (
524
+ <div className={'base_rule_line_content'}>
525
+ <div className={'base_rule_item2'}>
526
+ {item.subExpression &&
527
+ this.renderRuleItem(
528
+ item.subExpression,
529
+ item,
530
+ 1,
531
+ classDataIndex,
532
+ relateDatas,
533
+ )}
534
+ </div>
535
+ {needShowAction && (
536
+ <div className={'base_rule_item3'}>
537
+ {(extraInfo &&
538
+ isRuleActionConfig &&
539
+ (!onlyCondition || !onlyAction) &&
540
+ this.renderRuleTypeItem(
541
+ extraInfo,
542
+ item,
543
+ 1,
544
+ classDataIndex,
545
+ ruleTypeData,
546
+ ruleReturnConfig,
547
+ isRuleInstance
548
+ )) ||
549
+ null}
550
+ </div>
551
+ ) || null}
552
+ </div>
553
+ )}
554
+ </div>
555
+ </div>
556
+ );
557
+ })}
558
+ </div>
559
+ );
560
+ };
561
+
562
+ handleAddRule = () => {
563
+ const { ruleClassData } = this.state;
564
+ const { callBack, ruleTypeData=[], ruleGroupInfo, ruleReturnConfig=[] } = this.props;
565
+ const isRuleInstance = ruleGroupInfo?.type?.indexOf('instance') > -1;
566
+ const initKongData = {
567
+ ruleName: `规则${ruleClassData?.length + 1}`,
568
+ subExpression: {
569
+ // "expressionType": "relation",
570
+ operationType: 'relation',
571
+ propertyPath: '',
572
+ params: [],
573
+ paramNames: [],
574
+ },
575
+ extraInfo: {
576
+ response: ruleReturnConfig?.map((s) => {
577
+ return {
578
+ code: s?.code,
579
+ value: s?.defaultValue || '',
580
+ enable: false,
581
+ };
582
+ })||[],
583
+ execute: ruleTypeData?.map((s) => {
584
+ return {
585
+ priority: 1,
586
+ code: s.code,
587
+ properties: {
588
+ configPropertyCode: 'configPropertyValue',
589
+ },
590
+ };
591
+ })||[],
592
+ },
593
+ }
594
+ const initTemplateData = ruleGroupInfo?.templateData && Object.keys(ruleGroupInfo?.templateData)?.length ? {
595
+ ruleName: `规则${ruleClassData?.length + 1}`,
596
+ ..._.cloneDeep(ruleGroupInfo?.templateData)
597
+ } : initKongData;
598
+ const initNewData = isRuleInstance ? initTemplateData : initKongData
599
+ ruleClassData.push(initNewData);
600
+ this.setState(
601
+ {
602
+ ruleClassData,
603
+ },
604
+ () => {
605
+ callBack(ruleClassData);
606
+ },
607
+ );
608
+ };
609
+
610
+ // 树结构 转化成 平行树 (递归函数)
611
+ coverToParallel = (treeData, result) => {
612
+ treeData.forEach((el) => {
613
+ result.push(el);
614
+ if (el.children && el.children.length > 0) {
615
+ // 子级递归
616
+ this.coverToParallel(el.children, result);
617
+ }
618
+ });
619
+ return result;
620
+ };
621
+
622
+ renderRuleItem = (
623
+ itemDetail,
624
+ parentDetail,
625
+ floorIndex,
626
+ classDataIndex,
627
+ relateDatas,
628
+ ) => {
629
+ const { ruleTreeData } = this.state;
630
+ const {
631
+ callBack,
632
+ initialThresholdQuery = {},
633
+ disabled,
634
+ systemVariableList,
635
+ } = this.props;
636
+ let thresholdQuery = {
637
+ ...initialThresholdQuery,
638
+ ...relateDatas,
639
+ };
640
+ let finalIndex = floorIndex + 1;
641
+ let queryIdentify = '';
642
+ let queryIdentifyType = '';
643
+ if (
644
+ this.propertyCodeToRangeIdMap[
645
+ `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
646
+ ]
647
+ ) {
648
+ queryIdentify =
649
+ this.propertyCodeToRangeIdMap[
650
+ `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
651
+ ];
652
+ queryIdentifyType = Array.isArray(queryIdentify)
653
+ ? 'objectPropertyListIdentify'
654
+ : 'objectPropertyCodeIdentify';
655
+ } else if (
656
+ getSpecialPropertyCode(getPropertyCode(itemDetail.propertyPath))
657
+ ) {
658
+ queryIdentify = getSpecialPropertyCode(
659
+ getPropertyCode(itemDetail.propertyPath),
660
+ );
661
+ queryIdentifyType = 'specialPropertyIdentify';
662
+ } else if (
663
+ this.dictCodeToRangeIdMap[
664
+ `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
665
+ ]
666
+ ) {
667
+ queryIdentify =
668
+ this.dictCodeToRangeIdMap[
669
+ `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
670
+ ];
671
+ queryIdentifyType = 'dictCodeIdentify';
672
+ } else if (
673
+ this.dynamicDictCodeToRangeIdMap[
674
+ `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
675
+ ]
676
+ ) {
677
+ queryIdentify =
678
+ this.dynamicDictCodeToRangeIdMap[
679
+ `${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`
680
+ ];
681
+ queryIdentifyType = 'dynamicDictCodeIdentify';
682
+ }
683
+
684
+ const parallelTreeData = this.coverToParallel(ruleTreeData, []) || [];
685
+ const currentTreeItem =
686
+ itemDetail?.elementId &&
687
+ parallelTreeData.find((i) => (i?.key?.indexOf('.') > -1 ? i.id : i.key) === itemDetail?.elementId);
688
+ const dataChoiceBusinessType = currentTreeItem?.dataChoiceBusinessType;
689
+ const dataInputBusinessType = currentTreeItem?.dataInputBusinessType;
690
+ return (
691
+ <div
692
+ className={'rule_line_content'}
693
+ style={{ display: 'flex', marginBottom: '0px', padding: '10px 0px' }}
694
+ >
695
+ <div
696
+ className={'logical_operate_content'}
697
+ style={{
698
+ display: itemDetail.operationType == 'logic' ? 'block' : 'none',
699
+ width: '60px',
700
+ zIndex: 20,
701
+ }}
702
+ >
703
+ <Popover
704
+ content={
705
+ <div>
706
+ <p
707
+ className={'choose_logical_type'}
708
+ onClick={() => {
709
+ this.handleLogicalTypeChange(itemDetail, 'or');
710
+ }}
711
+ >
712
+ 或者
713
+ </p>
714
+ <p
715
+ className={'choose_logical_type'}
716
+ onClick={() => {
717
+ this.handleLogicalTypeChange(itemDetail, 'and');
718
+ }}
719
+ >
720
+ 并且
721
+ </p>
722
+ </div>
723
+ }
724
+ trigger="focus"
725
+ >
726
+ <Button
727
+ disabled={disabled}
728
+ type="link"
729
+ className={'logical_item_btn'}
730
+ >
731
+ {itemDetail?.operationCode == 'or' ? '或者' : '并且'}
732
+ <DownOutlined style={{ marginLeft: '6px' }} />
733
+ </Button>
734
+ </Popover>
735
+ <span className={'top_line'}></span>
736
+ <span className={'bottom_line'}></span>
737
+ </div>
738
+
739
+ <div style={{ flexGrow: 1 }}>
740
+ {itemDetail.operationType == 'logic' ? (
741
+ itemDetail?.subExpression?.map((item1) => {
742
+ return this.renderRuleItem(
743
+ item1,
744
+ itemDetail,
745
+ finalIndex,
746
+ classDataIndex,
747
+ relateDatas,
748
+ );
749
+ })
750
+ ) : (
751
+ <div style={{ display: 'flex', alignItems: 'center' }}>
752
+ {/* todo */}
753
+ <TreeSelect
754
+ value={itemDetail.elementId}
755
+ disabled={disabled}
756
+ onChange={(value, name, nodeInfo) => {
757
+ if (!nodeInfo.triggerNode.props.isLeaf) return; //只有最末端叶子节点可选中
758
+ const { ruleClassData } = this.state;
759
+ itemDetail.propertyPath = nodeInfo.triggerNode.props.pValue;
760
+ itemDetail.params = [];
761
+ itemDetail.paramNames = [];
762
+ itemDetail.operationCode = '';
763
+ itemDetail.elementId = nodeInfo.triggerNode.props.id;
764
+ itemDetail.elementName = nodeInfo.triggerNode.props.title;
765
+ itemDetail.dataTypeCode =
766
+ nodeInfo.triggerNode.props.dataTypeCode;
767
+ itemDetail.metaObjectCode =
768
+ nodeInfo.triggerNode.props.metaObjectCode;
769
+ itemDetail.isInsertParam = false;
770
+ this.setState(
771
+ {
772
+ ruleClassData,
773
+ },
774
+ () => {
775
+ callBack(ruleClassData);
776
+ },
777
+ );
778
+ }}
779
+ style={{ width: '200px' }}
780
+ treeData={ruleTreeData}
781
+ />
782
+ <Select
783
+ value={itemDetail?.operationCode || ''}
784
+ disabled={disabled}
785
+ style={{ width: '150px', marginLeft: '10px' }}
786
+ onChange={(value) => {
787
+ const { ruleClassData } = this.state;
788
+ itemDetail.operationCode = value;
789
+ this.setState(
790
+ {
791
+ ruleClassData,
792
+ },
793
+ () => {
794
+ callBack(ruleClassData);
795
+ },
796
+ );
797
+ }}
798
+ >
799
+ {this.getDataTypeOperateList(itemDetail.dataTypeCode).map(
800
+ (item) => (
801
+ <Select.Option value={item.code} key={item.code}>
802
+ {item.name}
803
+ </Select.Option>
804
+ ),
805
+ )}
806
+ </Select>
807
+ {!itemDetail?.isInsertParam ? (
808
+ <RuleField
809
+ customerWidth={this.props.customerWidth}
810
+ selectOperation={itemDetail?.operationCode || ''}
811
+ disabled={disabled}
812
+ initialThresholdQuery={thresholdQuery}
813
+ dataTypeCode={itemDetail?.dataTypeCode || ''}
814
+ dataChoiceBusinessType={dataChoiceBusinessType || ''}
815
+ dataInputBusinessType={dataInputBusinessType || ''}
816
+ itemDetail={itemDetail}
817
+ queryIdentifyType={queryIdentifyType}
818
+ queryIdentify={queryIdentify}
819
+ propertyCode={getPropertyCode(itemDetail.propertyPath)}
820
+ // propertyCode={`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`}
821
+ relateDatas={relateDatas}
822
+ values={itemDetail.params || []}
823
+ valueNames={itemDetail.paramNames || []}
824
+ callback={(newValues, newValueNames) => {
825
+ this.handleValuesChange(
826
+ itemDetail,
827
+ newValues,
828
+ newValueNames,
829
+ );
830
+ }}
831
+ />
832
+ ) : null}
833
+ <Select
834
+ disabled={disabled}
835
+ value={
836
+ itemDetail?.systemCode || itemDetail?.params?.[0]?.replace('{', '').replace('}', '') ||
837
+ ''
838
+ } // systemCode兼容用户结算组织那边使用规则
839
+ style={{
840
+ width: '250px',
841
+ marginLeft: '10px',
842
+ display: itemDetail?.isInsertParam ? '' : 'none',
843
+ }}
844
+ onChange={(value) => {
845
+ const { ruleClassData } = this.state;
846
+ itemDetail.params = [(value && `{${value}}`) || ''];
847
+ const name = systemVariableList.find(
848
+ (i) => i.code == value,
849
+ )?.name;
850
+ itemDetail.paramNames = [name || ''];
851
+ itemDetail.systemCode = value;
852
+ this.setState(
853
+ {
854
+ ruleClassData,
855
+ },
856
+ () => {
857
+ callBack(ruleClassData);
858
+ },
859
+ );
860
+ }}
861
+ >
862
+ {systemVariableList?.length
863
+ ? systemVariableList.map((item) => (
864
+ <Select.Option value={item.code} key={item.code}>
865
+ {item.name}
866
+ </Select.Option>
867
+ ))
868
+ : null}
869
+ </Select>
870
+ <PlusCircleOutlined
871
+ className={'icon_btn_style'}
872
+ onClick={() => {
873
+ this.addChildRules(itemDetail);
874
+ }}
875
+ style={{
876
+ color: '#008fe0',
877
+ marginLeft: '15px',
878
+ display: floorIndex > 4 || disabled ? 'none' : 'inline-block',
879
+ }}
880
+ />
881
+ <MinusCircleOutlined
882
+ className={'icon_btn_style'}
883
+ onClick={() => {
884
+ this.handleDeleteRule(
885
+ itemDetail,
886
+ parentDetail,
887
+ classDataIndex,
888
+ );
889
+ }}
890
+ style={{
891
+ color: 'gray',
892
+ display: disabled ? 'none' : 'inline-block',
893
+ }}
894
+ />
895
+ <Button
896
+ type="link"
897
+ disabled={
898
+ disabled || (itemDetail.operationCode === '' || !itemDetail.operationCode
899
+ ? true
900
+ : false)
901
+ }
902
+ onClick={() => {
903
+ const { ruleClassData } = this.state;
904
+ if (systemVariableList && Array.isArray(systemVariableList) && systemVariableList.length && systemVariableList[0].code!== '-1' ) {
905
+ itemDetail.isInsertParam = !itemDetail.isInsertParam;
906
+ if (itemDetail.isInsertParam) {
907
+ itemDetail.type = 10;
908
+ itemDetail.paramNames = [];
909
+ itemDetail.params = [];
910
+ } else {
911
+ itemDetail.systemCode = null;
912
+ }
913
+
914
+ this.setState(
915
+ {
916
+ ruleClassData,
917
+ },
918
+ () => {
919
+ callBack(ruleClassData);
920
+ },
921
+ );
922
+ } else {
923
+ message.warn('未配置规则变量');
924
+ }
925
+ }}
926
+ >
927
+ {itemDetail?.isInsertParam ? '取消插入参数' : '插入参数'}
928
+ </Button>
929
+ </div>
930
+ )}
931
+ <div
932
+ style={{
933
+ display:
934
+ itemDetail.operationType == 'logic' && !disabled
935
+ ? 'block'
936
+ : 'none',
937
+ }}
938
+ >
939
+ <span
940
+ style={{ color: '#008fe0', cursor: 'pointer' }}
941
+ type="link"
942
+ onClick={() => {
943
+ this.addPeerRule(itemDetail);
944
+ }}
945
+ >
946
+ <PlusCircleOutlined
947
+ style={{
948
+ color: '#008fe0',
949
+ fontSize: '14px',
950
+ marginRight: '5px',
951
+ }}
952
+ />
953
+ 添加条件
954
+ </span>
955
+ </div>
956
+ </div>
957
+ </div>
958
+ );
959
+ };
960
+
961
+ handleEditExtraInfoResponse = (code, val, parentDetail,classDataIndex, key) => {
962
+ const { ruleClassData } = this.state;
963
+ const { callBack } = this.props;
964
+ parentDetail.extraInfo.response = parentDetail.extraInfo.response.map((i) => {
965
+ if (i.code && key === i.code) {
966
+ i[code] = val;
967
+ return i;
968
+ }
969
+ return i;
970
+ });
971
+ ruleClassData[classDataIndex].extraInfo.response = ruleClassData[
972
+ classDataIndex
973
+ ].extraInfo.response.map((i) => {
974
+ if (i.code && key === i.code) {
975
+ i[code] = val;
976
+ return i;
977
+ }
978
+ return i;
979
+ });
980
+
981
+ this.setState(
982
+ {
983
+ ruleClassData,
984
+ },
985
+ () => {
986
+ callBack(ruleClassData);
987
+ },
988
+ );
989
+ };
990
+ // 场景需要返回值2022.11.15
991
+ renderResItem = (
992
+ itemDetail,
993
+ parentDetail,
994
+ ruleReturnConfig,
995
+ selectRuleReturnData,
996
+ classDataIndex,
997
+ disabled,
998
+ boxStyle,
999
+ ) => {
1000
+ const isRightText = ruleReturnConfig?.rightText?.length;
1001
+
1002
+ const showValue = (code, type, functionItem, configItem) => {
1003
+ let defaultValue = configItem.defaultValue;
1004
+ const pCode = itemDetail.response?.find((i) => i.code == code)?.value;
1005
+ if (type === 'input') {
1006
+ return pCode === undefined ? pCode : pCode || defaultValue;
1007
+ }
1008
+ if(['date','dateTime','rangeTime'].includes(type)) {
1009
+ if(['date','dateTime'].includes(type)) return pCode ? moment(pCode) : pCode;
1010
+ if(['rangeTime'].includes(type)) {
1011
+ const newPCode = Array.isArray(pCode) ? pCode : pCode?.split(',');
1012
+ return pCode ? newPCode?.map((i) => moment(i)) : pCode;
1013
+ }
1014
+ }
1015
+ return pCode || defaultValue;
1016
+ };
1017
+ const handleEdit = (code, val, functionItem) => {
1018
+ let value = val;
1019
+ if (isObj(code)) {
1020
+ Object.keys(code).forEach((ite) => {
1021
+ this.handleEditExtraInfoResponse(ite, code[ite], parentDetail,classDataIndex);
1022
+ });
1023
+ return;
1024
+ }
1025
+ if (Array.isArray(val)) {
1026
+ value = val.map((m) => m.value || m).join(',');
1027
+ }
1028
+ if (isObj(val)) {
1029
+ value = val.value || val.PCDCode?.join('/');
1030
+ }
1031
+ this.handleEditExtraInfoResponse('value', value, parentDetail,classDataIndex,code);
1032
+ };
1033
+
1034
+ return (
1035
+ <>
1036
+ {selectRuleReturnData && selectRuleReturnData.length ? (
1037
+ <div>
1038
+ <div className={'rule_action_return_border'}>
1039
+ <div className={'rule_border_title'}>返回值</div>
1040
+ <div>
1041
+ {selectRuleReturnData.map((item) => (
1042
+ <div style={{ display: 'flex' }}>
1043
+ {this.renderFormCompItem(
1044
+ item,
1045
+ showValue,
1046
+ handleEdit,
1047
+ {},
1048
+ boxStyle,
1049
+ disabled,
1050
+ )}
1051
+ <MinusCircleOutlined
1052
+ className={'icon_btn_style'}
1053
+ onClick={() => {
1054
+ this.handleEditExtraInfoResponse(
1055
+ 'enable',
1056
+ false,
1057
+ parentDetail,
1058
+ classDataIndex,
1059
+ item.code,
1060
+ );
1061
+ }}
1062
+ style={{
1063
+ color: 'gray',
1064
+ marginLeft: isRightText ? '100px' : '15px',
1065
+ marginTop: '15px',
1066
+ display: disabled ? 'none' : 'inline-block',
1067
+ }}
1068
+ />
1069
+ </div>
1070
+ ))}
1071
+ </div>
1072
+ </div>
1073
+ </div>
1074
+ ) : (
1075
+ <></>
1076
+ )}
1077
+ </>
1078
+ );
1079
+ };
1080
+
1081
+
1082
+ renderFormCompItem = (
1083
+ config,
1084
+ showValue,
1085
+ handleEdit,
1086
+ parentItem,
1087
+ boxStyle,
1088
+ disabled
1089
+ ) => {
1090
+ if (!config) return;
1091
+ return (
1092
+ <div style={boxStyle}>
1093
+ {(config?.leftText && (
1094
+ <div style={{ flex: 'none', marginRight: 10 }}>
1095
+ {config?.required && <span className="requiredMark" />}
1096
+ {config.leftText}
1097
+ </div>
1098
+ )) ||
1099
+ null}
1100
+ {(!config?.leftText && config?.rightText && config?.required && (
1101
+ <div style={{ flex: 'none', marginRight: 10 }}>
1102
+ <span className="requiredMark" />
1103
+ </div>
1104
+ )) ||
1105
+ null}
1106
+ <RenderCompItem regularDataList={this.props.regularDataList} ites={config} showValue={(a, b, c = parentItem, d = config) => showValue(a, b, c, d)} handleEdit={(a, b, c = parentItem, d = config) => handleEdit(a, b, c, d)} disabled={disabled}></RenderCompItem>
1107
+ {(config?.rightText && (
1108
+ <div style={{ flex: 'none', marginLeft: 10 }}>{config.rightText}</div>
1109
+ )) ||
1110
+ null}
1111
+ </div>
1112
+ );
1113
+ };
1114
+
1115
+ renderActionList = (
1116
+ itemDetail,
1117
+ parentDetail,
1118
+ handleRuleTypeData,
1119
+ sRuleActionData,
1120
+ classDataIndex,
1121
+ disabled,
1122
+ boxStyle,
1123
+ ) => {
1124
+ const showValue = (code, type, functionItem, configItem) => {
1125
+ const functionIndex = handleRuleTypeData.findIndex(
1126
+ (m) => m.code === functionItem.code,
1127
+ );
1128
+ const pCode =
1129
+ itemDetail.execute[functionIndex] &&
1130
+ itemDetail.execute[functionIndex].properties[code];
1131
+ let defaultValue = configItem.defaultValue;
1132
+ if (type === 'input') {
1133
+ return pCode === undefined ? pCode : pCode || defaultValue;
1134
+ }
1135
+ return pCode || defaultValue;
1136
+ };
1137
+ const handleEdit = (code, val, functionItem) => {
1138
+ const functionIndex = handleRuleTypeData.findIndex(
1139
+ (m) => m.code === functionItem.code,
1140
+ );
1141
+ const { ruleClassData } = this.state;
1142
+ const { callBack } = this.props;
1143
+ parentDetail.extraInfo.execute[functionIndex]['properties'][code] = val;
1144
+ parentDetail.extraInfo.execute[functionIndex]['code'] = functionItem.code;
1145
+
1146
+ this.setState(
1147
+ {
1148
+ ruleClassData,
1149
+ },
1150
+ () => {
1151
+ callBack(ruleClassData);
1152
+ },
1153
+ );
1154
+ };
1155
+
1156
+ return (
1157
+ <>
1158
+ {sRuleActionData && sRuleActionData.length ? (
1159
+ <div>
1160
+ <div className={'rule_action_return_border'}>
1161
+ <div className={'rule_border_title'}>动作</div>
1162
+ <div>
1163
+ {sRuleActionData.map((i, index) => (
1164
+ <div>
1165
+ <div className={'rule_action_item'}>
1166
+ {(i.valueList?.length &&
1167
+ i.valueList.map((s) => {
1168
+ return this.renderFormCompItem(
1169
+ s,
1170
+ showValue,
1171
+ handleEdit,
1172
+ i,
1173
+ boxStyle,
1174
+ disabled,
1175
+ );
1176
+ })) || (
1177
+ <div style={boxStyle} key={i.functionName}>
1178
+ <div>{i.functionName}</div>
1179
+ </div>
1180
+ )}
1181
+ <MinusCircleOutlined
1182
+ className={'icon_btn_style'}
1183
+ onClick={() => {
1184
+ this.handleDeleteRuleAction(classDataIndex, i.code);
1185
+ }}
1186
+ style={{
1187
+ color: 'gray',
1188
+ marginLeft: '15px',
1189
+ marginTop: '15px',
1190
+ display: disabled ? 'none' : 'inline-block',
1191
+ }}
1192
+ />
1193
+ </div>
1194
+ </div>
1195
+ ))}
1196
+ </div>
1197
+ </div>
1198
+ </div>
1199
+ ) : (
1200
+ <></>
1201
+ )}
1202
+ </>
1203
+ );
1204
+ };
1205
+
1206
+ renderRuleTypeItem = (
1207
+ itemDetail,
1208
+ parentDetail,
1209
+ floorIndex,
1210
+ classDataIndex,
1211
+ ruleTypeData,
1212
+ ruleReturnConfig,
1213
+ isRuleInstance
1214
+ ) => {
1215
+ const { modalParams } = this.state;
1216
+ const { disabled } = this.props;
1217
+ const isHaveRuleTypeData = ruleTypeData?.length;
1218
+ const isHaveRuleReturnConfig = ruleReturnConfig?.length;
1219
+ const handleRuleTypeData = isHaveRuleTypeData
1220
+ ? ruleTypeData.sort((a, b) => a.priority - b.priority)
1221
+ : [];
1222
+
1223
+ const selectRuleActionCode = isHaveRuleTypeData
1224
+ ? itemDetail.execute.filter((i) => i.isSelected).map((s) => s.code)
1225
+ : [];
1226
+
1227
+ const selectRuleReturnCode = isHaveRuleReturnConfig
1228
+ ? _.compact(
1229
+ itemDetail.response.filter((i) => i?.enable).map((s) => s?.code),
1230
+ )
1231
+ : [];
1232
+
1233
+ const selectRuleActionData = isHaveRuleTypeData
1234
+ ? handleRuleTypeData.filter((r) =>
1235
+ selectRuleActionCode.some((s) => s === r.code),
1236
+ )
1237
+ : [];
1238
+
1239
+ const selectRuleReturnData = isHaveRuleReturnConfig
1240
+ ? itemDetail.response.length === 1 &&
1241
+ !itemDetail.response[0]?.code &&
1242
+ itemDetail.response[0]?.enable
1243
+ ? [{ ...ruleReturnConfig[0], value: itemDetail.response[0]?.value }]
1244
+ : ruleReturnConfig.filter((r) =>
1245
+ selectRuleReturnCode.some((s) => s === r.code),
1246
+ )
1247
+ : [];
1248
+
1249
+ const RuleActionItemStyle = {
1250
+ display: 'flex',
1251
+ // height: '30px',
1252
+ // lineHeight: '30px',
1253
+ margin: '10px 0px',
1254
+ };
1255
+
1256
+ const displayNoneActionStyle = (isRuleInstance && !isHaveRuleTypeData)? { display: 'none' }: {};
1257
+ const displayNoneReturnValueStyle = (isRuleInstance && !isHaveRuleReturnConfig)? { display: 'none' }: {};
1258
+
1259
+ return (
1260
+ <div>
1261
+ <div style={{ textAlign: 'right', display: 'flex', marginBottom: 10 }}>
1262
+ <Button
1263
+ disabled={disabled}
1264
+ type="link"
1265
+ style={displayNoneActionStyle}
1266
+ onClick={() => {
1267
+ if (isHaveRuleTypeData) {
1268
+ this.setState({
1269
+ modalParams: {
1270
+ ...modalParams,
1271
+ type: 'action',
1272
+ dataSource: handleRuleTypeData,
1273
+ classDataIndex,
1274
+ visible: true,
1275
+ },
1276
+ });
1277
+ } else {
1278
+ message.warn('未配置执行动作');
1279
+ }
1280
+ }}
1281
+ >
1282
+ 新增动作
1283
+ </Button>
1284
+ <Button
1285
+ disabled={disabled}
1286
+ type="link"
1287
+ style={displayNoneReturnValueStyle}
1288
+ onClick={() => {
1289
+ if (isHaveRuleReturnConfig) {
1290
+ this.setState({
1291
+ modalParams: {
1292
+ ...modalParams,
1293
+ type: 'returnResponse',
1294
+ dataSource: ruleReturnConfig,
1295
+ classDataIndex,
1296
+ visible: true,
1297
+ },
1298
+ });
1299
+ } else {
1300
+ message.warn('未配置返回');
1301
+ }
1302
+ }}
1303
+ >
1304
+ 新增返回值
1305
+ </Button>
1306
+ </div>
1307
+ {(isHaveRuleTypeData &&
1308
+ this.renderActionList(
1309
+ itemDetail,
1310
+ parentDetail,
1311
+ handleRuleTypeData,
1312
+ selectRuleActionData,
1313
+ classDataIndex,
1314
+ disabled,
1315
+ RuleActionItemStyle,
1316
+ )) ||
1317
+ null}
1318
+ {(isHaveRuleReturnConfig &&
1319
+ this.renderResItem(
1320
+ itemDetail,
1321
+ parentDetail,
1322
+ ruleReturnConfig,
1323
+ selectRuleReturnData,
1324
+ classDataIndex,
1325
+ disabled,
1326
+ RuleActionItemStyle,
1327
+ )) ||
1328
+ null}
1329
+ </div>
1330
+ );
1331
+ };
1332
+
1333
+ //添加同一层级条件
1334
+ addPeerRule = (itemDetail) => {
1335
+ const { ruleClassData } = this.state;
1336
+ const { callBack, disabled } = this.props;
1337
+ if (disabled) return;
1338
+ itemDetail.subExpression.push({
1339
+ // "expressionType": "relation",
1340
+ operationType: 'relation',
1341
+ operationCode: '',
1342
+ propertyPath: '',
1343
+ params: [],
1344
+ paramNames: [],
1345
+ });
1346
+ this.setState(
1347
+ {
1348
+ ruleClassData,
1349
+ },
1350
+ () => {
1351
+ callBack(ruleClassData);
1352
+ },
1353
+ );
1354
+ };
1355
+
1356
+ //添加子层级条件
1357
+ addChildRules = (itemDetail) => {
1358
+ const { ruleClassData } = this.state;
1359
+ const { callBack } = this.props;
1360
+ const initialData = JSON.parse(JSON.stringify(itemDetail));
1361
+ delete itemDetail.propertyPath;
1362
+ delete itemDetail.params;
1363
+ delete itemDetail.paramNames;
1364
+ delete itemDetail.dataTypeCode;
1365
+ delete itemDetail.elementId;
1366
+ delete itemDetail.elementName;
1367
+ delete itemDetail.metaObjectCode;
1368
+ // itemDetail.expressionType = 'logic';
1369
+ itemDetail.operationType = 'logic';
1370
+ itemDetail.operationCode = 'and';
1371
+ itemDetail.subExpression = [
1372
+ initialData,
1373
+ {
1374
+ // "expressionType": "relation",
1375
+ operationType: 'relation',
1376
+ type: 20,
1377
+ operationCode: '',
1378
+ propertyPath: '',
1379
+ params: [],
1380
+ paramNames: [],
1381
+ },
1382
+ ];
1383
+ this.setState(
1384
+ {
1385
+ ruleClassData,
1386
+ },
1387
+ () => {
1388
+ callBack(ruleClassData);
1389
+ },
1390
+ );
1391
+ };
1392
+
1393
+ handleDeleteRule = (itemDetail, parentDetail, classDataIndex) => {
1394
+ const { ruleClassData } = this.state;
1395
+ const { callBack, metaObjectCode } = this.props;
1396
+ if (parentDetail.ruleName) {
1397
+ //删除根规则层级最后一条时整个规则项删除
1398
+ ruleClassData.splice(classDataIndex, 1);
1399
+ } else {
1400
+ let deleteItemIndex = parentDetail.subExpression.findIndex(
1401
+ (detailItem) =>
1402
+ JSON.stringify(itemDetail) == JSON.stringify(detailItem),
1403
+ );
1404
+ if (parentDetail.subExpression.length > 2) {
1405
+ parentDetail.subExpression.splice(deleteItemIndex, 1);
1406
+ } else {
1407
+ parentDetail.subExpression.splice(deleteItemIndex, 1);
1408
+ // parentDetail.expressionType = parentDetail.subExpression[0].expressionType;
1409
+ parentDetail.operationCode =
1410
+ parentDetail.subExpression[0].operationCode;
1411
+ parentDetail.operationType =
1412
+ parentDetail.subExpression[0].operationType;
1413
+
1414
+ if (parentDetail.subExpression[0].operationType == 'logic') {
1415
+ parentDetail.subExpression = [
1416
+ ...parentDetail.subExpression[0].subExpression,
1417
+ ];
1418
+ } else {
1419
+ parentDetail.propertyPath =
1420
+ parentDetail.subExpression[0].propertyPath;
1421
+ parentDetail.params = [...parentDetail.subExpression[0].params];
1422
+ parentDetail.paramNames = parentDetail.subExpression[0].paramNames
1423
+ ? [...parentDetail.subExpression[0].paramNames]
1424
+ : [];
1425
+ parentDetail.metaObjectCode = metaObjectCode || parentDetail.subExpression[0].metaObjectCode;
1426
+ parentDetail.elementId = parentDetail.subExpression[0].elementId;
1427
+ parentDetail.elementName = parentDetail.subExpression[0].elementName;
1428
+ parentDetail.dataTypeCode =
1429
+ parentDetail.subExpression[0].dataTypeCode;
1430
+ delete parentDetail.subExpression;
1431
+ }
1432
+ }
1433
+ }
1434
+ this.setState(
1435
+ {
1436
+ ruleClassData,
1437
+ },
1438
+ () => {
1439
+ callBack(ruleClassData);
1440
+ },
1441
+ );
1442
+ };
1443
+
1444
+ handleLogicalTypeChange = (itemDetail, type) => {
1445
+ const { ruleClassData } = this.state;
1446
+ const { callBack } = this.props;
1447
+ itemDetail.operationCode = type;
1448
+ this.setState(
1449
+ {
1450
+ ruleClassData,
1451
+ },
1452
+ () => {
1453
+ callBack(ruleClassData);
1454
+ },
1455
+ );
1456
+ };
1457
+
1458
+ // 新增执行顺序
1459
+ handleSelectRuleAction = (keys, classDataIndex, type, callback) => {
1460
+ callback();
1461
+ const { callBack } = this.props;
1462
+ const { ruleClassData } = this.state;
1463
+ if (type === 'action') {
1464
+ ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
1465
+ classDataIndex
1466
+ ].extraInfo.execute.map((i) => {
1467
+ if (i.code && keys.some((r) => r === i.code) && !i.isSelected) {
1468
+ return { ...i, isSelected: true };
1469
+ }
1470
+ return i;
1471
+ });
1472
+ } else {
1473
+ ruleClassData[classDataIndex].extraInfo.response = ruleClassData[
1474
+ classDataIndex
1475
+ ].extraInfo.response.map((i) => {
1476
+ if (i.code && keys.some((r) => r === i.code) && !i.enable) {
1477
+ console.log('i', i);
1478
+ return { ...i, enable: true };
1479
+ }
1480
+ return i;
1481
+ });
1482
+ }
1483
+ // 处理数据
1484
+ this.setState(
1485
+ {
1486
+ ruleClassData,
1487
+ },
1488
+ () => {
1489
+ callBack(ruleClassData);
1490
+ },
1491
+ );
1492
+ };
1493
+
1494
+ handleDeleteRuleAction = (classDataIndex, functionCode) => {
1495
+ const { callBack } = this.props;
1496
+ const { ruleClassData } = this.state;
1497
+ ruleClassData[classDataIndex].extraInfo.execute = ruleClassData[
1498
+ classDataIndex
1499
+ ].extraInfo.execute.map((i) => {
1500
+ if (i.code && functionCode === i.code && i.isSelected) {
1501
+ return { ...i, isSelected: false };
1502
+ }
1503
+ return i;
1504
+ });
1505
+ // 处理数据
1506
+ this.setState(
1507
+ {
1508
+ ruleClassData,
1509
+ },
1510
+ () => {
1511
+ callBack(ruleClassData);
1512
+ },
1513
+ );
1514
+ };
1515
+
1516
+ render() {
1517
+ const { onlyOneRule, callBack, disabled, headerButtonComponentFun } = this.props;
1518
+ const { ruleClassData, modalParams } = this.state;
1519
+ return (
1520
+ <div className={'base_rule'}>
1521
+ <div className={'base_rule_content'}>
1522
+ {headerButtonComponentFun?headerButtonComponentFun(this.handleAddRule): (
1523
+ <div
1524
+ disabled={disabled}
1525
+ style={{
1526
+ display: onlyOneRule ? 'none' : 'block',
1527
+ }}
1528
+ className={'base_rule_line_title'}
1529
+ >
1530
+ <Button
1531
+ onClick={this.handleAddRule}
1532
+ className={'base_rule_btn_style'}
1533
+ type="link"
1534
+ >
1535
+ 新增规则
1536
+ </Button>
1537
+ </div>
1538
+ )}
1539
+ <div>{this.renderRuleContent()}</div>
1540
+ </div>
1541
+ {(modalParams.visible && (
1542
+ <Modal
1543
+ title={modalParams.type === 'action' ? '新增动作' : '新增返回值'}
1544
+ visible={modalParams.visible}
1545
+ onCancel={() => {
1546
+ this.setState({
1547
+ modalParams: { ...modalParams, visible: false },
1548
+ });
1549
+ }}
1550
+ maskClosable={false}
1551
+ destroyOnClose
1552
+ footer={null}
1553
+ >
1554
+ <Table
1555
+ rowSelection={{
1556
+ onChange: (keys, selectRows) => {
1557
+ this.handleSelectRuleAction(
1558
+ keys,
1559
+ modalParams.classDataIndex,
1560
+ modalParams?.type,
1561
+ () => {
1562
+ this.setState({
1563
+ modalParams: { ...modalParams, visible: false },
1564
+ });
1565
+ },
1566
+ );
1567
+ },
1568
+ }}
1569
+ columns={
1570
+ modalParams.type === 'action'
1571
+ ? [
1572
+ {
1573
+ title: '执行动作名称',
1574
+ key: 'functionName',
1575
+ dataIndex: 'functionName',
1576
+ },
1577
+ ]
1578
+ : [
1579
+ {
1580
+ title: '字段名称',
1581
+ key: 'name',
1582
+ dataIndex: 'name',
1583
+ },
1584
+ {
1585
+ title: '字段编码',
1586
+ key: 'code',
1587
+ dataIndex: 'code',
1588
+ },
1589
+ ]
1590
+ }
1591
+ dataSource={modalParams?.dataSource}
1592
+ rowKey={'code'}
1593
+ />
1594
+ </Modal>
1595
+ )) ||
1596
+ null}
1597
+ </div>
1598
+ );
1599
+ }
1600
+ }
1601
+ export default RuleObjectComponent;