@bit-sun/business-component 2.3.19 → 2.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) 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/SearchSelect/index.d.ts +1 -1
  13. package/dist/index.esm.js +983 -936
  14. package/dist/index.js +989 -942
  15. package/dist/utils/utils.d.ts +1 -1
  16. package/docs/index.md +21 -21
  17. package/lib/assets/drag.svg +17 -17
  18. package/lib/assets/exportFail.svg +37 -37
  19. package/lib/assets/exportProcessing.svg +28 -28
  20. package/lib/assets/exportSuccess.svg +34 -34
  21. package/lib/assets/label_icon_bottom.svg +25 -25
  22. package/lib/assets/upExport.svg +22 -22
  23. package/package.json +78 -78
  24. package/src/assets/32.svg +27 -27
  25. package/src/assets/addIcon.svg +17 -17
  26. package/src/assets/allfunc.svg +27 -27
  27. package/src/assets/arrowRight.svg +24 -24
  28. package/src/assets/btn-delete.svg +29 -29
  29. package/src/assets/btn-edit.svg +19 -19
  30. package/src/assets/btn-more.svg +17 -17
  31. package/src/assets/btn-submit.svg +19 -19
  32. package/src/assets/caidan.svg +11 -11
  33. package/src/assets/close.svg +26 -26
  34. package/src/assets/drag.svg +17 -17
  35. package/src/assets/exportFail.svg +37 -37
  36. package/src/assets/exportProcessing.svg +28 -28
  37. package/src/assets/exportSuccess.svg +34 -34
  38. package/src/assets/fixed-left-active.svg +11 -11
  39. package/src/assets/fixed-left.svg +15 -15
  40. package/src/assets/fixed-right-active.svg +11 -11
  41. package/src/assets/fixed-right.svg +15 -15
  42. package/src/assets/guanbi.svg +15 -15
  43. package/src/assets/icon-quanping.svg +15 -15
  44. package/src/assets/icon-shezhi.svg +17 -17
  45. package/src/assets/label_icon_bottom.svg +25 -25
  46. package/src/assets/list-no-img.svg +21 -21
  47. package/src/assets/morentouxiang-32.svg +23 -23
  48. package/src/assets/scanning.svg +24 -24
  49. package/src/assets/upExport.svg +22 -22
  50. package/src/common/ENUM.ts +41 -41
  51. package/src/components/Business/AddSelectBusiness/index.md +162 -162
  52. package/src/components/Business/AddSelectBusiness/index.tsx +895 -895
  53. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  54. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  55. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  56. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  58. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  59. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  60. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  61. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  62. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  63. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  64. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  65. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  66. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  67. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  68. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  69. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
  70. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  71. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  72. package/src/components/Business/BsLayouts/index.less +79 -79
  73. package/src/components/Business/BsLayouts/index.tsx +1484 -1484
  74. package/src/components/Business/BsLayouts/service.ts +10 -10
  75. package/src/components/Business/BsLayouts/utils.tsx +203 -203
  76. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +564 -564
  77. package/src/components/Business/BsSulaQueryTable/index.less +221 -221
  78. package/src/components/Business/BsSulaQueryTable/index.tsx +535 -535
  79. package/src/components/Business/BsSulaQueryTable/setting.tsx +852 -852
  80. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  81. package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -688
  82. package/src/components/Business/CommodityEntry/index.md +70 -70
  83. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  84. package/src/components/Business/CommonAlert/index.tsx +23 -23
  85. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  86. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  87. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  88. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  89. package/src/components/Business/DetailPageWrapper/index.tsx +313 -313
  90. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  91. package/src/components/Business/HomePageWrapper/index.less +33 -33
  92. package/src/components/Business/HomePageWrapper/index.md +45 -45
  93. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  94. package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
  95. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
  96. package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -205
  97. package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
  98. package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
  99. package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
  100. package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
  101. package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
  102. package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
  103. package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
  104. package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
  105. package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
  106. package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
  107. package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
  108. package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
  109. package/src/components/Business/JsonQueryTable/function.ts +62 -62
  110. package/src/components/Business/JsonQueryTable/index.less +16 -16
  111. package/src/components/Business/JsonQueryTable/index.md +328 -328
  112. package/src/components/Business/JsonQueryTable/index.tsx +535 -535
  113. package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
  114. package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
  115. package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
  116. package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
  117. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
  118. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
  119. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
  120. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
  121. package/src/components/Business/JsonQueryTable/static.ts +390 -390
  122. package/src/components/Business/SearchSelect/BusinessUtils.ts +1762 -1762
  123. package/src/components/Business/SearchSelect/common.ts +75 -75
  124. package/src/components/Business/SearchSelect/index.md +1329 -1329
  125. package/src/components/Business/SearchSelect/index.tsx +55 -55
  126. package/src/components/Business/SearchSelect/utils.ts +100 -100
  127. package/src/components/Business/StateFlow/index.less +130 -130
  128. package/src/components/Business/StateFlow/index.md +60 -60
  129. package/src/components/Business/StateFlow/index.tsx +29 -29
  130. package/src/components/Business/TreeSearchSelect/index.md +156 -156
  131. package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
  132. package/src/components/Business/TreeSearchSelect/utils.ts +75 -75
  133. package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -764
  134. package/src/components/Business/columnSettingTable/index.less +247 -247
  135. package/src/components/Business/columnSettingTable/index.md +357 -357
  136. package/src/components/Business/columnSettingTable/index.tsx +232 -232
  137. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +240 -240
  138. package/src/components/Business/columnSettingTable/utils.tsx +71 -69
  139. package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -86
  140. package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
  141. package/src/components/Business/moreTreeTable/index.less +99 -99
  142. package/src/components/Business/moreTreeTable/index.md +448 -448
  143. package/src/components/Business/moreTreeTable/index.tsx +387 -387
  144. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  145. package/src/components/Functional/AddSelect/helps.ts +14 -14
  146. package/src/components/Functional/AddSelect/index.less +367 -367
  147. package/src/components/Functional/AddSelect/index.md +155 -155
  148. package/src/components/Functional/AddSelect/index.tsx +1282 -1282
  149. package/src/components/Functional/BillEntry/index.less +371 -371
  150. package/src/components/Functional/BillEntry/index.md +39 -39
  151. package/src/components/Functional/BillEntry/index.tsx +772 -772
  152. package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
  153. package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
  154. package/src/components/Functional/BsAntdSula/index.ts +2 -2
  155. package/src/components/Functional/DataImport/index.less +63 -63
  156. package/src/components/Functional/DataImport/index.md +44 -44
  157. package/src/components/Functional/DataImport/index.tsx +695 -695
  158. package/src/components/Functional/DataValidation/index.less +63 -63
  159. package/src/components/Functional/DataValidation/index.md +39 -39
  160. package/src/components/Functional/DataValidation/index.tsx +687 -687
  161. package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
  162. package/src/components/Functional/EllipsisTooltip/index.js +36 -36
  163. package/src/components/Functional/EllipsisTooltip/index.md +30 -30
  164. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  165. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -59
  166. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  167. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  168. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  169. package/src/components/Functional/SearchSelect/index.less +115 -115
  170. package/src/components/Functional/SearchSelect/index.md +141 -141
  171. package/src/components/Functional/SearchSelect/index.tsx +879 -879
  172. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  173. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  174. package/src/components/Functional/TreeSearchSelect/index.tsx +199 -199
  175. package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
  176. package/src/components/Solution/RuleComponent/index.d.ts +29 -29
  177. package/src/components/Solution/RuleComponent/index.js +2032 -2032
  178. package/src/components/Solution/RuleComponent/index.less +230 -230
  179. package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
  180. package/src/components/Solution/RuleComponent/ruleFiled.js +2107 -2107
  181. package/src/components/Solution/RuleComponent/services.ts +13 -13
  182. package/src/components/Solution/RuleComponent/util.js +139 -139
  183. package/src/index.ts +38 -38
  184. package/src/plugin/TableColumnSetting/index.less +247 -247
  185. package/src/plugin/TableColumnSetting/index.md +50 -50
  186. package/src/plugin/TableColumnSetting/index.tsx +724 -724
  187. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  188. package/src/styles/bsDefault.less +1912 -1912
  189. package/src/utils/CheckOneUser/index.md +39 -39
  190. package/src/utils/CheckOneUser/index.ts +51 -51
  191. package/src/utils/LocalstorageUtils.ts +95 -95
  192. package/src/utils/TableUtils.tsx +18 -18
  193. package/src/utils/checkUtils.ts +39 -39
  194. package/src/utils/enumConfig.ts +11 -11
  195. package/src/utils/getFormMode.js +12 -12
  196. package/src/utils/index.ts +4 -4
  197. package/src/utils/requestUtils.ts +34 -34
  198. package/src/utils/serialize.js +7 -7
  199. package/src/utils/utils.ts +212 -212
  200. package/tsconfig.json +29 -29
  201. package/typings.d.ts +4 -4
@@ -1,895 +1,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 { 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 { 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
+ };