@bit-sun/business-component 1.2.3 → 1.2.4-alpha.1

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 (169) hide show
  1. package/.fatherrc.ts +1 -0
  2. package/.umirc.ts +31 -16
  3. package/dist/components/Business/AddSelectBusiness/index.d.ts +1 -0
  4. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +4 -0
  5. package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +4 -0
  6. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +4 -0
  7. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +17 -0
  8. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +30 -0
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +3 -0
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +2 -0
  11. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +4 -0
  12. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +4 -0
  13. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +2 -0
  14. package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +8 -0
  15. package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +8 -0
  16. package/dist/components/Business/BsLayouts/index.d.ts +18 -0
  17. package/dist/components/Business/BsLayouts/service.d.ts +1 -0
  18. package/dist/components/Business/BsLayouts/utils.d.ts +13 -0
  19. package/dist/components/Business/BsSulaQueryTable/index.d.ts +2 -0
  20. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +58 -0
  21. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +98 -0
  22. package/dist/components/Business/CommonAlert/index.d.ts +3 -0
  23. package/dist/components/Business/CommonGuideWrapper/index.d.ts +6 -0
  24. package/dist/components/Business/DetailPageWrapper/index.d.ts +9 -0
  25. package/dist/components/Business/DetailPageWrapper/utils.d.ts +8 -0
  26. package/dist/components/Business/HomePageWrapper/index.d.ts +3 -0
  27. package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +1 -1
  28. package/dist/components/Business/SearchSelect/common.d.ts +5 -1
  29. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  30. package/dist/components/Business/SearchSelect/utils.d.ts +2 -1
  31. package/dist/components/Business/StateFlow/index.d.ts +3 -0
  32. package/dist/components/Business/TreeSearchSelect/index.d.ts +3 -0
  33. package/dist/components/Business/TreeSearchSelect/utils.d.ts +2 -0
  34. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +54 -0
  35. package/dist/components/Business/columnSettingTable/index.d.ts +16 -0
  36. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +17 -0
  37. package/dist/components/Business/columnSettingTable/utils.d.ts +8 -0
  38. package/dist/components/Functional/AddSelect/index.d.ts +3 -0
  39. package/dist/components/Functional/BillEntry/index.d.ts +4 -0
  40. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +12 -0
  41. package/dist/components/Functional/SearchSelect/index.d.ts +2 -1
  42. package/dist/components/Functional/TreeSearchSelect/index.d.ts +2 -0
  43. package/dist/index.d.ts +15 -0
  44. package/dist/index.esm.js +19420 -4457
  45. package/dist/index.js +19451 -4471
  46. package/dist/utils/CheckOneUser/index.d.ts +1 -1
  47. package/dist/utils/enumConfig.d.ts +10 -0
  48. package/dist/utils/requestUtils.d.ts +1 -0
  49. package/dist/utils/utils.d.ts +3 -0
  50. package/lib/assets/arrow_top.png +0 -0
  51. package/lib/assets/drag.svg +17 -0
  52. package/lib/assets/exportFail.svg +38 -0
  53. package/lib/assets/exportProcessing.svg +29 -0
  54. package/lib/assets/exportSuccess.svg +35 -0
  55. package/lib/assets/exportlogo.png +0 -0
  56. package/lib/assets/label_icon_bottom.svg +26 -0
  57. package/lib/assets/upExport.svg +23 -0
  58. package/package.json +26 -5
  59. package/src/assets/32.svg +28 -0
  60. package/src/assets/addIcon.svg +18 -0
  61. package/src/assets/allfunc.svg +28 -0
  62. package/src/assets/arrowRight.svg +25 -0
  63. package/src/assets/arrow_top.png +0 -0
  64. package/src/assets/btn-delete.svg +30 -0
  65. package/src/assets/btn-edit.svg +20 -0
  66. package/src/assets/btn-more.svg +18 -0
  67. package/src/assets/btn-submit.svg +20 -0
  68. package/src/assets/caidan.svg +12 -0
  69. package/src/assets/close.svg +26 -0
  70. package/src/assets/closeicon.png +0 -0
  71. package/src/assets/drag.svg +17 -0
  72. package/src/assets/exportFail.svg +38 -0
  73. package/src/assets/exportProcessing.svg +29 -0
  74. package/src/assets/exportSuccess.svg +35 -0
  75. package/src/assets/exportlogo.png +0 -0
  76. package/src/assets/fixed-left-active.svg +12 -0
  77. package/src/assets/fixed-left.svg +16 -0
  78. package/src/assets/fixed-right-active.svg +12 -0
  79. package/src/assets/fixed-right.svg +16 -0
  80. package/src/assets/guanbi.svg +16 -0
  81. package/src/assets/icon-quanping.svg +16 -0
  82. package/src/assets/icon-shezhi.svg +18 -0
  83. package/src/assets/label_icon_bottom.svg +26 -0
  84. package/src/assets/list-no-img.svg +22 -0
  85. package/src/assets/morentouxiang-32.svg +24 -0
  86. package/src/assets/right.png +0 -0
  87. package/src/assets/scanning.svg +25 -0
  88. package/src/assets/upExport.svg +23 -0
  89. package/src/assets/xinglan-icon-out.png +0 -0
  90. package/src/components/Business/AddSelectBusiness/index.md +41 -0
  91. package/src/components/Business/AddSelectBusiness/index.tsx +290 -0
  92. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +112 -0
  93. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -0
  94. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -0
  95. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -0
  96. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +38 -0
  97. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +243 -0
  98. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +385 -0
  99. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +286 -0
  100. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +75 -0
  101. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +171 -0
  102. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +65 -0
  103. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +154 -0
  104. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +73 -0
  105. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +158 -0
  106. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -0
  107. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -0
  108. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +156 -0
  109. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +161 -0
  110. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +76 -0
  111. package/src/components/Business/BsLayouts/index.less +80 -0
  112. package/src/components/Business/BsLayouts/index.tsx +1465 -0
  113. package/src/components/Business/BsLayouts/service.ts +11 -0
  114. package/src/components/Business/BsLayouts/utils.tsx +211 -0
  115. package/src/components/Business/BsSulaQueryTable/index.less +220 -0
  116. package/src/components/Business/BsSulaQueryTable/index.tsx +505 -0
  117. package/src/components/Business/BsSulaQueryTable/setting.tsx +799 -0
  118. package/src/components/Business/BsSulaQueryTable/utils.less +65 -0
  119. package/src/components/Business/BsSulaQueryTable/utils.tsx +688 -0
  120. package/src/components/Business/CommodityEntry/index.md +4 -3
  121. package/src/components/Business/CommodityEntry/index.tsx +7 -2
  122. package/src/components/Business/CommonAlert/index.less +0 -0
  123. package/src/components/Business/CommonAlert/index.tsx +23 -0
  124. package/src/components/Business/CommonGuideWrapper/index.less +112 -0
  125. package/src/components/Business/CommonGuideWrapper/index.md +39 -0
  126. package/src/components/Business/CommonGuideWrapper/index.tsx +84 -0
  127. package/src/components/Business/DetailPageWrapper/index.less +80 -0
  128. package/src/components/Business/DetailPageWrapper/index.tsx +335 -0
  129. package/src/components/Business/DetailPageWrapper/utils.tsx +101 -0
  130. package/src/components/Business/HomePageWrapper/index.less +33 -0
  131. package/src/components/Business/HomePageWrapper/index.md +45 -0
  132. package/src/components/Business/HomePageWrapper/index.tsx +162 -0
  133. package/src/components/Business/SearchSelect/BusinessUtils.ts +107 -14
  134. package/src/components/Business/SearchSelect/common.ts +20 -1
  135. package/src/components/Business/SearchSelect/index.md +60 -30
  136. package/src/components/Business/SearchSelect/index.tsx +21 -12
  137. package/src/components/Business/SearchSelect/utils.ts +30 -4
  138. package/src/components/Business/StateFlow/index.less +131 -0
  139. package/src/components/Business/StateFlow/index.md +60 -0
  140. package/src/components/Business/StateFlow/index.tsx +30 -0
  141. package/src/components/Business/TreeSearchSelect/index.md +126 -0
  142. package/src/components/Business/TreeSearchSelect/index.tsx +34 -0
  143. package/src/components/Business/TreeSearchSelect/utils.ts +60 -0
  144. package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -0
  145. package/src/components/Business/columnSettingTable/index.less +247 -0
  146. package/src/components/Business/columnSettingTable/index.md +358 -0
  147. package/src/components/Business/columnSettingTable/index.tsx +233 -0
  148. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +241 -0
  149. package/src/components/Business/columnSettingTable/utils.tsx +69 -0
  150. package/src/components/Functional/AddSelect/index.less +367 -0
  151. package/src/components/Functional/AddSelect/index.md +122 -0
  152. package/src/components/Functional/AddSelect/index.tsx +962 -0
  153. package/src/components/Functional/BillEntry/index.less +371 -0
  154. package/src/components/Functional/BillEntry/index.md +39 -0
  155. package/src/components/Functional/BillEntry/index.tsx +613 -0
  156. package/src/components/Functional/DataImport/index.tsx +7 -2
  157. package/src/components/Functional/DataValidation/index.md +1 -0
  158. package/src/components/Functional/DataValidation/index.tsx +17 -2
  159. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -0
  160. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -0
  161. package/src/components/Functional/SearchSelect/index.tsx +218 -121
  162. package/src/components/Functional/TreeSearchSelect/index.md +47 -0
  163. package/src/components/Functional/TreeSearchSelect/index.tsx +149 -0
  164. package/src/index.ts +15 -6
  165. package/src/styles/bsDefault.less +1907 -0
  166. package/src/utils/enumConfig.ts +10 -0
  167. package/src/utils/requestUtils.ts +33 -0
  168. package/src/utils/utils.ts +52 -0
  169. package/typings.d.ts +3 -0
@@ -0,0 +1,613 @@
1
+ // @ts-nocheck
2
+ import { Button, message, Input, InputNumber, Tooltip, Table, Popover, Select } from 'antd';
3
+ import React, { useState, useRef, useEffect } from 'react';
4
+ import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/icons';
5
+ import { stringify } from 'querystring';
6
+ import './index.less';
7
+ import axios from 'axios';
8
+
9
+ const InputElement = ({
10
+ record, text, currentIndex, inputLength, index, setData, data, item, callSelectItem
11
+ }: {
12
+ record: any, text: string, currentIndex: any, inputLength: any, index: any, setData: any, data: any, item: any, callSelectItem: any
13
+ }) => {
14
+ const [hoverVisibled, updateHoverVisibled] = useState(false);
15
+ const [searchData, updateSearchData] = useState([]);
16
+ const tableRef = useRef(null);
17
+ const [value, setValue] = useState(text)
18
+ const inputRef = useRef(false);
19
+
20
+ const onSerchdata = (name: any) => {
21
+ axios
22
+ .get(`/items/sku/pager/v2?${stringify({ 'skuCodeAndSkuName': name, 'pageSize': 100, 'qp-combination-eq': false, 'qp-approveStatus-eq': 1, 'qp-status-eq': 1 })}`)
23
+ .then(({ data, status }: any) => {
24
+ if (status === 200) {
25
+ if (data.status === '0') {
26
+ const resultData = data.data.items.map((item: any, index: any) => ({
27
+ ...item,
28
+ index
29
+ }));
30
+ if (resultData.length === 1) {
31
+ callSelectItem({ ...resultData[0], needFocus: true })
32
+ setValue(resultData[0][item.dataIndex])
33
+ } else {
34
+ updateHoverVisibled(true)
35
+ updateSearchData(resultData)
36
+ }
37
+ } else {
38
+ updateSearchData([])
39
+ }
40
+ }
41
+ })
42
+ }
43
+
44
+ const onCallback = (itemData: any) => {
45
+ updateHoverVisibled(false)
46
+ if (itemData) {
47
+ callSelectItem({ ...itemData, needFocus: true })
48
+ setValue(itemData[item.dataIndex])
49
+ } else {
50
+ callSelectItem(null)
51
+ }
52
+ }
53
+
54
+ const SearchDataTable = (hoverVisibled: any) => {
55
+ const [selectIndex, setSelectIndex] = useState(0);
56
+ const inputRef = useRef(null);
57
+
58
+ useEffect(() => {
59
+ if (searchData.length && hoverVisibled) {
60
+ let dom = tableRef?.current?.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[0]
61
+ if (dom) {
62
+ dom.style.background = '#005CFF30'
63
+ }
64
+ }
65
+ }, [hoverVisibled, tableRef?.current])
66
+
67
+ useEffect(() => {
68
+ const inter = setInterval(() => {
69
+ if (inputRef.current) {
70
+ inputRef.current.focus()
71
+ }
72
+ }, 500)
73
+
74
+ return () => {
75
+ clearInterval(inter);
76
+ }
77
+ })
78
+
79
+ if (!hoverVisibled) return <></>
80
+
81
+ return <div className={'add_select_wrapper_select'} style={{ width: '800px', height: '400px', overflow: 'auto', position: 'relative' }}>
82
+ <Input placeholder='请输入skucode或者sku名称' ref={inputRef} style={{ position: 'absolute', zIndex: '-100', height: '22px' }} onKeyDown={(e) => {
83
+ let currentIndex = selectIndex
84
+ if (e.keyCode === 27) {
85
+ e.stopPropagation();
86
+ e.preventDefault();
87
+ setSelectIndex(0);
88
+ onCallback(null)
89
+ }
90
+ if (e.keyCode === 13) { // enter
91
+ onCallback(searchData[currentIndex])
92
+ setSelectIndex(0);
93
+ }
94
+
95
+ if (e.keyCode === 40) { // 向下
96
+ let dom = tableRef.current.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[currentIndex + 1]
97
+ if (dom) {
98
+ tableRef.current.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[currentIndex].style.background = ''
99
+ setSelectIndex(currentIndex + 1)
100
+ dom.style.background = '#005CFF30'
101
+ dom.scrollIntoViewIfNeeded(false)
102
+ }
103
+ } else if (e.keyCode === 38) {
104
+ let dom = tableRef.current.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[currentIndex - 1]
105
+ if (dom) {
106
+ tableRef.current.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[currentIndex].style.background = ''
107
+ setSelectIndex(currentIndex - 1)
108
+ dom.style.background = '#005CFF30'
109
+ dom.scrollIntoViewIfNeeded(false)
110
+ }
111
+ }
112
+ }} />
113
+ <Table
114
+ ref={tableRef}
115
+ pagination={false}
116
+ // components={
117
+ // {
118
+ // body: {
119
+ // cell: ({index, record, ...props}) => {
120
+ // debugger
121
+ // return <td {...props} style={selectIndex === record?.index ? {background: '#005CFF30'} : {} } />
122
+ // }
123
+ // }
124
+ // }
125
+ // }
126
+ onRow={(record, index) => {
127
+ return {
128
+ onClick: ((record, index, event) => {
129
+ let dom = tableRef.current.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[index]
130
+ if (dom) {
131
+ [...(tableRef.current.getElementsByTagName('tbody')[0].getElementsByTagName('tr'))].map(item => {
132
+ item.style.background = ''
133
+ })
134
+ dom.style.background = '#005CFF30'
135
+ dom.scrollIntoViewIfNeeded(false)
136
+ }
137
+ setSelectIndex(index)
138
+ }).bind(this, record, index), // 点击行
139
+ }
140
+ }}
141
+ rowClassName={'row-class'}
142
+ columns={[{
143
+ title: 'SKU编码',
144
+ width: 150,
145
+ dataIndex: 'skuCode',
146
+ },
147
+ {
148
+ title: 'SKU名称',
149
+ width: 200,
150
+ ellipsis: {
151
+ showTitle: false,
152
+ },
153
+ render: (text: any) => (
154
+ <Tooltip placement="topLeft" title={text}>
155
+ {text}
156
+ </Tooltip>
157
+ ),
158
+ dataIndex: 'name',
159
+ },
160
+ {
161
+ title: '国际条码',
162
+ width: 100,
163
+ ellipsis: {
164
+ showTitle: false,
165
+ },
166
+ dataIndex: 'barCode',
167
+ render: (text: any) => (
168
+ <Tooltip placement="topLeft" title={text}>
169
+ {text}
170
+ </Tooltip>
171
+ ),
172
+ },
173
+ {
174
+ title: '所属SPU名称',
175
+ width: 100,
176
+ ellipsis: {
177
+ showTitle: false,
178
+ },
179
+ dataIndex: 'itemName',
180
+ render: (text: any) => (
181
+ <Tooltip placement="topLeft" title={text}>
182
+ {text}
183
+ </Tooltip>
184
+ ),
185
+ },
186
+ {
187
+ title: '所属SPU编码',
188
+ width: 100,
189
+ ellipsis: {
190
+ showTitle: false,
191
+ },
192
+ dataIndex: 'itemCode',
193
+ render: (text: any) => (
194
+ <Tooltip placement="topLeft" title={text}>
195
+ {text}
196
+ </Tooltip>
197
+ ),
198
+ },
199
+ {
200
+ title: '外部编码',
201
+ width: 100,
202
+ ellipsis: {
203
+ showTitle: false,
204
+ },
205
+ render: (text: any) => (
206
+ <Tooltip placement="topLeft" title={text}>
207
+ {text}
208
+ </Tooltip>
209
+ ),
210
+ dataIndex: 'externalCode',
211
+ }]} dataSource={searchData} />
212
+ </div>
213
+ }
214
+
215
+
216
+ return (
217
+ <Popover placement="bottomLeft" destroyTooltipOnHide={{ keepParent: false }} title="" trigger="" content={SearchDataTable(hoverVisibled)} visible={hoverVisibled} onVisibleChange={(disabled) => { updateHoverVisibled(disabled) }}>
218
+ {item.isPrimaryInput ?
219
+ <Input
220
+ value={value}
221
+ ref={inputRef}
222
+ placeholder='skucode / sku名称'
223
+ keyboard={false}
224
+ autoFocus={record.autoFocus}
225
+ onChange={(value) => {
226
+ record[item.dataIndex] = value.currentTarget.value
227
+ setValue(value.currentTarget.value)
228
+ // setData(data);
229
+ }}
230
+ // onFocus={(e)=> {
231
+ // let dom1 = e.currentTarget;
232
+ // dom1.setSelectionRange(100, 0);
233
+ // dom1.select(text);
234
+ // }}
235
+ onKeyDown={(e) => {
236
+ // if (e.keyCode === 13 && e.ctrlKey) {
237
+ // handleOk(true)
238
+ // document.getElementById("first-query")?.focus()
239
+ // }
240
+ if (e.keyCode === 8 && e.ctrlKey && index) {
241
+ message.success('删除当前行')
242
+ e.stopPropagation();
243
+ e.preventDefault();
244
+ let dom = e.nativeEvent.path[3].children[index]?.getElementsByTagName('input')[currentIndex]
245
+ if (dom) {
246
+ dom.select();
247
+ dom.focus();
248
+ dom.scrollIntoViewIfNeeded(false)
249
+ }
250
+ dom = null
251
+ setData(data.filter((item, innerIndex) => innerIndex !== index))
252
+ }
253
+ if (e.keyCode === 13) { // enter
254
+ if (item.isPrimaryInput) {
255
+ if (e.currentTarget.value.length < 2) {
256
+ message.warning('至少输入两个字符');
257
+ } else {
258
+ onSerchdata(e.currentTarget.value)
259
+ }
260
+ }
261
+ }
262
+ if (e.keyCode === 37 && e.shiftKey) { // 左滑动
263
+ e.stopPropagation();
264
+ e.preventDefault();
265
+ let dom = e.nativeEvent.path[3].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
266
+ if (dom) {
267
+ dom.select();
268
+ dom.focus();
269
+ dom.scrollIntoViewIfNeeded(false)
270
+ }
271
+ dom = null
272
+ }
273
+ if (e.keyCode === 39 && e.shiftKey) { // 右滑
274
+ e.stopPropagation();
275
+ e.preventDefault();
276
+ let dom = e.nativeEvent.path[3].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
277
+ if (dom) {
278
+ dom.select();
279
+ dom.focus();
280
+ dom.scrollIntoViewIfNeeded(false)
281
+ }
282
+ dom = null
283
+ }
284
+ if (e.keyCode === 40) { // 向下
285
+ debugger
286
+ e.stopPropagation();
287
+ e.preventDefault();
288
+ let dom = e.nativeEvent.path[3].children[index + 2]?.getElementsByTagName('input')[currentIndex]
289
+ if (dom) {
290
+ dom.select();
291
+ dom.focus();
292
+ dom.scrollIntoViewIfNeeded(false)
293
+ }
294
+ dom = null
295
+ } else if (e.keyCode === 38) {
296
+ e.stopPropagation();
297
+ e.preventDefault();
298
+ let dom1 = e.nativeEvent.path[3].children[index]?.getElementsByTagName('input')[currentIndex]
299
+ if (dom1) {
300
+ // dom1.value=""
301
+ // dom1.setSelectionRange(100, 0);
302
+ dom1.select();
303
+ dom1.focus();
304
+ dom1.scrollIntoViewIfNeeded(false)
305
+ // dom1.value=record['count']
306
+ }
307
+ dom1 = null
308
+ } else if (e.keyCode === 9 && currentIndex === inputLength - 1 && index === data.length - 1) {
309
+ setData([...data, {}])
310
+ }
311
+ }}
312
+ />
313
+ :
314
+ <InputNumber
315
+ // onBlur={() => {updateHoverVisibled(false)}}
316
+ defaultValue={text || ''}
317
+ min={0}
318
+ keyboard={false}
319
+ onChange={(value) => {
320
+ record[item.dataIndex] = value
321
+ }}
322
+ onKeyDown={(e) => {
323
+ // if (e.keyCode === 13 && e.ctrlKey) {
324
+ // handleOk(true)
325
+ // document.getElementById("first-query")?.focus()
326
+ // }
327
+ if (e.keyCode === 8 && e.ctrlKey && index) {
328
+ message.success('删除当前行')
329
+ e.stopPropagation();
330
+ e.preventDefault();
331
+ let dom = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
332
+ if (dom) {
333
+ dom.select();
334
+ dom.focus();
335
+ dom.scrollIntoViewIfNeeded(false)
336
+ }
337
+ dom = null
338
+ setData(data.filter((item, innerIndex) => innerIndex !== index))
339
+ }
340
+ if (e.keyCode === 37 && e.shiftKey) { // 左滑动
341
+ e.stopPropagation();
342
+ e.preventDefault();
343
+ let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
344
+ if (dom) {
345
+ dom.select();
346
+ dom.focus();
347
+ dom.scrollIntoViewIfNeeded(false)
348
+ }
349
+ dom = null
350
+ }
351
+ if (e.keyCode === 39 && e.shiftKey) { // 右滑
352
+ e.stopPropagation();
353
+ e.preventDefault();
354
+ let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
355
+ if (dom) {
356
+ dom.select();
357
+ dom.focus();
358
+ dom.scrollIntoViewIfNeeded(false)
359
+ }
360
+ dom = null
361
+ }
362
+ if (e.keyCode === 40) { // 向下
363
+ e.stopPropagation();
364
+ e.preventDefault();
365
+ let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
366
+ if (dom) {
367
+ dom.select();
368
+ dom.focus();
369
+ dom.scrollIntoViewIfNeeded(false)
370
+ }
371
+ dom = null
372
+ } else if (e.keyCode === 38) {
373
+ e.stopPropagation();
374
+ e.preventDefault();
375
+ let dom1 = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
376
+ if (dom1) {
377
+ // dom1.value=""
378
+ // dom1.setSelectionRange(100, 0);
379
+ dom1.select();
380
+ dom1.focus();
381
+ dom1.scrollIntoViewIfNeeded(false)
382
+ // dom1.value=record['count']
383
+ }
384
+ dom1 = null
385
+ } else if (e.keyCode === 9 && currentIndex === inputLength - 1 && index === data.length - 1) {
386
+ e.stopPropagation();
387
+ e.preventDefault();
388
+ } else if (e.keyCode === 13 && currentIndex === inputLength - 1 && index === data.length - 1 && record['skuCode']) {
389
+ setData([...data, { autoFocus: true }])
390
+ }
391
+ }}
392
+ />
393
+ }
394
+
395
+ </Popover>
396
+ )
397
+ }
398
+
399
+ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/check", isBrandAuth=true, isCheckStockNum=true }) => {
400
+ const columns = [
401
+ {
402
+ title: 'SKU编码',
403
+ width: 150,
404
+ dataIndex: 'skuCode',
405
+ isInputItem: true,
406
+ isPrimaryInput: true
407
+ },
408
+ {
409
+ title: 'SKU名称',
410
+ width: 200,
411
+ ellipsis: {
412
+ showTitle: false,
413
+ },
414
+ render: (text: any) => (
415
+ <Tooltip placement="topLeft" title={text}>
416
+ {text}
417
+ </Tooltip>
418
+ ),
419
+ dataIndex: 'name',
420
+ },
421
+ {
422
+ title: '单位',
423
+ dataIndex: 'selectUnitCode',
424
+ width: 100,
425
+ render: (text: any, record: any) => {
426
+ if (record?.packingUnitList?.length) {
427
+ const basePackUnit = record?.packingUnitList[0]
428
+ record.selectUnitCode = basePackUnit.unitCode
429
+ return basePackUnit.name || basePackUnit.unitCode
430
+ }
431
+
432
+
433
+ return <></>
434
+ },
435
+ },
436
+ {
437
+ title: '数量',
438
+ width: 100,
439
+ isInputItem: true,
440
+ dataIndex: 'count',
441
+ },
442
+ {
443
+ title: '所属SPU编码',
444
+ width: 100,
445
+ ellipsis: {
446
+ showTitle: false,
447
+ },
448
+ dataIndex: 'itemCode',
449
+ render: (text: any) => (
450
+ <Tooltip placement="topLeft" title={text}>
451
+ {text}
452
+ </Tooltip>
453
+ ),
454
+ },
455
+ {
456
+ title: '规格',
457
+ width: 200,
458
+ ellipsis: {
459
+ showTitle: false,
460
+ },
461
+ render: (text: any) => (
462
+ <Tooltip placement="topLeft" title={text}>
463
+ {text}
464
+ </Tooltip>
465
+ ),
466
+ dataIndex: 'propertyNameAndValue',
467
+ }
468
+ ]
469
+ const [isModalVisible, setIsModalVisible] = useState(false);
470
+ const [data, setData] = useState([{ hovered: false }]);
471
+ const tableRef = useRef(null)
472
+
473
+ const [loading, setLoading] = useState(false);
474
+
475
+ const callSelectItem = (index, item) => {
476
+ if (item) {
477
+ let newData = [].concat(data)
478
+ newData[index] = { ...data[index], ...item }
479
+ setData(newData)
480
+ }
481
+ let dom = tableRef?.current?.getElementsByTagName('tbody')[0].getElementsByTagName('tr')[index + 1]
482
+ if (dom) {
483
+ setTimeout(() => {
484
+ dom.getElementsByTagName('input')[item ? 1 : 0]?.select()
485
+ dom.getElementsByTagName('input')[item ? 1 : 0]?.focus()
486
+ }, 200)
487
+ }
488
+ }
489
+
490
+ const deleteRecord = (record) => {
491
+ setData(data.filter(item => item.skuCode !== record.skuCode))
492
+ }
493
+
494
+ let inputIndex = 0;
495
+ let selectColumns = [...columns.map(item => {
496
+ const inputLength = columns.filter(item => item.isInputItem || item.isSelectItem).length
497
+ const currentIndex = inputIndex
498
+ if (item.isInputItem) {
499
+ inputIndex++;
500
+ return {
501
+ ...item,
502
+ render: (text, record, index) => {
503
+ return (
504
+ <InputElement setData={setData} callSelectItem={callSelectItem.bind(this, index)} item={item} isPrimaryInput={item.isPrimaryInput} record={record} text={text} data={data} index={index} inputLength={inputLength} currentIndex={currentIndex} />
505
+ );
506
+ },
507
+ }
508
+ } else if (item.isSelectItem) {
509
+ inputIndex++;
510
+ }
511
+
512
+ return item
513
+ }), {
514
+ title: '操作',
515
+ width: 50,
516
+ render: (text, record, index) => {
517
+ if (index !== 0) {
518
+ return (
519
+ <span style={{ cursor: 'pointer', color: '#005CFF' }} onClick={() => {
520
+ deleteRecord(record)
521
+ }}>删除</span>
522
+ )
523
+ }
524
+ }
525
+ }]
526
+
527
+ const isSkuCanEntry = (resultData) => {
528
+ // 处理业务参数
529
+ let otherParams={}
530
+ if(isBrandAuth){
531
+ otherParams = { brandAuth: 'ctl-withAuth' }
532
+ }
533
+ return axios
534
+ .post(validDataUrl, {
535
+ ...otherParams,
536
+ columns: ["skuCode", "quantity"],
537
+ data: resultData.map((i:any) => ({ skuCode: i.skuCode, quality: i.count })),
538
+ checkStockNum: isCheckStockNum,
539
+ })
540
+ .then((result) => {
541
+ result = result.data;
542
+ if (result.status !== '0') {
543
+ message.error(result.msg);
544
+ return { flag: false }
545
+ } else {
546
+ let res = result.data || [];
547
+ const errorList = res.filter((i: any) => !i.flag);
548
+ return { flag: !errorList?.length, errorList }
549
+ }
550
+ }).catch(() => {
551
+ return { flag:false }
552
+ })
553
+ }
554
+
555
+ const handleSubmit = async () => {
556
+ // 加校验逻辑
557
+ if (!data?.length) {
558
+ message.warning('至少录入一条数据');
559
+ return;
560
+ }
561
+ if (!data?.every((d: any) => d.skuCode && d.name)) {
562
+ message.warning('请选择商品!');
563
+ return;
564
+ }
565
+ if (!data?.every((d: any) => d.count)) {
566
+ message.warning('请填写商品数量!');
567
+ return;
568
+ }
569
+ const canEntryObject = await isSkuCanEntry(data)
570
+ if(canEntryObject?.flag === false) {
571
+ const messageInfo = canEntryObject?.errorList?.length && canEntryObject?.errorList.map((i: any) => <div>{i.skuCode}校验失败:{i.checkResults}</div>)
572
+ messageInfo && message.warning({ content: messageInfo, duration: 6 });
573
+ return;
574
+ }
575
+
576
+ setLoading(true)
577
+ onSaveCallback(data).then(res => {
578
+ if(true) {
579
+ message.success('保存成功')
580
+ }
581
+ setLoading(false)
582
+ }).catch(Error => {
583
+ message.error(Error);
584
+ setLoading(false)
585
+ })
586
+ }
587
+
588
+ return (
589
+ <div className='add_select'>
590
+ <div className='add_select_quick_header'>
591
+ <div className='add_select_quick_header_title'><div>快速录入</div><Button type="primary" onClick={() => handleSubmit()} loading={loading}>提交</Button></div>
592
+ <span><span>*</span> &nbsp;快捷键:【Tab】-跳格切换;【Shift+←、→】-当前行左、右移动;【 ↑、↓】-当前列上、下移动;【ctrl+Delete】-删除当前行;</span>
593
+ </div>
594
+ <div className={'add_select_wrapper_select add_select_wrapper_select_quick'}>
595
+ <Table
596
+ size='small'
597
+ scroll={{ y: 240 }}
598
+ ref={tableRef}
599
+ dataSource={data}
600
+ columns={selectColumns}
601
+ pagination={false}
602
+ rowClassName={'row-class'}
603
+ rowClassName={(record: object | null | undefined, index: number) =>
604
+ index % 2 === 0 ? 'table_base row-class' : 'table_odd row-class'
605
+ }
606
+ />
607
+ </div>
608
+
609
+ </div>
610
+ );
611
+ };
612
+
613
+ export default BillEntry;
@@ -27,7 +27,7 @@ import {
27
27
  } from '@ant-design/icons';
28
28
  import axios from 'axios';
29
29
  import './index.less';
30
- import _ from "loadsh"
30
+ import _ from "lodash"
31
31
 
32
32
  // const luckysheet = window.luckysheet;
33
33
 
@@ -58,6 +58,12 @@ const mapping = new Map([
58
58
  ['newUniqueCode', '新唯一码'],
59
59
  ['relationRecordCode', '单据编码'],
60
60
  ['remark', '备注'],
61
+ ['externalCode', 'JDE商品编码'],
62
+ ['realWarehouseCode', '仓库编码'],
63
+ ['syncRate', '按百分比'],
64
+ ['assignQuantity', '按指定数量'],
65
+ ['retainQuantity', ' 按保留数量'],
66
+ ['priority', ' 优先级'],
61
67
  ]);
62
68
 
63
69
  // for dnd
@@ -401,7 +407,6 @@ class DataImport extends React.Component {
401
407
  let sheetData = luckysheet.getSheetData();
402
408
  let data = JSON.parse(JSON.stringify(sheetData))
403
409
  .filter((item) => {
404
- debugger
405
410
  return item[0]
406
411
  })
407
412
  .map((item) => {
@@ -26,6 +26,7 @@ export default () => {
26
26
  // columns={['skuCode', 'quantity', 'price']}
27
27
  columns={["skuCode", "quantity", "price"]} // 需要哪些列展示,以及展示的顺序
28
28
  validDataUrl="/wms-ops/recordDetailImport/check" // 校验的接口url
29
+ validDataParams={{ recordCode: '111' }}
29
30
  onRef={(ref) => {
30
31
  dataValidationRef = ref;
31
32
  }}
@@ -27,7 +27,7 @@ import {
27
27
  } from '@ant-design/icons';
28
28
  import axios from 'axios';
29
29
  import './index.less';
30
- import _ from "loadsh"
30
+ import _ from "lodash"
31
31
 
32
32
  // const luckysheet = window.luckysheet;
33
33
 
@@ -58,6 +58,12 @@ const mapping = new Map([
58
58
  ['newUniqueCode', '新唯一码'],
59
59
  ['relationRecordCode', '单据编码'],
60
60
  ['remark', '备注'],
61
+ ['externalCode', 'JDE商品编码'],
62
+ ['realWarehouseCode', '仓库编码'],
63
+ ['syncRate', '按百分比'],
64
+ ['assignQuantity', '按指定数量'],
65
+ ['retainQuantity', ' 按保留数量'],
66
+ ['priority', ' 优先级'],
61
67
  ]);
62
68
 
63
69
  // for dnd
@@ -400,15 +406,24 @@ class DataValidation extends React.Component {
400
406
  };
401
407
 
402
408
  resetData = () => {
403
- const { validDataUrl, updateData, columns } = this.props;
409
+ const { validDataUrl, validDataParams, updateData, columns, isBrandAuth, isCheckStockNum = true } = this.props;
404
410
  const resultData = this.getData().filter(d => {
405
411
  return _.compact(Object.values(d)).length
406
412
  })
407
413
 
414
+ // 处理业务参数
415
+ let otherParams={}
416
+ if(isBrandAuth){
417
+ otherParams = { brandAuth: 'ctl-withAuth' }
418
+ }
419
+
408
420
  axios
409
421
  .post(validDataUrl, {
422
+ ...otherParams,
423
+ ...validDataParams,
410
424
  columns: columns,
411
425
  data: resultData,
426
+ checkStockNum: isCheckStockNum
412
427
  })
413
428
  .then((result) => {
414
429
  result = result.data;