@bit-sun/business-component 2.4.26 → 2.4.28

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