@bit-sun/business-component 3.1.10-alpha.1 → 3.1.10-alpha.11

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 (223) 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/components/Functional/AddSelect/index.d.ts +1 -1
  9. package/dist/index.esm.js +485 -205
  10. package/dist/index.js +486 -206
  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 +568 -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 +767 -767
  79. package/src/components/Business/BsSulaQueryTable/setting.tsx +890 -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 +2326 -2318
  123. package/src/components/Business/SearchSelect/common.ts +134 -134
  124. package/src/components/Business/SearchSelect/index.md +1570 -1570
  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 +239 -239
  131. package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
  132. package/src/components/Business/TreeSearchSelect/utils.ts +115 -115
  133. package/src/components/Business/columnSettingTable/columnSetting.tsx +818 -816
  134. package/src/components/Business/columnSettingTable/index.less +253 -253
  135. package/src/components/Business/columnSettingTable/index.md +372 -372
  136. package/src/components/Business/columnSettingTable/index.tsx +225 -225
  137. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +232 -232
  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 +1088 -1072
  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 -771
  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 +782 -782
  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 +1050 -1046
  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/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +358 -358
  178. package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +255 -255
  179. package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +57 -57
  180. package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.tsx +129 -129
  181. package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
  182. package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
  183. package/src/components/Solution/RuleComponent/RenderCompItem.tsx +774 -774
  184. package/src/components/Solution/RuleComponent/index.d.ts +34 -29
  185. package/src/components/Solution/RuleComponent/index.js +1680 -1663
  186. package/src/components/Solution/RuleComponent/index.less +247 -247
  187. package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
  188. package/src/components/Solution/RuleComponent/ruleFiled.js +2695 -2695
  189. package/src/components/Solution/RuleComponent/services.ts +13 -13
  190. package/src/components/Solution/RuleComponent/util.js +143 -143
  191. package/src/components/Solution/RuleSetter/RuleInstance.tsx +6 -6
  192. package/src/components/Solution/RuleSetter/baseRule.tsx +414 -414
  193. package/src/components/Solution/RuleSetter/function.ts +467 -467
  194. package/src/components/Solution/RuleSetter/index.less +221 -221
  195. package/src/components/Solution/RuleSetter/index.tsx +210 -210
  196. package/src/components/Solution/RuleSetter/service.js +276 -276
  197. package/src/index.ts +42 -42
  198. package/src/plugin/TableColumnSetting/index.less +247 -247
  199. package/src/plugin/TableColumnSetting/index.md +50 -50
  200. package/src/plugin/TableColumnSetting/index.tsx +725 -725
  201. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  202. package/src/styles/bsDefault.less +1933 -1933
  203. package/src/utils/CheckOneUser/index.md +39 -39
  204. package/src/utils/CheckOneUser/index.ts +51 -51
  205. package/src/utils/CustomLoginInfo.ts +55 -55
  206. package/src/utils/LocalstorageUtils.ts +134 -134
  207. package/src/utils/TableUtils.less +51 -51
  208. package/src/utils/TableUtils.tsx +691 -691
  209. package/src/utils/TreeUtils.ts +12 -12
  210. package/src/utils/auth.ts +38 -38
  211. package/src/utils/businessUtils.ts +434 -434
  212. package/src/utils/checkUtils.ts +39 -39
  213. package/src/utils/constant.ts +38 -38
  214. package/src/utils/enumConfig.ts +17 -17
  215. package/src/utils/getFormMode.js +12 -12
  216. package/src/utils/index.ts +21 -21
  217. package/src/utils/request.ts +53 -53
  218. package/src/utils/requestUtils.ts +197 -197
  219. package/src/utils/serialize.js +7 -7
  220. package/src/utils/utils.ts +266 -266
  221. package/src/utils/xlsxUtil.tsx +145 -145
  222. package/tsconfig.json +29 -29
  223. package/typings.d.ts +4 -4
@@ -1,534 +1,534 @@
1
- // @ts-nocheck
2
- import React, { useState, useRef, useEffect, Fragment } from 'react';
3
- import { message, Button, Table, Tabs } from 'antd';
4
- import Drawer from './drawer';
5
- import ConfigButton from './configButton';
6
- import Editor from './jsonEditor';
7
- import request from '@/utils/request';
8
- import FieldsSettingsTable from './components/FieldsSettingsTable';
9
- import { isEmpty } from "lodash"
10
- import './index.less';
11
- import { getUserId } from '@/utils/LocalstorageUtils';
12
-
13
- function iterFileds (fields) {
14
- let filedsValue = [];
15
-
16
- function iter(field) {
17
- if(Array.isArray(field.fields)) {
18
- field.fields.forEach(item => {
19
- const targetValue = iterFileds(item);
20
- if(targetValue){
21
- filedsValue.push(targetValue);
22
- }
23
- })
24
- } else {
25
- return {
26
- name: field.name,
27
- isStaticCode: true,
28
- label: field.label,
29
- }
30
- }
31
-
32
- return {
33
- container: {
34
- name: field?.container?.props?.name,
35
- title: field?.container?.props?.title
36
- },
37
- isStaticCode: true,
38
- fields: filedsValue,
39
- };
40
- }
41
-
42
- filedsValue = iter(fields)
43
-
44
- return filedsValue;
45
- }
46
-
47
- function flatFileds (fields) {
48
- let filedsValue = {
49
- };
50
- function iter(field, containerName) {
51
- if(Array.isArray(field.fields)) {
52
- if (field?.container?.props?.name) {
53
- filedsValue[field?.container?.props?.name] = {
54
- ...field,
55
- fields: []
56
- }
57
- }
58
- field.fields.forEach(item => {
59
- iter(item, field?.container?.props?.name)
60
- })
61
- } else {
62
- filedsValue[containerName ? (containerName + field.name) : field.name] = field
63
- }
64
- }
65
-
66
- iter(fields)
67
-
68
- return filedsValue;
69
- }
70
-
71
- function convertFileds (fields, falltValue, faltFieldRange, containerName) {
72
- let filedsValue = [];
73
-
74
- function iter(field) {
75
- if(Array.isArray(field.fields)) {
76
- field.fields.forEach(item => {
77
- const targetValue = convertFileds(item, falltValue, faltFieldRange, field?.container?.name);
78
- if(targetValue){
79
- if(item.dependency) {
80
- targetValue.dependency = {
81
- visible: {
82
- ...item.dependency.visible,
83
- type: (new Function('request','ctx', item.dependency.visible.type)).bind(null, request)
84
- }
85
- }
86
- }
87
- filedsValue.push(targetValue)
88
- }
89
- })
90
- } else {
91
- const returnField = field.isStaticCode ? falltValue[containerName ? (containerName + field.name) : field.name] : faltFieldRange[field.name];
92
- if (returnField) {
93
- returnField.label = field?.label;
94
- if(field?.disabled){ // 字段设置只读属性
95
- returnField.field.props.disabled = true;
96
- }
97
- if(field?.invisible){ // 字段设置不可见属性
98
- returnField.initialVisible = false;
99
- }
100
-
101
- if(Array.isArray(returnField.name)&&returnField.name?.includes("extensionFields")){
102
- returnField.notShowLabel = true;
103
- }
104
- } else {
105
- }
106
- return returnField;
107
- }
108
-
109
- return {...falltValue[field?.container?.name], fields: filedsValue};
110
- }
111
-
112
- filedsValue = iter(fields)
113
-
114
- return filedsValue;
115
- }
116
-
117
- function faltColumns(columns) {
118
- let columnsValue = {}
119
-
120
- columns.forEach(item => {
121
- columnsValue[item.key] = {...item}
122
- })
123
-
124
- return columnsValue;
125
- }
126
-
127
- function faltCustomerFieldRange(fileds) {
128
- let columnsValue = {}
129
-
130
- fileds.forEach(item => {
131
- columnsValue[item.name] = {...item}
132
- })
133
-
134
- return columnsValue;
135
- }
136
-
137
- //form存在新加container属性分组得情况 组合操作
138
- function combineContainer(originFields, currentFields){
139
- let newCurrentFields = [...originFields];
140
- currentFields.map((item: any) => {
141
- if(!originFields.find((i: any) => i?.container?.props?.name == item?.container?.name)){
142
- newCurrentFields = [...newCurrentFields, {
143
- container: {
144
- type: 'card',
145
- props: {
146
- title: item?.container?.title,
147
- level: 1,
148
- id: Math.random(),
149
- isWhiteCard: true,
150
- bordered: false,
151
- name: item?.container?.name,
152
- },
153
- },
154
- fields: item?.fields || []
155
- }];
156
- }
157
- })
158
- return newCurrentFields;
159
- }
160
-
161
- function hanleCallbackValue(codeProps, value, customerFields, cacheColumns = []) {
162
- const faltFieldRange = faltCustomerFieldRange(customerFields);
163
- // const falltValue = flatFileds({fields: codeProps.fields})
164
- const falltValue = flatFileds({fields: combineContainer(codeProps.fields, value?.fields)})
165
- let newCodeProps = {...codeProps};
166
- newCodeProps.fields = convertFileds({fields: value.fields}, falltValue, faltFieldRange).fields;
167
- if (codeProps.columns) {
168
- const faltColumnsValue = faltColumns(codeProps.columns)
169
- newCodeProps.columns = value.columns.map(item => {
170
- if (item.isStaticCode) {
171
- const cacheFieldProperty = cacheColumns.find(k => (k.key||k.dataIndex) == (item.key||item.dataIndex));
172
- return {
173
- ...faltColumnsValue[item.key],
174
- ...cacheFieldProperty
175
- }
176
- } else {
177
- //自定义字段-列字段
178
- if(item?.key&&item?.key.includes('extensionFields')&&item?.key.includes(',')){
179
- return {
180
- ...item,
181
- render: ({ record }: any) => {
182
- try{
183
- const { extensionFields = {} } = record;
184
- const fieldName1= item?.key.split(',')[1]; //兼容没有fieldName的情况
185
- const fieldName2 = `${fieldName1}Name`;
186
- if(customerFields.length){
187
- const targetField = customerFields.find(k => k.name.includes(fieldName1));
188
- if(targetField){
189
- const { initialSource = [] } = targetField
190
- if(initialSource.length){
191
- return initialSource.find((d => d.value == extensionFields[fieldName1]))?.text || extensionFields[fieldName1];
192
- }
193
- }
194
- }
195
- return extensionFields[fieldName2] || extensionFields[fieldName1] || '';
196
- }catch(e){
197
- console.log('e',e);
198
- }
199
- }
200
- }
201
- }else{
202
- return {
203
- ...item
204
- }
205
- }
206
- }
207
- });
208
-
209
- //进行列表搜索项自定义字段name替换 (排除是编辑表单的fields)
210
- newCodeProps.fields = newCodeProps.fields.map(item => {
211
- if(Array.isArray(item?.name)){
212
- return {
213
- ...item,
214
- name: item?.realSearchName || item?.name
215
- }
216
- }
217
- return item;
218
- });
219
-
220
- }
221
-
222
- return newCodeProps;
223
- }
224
-
225
- function isAdmin() {
226
- const username = getUserId();
227
-
228
- return username === 'admin' || username === 'uiuiui'
229
- }
230
-
231
- const tableStyleList = [
232
- {
233
- type: '快速搜索',
234
- img: 'https://img.alicdn.com/tfs/TB1al1JqHr1gK0jSZR0XXbP8XXa-40-40.svg',
235
- url: '/list/singlesearch',
236
- },
237
- {
238
- type: '高级搜索',
239
- img: 'https://img.alicdn.com/tfs/TB1QgKIqQL0gK0jSZFtXXXQCXXa-40-40.svg',
240
- url: '/list/advancedsearch',
241
- },
242
- {
243
- type: '一般搜索',
244
- img: 'https://img.alicdn.com/tfs/TB1xHCPqRr0gK0jSZFnXXbRRXXa-40-40.svg',
245
- url: '/list/basic',
246
- },
247
- {
248
- type: '无分页表格',
249
- img: 'https://img.alicdn.com/tfs/TB1txuMqQL0gK0jSZFxXXXWHVXa-40-40.svg',
250
- url: '/list/nopagination',
251
- },
252
- {
253
- type: '分步查询表格',
254
- img: 'https://img.alicdn.com/tfs/TB10IOmGkL0gK0jSZFAXXcA9pXa-53-46.svg',
255
- url: '/list/stepquerytable',
256
- },
257
- ];
258
- const JsonQueryTable = React.memo(props => {
259
- const {
260
- callBack, // 主保存函数回调
261
- codeProps, // 整体的配置数据
262
- customerFields, //可选的配置字段
263
- initialSetting, //上一次添加自定义字段后保存的数据
264
- pageType, //页面权限code
265
- detailTablesSetting = [], //详情明细表格列配置数据
266
- saveTableCallBack, //详情明细保存函数回调
267
- } = props;
268
-
269
- let codeFilter = {};
270
- if (codeProps.columns) { // table
271
- codeFilter.columns = codeProps.columns.map(item => ({
272
- key: item.key,
273
- isStaticCode: true,
274
- title: item.title
275
- }))
276
-
277
- codeFilter.fields = codeProps.fields.map(item => ({
278
- name: item.name,
279
- isStaticCode: true,
280
- label: item.label,
281
- notShowLabel: item.notShowLabel || false
282
- }))
283
- } else {
284
- codeFilter.fields = iterFileds({fields: codeProps.fields}).fields
285
- }
286
-
287
- const styleRef = useRef(null);
288
-
289
- const [visible, setVisible] = useState(false)
290
- const [code, setCode] = useState(codeProps);
291
- const [init, setInit] = useState(true);
292
- const [jsonEditorVal, setJsonEditorVal] = useState(initialSetting || codeFilter);
293
- const [moduleParams, setModuleParams] = useState({});
294
- const [activeKey, setActiveKey] = useState('main'); //默认详情页配置
295
- const [tablesConfigParams, setTablesConfigParams] = useState({});
296
- const [tableJsonEditorValsArr, setTableJsonEditorValsArr] = useState([]);
297
-
298
- useEffect(()=>{
299
- Promise.all([
300
- request.get(`/basic/flow/businessFieldGroup/one?moduleType=2&layoutPoint=${pageType}`),
301
- ]).then(([res] )=> {
302
- const { code, data } = res?.data || {};
303
- if (code === '000000') {
304
- if(data){
305
- const { businessType, code:fieldGroup, moduleType, moduleRelationId } = data;
306
- setModuleParams({
307
- businessType,
308
- fieldGroup,
309
- moduleType,
310
- moduleRelationId
311
- });
312
- }
313
- }
314
- })
315
- },[]);
316
-
317
- useEffect(()=>{
318
- //明细表的配置数据
319
- const axiosArr = detailTablesSetting.map((item:any) => request.get(`/basic/flow/businessFieldGroup/one?moduleType=2&layoutPoint=${item.tableCode}`));
320
- Promise.all(axiosArr).then(([...resArr])=> {
321
- let configParams = {};
322
- detailTablesSetting.map((item:any, index:number)=>{
323
- const { code, data } = resArr[index]?.data || {};
324
- if(data){
325
- const { businessType, code:fieldGroup, moduleType } = data;
326
- configParams [item.tableCode] = {
327
- businessType,
328
- fieldGroup,
329
- moduleType,
330
- tableFlag: true
331
- }
332
- }
333
- })
334
- setTablesConfigParams({
335
- ...configParams,
336
- });
337
- })
338
-
339
- const detailTableCodeFilter = detailTablesSetting.map(item => {
340
- if(item?.initialSetting && item?.initialSetting.length){
341
- return {
342
- ...item,
343
- columns: item?.initialSetting
344
- }
345
- }
346
- return {
347
- ...item,
348
- columns: item?.columns.map(childItem => ({
349
- key: childItem.key || childItem.dataIndex,
350
- dataIndex: childItem.dataIndex || childItem.key,
351
- isStaticCode: true,
352
- title: childItem.title
353
- }))
354
- }
355
- });
356
- setTableJsonEditorValsArr([...detailTableCodeFilter]);
357
- const lastRes = detailTableCodeFilter.map(item => {
358
- if(item?.initialSetting && item?.initialSetting.length){
359
- const codeProps = {
360
- fields: [],
361
- columns: item?.columns,
362
- };
363
- const newValue = {
364
- fields: [],
365
- columns: item.initialSetting
366
- };
367
- const result = hanleCallbackValue(codeProps, newValue, item?.customerFields, item?.cacheColumns);
368
- return {
369
- ...item,
370
- columns: result?.columns
371
- }
372
- }
373
- return item;
374
- });
375
- if(lastRes.length){
376
- saveTableCallBack(lastRes, false);
377
- }
378
- },[detailTablesSetting.length]);
379
-
380
- const onClickRun = (value, isSave) => {
381
- setJsonEditorVal(value);
382
-
383
- try {
384
- setCode(value);
385
- callBack(hanleCallbackValue(codeProps, value, customerFields), isSave, value);
386
- } catch (e) {
387
- message.error(e);
388
- }
389
- };
390
-
391
- //明细表保存
392
- const onClickRunDetailTables = (value, isSave, tableCode, tableSouce) =>{
393
- const targetCode = tableCode || activeKey;
394
- const targetTableSource = tableSouce || tableJsonEditorValsArr;
395
- const newArr = targetTableSource.map(item => {
396
- if(item.tableCode == targetCode){
397
- return {
398
- ...item,
399
- columns: value
400
- }
401
- }
402
- return item
403
- });
404
- setTableJsonEditorValsArr([...newArr]);
405
-
406
- try {
407
- const target = targetTableSource.find(item=>item.tableCode == targetCode);
408
- const codeProps = {
409
- fields: [],
410
- columns: target?.columns,
411
- };
412
- const newValue = {
413
- fields: [],
414
- columns: value
415
- };
416
- const result = hanleCallbackValue(codeProps, newValue, target?.customerFields, target?.cacheColumns);
417
- saveTableCallBack({ columns: result.columns, tableCode: targetCode }, isSave, value);
418
- } catch (e) {
419
- message.error(e);
420
- }
421
- }
422
-
423
- React.useEffect(() => {
424
- localStorage.setItem('jsonEditorVal',JSON.stringify(jsonEditorVal||{}))
425
- }, [jsonEditorVal]);
426
-
427
- React.useEffect(() => {
428
- if (initialSetting) {
429
- onClickRun(initialSetting);
430
- setJsonEditorVal(initialSetting)
431
- }
432
- }, [initialSetting]);
433
-
434
- const height =
435
- styleRef?.current?.clientHeight || styleRef?.current?.offsetHeight;
436
-
437
- const tableParams = {
438
- ...moduleParams,
439
- jsonEditorVal,
440
- codeProps,
441
- };
442
-
443
- return (
444
- <div>
445
- <Drawer visible={visible} width={1400} onClose={() => setVisible(false)} className={'customFieldsDrawer'}>
446
- {
447
- detailTablesSetting.length == 0 &&(
448
- <div style={{display: 'flex'}}>
449
- <div style={{flex: 1, width: 500}}>
450
- {
451
- isEmpty(moduleParams)?(
452
- <div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
453
- 提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
454
- </div>
455
- ):(
456
- <FieldsSettingsTable {...tableParams}/>
457
- )
458
- }
459
- </div>
460
- <div style={{flex: 1}}>
461
- <Editor
462
- type="table"
463
- onRun={onClickRun}
464
- value={jsonEditorVal}
465
- shallowHeight={height}
466
- />
467
- </div>
468
- </div>
469
- )
470
- }
471
- {
472
- detailTablesSetting.length > 0 && (
473
- <Tabs defaultActiveKey={activeKey} onChange={(v: any) => setActiveKey(v)}>
474
- <Tabs.TabPane tab="详情页配置" key="main">
475
- <div style={{display: 'flex'}}>
476
- <div style={{flex: 1, width: 500}}>
477
- {
478
- isEmpty(moduleParams)?(
479
- <div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
480
- 提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
481
- </div>
482
- ):(
483
- <FieldsSettingsTable {...tableParams}/>
484
- )
485
- }
486
- </div>
487
- <div style={{flex: 1}}>
488
- <Editor
489
- type="table"
490
- onRun={onClickRun}
491
- value={jsonEditorVal}
492
- shallowHeight={height}
493
- />
494
- </div>
495
- </div>
496
- </Tabs.TabPane>
497
- {
498
- tableJsonEditorValsArr.map((k:any)=>(
499
- <Tabs.TabPane tab={k.title} key={k.tableCode}>
500
- <div style={{display: 'flex'}}>
501
- <div style={{flex: 1, width: 500}}>
502
- {
503
- !tablesConfigParams[k.tableCode]?(
504
- <div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
505
- 提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
506
- </div>
507
- ):(
508
- <FieldsSettingsTable {...tablesConfigParams[k.tableCode]}/>
509
- )
510
- }
511
- </div>
512
- <div style={{flex: 1}}>
513
- <Editor
514
- type="table"
515
- onRun={onClickRunDetailTables}
516
- value={k.columns}
517
- shallowHeight={height}
518
- />
519
- </div>
520
- </div>
521
- </Tabs.TabPane>
522
- ))
523
- }
524
- </Tabs>
525
- )
526
- }
527
- </Drawer>
528
-
529
- {!visible && isAdmin() && <ConfigButton type='primary' onClick={() => setVisible(true)}>setting</ConfigButton>}
530
- </div>
531
- );
532
- });
533
-
534
- export default JsonQueryTable;
1
+ // @ts-nocheck
2
+ import React, { useState, useRef, useEffect, Fragment } from 'react';
3
+ import { message, Button, Table, Tabs } from 'antd';
4
+ import Drawer from './drawer';
5
+ import ConfigButton from './configButton';
6
+ import Editor from './jsonEditor';
7
+ import request from '@/utils/request';
8
+ import FieldsSettingsTable from './components/FieldsSettingsTable';
9
+ import { isEmpty } from "lodash"
10
+ import './index.less';
11
+ import { getUserId } from '@/utils/LocalstorageUtils';
12
+
13
+ function iterFileds (fields) {
14
+ let filedsValue = [];
15
+
16
+ function iter(field) {
17
+ if(Array.isArray(field.fields)) {
18
+ field.fields.forEach(item => {
19
+ const targetValue = iterFileds(item);
20
+ if(targetValue){
21
+ filedsValue.push(targetValue);
22
+ }
23
+ })
24
+ } else {
25
+ return {
26
+ name: field.name,
27
+ isStaticCode: true,
28
+ label: field.label,
29
+ }
30
+ }
31
+
32
+ return {
33
+ container: {
34
+ name: field?.container?.props?.name,
35
+ title: field?.container?.props?.title
36
+ },
37
+ isStaticCode: true,
38
+ fields: filedsValue,
39
+ };
40
+ }
41
+
42
+ filedsValue = iter(fields)
43
+
44
+ return filedsValue;
45
+ }
46
+
47
+ function flatFileds (fields) {
48
+ let filedsValue = {
49
+ };
50
+ function iter(field, containerName) {
51
+ if(Array.isArray(field.fields)) {
52
+ if (field?.container?.props?.name) {
53
+ filedsValue[field?.container?.props?.name] = {
54
+ ...field,
55
+ fields: []
56
+ }
57
+ }
58
+ field.fields.forEach(item => {
59
+ iter(item, field?.container?.props?.name)
60
+ })
61
+ } else {
62
+ filedsValue[containerName ? (containerName + field.name) : field.name] = field
63
+ }
64
+ }
65
+
66
+ iter(fields)
67
+
68
+ return filedsValue;
69
+ }
70
+
71
+ function convertFileds (fields, falltValue, faltFieldRange, containerName) {
72
+ let filedsValue = [];
73
+
74
+ function iter(field) {
75
+ if(Array.isArray(field.fields)) {
76
+ field.fields.forEach(item => {
77
+ const targetValue = convertFileds(item, falltValue, faltFieldRange, field?.container?.name);
78
+ if(targetValue){
79
+ if(item.dependency) {
80
+ targetValue.dependency = {
81
+ visible: {
82
+ ...item.dependency.visible,
83
+ type: (new Function('request','ctx', item.dependency.visible.type)).bind(null, request)
84
+ }
85
+ }
86
+ }
87
+ filedsValue.push(targetValue)
88
+ }
89
+ })
90
+ } else {
91
+ const returnField = field.isStaticCode ? falltValue[containerName ? (containerName + field.name) : field.name] : faltFieldRange[field.name];
92
+ if (returnField) {
93
+ returnField.label = field?.label;
94
+ if(field?.disabled){ // 字段设置只读属性
95
+ returnField.field.props.disabled = true;
96
+ }
97
+ if(field?.invisible){ // 字段设置不可见属性
98
+ returnField.initialVisible = false;
99
+ }
100
+
101
+ if(Array.isArray(returnField.name)&&returnField.name?.includes("extensionFields")){
102
+ returnField.notShowLabel = true;
103
+ }
104
+ } else {
105
+ }
106
+ return returnField;
107
+ }
108
+
109
+ return {...falltValue[field?.container?.name], fields: filedsValue};
110
+ }
111
+
112
+ filedsValue = iter(fields)
113
+
114
+ return filedsValue;
115
+ }
116
+
117
+ function faltColumns(columns) {
118
+ let columnsValue = {}
119
+
120
+ columns.forEach(item => {
121
+ columnsValue[item.key] = {...item}
122
+ })
123
+
124
+ return columnsValue;
125
+ }
126
+
127
+ function faltCustomerFieldRange(fileds) {
128
+ let columnsValue = {}
129
+
130
+ fileds.forEach(item => {
131
+ columnsValue[item.name] = {...item}
132
+ })
133
+
134
+ return columnsValue;
135
+ }
136
+
137
+ //form存在新加container属性分组得情况 组合操作
138
+ function combineContainer(originFields, currentFields){
139
+ let newCurrentFields = [...originFields];
140
+ currentFields.map((item: any) => {
141
+ if(!originFields.find((i: any) => i?.container?.props?.name == item?.container?.name)){
142
+ newCurrentFields = [...newCurrentFields, {
143
+ container: {
144
+ type: 'card',
145
+ props: {
146
+ title: item?.container?.title,
147
+ level: 1,
148
+ id: Math.random(),
149
+ isWhiteCard: true,
150
+ bordered: false,
151
+ name: item?.container?.name,
152
+ },
153
+ },
154
+ fields: item?.fields || []
155
+ }];
156
+ }
157
+ })
158
+ return newCurrentFields;
159
+ }
160
+
161
+ function hanleCallbackValue(codeProps, value, customerFields, cacheColumns = []) {
162
+ const faltFieldRange = faltCustomerFieldRange(customerFields);
163
+ // const falltValue = flatFileds({fields: codeProps.fields})
164
+ const falltValue = flatFileds({fields: combineContainer(codeProps.fields, value?.fields)})
165
+ let newCodeProps = {...codeProps};
166
+ newCodeProps.fields = convertFileds({fields: value.fields}, falltValue, faltFieldRange).fields;
167
+ if (codeProps.columns) {
168
+ const faltColumnsValue = faltColumns(codeProps.columns)
169
+ newCodeProps.columns = value.columns.map(item => {
170
+ if (item.isStaticCode) {
171
+ const cacheFieldProperty = cacheColumns.find(k => (k.key||k.dataIndex) == (item.key||item.dataIndex));
172
+ return {
173
+ ...faltColumnsValue[item.key],
174
+ ...cacheFieldProperty
175
+ }
176
+ } else {
177
+ //自定义字段-列字段
178
+ if(item?.key&&item?.key.includes('extensionFields')&&item?.key.includes(',')){
179
+ return {
180
+ ...item,
181
+ render: ({ record }: any) => {
182
+ try{
183
+ const { extensionFields = {} } = record;
184
+ const fieldName1= item?.key.split(',')[1]; //兼容没有fieldName的情况
185
+ const fieldName2 = `${fieldName1}Name`;
186
+ if(customerFields.length){
187
+ const targetField = customerFields.find(k => k.name.includes(fieldName1));
188
+ if(targetField){
189
+ const { initialSource = [] } = targetField
190
+ if(initialSource.length){
191
+ return initialSource.find((d => d.value == extensionFields[fieldName1]))?.text || extensionFields[fieldName1];
192
+ }
193
+ }
194
+ }
195
+ return extensionFields[fieldName2] || extensionFields[fieldName1] || '';
196
+ }catch(e){
197
+ console.log('e',e);
198
+ }
199
+ }
200
+ }
201
+ }else{
202
+ return {
203
+ ...item
204
+ }
205
+ }
206
+ }
207
+ });
208
+
209
+ //进行列表搜索项自定义字段name替换 (排除是编辑表单的fields)
210
+ newCodeProps.fields = newCodeProps.fields.map(item => {
211
+ if(Array.isArray(item?.name)){
212
+ return {
213
+ ...item,
214
+ name: item?.realSearchName || item?.name
215
+ }
216
+ }
217
+ return item;
218
+ });
219
+
220
+ }
221
+
222
+ return newCodeProps;
223
+ }
224
+
225
+ function isAdmin() {
226
+ const username = getUserId();
227
+
228
+ return username === 'admin' || username === 'uiuiui'
229
+ }
230
+
231
+ const tableStyleList = [
232
+ {
233
+ type: '快速搜索',
234
+ img: 'https://img.alicdn.com/tfs/TB1al1JqHr1gK0jSZR0XXbP8XXa-40-40.svg',
235
+ url: '/list/singlesearch',
236
+ },
237
+ {
238
+ type: '高级搜索',
239
+ img: 'https://img.alicdn.com/tfs/TB1QgKIqQL0gK0jSZFtXXXQCXXa-40-40.svg',
240
+ url: '/list/advancedsearch',
241
+ },
242
+ {
243
+ type: '一般搜索',
244
+ img: 'https://img.alicdn.com/tfs/TB1xHCPqRr0gK0jSZFnXXbRRXXa-40-40.svg',
245
+ url: '/list/basic',
246
+ },
247
+ {
248
+ type: '无分页表格',
249
+ img: 'https://img.alicdn.com/tfs/TB1txuMqQL0gK0jSZFxXXXWHVXa-40-40.svg',
250
+ url: '/list/nopagination',
251
+ },
252
+ {
253
+ type: '分步查询表格',
254
+ img: 'https://img.alicdn.com/tfs/TB10IOmGkL0gK0jSZFAXXcA9pXa-53-46.svg',
255
+ url: '/list/stepquerytable',
256
+ },
257
+ ];
258
+ const JsonQueryTable = React.memo(props => {
259
+ const {
260
+ callBack, // 主保存函数回调
261
+ codeProps, // 整体的配置数据
262
+ customerFields, //可选的配置字段
263
+ initialSetting, //上一次添加自定义字段后保存的数据
264
+ pageType, //页面权限code
265
+ detailTablesSetting = [], //详情明细表格列配置数据
266
+ saveTableCallBack, //详情明细保存函数回调
267
+ } = props;
268
+
269
+ let codeFilter = {};
270
+ if (codeProps.columns) { // table
271
+ codeFilter.columns = codeProps.columns.map(item => ({
272
+ key: item.key,
273
+ isStaticCode: true,
274
+ title: item.title
275
+ }))
276
+
277
+ codeFilter.fields = codeProps.fields.map(item => ({
278
+ name: item.name,
279
+ isStaticCode: true,
280
+ label: item.label,
281
+ notShowLabel: item.notShowLabel || false
282
+ }))
283
+ } else {
284
+ codeFilter.fields = iterFileds({fields: codeProps.fields}).fields
285
+ }
286
+
287
+ const styleRef = useRef(null);
288
+
289
+ const [visible, setVisible] = useState(false)
290
+ const [code, setCode] = useState(codeProps);
291
+ const [init, setInit] = useState(true);
292
+ const [jsonEditorVal, setJsonEditorVal] = useState(initialSetting || codeFilter);
293
+ const [moduleParams, setModuleParams] = useState({});
294
+ const [activeKey, setActiveKey] = useState('main'); //默认详情页配置
295
+ const [tablesConfigParams, setTablesConfigParams] = useState({});
296
+ const [tableJsonEditorValsArr, setTableJsonEditorValsArr] = useState([]);
297
+
298
+ useEffect(()=>{
299
+ Promise.all([
300
+ request.get(`/basic/flow/businessFieldGroup/one?moduleType=2&layoutPoint=${pageType}`),
301
+ ]).then(([res] )=> {
302
+ const { code, data } = res?.data || {};
303
+ if (code === '000000') {
304
+ if(data){
305
+ const { businessType, code:fieldGroup, moduleType, moduleRelationId } = data;
306
+ setModuleParams({
307
+ businessType,
308
+ fieldGroup,
309
+ moduleType,
310
+ moduleRelationId
311
+ });
312
+ }
313
+ }
314
+ })
315
+ },[]);
316
+
317
+ useEffect(()=>{
318
+ //明细表的配置数据
319
+ const axiosArr = detailTablesSetting.map((item:any) => request.get(`/basic/flow/businessFieldGroup/one?moduleType=2&layoutPoint=${item.tableCode}`));
320
+ Promise.all(axiosArr).then(([...resArr])=> {
321
+ let configParams = {};
322
+ detailTablesSetting.map((item:any, index:number)=>{
323
+ const { code, data } = resArr[index]?.data || {};
324
+ if(data){
325
+ const { businessType, code:fieldGroup, moduleType } = data;
326
+ configParams [item.tableCode] = {
327
+ businessType,
328
+ fieldGroup,
329
+ moduleType,
330
+ tableFlag: true
331
+ }
332
+ }
333
+ })
334
+ setTablesConfigParams({
335
+ ...configParams,
336
+ });
337
+ })
338
+
339
+ const detailTableCodeFilter = detailTablesSetting.map(item => {
340
+ if(item?.initialSetting && item?.initialSetting.length){
341
+ return {
342
+ ...item,
343
+ columns: item?.initialSetting
344
+ }
345
+ }
346
+ return {
347
+ ...item,
348
+ columns: item?.columns.map(childItem => ({
349
+ key: childItem.key || childItem.dataIndex,
350
+ dataIndex: childItem.dataIndex || childItem.key,
351
+ isStaticCode: true,
352
+ title: childItem.title
353
+ }))
354
+ }
355
+ });
356
+ setTableJsonEditorValsArr([...detailTableCodeFilter]);
357
+ const lastRes = detailTableCodeFilter.map(item => {
358
+ if(item?.initialSetting && item?.initialSetting.length){
359
+ const codeProps = {
360
+ fields: [],
361
+ columns: item?.columns,
362
+ };
363
+ const newValue = {
364
+ fields: [],
365
+ columns: item.initialSetting
366
+ };
367
+ const result = hanleCallbackValue(codeProps, newValue, item?.customerFields, item?.cacheColumns);
368
+ return {
369
+ ...item,
370
+ columns: result?.columns
371
+ }
372
+ }
373
+ return item;
374
+ });
375
+ if(lastRes.length){
376
+ saveTableCallBack(lastRes, false);
377
+ }
378
+ },[detailTablesSetting.length]);
379
+
380
+ const onClickRun = (value, isSave) => {
381
+ setJsonEditorVal(value);
382
+
383
+ try {
384
+ setCode(value);
385
+ callBack(hanleCallbackValue(codeProps, value, customerFields), isSave, value);
386
+ } catch (e) {
387
+ message.error(e);
388
+ }
389
+ };
390
+
391
+ //明细表保存
392
+ const onClickRunDetailTables = (value, isSave, tableCode, tableSouce) =>{
393
+ const targetCode = tableCode || activeKey;
394
+ const targetTableSource = tableSouce || tableJsonEditorValsArr;
395
+ const newArr = targetTableSource.map(item => {
396
+ if(item.tableCode == targetCode){
397
+ return {
398
+ ...item,
399
+ columns: value
400
+ }
401
+ }
402
+ return item
403
+ });
404
+ setTableJsonEditorValsArr([...newArr]);
405
+
406
+ try {
407
+ const target = targetTableSource.find(item=>item.tableCode == targetCode);
408
+ const codeProps = {
409
+ fields: [],
410
+ columns: target?.columns,
411
+ };
412
+ const newValue = {
413
+ fields: [],
414
+ columns: value
415
+ };
416
+ const result = hanleCallbackValue(codeProps, newValue, target?.customerFields, target?.cacheColumns);
417
+ saveTableCallBack({ columns: result.columns, tableCode: targetCode }, isSave, value);
418
+ } catch (e) {
419
+ message.error(e);
420
+ }
421
+ }
422
+
423
+ React.useEffect(() => {
424
+ localStorage.setItem('jsonEditorVal',JSON.stringify(jsonEditorVal||{}))
425
+ }, [jsonEditorVal]);
426
+
427
+ React.useEffect(() => {
428
+ if (initialSetting) {
429
+ onClickRun(initialSetting);
430
+ setJsonEditorVal(initialSetting)
431
+ }
432
+ }, [initialSetting]);
433
+
434
+ const height =
435
+ styleRef?.current?.clientHeight || styleRef?.current?.offsetHeight;
436
+
437
+ const tableParams = {
438
+ ...moduleParams,
439
+ jsonEditorVal,
440
+ codeProps,
441
+ };
442
+
443
+ return (
444
+ <div>
445
+ <Drawer visible={visible} width={1400} onClose={() => setVisible(false)} className={'customFieldsDrawer'}>
446
+ {
447
+ detailTablesSetting.length == 0 &&(
448
+ <div style={{display: 'flex'}}>
449
+ <div style={{flex: 1, width: 500}}>
450
+ {
451
+ isEmpty(moduleParams)?(
452
+ <div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
453
+ 提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
454
+ </div>
455
+ ):(
456
+ <FieldsSettingsTable {...tableParams}/>
457
+ )
458
+ }
459
+ </div>
460
+ <div style={{flex: 1}}>
461
+ <Editor
462
+ type="table"
463
+ onRun={onClickRun}
464
+ value={jsonEditorVal}
465
+ shallowHeight={height}
466
+ />
467
+ </div>
468
+ </div>
469
+ )
470
+ }
471
+ {
472
+ detailTablesSetting.length > 0 && (
473
+ <Tabs defaultActiveKey={activeKey} onChange={(v: any) => setActiveKey(v)}>
474
+ <Tabs.TabPane tab="详情页配置" key="main">
475
+ <div style={{display: 'flex'}}>
476
+ <div style={{flex: 1, width: 500}}>
477
+ {
478
+ isEmpty(moduleParams)?(
479
+ <div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
480
+ 提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
481
+ </div>
482
+ ):(
483
+ <FieldsSettingsTable {...tableParams}/>
484
+ )
485
+ }
486
+ </div>
487
+ <div style={{flex: 1}}>
488
+ <Editor
489
+ type="table"
490
+ onRun={onClickRun}
491
+ value={jsonEditorVal}
492
+ shallowHeight={height}
493
+ />
494
+ </div>
495
+ </div>
496
+ </Tabs.TabPane>
497
+ {
498
+ tableJsonEditorValsArr.map((k:any)=>(
499
+ <Tabs.TabPane tab={k.title} key={k.tableCode}>
500
+ <div style={{display: 'flex'}}>
501
+ <div style={{flex: 1, width: 500}}>
502
+ {
503
+ !tablesConfigParams[k.tableCode]?(
504
+ <div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
505
+ 提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
506
+ </div>
507
+ ):(
508
+ <FieldsSettingsTable {...tablesConfigParams[k.tableCode]}/>
509
+ )
510
+ }
511
+ </div>
512
+ <div style={{flex: 1}}>
513
+ <Editor
514
+ type="table"
515
+ onRun={onClickRunDetailTables}
516
+ value={k.columns}
517
+ shallowHeight={height}
518
+ />
519
+ </div>
520
+ </div>
521
+ </Tabs.TabPane>
522
+ ))
523
+ }
524
+ </Tabs>
525
+ )
526
+ }
527
+ </Drawer>
528
+
529
+ {!visible && isAdmin() && <ConfigButton type='primary' onClick={() => setVisible(true)}>setting</ConfigButton>}
530
+ </div>
531
+ );
532
+ });
533
+
534
+ export default JsonQueryTable;