@bit-sun/business-component 2.1.24 → 2.2.0-alpha.10

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 (184) 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/Business/AddSelectBusiness/index.d.ts +1 -0
  9. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +59 -0
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.esm.js +5925 -3841
  12. package/dist/index.js +5924 -3838
  13. package/dist/plugin/TableColumnSetting/index.d.ts +64 -0
  14. package/dist/plugin/TableColumnSetting/utils.d.ts +1 -0
  15. package/dist/utils/LocalstorageUtils.d.ts +8 -0
  16. package/dist/utils/enumConfig.d.ts +1 -0
  17. package/docs/index.md +21 -21
  18. package/lib/assets/drag.svg +17 -17
  19. package/lib/assets/exportFail.svg +37 -37
  20. package/lib/assets/exportProcessing.svg +28 -28
  21. package/lib/assets/exportSuccess.svg +34 -34
  22. package/lib/assets/label_icon_bottom.svg +25 -25
  23. package/lib/assets/upExport.svg +22 -22
  24. package/package.json +77 -77
  25. package/src/assets/32.svg +27 -27
  26. package/src/assets/addIcon.svg +17 -17
  27. package/src/assets/allfunc.svg +27 -27
  28. package/src/assets/arrowRight.svg +24 -24
  29. package/src/assets/btn-delete.svg +29 -29
  30. package/src/assets/btn-edit.svg +19 -19
  31. package/src/assets/btn-more.svg +17 -17
  32. package/src/assets/btn-submit.svg +19 -19
  33. package/src/assets/caidan.svg +11 -11
  34. package/src/assets/close.svg +26 -26
  35. package/src/assets/drag.svg +17 -17
  36. package/src/assets/exportFail.svg +37 -37
  37. package/src/assets/exportProcessing.svg +28 -28
  38. package/src/assets/exportSuccess.svg +34 -34
  39. package/src/assets/fixed-left-active.svg +11 -11
  40. package/src/assets/fixed-left.svg +15 -15
  41. package/src/assets/fixed-right-active.svg +11 -11
  42. package/src/assets/fixed-right.svg +15 -15
  43. package/src/assets/guanbi.svg +15 -15
  44. package/src/assets/icon-quanping.svg +15 -15
  45. package/src/assets/icon-shezhi.svg +17 -17
  46. package/src/assets/label_icon_bottom.svg +25 -25
  47. package/src/assets/list-no-img.svg +21 -21
  48. package/src/assets/morentouxiang-32.svg +23 -23
  49. package/src/assets/scanning.svg +24 -24
  50. package/src/assets/upExport.svg +22 -22
  51. package/src/components/Business/AddSelectBusiness/index.md +93 -42
  52. package/src/components/Business/AddSelectBusiness/index.tsx +601 -341
  53. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  54. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  55. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  56. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  58. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  59. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  60. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  61. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  62. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  63. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  64. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  65. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  66. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  67. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  68. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  69. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +156 -156
  70. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  71. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  72. package/src/components/Business/BsLayouts/index.less +79 -79
  73. package/src/components/Business/BsLayouts/index.tsx +1479 -1479
  74. package/src/components/Business/BsLayouts/service.ts +10 -10
  75. package/src/components/Business/BsLayouts/utils.tsx +225 -230
  76. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +538 -0
  77. package/src/components/Business/BsSulaQueryTable/index.less +219 -219
  78. package/src/components/Business/BsSulaQueryTable/index.tsx +527 -476
  79. package/src/components/Business/BsSulaQueryTable/setting.tsx +802 -802
  80. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  81. package/src/components/Business/BsSulaQueryTable/utils.tsx +688 -688
  82. package/src/components/Business/CommodityEntry/index.md +70 -70
  83. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  84. package/src/components/Business/CommonAlert/index.tsx +23 -23
  85. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  86. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  87. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  88. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  89. package/src/components/Business/DetailPageWrapper/index.tsx +313 -335
  90. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  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 +824 -824
  95. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -201
  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 +449 -320
  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 +356 -356
  122. package/src/components/Business/SearchSelect/BusinessUtils.ts +1723 -1586
  123. package/src/components/Business/SearchSelect/common.ts +53 -53
  124. package/src/components/Business/SearchSelect/index.md +1310 -1254
  125. package/src/components/Business/SearchSelect/index.tsx +51 -51
  126. package/src/components/Business/SearchSelect/utils.ts +100 -100
  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 +126 -126
  131. package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
  132. package/src/components/Business/TreeSearchSelect/utils.ts +60 -60
  133. package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -764
  134. package/src/components/Business/columnSettingTable/index.less +247 -247
  135. package/src/components/Business/columnSettingTable/index.md +357 -357
  136. package/src/components/Business/columnSettingTable/index.tsx +232 -232
  137. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +240 -240
  138. package/src/components/Business/columnSettingTable/utils.tsx +68 -68
  139. package/src/components/Business/moreTreeTable/index.less +99 -99
  140. package/src/components/Business/moreTreeTable/index.md +508 -508
  141. package/src/components/Business/moreTreeTable/index.tsx +315 -315
  142. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  143. package/src/components/Functional/AddSelect/index.less +367 -367
  144. package/src/components/Functional/AddSelect/index.md +155 -154
  145. package/src/components/Functional/AddSelect/index.tsx +1165 -994
  146. package/src/components/Functional/BillEntry/index.less +371 -371
  147. package/src/components/Functional/BillEntry/index.md +39 -39
  148. package/src/components/Functional/BillEntry/index.tsx +766 -670
  149. package/src/components/Functional/DataImport/index.less +63 -63
  150. package/src/components/Functional/DataImport/index.md +44 -44
  151. package/src/components/Functional/DataImport/index.tsx +695 -695
  152. package/src/components/Functional/DataValidation/index.less +63 -63
  153. package/src/components/Functional/DataValidation/index.md +39 -39
  154. package/src/components/Functional/DataValidation/index.tsx +687 -687
  155. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  156. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -59
  157. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  158. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  159. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  160. package/src/components/Functional/SearchSelect/index.less +115 -115
  161. package/src/components/Functional/SearchSelect/index.md +141 -141
  162. package/src/components/Functional/SearchSelect/index.tsx +813 -813
  163. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  164. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  165. package/src/components/Functional/TreeSearchSelect/index.tsx +160 -149
  166. package/src/index.ts +34 -34
  167. package/src/plugin/TableColumnSetting/index.less +247 -0
  168. package/src/plugin/TableColumnSetting/index.md +50 -0
  169. package/src/plugin/TableColumnSetting/index.tsx +724 -0
  170. package/src/plugin/TableColumnSetting/utils.ts +19 -0
  171. package/src/styles/bsDefault.less +1912 -1906
  172. package/src/utils/CheckOneUser/index.md +39 -39
  173. package/src/utils/CheckOneUser/index.ts +51 -51
  174. package/src/utils/LocalstorageUtils.ts +58 -0
  175. package/src/utils/TableUtils.tsx +18 -18
  176. package/src/utils/checkUtils.ts +39 -39
  177. package/src/utils/enumConfig.ts +11 -10
  178. package/src/utils/getFormMode.js +12 -12
  179. package/src/utils/index.ts +2 -2
  180. package/src/utils/requestUtils.ts +36 -33
  181. package/src/utils/serialize.js +7 -7
  182. package/src/utils/utils.ts +183 -183
  183. package/tsconfig.json +29 -29
  184. package/typings.d.ts +4 -4
@@ -1,994 +1,1165 @@
1
- // @ts-nocheck
2
- import React, { useState, useEffect } from 'react';
3
- import { useDebounceFn } from 'ahooks';
4
- import { Input, Button, Modal, Select, InputNumber, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
5
- import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/icons';
6
- import axios from 'axios';
7
- import { stringify } from 'querystring';
8
- import _ from "lodash"
9
- import './index.less';
10
- import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
- import { Resizable } from 'react-resizable';
12
- import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
13
-
14
- const loadSelectSource = (url: string, params?: any) => {
15
- return new Promise((resolve, reject) => {
16
- axios
17
- .get(`${url}?${stringify(params)}`)
18
- .then((result: any) => {
19
- result = result.data;
20
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
21
- message.error(result.msg);
22
- return;
23
- }
24
- resolve(result);
25
- })
26
- .catch((err) => {
27
- reject(err);
28
- });
29
- })
30
- };
31
-
32
- const ResizeableTitle = (props) => {
33
- const { onResize, width, ...restProps } = props;
34
-
35
- if (!width) {
36
- return <th {...restProps} />;
37
- }
38
- return (
39
- <Resizable
40
- width={width}
41
- height={0}
42
- onResize={onResize}
43
- draggableOpts={{ enableUserSelectHack: false }}
44
- >
45
- <th {...restProps} />
46
- </Resizable>
47
- );
48
- };
49
-
50
- const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
51
- const data = reData && reData[position]?.data;
52
- const list = Array.isArray(data) ? data :(data?.items || data?.list || data?.children || []);
53
- const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
54
- changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
55
- }
56
-
57
- // 格式化树选择器数据源
58
- const mapSearchTree = (treeDataItem: any, resKeyValue: any) => {
59
- const haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
60
- return {
61
- title: treeDataItem[resKeyValue[1]],
62
- value: treeDataItem[resKeyValue[0]],
63
- parentId: treeDataItem.parent,
64
- data: { ...treeDataItem },
65
- isLeaf: !haveChildren,
66
- disabled: haveChildren,
67
- children: haveChildren ? treeDataItem.children.map((i: any) => mapSearchTree(i, resKeyValue)) : [],
68
- };
69
- };
70
- const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name']) => {
71
- const data = reData && reData[position]?.data;
72
- const formatData = (data &&
73
- Array.isArray(data) &&
74
- data.length &&
75
- data.map((ites: any) => mapSearchTree(ites, resKeyValue))) ||
76
- []
77
- changeSearchForm[changePosition].field.props.treeData = formatData;
78
- }
79
-
80
- const { Option } = Select;
81
-
82
- const AddSelect = (props: any) => {
83
- const {
84
- value, // 必传
85
- onChange,
86
- selectProps = {},
87
- modalTableProps = {},
88
- labelInValue = false,
89
- requestConfig,
90
- ctx,
91
- sourceName,
92
- needModalTable = true,
93
- getPopupContainer = undefined,
94
- onSaveCallback,
95
- buttonText = '添加',
96
- buttonProps = {},
97
- beforeShowModal
98
- } = props;
99
- const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField = 'name', mappingTextShowKeyField, mappingValueField = 'code', mappingTextShowTextField } = requestConfig || {};
100
- const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
101
- const realButtonProps = {type: "primary", ...buttonProps};
102
-
103
- const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
104
- const initVal = value || (selectMode ? [] : null);
105
- const pageSize = 100 // 下拉框默认分页 条数
106
- const tableInitPageSize = 10 // 弹框默认分页 条数
107
- const currentPage = 1
108
- const selectParamsKey = requestConfig?.filter || 'qp-codeAndName-like'
109
- const selectParamsInitKey = requestConfig?.filterInit || selectParamsKey
110
- const currentSelectProps = {
111
- ...selectProps,
112
- // 以下属性不可更改----设计配置项
113
- showSearch: false,
114
- filterOption: false,
115
- allowClear: true,
116
- listHeight: 160,
117
- optionLabelProp: "label",
118
- autoClearSearchValue: false
119
- }
120
- const [items, setItems] = useState([]);
121
- const [scrollPage, setScrollPage] = useState(1);
122
- const [itemsTotal, setItemsTotal] = useState(0);
123
- const [fetching, setFetching] = useState(false);
124
- const [searchValue, setSearchValue] = useState('');
125
- const [isModalVisible, setIsModalVisible] = useState(false);
126
- const [popvalue, setPopValue] = useState(initVal);
127
- const [uniqueValue, setUniqueValue] = useState(sourceName)
128
- const { run } = useDebounceFn(
129
- (v?: any) => {
130
- // 优化搜索参数 支持传多个
131
- let searchParams = {};
132
- if (typeof selectParamsKey === 'string') {
133
- searchParams = v ? { [selectParamsInitKey]: initVal } : { [selectParamsKey]: searchValue }
134
- }
135
- if (Array.isArray(selectParamsKey)) {
136
- selectParamsKey.forEach((i: any) => {
137
- searchParams = { ...searchParams, [i]: searchValue }
138
- })
139
- }
140
- // 防抖函数 待定
141
- getData(searchParams)
142
- },
143
- {
144
- wait: 1000,
145
- },
146
- );
147
-
148
- const [form] = Form.useForm();
149
- const [tableSearchForm, setTableSearchForm] = useState(modalTableProps?.tableSearchForm)
150
- const [caretLeftFlag, setCaretLeftFlag] = useState(true);
151
- const [tableData, setTableData] = useState([]);
152
- const [tablePagination, setTablePagination] = useState({ total: 0, size: "small", current: 1, pageSize: tableInitPageSize })
153
- const [selectedRowKeys, setSelectedRowKeys] = useState([]);
154
- const [doubleArr, setDoubleArr] = useState([]); // 存放双数组的数组
155
- const [checkedAll, setCheckedAll] = useState(false)
156
- const [indeterminate, setIndeterminate] = useState(false)
157
- const [tableFormParams, setTableFormParams] = useState({});
158
- const [tableColumns, setTableColumns] = useState([]);
159
- const [confirmLoading, setConfirmLoading] = useState(false);
160
- const [confirmContinueLoading, setConfirmContinueLoading] = useState(false);
161
-
162
- useEffect(() => {
163
- setTableColumns(
164
- modalTableProps?.tableColumns.map((item, index) => {
165
- return {
166
- ...item,
167
- width: item.width || 200,
168
- onHeaderCell: (column) => ({
169
- ...item,
170
- width:
171
- typeof column.width === 'number'
172
- ? column.width
173
- : parseInt(column.width.replace('px', '')),
174
- onResize: handleResize(index),
175
- })
176
- }
177
- })
178
- )
179
- }, [modalTableProps?.tableColumns])
180
-
181
- // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
182
- const getData = (params = {}, type = 1) => {
183
- if (!requestConfig) return;
184
-
185
- setFetching(true)
186
-
187
- // 处理dependence参数
188
- const fixedParam = {};
189
- if (fixedparameter && fieldValToParam && ctx) {
190
- fixedparameter.forEach((item: any, index: any) => {
191
- const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
192
- if (fixedParamVal) {
193
- fixedParam[item] = fixedParamVal;
194
- form.setFieldsValue({ ...form?.getFieldsValue(), [item]: fixedParamVal })
195
- }
196
- });
197
- }
198
-
199
- // 数组对象处理,对带有特殊标记的name进行处理
200
- for (const key in params) {
201
- if (Object.prototype.hasOwnProperty.call(params, key)) {
202
- const element = params[key];
203
- if (element && key.indexOf('*number*') >= 0) {
204
- const dataParams = key.split('*number*');
205
- dataParams.forEach((value, index) => {
206
- params[value] = element[index];
207
- });
208
- delete params[key];
209
- } else if (element && key.indexOf('*address*') >= 0) {
210
- const dataParams = key.split('*address*');
211
- dataParams.forEach((value, index) => {
212
- params[value] = element.PCDCode[index];
213
- });
214
- delete params[key];
215
- } else if (element && key.indexOf('*costType*') >= 0) {
216
- const dataParams = key.split('*costType*');
217
- // eslint-disable-next-line prefer-destructuring
218
- params[dataParams[0]] = element[1];
219
- delete params[key];
220
- } else if (element && key.indexOf('*fullDate*') >= 0) {
221
- const dataParams = key.split('*fullDate*');
222
- dataParams.forEach((value, index) => {
223
- if (index === 0) {
224
- params[value] = moment(element[index])
225
- .millisecond(0)
226
- .second(0)
227
- .minute(0)
228
- .hour(0)
229
- .format('YYYY-MM-DD HH:mm:ss');
230
- } else {
231
- params[value] = moment(element[index])
232
- .millisecond(59)
233
- .second(59)
234
- .minute(59)
235
- .hour(23)
236
- .format('YYYY-MM-DD HH:mm:ss');
237
- }
238
- });
239
- delete params[key];
240
- } else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
241
- const dataParams = key.split('*checkBox*');
242
- if (element) {
243
- params[dataParams[0]] = 0
244
- }
245
- delete params[key];
246
- } else if (element && key.indexOf('*cascader*') >= 0) {
247
- const dataParams = key.split('*cascader*');
248
- params[dataParams[0]] = element[element.length - 1]
249
- delete params[key];
250
- } else if (element && key.indexOf('*date*') >= 0) {
251
- const dataParams = key.split('*date*')
252
- dataParams.forEach((value, index) => {
253
- if (index === 0) {
254
- params[value] = moment(element[index])
255
- .format('YYYY-MM-DD');
256
- } else {
257
- params[value] = moment(element[index])
258
- .format('YYYY-MM-DD');
259
- }
260
- });
261
- delete params[key];
262
- }
263
- else if (element && key.indexOf('*') >= 0) {
264
- const dataParams = key.split('*');
265
- dataParams.forEach((value, index) => {
266
- params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
267
- });
268
- delete params[key];
269
- } else if (element && key.indexOf('_selectNumberRange') >= 0) { // key = xxxxx_selectNumberRange qp-xxxxx-gt
270
- const dataParams = key.split('_selectNumberRange')[0]
271
- if (params[key][0] === 'range') {
272
- if (params[key][1][0]) {
273
- params[`qp-${dataParams}-ge`] = params[key][1][0]
274
- }
275
- if (params[key][1][1]) {
276
- params[`qp-${dataParams}-le`] = params[key][1][1]
277
- }
278
- } else {
279
- params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
280
- }
281
- delete params[key]
282
- } else if (Array.isArray(element)) {
283
- params[key] = element.join(',');
284
- } else if (element == null || element === undefined || String(element).trim() === '') {
285
- delete params[key]
286
- }
287
- }
288
- }
289
-
290
- const queryParams = {
291
- pageSize,
292
- currentPage,
293
- ...otherParams, // 默认参数
294
- ...fixedParam,
295
- ...params,
296
- }
297
- axios
298
- .get(`${url}?${stringify(queryParams)}`)
299
- .then((result: any) => {
300
- setFetching(false)
301
- result = result.data;
302
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
303
- message.error(result.msg);
304
- return;
305
- }
306
- const res = result.data;
307
- let source = [];
308
- if (isMap) {
309
- source = Object.keys(res).map((d, i) => {
310
- return {
311
- text: Object.values(res)[i],
312
- value: d,
313
- };
314
- });
315
- } else {
316
- const keys = res.list ? 'list' : 'items';
317
- source = res
318
- ? res[keys]
319
- ? res[keys].map((item: any) => {
320
- let textShowText = item[mappingTextField]
321
- if (mappingTextShowTextField) {
322
- textShowText = []
323
- if (Array.isArray(mappingTextShowTextField)) {
324
- mappingTextShowTextField.forEach((r: any) => {
325
- textShowText.push(item[r])
326
- })
327
- } else {
328
- textShowText = item[mappingTextShowTextField]
329
- }
330
- }
331
- return {
332
- ...item,
333
- text: item[mappingTextField],
334
- textShowText,
335
- textShowKey: item[mappingTextShowKeyField || mappingValueField],
336
- value: item[mappingValueField],
337
- baseUnitCode: item?.packingUnitList?.find((item: any) => item.baseUnit === true)?.unitCode
338
- };
339
- })
340
- : Array.isArray(res) &&
341
- res?.map((item: Record<string, any>) => {
342
- let textShowText = item[mappingTextField]
343
- if (mappingTextShowTextField) {
344
- textShowText = []
345
- if (Array.isArray(mappingTextShowTextField)) {
346
- mappingTextShowTextField.forEach((r: any) => {
347
- textShowText.push(item[r])
348
- })
349
- } else {
350
- textShowText = item[mappingTextShowTextField]
351
- }
352
- }
353
- return {
354
- ...item,
355
- text: item[mappingTextField],
356
- textShowText,
357
- textShowKey: item[mappingTextShowKeyField || mappingValueField],
358
- value: item[mappingValueField],
359
- baseUnitCode: item?.packingUnitList?.find((item: any) => item.baseUnit === true)?.unitCode
360
- };
361
- })
362
- : [];
363
- }
364
- source = Array.isArray(source) ? source : []
365
- if (type === 1) {
366
- ctx?.form?.setFieldSource(resultSourceKey, source)
367
- setItems(source)
368
- setItemsTotal(Number(res?.total || res?.totalCount || source.length))
369
- } else {
370
- setTableData(source)
371
- setTablePagination({ ...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage)) })
372
- }
373
- })
374
- .catch((err) => { setFetching(false) });
375
- }
376
-
377
- const SelectScroll = e => {
378
- e.persist();
379
- const { target } = e;
380
- const totalPage = Math.ceil(itemsTotal / pageSize)
381
- // 判断是否滑动到底部
382
- const isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight // >=scrollHeight
383
- // 判断数据是否还没有加载到了最后一页
384
- const canPageAdd = scrollPage < totalPage
385
- if (isTouchGround && canPageAdd) {
386
- const nextScrollPage = scrollPage + 1;
387
- setScrollPage(nextScrollPage);
388
- getData({ currentPage: nextScrollPage }); // 调用api方法
389
- }
390
-
391
- //判断是否滑动到顶部
392
- const isTouchTop = target.scrollTop === 0 // <=0
393
- // 判断数据是否到第一页
394
- const canPageJian = scrollPage > 1
395
- if (isTouchTop && canPageJian) {
396
- const preScrollPage = scrollPage - 1;
397
- setScrollPage(preScrollPage);
398
- getData({ currentPage: preScrollPage }); // 调用api方法
399
- }
400
- }
401
-
402
- useEffect(() => {
403
- Promise.all([
404
- loadSelectSource(`/items/brand/queryBrandList`, {
405
- pageSize: 5000,
406
- currentPage: 1,
407
- 'ctl-withAuth': true
408
- }),
409
- loadSelectSource(`/items/category/queryCategoryTree`, {
410
- pageSize: 5000,
411
- currentPage: 1,
412
- }),
413
- ]).then((x: any)=>{
414
- formatSource(x,0, 2, tableSearchForm,['id','name'])
415
- formatTreeDataSource(x,1, 3, tableSearchForm)
416
- })
417
- }, [])
418
-
419
- useEffect(() => {
420
- if (value) {
421
- setPopValue(value);
422
- }
423
- }, [value]);
424
-
425
- useEffect(() => {
426
- makeUniqueValue();
427
- }, [sourceName])
428
-
429
- const showModal = () => {
430
- // getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
431
- setIsModalVisible(true);
432
- // 回显
433
- if (value) {
434
- if (selectMode) {
435
- setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
436
- setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
437
- setIndeterminate(!!value.length && value.length < itemsTotal);
438
- setCheckedAll(itemsTotal && value.length === itemsTotal);
439
- // 需清空数据
440
- if (!value.length) {
441
- setDoubleArr([])
442
- }
443
- } else {
444
- setSelectedRowKeys(labelInValue ? [value.key] : [value])
445
- setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value }]);
446
- }
447
- }
448
-
449
- setTimeout(() => {
450
- document.getElementById("first-query")?.focus()
451
- }, 50)
452
- };
453
-
454
- const handleShowModal = () => {
455
- if(beforeShowModal) {
456
- beforeShowModal(popvalue).then(res => {
457
- showModal()
458
- }).catch(Error => {
459
- message.warning(Error)
460
- })
461
- } else {
462
- showModal()
463
- }
464
- }
465
-
466
- const handleSelectOver = (selectedValue: any) => {
467
- if (selectedValue?.length) {
468
- formaData(selectedValue);
469
- // 解决选择最后1页的sku,返回后,不显示名称问题
470
- const source = _.uniqBy(items.concat(selectedValue), 'value')
471
- ctx?.form?.setFieldSource(resultSourceKey, source)
472
- setItems(source)
473
- }
474
- }
475
-
476
- const handleLoading = (isContinue,flag) => {
477
- isContinue ? setConfirmContinueLoading(flag) : setConfirmLoading(flag);
478
- }
479
-
480
- const handleOk = (isContinue) => {
481
- if(!popvalue.length) {
482
- message.warning('至少选中一条数据')
483
- return;
484
- }
485
- // handleSelectOver(popvalue)
486
- if(onSaveCallback) {
487
- handleLoading(isContinue,true)
488
- onSaveCallback(popvalue).then(res => {
489
- if(true) {
490
- message.success('保存成功')
491
- deleteSelectRows();
492
- document.getElementById('first-query')?.focus()
493
- !isContinue && handleCancel();
494
- } else {
495
- }
496
- handleLoading(isContinue,false)
497
- }).catch(Error => {
498
- message.error(Error);
499
- handleLoading(isContinue,false)
500
- })
501
- } else {
502
- !isContinue && handleCancel();
503
- }
504
- };
505
-
506
- const formaData = (value) => {
507
- if (labelInValue) {
508
- const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
509
- onChange(selectMode ? formatResult : formatResult[0])
510
- } else {
511
- const formatResult = selectMode ? value.map((i: any) => i.value) : _.get(value[0], 'value')
512
- onChange(formatResult)
513
- }
514
- };
515
-
516
- const handleCancel = () => {
517
- form.resetFields();
518
- setTableFormParams({});
519
- setIsModalVisible(false);
520
- setTableData([])
521
- // if (selectMode) {
522
- // run();
523
- // }
524
- };
525
-
526
- const onSearchChange = (e) => {
527
- setSearchValue(e.target.value);
528
- run();
529
- }
530
-
531
- const onSearchBlur = () => {
532
- setSearchValue('')
533
- run();
534
- }
535
-
536
- const onSearchTable = () => {
537
- const params = form.getFieldsValue();
538
- setTableFormParams(params);
539
- getData({ ...params, pageSize: tableInitPageSize }, 2)
540
- if (selectMode) {
541
- getData(params)
542
- }
543
- }
544
-
545
- const onResetTable = () => {
546
- form.resetFields();
547
- setTableFormParams({});
548
- getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
549
- }
550
-
551
- const handleTableChange = (pagination) => {
552
- getData({ ...tableFormParams, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
553
- }
554
-
555
- // 扁平化二维数组的方法
556
- const mapRows = params => {
557
- var res = [];
558
- for (var i = 0; i < params.length; i++) {
559
- if (Array.isArray(params[i])) {
560
- // 去重
561
- res = _.uniqBy(res.concat(mapRows(params[i])), 'value');
562
- } else {
563
- res.push(params[i]);
564
- // 去重
565
- res = _.uniqBy(res, 'value')
566
- }
567
- }
568
- return res.filter(Boolean); //去掉undefined的情况
569
- };
570
-
571
- const onChangeSelectedKeys = (selectKeys, selectRows) => {
572
- if(selectKeys.length - selectedRowKeys.length > 0) {
573
- if (selectKeys.length - selectedRowKeys.length === 1) {
574
- selectRows[selectRows.length -1]['needFocus'] = true;
575
- } else {
576
- selectRows[selectedRowKeys.length]['needFocus'] = true;
577
- }
578
- }
579
- setPopValue(selectRows);
580
- setSelectedRowKeys(selectKeys)
581
- // setIndeterminate(!!filterRows.length && filterRows.length < tablePagination?.total);
582
- // setCheckedAll(filterRows.length === tablePagination?.total);
583
- }
584
-
585
- // 生成唯一值
586
- const makeUniqueValue = () => {
587
- const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
588
- setUniqueValue(generateUnitKey);
589
- return generateUnitKey;
590
- }
591
-
592
- const rowSelection = {
593
- type: 'checkbox',
594
- selectedRowKeys,
595
- preserveSelectedRowKeys: true,
596
- onChange: (sks, srs) => {
597
- onChangeSelectedKeys(sks, srs)
598
- },
599
- getCheckboxProps: () => ({
600
- disabled: selectProps?.disabled || props?.disabled,
601
- }),
602
- };
603
-
604
- const onDoubleClickSelect = (e, record) => {
605
- if (!selectMode) {
606
- const srs = [JSON.parse(JSON.stringify(record))]
607
- const sks = srs.map((i: any) => i.value)
608
- onChangeSelectedKeys(sks, srs)
609
- }
610
- }
611
-
612
- const themeColor = { color: '#005CFF' }
613
-
614
- const formItem = (list) => {
615
- if (isModalVisible && list?.length) {
616
- return list.map((i: any, index) => {
617
- if (i?.type === 'select' || i?.field?.type === 'select') {
618
- return (
619
- <Form.Item name={i.name} label={i.label} key={i.name}>
620
- <Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}>
621
- {i?.initialSource?.length && i?.initialSource.map((m: any) => (
622
- <Option value={m.value} key={m.value}>{m.text}</Option>
623
- ))}
624
- </Select>
625
- </Form.Item>
626
- )
627
- }
628
-
629
- if (i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
630
- return (
631
- <Form.Item name={i.name} label={i.label} key={i.name}>
632
- <TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}></TreeSelect>
633
- </Form.Item>
634
- )
635
- }
636
-
637
- if (i?.type === 'BusinessSearchSelect' || i?.field?.type === 'BusinessSearchSelect') {
638
- return (
639
- <div>
640
- <Form.Item name={i.name} label={i.label} key={i.name}>
641
- <BusinessSearchSelect {...i.field.props} />
642
- </Form.Item>
643
- </div>
644
- )
645
- }
646
-
647
- if (i?.type === 'multipleQueryInput' || i?.field?.type === 'multipleQueryInput') {
648
- return (
649
- <div>
650
- <Form.Item name={i.name} label={i.label} key={i.name}>
651
- <QueryMutipleInput onValueChange={(value) => {
652
- form.setFieldsValue({
653
- [i.name]: value
654
- })
655
- }} />
656
- </Form.Item>
657
- </div>
658
- );
659
- }
660
-
661
- // 默认type是input
662
- return (
663
- <Form.Item name={i.name} label={i.label} key={i.name}>
664
- <Input id={index === 0 ? "first-query" : 'index'} style={{ width: '100%' }} onKeyDown={(e) => {
665
- if (e.keyCode === 13) {
666
- onSearchTable()
667
- }
668
- }} placeholder='请输入' allowClear maxLength={100} {...i?.field?.props} />
669
- </Form.Item>
670
- )
671
- })
672
- } else {
673
- return null
674
- }
675
- }
676
-
677
- const maxTagPlaceholder = (selectedValues) => {
678
- const onClose = (e: any, item: any) => {
679
- e.preventDefault();
680
- const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value) : JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
681
- onChange(newValue);
682
- }
683
- return (
684
- <Tooltip title={selectedValues.map((i: any) => (
685
- <Tag
686
- closable={true}
687
- onClose={(e) => onClose(e, i)}
688
- style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
689
- >
690
- {i.label}
691
- </Tag>
692
- ))}>
693
- {`+ ${selectedValues?.length}`}
694
- </Tooltip>
695
- )
696
- }
697
-
698
- const deleteSelectRows = () => {
699
- setPopValue([])
700
- setSelectedRowKeys([])
701
- }
702
-
703
- const deleteRecord = (record) => {
704
- setPopValue(popvalue.filter(item => item.skuCode !== record.skuCode))
705
- setSelectedRowKeys([...selectedRowKeys.filter(item => item !== record.skuCode)])
706
- }
707
-
708
- let inputIndex = 0;
709
- let selectColumns = [... modalTableProps.selectColumn.map(item => {
710
- const inputLength = modalTableProps.selectColumn.filter(item => item.isInputItem).length
711
- const currentIndex = inputIndex
712
-
713
- if (item.isInputItem) {
714
- inputIndex++;
715
- return {
716
- ...item,
717
- render: (text, record, index) => {
718
- // let
719
- if(record.needFocus === true && currentIndex === 0) {
720
-
721
- }
722
- let precisionObj={};
723
- const unitAccuracy = record.packingUnitList?.[0]?.unitAccuracy
724
- const isCountUnitAccuracyCheck = item.dataIndex =='count' && unitAccuracy !== undefined
725
- if(isCountUnitAccuracyCheck) {
726
- precisionObj = {
727
- onBlur: (e: any) => {
728
- const { target: { value } } = e;
729
- if(!checkQuantityAccuracy(value,Number(unitAccuracy))) {
730
- record[item.dataIndex] = precisionQuantity(value,Number(unitAccuracy))
731
- const newPopValue = popvalue.map((i: any, innerIndex: number) => {
732
- if(innerIndex == index) {
733
- i[item.dataIndex] = record[item.dataIndex]
734
- }
735
- return i
736
- })
737
- setPopValue(newPopValue)
738
- }
739
- }
740
- // precision: unitAccuracy
741
- }
742
- }
743
- return (
744
- <InputNumber
745
- value={text || ''}
746
- min={0}
747
- autoFocus={record.needFocus}
748
- keyboard={false}
749
- {...precisionObj}
750
- onChange={(value) => {
751
- record[item.dataIndex] = value
752
- const newPopValue = popvalue.map((i: any, innerIndex: number) => {
753
- if(innerIndex == index) {
754
- i[item.dataIndex] = record[item.dataIndex]
755
- }
756
- return i
757
- })
758
- setPopValue(newPopValue)
759
- }}
760
- // onFocus={(e)=> {
761
- // let dom1 = e.currentTarget;
762
- // dom1.setSelectionRange(100, 0);
763
- // dom1.select(text);
764
- // }}
765
- onKeyDown={(e) => {
766
- if(e.keyCode === 13 && e.ctrlKey) {
767
- handleOk(true)
768
- document.getElementById("first-query")?.focus()
769
- }
770
- if(e.keyCode === 8 && e.ctrlKey) {
771
- message.success('删除当前行')
772
- e.stopPropagation();
773
- e.preventDefault();
774
- let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
775
- if (dom) {
776
- dom.select();
777
- dom.focus();
778
- dom.scrollIntoView(false)
779
- }
780
- dom = null
781
- deleteRecord(record, popvalue);
782
- }
783
- if (e.keyCode === 37 && e.shiftKey) { // 左滑动
784
- e.stopPropagation();
785
- e.preventDefault();
786
- let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
787
- if (dom) {
788
- dom.select();
789
- dom.focus();
790
- dom.scrollIntoView(false)
791
- }
792
- dom = null
793
- }
794
- if (e.keyCode === 39 && e.shiftKey) { // 右滑
795
- e.stopPropagation();
796
- e.preventDefault();
797
- let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
798
- if (dom) {
799
- dom.select();
800
- dom.focus();
801
- dom.scrollIntoView(false)
802
- }
803
- dom = null
804
- }
805
- if (e.keyCode === 40) {
806
- e.stopPropagation();
807
- e.preventDefault();
808
- let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
809
- if (dom) {
810
- dom.select();
811
- dom.focus();
812
- dom.scrollIntoView(false)
813
- }
814
- dom = null
815
- } else if (e.keyCode === 38) {
816
- e.stopPropagation();
817
- e.preventDefault();
818
- let dom1 = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
819
- if (dom1) {
820
- // dom1.value=""
821
- // dom1.setSelectionRange(100, 0);
822
- dom1.select();
823
- dom1.focus();
824
- dom1.scrollIntoViewIfNeeded(false)
825
- // dom1.value=record['count']
826
- }
827
- dom1 = null
828
- } else if (e.keyCode === 9 && index === selectedRowKeys.length - 1 && currentIndex === inputLength - 1) {
829
- e.stopPropagation();
830
- e.preventDefault();
831
- }
832
- }}
833
- />
834
- );
835
- },
836
- }
837
- }
838
-
839
- return item
840
- }), {
841
- title: '操作',
842
- width: 50,
843
- fixed: 'right',
844
- render: (text, record, index) => {
845
- return (
846
- <span style={{cursor: 'pointer', color: '#005CFF' }} onClick={() => {
847
- deleteRecord(record)
848
- }} type={"text"}>删除</span>
849
- )
850
- }
851
- },]
852
-
853
- const handleResize =
854
- (index) =>
855
- (e, { size }) => {
856
- setTableColumns((columns: any) => {
857
- let newColumns = [...columns];
858
- newColumns[index] = {
859
- ...newColumns[index],
860
- width: size.width,
861
- };
862
- return [...newColumns];
863
- });
864
- };
865
-
866
- return (
867
- <div className={'add_select'}>
868
- <div className="add_select_show" id={`add_select_div_${uniqueValue}`}>
869
- <Button onClick={handleShowModal} {...realButtonProps}>
870
- {buttonText}
871
- </Button>
872
- </div>
873
- {needModalTable && isModalVisible && (
874
- <Modal
875
- width='1200px'
876
- style={{ top: 20 }}
877
- bodyStyle={{ padding: '0px' }}
878
- // title={modalTableProps?.modalTableTitle}
879
- visible={isModalVisible}
880
- closable={false}
881
- onCancel={handleCancel}
882
- footer={selectMode ? [
883
- <Button key="back" onClick={handleCancel}>
884
- 取消
885
- </Button>,
886
- <Button
887
- key="submit"
888
- style={{color: '#005CFF', borderColor: '#005CFF'}}
889
- onClick={() => {handleOk(true)}}
890
- loading={confirmContinueLoading}
891
- disabled={!tableData.length || (selectProps?.disabled || props?.disabled)}
892
- >
893
- 保存并继续
894
- </Button>,
895
- <Button
896
- key="submit"
897
- type="primary"
898
- onClick={() => {handleOk(false)}}
899
- loading={confirmLoading}
900
- disabled={!tableData.length || (selectProps?.disabled || props?.disabled)}
901
- >
902
- 确定
903
- </Button>,
904
- ] : null}
905
- >
906
- <div>
907
- <div className='add_select_header'>
908
- {modalTableProps?.modalTableTitle}
909
- <span><span>*</span> &nbsp;快捷键:【Tab】-跳格切换;【Shift+←、→】-当前行左、右移动;【 ↑、↓】-当前列上、下移动;【ctrl+Enter】-保存并继续;【ctrl+Delete】-删除当前行;</span>
910
- <span className='add_select_header_close'><CloseCircleOutlined style={{fontSize: '20px'}} onClick={handleCancel} /></span>
911
- </div>
912
- <div className={'add_select_wrapper'}>
913
- <div className={caretLeftFlag ? 'add_select_wrapper_left' : 'add_select_wrapper_left1'}>
914
- <div className={'select_list_columns'}>
915
- <div className={'select_list_columns_formItems'}>
916
- <Form form={form} layout='vertical' key='modalForm'>
917
- {formItem(tableSearchForm)}
918
- </Form>
919
- </div>
920
- </div>
921
- <div className={'select_list_searchButton'}>
922
- <Button key='reset' className={'select_list_button_space'} onClick={onResetTable}>重置</Button>
923
- <Button key='search' type="primary" onClick={onSearchTable}>查询</Button>
924
- </div>
925
- </div>
926
- <div className={caretLeftFlag ? 'add_select_wrapper_right' : 'add_select_wrapper_right1'}>
927
- <div>
928
- <div className={'select_list_selectTips'}>
929
- <div style={{ marginLeft: 8 }}>搜索结果共&nbsp;<span style={themeColor}>{tablePagination?.total || 0}</span>&nbsp;项{selectMode ? <span>, 本次已选&nbsp;<span style={themeColor}>{selectedRowKeys?.length || 0}</span>&nbsp;项</span> : ''}</div>
930
- </div>
931
- <Table
932
- size='small'
933
- rowSelection={rowSelection}
934
- columns={tableColumns}
935
- dataSource={tableData}
936
- pagination={tablePagination}
937
- loading={fetching}
938
- onChange={handleTableChange}
939
- rowKey={mappingValueField}
940
- rowClassName={'row-class'}
941
- scroll={{ y: 500 }}
942
- components={{
943
- header: {
944
- cell: ResizeableTitle,
945
- },
946
- }}
947
- />
948
- </div>
949
- </div>
950
- {/* <div>
951
- <Table
952
- size='small'
953
- columns={modalTableProps?.tableColumns}
954
- dataSource={mapRows(doubleArr)}
955
- rowKey={mappingValueField}
956
- scroll={{ x: modalTableProps.overScrollX || 'max-content', y: modalTableProps.overScrollY || null }}
957
- onRow={record => {
958
- return {
959
- onDoubleClick: event => onDoubleClickSelect(event, record),
960
- };
961
- }}
962
- />
963
- </div> */}
964
- </div>
965
- <div className={'add_select_wrapper_select'}>
966
- <div className={'select_list_selectTips'}>
967
- <div style={{ marginLeft: 8 }}><span>本次已选&nbsp;<span style={themeColor}>{selectedRowKeys?.length || 0}</span>&nbsp;项</span></div>
968
- <div style={{ marginRight: 8 }}><span onClick={deleteSelectRows} style={{ ...themeColor, cursor: 'pointer' }}>清空所选商品</span></div>
969
- </div>
970
- <Table
971
- size='small'
972
- // rowSelection={rowSelection}
973
- columns={selectColumns}
974
- dataSource={popvalue}
975
- pagination={false}
976
- // onChange={handleTableChange}
977
- rowKey={mappingValueField}
978
- rowClassName={'row-class'}
979
- scroll={{ y: 500 }}
980
- onRow={record => {
981
- return {
982
- onDoubleClick: event => onDoubleClickSelect(event, record),
983
- };
984
- }}
985
- />
986
- </div>
987
- </div>
988
- </Modal>
989
- )}
990
- </div>
991
- );
992
- };
993
-
994
- export default AddSelect;
1
+ // @ts-nocheck
2
+ import React, { useState, useEffect } from 'react';
3
+ import { useDebounceFn } from 'ahooks';
4
+ import { Input, Button, Modal, Select, InputNumber, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
5
+ import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/icons';
6
+ import axios from 'axios';
7
+ import { stringify } from 'querystring';
8
+ import _ from "lodash"
9
+ import './index.less';
10
+ import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
+ import { Resizable } from 'react-resizable';
12
+ import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
13
+ import TableColumnSetting from '@/plugin/TableColumnSetting';
14
+ import { setInitialShowColumn } from '@/plugin/TableColumnSetting/utils';
15
+ import { handleAntdColumnsSpecialParams, uuid } from '@/utils/utils';
16
+ import { getItemDefaultWidth, noEmptyArray } from '@/components/Business/columnSettingTable/utils';
17
+
18
+ const loadSelectSource = (url: string, params?: any) => {
19
+ return new Promise((resolve, reject) => {
20
+ axios
21
+ .get(`${url}?${stringify(params)}`)
22
+ .then((result: any) => {
23
+ result = result.data;
24
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
25
+ message.error(result.msg);
26
+ return;
27
+ }
28
+ resolve(result);
29
+ })
30
+ .catch((err) => {
31
+ reject(err);
32
+ });
33
+ })
34
+ };
35
+
36
+ const ResizeableTitle = (props) => {
37
+ const { onResize, width, ...restProps } = props;
38
+
39
+ if (!width) {
40
+ return <th {...restProps} />;
41
+ }
42
+ return (
43
+ <Resizable
44
+ width={width}
45
+ height={0}
46
+ onResize={onResize}
47
+ draggableOpts={{ enableUserSelectHack: false }}
48
+ >
49
+ <th {...restProps} />
50
+ </Resizable>
51
+ );
52
+ };
53
+
54
+ const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
55
+ const data = reData && reData[position]?.data;
56
+ const list = Array.isArray(data) ? data :(data?.items || data?.list || data?.children || []);
57
+ const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
58
+ changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
59
+ }
60
+
61
+ // 格式化树选择器数据源
62
+ const mapSearchTree = (treeDataItem: any, resKeyValue: any) => {
63
+ const haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
64
+ return {
65
+ title: treeDataItem[resKeyValue[1]],
66
+ value: treeDataItem[resKeyValue[0]],
67
+ parentId: treeDataItem.parent,
68
+ data: { ...treeDataItem },
69
+ isLeaf: !haveChildren,
70
+ disabled: haveChildren,
71
+ children: haveChildren ? treeDataItem.children.map((i: any) => mapSearchTree(i, resKeyValue)) : [],
72
+ };
73
+ };
74
+ const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name']) => {
75
+ const data = reData && reData[position]?.data;
76
+ const formatData = (data &&
77
+ Array.isArray(data) &&
78
+ data.length &&
79
+ data.map((ites: any) => mapSearchTree(ites, resKeyValue))) ||
80
+ []
81
+ changeSearchForm[changePosition].field.props.treeData = formatData;
82
+ }
83
+
84
+ const { Option } = Select;
85
+
86
+ const AddSelect = (props: any) => {
87
+ const {
88
+ value, // 必传
89
+ onChange,
90
+ selectProps = {},
91
+ modalTableProps = {},
92
+ labelInValue = false,
93
+ requestConfig,
94
+ ctx,
95
+ sourceName,
96
+ needModalTable = true,
97
+ getPopupContainer = undefined,
98
+ onSaveCallback,
99
+ buttonText = '添加',
100
+ buttonProps = {},
101
+ beforeShowModal,
102
+ tableCodeList = [], // 非必填 默认取组件定义code,如需自定义----数组第一位为供选择商品的table的code,第二位为已选择商品的table的code
103
+ businessType = 'sku',
104
+ isAllowRepeatedSelect = false
105
+ } = props;
106
+ const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField = 'name', mappingTextShowKeyField, mappingValueField = 'code', mappingTextShowTextField } = requestConfig || {};
107
+ const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
108
+ const realButtonProps = {type: "primary", ...buttonProps};
109
+ const selectRowKey = isAllowRepeatedSelect ? 'uuid' : mappingValueField
110
+
111
+ const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
112
+ const initVal = value || (selectMode ? [] : null);
113
+ const pageSize = 100 // 下拉框默认分页 条数
114
+ const tableInitPageSize = 10 // 弹框默认分页 条数
115
+ const currentPage = 1
116
+ const selectParamsKey = requestConfig?.filter || 'qp-codeAndName-like'
117
+ const selectParamsInitKey = requestConfig?.filterInit || selectParamsKey
118
+ const currentSelectProps = {
119
+ ...selectProps,
120
+ // 以下属性不可更改----设计配置项
121
+ showSearch: false,
122
+ filterOption: false,
123
+ allowClear: true,
124
+ listHeight: 160,
125
+ optionLabelProp: "label",
126
+ autoClearSearchValue: false
127
+ }
128
+ const [items, setItems] = useState([]);
129
+ const [scrollPage, setScrollPage] = useState(1);
130
+ const [itemsTotal, setItemsTotal] = useState(0);
131
+ const [fetching, setFetching] = useState(false);
132
+ const [searchValue, setSearchValue] = useState('');
133
+ const [isModalVisible, setIsModalVisible] = useState(false);
134
+ const [popvalue, setPopValue] = useState(initVal);
135
+ const [uniqueValue, setUniqueValue] = useState(sourceName)
136
+ const { run } = useDebounceFn(
137
+ (v?: any) => {
138
+ // 优化搜索参数 支持传多个
139
+ let searchParams = {};
140
+ if (typeof selectParamsKey === 'string') {
141
+ searchParams = v ? { [selectParamsInitKey]: initVal } : { [selectParamsKey]: searchValue }
142
+ }
143
+ if (Array.isArray(selectParamsKey)) {
144
+ selectParamsKey.forEach((i: any) => {
145
+ searchParams = { ...searchParams, [i]: searchValue }
146
+ })
147
+ }
148
+ // 防抖函数 待定
149
+ getData(searchParams)
150
+ },
151
+ {
152
+ wait: 1000,
153
+ },
154
+ );
155
+
156
+ const [form] = Form.useForm();
157
+ const [tableSearchForm, setTableSearchForm] = useState(modalTableProps?.tableSearchForm)
158
+ const [caretLeftFlag, setCaretLeftFlag] = useState(true);
159
+ const [tableData, setTableData] = useState([]);
160
+ const [tablePagination, setTablePagination] = useState({ total: 0, size: "small", current: 1, pageSize: tableInitPageSize })
161
+ const [selectedRowKeys, setSelectedRowKeys] = useState([]);
162
+ const [doubleArr, setDoubleArr] = useState([]); // 存放双数组的数组
163
+ const [checkedAll, setCheckedAll] = useState(false)
164
+ const [indeterminate, setIndeterminate] = useState(false)
165
+ const [tableFormParams, setTableFormParams] = useState({});
166
+ const [confirmLoading, setConfirmLoading] = useState(false);
167
+ const [confirmContinueLoading, setConfirmContinueLoading] = useState(false);
168
+
169
+ const [selectColumns, setSelectColumns] = useState([]);
170
+ const [showColumns, setShowColumns] = useState([]);
171
+ const [tableColumns, setTableColumns] = useState([]);
172
+ const [showToChooseColumns, setShowToChooseColumns] = useState([]);
173
+ const codeToChoose = tableCodeList[0] || 'skuSelect-tableOptionsToChoosePartCode';
174
+ const codeSelected = tableCodeList[1] || 'skuSelect-tableSelectedItemPartCode';
175
+
176
+ useEffect(() => {
177
+ setTableColumns(modalTableProps?.tableColumns)
178
+ }, [modalTableProps?.tableColumns])
179
+
180
+ useEffect(() => {
181
+ setSelectColumns([... modalTableProps.selectColumn.map(item => {
182
+ const inputLength = modalTableProps.selectColumn.filter(item => item.isInputItem).length
183
+ const currentIndex = inputIndex
184
+
185
+ if (item.isInputItem) {
186
+ inputIndex++;
187
+ return {
188
+ ...item,
189
+ render: (text, record, index) => {
190
+ // let
191
+ if(record.needFocus === true && currentIndex === 0) {
192
+
193
+ }
194
+ let precisionObj=businessType == 'skc'?{
195
+ precision: 0
196
+ }:{};
197
+ const unitAccuracy = record.packingUnitList?.[0]?.unitAccuracy
198
+ const isCountUnitAccuracyCheck = item.dataIndex =='count' && unitAccuracy !== undefined
199
+ if(isCountUnitAccuracyCheck) {
200
+ precisionObj = {
201
+ onBlur: (e: any) => {
202
+ const { target: { value } } = e;
203
+ if(!checkQuantityAccuracy(value,Number(unitAccuracy))) {
204
+ record[item.dataIndex] = precisionQuantity(value,Number(unitAccuracy))
205
+ const newPopValue = popvalue.map((i: any, innerIndex: number) => {
206
+ if(innerIndex == index) {
207
+ i[item.dataIndex] = record[item.dataIndex]
208
+ }
209
+ return i
210
+ })
211
+ setPopValue(newPopValue)
212
+ }
213
+ }
214
+ // precision: unitAccuracy
215
+ }
216
+ }
217
+ return (
218
+ <InputNumber
219
+ value={text || ''}
220
+ min={0}
221
+ autoFocus={record.needFocus}
222
+ keyboard={false}
223
+ {...precisionObj}
224
+ onChange={(value) => {
225
+ record[item.dataIndex] = value
226
+ const newPopValue = popvalue.map((i: any, innerIndex: number) => {
227
+ if(innerIndex == index) {
228
+ i[item.dataIndex] = record[item.dataIndex]
229
+ }
230
+ return i
231
+ })
232
+ setPopValue(newPopValue)
233
+ }}
234
+ // onFocus={(e)=> {
235
+ // let dom1 = e.currentTarget;
236
+ // dom1.setSelectionRange(100, 0);
237
+ // dom1.select(text);
238
+ // }}
239
+ onKeyDown={(e) => {
240
+ if(e.keyCode === 13 && e.ctrlKey) {
241
+ handleOk(true)
242
+ document.getElementById("first-query")?.focus()
243
+ }
244
+ if(e.keyCode === 8 && e.ctrlKey) {
245
+ message.success('删除当前行')
246
+ e.stopPropagation();
247
+ e.preventDefault();
248
+ let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
249
+ if (dom) {
250
+ dom.select();
251
+ dom.focus();
252
+ dom.scrollIntoView(false)
253
+ }
254
+ dom = null
255
+ deleteRecord(record, popvalue);
256
+ }
257
+ if (e.keyCode === 37 && e.shiftKey) { // 左滑动
258
+ e.stopPropagation();
259
+ e.preventDefault();
260
+ let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
261
+ if (dom) {
262
+ dom.select();
263
+ dom.focus();
264
+ dom.scrollIntoView(false)
265
+ }
266
+ dom = null
267
+ }
268
+ if (e.keyCode === 39 && e.shiftKey) { // 右滑
269
+ e.stopPropagation();
270
+ e.preventDefault();
271
+ let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
272
+ if (dom) {
273
+ dom.select();
274
+ dom.focus();
275
+ dom.scrollIntoView(false)
276
+ }
277
+ dom = null
278
+ }
279
+ if (e.keyCode === 40) {
280
+ e.stopPropagation();
281
+ e.preventDefault();
282
+ let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
283
+ if (dom) {
284
+ dom.select();
285
+ dom.focus();
286
+ dom.scrollIntoView(false)
287
+ }
288
+ dom = null
289
+ } else if (e.keyCode === 38) {
290
+ e.stopPropagation();
291
+ e.preventDefault();
292
+ let dom1 = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
293
+ if (dom1) {
294
+ // dom1.value=""
295
+ // dom1.setSelectionRange(100, 0);
296
+ dom1.select();
297
+ dom1.focus();
298
+ dom1.scrollIntoViewIfNeeded(false)
299
+ // dom1.value=record['count']
300
+ }
301
+ dom1 = null
302
+ } else if (e.keyCode === 9 && index === selectedRowKeys.length - 1 && currentIndex === inputLength - 1) {
303
+ e.stopPropagation();
304
+ e.preventDefault();
305
+ }
306
+ }}
307
+ />
308
+ );
309
+ },
310
+ }
311
+ }
312
+
313
+ const selectLength = modalTableProps.selectColumn.filter(item => item.isSelectItem).length
314
+ const currentSelectIndex = selectIndex
315
+ if(item.isSelectItem) {
316
+ selectIndex++;
317
+ return {
318
+ ...item,
319
+ render: (text, record, index) => {
320
+ if (item.dataSource?.length) {
321
+ return (
322
+ <Select
323
+ value={text || null}
324
+ onChange={(value) => {
325
+ if(businessType == 'skc' && popvalue.some((i: any) => i.code == record.code && i[item.dataIndex] == value)) {
326
+ message.warning('相同skc配码不可设置相同哦')
327
+ record[item.dataIndex] = null;
328
+ const newPopValue = popvalue.map((i: any, innerIndex: number) => {
329
+ if(innerIndex == index) {
330
+ i[item.dataIndex] = record[item.dataIndex]
331
+ }
332
+ return i
333
+ })
334
+ setPopValue(newPopValue)
335
+ return false
336
+ }
337
+ record[item.dataIndex] = value
338
+ const newPopValue = popvalue.map((i: any, innerIndex: number) => {
339
+ if(innerIndex == index) {
340
+ i[item.dataIndex] = record[item.dataIndex]
341
+ }
342
+ return i
343
+ })
344
+ setPopValue(newPopValue)
345
+ }}
346
+ style={{width: '160px'}}
347
+ >
348
+ {item.dataSource.map((item: any) => {
349
+ return <Select.Option value={item.code}>{item.name}</Select.Option>
350
+ })}
351
+ </Select>
352
+ )
353
+ }
354
+ return <></>
355
+ },
356
+ }
357
+ }
358
+
359
+ return item
360
+ }), {
361
+ title: '操作',
362
+ width: 50,
363
+ dataIndex: 'operation',
364
+ fixed: 'right',
365
+ render: (text, record, index) => {
366
+ return (
367
+ <span style={{cursor: 'pointer', color: '#005CFF' }} onClick={() => {
368
+ deleteRecord(record)
369
+ }} type={"text"}>删除</span>
370
+ )
371
+ }
372
+ },])
373
+ }, [modalTableProps?.selectColumn,popvalue])
374
+
375
+ // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
376
+ const getData = (params = {}, type = 1) => {
377
+ if (!requestConfig) return;
378
+
379
+ setFetching(true)
380
+
381
+ // 处理dependence参数
382
+ const fixedParam = {};
383
+ if (fixedparameter && fieldValToParam && ctx) {
384
+ fixedparameter.forEach((item: any, index: any) => {
385
+ const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
386
+ if (fixedParamVal) {
387
+ fixedParam[item] = fixedParamVal;
388
+ form.setFieldsValue({ ...form?.getFieldsValue(), [item]: fixedParamVal })
389
+ }
390
+ });
391
+ }
392
+
393
+ // 数组对象处理,对带有特殊标记的name进行处理
394
+ for (const key in params) {
395
+ if (Object.prototype.hasOwnProperty.call(params, key)) {
396
+ const element = params[key];
397
+ if (element && key.indexOf('*number*') >= 0) {
398
+ const dataParams = key.split('*number*');
399
+ dataParams.forEach((value, index) => {
400
+ params[value] = element[index];
401
+ });
402
+ delete params[key];
403
+ } else if (element && key.indexOf('*address*') >= 0) {
404
+ const dataParams = key.split('*address*');
405
+ dataParams.forEach((value, index) => {
406
+ params[value] = element.PCDCode[index];
407
+ });
408
+ delete params[key];
409
+ } else if (element && key.indexOf('*costType*') >= 0) {
410
+ const dataParams = key.split('*costType*');
411
+ // eslint-disable-next-line prefer-destructuring
412
+ params[dataParams[0]] = element[1];
413
+ delete params[key];
414
+ } else if (element && key.indexOf('*fullDate*') >= 0) {
415
+ const dataParams = key.split('*fullDate*');
416
+ dataParams.forEach((value, index) => {
417
+ if (index === 0) {
418
+ params[value] = moment(element[index])
419
+ .millisecond(0)
420
+ .second(0)
421
+ .minute(0)
422
+ .hour(0)
423
+ .format('YYYY-MM-DD HH:mm:ss');
424
+ } else {
425
+ params[value] = moment(element[index])
426
+ .millisecond(59)
427
+ .second(59)
428
+ .minute(59)
429
+ .hour(23)
430
+ .format('YYYY-MM-DD HH:mm:ss');
431
+ }
432
+ });
433
+ delete params[key];
434
+ } else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
435
+ const dataParams = key.split('*checkBox*');
436
+ if (element) {
437
+ params[dataParams[0]] = 0
438
+ }
439
+ delete params[key];
440
+ } else if (element && key.indexOf('*cascader*') >= 0) {
441
+ const dataParams = key.split('*cascader*');
442
+ params[dataParams[0]] = element[element.length - 1]
443
+ delete params[key];
444
+ } else if (element && key.indexOf('*date*') >= 0) {
445
+ const dataParams = key.split('*date*')
446
+ dataParams.forEach((value, index) => {
447
+ if (index === 0) {
448
+ params[value] = moment(element[index])
449
+ .format('YYYY-MM-DD');
450
+ } else {
451
+ params[value] = moment(element[index])
452
+ .format('YYYY-MM-DD');
453
+ }
454
+ });
455
+ delete params[key];
456
+ }
457
+ else if (element && key.indexOf('*') >= 0) {
458
+ const dataParams = key.split('*');
459
+ dataParams.forEach((value, index) => {
460
+ params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
461
+ });
462
+ delete params[key];
463
+ } else if (element && key.indexOf('_selectNumberRange') >= 0) { // key = xxxxx_selectNumberRange qp-xxxxx-gt
464
+ const dataParams = key.split('_selectNumberRange')[0]
465
+ if (params[key][0] === 'range') {
466
+ if (params[key][1][0]) {
467
+ params[`qp-${dataParams}-ge`] = params[key][1][0]
468
+ }
469
+ if (params[key][1][1]) {
470
+ params[`qp-${dataParams}-le`] = params[key][1][1]
471
+ }
472
+ } else {
473
+ params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
474
+ }
475
+ delete params[key]
476
+ } else if (Array.isArray(element)) {
477
+ params[key] = element.join(',');
478
+ } else if (element == null || element === undefined || String(element).trim() === '') {
479
+ delete params[key]
480
+ }
481
+ }
482
+ }
483
+
484
+ const queryParams = {
485
+ pageSize,
486
+ currentPage,
487
+ ...otherParams, // 默认参数
488
+ ...fixedParam,
489
+ ...params,
490
+ }
491
+ axios
492
+ .get(`${url}?${stringify(queryParams)}`)
493
+ .then((result: any) => {
494
+ setFetching(false)
495
+ result = result.data;
496
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
497
+ message.error(result.msg);
498
+ return;
499
+ }
500
+ const res = result.data;
501
+ let source = [];
502
+ if (isMap) {
503
+ source = Object.keys(res).map((d, i) => {
504
+ return {
505
+ text: Object.values(res)[i],
506
+ value: d,
507
+ };
508
+ });
509
+ } else {
510
+ const keys = res.list ? 'list' : 'items';
511
+ source = res
512
+ ? res[keys]
513
+ ? res[keys].map((item: any) => {
514
+ let textShowText = item[mappingTextField]
515
+ if (mappingTextShowTextField) {
516
+ textShowText = []
517
+ if (Array.isArray(mappingTextShowTextField)) {
518
+ mappingTextShowTextField.forEach((r: any) => {
519
+ textShowText.push(item[r])
520
+ })
521
+ } else {
522
+ textShowText = item[mappingTextShowTextField]
523
+ }
524
+ }
525
+ return {
526
+ ...item,
527
+ text: item[mappingTextField],
528
+ textShowText,
529
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
530
+ value: item[mappingValueField],
531
+ baseUnitCode: item?.packingUnitList?.find((item: any) => item.baseUnit === true)?.unitCode
532
+ };
533
+ })
534
+ : Array.isArray(res) &&
535
+ res?.map((item: Record<string, any>) => {
536
+ let textShowText = item[mappingTextField]
537
+ if (mappingTextShowTextField) {
538
+ textShowText = []
539
+ if (Array.isArray(mappingTextShowTextField)) {
540
+ mappingTextShowTextField.forEach((r: any) => {
541
+ textShowText.push(item[r])
542
+ })
543
+ } else {
544
+ textShowText = item[mappingTextShowTextField]
545
+ }
546
+ }
547
+ return {
548
+ ...item,
549
+ text: item[mappingTextField],
550
+ textShowText,
551
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
552
+ value: item[mappingValueField],
553
+ baseUnitCode: item?.packingUnitList?.find((item: any) => item.baseUnit === true)?.unitCode
554
+ };
555
+ })
556
+ : [];
557
+ }
558
+ source = Array.isArray(source) ? source : []
559
+ if (type === 1) {
560
+ ctx?.form?.setFieldSource(resultSourceKey, source)
561
+ setItems(source)
562
+ setItemsTotal(Number(res?.total || res?.totalCount || source.length))
563
+ } else {
564
+ setTableData(source)
565
+ setTablePagination({ ...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage)) })
566
+ }
567
+ })
568
+ .catch((err) => { setFetching(false) });
569
+ }
570
+
571
+ const SelectScroll = e => {
572
+ e.persist();
573
+ const { target } = e;
574
+ const totalPage = Math.ceil(itemsTotal / pageSize)
575
+ // 判断是否滑动到底部
576
+ const isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight // >=scrollHeight
577
+ // 判断数据是否还没有加载到了最后一页
578
+ const canPageAdd = scrollPage < totalPage
579
+ if (isTouchGround && canPageAdd) {
580
+ const nextScrollPage = scrollPage + 1;
581
+ setScrollPage(nextScrollPage);
582
+ getData({ currentPage: nextScrollPage }); // 调用api方法
583
+ }
584
+
585
+ //判断是否滑动到顶部
586
+ const isTouchTop = target.scrollTop === 0 // <=0
587
+ // 判断数据是否到第一页
588
+ const canPageJian = scrollPage > 1
589
+ if (isTouchTop && canPageJian) {
590
+ const preScrollPage = scrollPage - 1;
591
+ setScrollPage(preScrollPage);
592
+ getData({ currentPage: preScrollPage }); // 调用api方法
593
+ }
594
+ }
595
+
596
+ useEffect(() => {
597
+ if(businessType == 'sku') {
598
+ Promise.all([
599
+ loadSelectSource(`/items/brand/queryBrandList`, {
600
+ pageSize: 5000,
601
+ currentPage: 1,
602
+ 'ctl-withAuth': true
603
+ }),
604
+ loadSelectSource(`/items/category/queryCategoryTree`, {
605
+ pageSize: 5000,
606
+ currentPage: 1,
607
+ }),
608
+ ]).then((x: any)=>{
609
+ formatSource(x,0, 2, tableSearchForm,['id','name'])
610
+ formatTreeDataSource(x,1, 3, tableSearchForm)
611
+ })
612
+ }
613
+ if(businessType == 'skc') {
614
+ Promise.all([
615
+ loadSelectSource(`/items/item/propertyValue`, {
616
+ pageSize: 5000,
617
+ currentPage: 1,
618
+ 'qp-propertyId-eq': '1467042217951883265'
619
+ }),
620
+ loadSelectSource(`/items/category/queryCategoryTree`, {
621
+ pageSize: 5000,
622
+ currentPage: 1,
623
+ }),
624
+ loadSelectSource(`/items/class/withProperty`, {
625
+ pageSize: 5000,
626
+ currentPage: 1,
627
+ }),
628
+ loadSelectSource(`/items/brand/queryBrandList`, {
629
+ pageSize: 5000,
630
+ currentPage: 1,
631
+ 'ctl-withAuth': true
632
+ }),
633
+ ]).then((x: any)=>{
634
+ formatSource(x,0, 3, tableSearchForm,['value','value'])
635
+ formatTreeDataSource(x,1, 4, tableSearchForm)
636
+ formatSource(x,2, 5, tableSearchForm,['id','name'])
637
+ formatSource(x,3, 6, tableSearchForm,['id','name'])
638
+ })
639
+ }
640
+ }, [businessType])
641
+
642
+ useEffect(() => {
643
+ if (value) {
644
+ setPopValue(value);
645
+ }
646
+ }, [value]);
647
+
648
+ useEffect(() => {
649
+ makeUniqueValue();
650
+ }, [sourceName])
651
+
652
+ const showModal = () => {
653
+ // getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
654
+ setIsModalVisible(true);
655
+ // 回显
656
+ if (value) {
657
+ if (selectMode) {
658
+ setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
659
+ setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
660
+ setIndeterminate(!!value.length && value.length < itemsTotal);
661
+ setCheckedAll(itemsTotal && value.length === itemsTotal);
662
+ // 需清空数据
663
+ if (!value.length) {
664
+ setDoubleArr([])
665
+ }
666
+ } else {
667
+ setSelectedRowKeys(labelInValue ? [value.key] : [value])
668
+ setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value }]);
669
+ }
670
+ }
671
+
672
+ setTimeout(() => {
673
+ document.getElementById("first-query")?.focus()
674
+ }, 50)
675
+ };
676
+
677
+ const handleShowModal = () => {
678
+ if(beforeShowModal) {
679
+ beforeShowModal(popvalue).then(res => {
680
+ showModal()
681
+ }).catch(Error => {
682
+ message.warning(Error)
683
+ })
684
+ } else {
685
+ showModal()
686
+ }
687
+ }
688
+
689
+ const handleSelectOver = (selectedValue: any) => {
690
+ if (selectedValue?.length) {
691
+ formaData(selectedValue);
692
+ // 解决选择最后1页的sku,返回后,不显示名称问题
693
+ const source = _.uniqBy(items.concat(selectedValue), 'value')
694
+ ctx?.form?.setFieldSource(resultSourceKey, source)
695
+ setItems(source)
696
+ }
697
+ }
698
+
699
+ const handleLoading = (isContinue,flag) => {
700
+ isContinue ? setConfirmContinueLoading(flag) : setConfirmLoading(flag);
701
+ }
702
+
703
+ const handleOk = (isContinue) => {
704
+ if(!popvalue.length) {
705
+ message.warning('至少选中一条数据')
706
+ return;
707
+ }
708
+ // handleSelectOver(popvalue)
709
+ if(onSaveCallback) {
710
+ handleLoading(isContinue,true)
711
+ onSaveCallback(popvalue).then(res => {
712
+ if(true) {
713
+ message.success('保存成功')
714
+ deleteSelectRows();
715
+ document.getElementById('first-query')?.focus()
716
+ !isContinue && handleCancel();
717
+ } else {
718
+ }
719
+ handleLoading(isContinue,false)
720
+ }).catch(Error => {
721
+ message.error(Error);
722
+ handleLoading(isContinue,false)
723
+ })
724
+ } else {
725
+ !isContinue && handleCancel();
726
+ }
727
+ };
728
+
729
+ const formaData = (value) => {
730
+ if (labelInValue) {
731
+ const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
732
+ onChange(selectMode ? formatResult : formatResult[0])
733
+ } else {
734
+ const formatResult = selectMode ? value.map((i: any) => i.value) : _.get(value[0], 'value')
735
+ onChange(formatResult)
736
+ }
737
+ };
738
+
739
+ const handleCancel = () => {
740
+ form.resetFields();
741
+ setTableFormParams({});
742
+ setIsModalVisible(false);
743
+ setTableData([])
744
+ // if (selectMode) {
745
+ // run();
746
+ // }
747
+ };
748
+
749
+ const onSearchChange = (e) => {
750
+ setSearchValue(e.target.value);
751
+ run();
752
+ }
753
+
754
+ const onSearchBlur = () => {
755
+ setSearchValue('')
756
+ run();
757
+ }
758
+
759
+ const onSearchTable = () => {
760
+ const params = form.getFieldsValue();
761
+ setTableFormParams(params);
762
+ getData({ ...params, pageSize: tableInitPageSize }, 2)
763
+ if (selectMode) {
764
+ getData(params)
765
+ }
766
+ }
767
+
768
+ const onResetTable = () => {
769
+ form.resetFields();
770
+ setTableFormParams({});
771
+ getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
772
+ }
773
+
774
+ const handleTableChange = (pagination) => {
775
+ getData({ ...tableFormParams, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
776
+ }
777
+
778
+ // 扁平化二维数组的方法
779
+ const mapRows = params => {
780
+ var res = [];
781
+ for (var i = 0; i < params.length; i++) {
782
+ if (Array.isArray(params[i])) {
783
+ // 去重
784
+ res = _.uniqBy(res.concat(mapRows(params[i])), 'value');
785
+ } else {
786
+ res.push(params[i]);
787
+ // 去重
788
+ res = _.uniqBy(res, 'value')
789
+ }
790
+ }
791
+ return res.filter(Boolean); //去掉undefined的情况
792
+ };
793
+
794
+ const onChangeSelectedKeys = (selectKeys, selectRows) => {
795
+ if(selectKeys.length - selectedRowKeys.length > 0) {
796
+ if (selectKeys.length - selectedRowKeys.length === 1) {
797
+ selectRows[selectRows.length -1]['needFocus'] = true;
798
+ } else {
799
+ selectRows[selectedRowKeys.length]['needFocus'] = true;
800
+ }
801
+ }
802
+ if(isAllowRepeatedSelect) {
803
+ const list = popvalue.concat(selectRows).map((i: any) => ({...i, uuid: i.uuid || uuid()}))
804
+ setPopValue(list);
805
+ setSelectedRowKeys([])
806
+ } else {
807
+ setPopValue(selectRows);
808
+ setSelectedRowKeys(selectKeys)
809
+ }
810
+ // setIndeterminate(!!filterRows.length && filterRows.length < tablePagination?.total);
811
+ // setCheckedAll(filterRows.length === tablePagination?.total);
812
+ }
813
+
814
+ // 生成唯一值
815
+ const makeUniqueValue = () => {
816
+ const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
817
+ setUniqueValue(generateUnitKey);
818
+ return generateUnitKey;
819
+ }
820
+
821
+ const rowSelection = {
822
+ type: 'checkbox',
823
+ selectedRowKeys,
824
+ preserveSelectedRowKeys: true,
825
+ onChange: (sks, srs) => {
826
+ onChangeSelectedKeys(sks, srs)
827
+ },
828
+ getCheckboxProps: () => ({
829
+ disabled: selectProps?.disabled || props?.disabled,
830
+ }),
831
+ };
832
+
833
+ const onDoubleClickSelect = (e, record) => {
834
+ if (!selectMode) {
835
+ const srs = [JSON.parse(JSON.stringify(record))]
836
+ const sks = srs.map((i: any) => i.value)
837
+ onChangeSelectedKeys(sks, srs)
838
+ }
839
+ }
840
+
841
+ const themeColor = { color: '#005CFF' }
842
+
843
+ const formItem = (list) => {
844
+ if (isModalVisible && list?.length) {
845
+ return list.map((i: any, index) => {
846
+ if (i?.type === 'select' || i?.field?.type === 'select') {
847
+ return (
848
+ <Form.Item name={i.name} label={i.label} key={i.name}>
849
+ <Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}>
850
+ {i?.initialSource?.length && i?.initialSource.map((m: any) => (
851
+ <Option value={m.value} key={m.value}>{m.text}</Option>
852
+ ))}
853
+ </Select>
854
+ </Form.Item>
855
+ )
856
+ }
857
+
858
+ if (i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
859
+ return (
860
+ <Form.Item name={i.name} label={i.label} key={i.name}>
861
+ <TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}></TreeSelect>
862
+ </Form.Item>
863
+ )
864
+ }
865
+
866
+ if (i?.type === 'BusinessSearchSelect' || i?.field?.type === 'BusinessSearchSelect') {
867
+ return (
868
+ <div>
869
+ <Form.Item name={i.name} label={i.label} key={i.name}>
870
+ <BusinessSearchSelect {...i.field.props} />
871
+ </Form.Item>
872
+ </div>
873
+ )
874
+ }
875
+
876
+ if (i?.type === 'multipleQueryInput' || i?.field?.type === 'multipleQueryInput') {
877
+ return (
878
+ <div>
879
+ <Form.Item name={i.name} label={i.label} key={i.name}>
880
+ <QueryMutipleInput onValueChange={(value) => {
881
+ form.setFieldsValue({
882
+ [i.name]: value
883
+ })
884
+ }} />
885
+ </Form.Item>
886
+ </div>
887
+ );
888
+ }
889
+
890
+ // 默认type是input
891
+ return (
892
+ <Form.Item name={i.name} label={i.label} key={i.name}>
893
+ <Input id={index === 0 ? "first-query" : 'index'} style={{ width: '100%' }} onKeyDown={(e) => {
894
+ if (e.keyCode === 13) {
895
+ onSearchTable()
896
+ }
897
+ }} placeholder='请输入' allowClear maxLength={100} {...i?.field?.props} />
898
+ </Form.Item>
899
+ )
900
+ })
901
+ } else {
902
+ return null
903
+ }
904
+ }
905
+
906
+ const maxTagPlaceholder = (selectedValues) => {
907
+ const onClose = (e: any, item: any) => {
908
+ e.preventDefault();
909
+ const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value) : JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
910
+ onChange(newValue);
911
+ }
912
+ return (
913
+ <Tooltip title={selectedValues.map((i: any) => (
914
+ <Tag
915
+ closable={true}
916
+ onClose={(e) => onClose(e, i)}
917
+ style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
918
+ >
919
+ {i.label}
920
+ </Tag>
921
+ ))}>
922
+ {`+ ${selectedValues?.length}`}
923
+ </Tooltip>
924
+ )
925
+ }
926
+
927
+ const deleteSelectRows = () => {
928
+ setPopValue([])
929
+ setSelectedRowKeys([])
930
+ }
931
+
932
+ const deleteRecord = (record) => {
933
+ if(isAllowRepeatedSelect) {
934
+ setPopValue(popvalue.filter(item => item.uuid !== record.uuid))
935
+ setSelectedRowKeys([])
936
+ } else {
937
+ setPopValue(popvalue.filter(item => item.skuCode !== record.skuCode))
938
+ setSelectedRowKeys([...selectedRowKeys.filter(item => item !== record.skuCode)])
939
+ }
940
+ }
941
+
942
+ let inputIndex = 0;
943
+ let selectIndex = 0;
944
+
945
+ useEffect(() => {
946
+ setInitialShowColumn(codeSelected,selectColumns,(res) => {
947
+ setShowColumnsCallback(res)
948
+ })
949
+ },[selectColumns])
950
+ useEffect(() => {
951
+ setInitialShowColumn(codeToChoose,tableColumns,(res) => {
952
+ setShowToChooseColumnsCallback(res)
953
+ })
954
+ },[tableColumns])
955
+
956
+ const handleResize = (arr,index: any, callback) => (_: any, { size }: any) => {
957
+ let newColumns = arr.map((col: any) => ({ ...col }));
958
+ const handleIndex = (arr: any, indexArr: any) => {
959
+ let i = indexArr.shift();
960
+ if (indexArr.length > 0) {
961
+ handleIndex(arr[i].children, indexArr);
962
+ } else {
963
+ arr[i] = {
964
+ ...arr[i],
965
+ width: size.width,
966
+ };
967
+ handleAntdColumnsSpecialParams(arr[i]);
968
+ }
969
+ };
970
+ handleIndex(newColumns, [...index]);
971
+ callback(newColumns)
972
+ };
973
+
974
+ const setShowColumnsCallback = (newColumns: Array<any>) => {
975
+ setShowColumns([...newColumns])
976
+ }
977
+ const setShowToChooseColumnsCallback = (newColumns: Array<any>) => {
978
+ setShowToChooseColumns([...newColumns])
979
+ }
980
+
981
+ const handleColumns = (arr: any, indexArr: any[], callback: any) => {
982
+ arr.forEach((item: any, index: any) => {
983
+ let indexArrInside = [...indexArr, index].filter((i: any) => i || i === 0)
984
+ if (noEmptyArray(item.children)) {
985
+ handleColumns(item.children, indexArrInside);
986
+ } else {
987
+ item.width = item.width || getItemDefaultWidth(item);
988
+ item.onHeaderCell = (column: any) => ({
989
+ ...item,
990
+ width:
991
+ typeof column.width === 'number'
992
+ ? column.width
993
+ : parseInt(column.width.replace('px', '')),
994
+ onResize: handleResize(arr,indexArrInside, callback),
995
+ });
996
+ }
997
+ })
998
+ };
999
+ let showToChooseCol = showToChooseColumns.map((item: any) => {
1000
+ handleAntdColumnsSpecialParams(item);
1001
+ return ({ ...item })
1002
+ })
1003
+ handleColumns(showToChooseCol, [],(res)=> setShowToChooseColumnsCallback(res));
1004
+ let showSelectedCol = showColumns.map((item: any) => {
1005
+ handleAntdColumnsSpecialParams(item);
1006
+ return ({ ...item })
1007
+ })
1008
+ handleColumns(showSelectedCol, [],(res)=> setShowColumnsCallback(res));
1009
+
1010
+ const selectLength = isAllowRepeatedSelect ? (popvalue?.length || 0) : (selectedRowKeys?.length || 0)
1011
+ return (
1012
+ <div className={'add_select'}>
1013
+ <div className="add_select_show" id={`add_select_div_${uniqueValue}`}>
1014
+ <Button onClick={handleShowModal} {...realButtonProps}>
1015
+ {buttonText}
1016
+ </Button>
1017
+ </div>
1018
+ {needModalTable && isModalVisible && (
1019
+ <Modal
1020
+ width='1200px'
1021
+ style={{ top: 20 }}
1022
+ bodyStyle={{ padding: '0px' }}
1023
+ // title={modalTableProps?.modalTableTitle}
1024
+ visible={isModalVisible}
1025
+ closable={false}
1026
+ onCancel={handleCancel}
1027
+ footer={selectMode ? [
1028
+ <Button key="back" onClick={handleCancel}>
1029
+ 取消
1030
+ </Button>,
1031
+ <Button
1032
+ key="save-and-continue"
1033
+ style={{color: '#005CFF', borderColor: '#005CFF'}}
1034
+ onClick={() => {handleOk(true)}}
1035
+ loading={confirmContinueLoading}
1036
+ disabled={!tableData.length || (selectProps?.disabled || props?.disabled)}
1037
+ >
1038
+ 保存并继续
1039
+ </Button>,
1040
+ <Button
1041
+ key="submit"
1042
+ type="primary"
1043
+ onClick={() => {handleOk(false)}}
1044
+ loading={confirmLoading}
1045
+ disabled={!tableData.length || (selectProps?.disabled || props?.disabled)}
1046
+ >
1047
+ 确定
1048
+ </Button>,
1049
+ ] : null}
1050
+ >
1051
+ <div>
1052
+ <div className='add_select_header'>
1053
+ {modalTableProps?.modalTableTitle}
1054
+ <span><span>*</span> &nbsp;快捷键:【Tab】-跳格切换;【Shift+←、→】-当前行左、右移动;【 ↑、↓】-当前列上、下移动;【ctrl+Enter】-保存并继续;【ctrl+Delete】-删除当前行;</span>
1055
+ <span className='add_select_header_close'><CloseCircleOutlined style={{fontSize: '20px'}} onClick={handleCancel} /></span>
1056
+ </div>
1057
+ <div className={'add_select_wrapper'}>
1058
+ <div className={caretLeftFlag ? 'add_select_wrapper_left' : 'add_select_wrapper_left1'}>
1059
+ <div className={'select_list_columns'}>
1060
+ <div className={'select_list_columns_formItems'}>
1061
+ <Form form={form} layout='vertical' key='modalForm'>
1062
+ {formItem(tableSearchForm)}
1063
+ </Form>
1064
+ </div>
1065
+ </div>
1066
+ <div className={'select_list_searchButton'}>
1067
+ <Button key='reset' className={'select_list_button_space'} onClick={onResetTable}>重置</Button>
1068
+ <Button key='search' type="primary" onClick={onSearchTable}>查询</Button>
1069
+ </div>
1070
+ </div>
1071
+ <div className={caretLeftFlag ? 'add_select_wrapper_right' : 'add_select_wrapper_right1'}>
1072
+ <div>
1073
+ <div className={'select_list_selectTips'}>
1074
+ <div style={{ marginLeft: 8 }}>搜索结果共&nbsp;<span style={themeColor}>{tablePagination?.total || 0}</span>&nbsp;项{selectMode ? <span>, 本次已选&nbsp;<span style={themeColor}>{selectLength}</span>&nbsp;项</span> : ''}</div>
1075
+ <div>
1076
+ <span style={{ marginRight: 8 }}>
1077
+ <TableColumnSetting
1078
+ setShowColumns={setShowToChooseColumnsCallback}
1079
+ showColumns={showToChooseColumns}
1080
+ datasource={tableColumns || []}
1081
+ tableCode={codeToChoose}
1082
+ settingImgAttribute={{ width: 20, style: { marginTop: -2 } }}
1083
+ />
1084
+ </span>
1085
+ </div>
1086
+ </div>
1087
+ <Table
1088
+ size='small'
1089
+ rowSelection={rowSelection}
1090
+ columns={showToChooseCol}
1091
+ dataSource={tableData}
1092
+ pagination={tablePagination}
1093
+ loading={fetching}
1094
+ onChange={handleTableChange}
1095
+ rowKey={mappingValueField}
1096
+ rowClassName={'row-class'}
1097
+ scroll={{ y: 500 }}
1098
+ components={{
1099
+ header: {
1100
+ cell: ResizeableTitle,
1101
+ },
1102
+ }}
1103
+ />
1104
+ </div>
1105
+ </div>
1106
+ {/* <div>
1107
+ <Table
1108
+ size='small'
1109
+ columns={modalTableProps?.tableColumns}
1110
+ dataSource={mapRows(doubleArr)}
1111
+ rowKey={mappingValueField}
1112
+ scroll={{ x: modalTableProps.overScrollX || 'max-content', y: modalTableProps.overScrollY || null }}
1113
+ onRow={record => {
1114
+ return {
1115
+ onDoubleClick: event => onDoubleClickSelect(event, record),
1116
+ };
1117
+ }}
1118
+ />
1119
+ </div> */}
1120
+ </div>
1121
+ <div className={'add_select_wrapper_select'}>
1122
+ <div className={'select_list_selectTips'}>
1123
+ <div style={{ marginLeft: 8 }}><span>本次已选&nbsp;<span style={themeColor}>{selectLength}</span>&nbsp;项</span></div>
1124
+ <div style={{ display: 'flex' }}>
1125
+ <span style={{ marginRight: 8 }}>
1126
+ <TableColumnSetting
1127
+ setShowColumns={setShowColumnsCallback}
1128
+ showColumns={showColumns}
1129
+ datasource={selectColumns || []}
1130
+ tableCode={codeSelected}
1131
+ settingImgAttribute={{ width: 20, style: { marginTop: -2 } }}
1132
+ />
1133
+ </span>
1134
+ <div style={{ marginRight: 8 }}><span onClick={deleteSelectRows} style={{ ...themeColor, cursor: 'pointer' }}>清空所选商品</span></div>
1135
+ </div>
1136
+ </div>
1137
+ <Table
1138
+ size='small'
1139
+ columns={showSelectedCol}
1140
+ dataSource={popvalue}
1141
+ pagination={false}
1142
+ // onChange={handleTableChange}
1143
+ rowKey={selectRowKey}
1144
+ rowClassName={'row-class'}
1145
+ scroll={{ y: 500 }}
1146
+ onRow={record => {
1147
+ return {
1148
+ onDoubleClick: event => onDoubleClickSelect(event, record),
1149
+ };
1150
+ }}
1151
+ components={{
1152
+ header: {
1153
+ cell: ResizeableTitle,
1154
+ },
1155
+ }}
1156
+ />
1157
+ </div>
1158
+ </div>
1159
+ </Modal>
1160
+ )}
1161
+ </div>
1162
+ );
1163
+ };
1164
+
1165
+ export default AddSelect;