zy-react-library 1.1.0 → 1.1.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/README.md +5 -1
- package/components/Cascader/Area/index.js +11 -11
- package/components/Cascader/Basic/index.js +23 -30
- package/components/Cascader/Dictionary/index.js +42 -42
- package/components/Cascader/Industry/index.js +12 -11
- package/components/Editor/index.js +43 -63
- package/components/FormBuilder/FormBuilder.js +97 -87
- package/components/FormBuilder/FormItemsRenderer.js +579 -581
- package/components/FormBuilder/index.js +5 -3
- package/components/HeaderBack/index.js +39 -32
- package/components/HiddenInfo/gwj/index.js +507 -439
- package/components/Icon/AddIcon/index.js +6 -6
- package/components/Icon/BackIcon/index.js +6 -6
- package/components/Icon/DeleteIcon/index.js +6 -6
- package/components/Icon/DownloadIcon/index.js +6 -6
- package/components/Icon/EditIcon/index.js +6 -6
- package/components/Icon/ExportIcon/index.js +6 -6
- package/components/Icon/ImportIcon/index.js +6 -6
- package/components/Icon/LocationIcon/index.js +6 -6
- package/components/Icon/PrintIcon/index.js +6 -6
- package/components/Icon/ResetIcon/index.js +6 -6
- package/components/Icon/SearchIcon/index.js +6 -6
- package/components/Icon/VideoIcon/index.js +6 -6
- package/components/Icon/ViewIcon/index.js +6 -6
- package/components/ImportFile/index.js +94 -91
- package/components/LeftTree/Area/index.js +15 -15
- package/components/LeftTree/Basic/index.js +54 -65
- package/components/LeftTree/Department/Gwj/index.js +29 -32
- package/components/LeftTree/Dictionary/index.js +42 -42
- package/components/Map/MapSelector.js +280 -254
- package/components/Map/index.js +90 -77
- package/components/Page/index.d.ts +2 -0
- package/components/Page/index.js +44 -34
- package/components/Pdf/index.js +92 -90
- package/components/PreviewImg/index.js +26 -32
- package/components/PreviewPdf/index.js +78 -86
- package/components/Search/index.js +147 -141
- package/components/Select/Basic/index.js +70 -76
- package/components/Select/Dictionary/index.js +42 -42
- package/components/Select/Personnel/Gwj/index.js +45 -49
- package/components/SelectCreate/index.js +33 -40
- package/components/SelectTree/Area/index.js +11 -17
- package/components/SelectTree/Basic/index.js +105 -102
- package/components/SelectTree/Department/Gwj/index.js +40 -46
- package/components/SelectTree/Dictionary/index.js +42 -42
- package/components/SelectTree/HiddenLevel/Gwj/index.js +33 -35
- package/components/SelectTree/HiddenPart/Gwj/index.js +16 -19
- package/components/SelectTree/Industry/index.js +12 -18
- package/components/Signature/index.js +68 -62
- package/components/Table/index.js +77 -73
- package/components/Table/index.less +7 -1
- package/components/TooltipPreviewImg/index.js +28 -27
- package/components/Upload/index.js +229 -275
- package/components/Video/AliPlayer.js +182 -160
- package/components/Video/index.js +71 -90
- package/css/common.less +4 -0
- package/enum/dictionary/index.js +5 -3
- package/enum/formItemRender/index.js +37 -35
- package/enum/hidden/gwj/index.js +65 -26
- package/enum/uploadFile/gwj/index.js +166 -84
- package/hooks/useDeleteFile/index.js +24 -30
- package/hooks/useDictionary/index.js +28 -30
- package/hooks/useDownloadBlob/index.js +78 -77
- package/hooks/useDownloadFile/index.js +76 -79
- package/hooks/useGetFile/index.js +32 -32
- package/hooks/useGetUrlQuery/index.js +1 -2
- package/hooks/useGetUserInfo/index.js +19 -26
- package/hooks/useIdle/index.js +9 -11
- package/hooks/useImportFile/index.js +30 -28
- package/hooks/useIsExistenceDuplicateSelection/index.js +25 -18
- package/hooks/useTable/index.js +49 -38
- package/hooks/useUploadFile/index.js +142 -147
- package/hooks/useUrlQueryCriteria/index.js +20 -13
- package/package.json +14 -1
- package/regular/index.js +34 -39
- package/utils/index.js +515 -511
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import {
|
|
3
|
-
import { DICTIONARY_APP_KEY_ENUM } from
|
|
4
|
-
import BasicSelectTree from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
setTreeData(data);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
DictionarySelectTree.displayName = "DictionarySelectTree";
|
|
41
|
-
|
|
42
|
-
export default
|
|
1
|
+
import { request } from '@cqsjjb/jjb-common-lib/http';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { DICTIONARY_APP_KEY_ENUM } from '../../../enum/dictionary/index.js';
|
|
4
|
+
import BasicSelectTree from '../Basic/index.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function DictionarySelectTree(props) {
|
|
8
|
+
const {
|
|
9
|
+
appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT,
|
|
10
|
+
dictValue = "",
|
|
11
|
+
nameKey = "dictLabel",
|
|
12
|
+
idKey = "dictValue",
|
|
13
|
+
...restProps
|
|
14
|
+
} = props;
|
|
15
|
+
const [treeData, setTreeData] = useState([]);
|
|
16
|
+
const getData = async () => {
|
|
17
|
+
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
|
18
|
+
console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setTreeData([]);
|
|
22
|
+
const {
|
|
23
|
+
data
|
|
24
|
+
} = await request("/config/dict-trees/list/by/dictValues", "get", {
|
|
25
|
+
appKey,
|
|
26
|
+
dictValue
|
|
27
|
+
});
|
|
28
|
+
setTreeData(data);
|
|
29
|
+
};
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
dictValue && getData();
|
|
32
|
+
}, [dictValue]);
|
|
33
|
+
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
34
|
+
treeData: treeData,
|
|
35
|
+
nameKey: nameKey,
|
|
36
|
+
idKey: idKey,
|
|
37
|
+
...restProps
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
DictionarySelectTree.displayName = "DictionarySelectTree";
|
|
41
|
+
|
|
42
|
+
export { DictionarySelectTree as default };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import {
|
|
3
|
-
import { DICTIONARY_APP_KEY_ENUM } from
|
|
4
|
-
import BasicSelectTree from
|
|
1
|
+
import { request } from '@cqsjjb/jjb-common-lib/http';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { DICTIONARY_APP_KEY_ENUM } from '../../../../enum/dictionary/index.js';
|
|
4
|
+
import BasicSelectTree from '../../Basic/index.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
/**
|
|
7
|
-
* 隐患级别下拉树组件(港务局版本)
|
|
8
|
-
*/
|
|
9
7
|
function HiddenLevelSelectTree(props) {
|
|
10
8
|
const {
|
|
11
9
|
isShowNeglect = true,
|
|
@@ -13,60 +11,60 @@ function HiddenLevelSelectTree(props) {
|
|
|
13
11
|
isShowMajor = true,
|
|
14
12
|
...restProps
|
|
15
13
|
} = props;
|
|
16
|
-
|
|
17
14
|
const [treeData, setTreeData] = useState([]);
|
|
18
15
|
|
|
19
16
|
// 过滤隐患级别的树数据
|
|
20
|
-
const filterTreeData =
|
|
17
|
+
const filterTreeData = treeData => {
|
|
21
18
|
// 隐患级别的特定ID
|
|
22
19
|
const HIDDEN_LEVEL_IDS = {
|
|
23
|
-
neglect: "hiddenLevel1001",
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
neglect: "hiddenLevel1001",
|
|
21
|
+
// 忽略隐患
|
|
22
|
+
larger: "jdyh001",
|
|
23
|
+
// 较大隐患
|
|
24
|
+
major: "hiddenLevel0002" // 重大隐患
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
// 递归过滤树数据
|
|
29
|
-
const filterTree =
|
|
30
|
-
if (!nodes || !Array.isArray(nodes))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return nodes.filter((node) => {
|
|
28
|
+
const filterTree = nodes => {
|
|
29
|
+
if (!nodes || !Array.isArray(nodes)) return [];
|
|
30
|
+
return nodes.filter(node => {
|
|
34
31
|
// 根据不同的ID和对应的props来决定是否显示
|
|
35
|
-
if (node.dictValue === HIDDEN_LEVEL_IDS.neglect)
|
|
36
|
-
|
|
37
|
-
if (node.dictValue === HIDDEN_LEVEL_IDS.
|
|
38
|
-
return isShowLarger;
|
|
39
|
-
if (node.dictValue === HIDDEN_LEVEL_IDS.major)
|
|
40
|
-
return isShowMajor;
|
|
32
|
+
if (node.dictValue === HIDDEN_LEVEL_IDS.neglect) return isShowNeglect;
|
|
33
|
+
if (node.dictValue === HIDDEN_LEVEL_IDS.larger) return isShowLarger;
|
|
34
|
+
if (node.dictValue === HIDDEN_LEVEL_IDS.major) return isShowMajor;
|
|
41
35
|
|
|
42
36
|
// 如果有子节点,递归过滤子节点
|
|
43
|
-
if (node.children && node.children.length > 0)
|
|
44
|
-
node.children = filterTree(node.children);
|
|
37
|
+
if (node.children && node.children.length > 0) node.children = filterTree(node.children);
|
|
45
38
|
|
|
46
39
|
// 默认显示其他节点
|
|
47
40
|
return true;
|
|
48
41
|
});
|
|
49
42
|
};
|
|
50
|
-
|
|
51
43
|
return filterTree(treeData);
|
|
52
44
|
};
|
|
53
|
-
|
|
54
45
|
const getData = async () => {
|
|
55
46
|
setTreeData([]);
|
|
56
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
data
|
|
49
|
+
} = await request("/config/dict-trees/list/by/dictValues", "get", {
|
|
50
|
+
appKey: DICTIONARY_APP_KEY_ENUM.GWJ,
|
|
51
|
+
dictValue: "hiddenLevel"
|
|
52
|
+
});
|
|
57
53
|
const filterData = filterTreeData(data);
|
|
58
54
|
setTreeData(filterData);
|
|
59
55
|
};
|
|
60
|
-
|
|
61
56
|
useEffect(() => {
|
|
62
57
|
getData();
|
|
63
58
|
}, []);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
60
|
+
treeData: treeData,
|
|
61
|
+
placeholder: "\u9690\u60A3\u7EA7\u522B",
|
|
62
|
+
onlyLastLevel: true,
|
|
63
|
+
nameKey: "dictLabel",
|
|
64
|
+
idKey: "dictValue",
|
|
65
|
+
...restProps
|
|
66
|
+
});
|
|
68
67
|
}
|
|
69
|
-
|
|
70
68
|
HiddenLevelSelectTree.displayName = "HiddenLevelSelectTree";
|
|
71
69
|
|
|
72
|
-
export default
|
|
70
|
+
export { HiddenLevelSelectTree as default };
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import {
|
|
3
|
-
import BasicSelectTree from
|
|
1
|
+
import { request } from '@cqsjjb/jjb-common-lib/http';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import BasicSelectTree from '../../Basic/index.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* 隐患部位下拉树组件(港务局版本)
|
|
7
|
-
*/
|
|
8
6
|
function HiddenPartSelectTree(props) {
|
|
9
7
|
const {
|
|
10
8
|
params = {},
|
|
11
9
|
isNeedCorpInfoId = false,
|
|
12
10
|
...restProps
|
|
13
11
|
} = props;
|
|
14
|
-
|
|
15
12
|
const [treeData, setTreeData] = useState([]);
|
|
16
|
-
|
|
17
13
|
const getData = async () => {
|
|
18
14
|
setTreeData([]);
|
|
19
15
|
|
|
20
16
|
// 根据参数决定是否发送请求
|
|
21
|
-
if (isNeedCorpInfoId && !params.eqCorpinfoId)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
if (isNeedCorpInfoId && !params.eqCorpinfoId) return;
|
|
18
|
+
const {
|
|
19
|
+
data
|
|
20
|
+
} = await request("/hidden/hiddenRegion/listByTree", "post", params);
|
|
25
21
|
setTreeData(data);
|
|
26
22
|
};
|
|
27
|
-
|
|
28
23
|
useEffect(() => {
|
|
29
24
|
getData();
|
|
30
25
|
}, [JSON.stringify(params), isNeedCorpInfoId]);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
27
|
+
treeData: treeData,
|
|
28
|
+
placeholder: "\u9690\u60A3\u90E8\u4F4D",
|
|
29
|
+
nameKey: "hiddenregion",
|
|
30
|
+
idKey: "hiddenregionId",
|
|
31
|
+
...restProps
|
|
32
|
+
});
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
HiddenPartSelectTree.displayName = "HiddenPartSelectTree";
|
|
38
35
|
|
|
39
|
-
export default
|
|
36
|
+
export { HiddenPartSelectTree as default };
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import Industry from
|
|
2
|
-
import BasicSelectTree from
|
|
1
|
+
import Industry from '../../../json/industry.json';
|
|
2
|
+
import BasicSelectTree from '../Basic/index.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
* 行业类型下拉树组件
|
|
6
|
-
*/
|
|
7
5
|
function IndustrySelectTree(props) {
|
|
8
6
|
const {
|
|
9
7
|
placeholder = "行业类型",
|
|
10
8
|
...restProps
|
|
11
9
|
} = props;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{...restProps}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
10
|
+
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
11
|
+
treeData: Industry,
|
|
12
|
+
placeholder: placeholder,
|
|
13
|
+
nameKey: "dict_label",
|
|
14
|
+
idKey: "dict_value",
|
|
15
|
+
childrenKey: "childrenList",
|
|
16
|
+
...restProps
|
|
17
|
+
});
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
IndustrySelectTree.displayName = "IndustrySelectTree";
|
|
26
20
|
|
|
27
|
-
export default
|
|
21
|
+
export { IndustrySelectTree as default };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Button, Image,
|
|
2
|
-
import dayjs from
|
|
3
|
-
import {
|
|
4
|
-
import SignatureCanvas from
|
|
5
|
-
import { base642File } from
|
|
1
|
+
import { Button, Image, Modal, message } from 'antd';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import SignatureCanvas from 'react-signature-canvas';
|
|
5
|
+
import { base642File } from '../../utils/index.js';
|
|
6
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* 签字组件
|
|
9
|
-
*/
|
|
10
8
|
function Signature(props) {
|
|
11
9
|
const {
|
|
12
10
|
onConfirm,
|
|
@@ -15,14 +13,12 @@ function Signature(props) {
|
|
|
15
13
|
url = "",
|
|
16
14
|
...restProps
|
|
17
15
|
} = props;
|
|
18
|
-
|
|
19
16
|
const [signatureModalOpen, setSignatureModalOpen] = useState(false);
|
|
20
17
|
const signatureCanvas = useRef(null);
|
|
21
18
|
const [base64, setBase64] = useState("");
|
|
22
19
|
useEffect(() => {
|
|
23
20
|
setBase64(url);
|
|
24
21
|
}, [url]);
|
|
25
|
-
|
|
26
22
|
const onOk = () => {
|
|
27
23
|
if (signatureCanvas.current.isEmpty()) {
|
|
28
24
|
message.warning("请签名");
|
|
@@ -33,62 +29,72 @@ function Signature(props) {
|
|
|
33
29
|
onConfirm({
|
|
34
30
|
time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
35
31
|
base64,
|
|
36
|
-
file: base642File(base64)
|
|
32
|
+
file: base642File(base64)
|
|
37
33
|
});
|
|
38
34
|
signatureCanvas.current.clear();
|
|
39
35
|
setSignatureModalOpen(false);
|
|
40
36
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
37
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
38
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
39
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
40
|
+
type: "primary",
|
|
41
|
+
onClick: () => {
|
|
42
|
+
setSignatureModalOpen(true);
|
|
43
|
+
},
|
|
44
|
+
children: base64 ? "重新签字" : "手写签字"
|
|
45
|
+
})
|
|
46
|
+
}), base64 && /*#__PURE__*/jsx("div", {
|
|
47
|
+
style: {
|
|
48
|
+
border: "1px dashed #d9d9d9",
|
|
49
|
+
width,
|
|
50
|
+
height,
|
|
51
|
+
marginTop: 16
|
|
52
|
+
},
|
|
53
|
+
children: /*#__PURE__*/jsx(Image, {
|
|
54
|
+
src: base64,
|
|
55
|
+
style: {
|
|
56
|
+
width,
|
|
57
|
+
height,
|
|
58
|
+
objectFit: "contain"
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/jsx(Modal, {
|
|
62
|
+
title: "\u7B7E\u5B57",
|
|
63
|
+
width: 800,
|
|
64
|
+
open: signatureModalOpen,
|
|
65
|
+
maskClosable: false,
|
|
66
|
+
onCancel: () => setSignatureModalOpen(false),
|
|
67
|
+
footer: [/*#__PURE__*/jsx(Button, {
|
|
68
|
+
onClick: () => signatureCanvas.current.clear(),
|
|
69
|
+
children: "\u91CD\u7B7E"
|
|
70
|
+
}, "clear"), /*#__PURE__*/jsx(Button, {
|
|
71
|
+
onClick: () => {
|
|
72
|
+
setSignatureModalOpen(false);
|
|
73
|
+
signatureCanvas.current.clear();
|
|
74
|
+
},
|
|
75
|
+
children: "\u53D6\u6D88"
|
|
76
|
+
}, "cancel"), /*#__PURE__*/jsx(Button, {
|
|
77
|
+
type: "primary",
|
|
78
|
+
onClick: onOk,
|
|
79
|
+
children: "\u786E\u5B9A"
|
|
80
|
+
}, "ok")],
|
|
81
|
+
children: /*#__PURE__*/jsx("div", {
|
|
82
|
+
style: {
|
|
83
|
+
border: "1px dashed #d9d9d9"
|
|
84
|
+
},
|
|
85
|
+
children: /*#__PURE__*/jsx(SignatureCanvas, {
|
|
86
|
+
ref: signatureCanvas,
|
|
87
|
+
penColor: "black",
|
|
88
|
+
canvasProps: {
|
|
89
|
+
width,
|
|
90
|
+
height
|
|
91
|
+
},
|
|
92
|
+
...restProps
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
90
97
|
}
|
|
91
|
-
|
|
92
98
|
Signature.displayName = "Signature";
|
|
93
99
|
|
|
94
|
-
export default
|
|
100
|
+
export { Signature as default };
|
|
@@ -1,73 +1,77 @@
|
|
|
1
|
-
import TablePro from
|
|
2
|
-
import { getIndexColumn } from
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...column
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return columns.map(setAlign);
|
|
63
|
-
}
|
|
64
|
-
return (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import TablePro from '@cqsjjb/jjb-react-admin-component/Table';
|
|
2
|
+
import { getIndexColumn } from '../../utils/index.js';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import './index.less';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const CLEANUP_INTERVAL_DAYS = 10; // 清理间隔天数
|
|
8
|
+
const LAST_CLEANUP_KEY = 'tableLocalStorageLastCleanup'; // 最后清理时间存储key
|
|
9
|
+
|
|
10
|
+
// 清理本地存储中特定后缀的key
|
|
11
|
+
function cleanupTableLocalStorage() {
|
|
12
|
+
const now = dayjs();
|
|
13
|
+
const lastCleanupStr = localStorage.getItem(LAST_CLEANUP_KEY);
|
|
14
|
+
const lastCleanup = lastCleanupStr ? dayjs(lastCleanupStr) : null;
|
|
15
|
+
|
|
16
|
+
// 如果没有上次清理时间或距离上次清理已超过10天
|
|
17
|
+
if (!lastCleanup || now.diff(lastCleanup, 'day') >= CLEANUP_INTERVAL_DAYS) {
|
|
18
|
+
// 查找并清理符合条件的key
|
|
19
|
+
const keysToRemove = [];
|
|
20
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
21
|
+
const key = localStorage.key(i);
|
|
22
|
+
if (key && (key.endsWith('#columnState') || key.endsWith('#size') || key.endsWith('#resizable'))) {
|
|
23
|
+
keysToRemove.push(key);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 删除匹配的key
|
|
28
|
+
keysToRemove.forEach(key => {
|
|
29
|
+
localStorage.removeItem(key);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// 更新最后清理时间
|
|
33
|
+
localStorage.setItem(LAST_CLEANUP_KEY, now.toISOString());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function Table(props) {
|
|
37
|
+
const {
|
|
38
|
+
columns = [],
|
|
39
|
+
showIndexColumn = true,
|
|
40
|
+
ellipsis = true,
|
|
41
|
+
align = "center",
|
|
42
|
+
indexColumnFixed = "left",
|
|
43
|
+
rowKey = "id",
|
|
44
|
+
...restProps
|
|
45
|
+
} = props;
|
|
46
|
+
|
|
47
|
+
// 组件初始化时执行清理
|
|
48
|
+
cleanupTableLocalStorage();
|
|
49
|
+
function settingColumns() {
|
|
50
|
+
showIndexColumn && columns.unshift({
|
|
51
|
+
...getIndexColumn(props.pagination),
|
|
52
|
+
fixed: indexColumnFixed
|
|
53
|
+
});
|
|
54
|
+
const setAlign = column => ({
|
|
55
|
+
align,
|
|
56
|
+
ellipsis,
|
|
57
|
+
...column,
|
|
58
|
+
...(column.children ? {
|
|
59
|
+
children: column.children.map(setAlign)
|
|
60
|
+
} : {})
|
|
61
|
+
});
|
|
62
|
+
return columns.map(setAlign);
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/jsx("div", {
|
|
65
|
+
className: "table-layout card-layout",
|
|
66
|
+
children: /*#__PURE__*/jsx(TablePro, {
|
|
67
|
+
rowKey: rowKey,
|
|
68
|
+
columns: settingColumns(),
|
|
69
|
+
bordered: true,
|
|
70
|
+
size: "small",
|
|
71
|
+
...restProps
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
Table.displayName = "Table";
|
|
76
|
+
|
|
77
|
+
export { Table as default };
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.@{ant-prefix}-pro-table-list-toolbar-container {
|
|
12
|
-
padding-top:
|
|
12
|
+
padding-top: 0 !important;
|
|
13
13
|
padding-bottom: 16px;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
.search-layout {
|
|
17
|
+
+ .table-layout .@{ant-prefix}-pro-table-list-toolbar-container {
|
|
18
|
+
padding-top: 26px !important;
|
|
19
|
+
}
|
|
20
|
+
}
|