@bit-sun/business-component 4.0.13-alpha.9 → 4.2.0-aiwei-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.
- package/.umirc.ts +21 -10
- package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
- package/dist/components/Business/BsLayouts/index.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +11 -8
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
- package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
- package/dist/components/Business/CommonAlert/index.d.ts +1 -2
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
- package/dist/components/Business/DetailPageWrapper/index.d.ts +11 -6
- package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
- package/dist/components/Business/ItemPropertySelector/index.d.ts +2 -0
- package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
- package/dist/components/Business/ModalUtils/index.d.ts +8 -0
- package/dist/components/Business/PropertyModal/index.d.ts +1 -2
- package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/SearchSelect/utils.d.ts +4 -2
- package/dist/components/Business/StateFlow/index.d.ts +1 -2
- package/dist/components/Business/SystemLog/index.d.ts +78 -0
- package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +9 -8
- package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
- package/dist/components/Business/columnSettingTable/index.d.ts +21 -4
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +22 -5
- package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
- package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
- package/dist/components/Common/Section/index.d.ts +1 -1
- package/dist/components/Functional/AddSelect/index.d.ts +1 -2
- package/dist/components/Functional/AuthButton/index.d.ts +1 -2
- package/dist/components/Functional/DataImport/index.d.ts +3 -3
- package/dist/components/Functional/DataValidation/index.d.ts +15 -5
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +3 -3
- package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/utils.d.ts +4 -4
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
- package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +4238 -2124
- package/dist/index.js +4247 -2122
- package/dist/plugin/TableColumnSetting/index.d.ts +6 -5
- package/dist/utils/RequestCacheManager.d.ts +82 -0
- package/dist/utils/TableUtils.d.ts +18 -19
- package/dist/utils/cachedRequest.d.ts +76 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/utils.d.ts +41 -0
- package/package.json +16 -14
- package/src/assets/btn-cancel.svg +3 -0
- package/src/assets/btn-copy.svg +3 -0
- package/src/assets/btn-delete.svg +2 -29
- package/src/assets/btn-edit.svg +2 -19
- package/src/assets/btn-hangUp.svg +3 -0
- package/src/assets/btn-print.svg +3 -0
- package/src/assets/btn-refresh.svg +3 -0
- package/src/assets/btn-unhook.svg +3 -0
- package/src/components/Business/AddSelectBusiness/index.md +8 -2
- package/src/components/Business/AddSelectBusiness/index.tsx +4 -1
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +1 -1
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +1 -1
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +1 -1
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +1 -1
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +2 -2
- package/src/components/Business/BsLayouts/service.ts +1 -1
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +6 -5
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +0 -4
- package/src/components/Business/BsSulaQueryTable/index.less +5 -3
- package/src/components/Business/BsSulaQueryTable/index.md +45 -32
- package/src/components/Business/BsSulaQueryTable/index.tsx +154 -76
- package/src/components/Business/BsSulaQueryTable/setting.tsx +47 -11
- package/src/components/Business/BsSulaQueryTable/utils.less +1 -1
- package/src/components/Business/BsSulaQueryTable/utils.tsx +15 -12
- package/src/components/Business/CommodityEntry/index.md +1 -1
- package/src/components/Business/CommodityEntry/index.tsx +11 -9
- package/src/components/Business/DetailPageWrapper/index.less +1 -1
- package/src/components/Business/DetailPageWrapper/index.tsx +24 -5
- package/src/components/Business/DetailPageWrapper/utils.tsx +7 -2
- package/src/components/Business/HomePageWrapper/index.less +1 -1
- package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
- package/src/components/Business/JsonQueryTable/function.ts +1 -1
- package/src/components/Business/JsonQueryTable/index.tsx +1 -1
- package/src/components/Business/ModalUtils/index.tsx +45 -0
- package/src/components/Business/PropertyModal/index.tsx +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +625 -76
- package/src/components/Business/SearchSelect/index.md +4 -4
- package/src/components/Business/SearchSelect/utils.ts +27 -5
- package/src/components/Business/SystemLog/index.md +37 -0
- package/src/components/Business/SystemLog/index.tsx +87 -0
- package/src/components/Business/columnSettingTable/columnSetting.tsx +28 -12
- package/src/components/Business/columnSettingTable/index.less +5 -3
- package/src/components/Business/columnSettingTable/index.md +200 -136
- package/src/components/Business/columnSettingTable/index.tsx +168 -39
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +188 -56
- package/src/components/Functional/AddSelect/helps.ts +1 -1
- package/src/components/Functional/AddSelect/index.tsx +132 -13
- package/src/components/Functional/BillEntry/index.less +3 -0
- package/src/components/Functional/BillEntry/index.tsx +1 -1
- package/src/components/Functional/DataImport/index.tsx +1 -1
- package/src/components/Functional/DataValidation/index.md +1 -0
- package/src/components/Functional/DataValidation/index.tsx +161 -27
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +1 -1
- package/src/components/Functional/QueryMutipleInput/index.tsx +12 -3
- package/src/components/Functional/QueryMutipleSelect/index.tsx +3 -2
- package/src/components/Functional/SearchSelect/index.less +4 -0
- package/src/components/Functional/SearchSelect/index.tsx +68 -24
- package/src/components/Functional/SearchSelect/utils.tsx +17 -11
- package/src/components/Functional/TreeSearchSelect/index.tsx +3 -2
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +1 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +11 -2
- package/src/components/Solution/RuleComponent/index.js +75 -4
- package/src/components/Solution/RuleComponent/ruleFiled.js +26 -2
- package/src/components/Solution/RuleComponent/services.ts +1 -1
- package/src/components/Solution/RuleSetter/service.js +1 -1
- package/src/index.ts +3 -0
- package/src/plugin/TableColumnSetting/index.less +5 -3
- package/src/plugin/TableColumnSetting/index.tsx +80 -13
- package/src/styles/bsDefault.less +9 -3
- package/src/utils/RequestCacheManager.ts +213 -0
- package/src/utils/RequestCache_Examples.md +137 -0
- package/src/utils/RequestCache_README.md +170 -0
- package/src/utils/TableUtils.less +1 -1
- package/src/utils/cachedRequest.ts +288 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/request.ts +8 -4
- package/src/utils/requestUtils.ts +1 -1
- package/src/utils/utils.ts +52 -16
|
@@ -36,6 +36,7 @@ export default () => {
|
|
|
36
36
|
ellipsis: {
|
|
37
37
|
showTitle: false,
|
|
38
38
|
},
|
|
39
|
+
showTotal: true,
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
42
|
dataIndex: 'spuCode',
|
|
@@ -111,7 +112,7 @@ export default () => {
|
|
|
111
112
|
x: '100%',
|
|
112
113
|
},
|
|
113
114
|
rowKey: 'id',
|
|
114
|
-
dataSource: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],
|
|
115
|
+
dataSource: [{"id": 1},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],
|
|
115
116
|
pagination: {
|
|
116
117
|
showTotal: (total: any) => `共 ${total} 条`,
|
|
117
118
|
showQuickJumper: true,
|
|
@@ -182,113 +183,182 @@ export default () => {
|
|
|
182
183
|
## sula列设置表格
|
|
183
184
|
|
|
184
185
|
```tsx
|
|
185
|
-
import React, { useState } from 'react';
|
|
186
|
+
import React, { useState, Fragment, } from 'react';
|
|
187
|
+
import { Segmented } from 'antd';
|
|
186
188
|
import { SulaColumnSettingTable } from '../../../index.ts';
|
|
187
189
|
|
|
188
190
|
export default () => {
|
|
189
191
|
const settingTableRef = React.useRef(null);
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
ellipsis: {
|
|
213
|
-
showTitle: true,
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
dataIndex: 'skuCode',
|
|
218
|
-
title: 'SKU',
|
|
219
|
-
fixed: 'left',
|
|
220
|
-
ellipsis: {
|
|
221
|
-
showTitle: true,
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
dataIndex: 'skuSpec',
|
|
226
|
-
title: '商品规格',
|
|
227
|
-
ellipsis: {
|
|
228
|
-
showTitle: false,
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
dataIndex: 'barCode',
|
|
233
|
-
title: '条码',
|
|
234
|
-
ellipsis: {
|
|
235
|
-
showTitle: false,
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
dataIndex: 'executeAmount',
|
|
240
|
-
title: '可执行数量',
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
dataIndex: 'planAmount',
|
|
244
|
-
title: '数量',
|
|
245
|
-
ellipsis: {
|
|
246
|
-
showTitle: false,
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
dataIndex: 'baseUnitCode',
|
|
251
|
-
title: '单位',
|
|
252
|
-
ellipsis: {
|
|
253
|
-
showTitle: false,
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
dataIndex: 'completeAmount',
|
|
258
|
-
title: '累计入库数量',
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
dataIndex: 'reverseNumber',
|
|
262
|
-
title: '累计退货数量',
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
dataIndex: 'taxRate',
|
|
266
|
-
title: '税率',
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
dataIndex: 'taxAmount',
|
|
270
|
-
title: '税额',
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
dataIndex: 'standardPrice',
|
|
274
|
-
title: '标准单价',
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
key: 'createUserName',
|
|
278
|
-
title: '操作人',
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
key: 'remark',
|
|
282
|
-
title: '备注',
|
|
283
|
-
textOverflow: true,
|
|
192
|
+
const [inputModel, setInputModel] = useState('整款模式'); // 录入模式
|
|
193
|
+
|
|
194
|
+
const skuDetailColumns = [
|
|
195
|
+
{
|
|
196
|
+
title: '商品编码',
|
|
197
|
+
dataIndex: 'itemCode',
|
|
198
|
+
key: 'itemCode',
|
|
199
|
+
width: 120,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
title: '商品名称',
|
|
203
|
+
dataIndex: 'itemName',
|
|
204
|
+
key: 'itemName',
|
|
205
|
+
width: 80,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: 'skuCode',
|
|
209
|
+
dataIndex: 'skuCode',
|
|
210
|
+
title: 'SKU',
|
|
211
|
+
width: 160,
|
|
212
|
+
ellipsis: {
|
|
213
|
+
showTitle: false,
|
|
284
214
|
},
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
title: '图片',
|
|
218
|
+
dataIndex: ['mediaList', '0', 'url'],
|
|
219
|
+
images: true,
|
|
220
|
+
width: 60,
|
|
221
|
+
},
|
|
222
|
+
{ title: '颜色', dataIndex: 'colorName', key: 'colorName', width: 100 },
|
|
223
|
+
{ title: '尺码', dataIndex: 'sizeName', key: 'sizeName', width: 60 },
|
|
224
|
+
{
|
|
225
|
+
key: 'unitCode',
|
|
226
|
+
dataIndex: 'unitCode',
|
|
227
|
+
title: '单位',
|
|
228
|
+
width: 60
|
|
229
|
+
},
|
|
230
|
+
// ...showPropertyList,
|
|
231
|
+
{
|
|
232
|
+
key: 'salemanName',
|
|
233
|
+
dataIndex: 'salemanName',
|
|
234
|
+
title: '导购',
|
|
235
|
+
width: 120,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
key: 'quantity',
|
|
239
|
+
dataIndex: 'quantity',
|
|
240
|
+
title: '数量',
|
|
241
|
+
align: 'right',
|
|
242
|
+
width: 70,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
key: 'labelPrice',
|
|
246
|
+
dataIndex: 'labelPrice',
|
|
247
|
+
title: '吊牌价',
|
|
248
|
+
align: 'right',
|
|
249
|
+
width: 70,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
key: 'money',
|
|
253
|
+
dataIndex: 'money',
|
|
254
|
+
title: '吊牌金额',
|
|
255
|
+
align: 'right',
|
|
256
|
+
width: 70,
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
key: 'realUnitPrice',
|
|
260
|
+
dataIndex: 'realUnitPrice',
|
|
261
|
+
title: '实际售价',
|
|
262
|
+
align: 'right',
|
|
263
|
+
width: 70,
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: 'discountRate',
|
|
267
|
+
dataIndex: 'discountRate',
|
|
268
|
+
title: '折扣率(%)',
|
|
269
|
+
align: 'right',
|
|
270
|
+
width: 100,
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
key: 'receivableMoney',
|
|
274
|
+
dataIndex: 'receivableMoney',
|
|
275
|
+
title: '实收金额',
|
|
276
|
+
align: 'right',
|
|
277
|
+
width: 100,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
key: 'discountUnitPrice',
|
|
281
|
+
dataIndex: 'discountUnitPrice',
|
|
282
|
+
title: '优惠单价',
|
|
283
|
+
align: 'right',
|
|
284
|
+
width: 70,
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
key: 'discountMoney',
|
|
288
|
+
dataIndex: 'discountMoney',
|
|
289
|
+
title: '优惠金额',
|
|
290
|
+
align: 'right',
|
|
291
|
+
width: 100,
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
key: 'moneyDiffer',
|
|
295
|
+
dataIndex: 'moneyDiffer',
|
|
296
|
+
title: '抹零金额',
|
|
297
|
+
align: 'right',
|
|
298
|
+
width: 70,
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
{
|
|
302
|
+
key: 'discountType',
|
|
303
|
+
dataIndex: 'discountType',
|
|
304
|
+
title: '优惠活动类型',
|
|
305
|
+
width: 120,
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
key: 'activityCode',
|
|
309
|
+
dataIndex: 'activityCode',
|
|
310
|
+
title: '活动编号',
|
|
311
|
+
width: 100,
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
key: 'column14',
|
|
315
|
+
dataIndex: 'column14',
|
|
316
|
+
title: '已发货数量',
|
|
317
|
+
align: 'right',
|
|
318
|
+
width: 70,
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
key: 'retQuantity',
|
|
322
|
+
dataIndex: 'retQuantity',
|
|
323
|
+
title: '已退数量',
|
|
324
|
+
align: 'right',
|
|
325
|
+
width: 70,
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
key: 'saleFlg',
|
|
329
|
+
dataIndex: 'saleFlg',
|
|
330
|
+
title: '销售方式',
|
|
331
|
+
width: 70,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
key: 'returnReason',
|
|
335
|
+
dataIndex: 'returnReason',
|
|
336
|
+
title: '退货原因',
|
|
337
|
+
width: 100,
|
|
338
|
+
},
|
|
339
|
+
];
|
|
340
|
+
|
|
341
|
+
const summary = () => {
|
|
342
|
+
return {
|
|
343
|
+
//diy: true,
|
|
344
|
+
cont: [
|
|
345
|
+
{
|
|
346
|
+
key: 'returnReason',
|
|
347
|
+
value: 0,
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// 表格字段控制
|
|
354
|
+
const getTableColumns = (inputModel: string, twoDimensions: string) => {
|
|
355
|
+
if(inputModel == 'SKU模式'){
|
|
356
|
+
return skuDetailColumns;
|
|
357
|
+
}else{
|
|
358
|
+
return [];
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
292
362
|
const config = {
|
|
293
363
|
modeType: 'view',
|
|
294
364
|
rowKey: 'id',
|
|
@@ -297,7 +367,7 @@ export default () => {
|
|
|
297
367
|
url: 'xxxxxx',
|
|
298
368
|
converter: ({ data }: any) => {
|
|
299
369
|
return {
|
|
300
|
-
list: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],
|
|
370
|
+
list: [{"id": 1},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],
|
|
301
371
|
total: 40
|
|
302
372
|
};
|
|
303
373
|
},
|
|
@@ -313,37 +383,8 @@ export default () => {
|
|
|
313
383
|
},
|
|
314
384
|
rowSelection: {
|
|
315
385
|
},
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
diy: true,
|
|
319
|
-
cont: [
|
|
320
|
-
{
|
|
321
|
-
key: 'spuCode',
|
|
322
|
-
value: 100,
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
key: 'skuSpec',
|
|
326
|
-
value: 200,
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
key: 'executeAmount',
|
|
330
|
-
value: 300,
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
key: 'completeAmount',
|
|
334
|
-
value: 300,
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
key: 'taxAmount',
|
|
338
|
-
value: 300,
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
key: 'standardPrice',
|
|
342
|
-
value: 300,
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
}
|
|
346
|
-
},
|
|
386
|
+
isSpecial: true,
|
|
387
|
+
summary: summary,
|
|
347
388
|
dynamicColumns: [
|
|
348
389
|
{
|
|
349
390
|
key: 'expectTime',
|
|
@@ -355,8 +396,31 @@ export default () => {
|
|
|
355
396
|
key: 'price',
|
|
356
397
|
},
|
|
357
398
|
],
|
|
358
|
-
columns,
|
|
399
|
+
columns: skuDetailColumns,
|
|
400
|
+
newUpdateSummary: 1,
|
|
401
|
+
isSpecial: true,
|
|
359
402
|
tableCode: 'uniquecode-1',
|
|
403
|
+
actionsRender: [
|
|
404
|
+
{
|
|
405
|
+
position: 'right',
|
|
406
|
+
type: () => {
|
|
407
|
+
return (
|
|
408
|
+
<Fragment>
|
|
409
|
+
<Segmented
|
|
410
|
+
value={inputModel}
|
|
411
|
+
style={{ marginRight: 22 }}
|
|
412
|
+
onChange={(value: any) => {
|
|
413
|
+
setInputModel(value)
|
|
414
|
+
}}
|
|
415
|
+
options={
|
|
416
|
+
['整款模式', 'SKU模式']
|
|
417
|
+
}
|
|
418
|
+
/>
|
|
419
|
+
</Fragment>
|
|
420
|
+
);
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
]
|
|
360
424
|
}
|
|
361
425
|
return (
|
|
362
426
|
<SulaColumnSettingTable
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import React, { useState } from 'react';
|
|
2
3
|
import { Table, Tooltip, Typography } from 'antd';
|
|
3
4
|
import { Resizable } from 'react-resizable';
|
|
@@ -14,28 +15,39 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
14
15
|
super(props);
|
|
15
16
|
this.state = {
|
|
16
17
|
showColumns: [],
|
|
18
|
+
selectedRowKeys: [], // 新增状态,用于跟踪选中的行的键
|
|
19
|
+
selectedRows: [],
|
|
20
|
+
showSummary: null
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
componentDidMount() {
|
|
21
|
-
const { columns }: any = this.props;
|
|
22
|
-
this.setInitialShowColumn(columns || [])
|
|
25
|
+
const { columns, updateSummary }: any = this.props;
|
|
26
|
+
this.setInitialShowColumn(columns || [], () => {
|
|
27
|
+
// 首次加载时调用 recalculateSummary 方法
|
|
28
|
+
this.recalculateSummary(updateSummary || '');
|
|
29
|
+
});
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
componentWillReceiveProps(nextProps: any) {
|
|
27
34
|
// if (JSON.stringify(this.props.columns) !== JSON.stringify(nextProps.columns)) {
|
|
28
35
|
// }
|
|
29
|
-
this.setInitialShowColumn(nextProps.columns || [])
|
|
30
|
-
|
|
36
|
+
this.setInitialShowColumn(nextProps.columns || [], () => {
|
|
37
|
+
this.recalculateSummary(nextProps.updateSummary);
|
|
38
|
+
});
|
|
39
|
+
if(nextProps.newUpdateSummary){
|
|
40
|
+
this.recalculateSummary(nextProps.newUpdateSummary);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
31
43
|
|
|
32
|
-
setInitialShowColumn = (columns: any[]) => {
|
|
44
|
+
setInitialShowColumn = (columns: any[], callback?: () => void) => {
|
|
33
45
|
// 获取当前列表定义数据
|
|
34
46
|
let columnConfig = this.getConfigFromlocalstorage();
|
|
35
47
|
let showColumns = getShowColumns(columns, columnConfig);
|
|
36
48
|
this.setState({
|
|
37
|
-
showColumns
|
|
38
|
-
})
|
|
49
|
+
showColumns
|
|
50
|
+
}, callback);
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
reSetInitialShowColumn = () => {
|
|
@@ -68,32 +80,97 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
68
80
|
return [];
|
|
69
81
|
};
|
|
70
82
|
|
|
83
|
+
/**
|
|
84
|
+
* 新增函数,用于根据传入的小数位数进行四舍五入
|
|
85
|
+
* @param number
|
|
86
|
+
* @param decimalPlaces
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
roundToDecimalPlaces = (number: any, decimalPlaces: number) => {
|
|
90
|
+
const factor = Math.pow(10, (decimalPlaces || 2));
|
|
91
|
+
return Math.round(Number(number || 0) * factor) / factor;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 合计行逻辑
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
71
98
|
getTableSummaryInfo = () => {
|
|
72
|
-
const { summary = undefined, rowSelection, expandable }: any = this.props;
|
|
73
|
-
const { showColumns }
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
const { summary = undefined, rowSelection, expandable, modeType, dataSource, isSpecial = false, }: any = this.props;
|
|
100
|
+
const { showColumns } = this.state;
|
|
101
|
+
|
|
102
|
+
// 封装生成 summaryRow 的逻辑
|
|
103
|
+
const generateSummaryRow = () => {
|
|
104
|
+
if (rowSelection && expandable) {
|
|
105
|
+
return [{}, {}, ...showColumns];
|
|
106
|
+
} else if (rowSelection || expandable || isSpecial) {
|
|
107
|
+
return [{}, ...showColumns];
|
|
108
|
+
}
|
|
109
|
+
return [...showColumns];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const summaryRow = generateSummaryRow();
|
|
113
|
+
|
|
114
|
+
let summaryInitial: any = [];
|
|
115
|
+
// 完善判断逻辑
|
|
116
|
+
if (typeof summary === 'function') {
|
|
117
|
+
const summaryResult = summary();
|
|
118
|
+
if (summaryResult.diy && !Array.isArray(summaryResult)) {
|
|
119
|
+
summaryInitial = summaryResult.cont;
|
|
120
|
+
}
|
|
121
|
+
} else if (typeof summary === 'object' && summary !== null && summary.diy && !Array.isArray(summary)) {
|
|
122
|
+
summaryInitial = summary.cont;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// let offset = 0;
|
|
126
|
+
let validSummaryRow = summaryRow;
|
|
127
|
+
// if(summaryInitial && summaryInitial.length > 0){
|
|
128
|
+
// summaryRow.filter((item) => {
|
|
129
|
+
// if (Object.keys(item).length === 0) {
|
|
130
|
+
// offset++;
|
|
131
|
+
// return false;
|
|
132
|
+
// }
|
|
133
|
+
// return true;
|
|
134
|
+
// });
|
|
135
|
+
// }
|
|
136
|
+
|
|
137
|
+
const summaryDom = (
|
|
138
|
+
<Table.Summary fixed>
|
|
139
|
+
<Table.Summary.Row>
|
|
140
|
+
{validSummaryRow.map((item, index) => {
|
|
141
|
+
const actualIndex = index;
|
|
142
|
+
let cellContent;
|
|
143
|
+
|
|
144
|
+
if (item.showTotal) {
|
|
145
|
+
cellContent = <Text type="danger">合计</Text>;
|
|
146
|
+
} else if (summaryInitial && summaryInitial.length > 0) {
|
|
147
|
+
const matchedItem = summaryInitial.find((inner: any) => inner.key === item.dataIndex || inner.key === item.key);
|
|
148
|
+
cellContent = <Text type="danger">{matchedItem ? matchedItem.value : ''}</Text>;
|
|
149
|
+
} else {
|
|
150
|
+
if (item.showSummary) {
|
|
151
|
+
const sum = dataSource.reduce((acc: any, record: any) => {
|
|
152
|
+
const value = record[item.dataIndex];
|
|
153
|
+
return acc + Number(value || 0);
|
|
154
|
+
}, 0);
|
|
155
|
+
const decimalPlaces = item.showDigit || 2;
|
|
156
|
+
const roundedSum = this.roundToDecimalPlaces(sum, decimalPlaces);
|
|
157
|
+
cellContent = <Text type="danger">{roundedSum}</Text>;
|
|
158
|
+
} else {
|
|
159
|
+
cellContent = <Text type="danger"></Text>;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
81
163
|
return (
|
|
82
|
-
<Table.Summary.Cell index={
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
summaryInitial.filter((inner: any) => inner.key === item.dataIndex || inner.key === item.key).length ?
|
|
86
|
-
`${item.title}: ${summaryInitial.filter((inner: any) => inner.key === item.dataIndex || inner.key === item.key)[0].value}` : ''
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
</Text>
|
|
164
|
+
<Table.Summary.Cell index={item.showTotal ? actualIndex + 1 : actualIndex}>
|
|
165
|
+
{cellContent}
|
|
90
166
|
</Table.Summary.Cell>
|
|
91
|
-
)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
</Table.Summary
|
|
95
|
-
|
|
96
|
-
|
|
167
|
+
);
|
|
168
|
+
})}
|
|
169
|
+
</Table.Summary.Row>
|
|
170
|
+
</Table.Summary>
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
return () => summaryDom;
|
|
97
174
|
};
|
|
98
175
|
|
|
99
176
|
handledynamicColumns = (col: any[]) => {
|
|
@@ -154,19 +231,52 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
154
231
|
}
|
|
155
232
|
};
|
|
156
233
|
|
|
234
|
+
/**
|
|
235
|
+
* 处理行点击事件
|
|
236
|
+
* @param record
|
|
237
|
+
*/
|
|
238
|
+
handleRowClick = (record: any) => {
|
|
239
|
+
const { selectedRowKeys, selectedRows, } = this.state;
|
|
240
|
+
const { rowKey }: any = this.props;
|
|
241
|
+
let newSelectedRowKeys = [...selectedRowKeys];
|
|
242
|
+
let newSelectedRows = [...selectedRows];
|
|
243
|
+
|
|
244
|
+
const keyIndex = newSelectedRowKeys.indexOf(record[rowKey]);
|
|
245
|
+
if (keyIndex > -1) {
|
|
246
|
+
// 如果已经选中,则取消选中
|
|
247
|
+
newSelectedRowKeys.splice(keyIndex, 1);
|
|
248
|
+
newSelectedRows.splice(keyIndex, 1);
|
|
249
|
+
} else {
|
|
250
|
+
// 如果未选中,则添加到选中列表
|
|
251
|
+
newSelectedRowKeys.push(record[rowKey]);
|
|
252
|
+
newSelectedRows.push(record);
|
|
253
|
+
}
|
|
254
|
+
this.setState({
|
|
255
|
+
selectedRowKeys: newSelectedRowKeys,
|
|
256
|
+
selectedRows: newSelectedRows,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// 手动调用外部传入的 onChange 函数
|
|
260
|
+
const { rowSelection }: any = this.props;
|
|
261
|
+
if (rowSelection && typeof rowSelection.onChange === 'function') {
|
|
262
|
+
// 直接将 record 作为数组元素传递
|
|
263
|
+
rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
recalculateSummary = (nextProps: any) => {
|
|
268
|
+
if (this.state.showColumns.length) {
|
|
269
|
+
const showSummary = this.getTableSummaryInfo();
|
|
270
|
+
this.setState({ showSummary });
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
157
274
|
render() {
|
|
158
|
-
const { columns, tableCode, appRequestConfig, summary = undefined, dynamicColumns = [], scroll={}, ...restProps }: any = this.props;
|
|
275
|
+
const { columns, tableCode, appRequestConfig, summary = undefined, dynamicColumns = [], scroll={}, rowSelection: propRowSelection, ...restProps }: any = this.props;
|
|
159
276
|
let otherTableInfo = {
|
|
160
277
|
...restProps,
|
|
161
278
|
};
|
|
162
|
-
|
|
163
|
-
if (this.state.showColumns.length && !Array.isArray(summary)) {
|
|
164
|
-
if (summary && summary().diy) {
|
|
165
|
-
showSummary = this.getTableSummaryInfo();
|
|
166
|
-
} else {
|
|
167
|
-
showSummary = summary;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
279
|
+
const { showSummary } = this.state;
|
|
170
280
|
|
|
171
281
|
const handleColumns = (arr: any, indexArr: any[]) => {
|
|
172
282
|
arr.forEach((item: any, index: any) => {
|
|
@@ -195,6 +305,7 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
195
305
|
showCol = this.handledynamicColumns(showCol);
|
|
196
306
|
}
|
|
197
307
|
|
|
308
|
+
|
|
198
309
|
otherTableInfo = {
|
|
199
310
|
...otherTableInfo,
|
|
200
311
|
scroll: {
|
|
@@ -202,6 +313,24 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
202
313
|
...scroll,
|
|
203
314
|
x: restProps.overScrollX || this.getTableScrollXWidth(showCol)
|
|
204
315
|
},
|
|
316
|
+
rowSelection: propRowSelection ? {
|
|
317
|
+
...propRowSelection,
|
|
318
|
+
selectedRowKeys: this.state.selectedRowKeys,
|
|
319
|
+
onChange: (selectedRowKeys: any, selectedRows: any) => {
|
|
320
|
+
this.setState({
|
|
321
|
+
selectedRowKeys,
|
|
322
|
+
selectedRows
|
|
323
|
+
});
|
|
324
|
+
if (propRowSelection && propRowSelection.onChange) {
|
|
325
|
+
propRowSelection.onChange(selectedRowKeys, selectedRows);
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
} : false,
|
|
329
|
+
onRow: (record: any) => {
|
|
330
|
+
return {
|
|
331
|
+
onClick: () => this.handleRowClick(record), // 绑定行点击事件
|
|
332
|
+
};
|
|
333
|
+
},
|
|
205
334
|
...(
|
|
206
335
|
showSummary ? { summary: showSummary } : {}
|
|
207
336
|
)
|