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

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 (167) hide show
  1. package/.fatherrc.ts +0 -1
  2. package/.umirc.ts +16 -31
  3. package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +1 -1
  4. package/dist/components/Business/SearchSelect/common.d.ts +1 -5
  5. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  6. package/dist/components/Business/SearchSelect/utils.d.ts +1 -2
  7. package/dist/components/Functional/SearchSelect/index.d.ts +1 -2
  8. package/dist/index.d.ts +0 -15
  9. package/dist/index.esm.js +4456 -19407
  10. package/dist/index.js +4443 -19411
  11. package/package.json +5 -26
  12. package/src/components/Business/CommodityEntry/index.md +3 -4
  13. package/src/components/Business/CommodityEntry/index.tsx +2 -7
  14. package/src/components/Business/SearchSelect/BusinessUtils.ts +14 -107
  15. package/src/components/Business/SearchSelect/common.ts +1 -20
  16. package/src/components/Business/SearchSelect/index.md +30 -60
  17. package/src/components/Business/SearchSelect/index.tsx +12 -21
  18. package/src/components/Business/SearchSelect/utils.ts +4 -30
  19. package/src/components/Functional/DataImport/index.tsx +2 -1
  20. package/src/components/Functional/DataValidation/index.tsx +1 -1
  21. package/src/components/Functional/SearchSelect/index.tsx +121 -218
  22. package/src/index.ts +6 -15
  23. package/typings.d.ts +0 -3
  24. package/dist/components/Business/AddSelectBusiness/index.d.ts +0 -1
  25. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +0 -4
  26. package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +0 -4
  27. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +0 -4
  28. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +0 -17
  29. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +0 -30
  30. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +0 -3
  31. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +0 -2
  32. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +0 -4
  33. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +0 -4
  34. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +0 -2
  35. package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +0 -8
  36. package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +0 -8
  37. package/dist/components/Business/BsLayouts/index.d.ts +0 -18
  38. package/dist/components/Business/BsLayouts/service.d.ts +0 -1
  39. package/dist/components/Business/BsLayouts/utils.d.ts +0 -13
  40. package/dist/components/Business/BsSulaQueryTable/index.d.ts +0 -2
  41. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +0 -58
  42. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +0 -98
  43. package/dist/components/Business/CommonAlert/index.d.ts +0 -3
  44. package/dist/components/Business/CommonGuideWrapper/index.d.ts +0 -6
  45. package/dist/components/Business/DetailPageWrapper/index.d.ts +0 -9
  46. package/dist/components/Business/DetailPageWrapper/utils.d.ts +0 -8
  47. package/dist/components/Business/HomePageWrapper/index.d.ts +0 -3
  48. package/dist/components/Business/StateFlow/index.d.ts +0 -3
  49. package/dist/components/Business/TreeSearchSelect/index.d.ts +0 -3
  50. package/dist/components/Business/TreeSearchSelect/utils.d.ts +0 -2
  51. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +0 -54
  52. package/dist/components/Business/columnSettingTable/index.d.ts +0 -16
  53. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +0 -17
  54. package/dist/components/Business/columnSettingTable/utils.d.ts +0 -8
  55. package/dist/components/Functional/AddSelect/index.d.ts +0 -3
  56. package/dist/components/Functional/BillEntry/index.d.ts +0 -4
  57. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +0 -12
  58. package/dist/components/Functional/TreeSearchSelect/index.d.ts +0 -2
  59. package/dist/utils/enumConfig.d.ts +0 -10
  60. package/dist/utils/requestUtils.d.ts +0 -1
  61. package/dist/utils/utils.d.ts +0 -3
  62. package/lib/assets/arrow_top.png +0 -0
  63. package/lib/assets/drag.svg +0 -17
  64. package/lib/assets/exportFail.svg +0 -38
  65. package/lib/assets/exportProcessing.svg +0 -29
  66. package/lib/assets/exportSuccess.svg +0 -35
  67. package/lib/assets/exportlogo.png +0 -0
  68. package/lib/assets/label_icon_bottom.svg +0 -26
  69. package/lib/assets/upExport.svg +0 -23
  70. package/src/assets/32.svg +0 -28
  71. package/src/assets/addIcon.svg +0 -18
  72. package/src/assets/allfunc.svg +0 -28
  73. package/src/assets/arrowRight.svg +0 -25
  74. package/src/assets/arrow_top.png +0 -0
  75. package/src/assets/btn-delete.svg +0 -30
  76. package/src/assets/btn-edit.svg +0 -20
  77. package/src/assets/btn-more.svg +0 -18
  78. package/src/assets/btn-submit.svg +0 -20
  79. package/src/assets/caidan.svg +0 -12
  80. package/src/assets/close.svg +0 -26
  81. package/src/assets/closeicon.png +0 -0
  82. package/src/assets/drag.svg +0 -17
  83. package/src/assets/exportFail.svg +0 -38
  84. package/src/assets/exportProcessing.svg +0 -29
  85. package/src/assets/exportSuccess.svg +0 -35
  86. package/src/assets/exportlogo.png +0 -0
  87. package/src/assets/fixed-left-active.svg +0 -12
  88. package/src/assets/fixed-left.svg +0 -16
  89. package/src/assets/fixed-right-active.svg +0 -12
  90. package/src/assets/fixed-right.svg +0 -16
  91. package/src/assets/guanbi.svg +0 -16
  92. package/src/assets/icon-quanping.svg +0 -16
  93. package/src/assets/icon-shezhi.svg +0 -18
  94. package/src/assets/label_icon_bottom.svg +0 -26
  95. package/src/assets/list-no-img.svg +0 -22
  96. package/src/assets/morentouxiang-32.svg +0 -24
  97. package/src/assets/right.png +0 -0
  98. package/src/assets/scanning.svg +0 -25
  99. package/src/assets/upExport.svg +0 -23
  100. package/src/assets/xinglan-icon-out.png +0 -0
  101. package/src/components/Business/AddSelectBusiness/index.md +0 -41
  102. package/src/components/Business/AddSelectBusiness/index.tsx +0 -290
  103. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +0 -112
  104. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +0 -153
  105. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +0 -70
  106. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +0 -90
  107. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +0 -38
  108. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +0 -243
  109. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +0 -385
  110. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +0 -286
  111. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +0 -75
  112. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +0 -171
  113. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +0 -65
  114. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +0 -154
  115. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +0 -73
  116. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +0 -158
  117. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +0 -85
  118. package/src/components/Business/BsLayouts/Components/RightContent/home.less +0 -218
  119. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +0 -156
  120. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +0 -161
  121. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +0 -76
  122. package/src/components/Business/BsLayouts/index.less +0 -80
  123. package/src/components/Business/BsLayouts/index.tsx +0 -1465
  124. package/src/components/Business/BsLayouts/service.ts +0 -11
  125. package/src/components/Business/BsLayouts/utils.tsx +0 -211
  126. package/src/components/Business/BsSulaQueryTable/index.less +0 -220
  127. package/src/components/Business/BsSulaQueryTable/index.tsx +0 -505
  128. package/src/components/Business/BsSulaQueryTable/setting.tsx +0 -799
  129. package/src/components/Business/BsSulaQueryTable/utils.less +0 -65
  130. package/src/components/Business/BsSulaQueryTable/utils.tsx +0 -688
  131. package/src/components/Business/CommonAlert/index.less +0 -0
  132. package/src/components/Business/CommonAlert/index.tsx +0 -23
  133. package/src/components/Business/CommonGuideWrapper/index.less +0 -112
  134. package/src/components/Business/CommonGuideWrapper/index.md +0 -39
  135. package/src/components/Business/CommonGuideWrapper/index.tsx +0 -84
  136. package/src/components/Business/DetailPageWrapper/index.less +0 -80
  137. package/src/components/Business/DetailPageWrapper/index.tsx +0 -335
  138. package/src/components/Business/DetailPageWrapper/utils.tsx +0 -101
  139. package/src/components/Business/HomePageWrapper/index.less +0 -33
  140. package/src/components/Business/HomePageWrapper/index.md +0 -45
  141. package/src/components/Business/HomePageWrapper/index.tsx +0 -162
  142. package/src/components/Business/StateFlow/index.less +0 -131
  143. package/src/components/Business/StateFlow/index.md +0 -60
  144. package/src/components/Business/StateFlow/index.tsx +0 -30
  145. package/src/components/Business/TreeSearchSelect/index.md +0 -126
  146. package/src/components/Business/TreeSearchSelect/index.tsx +0 -34
  147. package/src/components/Business/TreeSearchSelect/utils.ts +0 -60
  148. package/src/components/Business/columnSettingTable/columnSetting.tsx +0 -764
  149. package/src/components/Business/columnSettingTable/index.less +0 -247
  150. package/src/components/Business/columnSettingTable/index.md +0 -358
  151. package/src/components/Business/columnSettingTable/index.tsx +0 -233
  152. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +0 -241
  153. package/src/components/Business/columnSettingTable/utils.tsx +0 -69
  154. package/src/components/Functional/AddSelect/index.less +0 -367
  155. package/src/components/Functional/AddSelect/index.md +0 -122
  156. package/src/components/Functional/AddSelect/index.tsx +0 -962
  157. package/src/components/Functional/BillEntry/index.less +0 -371
  158. package/src/components/Functional/BillEntry/index.md +0 -39
  159. package/src/components/Functional/BillEntry/index.tsx +0 -613
  160. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +0 -37
  161. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +0 -59
  162. package/src/components/Functional/TreeSearchSelect/index.md +0 -47
  163. package/src/components/Functional/TreeSearchSelect/index.tsx +0 -149
  164. package/src/styles/bsDefault.less +0 -1907
  165. package/src/utils/enumConfig.ts +0 -10
  166. package/src/utils/requestUtils.ts +0 -33
  167. package/src/utils/utils.ts +0 -52
@@ -1,613 +0,0 @@
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;
@@ -1,37 +0,0 @@
1
- ---
2
- title: 导出按钮
3
- order: 5
4
- nav:
5
- title: 组件
6
- order: 1
7
- group:
8
- path: /components/functional
9
- order: 0
10
- title: 功能组件
11
- ---
12
-
13
- ## ExportIcon
14
-
15
- 导出按钮demo
16
-
17
- ```tsx
18
- import React, { useState, useRef } from 'react';
19
- import {ExportIcon} from '../../../../index';
20
-
21
-
22
-
23
- export default () => {
24
-
25
- const tableRef = useRef()
26
-
27
- return (
28
- <div>
29
- <ExportIcon request={{url:'abc'}} tableRef={tableRef}/>
30
- </div>
31
- );
32
- };
33
- ```
34
-
35
- <API></API>
36
-
37
- More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -1,59 +0,0 @@
1
- // @ts-nocheck
2
- import React, {Ref} from 'react'
3
- import {message, Popconfirm, Tooltip} from "antd";
4
- import axios from 'axios'
5
- import exportlogo from '../../../../assets/exportlogo.png'
6
- import {omit} from 'lodash'
7
- interface exportIconType{
8
- /** others选填,使用axios发请求,*/
9
- request:{
10
- url: string,
11
- params: Function | Object,
12
- others?: Object
13
- },
14
- /** BsSulaQueryTable的tableRef*/
15
- tableRef: any,
16
- }
17
-
18
- const ExportIcon = ({request, tableRef}: exportIconType) => {
19
- const {url, params, others} = request
20
-
21
- return (
22
- <div style={{ cursor: 'pointer' }}>
23
- <Tooltip title="导出数据">
24
- <img width={32} src={exportlogo} onClick={() =>{
25
- const convertedParams = tableRef?.current?.getExportParams()
26
- let requestData: any
27
-
28
- if(typeof params === 'function'){
29
- requestData = {...omit(params(convertedParams),'selectedRows')}
30
- }else if(typeof params === 'object'){
31
- requestData = {...params}
32
- }
33
- if(!params){
34
- requestData = omit(convertedParams, 'selectedRows')
35
- }
36
-
37
- requestData['qp-id-in'] = convertedParams?.selectedRows?.map((d: any) => d.id)?.join(',')
38
-
39
- axios({
40
- url,
41
- method:'POST',
42
- data:requestData,
43
- ...others,
44
- })
45
- .then((result: any) => {
46
- result = result.data;
47
- if (result.code !== '000000') {
48
- message.error(result?.msg);
49
- return;
50
- }
51
- message.success('任务已排入导出队列')
52
- })
53
- }} />
54
- </Tooltip>
55
- </div>
56
- )
57
- }
58
-
59
- export default ExportIcon