@bit-sun/business-component 2.2.1 → 2.2.2
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/index.d.ts +1 -0
- package/dist/index.esm.js +6007 -5131
- package/dist/index.js +6006 -5129
- package/dist/plugin/TableColumnSetting/index.d.ts +64 -0
- package/dist/plugin/TableColumnSetting/utils.d.ts +1 -0
- package/dist/utils/LocalstorageUtils.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.md +21 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +4 -1
- package/src/components/Functional/AddSelect/index.md +2 -1
- package/src/components/Functional/AddSelect/index.tsx +251 -173
- package/src/components/Functional/BillEntry/index.tsx +129 -33
- package/src/index.ts +1 -1
- package/src/plugin/TableColumnSetting/index.less +247 -0
- package/src/plugin/TableColumnSetting/index.md +50 -0
- package/src/plugin/TableColumnSetting/index.tsx +724 -0
- package/src/plugin/TableColumnSetting/utils.ts +19 -0
- package/src/utils/LocalstorageUtils.ts +33 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { setConfigTableColumns, getConfigTableColumns } from '@/utils/LocalstorageUtils';
|
|
2
|
+
|
|
3
|
+
export const setInitialShowColumn = (tableCode: string, columns: any[], callback: any) => {
|
|
4
|
+
// 获取当前列表定义数据
|
|
5
|
+
let columnConfig = getConfigTableColumns(tableCode);
|
|
6
|
+
let showColumns = columnConfig.length ? columnConfig.map((item: any) => {
|
|
7
|
+
let inner = columns.filter(innerItem => (
|
|
8
|
+
innerItem.dataIndex && innerItem.dataIndex === item.dataIndex
|
|
9
|
+
) || (innerItem.key && innerItem.key === item.key))[0];
|
|
10
|
+
return {
|
|
11
|
+
...inner,
|
|
12
|
+
...item,
|
|
13
|
+
}
|
|
14
|
+
}).filter((item: any) => !item.hidden)
|
|
15
|
+
:
|
|
16
|
+
(columns || []).filter((item: any) => !item.hidden);
|
|
17
|
+
|
|
18
|
+
callback(showColumns)
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ENUM from '@/utils/enumConfig';
|
|
2
|
+
|
|
3
|
+
// 存储表头
|
|
4
|
+
export const setConfigTableColumns = (configvalue: any, tableCode:string) => {
|
|
5
|
+
let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]'
|
|
6
|
+
let configArray = JSON.parse(config)
|
|
7
|
+
let currentSetting = configArray.filter((item:any) => item.code === tableCode)
|
|
8
|
+
if (currentSetting.length) {
|
|
9
|
+
currentSetting[0].detail = JSON.stringify(configvalue)
|
|
10
|
+
} else {
|
|
11
|
+
configArray.push({
|
|
12
|
+
"code": tableCode,
|
|
13
|
+
"detail": JSON.stringify(configvalue)
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
localStorage.setItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION, JSON.stringify(configArray))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 取表头
|
|
21
|
+
export const getConfigTableColumns = (tableCode: string) => {
|
|
22
|
+
if (!tableCode) return [];
|
|
23
|
+
let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
|
|
24
|
+
let configArray = JSON.parse(config);
|
|
25
|
+
let configSetting = configArray.filter(
|
|
26
|
+
(item:any) => item.code === tableCode,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (configSetting.length) {
|
|
30
|
+
return JSON.parse(configSetting[0].detail || '[]');
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
};
|