@bit-sun/business-component 2.4.19 → 2.4.21

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 (197) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +5 -5
  3. package/.gitlab-ci.yml +179 -179
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +74 -74
  7. package/README.md +27 -27
  8. package/dist/index.esm.js +10 -6
  9. package/dist/index.js +10 -6
  10. package/docs/index.md +21 -21
  11. package/lib/assets/drag.svg +17 -17
  12. package/lib/assets/exportFail.svg +37 -37
  13. package/lib/assets/exportProcessing.svg +28 -28
  14. package/lib/assets/exportSuccess.svg +34 -34
  15. package/lib/assets/label_icon_bottom.svg +25 -25
  16. package/lib/assets/upExport.svg +22 -22
  17. package/package.json +79 -79
  18. package/src/assets/32.svg +27 -27
  19. package/src/assets/addIcon.svg +17 -17
  20. package/src/assets/allfunc.svg +27 -27
  21. package/src/assets/arrowRight.svg +24 -24
  22. package/src/assets/btn-delete.svg +29 -29
  23. package/src/assets/btn-edit.svg +19 -19
  24. package/src/assets/btn-more.svg +17 -17
  25. package/src/assets/btn-submit.svg +19 -19
  26. package/src/assets/caidan.svg +11 -11
  27. package/src/assets/close.svg +26 -26
  28. package/src/assets/drag.svg +17 -17
  29. package/src/assets/exportFail.svg +37 -37
  30. package/src/assets/exportProcessing.svg +28 -28
  31. package/src/assets/exportSuccess.svg +34 -34
  32. package/src/assets/fixed-left-active.svg +11 -11
  33. package/src/assets/fixed-left.svg +15 -15
  34. package/src/assets/fixed-right-active.svg +11 -11
  35. package/src/assets/fixed-right.svg +15 -15
  36. package/src/assets/guanbi.svg +15 -15
  37. package/src/assets/icon-quanping.svg +15 -15
  38. package/src/assets/icon-shezhi.svg +17 -17
  39. package/src/assets/label_icon_bottom.svg +25 -25
  40. package/src/assets/list-no-img.svg +21 -21
  41. package/src/assets/morentouxiang-32.svg +23 -23
  42. package/src/assets/scanning.svg +24 -24
  43. package/src/assets/upExport.svg +22 -22
  44. package/src/common/ENUM.ts +41 -41
  45. package/src/components/Business/AddSelectBusiness/index.md +162 -162
  46. package/src/components/Business/AddSelectBusiness/index.tsx +1061 -1061
  47. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  48. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  49. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  50. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  51. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  52. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  53. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  54. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  55. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  56. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  58. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  59. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  60. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  61. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  62. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  63. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
  64. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  65. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  66. package/src/components/Business/BsLayouts/index.less +79 -79
  67. package/src/components/Business/BsLayouts/index.tsx +1484 -1484
  68. package/src/components/Business/BsLayouts/service.ts +10 -10
  69. package/src/components/Business/BsLayouts/utils.tsx +203 -203
  70. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -566
  71. package/src/components/Business/BsSulaQueryTable/index.less +221 -221
  72. package/src/components/Business/BsSulaQueryTable/index.tsx +558 -558
  73. package/src/components/Business/BsSulaQueryTable/setting.tsx +854 -854
  74. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  75. package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -690
  76. package/src/components/Business/CommodityEntry/index.md +70 -70
  77. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  78. package/src/components/Business/CommonAlert/index.tsx +23 -23
  79. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  80. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  81. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  82. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  83. package/src/components/Business/DetailPageWrapper/index.tsx +315 -315
  84. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  85. package/src/components/Business/HomePageWrapper/index.less +33 -33
  86. package/src/components/Business/HomePageWrapper/index.md +45 -45
  87. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  88. package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
  89. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
  90. package/src/components/Business/JsonQueryTable/components/Formula.tsx +206 -206
  91. package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
  92. package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
  93. package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
  94. package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
  95. package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
  96. package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
  97. package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
  98. package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
  99. package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
  100. package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
  101. package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
  102. package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
  103. package/src/components/Business/JsonQueryTable/function.ts +62 -62
  104. package/src/components/Business/JsonQueryTable/index.less +16 -16
  105. package/src/components/Business/JsonQueryTable/index.md +328 -328
  106. package/src/components/Business/JsonQueryTable/index.tsx +537 -537
  107. package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
  108. package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
  109. package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
  110. package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
  111. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
  112. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
  113. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
  114. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
  115. package/src/components/Business/JsonQueryTable/static.ts +450 -450
  116. package/src/components/Business/SearchSelect/BusinessUtils.ts +2057 -2057
  117. package/src/components/Business/SearchSelect/common.ts +134 -134
  118. package/src/components/Business/SearchSelect/index.md +1444 -1444
  119. package/src/components/Business/SearchSelect/index.tsx +55 -55
  120. package/src/components/Business/SearchSelect/utils.ts +101 -101
  121. package/src/components/Business/StateFlow/index.less +130 -130
  122. package/src/components/Business/StateFlow/index.md +60 -60
  123. package/src/components/Business/StateFlow/index.tsx +29 -29
  124. package/src/components/Business/TreeSearchSelect/index.md +185 -185
  125. package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
  126. package/src/components/Business/TreeSearchSelect/utils.ts +104 -104
  127. package/src/components/Business/columnSettingTable/columnSetting.tsx +766 -766
  128. package/src/components/Business/columnSettingTable/index.less +247 -247
  129. package/src/components/Business/columnSettingTable/index.md +357 -357
  130. package/src/components/Business/columnSettingTable/index.tsx +235 -234
  131. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +243 -242
  132. package/src/components/Business/columnSettingTable/utils.tsx +71 -71
  133. package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
  134. package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
  135. package/src/components/Business/moreTreeTable/index.less +99 -99
  136. package/src/components/Business/moreTreeTable/index.md +448 -448
  137. package/src/components/Business/moreTreeTable/index.tsx +387 -387
  138. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  139. package/src/components/Functional/AddSelect/helps.ts +80 -80
  140. package/src/components/Functional/AddSelect/index.less +367 -367
  141. package/src/components/Functional/AddSelect/index.md +155 -155
  142. package/src/components/Functional/AddSelect/index.tsx +1171 -1171
  143. package/src/components/Functional/BillEntry/index.less +371 -371
  144. package/src/components/Functional/BillEntry/index.md +39 -39
  145. package/src/components/Functional/BillEntry/index.tsx +773 -773
  146. package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
  147. package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
  148. package/src/components/Functional/BsAntdSula/index.ts +2 -2
  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 +696 -696
  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 +688 -688
  155. package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
  156. package/src/components/Functional/EllipsisTooltip/index.js +36 -36
  157. package/src/components/Functional/EllipsisTooltip/index.md +30 -30
  158. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  159. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +60 -60
  160. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  161. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  162. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  163. package/src/components/Functional/SearchSelect/index.less +115 -115
  164. package/src/components/Functional/SearchSelect/index.md +141 -141
  165. package/src/components/Functional/SearchSelect/index.tsx +896 -896
  166. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  167. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  168. package/src/components/Functional/TreeSearchSelect/index.tsx +204 -204
  169. package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
  170. package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
  171. package/src/components/Solution/RuleComponent/index.d.ts +29 -29
  172. package/src/components/Solution/RuleComponent/index.js +2073 -2073
  173. package/src/components/Solution/RuleComponent/index.less +230 -230
  174. package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
  175. package/src/components/Solution/RuleComponent/ruleFiled.js +2281 -2281
  176. package/src/components/Solution/RuleComponent/services.ts +13 -13
  177. package/src/components/Solution/RuleComponent/util.js +143 -143
  178. package/src/index.ts +38 -38
  179. package/src/plugin/TableColumnSetting/index.less +247 -247
  180. package/src/plugin/TableColumnSetting/index.md +50 -50
  181. package/src/plugin/TableColumnSetting/index.tsx +725 -725
  182. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  183. package/src/styles/bsDefault.less +1912 -1912
  184. package/src/utils/CheckOneUser/index.md +39 -39
  185. package/src/utils/CheckOneUser/index.ts +51 -51
  186. package/src/utils/CustomLoginInfo.ts +55 -55
  187. package/src/utils/LocalstorageUtils.ts +95 -95
  188. package/src/utils/TableUtils.tsx +18 -18
  189. package/src/utils/checkUtils.ts +39 -39
  190. package/src/utils/enumConfig.ts +11 -11
  191. package/src/utils/getFormMode.js +12 -12
  192. package/src/utils/index.ts +4 -4
  193. package/src/utils/requestUtils.ts +166 -166
  194. package/src/utils/serialize.js +7 -7
  195. package/src/utils/utils.ts +195 -195
  196. package/tsconfig.json +29 -29
  197. package/typings.d.ts +4 -4
@@ -1,1061 +1,1061 @@
1
- /*
2
- * @Description:
3
- * @Author: rodchen
4
- * @Date: 2022-05-07 15:17:28
5
- * @LastEditTime: 2022-05-08 21:01:21
6
- * @LastEditors: rodchen
7
- */
8
- import React, { useState, useEffect } from 'react';
9
- import { Tooltip, Select, message } from 'antd';
10
- import axios from 'axios';
11
- import { AddSelect } from '../../../index';
12
- import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
13
- import { getSkuImg } from '@/utils/TableUtils';
14
- import { judgeIsRequestError } from '@/utils/requestUtils';
15
- import { getEmployeeId } from '@/utils/LocalstorageUtils';
16
- // import { getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
17
-
18
- function handleSelectColumn(c: any, parentProps: any) {
19
- let result = c;
20
- const showColumns = parentProps?.showColumns || [];
21
- const exceptColumns = parentProps?.exceptColumns || [];
22
- const coverColumns = parentProps?.coverColumns || [];
23
- const additionColumns = parentProps?.additionColumns || [];
24
- // 仅展示内容
25
- if(showColumns?.length) {
26
- result = result.filter((i: any) => showColumns.includes(i.dataIndex))
27
- }
28
- // 过滤不需要展示内容
29
- if(exceptColumns?.length) {
30
- result = result.filter((i: any) => !exceptColumns.includes(i.dataIndex))
31
- }
32
- // 追加(最好不用这个,当组件不固定时候会有影响)
33
- if(additionColumns?.length) {
34
- additionColumns.forEach((i: any) => {
35
- result.splice(i.position,0,i.column)
36
- })
37
- }
38
- // 覆盖内容
39
- if(coverColumns?.length) {
40
- result = coverColumns;
41
- }
42
- return result
43
- }
44
- function handleSearchForm(c: any, parentProps: any) {
45
- let result = c;
46
- const showTableSearchForm = parentProps?.showTableSearchForm || [];
47
- const exceptTableSearchForm= parentProps?.exceptTableSearchForm|| [];
48
- const coverTableSearchForm = parentProps?.coverTableSearchForm || [];
49
- // 仅展示内容
50
- if(showTableSearchForm?.length) {
51
- result = result.filter((i: any) => showTableSearchForm.includes(i.name))
52
- }
53
- // 过滤不需要展示内容
54
- if(exceptTableSearchForm?.length) {
55
- result = result.filter((i: any) => !exceptTableSearchForm.includes(i.name))
56
- }
57
- // 覆盖内容
58
- if(coverTableSearchForm?.length) {
59
- result = coverTableSearchForm;
60
- }
61
- return result;
62
- }
63
- function handleFormSearchSourceLoad(c: any, parentProps: any) {
64
- let result = c;
65
- const showTableFormSearchSourceLoad = parentProps?.showTableFormSearchSourceLoad || [];
66
- const exceptTableFormSearchSourceLoad= parentProps?.exceptTableFormSearchSourceLoad|| [];
67
- const coverTableFormSearchSourceLoad = parentProps?.coverTableFormSearchSourceLoad || [];
68
- const noNeedTableFormSearchSourceLoad = parentProps?.noNeedTableFormSearchSourceLoad
69
- // 仅展示内容
70
- if(showTableFormSearchSourceLoad?.length) {
71
- result = result.filter((i: any) => showTableFormSearchSourceLoad.includes(i.url))
72
- }
73
- // 过滤不需要展示内容
74
- if(exceptTableFormSearchSourceLoad?.length) {
75
- result = result.filter((i: any) => !exceptTableFormSearchSourceLoad.includes(i.url))
76
- }
77
- // 覆盖内容
78
- if(coverTableFormSearchSourceLoad?.length) {
79
- result = coverTableFormSearchSourceLoad;
80
- }
81
- // 不需要默认请求
82
- if(noNeedTableFormSearchSourceLoad) {
83
- result = [];
84
- }
85
- return result;
86
- }
87
-
88
- export const AddSkuSelect = (parProps: any) => {
89
- const selectProps = {
90
- mode: 'multiple',
91
- }
92
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
93
- const isNoUseItemBarcode = parProps?.noUseItemEancode !== undefined ? parProps?.noUseItemEancode : true; // 默认不加商品条码,兼容老项目
94
- //注⚠️:自定义过表头的请记得传tableCodeList参数
95
- const initialSelectColumn = [
96
- {
97
- title: 'SKU编码',
98
- width: 150,
99
- dataIndex: 'skuCode',
100
- },
101
- ...(isNoUseItemBarcode ? [] : [
102
- {
103
- title: '商品条码',
104
- width: 100,
105
- ellipsis: {
106
- showTitle: false,
107
- },
108
- dataIndex: 'itemEancode',
109
- render: (text: any) => (
110
- <Tooltip placement="topLeft" title={text}>
111
- {text}
112
- </Tooltip>
113
- ),
114
- }
115
- ]),
116
- {
117
- title: 'SKU名称',
118
- width: 200,
119
- ellipsis: {
120
- showTitle: false,
121
- },
122
- render: (text: any) => (
123
- <Tooltip placement="topLeft" title={text}>
124
- {text}
125
- </Tooltip>
126
- ),
127
- dataIndex: 'name',
128
- },
129
- {
130
- title: '图片',
131
- dataIndex: 'itemUrl',
132
- width: 200,
133
- ellipsis: {
134
- showTitle: false,
135
- },
136
- render: (text: any,record: any) => (
137
- <Tooltip placement="topLeft" title={text}>
138
- {tableColumnsImage(getSkuImg(record),{ width: 28, height: 28 })}
139
- </Tooltip>
140
- ),
141
- },
142
- {
143
- title: '数量',
144
- width: 100,
145
- isInputItem: true,
146
- dataIndex: 'count',
147
- },
148
- {
149
- title: '单位',
150
- dataIndex: 'selectUnitCode',
151
- width: 80,
152
- ellipsis: {
153
- showTitle: false,
154
- },
155
- render: (text: any, record: any) => {
156
- if (record?.packingUnitList?.length) {
157
- const basePackUnit = record?.packingUnitList[0]
158
- record.selectUnitCode = basePackUnit.unitCode
159
- return basePackUnit.name || basePackUnit.unitCode
160
- }
161
-
162
-
163
- return <></>
164
- },
165
- },
166
- {
167
- title: '所属SPU编码',
168
- width: 150,
169
- ellipsis: {
170
- showTitle: false,
171
- },
172
- dataIndex: 'itemCode',
173
- render: (text: any) => (
174
- <Tooltip placement="topLeft" title={text}>
175
- {text}
176
- </Tooltip>
177
- ),
178
- },
179
- {
180
- title: '规格',
181
- width: 200,
182
- ellipsis: {
183
- showTitle: false,
184
- },
185
- render: (text: any) => (
186
- <Tooltip placement="topLeft" title={text}>
187
- {text}
188
- </Tooltip>
189
- ),
190
- dataIndex: 'propertyNameAndValue',
191
- }
192
- ]
193
- const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps);
194
- const initialTableColumn = [
195
- {
196
- title: 'SKU编码',
197
- width: 150,
198
- dataIndex: 'skuCode',
199
- },
200
- {
201
- title: 'SKU名称',
202
- width: 200,
203
- ellipsis: {
204
- showTitle: false,
205
- },
206
- render: (text: any) => (
207
- <Tooltip placement="topLeft" title={text}>
208
- {text}
209
- </Tooltip>
210
- ),
211
- dataIndex: 'name',
212
- },
213
- {
214
- title: '图片',
215
- dataIndex: 'itemUrl',
216
- width: 200,
217
- ellipsis: {
218
- showTitle: false,
219
- },
220
- render: (text: any,record: any) => (
221
- <Tooltip placement="topLeft" title={text}>
222
- {tableColumnsImage(getSkuImg(record),{ width: 20, height: 20 })}
223
- </Tooltip>
224
- ),
225
- },
226
- ...(isNoUseItemBarcode ? []: [
227
- {
228
- title: '商品条码',
229
- width: 100,
230
- ellipsis: {
231
- showTitle: false,
232
- },
233
- dataIndex: 'itemEancode',
234
- render: (text: any) => (
235
- <Tooltip placement="topLeft" title={text}>
236
- {text}
237
- </Tooltip>
238
- ),
239
- }
240
- ]),
241
- {
242
- title: '所属SPU名称',
243
- width: 100,
244
- ellipsis: {
245
- showTitle: false,
246
- },
247
- dataIndex: 'itemName',
248
- render: (text: any) => (
249
- <Tooltip placement="topLeft" title={text}>
250
- {text}
251
- </Tooltip>
252
- ),
253
- },
254
- {
255
- title: '所属SPU编码',
256
- width: 100,
257
- ellipsis: {
258
- showTitle: false,
259
- },
260
- dataIndex: 'itemCode',
261
- render: (text: any) => (
262
- <Tooltip placement="topLeft" title={text}>
263
- {text}
264
- </Tooltip>
265
- ),
266
- },
267
- {
268
- title: '外部编码',
269
- width: 100,
270
- ellipsis: {
271
- showTitle: false,
272
- },
273
- render: (text: any) => (
274
- <Tooltip placement="topLeft" title={text}>
275
- {text}
276
- </Tooltip>
277
- ),
278
- dataIndex: 'externalCode',
279
- },
280
- {
281
- title: '规格',
282
- width: 100,
283
- ellipsis: {
284
- showTitle: false,
285
- },
286
- render: (text: any) => (
287
- <Tooltip placement="topLeft" title={text}>
288
- {text}
289
- </Tooltip>
290
- ),
291
- dataIndex: 'propertyNameAndValue',
292
- },
293
- {
294
- title: '类目',
295
- width: 100,
296
- ellipsis: {
297
- showTitle: false,
298
- },
299
- render: (text: any) => (
300
- <Tooltip placement="topLeft" title={text}>
301
- {text}
302
- </Tooltip>
303
- ),
304
- dataIndex: 'categoryName',
305
- },
306
- {
307
- title: '品类',
308
- width: 100,
309
- ellipsis: {
310
- showTitle: false,
311
- },
312
- render: (text: any) => (
313
- <Tooltip placement="topLeft" title={text}>
314
- {text}
315
- </Tooltip>
316
- ),
317
- dataIndex: 'className',
318
- },
319
- {
320
- title: '品牌',
321
- width: 100,
322
- ellipsis: {
323
- showTitle: false,
324
- },
325
- render: (text: any) => (
326
- <Tooltip placement="topLeft" title={text}>
327
- {text}
328
- </Tooltip>
329
- ),
330
- dataIndex: 'brandName',
331
- },
332
- ]
333
- const mTpTableColumn = handleSelectColumn(initialTableColumn, parProps);
334
- const initialTableSearchForm = [
335
- {
336
- name: 'qp-skuCode-like', label: 'SKU编码'
337
- },
338
- { name: 'qp-skuName-like', label: 'SKU名称' },
339
- ...(isNoUseItemBarcode ? []: [
340
- { name: 'qp-code-in', label: '商品条码', field: {
341
- type: 'multipleQueryInput',
342
- props: {
343
- ...(parProps.requestConfig?.itemEancodeValueRequestConfig || {}),
344
- },
345
- }}
346
- ]),
347
- { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
348
- type: 'select',
349
- props: {
350
- mode: 'multiple',
351
- notFoundContent: '暂无数据',
352
- allowClear: true,
353
- showSearch: true,
354
- showArrow: true,
355
- maxTagCount: 1,
356
- optionFilterProp: 'children',
357
- filterOption: (input: string, option: { props: { children: string } }) =>
358
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
359
- },
360
- } },
361
- { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
362
- type: 'treeSelect',
363
- props: {
364
- treeData: [],
365
- treeCheckable: true,
366
- showSearch: true,
367
- allowClear: true,
368
- showArrow: true,
369
- treeNodeFilterProp: 'title',
370
- treeDefaultExpandAll: true,
371
- maxTagCount: 1,
372
- placeholder: '请选择',
373
- style: {
374
- width: '100%',
375
- },
376
- dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
377
- },
378
- } },
379
- ...(parProps?.addTableSearchForm||[])
380
- ]
381
- const mTpTableSearchForm = handleSearchForm(initialTableSearchForm, parProps);
382
- const initialPromiseLoadList = [
383
- {
384
- url: `/items/brand/queryBrandList`,
385
- params: {
386
- pageSize: 5000,
387
- currentPage: 1,
388
- 'ctl-withAuth': true
389
- },
390
- resType: 'list',
391
- resPosition: isNoUseItemBarcode ? 2 : 3,
392
- resKeyValue: ['id','name']
393
- },
394
- {
395
- url: `/items/category/queryCategoryTree`,
396
- params: {
397
- pageSize: 5000,
398
- currentPage: 1,
399
- },
400
- resType: 'treeList',
401
- resPosition: isNoUseItemBarcode ? 3 : 4
402
- },
403
- ]
404
- const mTpPromiseLoadList = handleFormSearchSourceLoad(initialPromiseLoadList, parProps);
405
- const props = {
406
- buttonText: parProps.buttonText || '新增',
407
- buttonProps: parProps.buttonProps || {},
408
- tableCodeList: parProps.tableCodeList || [],
409
- value,
410
- // labelInValue: true, // 非必填 默认为false
411
- requestConfig: {
412
- url: `/items/sku/pager/v2`,
413
- filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
414
- otherParams: {
415
- 'qp-combination-eq': false,
416
- 'qp-approveStatus-eq': 1,
417
- 'qp-status-eq': 1,
418
- // 'useOrgSign': getCurrentTargetBgId(), // 根据品牌、账号授权的组织+商品授权使用组织做权限过滤 这个交给业务使用的地方去做,传addOtherParams:{useOrgSign:单据中所选组织}
419
- ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
420
- }, // 默认参数
421
- mappingTextField: 'name',
422
- mappingValueField: 'skuCode',
423
- ...parProps.requestConfig
424
- },
425
- selectProps,
426
- onChange: (value: any) => {
427
- console.log(value)
428
- setValue(value)
429
- },
430
- beforeShowModal: parProps?.beforeShowModal,
431
- onSaveCallback: parProps.onSaveCallback,
432
- businessType: 'sku',
433
- isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
434
- };
435
- const modalTableProps = {
436
- modalTableTitle: '选择商品',
437
- tableSearchForm: mTpTableSearchForm,
438
- tableColumns: mTpTableColumn,
439
- selectColumn: mTpSelectColumn,
440
- promiseLoadList: mTpPromiseLoadList,
441
- }
442
-
443
- return (
444
- <div>
445
- <AddSelect
446
- {...props}
447
- modalTableProps={modalTableProps}
448
- />
449
- </div>
450
- );
451
- };
452
-
453
- export const AddSkcSelect = (parProps: any) => {
454
- const selectProps = {
455
- mode: 'multiple',
456
- }
457
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
458
- const [propertyList, setPropertyList] = useState([]);
459
-
460
- useEffect(() => {
461
- // type: 1 尺码组; 2 配码组
462
- axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
463
- result = result.data;
464
- if (judgeIsRequestError(result)) {
465
- message.error(result.msg);
466
- return;
467
- }
468
- const data = result.data || [];
469
- setPropertyList(data)
470
- }).catch((err) => {});
471
- },[])
472
-
473
- //注⚠️:自定义过表头的请记得传tableCodeList参数
474
- const initialSelectColumn = [
475
- {
476
- title: 'SKC编码',
477
- width: 150,
478
- dataIndex: 'code',
479
- },
480
- {
481
- title: 'SKC名称',
482
- width: 200,
483
- ellipsis: {
484
- showTitle: false,
485
- },
486
- render: (text: any) => (
487
- <Tooltip placement="topLeft" title={text}>
488
- {text}
489
- </Tooltip>
490
- ),
491
- dataIndex: 'name',
492
- },
493
- {
494
- title: '颜色',
495
- width: 200,
496
- ellipsis: {
497
- showTitle: false,
498
- },
499
- render: (text: any) => (
500
- <Tooltip placement="topLeft" title={text}>
501
- {text}
502
- </Tooltip>
503
- ),
504
- dataIndex: 'colorName',
505
- },
506
- {
507
- title: '配码',
508
- dataIndex: 'selectPropertyGroupCode',
509
- width: 160,
510
- isSelectItem: true,
511
- dataSource: propertyList,
512
- },
513
- {
514
- title: '数量',
515
- width: 100,
516
- isInputItem: true,
517
- dataIndex: 'count',
518
- },
519
- ]
520
- const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps)
521
- const initialPromiseLoadList = [
522
- {
523
- url: `/items/item/propertyValue/sizeBySkcConfig`,
524
- params: {
525
- pageSize: 10000,
526
- currentPage: 1,
527
- type: 2, // 类型:1尺码;2颜色
528
- },
529
- resType: 'list',
530
- resPosition: 3,
531
- resKeyValue: ['value','value']
532
- },
533
- {
534
- url: `/items/category/queryCategoryTree`,
535
- params: {
536
- pageSize: 5000,
537
- currentPage: 1,
538
- },
539
- resType: 'treeList',
540
- resPosition: 4,
541
- },
542
- {
543
- url: `/items/class/withProperty`,
544
- params: {
545
- pageSize: 5000,
546
- currentPage: 1,
547
- },
548
- resType: 'list',
549
- resPosition: 5,
550
- resKeyValue: ['id','name']
551
- },
552
- {
553
- url: `/items/brand/queryBrandList`,
554
- params: {
555
- pageSize: 5000,
556
- currentPage: 1,
557
- 'ctl-withAuth': true
558
- },
559
- resType: 'list',
560
- resPosition: 6,
561
- resKeyValue: ['id','name']
562
- },
563
- ]
564
- const props = {
565
- buttonText: parProps.buttonText || '新增',
566
- buttonProps: parProps.buttonProps || {},
567
- tableCodeList: parProps.tableCodeList || ['skcSelect-tableOptionsToChoosePartCode','skcSelect-tableSelectedItemPartCode'],
568
- value,
569
- // labelInValue: true, // 非必填 默认为false
570
- requestConfig: {
571
- url: `/items/skc/skcSelect`,
572
- filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
573
- otherParams: {
574
- 'qp-skcStatus-eq': 1,
575
- ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
576
- }, // 默认参数
577
- mappingTextField: 'name',
578
- mappingValueField: 'code',
579
- ...parProps.requestConfig
580
- },
581
- selectProps,
582
- onChange: (value: any) => {
583
- console.log(value)
584
- setValue(value)
585
- },
586
- beforeShowModal: parProps?.beforeShowModal,
587
- onSaveCallback: parProps.onSaveCallback,
588
- businessType: 'skc',
589
- isAllowRepeatedSelect: parProps?.isAllowRepeatedSelect!==undefined ? !!parProps?.isAllowRepeatedSelect : true, // 默认开启一行选多次
590
- };
591
- const modalTableProps = {
592
- modalTableTitle: '选择商品',
593
- tableSearchForm: [
594
- { name: 'qp-code-like', label: 'SKC编码' },
595
- { name: 'qp-skcName-like', label: 'SKC名称' },
596
- { name: 'qp-itemName-like', label: '商品名称' },
597
- { name: 'qp-colorName-in', type: 'select', label: '颜色', field: {
598
- type: 'select',
599
- props: {
600
- mode: 'multiple',
601
- notFoundContent: '暂无数据',
602
- allowClear: true,
603
- showSearch: true,
604
- showArrow: true,
605
- maxTagCount: 1,
606
- optionFilterProp: 'children',
607
- filterOption: (input: string, option: { props: { children: string } }) =>
608
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
609
- },
610
- } },
611
- { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
612
- type: 'treeSelect',
613
- props: {
614
- treeData: [],
615
- treeCheckable: true,
616
- showSearch: true,
617
- allowClear: true,
618
- showArrow: true,
619
- treeNodeFilterProp: 'title',
620
- treeDefaultExpandAll: true,
621
- maxTagCount: 1,
622
- placeholder: '请选择',
623
- style: {
624
- width: '100%',
625
- },
626
- dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
627
- },
628
- } },
629
- { name: 'qp-classId-in', type: 'select', label: '品类', field: {
630
- type: 'select',
631
- props: {
632
- mode: 'multiple',
633
- notFoundContent: '暂无数据',
634
- allowClear: true,
635
- showSearch: true,
636
- showArrow: true,
637
- maxTagCount: 1,
638
- optionFilterProp: 'children',
639
- filterOption: (input: string, option: { props: { children: string } }) =>
640
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
641
- },
642
- } },
643
- { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
644
- type: 'select',
645
- props: {
646
- mode: 'multiple',
647
- notFoundContent: '暂无数据',
648
- allowClear: true,
649
- showSearch: true,
650
- showArrow: true,
651
- maxTagCount: 1,
652
- optionFilterProp: 'children',
653
- filterOption: (input: string, option: { props: { children: string } }) =>
654
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
655
- },
656
- } },
657
- ],
658
- tableColumns: [
659
- {
660
- title: 'SKC编码',
661
- width: 150,
662
- dataIndex: 'code',
663
- },
664
- {
665
- title: 'SKC名称',
666
- width: 200,
667
- ellipsis: {
668
- showTitle: false,
669
- },
670
- render: (text: any) => (
671
- <Tooltip placement="topLeft" title={text}>
672
- {text}
673
- </Tooltip>
674
- ),
675
- dataIndex: 'name',
676
- },
677
- {
678
- title: '商品名称',
679
- width: 100,
680
- ellipsis: {
681
- showTitle: false,
682
- },
683
- dataIndex: 'itemName',
684
- render: (text: any) => (
685
- <Tooltip placement="topLeft" title={text}>
686
- {text}
687
- </Tooltip>
688
- ),
689
- },
690
- {
691
- title: '颜色',
692
- width: 100,
693
- ellipsis: {
694
- showTitle: false,
695
- },
696
- render: (text: any) => (
697
- <Tooltip placement="topLeft" title={text}>
698
- {text}
699
- </Tooltip>
700
- ),
701
- dataIndex: 'colorName',
702
- },
703
- {
704
- title: '类目',
705
- width: 100,
706
- ellipsis: {
707
- showTitle: false,
708
- },
709
- render: (text: any) => (
710
- <Tooltip placement="topLeft" title={text}>
711
- {text}
712
- </Tooltip>
713
- ),
714
- dataIndex: 'categoryName',
715
- },
716
- {
717
- title: '品类',
718
- width: 100,
719
- ellipsis: {
720
- showTitle: false,
721
- },
722
- render: (text: any) => (
723
- <Tooltip placement="topLeft" title={text}>
724
- {text}
725
- </Tooltip>
726
- ),
727
- dataIndex: 'className',
728
- },
729
- {
730
- title: '品牌',
731
- width: 100,
732
- ellipsis: {
733
- showTitle: false,
734
- },
735
- render: (text: any) => (
736
- <Tooltip placement="topLeft" title={text}>
737
- {text}
738
- </Tooltip>
739
- ),
740
- dataIndex: 'brandName',
741
- },
742
- ],
743
- selectColumn: mTpSelectColumn,
744
- promiseLoadList: initialPromiseLoadList
745
- }
746
-
747
- return (
748
- <div>
749
- <AddSelect
750
- {...props}
751
- modalTableProps={modalTableProps}
752
- />
753
- </div>
754
- );
755
- };
756
-
757
- export const AddSpuSelect = (parProps: any) => {
758
- const selectProps = {
759
- mode: 'multiple',
760
- }
761
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
762
- const [propertyList, setPropertyList] = useState([]);
763
-
764
- useEffect(() => {
765
- if(parProps?.isSingleColor) {
766
- // type: 1 尺码组; 2 配码组
767
- axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
768
- result = result.data;
769
- if (judgeIsRequestError(result)) {
770
- message.error(result.msg);
771
- return;
772
- }
773
- const data = result.data || [];
774
- setPropertyList(data)
775
- }).catch((err) => {});
776
- }
777
- },[])
778
-
779
- //注⚠️:自定义过表头的请记得传tableCodeList参数
780
- const initialSelectColumn = [
781
- {
782
- title: '商品编码',
783
- width: 150,
784
- dataIndex: 'itemCode',
785
- },
786
- {
787
- title: '商品名称',
788
- width: 200,
789
- ellipsis: {
790
- showTitle: false,
791
- },
792
- render: (text: any) => (
793
- <Tooltip placement="topLeft" title={text}>
794
- {text}
795
- </Tooltip>
796
- ),
797
- dataIndex: 'name',
798
- },
799
- {
800
- title: '颜色',
801
- dataIndex: 'colorName',
802
- width: 200,
803
- isSelectItem: true,
804
- dataSourceCode: 'colorValues',
805
- dataSourceMapping: ['value', 'value']
806
- },
807
- {
808
- title: '配码',
809
- dataIndex: 'selectPropertyGroupCode',
810
- width: 160,
811
- isSelectItem: true,
812
- dataSource: propertyList,
813
- filterDataSourceCode: 'matchingCodes',
814
- },
815
- {
816
- title: '数量',
817
- width: 100,
818
- isInputItem: true,
819
- dataIndex: 'count',
820
- },
821
- {
822
- title: '所属组织',
823
- dataIndex: 'ownOrgSignName',
824
- },
825
- {
826
- title: '品牌',
827
- dataIndex: 'brandName',
828
- },
829
- {
830
- title: '类目',
831
- dataIndex: 'categoryText',
832
- },
833
- {
834
- title: '品类',
835
- dataIndex: 'className',
836
- },
837
- ]
838
- const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps)
839
- const initialPromiseLoadList = [
840
- {
841
- url: `/user/orgViewNode/listNoPage`,
842
- params: {
843
- 'qp-employeeId-eq': getEmployeeId(),
844
- 'qp-orgViewCode-eq': 'business-organizational-view',
845
- 'ctl-withDefaultOrg': true,
846
- },
847
- resType: 'list',
848
- resPosition: 2,
849
- resKeyValue: ['targetId','name']
850
- },
851
- {
852
- url: `/items/brand/queryBrandList`,
853
- params: {
854
- pageSize: 5000,
855
- currentPage: 1,
856
- 'ctl-withAuth': true
857
- },
858
- resType: 'list',
859
- resPosition: 3,
860
- resKeyValue: ['id','name']
861
- },
862
- {
863
- url: `/items/category/queryCategoryTree`,
864
- params: {
865
- pageSize: 5000,
866
- currentPage: 1,
867
- },
868
- resType: 'treeList',
869
- resPosition: 4,
870
- },
871
- {
872
- url: `/items/class/withProperty`,
873
- params: {
874
- pageSize: 5000,
875
- currentPage: 1,
876
- },
877
- resType: 'list',
878
- resPosition: 5,
879
- resKeyValue: ['id','name']
880
- },
881
- ]
882
- const props = {
883
- buttonText: parProps.buttonText || '新增',
884
- buttonProps: parProps.buttonProps || {},
885
- tableCodeList: parProps.tableCodeList || [],
886
- value,
887
- // labelInValue: true, // 非必填 默认为false
888
- requestConfig: {
889
- url: `/items/item`,
890
- filter: 'qp-itemCode,name-orGroup,like', // 过滤参数
891
- otherParams: {
892
- 'qp-approveStatus-eq': 1, // 审核状态(0.待审批;1.审批通过;2.驳回;3.审批未通过)
893
- 'qp-status-eq': 1,
894
- sorter: 'desc-id',
895
- ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
896
- }, // 默认参数
897
- mappingTextField: 'name',
898
- mappingValueField: 'itemCode',
899
- ...parProps.requestConfig
900
- },
901
- selectProps,
902
- onChange: (value: any) => {
903
- console.log(value)
904
- setValue(value)
905
- },
906
- beforeShowModal: parProps?.beforeShowModal,
907
- onSaveCallback: parProps.onSaveCallback,
908
- businessType: 'spu',
909
- isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
910
- };
911
- const modalTableProps = {
912
- modalTableTitle: '选择商品',
913
- tableSearchForm: [
914
- { name: 'qp-itemCode-like', label: '商品编码' },
915
- { name: 'qp-name-like', label: '商品名称' },
916
- { name: 'qp-ownOrgSign-in', type: 'select', label: '所属组织', field: {
917
- type: 'select',
918
- props: {
919
- mode: 'multiple',
920
- notFoundContent: '暂无数据',
921
- allowClear: true,
922
- showSearch: true,
923
- showArrow: true,
924
- maxTagCount: 1,
925
- optionFilterProp: 'children',
926
- filterOption: (input: string, option: { props: { children: string } }) =>
927
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
928
- },
929
- } },
930
- { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
931
- type: 'select',
932
- props: {
933
- mode: 'multiple',
934
- notFoundContent: '暂无数据',
935
- allowClear: true,
936
- showSearch: true,
937
- showArrow: true,
938
- maxTagCount: 1,
939
- optionFilterProp: 'children',
940
- filterOption: (input: string, option: { props: { children: string } }) =>
941
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
942
- },
943
- } },
944
- { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
945
- type: 'treeSelect',
946
- props: {
947
- treeData: [],
948
- treeCheckable: true,
949
- showSearch: true,
950
- allowClear: true,
951
- showArrow: true,
952
- treeNodeFilterProp: 'title',
953
- treeDefaultExpandAll: true,
954
- maxTagCount: 1,
955
- placeholder: '请选择',
956
- style: {
957
- width: '100%',
958
- },
959
- dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
960
- },
961
- } },
962
- { name: 'qp-classId-in', type: 'select', label: '品类', field: {
963
- type: 'select',
964
- props: {
965
- mode: 'multiple',
966
- notFoundContent: '暂无数据',
967
- allowClear: true,
968
- showSearch: true,
969
- showArrow: true,
970
- maxTagCount: 1,
971
- optionFilterProp: 'children',
972
- filterOption: (input: string, option: { props: { children: string } }) =>
973
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
974
- },
975
- } },
976
- ],
977
- tableColumns: [
978
- {
979
- title: '商品编码',
980
- width: 150,
981
- dataIndex: 'itemCode',
982
- },
983
- {
984
- title: '商品名称',
985
- width: 200,
986
- ellipsis: {
987
- showTitle: false,
988
- },
989
- render: (text: any) => (
990
- <Tooltip placement="topLeft" title={text}>
991
- {text}
992
- </Tooltip>
993
- ),
994
- dataIndex: 'name',
995
- },
996
- {
997
- title: '所属组织',
998
- width: 100,
999
- ellipsis: {
1000
- showTitle: false,
1001
- },
1002
- render: (text: any) => (
1003
- <Tooltip placement="topLeft" title={text}>
1004
- {text}
1005
- </Tooltip>
1006
- ),
1007
- dataIndex: 'ownOrgSignName',
1008
- },
1009
- {
1010
- title: '品牌',
1011
- width: 100,
1012
- ellipsis: {
1013
- showTitle: false,
1014
- },
1015
- render: (text: any) => (
1016
- <Tooltip placement="topLeft" title={text}>
1017
- {text}
1018
- </Tooltip>
1019
- ),
1020
- dataIndex: 'brandName',
1021
- },
1022
- {
1023
- title: '类目',
1024
- width: 100,
1025
- ellipsis: {
1026
- showTitle: false,
1027
- },
1028
- render: (text: any) => (
1029
- <Tooltip placement="topLeft" title={text}>
1030
- {text}
1031
- </Tooltip>
1032
- ),
1033
- dataIndex: 'categoryName',
1034
- },
1035
- {
1036
- title: '品类',
1037
- width: 100,
1038
- ellipsis: {
1039
- showTitle: false,
1040
- },
1041
- render: (text: any) => (
1042
- <Tooltip placement="topLeft" title={text}>
1043
- {text}
1044
- </Tooltip>
1045
- ),
1046
- dataIndex: 'className',
1047
- },
1048
- ],
1049
- selectColumn: mTpSelectColumn,
1050
- promiseLoadList: initialPromiseLoadList
1051
- }
1052
-
1053
- return (
1054
- <div>
1055
- <AddSelect
1056
- {...props}
1057
- modalTableProps={modalTableProps}
1058
- />
1059
- </div>
1060
- );
1061
- };
1
+ /*
2
+ * @Description:
3
+ * @Author: rodchen
4
+ * @Date: 2022-05-07 15:17:28
5
+ * @LastEditTime: 2022-05-08 21:01:21
6
+ * @LastEditors: rodchen
7
+ */
8
+ import React, { useState, useEffect } from 'react';
9
+ import { Tooltip, Select, message } from 'antd';
10
+ import axios from 'axios';
11
+ import { AddSelect } from '../../../index';
12
+ import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
13
+ import { getSkuImg } from '@/utils/TableUtils';
14
+ import { judgeIsRequestError } from '@/utils/requestUtils';
15
+ import { getEmployeeId } from '@/utils/LocalstorageUtils';
16
+ // import { getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
17
+
18
+ function handleSelectColumn(c: any, parentProps: any) {
19
+ let result = c;
20
+ const showColumns = parentProps?.showColumns || [];
21
+ const exceptColumns = parentProps?.exceptColumns || [];
22
+ const coverColumns = parentProps?.coverColumns || [];
23
+ const additionColumns = parentProps?.additionColumns || [];
24
+ // 仅展示内容
25
+ if(showColumns?.length) {
26
+ result = result.filter((i: any) => showColumns.includes(i.dataIndex))
27
+ }
28
+ // 过滤不需要展示内容
29
+ if(exceptColumns?.length) {
30
+ result = result.filter((i: any) => !exceptColumns.includes(i.dataIndex))
31
+ }
32
+ // 追加(最好不用这个,当组件不固定时候会有影响)
33
+ if(additionColumns?.length) {
34
+ additionColumns.forEach((i: any) => {
35
+ result.splice(i.position,0,i.column)
36
+ })
37
+ }
38
+ // 覆盖内容
39
+ if(coverColumns?.length) {
40
+ result = coverColumns;
41
+ }
42
+ return result
43
+ }
44
+ function handleSearchForm(c: any, parentProps: any) {
45
+ let result = c;
46
+ const showTableSearchForm = parentProps?.showTableSearchForm || [];
47
+ const exceptTableSearchForm= parentProps?.exceptTableSearchForm|| [];
48
+ const coverTableSearchForm = parentProps?.coverTableSearchForm || [];
49
+ // 仅展示内容
50
+ if(showTableSearchForm?.length) {
51
+ result = result.filter((i: any) => showTableSearchForm.includes(i.name))
52
+ }
53
+ // 过滤不需要展示内容
54
+ if(exceptTableSearchForm?.length) {
55
+ result = result.filter((i: any) => !exceptTableSearchForm.includes(i.name))
56
+ }
57
+ // 覆盖内容
58
+ if(coverTableSearchForm?.length) {
59
+ result = coverTableSearchForm;
60
+ }
61
+ return result;
62
+ }
63
+ function handleFormSearchSourceLoad(c: any, parentProps: any) {
64
+ let result = c;
65
+ const showTableFormSearchSourceLoad = parentProps?.showTableFormSearchSourceLoad || [];
66
+ const exceptTableFormSearchSourceLoad= parentProps?.exceptTableFormSearchSourceLoad|| [];
67
+ const coverTableFormSearchSourceLoad = parentProps?.coverTableFormSearchSourceLoad || [];
68
+ const noNeedTableFormSearchSourceLoad = parentProps?.noNeedTableFormSearchSourceLoad
69
+ // 仅展示内容
70
+ if(showTableFormSearchSourceLoad?.length) {
71
+ result = result.filter((i: any) => showTableFormSearchSourceLoad.includes(i.url))
72
+ }
73
+ // 过滤不需要展示内容
74
+ if(exceptTableFormSearchSourceLoad?.length) {
75
+ result = result.filter((i: any) => !exceptTableFormSearchSourceLoad.includes(i.url))
76
+ }
77
+ // 覆盖内容
78
+ if(coverTableFormSearchSourceLoad?.length) {
79
+ result = coverTableFormSearchSourceLoad;
80
+ }
81
+ // 不需要默认请求
82
+ if(noNeedTableFormSearchSourceLoad) {
83
+ result = [];
84
+ }
85
+ return result;
86
+ }
87
+
88
+ export const AddSkuSelect = (parProps: any) => {
89
+ const selectProps = {
90
+ mode: 'multiple',
91
+ }
92
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
93
+ const isNoUseItemBarcode = parProps?.noUseItemEancode !== undefined ? parProps?.noUseItemEancode : true; // 默认不加商品条码,兼容老项目
94
+ //注⚠️:自定义过表头的请记得传tableCodeList参数
95
+ const initialSelectColumn = [
96
+ {
97
+ title: 'SKU编码',
98
+ width: 150,
99
+ dataIndex: 'skuCode',
100
+ },
101
+ ...(isNoUseItemBarcode ? [] : [
102
+ {
103
+ title: '商品条码',
104
+ width: 100,
105
+ ellipsis: {
106
+ showTitle: false,
107
+ },
108
+ dataIndex: 'itemEancode',
109
+ render: (text: any) => (
110
+ <Tooltip placement="topLeft" title={text}>
111
+ {text}
112
+ </Tooltip>
113
+ ),
114
+ }
115
+ ]),
116
+ {
117
+ title: 'SKU名称',
118
+ width: 200,
119
+ ellipsis: {
120
+ showTitle: false,
121
+ },
122
+ render: (text: any) => (
123
+ <Tooltip placement="topLeft" title={text}>
124
+ {text}
125
+ </Tooltip>
126
+ ),
127
+ dataIndex: 'name',
128
+ },
129
+ {
130
+ title: '图片',
131
+ dataIndex: 'itemUrl',
132
+ width: 200,
133
+ ellipsis: {
134
+ showTitle: false,
135
+ },
136
+ render: (text: any,record: any) => (
137
+ <Tooltip placement="topLeft" title={text}>
138
+ {tableColumnsImage(getSkuImg(record),{ width: 28, height: 28 })}
139
+ </Tooltip>
140
+ ),
141
+ },
142
+ {
143
+ title: '数量',
144
+ width: 100,
145
+ isInputItem: true,
146
+ dataIndex: 'count',
147
+ },
148
+ {
149
+ title: '单位',
150
+ dataIndex: 'selectUnitCode',
151
+ width: 80,
152
+ ellipsis: {
153
+ showTitle: false,
154
+ },
155
+ render: (text: any, record: any) => {
156
+ if (record?.packingUnitList?.length) {
157
+ const basePackUnit = record?.packingUnitList[0]
158
+ record.selectUnitCode = basePackUnit.unitCode
159
+ return basePackUnit.name || basePackUnit.unitCode
160
+ }
161
+
162
+
163
+ return <></>
164
+ },
165
+ },
166
+ {
167
+ title: '所属SPU编码',
168
+ width: 150,
169
+ ellipsis: {
170
+ showTitle: false,
171
+ },
172
+ dataIndex: 'itemCode',
173
+ render: (text: any) => (
174
+ <Tooltip placement="topLeft" title={text}>
175
+ {text}
176
+ </Tooltip>
177
+ ),
178
+ },
179
+ {
180
+ title: '规格',
181
+ width: 200,
182
+ ellipsis: {
183
+ showTitle: false,
184
+ },
185
+ render: (text: any) => (
186
+ <Tooltip placement="topLeft" title={text}>
187
+ {text}
188
+ </Tooltip>
189
+ ),
190
+ dataIndex: 'propertyNameAndValue',
191
+ }
192
+ ]
193
+ const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps);
194
+ const initialTableColumn = [
195
+ {
196
+ title: 'SKU编码',
197
+ width: 150,
198
+ dataIndex: 'skuCode',
199
+ },
200
+ {
201
+ title: 'SKU名称',
202
+ width: 200,
203
+ ellipsis: {
204
+ showTitle: false,
205
+ },
206
+ render: (text: any) => (
207
+ <Tooltip placement="topLeft" title={text}>
208
+ {text}
209
+ </Tooltip>
210
+ ),
211
+ dataIndex: 'name',
212
+ },
213
+ {
214
+ title: '图片',
215
+ dataIndex: 'itemUrl',
216
+ width: 200,
217
+ ellipsis: {
218
+ showTitle: false,
219
+ },
220
+ render: (text: any,record: any) => (
221
+ <Tooltip placement="topLeft" title={text}>
222
+ {tableColumnsImage(getSkuImg(record),{ width: 20, height: 20 })}
223
+ </Tooltip>
224
+ ),
225
+ },
226
+ ...(isNoUseItemBarcode ? []: [
227
+ {
228
+ title: '商品条码',
229
+ width: 100,
230
+ ellipsis: {
231
+ showTitle: false,
232
+ },
233
+ dataIndex: 'itemEancode',
234
+ render: (text: any) => (
235
+ <Tooltip placement="topLeft" title={text}>
236
+ {text}
237
+ </Tooltip>
238
+ ),
239
+ }
240
+ ]),
241
+ {
242
+ title: '所属SPU名称',
243
+ width: 100,
244
+ ellipsis: {
245
+ showTitle: false,
246
+ },
247
+ dataIndex: 'itemName',
248
+ render: (text: any) => (
249
+ <Tooltip placement="topLeft" title={text}>
250
+ {text}
251
+ </Tooltip>
252
+ ),
253
+ },
254
+ {
255
+ title: '所属SPU编码',
256
+ width: 100,
257
+ ellipsis: {
258
+ showTitle: false,
259
+ },
260
+ dataIndex: 'itemCode',
261
+ render: (text: any) => (
262
+ <Tooltip placement="topLeft" title={text}>
263
+ {text}
264
+ </Tooltip>
265
+ ),
266
+ },
267
+ {
268
+ title: '外部编码',
269
+ width: 100,
270
+ ellipsis: {
271
+ showTitle: false,
272
+ },
273
+ render: (text: any) => (
274
+ <Tooltip placement="topLeft" title={text}>
275
+ {text}
276
+ </Tooltip>
277
+ ),
278
+ dataIndex: 'externalCode',
279
+ },
280
+ {
281
+ title: '规格',
282
+ width: 100,
283
+ ellipsis: {
284
+ showTitle: false,
285
+ },
286
+ render: (text: any) => (
287
+ <Tooltip placement="topLeft" title={text}>
288
+ {text}
289
+ </Tooltip>
290
+ ),
291
+ dataIndex: 'propertyNameAndValue',
292
+ },
293
+ {
294
+ title: '类目',
295
+ width: 100,
296
+ ellipsis: {
297
+ showTitle: false,
298
+ },
299
+ render: (text: any) => (
300
+ <Tooltip placement="topLeft" title={text}>
301
+ {text}
302
+ </Tooltip>
303
+ ),
304
+ dataIndex: 'categoryName',
305
+ },
306
+ {
307
+ title: '品类',
308
+ width: 100,
309
+ ellipsis: {
310
+ showTitle: false,
311
+ },
312
+ render: (text: any) => (
313
+ <Tooltip placement="topLeft" title={text}>
314
+ {text}
315
+ </Tooltip>
316
+ ),
317
+ dataIndex: 'className',
318
+ },
319
+ {
320
+ title: '品牌',
321
+ width: 100,
322
+ ellipsis: {
323
+ showTitle: false,
324
+ },
325
+ render: (text: any) => (
326
+ <Tooltip placement="topLeft" title={text}>
327
+ {text}
328
+ </Tooltip>
329
+ ),
330
+ dataIndex: 'brandName',
331
+ },
332
+ ]
333
+ const mTpTableColumn = handleSelectColumn(initialTableColumn, parProps);
334
+ const initialTableSearchForm = [
335
+ {
336
+ name: 'qp-skuCode-like', label: 'SKU编码'
337
+ },
338
+ { name: 'qp-skuName-like', label: 'SKU名称' },
339
+ ...(isNoUseItemBarcode ? []: [
340
+ { name: 'qp-code-in', label: '商品条码', field: {
341
+ type: 'multipleQueryInput',
342
+ props: {
343
+ ...(parProps.requestConfig?.itemEancodeValueRequestConfig || {}),
344
+ },
345
+ }}
346
+ ]),
347
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
348
+ type: 'select',
349
+ props: {
350
+ mode: 'multiple',
351
+ notFoundContent: '暂无数据',
352
+ allowClear: true,
353
+ showSearch: true,
354
+ showArrow: true,
355
+ maxTagCount: 1,
356
+ optionFilterProp: 'children',
357
+ filterOption: (input: string, option: { props: { children: string } }) =>
358
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
359
+ },
360
+ } },
361
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
362
+ type: 'treeSelect',
363
+ props: {
364
+ treeData: [],
365
+ treeCheckable: true,
366
+ showSearch: true,
367
+ allowClear: true,
368
+ showArrow: true,
369
+ treeNodeFilterProp: 'title',
370
+ treeDefaultExpandAll: true,
371
+ maxTagCount: 1,
372
+ placeholder: '请选择',
373
+ style: {
374
+ width: '100%',
375
+ },
376
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
377
+ },
378
+ } },
379
+ ...(parProps?.addTableSearchForm||[])
380
+ ]
381
+ const mTpTableSearchForm = handleSearchForm(initialTableSearchForm, parProps);
382
+ const initialPromiseLoadList = [
383
+ {
384
+ url: `/items/brand/queryBrandList`,
385
+ params: {
386
+ pageSize: 5000,
387
+ currentPage: 1,
388
+ 'ctl-withAuth': true
389
+ },
390
+ resType: 'list',
391
+ resPosition: isNoUseItemBarcode ? 2 : 3,
392
+ resKeyValue: ['id','name']
393
+ },
394
+ {
395
+ url: `/items/category/queryCategoryTree`,
396
+ params: {
397
+ pageSize: 5000,
398
+ currentPage: 1,
399
+ },
400
+ resType: 'treeList',
401
+ resPosition: isNoUseItemBarcode ? 3 : 4
402
+ },
403
+ ]
404
+ const mTpPromiseLoadList = handleFormSearchSourceLoad(initialPromiseLoadList, parProps);
405
+ const props = {
406
+ buttonText: parProps.buttonText || '新增',
407
+ buttonProps: parProps.buttonProps || {},
408
+ tableCodeList: parProps.tableCodeList || [],
409
+ value,
410
+ // labelInValue: true, // 非必填 默认为false
411
+ requestConfig: {
412
+ url: `/items/sku/pager/v2`,
413
+ filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
414
+ otherParams: {
415
+ 'qp-combination-eq': false,
416
+ 'qp-approveStatus-eq': 1,
417
+ 'qp-status-eq': 1,
418
+ // 'useOrgSign': getCurrentTargetBgId(), // 根据品牌、账号授权的组织+商品授权使用组织做权限过滤 这个交给业务使用的地方去做,传addOtherParams:{useOrgSign:单据中所选组织}
419
+ ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
420
+ }, // 默认参数
421
+ mappingTextField: 'name',
422
+ mappingValueField: 'skuCode',
423
+ ...parProps.requestConfig
424
+ },
425
+ selectProps,
426
+ onChange: (value: any) => {
427
+ console.log(value)
428
+ setValue(value)
429
+ },
430
+ beforeShowModal: parProps?.beforeShowModal,
431
+ onSaveCallback: parProps.onSaveCallback,
432
+ businessType: 'sku',
433
+ isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
434
+ };
435
+ const modalTableProps = {
436
+ modalTableTitle: '选择商品',
437
+ tableSearchForm: mTpTableSearchForm,
438
+ tableColumns: mTpTableColumn,
439
+ selectColumn: mTpSelectColumn,
440
+ promiseLoadList: mTpPromiseLoadList,
441
+ }
442
+
443
+ return (
444
+ <div>
445
+ <AddSelect
446
+ {...props}
447
+ modalTableProps={modalTableProps}
448
+ />
449
+ </div>
450
+ );
451
+ };
452
+
453
+ export const AddSkcSelect = (parProps: any) => {
454
+ const selectProps = {
455
+ mode: 'multiple',
456
+ }
457
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
458
+ const [propertyList, setPropertyList] = useState([]);
459
+
460
+ useEffect(() => {
461
+ // type: 1 尺码组; 2 配码组
462
+ axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
463
+ result = result.data;
464
+ if (judgeIsRequestError(result)) {
465
+ message.error(result.msg);
466
+ return;
467
+ }
468
+ const data = result.data || [];
469
+ setPropertyList(data)
470
+ }).catch((err) => {});
471
+ },[])
472
+
473
+ //注⚠️:自定义过表头的请记得传tableCodeList参数
474
+ const initialSelectColumn = [
475
+ {
476
+ title: 'SKC编码',
477
+ width: 150,
478
+ dataIndex: 'code',
479
+ },
480
+ {
481
+ title: 'SKC名称',
482
+ width: 200,
483
+ ellipsis: {
484
+ showTitle: false,
485
+ },
486
+ render: (text: any) => (
487
+ <Tooltip placement="topLeft" title={text}>
488
+ {text}
489
+ </Tooltip>
490
+ ),
491
+ dataIndex: 'name',
492
+ },
493
+ {
494
+ title: '颜色',
495
+ width: 200,
496
+ ellipsis: {
497
+ showTitle: false,
498
+ },
499
+ render: (text: any) => (
500
+ <Tooltip placement="topLeft" title={text}>
501
+ {text}
502
+ </Tooltip>
503
+ ),
504
+ dataIndex: 'colorName',
505
+ },
506
+ {
507
+ title: '配码',
508
+ dataIndex: 'selectPropertyGroupCode',
509
+ width: 160,
510
+ isSelectItem: true,
511
+ dataSource: propertyList,
512
+ },
513
+ {
514
+ title: '数量',
515
+ width: 100,
516
+ isInputItem: true,
517
+ dataIndex: 'count',
518
+ },
519
+ ]
520
+ const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps)
521
+ const initialPromiseLoadList = [
522
+ {
523
+ url: `/items/item/propertyValue/sizeBySkcConfig`,
524
+ params: {
525
+ pageSize: 10000,
526
+ currentPage: 1,
527
+ type: 2, // 类型:1尺码;2颜色
528
+ },
529
+ resType: 'list',
530
+ resPosition: 3,
531
+ resKeyValue: ['value','value']
532
+ },
533
+ {
534
+ url: `/items/category/queryCategoryTree`,
535
+ params: {
536
+ pageSize: 5000,
537
+ currentPage: 1,
538
+ },
539
+ resType: 'treeList',
540
+ resPosition: 4,
541
+ },
542
+ {
543
+ url: `/items/class/withProperty`,
544
+ params: {
545
+ pageSize: 5000,
546
+ currentPage: 1,
547
+ },
548
+ resType: 'list',
549
+ resPosition: 5,
550
+ resKeyValue: ['id','name']
551
+ },
552
+ {
553
+ url: `/items/brand/queryBrandList`,
554
+ params: {
555
+ pageSize: 5000,
556
+ currentPage: 1,
557
+ 'ctl-withAuth': true
558
+ },
559
+ resType: 'list',
560
+ resPosition: 6,
561
+ resKeyValue: ['id','name']
562
+ },
563
+ ]
564
+ const props = {
565
+ buttonText: parProps.buttonText || '新增',
566
+ buttonProps: parProps.buttonProps || {},
567
+ tableCodeList: parProps.tableCodeList || ['skcSelect-tableOptionsToChoosePartCode','skcSelect-tableSelectedItemPartCode'],
568
+ value,
569
+ // labelInValue: true, // 非必填 默认为false
570
+ requestConfig: {
571
+ url: `/items/skc/skcSelect`,
572
+ filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
573
+ otherParams: {
574
+ 'qp-skcStatus-eq': 1,
575
+ ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
576
+ }, // 默认参数
577
+ mappingTextField: 'name',
578
+ mappingValueField: 'code',
579
+ ...parProps.requestConfig
580
+ },
581
+ selectProps,
582
+ onChange: (value: any) => {
583
+ console.log(value)
584
+ setValue(value)
585
+ },
586
+ beforeShowModal: parProps?.beforeShowModal,
587
+ onSaveCallback: parProps.onSaveCallback,
588
+ businessType: 'skc',
589
+ isAllowRepeatedSelect: parProps?.isAllowRepeatedSelect!==undefined ? !!parProps?.isAllowRepeatedSelect : true, // 默认开启一行选多次
590
+ };
591
+ const modalTableProps = {
592
+ modalTableTitle: '选择商品',
593
+ tableSearchForm: [
594
+ { name: 'qp-code-like', label: 'SKC编码' },
595
+ { name: 'qp-skcName-like', label: 'SKC名称' },
596
+ { name: 'qp-itemName-like', label: '商品名称' },
597
+ { name: 'qp-colorName-in', type: 'select', label: '颜色', field: {
598
+ type: 'select',
599
+ props: {
600
+ mode: 'multiple',
601
+ notFoundContent: '暂无数据',
602
+ allowClear: true,
603
+ showSearch: true,
604
+ showArrow: true,
605
+ maxTagCount: 1,
606
+ optionFilterProp: 'children',
607
+ filterOption: (input: string, option: { props: { children: string } }) =>
608
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
609
+ },
610
+ } },
611
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
612
+ type: 'treeSelect',
613
+ props: {
614
+ treeData: [],
615
+ treeCheckable: true,
616
+ showSearch: true,
617
+ allowClear: true,
618
+ showArrow: true,
619
+ treeNodeFilterProp: 'title',
620
+ treeDefaultExpandAll: true,
621
+ maxTagCount: 1,
622
+ placeholder: '请选择',
623
+ style: {
624
+ width: '100%',
625
+ },
626
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
627
+ },
628
+ } },
629
+ { name: 'qp-classId-in', type: 'select', label: '品类', field: {
630
+ type: 'select',
631
+ props: {
632
+ mode: 'multiple',
633
+ notFoundContent: '暂无数据',
634
+ allowClear: true,
635
+ showSearch: true,
636
+ showArrow: true,
637
+ maxTagCount: 1,
638
+ optionFilterProp: 'children',
639
+ filterOption: (input: string, option: { props: { children: string } }) =>
640
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
641
+ },
642
+ } },
643
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
644
+ type: 'select',
645
+ props: {
646
+ mode: 'multiple',
647
+ notFoundContent: '暂无数据',
648
+ allowClear: true,
649
+ showSearch: true,
650
+ showArrow: true,
651
+ maxTagCount: 1,
652
+ optionFilterProp: 'children',
653
+ filterOption: (input: string, option: { props: { children: string } }) =>
654
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
655
+ },
656
+ } },
657
+ ],
658
+ tableColumns: [
659
+ {
660
+ title: 'SKC编码',
661
+ width: 150,
662
+ dataIndex: 'code',
663
+ },
664
+ {
665
+ title: 'SKC名称',
666
+ width: 200,
667
+ ellipsis: {
668
+ showTitle: false,
669
+ },
670
+ render: (text: any) => (
671
+ <Tooltip placement="topLeft" title={text}>
672
+ {text}
673
+ </Tooltip>
674
+ ),
675
+ dataIndex: 'name',
676
+ },
677
+ {
678
+ title: '商品名称',
679
+ width: 100,
680
+ ellipsis: {
681
+ showTitle: false,
682
+ },
683
+ dataIndex: 'itemName',
684
+ render: (text: any) => (
685
+ <Tooltip placement="topLeft" title={text}>
686
+ {text}
687
+ </Tooltip>
688
+ ),
689
+ },
690
+ {
691
+ title: '颜色',
692
+ width: 100,
693
+ ellipsis: {
694
+ showTitle: false,
695
+ },
696
+ render: (text: any) => (
697
+ <Tooltip placement="topLeft" title={text}>
698
+ {text}
699
+ </Tooltip>
700
+ ),
701
+ dataIndex: 'colorName',
702
+ },
703
+ {
704
+ title: '类目',
705
+ width: 100,
706
+ ellipsis: {
707
+ showTitle: false,
708
+ },
709
+ render: (text: any) => (
710
+ <Tooltip placement="topLeft" title={text}>
711
+ {text}
712
+ </Tooltip>
713
+ ),
714
+ dataIndex: 'categoryName',
715
+ },
716
+ {
717
+ title: '品类',
718
+ width: 100,
719
+ ellipsis: {
720
+ showTitle: false,
721
+ },
722
+ render: (text: any) => (
723
+ <Tooltip placement="topLeft" title={text}>
724
+ {text}
725
+ </Tooltip>
726
+ ),
727
+ dataIndex: 'className',
728
+ },
729
+ {
730
+ title: '品牌',
731
+ width: 100,
732
+ ellipsis: {
733
+ showTitle: false,
734
+ },
735
+ render: (text: any) => (
736
+ <Tooltip placement="topLeft" title={text}>
737
+ {text}
738
+ </Tooltip>
739
+ ),
740
+ dataIndex: 'brandName',
741
+ },
742
+ ],
743
+ selectColumn: mTpSelectColumn,
744
+ promiseLoadList: initialPromiseLoadList
745
+ }
746
+
747
+ return (
748
+ <div>
749
+ <AddSelect
750
+ {...props}
751
+ modalTableProps={modalTableProps}
752
+ />
753
+ </div>
754
+ );
755
+ };
756
+
757
+ export const AddSpuSelect = (parProps: any) => {
758
+ const selectProps = {
759
+ mode: 'multiple',
760
+ }
761
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
762
+ const [propertyList, setPropertyList] = useState([]);
763
+
764
+ useEffect(() => {
765
+ if(parProps?.isSingleColor) {
766
+ // type: 1 尺码组; 2 配码组
767
+ axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
768
+ result = result.data;
769
+ if (judgeIsRequestError(result)) {
770
+ message.error(result.msg);
771
+ return;
772
+ }
773
+ const data = result.data || [];
774
+ setPropertyList(data)
775
+ }).catch((err) => {});
776
+ }
777
+ },[])
778
+
779
+ //注⚠️:自定义过表头的请记得传tableCodeList参数
780
+ const initialSelectColumn = [
781
+ {
782
+ title: '商品编码',
783
+ width: 150,
784
+ dataIndex: 'itemCode',
785
+ },
786
+ {
787
+ title: '商品名称',
788
+ width: 200,
789
+ ellipsis: {
790
+ showTitle: false,
791
+ },
792
+ render: (text: any) => (
793
+ <Tooltip placement="topLeft" title={text}>
794
+ {text}
795
+ </Tooltip>
796
+ ),
797
+ dataIndex: 'name',
798
+ },
799
+ {
800
+ title: '颜色',
801
+ dataIndex: 'colorName',
802
+ width: 200,
803
+ isSelectItem: true,
804
+ dataSourceCode: 'colorValues',
805
+ dataSourceMapping: ['value', 'value']
806
+ },
807
+ {
808
+ title: '配码',
809
+ dataIndex: 'selectPropertyGroupCode',
810
+ width: 160,
811
+ isSelectItem: true,
812
+ dataSource: propertyList,
813
+ filterDataSourceCode: 'matchingCodes',
814
+ },
815
+ {
816
+ title: '数量',
817
+ width: 100,
818
+ isInputItem: true,
819
+ dataIndex: 'count',
820
+ },
821
+ {
822
+ title: '所属组织',
823
+ dataIndex: 'ownOrgSignName',
824
+ },
825
+ {
826
+ title: '品牌',
827
+ dataIndex: 'brandName',
828
+ },
829
+ {
830
+ title: '类目',
831
+ dataIndex: 'categoryText',
832
+ },
833
+ {
834
+ title: '品类',
835
+ dataIndex: 'className',
836
+ },
837
+ ]
838
+ const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps)
839
+ const initialPromiseLoadList = [
840
+ {
841
+ url: `/user/orgViewNode/listNoPage`,
842
+ params: {
843
+ 'qp-employeeId-eq': getEmployeeId(),
844
+ 'qp-orgViewCode-eq': 'business-organizational-view',
845
+ 'ctl-withDefaultOrg': true,
846
+ },
847
+ resType: 'list',
848
+ resPosition: 2,
849
+ resKeyValue: ['targetId','name']
850
+ },
851
+ {
852
+ url: `/items/brand/queryBrandList`,
853
+ params: {
854
+ pageSize: 5000,
855
+ currentPage: 1,
856
+ 'ctl-withAuth': true
857
+ },
858
+ resType: 'list',
859
+ resPosition: 3,
860
+ resKeyValue: ['id','name']
861
+ },
862
+ {
863
+ url: `/items/category/queryCategoryTree`,
864
+ params: {
865
+ pageSize: 5000,
866
+ currentPage: 1,
867
+ },
868
+ resType: 'treeList',
869
+ resPosition: 4,
870
+ },
871
+ {
872
+ url: `/items/class/withProperty`,
873
+ params: {
874
+ pageSize: 5000,
875
+ currentPage: 1,
876
+ },
877
+ resType: 'list',
878
+ resPosition: 5,
879
+ resKeyValue: ['id','name']
880
+ },
881
+ ]
882
+ const props = {
883
+ buttonText: parProps.buttonText || '新增',
884
+ buttonProps: parProps.buttonProps || {},
885
+ tableCodeList: parProps.tableCodeList || [],
886
+ value,
887
+ // labelInValue: true, // 非必填 默认为false
888
+ requestConfig: {
889
+ url: `/items/item`,
890
+ filter: 'qp-itemCode,name-orGroup,like', // 过滤参数
891
+ otherParams: {
892
+ 'qp-approveStatus-eq': 1, // 审核状态(0.待审批;1.审批通过;2.驳回;3.审批未通过)
893
+ 'qp-status-eq': 1,
894
+ sorter: 'desc-id',
895
+ ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
896
+ }, // 默认参数
897
+ mappingTextField: 'name',
898
+ mappingValueField: 'itemCode',
899
+ ...parProps.requestConfig
900
+ },
901
+ selectProps,
902
+ onChange: (value: any) => {
903
+ console.log(value)
904
+ setValue(value)
905
+ },
906
+ beforeShowModal: parProps?.beforeShowModal,
907
+ onSaveCallback: parProps.onSaveCallback,
908
+ businessType: 'spu',
909
+ isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
910
+ };
911
+ const modalTableProps = {
912
+ modalTableTitle: '选择商品',
913
+ tableSearchForm: [
914
+ { name: 'qp-itemCode-like', label: '商品编码' },
915
+ { name: 'qp-name-like', label: '商品名称' },
916
+ { name: 'qp-ownOrgSign-in', type: 'select', label: '所属组织', field: {
917
+ type: 'select',
918
+ props: {
919
+ mode: 'multiple',
920
+ notFoundContent: '暂无数据',
921
+ allowClear: true,
922
+ showSearch: true,
923
+ showArrow: true,
924
+ maxTagCount: 1,
925
+ optionFilterProp: 'children',
926
+ filterOption: (input: string, option: { props: { children: string } }) =>
927
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
928
+ },
929
+ } },
930
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
931
+ type: 'select',
932
+ props: {
933
+ mode: 'multiple',
934
+ notFoundContent: '暂无数据',
935
+ allowClear: true,
936
+ showSearch: true,
937
+ showArrow: true,
938
+ maxTagCount: 1,
939
+ optionFilterProp: 'children',
940
+ filterOption: (input: string, option: { props: { children: string } }) =>
941
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
942
+ },
943
+ } },
944
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
945
+ type: 'treeSelect',
946
+ props: {
947
+ treeData: [],
948
+ treeCheckable: true,
949
+ showSearch: true,
950
+ allowClear: true,
951
+ showArrow: true,
952
+ treeNodeFilterProp: 'title',
953
+ treeDefaultExpandAll: true,
954
+ maxTagCount: 1,
955
+ placeholder: '请选择',
956
+ style: {
957
+ width: '100%',
958
+ },
959
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
960
+ },
961
+ } },
962
+ { name: 'qp-classId-in', type: 'select', label: '品类', field: {
963
+ type: 'select',
964
+ props: {
965
+ mode: 'multiple',
966
+ notFoundContent: '暂无数据',
967
+ allowClear: true,
968
+ showSearch: true,
969
+ showArrow: true,
970
+ maxTagCount: 1,
971
+ optionFilterProp: 'children',
972
+ filterOption: (input: string, option: { props: { children: string } }) =>
973
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
974
+ },
975
+ } },
976
+ ],
977
+ tableColumns: [
978
+ {
979
+ title: '商品编码',
980
+ width: 150,
981
+ dataIndex: 'itemCode',
982
+ },
983
+ {
984
+ title: '商品名称',
985
+ width: 200,
986
+ ellipsis: {
987
+ showTitle: false,
988
+ },
989
+ render: (text: any) => (
990
+ <Tooltip placement="topLeft" title={text}>
991
+ {text}
992
+ </Tooltip>
993
+ ),
994
+ dataIndex: 'name',
995
+ },
996
+ {
997
+ title: '所属组织',
998
+ width: 100,
999
+ ellipsis: {
1000
+ showTitle: false,
1001
+ },
1002
+ render: (text: any) => (
1003
+ <Tooltip placement="topLeft" title={text}>
1004
+ {text}
1005
+ </Tooltip>
1006
+ ),
1007
+ dataIndex: 'ownOrgSignName',
1008
+ },
1009
+ {
1010
+ title: '品牌',
1011
+ width: 100,
1012
+ ellipsis: {
1013
+ showTitle: false,
1014
+ },
1015
+ render: (text: any) => (
1016
+ <Tooltip placement="topLeft" title={text}>
1017
+ {text}
1018
+ </Tooltip>
1019
+ ),
1020
+ dataIndex: 'brandName',
1021
+ },
1022
+ {
1023
+ title: '类目',
1024
+ width: 100,
1025
+ ellipsis: {
1026
+ showTitle: false,
1027
+ },
1028
+ render: (text: any) => (
1029
+ <Tooltip placement="topLeft" title={text}>
1030
+ {text}
1031
+ </Tooltip>
1032
+ ),
1033
+ dataIndex: 'categoryName',
1034
+ },
1035
+ {
1036
+ title: '品类',
1037
+ width: 100,
1038
+ ellipsis: {
1039
+ showTitle: false,
1040
+ },
1041
+ render: (text: any) => (
1042
+ <Tooltip placement="topLeft" title={text}>
1043
+ {text}
1044
+ </Tooltip>
1045
+ ),
1046
+ dataIndex: 'className',
1047
+ },
1048
+ ],
1049
+ selectColumn: mTpSelectColumn,
1050
+ promiseLoadList: initialPromiseLoadList
1051
+ }
1052
+
1053
+ return (
1054
+ <div>
1055
+ <AddSelect
1056
+ {...props}
1057
+ modalTableProps={modalTableProps}
1058
+ />
1059
+ </div>
1060
+ );
1061
+ };