@bit-sun/business-component 2.4.31-alpha.9 → 2.4.32

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