@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
|
@@ -150,7 +150,7 @@ export default () => {
|
|
|
150
150
|
// },
|
|
151
151
|
// prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
|
|
152
152
|
selectProps,
|
|
153
|
-
selectBusinessType: '
|
|
153
|
+
selectBusinessType: 'shopFile2',
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
const onTabChange = (key) => {
|
|
@@ -297,7 +297,7 @@ import {BusinessSearchSelect} from '../../../index.ts';
|
|
|
297
297
|
const { TabPane } = Tabs;
|
|
298
298
|
export default () => {
|
|
299
299
|
const selectProps = {
|
|
300
|
-
|
|
300
|
+
mode: 'multiple',
|
|
301
301
|
// maxTagCount: 1,
|
|
302
302
|
// disabled: true
|
|
303
303
|
}
|
|
@@ -317,7 +317,7 @@ export default () => {
|
|
|
317
317
|
},
|
|
318
318
|
// prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
|
|
319
319
|
selectProps,
|
|
320
|
-
selectBusinessType: '
|
|
320
|
+
selectBusinessType: 'spuCommodityWithProperty',
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
const onTabChange = (key) => {
|
|
@@ -520,7 +520,7 @@ export default () => {
|
|
|
520
520
|
// needStatusSearch: true
|
|
521
521
|
// },
|
|
522
522
|
selectProps,
|
|
523
|
-
selectBusinessType: '
|
|
523
|
+
selectBusinessType: 'realWarehouse',
|
|
524
524
|
};
|
|
525
525
|
|
|
526
526
|
const onTabChange = (key) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import request from '@/utils/
|
|
1
|
+
import request from '@/utils/cachedRequest';
|
|
2
2
|
import { message } from 'antd';
|
|
3
|
+
import { uniqBy } from 'lodash';
|
|
3
4
|
import { stringify } from 'querystring';
|
|
4
5
|
import ENUM from '@/utils/enumConfig';
|
|
5
6
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
@@ -55,10 +56,11 @@ const getDictionaryTextByValue = (dicCode: string, value: string | number) => {
|
|
|
55
56
|
return dicItemArray[0].text;
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
const loadSelectSource = (url: string, params?: any) => {
|
|
59
|
+
const loadSelectSource = (url: string, params?: any,options?:any) => {
|
|
60
|
+
const realOptions = options || {};
|
|
59
61
|
return new Promise((resolve, reject) => {
|
|
60
62
|
request
|
|
61
|
-
.get(`${url}?${stringify(params)}
|
|
63
|
+
.get(`${url}?${stringify(params)}`, realOptions)
|
|
62
64
|
.then((result: any) => {
|
|
63
65
|
result = result.data;
|
|
64
66
|
if (judgeIsRequestError(result)) {
|
|
@@ -79,7 +81,7 @@ const handleDefaultPrefixUrl = (type: string) => {
|
|
|
79
81
|
case 'supplier2': case 'customer2': case 'shopFile2': case 'platCompany': case 'market-channel':
|
|
80
82
|
result = '/channel-manage';
|
|
81
83
|
break;
|
|
82
|
-
case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity': case 'skcCommodity': case 'brand':
|
|
84
|
+
case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity': case 'skcCommodity': case 'brand': case 'spuCommodityWithProperty':
|
|
83
85
|
result = '/items';
|
|
84
86
|
break;
|
|
85
87
|
case 'physicalWarehouse': case 'realWarehouse': case 'virtualWarehouse': case 'channelWarehouse': case 'ownerWarehouse':
|
|
@@ -125,4 +127,24 @@ const getFieldIndex = (tableSearchForm: any, name: string) =>{
|
|
|
125
127
|
return tableSearchForm.findIndex((i: any) => i.name.includes(name));
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
// 获取选择器-弹窗中-下拉框查询接口-头部的请求头
|
|
131
|
+
const getQueryHeadersList = (params: any) => {
|
|
132
|
+
const { defaultQSHL = [], querySelectHeadersList = [], extralHeaders = {} } = params;
|
|
133
|
+
|
|
134
|
+
const realQSHL = uniqBy([...querySelectHeadersList, ...defaultQSHL],'queryKey')||[]; // 去重,保留最先出现的元素,故defaultQSHL需要放在后面
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
let result: any = {};
|
|
138
|
+
realQSHL.forEach((item: any) => {
|
|
139
|
+
const { queryKey, isOpen, extralHeaders:QSH } = item;
|
|
140
|
+
if (isOpen && queryKey) {
|
|
141
|
+
result[queryKey] = { headers: { ...extralHeaders, ...(QSH || {}) } };
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const getQueryHeadersItem = (queryHeaders: any, queryKey: any) => queryHeaders?.[queryKey] || {};
|
|
149
|
+
|
|
150
|
+
export { getDictionarySource, getDictionaryTextByValue, loadSelectSource, handleDefaultPrefixUrl, handleHiddenFields, handleHiddenFieldsRequest, getFieldIndex, getQueryHeadersList, getQueryHeadersItem }
|
|
@@ -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
|
|
@@ -15,7 +15,7 @@ import fixedLeft from '../../../assets/fixed-left.svg';
|
|
|
15
15
|
import fixedLeftActive from '../../../assets/fixed-left-active.svg';
|
|
16
16
|
import fixedRight from '../../../assets/fixed-right.svg';
|
|
17
17
|
import fixedRightActive from '../../../assets/fixed-right-active.svg';
|
|
18
|
-
import request from '@/utils/
|
|
18
|
+
import request from '@/utils/cachedRequest';
|
|
19
19
|
// import { request } from 'umi';
|
|
20
20
|
import './index.less';
|
|
21
21
|
import ENUM from '@/utils/enumConfig';
|
|
@@ -67,9 +67,10 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
67
67
|
onSearchSort: false,
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
patchUserColumnConfig = (config: any) => {
|
|
70
|
+
patchUserColumnConfig = (config: any, tableCodes: any) => {
|
|
71
71
|
const { tableCode, appRequestConfig }: any = this.props;
|
|
72
|
-
|
|
72
|
+
const newTableCode = tableCodes || tableCode;
|
|
73
|
+
if (!newTableCode) return;
|
|
73
74
|
let configvalue = config ? config.map((item:any) => ({
|
|
74
75
|
key: item.key || item.dataIndex,
|
|
75
76
|
dataIndex: item.dataIndex || item.key,
|
|
@@ -82,21 +83,22 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
82
83
|
url: handleRequestUrl('/user','/appConfig/saveUserOrder',appRequestConfig),
|
|
83
84
|
method:'POST',
|
|
84
85
|
data: {
|
|
85
|
-
"code":
|
|
86
|
+
"code": newTableCode,
|
|
86
87
|
"detail": configvalue ? JSON.stringify(configvalue) : ''
|
|
87
88
|
},
|
|
88
89
|
}).then((res:any) => {
|
|
89
90
|
if (judgeIsRequestSuccess(res?.data)) {
|
|
90
|
-
this.patchConfigToLocalstorage(configvalue,
|
|
91
|
+
this.patchConfigToLocalstorage(configvalue, newTableCode, config)
|
|
91
92
|
} else {
|
|
92
93
|
message.error('保存表头列自定义失败,请稍后尝试');
|
|
93
94
|
}
|
|
94
95
|
})
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
patchConfigToLocalstorage = (configvalue:any, tableCode:string) => {
|
|
98
|
+
patchConfigToLocalstorage = (configvalue:any, tableCode:string, newDataSource: any) => {
|
|
98
99
|
const { setShowColumns, datasource = [] }: any = this.props;
|
|
99
100
|
const { sortDataSource } = this.state;
|
|
101
|
+
const sourceList = newDataSource || sortDataSource;
|
|
100
102
|
let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]'
|
|
101
103
|
let configArray = JSON.parse(config)
|
|
102
104
|
let currentSetting = configArray.filter((item:any) => item.code === tableCode)
|
|
@@ -114,7 +116,7 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
114
116
|
visible: false,
|
|
115
117
|
});
|
|
116
118
|
if (configvalue) {
|
|
117
|
-
setShowColumns([...
|
|
119
|
+
setShowColumns([...sourceList]);
|
|
118
120
|
} else {
|
|
119
121
|
this.setState({
|
|
120
122
|
dataSource: [
|
|
@@ -175,15 +177,28 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
175
177
|
return preKeyStr !== nextKeyStr;
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
// 提取逻辑到单独的方法
|
|
181
|
+
validateLocalStorageConfig = (datasource: any, tableCode: string) => {
|
|
182
|
+
let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
|
|
183
|
+
let configArray = JSON.parse(config);
|
|
184
|
+
let currentSetting = configArray.filter((item:any) => item.code === tableCode);
|
|
185
|
+
let configvalue = currentSetting?.[0]?.detail ? JSON.parse(currentSetting[0].detail) : [];
|
|
186
|
+
if (currentSetting.length === 0 || configvalue.length === 0 ) {
|
|
187
|
+
this.patchUserColumnConfig(datasource || [], tableCode);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
178
191
|
componentWillReceiveProps(nextProps: any) {
|
|
179
192
|
if (this.isColumnsChange(this.props?.datasource, nextProps?.datasource)) {
|
|
180
193
|
this.setInitValue(nextProps?.datasource || []);
|
|
194
|
+
this.validateLocalStorageConfig(nextProps?.datasource, nextProps?.tableCode);
|
|
181
195
|
}
|
|
182
196
|
}
|
|
183
197
|
|
|
184
198
|
componentDidMount() {
|
|
185
|
-
const { datasource = [] }: any = this.props;
|
|
199
|
+
const { datasource = [], tableCode }: any = this.props;
|
|
186
200
|
this.setInitValue(datasource);
|
|
201
|
+
this.validateLocalStorageConfig(datasource, tableCode);
|
|
187
202
|
}
|
|
188
203
|
|
|
189
204
|
columns = [
|
|
@@ -415,7 +430,7 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
415
430
|
visible: false,
|
|
416
431
|
});
|
|
417
432
|
setShowColumns([...sortDataSource]);
|
|
418
|
-
this.patchUserColumnConfig(sortDataSource)
|
|
433
|
+
this.patchUserColumnConfig(sortDataSource, null)
|
|
419
434
|
};
|
|
420
435
|
|
|
421
436
|
handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
|
@@ -476,7 +491,7 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
476
491
|
DraggableContainer = (props: any) => (
|
|
477
492
|
<SortableBody
|
|
478
493
|
useDragHandle
|
|
479
|
-
|
|
494
|
+
lockAxis='y'
|
|
480
495
|
helperClass="row-dragging"
|
|
481
496
|
onSortEnd={this.onSortEnd}
|
|
482
497
|
{...props}
|
|
@@ -487,9 +502,9 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
487
502
|
const { sortDataSource } = this.state;
|
|
488
503
|
// function findIndex base on Table rowKey props and should always be a right array index
|
|
489
504
|
const index = sortDataSource.findIndex(
|
|
490
|
-
(x
|
|
505
|
+
(x) => (x.key||x.dataIndex) == restProps['data-row-key'],
|
|
491
506
|
);
|
|
492
|
-
return <SortableItem index={index} {...restProps} />;
|
|
507
|
+
return <SortableItem key={restProps['data-row-key']} index={index} {...restProps} />;
|
|
493
508
|
};
|
|
494
509
|
|
|
495
510
|
onChange = (e: any, title: any) => {
|
|
@@ -854,6 +869,7 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
854
869
|
row: this.DraggableBodyRow,
|
|
855
870
|
},
|
|
856
871
|
}}
|
|
872
|
+
scroll={{ y: 364 }}
|
|
857
873
|
/>
|
|
858
874
|
</div>
|
|
859
875
|
</div>
|
|
@@ -151,16 +151,18 @@
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
.ant-table-
|
|
154
|
+
.ant-table-tbody::-webkit-scrollbar {
|
|
155
155
|
display: none;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.ant-table-wrapper {
|
|
159
159
|
margin-top: 10px;
|
|
160
|
-
height: 364px;
|
|
161
|
-
overflow: scroll;
|
|
162
160
|
padding-bottom: 50px;
|
|
163
161
|
|
|
162
|
+
tbody tr:first-child {
|
|
163
|
+
display: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
164
166
|
tr {
|
|
165
167
|
height: 30px;
|
|
166
168
|
td {
|