@bit-sun/business-component 4.2.0-alpha.6.2 → 4.2.0-alpha.6.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.
- package/dist/components/Business/SystemLog/index.d.ts +78 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +387 -55
- package/dist/index.js +388 -54
- package/dist/utils/utils.d.ts +41 -0
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +121 -25
- package/src/components/Business/SystemLog/index.md +37 -0
- package/src/components/Business/SystemLog/index.tsx +87 -0
- package/src/components/Business/columnSettingTable/index.tsx +7 -6
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +23 -22
- package/src/components/Functional/AddSelect/index.tsx +92 -0
- package/src/index.ts +2 -0
- package/src/utils/utils.ts +41 -1
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ const sharingTypeDataList = hasDictSharingType && getDictionarySource('UC000013'
|
|
|
13
13
|
|
|
14
14
|
export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
15
15
|
const { requestConfig:requestConfigProp={}, selectProps:selectConfigProps={}, modalTableProps:modalTableBusProps={}, hiddenFields=[]} = parentProps || {};
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
// 默认type === 'supplier' 供应商选择器
|
|
18
18
|
let requestConfig = {
|
|
19
19
|
init: true,
|
|
@@ -56,11 +56,11 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
const formatTreeDataSource = (
|
|
59
|
-
reData: any,
|
|
60
|
-
position: number,
|
|
59
|
+
reData: any,
|
|
60
|
+
position: number,
|
|
61
61
|
changePosition: number,
|
|
62
62
|
changeSearchForm: any,
|
|
63
|
-
resKeyValue=['id', 'name'],
|
|
63
|
+
resKeyValue=['id', 'name'],
|
|
64
64
|
childrenKey = 'children',
|
|
65
65
|
nodeDisabledJudge?: (data: any) => boolean, // 树节点能不能选 函数判断
|
|
66
66
|
) => {
|
|
@@ -344,7 +344,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
344
344
|
}
|
|
345
345
|
tableSearchForm = [
|
|
346
346
|
{ name: 'qp-skuCode-in', label: 'SKU编码', field: {
|
|
347
|
-
type:'multipleQuerySearchSelect',
|
|
347
|
+
type:'multipleQuerySearchSelect',
|
|
348
348
|
props: {
|
|
349
349
|
selectProps: {
|
|
350
350
|
mode: "multiple",
|
|
@@ -366,7 +366,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
366
366
|
} },
|
|
367
367
|
{ name: 'qp-skuName-like', label: 'SKU名称' },
|
|
368
368
|
{ name: 'qp-itemCode-in', label: 'SPU编码', field: {
|
|
369
|
-
type:'multipleQuerySearchSelect',
|
|
369
|
+
type:'multipleQuerySearchSelect',
|
|
370
370
|
props: {
|
|
371
371
|
selectProps: {
|
|
372
372
|
placeholder: '请输入SPU编码查询'
|
|
@@ -733,9 +733,9 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
733
733
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
734
734
|
},
|
|
735
735
|
} },
|
|
736
|
-
{
|
|
737
|
-
name: 'qp-year-in',
|
|
738
|
-
label: '年份',
|
|
736
|
+
{
|
|
737
|
+
name: 'qp-year-in',
|
|
738
|
+
label: '年份',
|
|
739
739
|
field: {
|
|
740
740
|
type: 'itemPropertySelector',
|
|
741
741
|
props: {
|
|
@@ -744,9 +744,9 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
746
|
},
|
|
747
|
-
{
|
|
748
|
-
name: 'qp-season-in',
|
|
749
|
-
label: '季节',
|
|
747
|
+
{
|
|
748
|
+
name: 'qp-season-in',
|
|
749
|
+
label: '季节',
|
|
750
750
|
field: {
|
|
751
751
|
type: 'itemPropertySelector',
|
|
752
752
|
props: {
|
|
@@ -755,9 +755,9 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
757
|
},
|
|
758
|
-
{
|
|
759
|
-
name: 'qp-zzdlbm-in',
|
|
760
|
-
label: '大类',
|
|
758
|
+
{
|
|
759
|
+
name: 'qp-zzdlbm-in',
|
|
760
|
+
label: '大类',
|
|
761
761
|
field: {
|
|
762
762
|
type: 'itemPropertySelector',
|
|
763
763
|
props: {
|
|
@@ -766,9 +766,9 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
},
|
|
769
|
-
{
|
|
770
|
-
name: 'qp-zzzlbm-in',
|
|
771
|
-
label: '中类',
|
|
769
|
+
{
|
|
770
|
+
name: 'qp-zzzlbm-in',
|
|
771
|
+
label: '中类',
|
|
772
772
|
field: {
|
|
773
773
|
type: 'itemPropertySelector',
|
|
774
774
|
props: {
|
|
@@ -777,9 +777,9 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
},
|
|
780
|
-
{
|
|
781
|
-
name: 'qp-zzxlbm-in',
|
|
782
|
-
label: '小类',
|
|
780
|
+
{
|
|
781
|
+
name: 'qp-zzxlbm-in',
|
|
782
|
+
label: '小类',
|
|
783
783
|
field: {
|
|
784
784
|
type: 'itemPropertySelector',
|
|
785
785
|
props: {
|
|
@@ -1379,13 +1379,39 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1379
1379
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1380
1380
|
},
|
|
1381
1381
|
} },
|
|
1382
|
-
|
|
1382
|
+
{
|
|
1383
|
+
name: 'qp-channelCode-in', type: 'treeSelect', label: '销售渠道', field: {
|
|
1384
|
+
type: 'treeSelect',
|
|
1385
|
+
props: {
|
|
1386
|
+
multiple: true,
|
|
1387
|
+
treeData: [],
|
|
1388
|
+
treeCheckable: false,
|
|
1389
|
+
notFoundContent: '暂无数据',
|
|
1390
|
+
allowClear: true,
|
|
1391
|
+
showSearch: true,
|
|
1392
|
+
showArrow: true,
|
|
1393
|
+
maxTagCount: 1,
|
|
1394
|
+
optionFilterProp: 'children',
|
|
1395
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
1396
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1397
|
+
showCheckedStrategy: 'TreeSelect.SHOW_ALL',
|
|
1398
|
+
},
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
...(modalTableBusProps?.needStatusSearch?[{ name: 'qp-status-eq', type: 'select', label: '运营仓状态', initialSource: getDictionarySource('SC00001') }]:[]),
|
|
1383
1402
|
]
|
|
1384
1403
|
const queryHeaderParams = getQueryHeadersList({ querySelectHeadersList, extralHeaders});
|
|
1385
1404
|
Promise.all([
|
|
1386
1405
|
loadSelectSource(`${prefixUrl.formSelectFix}/groupInfo/listNoPage`, { 'qp-status-eq': 1 },getQueryHeadersItem(queryHeaderParams,'qp-groupCode-in')),
|
|
1406
|
+
loadSelectSource(`/channel-manage/channelInfo/tree`, {
|
|
1407
|
+
'qp-status-eq': 10,
|
|
1408
|
+
'qp-isMain-eq': 1,
|
|
1409
|
+
'qp-type-in': '1,2',
|
|
1410
|
+
},getQueryHeadersItem(queryHeaderParams,'qp-orgCode-in')),
|
|
1387
1411
|
]).then((x: any)=>{
|
|
1388
1412
|
formatSource(x,0, 2, tableSearchForm,['groupCode','groupName']);
|
|
1413
|
+
const channelDisabledJude = (data: any) => data['parentCode'] === '0'; // 所属销售渠道 树节点不能点判断
|
|
1414
|
+
formatTreeDataSource(x, 1, 3, tableSearchForm, ['code','name'], 'channelInfoSon', channelDisabledJude)
|
|
1389
1415
|
})
|
|
1390
1416
|
modalTableProps = {
|
|
1391
1417
|
modalTableTitle: '选择运营仓',
|
|
@@ -1417,6 +1443,12 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1417
1443
|
defaultSort: 4,
|
|
1418
1444
|
render: (text: number) => getDictionaryTextByValue('SC00001', text),
|
|
1419
1445
|
}]:[]),
|
|
1446
|
+
{
|
|
1447
|
+
title: '所属销售渠道',
|
|
1448
|
+
dataIndex: 'channelName',
|
|
1449
|
+
defaultSort: 5,
|
|
1450
|
+
width: 100,
|
|
1451
|
+
},
|
|
1420
1452
|
],
|
|
1421
1453
|
...modalTableBusProps,
|
|
1422
1454
|
}
|
|
@@ -1690,15 +1722,66 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1690
1722
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1691
1723
|
},
|
|
1692
1724
|
} },
|
|
1693
|
-
|
|
1725
|
+
{
|
|
1726
|
+
name: 'qp-saleChannel-in', type: 'treeSelect', label: '销售渠道', field: {
|
|
1727
|
+
type: 'treeSelect',
|
|
1728
|
+
props: {
|
|
1729
|
+
multiple: true,
|
|
1730
|
+
treeData: [],
|
|
1731
|
+
treeCheckable: false,
|
|
1732
|
+
notFoundContent: '暂无数据',
|
|
1733
|
+
allowClear: true,
|
|
1734
|
+
showSearch: true,
|
|
1735
|
+
showArrow: true,
|
|
1736
|
+
maxTagCount: 1,
|
|
1737
|
+
optionFilterProp: 'children',
|
|
1738
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
1739
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1740
|
+
showCheckedStrategy: 'TreeSelect.SHOW_ALL',
|
|
1741
|
+
},
|
|
1742
|
+
}
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
name: 'qp-refCode-in', type: 'treeSelect', label: '营销区域', field: {
|
|
1746
|
+
type: 'treeSelect',
|
|
1747
|
+
props: {
|
|
1748
|
+
multiple: true,
|
|
1749
|
+
treeData: [],
|
|
1750
|
+
treeCheckable: false,
|
|
1751
|
+
notFoundContent: '暂无数据',
|
|
1752
|
+
allowClear: true,
|
|
1753
|
+
showSearch: true,
|
|
1754
|
+
showArrow: true,
|
|
1755
|
+
maxTagCount: 1,
|
|
1756
|
+
optionFilterProp: 'children',
|
|
1757
|
+
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
1758
|
+
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1759
|
+
|
|
1760
|
+
showCheckedStrategy: 'TreeSelect.SHOW_ALL',
|
|
1761
|
+
},
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
];
|
|
1694
1765
|
const queryHeaderParams = getQueryHeadersList({ querySelectHeadersList, extralHeaders});
|
|
1695
1766
|
Promise.all([
|
|
1696
1767
|
loadSelectSource(`${prefixUrl.formSelectFix}/org/listNoPage`, {},getQueryHeadersItem(queryHeaderParams,'qp-createOrgCode-eq')),
|
|
1768
|
+
loadSelectSource(`/channel-manage/channelInfo/tree`, {
|
|
1769
|
+
'qp-status-eq': 10,
|
|
1770
|
+
'qp-isMain-eq': 1,
|
|
1771
|
+
'qp-type-in': '1,2',
|
|
1772
|
+
},getQueryHeadersItem(queryHeaderParams,'qp-orgCode-in')),
|
|
1773
|
+
loadSelectSource(`/channel-manage/tagNode/getTree/10`, {
|
|
1774
|
+
'qp-status-eq': 1,
|
|
1775
|
+
},getQueryHeadersItem(queryHeaderParams,'qp-orgCode-in')),
|
|
1697
1776
|
]).then((x: any)=>{
|
|
1698
1777
|
const firstElement = x?.[0];
|
|
1699
1778
|
const allList = firstElement && [firstElement, firstElement];
|
|
1700
1779
|
formatSource(allList,0, 2, tableSearchForm);
|
|
1701
1780
|
formatSource(allList,1, 3, tableSearchForm);
|
|
1781
|
+
const channelDisabledJude = (data: any) => data['parentCode'] === '0'; // 所属销售渠道 树节点不能点判断
|
|
1782
|
+
const areaDisabledJude = (data: any) => data['parent'] === '0'; // 所属营销区域 树节点不能点判断
|
|
1783
|
+
formatTreeDataSource(x, 1, 4, tableSearchForm, ['code','name'], 'channelInfoSon', channelDisabledJude)
|
|
1784
|
+
formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children', areaDisabledJude)
|
|
1702
1785
|
})
|
|
1703
1786
|
modalTableProps = {
|
|
1704
1787
|
modalTableTitle: '选择客户',
|
|
@@ -1728,6 +1811,19 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1728
1811
|
title: '使用组织',
|
|
1729
1812
|
dataIndex: 'salesOrgName',
|
|
1730
1813
|
defaultSort: 4,
|
|
1814
|
+
width: 100,
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
title: '所属销售渠道',
|
|
1818
|
+
dataIndex: 'channelName',
|
|
1819
|
+
defaultSort: 5,
|
|
1820
|
+
width: 100,
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
title: '营销区域',
|
|
1824
|
+
dataIndex: 'commonRelationAreaName',
|
|
1825
|
+
defaultSort: 6,
|
|
1826
|
+
width: 100,
|
|
1731
1827
|
},
|
|
1732
1828
|
],
|
|
1733
1829
|
...modalTableBusProps
|
|
@@ -1995,7 +2091,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1995
2091
|
optionFilterProp: 'children',
|
|
1996
2092
|
filterOption: (input: string, option: { props: { children: string } }) =>
|
|
1997
2093
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
1998
|
-
|
|
2094
|
+
|
|
1999
2095
|
showCheckedStrategy: 'TreeSelect.SHOW_ALL',
|
|
2000
2096
|
},
|
|
2001
2097
|
} },
|
|
@@ -2013,7 +2109,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2013
2109
|
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
|
|
2014
2110
|
},
|
|
2015
2111
|
} ,
|
|
2016
|
-
initialSource: getDictionarySource('BUSINESS_StoreType')
|
|
2112
|
+
initialSource: getDictionarySource('BUSINESS_StoreType')
|
|
2017
2113
|
},
|
|
2018
2114
|
]
|
|
2019
2115
|
const queryHeaderParams = getQueryHeadersList({ querySelectHeadersList, extralHeaders});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 业务组件
|
|
7
|
+
order: 1
|
|
8
|
+
title: 日志组件
|
|
9
|
+
order: 1
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# SystemLog
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 日志业务组件
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import React, { useState } from 'react';
|
|
19
|
+
import { SystemLog } from '../../../index.ts';
|
|
20
|
+
|
|
21
|
+
export default () => {
|
|
22
|
+
const [modeType, setModeType] = useState('view');
|
|
23
|
+
const renderLogRef = useRef<any>();
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
fields: [
|
|
27
|
+
SystemLog({
|
|
28
|
+
modeType,
|
|
29
|
+
code: '123',
|
|
30
|
+
containerName: 'Test_Log_Info',
|
|
31
|
+
renderLogRef,
|
|
32
|
+
extraParams: {},
|
|
33
|
+
})
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { handleCommonTimeRender } from '@/utils/TableUtils';
|
|
2
|
+
import { formContainerAndItemLayout, handleConvertResponse } from '@/utils/utils';
|
|
3
|
+
import { Table as BsTable } from 'bssula';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
//操作日志
|
|
7
|
+
const SystemLog = ({
|
|
8
|
+
modeType,
|
|
9
|
+
code,
|
|
10
|
+
containerName,
|
|
11
|
+
renderLogRef = {},
|
|
12
|
+
extraParams = {},
|
|
13
|
+
}: {
|
|
14
|
+
modeType: string,
|
|
15
|
+
code: any
|
|
16
|
+
containerName: string,
|
|
17
|
+
renderLogRef: object,
|
|
18
|
+
extraParams?: object,
|
|
19
|
+
}) => {
|
|
20
|
+
return {
|
|
21
|
+
...formContainerAndItemLayout('table', '操作日志', containerName),
|
|
22
|
+
initialVisible: modeType != 'create',
|
|
23
|
+
fields: [
|
|
24
|
+
{
|
|
25
|
+
name: 'table',
|
|
26
|
+
label: false,
|
|
27
|
+
itemLayout: {
|
|
28
|
+
span: 24,
|
|
29
|
+
labelCol: {
|
|
30
|
+
span: 0,
|
|
31
|
+
},
|
|
32
|
+
wrapperCol: {
|
|
33
|
+
span: 24,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
field: (ctx: any) => {
|
|
37
|
+
return code && <BsTable
|
|
38
|
+
remoteDataSource={{
|
|
39
|
+
url: `/oms-ops/logInfo?qp-businessCode-eq=${code}`,
|
|
40
|
+
convertParams: ({ params }: any) => {
|
|
41
|
+
return {
|
|
42
|
+
pageSize: params.pageSize,
|
|
43
|
+
currentPage: params.current,
|
|
44
|
+
...extraParams,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
converter: ({ data }: any) => {
|
|
48
|
+
return {
|
|
49
|
+
...handleConvertResponse(data.list, data.total || data.totalCount),
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
}}
|
|
53
|
+
columns={[
|
|
54
|
+
{
|
|
55
|
+
title: '操作人',
|
|
56
|
+
dataIndex: 'handlerName',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: '操作名称',
|
|
60
|
+
dataIndex: 'handlerType',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: '操作时间',
|
|
64
|
+
dataIndex: 'handlerTime',
|
|
65
|
+
render: ({ text }: { text: any }) => handleCommonTimeRender(text)
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: '操作内容',
|
|
69
|
+
dataIndex: 'logcontent',
|
|
70
|
+
},
|
|
71
|
+
]}
|
|
72
|
+
style={{ width: '100%', marginTop: '-16px', padding: '0px' }}
|
|
73
|
+
rowKey="id"
|
|
74
|
+
scroll={{ x: 'max-content' }}
|
|
75
|
+
pagination={{
|
|
76
|
+
showTotal: (total: any) => `共 ${total} 条`,
|
|
77
|
+
showQuickJumper: true,
|
|
78
|
+
hideOnSinglePage: true,
|
|
79
|
+
}}
|
|
80
|
+
ref={renderLogRef}
|
|
81
|
+
/>
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export default SystemLog
|
|
@@ -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';
|
|
@@ -81,9 +82,9 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
84
|
* 新增函数,用于根据传入的小数位数进行四舍五入
|
|
84
|
-
* @param number
|
|
85
|
-
* @param decimalPlaces
|
|
86
|
-
* @returns
|
|
85
|
+
* @param number
|
|
86
|
+
* @param decimalPlaces
|
|
87
|
+
* @returns
|
|
87
88
|
*/
|
|
88
89
|
roundToDecimalPlaces = (number: any, decimalPlaces: number) => {
|
|
89
90
|
const factor = Math.pow(10, (decimalPlaces || 2));
|
|
@@ -92,7 +93,7 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
95
|
* 合计行逻辑
|
|
95
|
-
* @returns
|
|
96
|
+
* @returns
|
|
96
97
|
*/
|
|
97
98
|
getTableSummaryInfo = () => {
|
|
98
99
|
const { summary = undefined, rowSelection, expandable, modeType, dataSource, isSpecial = false, }: any = this.props;
|
|
@@ -232,7 +233,7 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
232
233
|
|
|
233
234
|
/**
|
|
234
235
|
* 处理行点击事件
|
|
235
|
-
* @param record
|
|
236
|
+
* @param record
|
|
236
237
|
*/
|
|
237
238
|
handleRowClick = (record: any) => {
|
|
238
239
|
const { selectedRowKeys, selectedRows, } = this.state;
|
|
@@ -316,7 +317,7 @@ export default class ColumnSettingTable extends React.Component {
|
|
|
316
317
|
...propRowSelection,
|
|
317
318
|
selectedRowKeys: this.state.selectedRowKeys,
|
|
318
319
|
onChange: (selectedRowKeys: any, selectedRows: any) => {
|
|
319
|
-
this.setState({
|
|
320
|
+
this.setState({
|
|
320
321
|
selectedRowKeys,
|
|
321
322
|
selectedRows
|
|
322
323
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
3
|
import { Table as SulaTable, request } from 'bssula';
|
|
3
4
|
import { Resizable } from 'react-resizable';
|
|
@@ -22,7 +23,7 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
22
23
|
showColumns: [],
|
|
23
24
|
selectedRowKeys: [], // 新增状态,用于跟踪选中的行的键
|
|
24
25
|
selectedRows: [],
|
|
25
|
-
showSummary: null
|
|
26
|
+
showSummary: null
|
|
26
27
|
}
|
|
27
28
|
this.sulaTableRef = React.createRef<any>();
|
|
28
29
|
}
|
|
@@ -79,9 +80,9 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
79
80
|
|
|
80
81
|
/**
|
|
81
82
|
* 新增函数,用于根据传入的小数位数进行四舍五入
|
|
82
|
-
* @param number
|
|
83
|
-
* @param decimalPlaces
|
|
84
|
-
* @returns
|
|
83
|
+
* @param number
|
|
84
|
+
* @param decimalPlaces
|
|
85
|
+
* @returns
|
|
85
86
|
*/
|
|
86
87
|
roundToDecimalPlaces = (number: any, decimalPlaces: number) => {
|
|
87
88
|
const factor = Math.pow(10, (decimalPlaces || 2));
|
|
@@ -90,7 +91,7 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* 合计行逻辑
|
|
93
|
-
* @returns
|
|
94
|
+
* @returns
|
|
94
95
|
*/
|
|
95
96
|
getTableSummaryInfo = () => {
|
|
96
97
|
const { summary = undefined, rowSelection, expandable, isSpecial = false, modeType }: any = this.props;
|
|
@@ -167,10 +168,10 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
167
168
|
</Table.Summary.Row>
|
|
168
169
|
</Table.Summary>
|
|
169
170
|
);
|
|
170
|
-
|
|
171
|
+
|
|
171
172
|
return () => summaryDom;
|
|
172
|
-
};
|
|
173
|
-
|
|
173
|
+
};
|
|
174
|
+
|
|
174
175
|
handledynamicColumns = (col: any[]) => {
|
|
175
176
|
let { dynamicColumns, modeType }: any = this.props;
|
|
176
177
|
col = col.map((item: any) => {
|
|
@@ -205,7 +206,7 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
205
206
|
|
|
206
207
|
ResizeableTitle = (props: any) => {
|
|
207
208
|
const { onResize, width, ...restProps } = props;
|
|
208
|
-
|
|
209
|
+
|
|
209
210
|
const [innerWidth, setInnerWidth] = useState(width);
|
|
210
211
|
const [isResizing, setIsResizing] = useState(false); // 标记是否正在拖拽
|
|
211
212
|
const [isDragging, setIsDragging] = useState(false); // 标记拖拽句柄是否被拖拽
|
|
@@ -213,9 +214,9 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
213
214
|
const markerPosition = useRef({ left: 0, top: 0 });
|
|
214
215
|
const currentStart = useRef(0);
|
|
215
216
|
const uuidref = useRef(uuid());
|
|
216
|
-
|
|
217
|
+
|
|
217
218
|
const prevWidthRef = useRef(width);
|
|
218
|
-
|
|
219
|
+
|
|
219
220
|
const handleMouseDown = (e: any) => {
|
|
220
221
|
currentStart.current = e.clientX;
|
|
221
222
|
markerPosition.current = { left: e.clientX, top: e.clientY }
|
|
@@ -223,35 +224,35 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
223
224
|
document.addEventListener('mousemove', handleMouseMove);
|
|
224
225
|
document.addEventListener('mouseup', handleMouseUp);
|
|
225
226
|
};
|
|
226
|
-
|
|
227
|
+
|
|
227
228
|
const handleMouseMove = (e: any) => {
|
|
228
229
|
e.stopPropagation();
|
|
229
230
|
e.preventDefault();
|
|
230
231
|
// 更新标记位置
|
|
231
232
|
markerPosition.current = { left: e.clientX, top: e.clientY }
|
|
232
233
|
const dom: HTMLElement | null = document.getElementById('text1');
|
|
233
|
-
|
|
234
|
+
|
|
234
235
|
if (dom && dom.style) {
|
|
235
236
|
dom.style.left = `${e.clientX}px`;
|
|
236
237
|
dom.style.top = `${e.clientY - 20}px`;
|
|
237
238
|
}
|
|
238
239
|
};
|
|
239
|
-
|
|
240
|
+
|
|
240
241
|
const handleMouseUp = (e: any) => {
|
|
241
242
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
242
243
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
243
244
|
setIsResizing(false);
|
|
244
245
|
};
|
|
245
|
-
|
|
246
|
+
|
|
246
247
|
const handleresize = (e: any, data: any, title: string) => {
|
|
247
248
|
const newWidth = data?.size?.width || 0;
|
|
248
249
|
setInnerWidth(newWidth); // 更新内部分宽度
|
|
249
250
|
};
|
|
250
|
-
|
|
251
|
+
|
|
251
252
|
const handleResizeStart = () => {
|
|
252
253
|
setIsResizing(true);
|
|
253
254
|
};
|
|
254
|
-
|
|
255
|
+
|
|
255
256
|
const handleResizeStop = (e: any, data: any) => {
|
|
256
257
|
setIsResizing(false);
|
|
257
258
|
if (onResize) {
|
|
@@ -265,11 +266,11 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
265
266
|
setInnerWidth(width);
|
|
266
267
|
}
|
|
267
268
|
}, [width]);
|
|
268
|
-
|
|
269
|
+
|
|
269
270
|
const thStyle = {
|
|
270
271
|
boxShadow: isResizing ? '2px 2px 10px rgba(0, 0, 0, 0.3)' : 'none',
|
|
271
272
|
};
|
|
272
|
-
|
|
273
|
+
|
|
273
274
|
return (
|
|
274
275
|
<Resizable
|
|
275
276
|
width={innerWidth}
|
|
@@ -333,7 +334,7 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
333
334
|
|
|
334
335
|
/**
|
|
335
336
|
* 处理行点击事件
|
|
336
|
-
* @param record
|
|
337
|
+
* @param record
|
|
337
338
|
*/
|
|
338
339
|
handleRowClick = (record: any) => {
|
|
339
340
|
const { selectedRowKeys, selectedRows, } = this.state;
|
|
@@ -420,7 +421,7 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
420
421
|
...propRowSelection,
|
|
421
422
|
selectedRowKeys: this.state.selectedRowKeys,
|
|
422
423
|
onChange: (selectedRowKeys: any, selectedRows: any) => {
|
|
423
|
-
this.setState({
|
|
424
|
+
this.setState({
|
|
424
425
|
selectedRowKeys,
|
|
425
426
|
selectedRows
|
|
426
427
|
});
|
|
@@ -436,7 +437,7 @@ export default class ColumnSettingSulaTable extends React.Component {
|
|
|
436
437
|
};
|
|
437
438
|
},
|
|
438
439
|
}
|
|
439
|
-
|
|
440
|
+
|
|
440
441
|
return (
|
|
441
442
|
<div style={{ position: 'relative' }}>
|
|
442
443
|
<span style={{ position: 'absolute', zIndex: '10', right: '8px', top: '10px' }} className="ant-dropdown-link">
|
|
@@ -222,6 +222,98 @@ const AddSelect = (props: any) => {
|
|
|
222
222
|
acc[key] = typeof value === 'function' ? value?.(record) : value;
|
|
223
223
|
return acc;
|
|
224
224
|
}, {});
|
|
225
|
+
|
|
226
|
+
// 可输入非数字字符
|
|
227
|
+
if(item.canInputString) {
|
|
228
|
+
return (
|
|
229
|
+
<InputNumber
|
|
230
|
+
min={0}
|
|
231
|
+
precision={0}
|
|
232
|
+
controls={false}
|
|
233
|
+
{...inputProps}
|
|
234
|
+
value={text || ''}
|
|
235
|
+
keyboard={false}
|
|
236
|
+
onPressEnter={(e: any) => {
|
|
237
|
+
e.target.blur();
|
|
238
|
+
}}
|
|
239
|
+
onBlur={async (e: any) => {
|
|
240
|
+
const {
|
|
241
|
+
target: { value },
|
|
242
|
+
} = e;
|
|
243
|
+
record[item.dataIndex] = value
|
|
244
|
+
editRecord(record)
|
|
245
|
+
}}
|
|
246
|
+
onKeyDown={(e) => {
|
|
247
|
+
if(e.keyCode === 13 && e.ctrlKey) {
|
|
248
|
+
handleOk(true)
|
|
249
|
+
document.getElementById("first-query")?.focus()
|
|
250
|
+
}
|
|
251
|
+
if(e.keyCode === 8 && e.ctrlKey) {
|
|
252
|
+
message.success('删除当前行')
|
|
253
|
+
e.stopPropagation();
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
|
|
256
|
+
if (dom) {
|
|
257
|
+
dom.select();
|
|
258
|
+
dom.focus();
|
|
259
|
+
dom.scrollIntoView(false)
|
|
260
|
+
}
|
|
261
|
+
dom = null
|
|
262
|
+
deleteRecord(record, popvalue);
|
|
263
|
+
}
|
|
264
|
+
if (e.keyCode === 37 && e.shiftKey) { // 左滑动
|
|
265
|
+
e.stopPropagation();
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
|
|
268
|
+
if (dom) {
|
|
269
|
+
dom.select();
|
|
270
|
+
dom.focus();
|
|
271
|
+
dom.scrollIntoView(false)
|
|
272
|
+
}
|
|
273
|
+
dom = null
|
|
274
|
+
}
|
|
275
|
+
if (e.keyCode === 39 && e.shiftKey) { // 右滑
|
|
276
|
+
e.stopPropagation();
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
|
|
279
|
+
if (dom) {
|
|
280
|
+
dom.select();
|
|
281
|
+
dom.focus();
|
|
282
|
+
dom.scrollIntoView(false)
|
|
283
|
+
}
|
|
284
|
+
dom = null
|
|
285
|
+
}
|
|
286
|
+
if (e.keyCode === 40) {
|
|
287
|
+
e.stopPropagation();
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
|
|
290
|
+
if (dom) {
|
|
291
|
+
dom.select();
|
|
292
|
+
dom.focus();
|
|
293
|
+
dom.scrollIntoView(false)
|
|
294
|
+
}
|
|
295
|
+
dom = null
|
|
296
|
+
} else if (e.keyCode === 38) {
|
|
297
|
+
e.stopPropagation();
|
|
298
|
+
e.preventDefault();
|
|
299
|
+
let dom1 = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
|
|
300
|
+
if (dom1) {
|
|
301
|
+
// dom1.value=""
|
|
302
|
+
// dom1.setSelectionRange(100, 0);
|
|
303
|
+
dom1.select();
|
|
304
|
+
dom1.focus();
|
|
305
|
+
dom1.scrollIntoViewIfNeeded(false)
|
|
306
|
+
// dom1.value=record['count']
|
|
307
|
+
}
|
|
308
|
+
dom1 = null
|
|
309
|
+
} else if (e.keyCode === 9 && index === selectedRowKeys.length - 1 && currentIndex === inputLength - 1) {
|
|
310
|
+
e.stopPropagation();
|
|
311
|
+
e.preventDefault();
|
|
312
|
+
}
|
|
313
|
+
}}
|
|
314
|
+
/>
|
|
315
|
+
);
|
|
316
|
+
}
|
|
225
317
|
|
|
226
318
|
return (
|
|
227
319
|
<InputNumber
|