@bit-sun/business-component 3.1.5 → 3.1.7

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