@bit-sun/business-component 2.3.21 → 2.3.23

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