zy-react-library 1.1.1 → 1.1.3

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.
Files changed (75) hide show
  1. package/README.md +5 -1
  2. package/components/Cascader/Area/index.js +1 -20
  3. package/components/Cascader/Basic/index.js +1 -64
  4. package/components/Cascader/Dictionary/index.js +1 -42
  5. package/components/Cascader/Industry/index.js +1 -20
  6. package/components/Editor/index.js +1 -102
  7. package/components/FormBuilder/FormBuilder.js +1 -87
  8. package/components/FormBuilder/FormItemsRenderer.js +1 -591
  9. package/components/FormBuilder/index.js +1 -3
  10. package/components/HeaderBack/index.js +1 -37
  11. package/components/HiddenInfo/gwj/index.js +1 -518
  12. package/components/Icon/AddIcon/index.js +1 -9
  13. package/components/Icon/BackIcon/index.js +1 -9
  14. package/components/Icon/DeleteIcon/index.js +1 -9
  15. package/components/Icon/DownloadIcon/index.js +1 -9
  16. package/components/Icon/EditIcon/index.js +1 -9
  17. package/components/Icon/ExportIcon/index.js +1 -9
  18. package/components/Icon/ImportIcon/index.js +1 -9
  19. package/components/Icon/LocationIcon/index.js +1 -9
  20. package/components/Icon/PrintIcon/index.js +1 -9
  21. package/components/Icon/ResetIcon/index.js +1 -9
  22. package/components/Icon/SearchIcon/index.js +1 -9
  23. package/components/Icon/VideoIcon/index.js +1 -9
  24. package/components/Icon/ViewIcon/index.js +1 -9
  25. package/components/ImportFile/index.js +1 -91
  26. package/components/LeftTree/Area/index.js +1 -15
  27. package/components/LeftTree/Basic/index.js +1 -171
  28. package/components/LeftTree/Department/Gwj/index.js +1 -32
  29. package/components/LeftTree/Dictionary/index.js +1 -42
  30. package/components/Map/MapSelector.js +1 -254
  31. package/components/Map/index.js +1 -77
  32. package/components/Page/index.js +1 -50
  33. package/components/Pdf/index.js +1 -134
  34. package/components/PreviewImg/index.js +1 -32
  35. package/components/PreviewPdf/index.js +1 -86
  36. package/components/Search/index.js +1 -141
  37. package/components/Select/Basic/index.js +1 -76
  38. package/components/Select/Dictionary/index.js +1 -42
  39. package/components/Select/Personnel/Gwj/index.js +1 -49
  40. package/components/SelectCreate/index.js +1 -55
  41. package/components/SelectTree/Area/index.js +1 -26
  42. package/components/SelectTree/Basic/index.js +1 -102
  43. package/components/SelectTree/Department/Gwj/index.js +1 -46
  44. package/components/SelectTree/Dictionary/index.js +1 -42
  45. package/components/SelectTree/HiddenLevel/Gwj/index.js +1 -72
  46. package/components/SelectTree/HiddenPart/Gwj/index.js +1 -39
  47. package/components/SelectTree/Industry/index.js +1 -27
  48. package/components/Signature/index.js +1 -94
  49. package/components/Table/index.js +1 -73
  50. package/components/Table/index.less +7 -1
  51. package/components/TooltipPreviewImg/index.js +1 -27
  52. package/components/Upload/index.js +1 -275
  53. package/components/Video/AliPlayer.js +1 -160
  54. package/components/Video/index.js +1 -90
  55. package/css/common.less +4 -0
  56. package/enum/dictionary/index.js +1 -7
  57. package/enum/formItemRender/index.js +1 -37
  58. package/enum/hidden/gwj/index.js +1 -31
  59. package/enum/uploadFile/gwj/index.js +1 -176
  60. package/hooks/useDeleteFile/index.js +1 -101
  61. package/hooks/useDictionary/index.js +1 -66
  62. package/hooks/useDownloadBlob/index.js +1 -79
  63. package/hooks/useDownloadFile/index.js +1 -81
  64. package/hooks/useGetFile/index.js +1 -74
  65. package/hooks/useGetUrlQuery/index.js +1 -16
  66. package/hooks/useGetUserInfo/index.js +1 -49
  67. package/hooks/useIdle/index.js +1 -67
  68. package/hooks/useImportFile/index.js +1 -59
  69. package/hooks/useIsExistenceDuplicateSelection/index.js +1 -20
  70. package/hooks/useTable/index.js +1 -113
  71. package/hooks/useUploadFile/index.js +1 -149
  72. package/hooks/useUrlQueryCriteria/index.js +1 -77
  73. package/package.json +18 -1
  74. package/regular/index.js +1 -61
  75. package/utils/index.js +1 -587
@@ -1,49 +1 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useEffect, useState } from "react";
3
- import BasicSelect from "../../Basic";
4
-
5
- /**
6
- * 人员下拉组件(港务局版本)
7
- */
8
- function PersonnelSelect(props) {
9
- const {
10
- params = {},
11
- placeholder = "人员",
12
- isNeedCorpInfoId = false,
13
- isNeedDepartmentId = true,
14
- isNeedPostId = false,
15
- extraParams = {
16
- noMain: "",
17
- eqEmploymentFlag: 1,
18
- },
19
- ...restProps
20
- } = props;
21
-
22
- const [data, setData] = useState([]);
23
-
24
- const getData = async () => {
25
- setData([]);
26
- // 根据参数决定是否发送请求
27
- if (isNeedCorpInfoId && !params.corpinfoId)
28
- return;
29
- if (isNeedDepartmentId && !params.departmentId)
30
- return;
31
- if (isNeedPostId && !params.postId)
32
- return;
33
-
34
- const { data } = await request("/basicInfo/user/listAll", "get", { ...params, ...extraParams });
35
- setData(data);
36
- };
37
-
38
- useEffect(() => {
39
- getData();
40
- }, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId, JSON.stringify(extraParams)]);
41
-
42
- return (
43
- <BasicSelect data={data} placeholder={placeholder} {...restProps} />
44
- );
45
- }
46
-
47
- PersonnelSelect.displayName = "PersonnelSelect";
48
-
49
- export default PersonnelSelect;
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as t,useEffect as r}from"react";import a from"../../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function i(i){const{params:n={},placeholder:s="人员",isNeedCorpInfoId:m=!1,isNeedDepartmentId:d=!0,isNeedPostId:p=!1,extraParams:c={noMain:"",eqEmploymentFlag:1},...f}=i,[l,u]=t([]);return r(()=>{(async()=>{if(u([]),m&&!n.corpinfoId)return;if(d&&!n.departmentId)return;if(p&&!n.postId)return;const{data:t}=await e("/basicInfo/user/listAll","get",{...n,...c});u(t)})()},[JSON.stringify(n),m,d,p,JSON.stringify(c)]),o(a,{data:l,placeholder:s,...f})}i.displayName="PersonnelSelect";export{i as default};
@@ -1,55 +1 @@
1
- import { CloseCircleOutlined } from "@ant-design/icons";
2
- import { Select } from "antd";
3
-
4
- /**
5
- * 可创建选项的选择器组件
6
- */
7
- function SelectCreate(props) {
8
- const {
9
- items,
10
- showDelete = true,
11
- label = "",
12
- maxCount = 1,
13
- onDelete,
14
- ...restProps
15
- } = props;
16
-
17
- const handlerDelete = (option) => {
18
- onDelete?.(option);
19
- };
20
-
21
- return (
22
- <Select
23
- mode="tags"
24
- maxCount={maxCount}
25
- placeholder={`请选择${label},无对应选项可直接输入创建选项`}
26
- optionRender={option => (
27
- <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
28
- <span>{option.label}</span>
29
- {
30
- showDelete && (
31
- <CloseCircleOutlined
32
- style={{ marginRight: 10 }}
33
- onClick={(e) => {
34
- e.stopPropagation();
35
- handlerDelete(option);
36
- }}
37
- />
38
- )
39
- }
40
- </div>
41
- )}
42
- {...restProps}
43
- >
44
- {
45
- items.map(item => (
46
- <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>
47
- ))
48
- }
49
- </Select>
50
- );
51
- }
52
-
53
- SelectCreate.displayName = "SelectCreate";
54
-
55
- export default SelectCreate;
1
+ import{CloseCircleOutlined as e}from"@ant-design/icons";import{Select as t}from"antd";import{jsx as n,jsxs as i}from"react/jsx-runtime";function a(a){const{items:o,showDelete:l=!0,label:r="",maxCount:s=1,onDelete:m,...d}=a;return n(t,{mode:"tags",maxCount:s,placeholder:`请选择${r},无对应选项可直接输入创建选项`,optionRender:t=>i("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n("span",{children:t.label}),l&&n(e,{style:{marginRight:10},onClick:e=>{e.stopPropagation(),(e=>{m?.(e)})(t)}})]}),...d,children:o.map(e=>n(t.Option,{value:e.id,children:e.name},e.id))})}a.displayName="SelectCreate";export{a as default};
@@ -1,26 +1 @@
1
- import Area from "../../../json/area.json";
2
- import BasicSelectTree from "../Basic";
3
-
4
- /**
5
- * 属地下拉树组件
6
- */
7
- function AreaSelectTree(props) {
8
- const {
9
- placeholder = "属地",
10
- ...restProps
11
- } = props;
12
-
13
- return (
14
- <BasicSelectTree
15
- treeData={Area}
16
- placeholder={placeholder}
17
- nameKey="label"
18
- idKey="value"
19
- {...restProps}
20
- />
21
- );
22
- }
23
-
24
- AreaSelectTree.displayName = "AreaSelectTree";
25
-
26
- export default AreaSelectTree;
1
+ import e from"../../../json/area.json";import r from"../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function o(o){const{placeholder:t="属地",...l}=o;return a(r,{treeData:e,placeholder:t,nameKey:"label",idKey:"value",...l})}o.displayName="AreaSelectTree";export{o as default};
@@ -1,102 +1 @@
1
- import { TreeSelect } from "antd";
2
- import { useEffect } from "react";
3
- import { arrayObjectDeduplication, getDataType, getTreeNodePaths, processTreeDataByLevel, processTreeDataForOnlyLastLevel } from "../../../utils";
4
-
5
- /**
6
- * 基础下拉树组件(不建议直接使用此组件,二次继承使用)
7
- */
8
- function BasicSelectTree(props) {
9
- const {
10
- onGetData,
11
- onChange,
12
- onGetLabel,
13
- onGetNodePaths,
14
- onGetNodePathsIsIncludeOneself = true,
15
- placeholder = "",
16
- treeData = [],
17
- nameKey = "name",
18
- idKey = "id",
19
- childrenKey = "children",
20
- level,
21
- onlyLastLevel = false,
22
- ...restProps
23
- } = props;
24
-
25
- // 根据 level 处理树数据
26
- let processedTreeData = level
27
- ? processTreeDataByLevel({
28
- data: treeData,
29
- level,
30
- childrenKey,
31
- currentLevel: 1,
32
- })
33
- : treeData;
34
-
35
- // 根据 onlyLastLevel 处理树数据
36
- processedTreeData = processTreeDataForOnlyLastLevel({ data: processedTreeData, childrenKey, onlyLastLevel });
37
-
38
- const handleChange = (value, label, extra) => {
39
- if (value) {
40
- if (getDataType(value) === "Array") {
41
- const parentNodes = [];
42
- for (let i = 0; i < value.length; i++) {
43
- const targetId = (restProps.labelInValue || restProps.treeCheckStrictly) ? value[i].value : value[i];
44
- const currentParentNodes = getTreeNodePaths({
45
- data: treeData,
46
- targetId,
47
- idKey,
48
- childrenKey,
49
- isIncludeOneself: onGetNodePathsIsIncludeOneself,
50
- });
51
- parentNodes.push(...currentParentNodes);
52
- }
53
- const deduplicationParentNodes = arrayObjectDeduplication(parentNodes, idKey);
54
- onGetNodePaths?.(deduplicationParentNodes);
55
- onGetLabel?.((restProps.labelInValue || restProps.treeCheckStrictly) ? value.map(item => item.label) : label);
56
- }
57
- else {
58
- const targetId = (restProps.labelInValue || restProps.treeCheckStrictly) ? value.value : value;
59
- const parentNodes = getTreeNodePaths({
60
- data: treeData,
61
- targetId,
62
- idKey,
63
- childrenKey,
64
- isIncludeOneself: onGetNodePathsIsIncludeOneself,
65
- });
66
- onGetNodePaths?.(parentNodes);
67
- onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
68
- }
69
- }
70
- else {
71
- onGetNodePaths?.([]);
72
- onGetLabel?.("");
73
- }
74
- onChange?.((restProps.labelInValue || restProps.treeCheckStrictly) ? value.map(item => item.value) : value, label, extra);
75
- };
76
-
77
- useEffect(() => {
78
- onGetData?.(treeData, processedTreeData);
79
- }, [treeData, processedTreeData]);
80
-
81
- return (
82
- <TreeSelect
83
- showSearch
84
- style={{ width: "100%" }}
85
- styles={{
86
- popup: { root: { maxHeight: 400, overflow: "auto" } },
87
- }}
88
- placeholder={`请选择${placeholder}`}
89
- onChange={handleChange}
90
- allowClear
91
- treeData={processedTreeData}
92
- fieldNames={{ label: nameKey, value: idKey, children: childrenKey }}
93
- treeNodeFilterProp={nameKey}
94
- showCheckedStrategy={TreeSelect.SHOW_ALL}
95
- {...restProps}
96
- />
97
- );
98
- }
99
-
100
- BasicSelectTree.displayName = "BasicSelectTree";
101
-
102
- export default BasicSelectTree;
1
+ import{TreeSelect as e}from"antd";import{useEffect as l}from"react";import{processTreeDataByLevel as t,processTreeDataForOnlyLastLevel as a,getDataType as r,getTreeNodePaths as n,arrayObjectDeduplication as o}from"../../../utils/index.js";import{jsx as c}from"react/jsx-runtime";function i(i){const{onGetData:d,onChange:s,onGetLabel:h,onGetNodePaths:u,onGetNodePathsIsIncludeOneself:y=!0,placeholder:m="",treeData:p=[],nameKey:f="name",idKey:v="id",childrenKey:I="children",level:K,onlyLastLevel:g=!1,...C}=i;let L=K?t({data:p,level:K,childrenKey:I,currentLevel:1}):p;return L=a({data:L,childrenKey:I,onlyLastLevel:g}),l(()=>{d?.(p,L)},[p,L]),c(e,{showSearch:!0,style:{width:"100%"},styles:{popup:{root:{maxHeight:400,overflow:"auto"}}},placeholder:`请选择${m}`,onChange:(e,l,t)=>{if(e)if("Array"===r(e)){const t=[];for(let l=0;l<e.length;l++){const a=C.labelInValue||C.treeCheckStrictly?e[l].value:e[l],r=n({data:p,targetId:a,idKey:v,childrenKey:I,isIncludeOneself:y});t.push(...r)}const a=o(t,v);u?.(a),h?.(C.labelInValue||C.treeCheckStrictly?e.map(e=>e.label):l)}else{const l=C.labelInValue||C.treeCheckStrictly?e.value:e,t=n({data:p,targetId:l,idKey:v,childrenKey:I,isIncludeOneself:y});u?.(t),h?.(t[t.length-1][f])}else u?.([]),h?.("");s?.(C.labelInValue||C.treeCheckStrictly?e.map(e=>e.value):e,l,t)},allowClear:!0,treeData:L,fieldNames:{label:f,value:v,children:I},treeNodeFilterProp:f,showCheckedStrategy:e.SHOW_ALL,...C})}i.displayName="BasicSelectTree";export{i as default};
@@ -1,46 +1 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useEffect, useState } from "react";
3
- import BasicSelectTree from "../../Basic";
4
-
5
- /**
6
- * 部门下拉树组件(港务局版本)
7
- */
8
- function DepartmentSelectTree(props) {
9
- const {
10
- params = {},
11
- placeholder = "部门",
12
- isNeedCorpInfoId = false,
13
- isNeedParentId = false,
14
- searchType = "current",
15
- ...restProps
16
- } = props;
17
-
18
- const [treeData, setTreeData] = useState([]);
19
-
20
- const getData = async () => {
21
- setTreeData([]);
22
-
23
- if (searchType === "current") {
24
- // 根据参数决定是否发送请求
25
- if (isNeedCorpInfoId && !params.eqCorpinfoId)
26
- return;
27
- if (isNeedParentId && !params.eqParentId)
28
- return;
29
- }
30
-
31
- const { data } = await request(searchType === "current" ? "/basicInfo/department/listTree" : "/basicInfo/department/listAllTree", "post", params);
32
- setTreeData(data);
33
- };
34
-
35
- useEffect(() => {
36
- getData();
37
- }, [JSON.stringify(params), isNeedCorpInfoId, isNeedParentId, searchType]);
38
-
39
- return (
40
- <BasicSelectTree treeData={treeData} placeholder={placeholder} childrenKey="childrenList" {...restProps} />
41
- );
42
- }
43
-
44
- DepartmentSelectTree.displayName = "DepartmentSelectTree";
45
-
46
- export default DepartmentSelectTree;
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as r,useEffect as t}from"react";import a from"../../Basic/index.js";import{jsx as i}from"react/jsx-runtime";function n(n){const{params:o={},placeholder:c="部门",isNeedCorpInfoId:s=!1,isNeedParentId:p=!1,searchType:d="current",...m}=n,[f,l]=r([]);return t(()=>{(async()=>{if(l([]),"current"===d){if(s&&!o.eqCorpinfoId)return;if(p&&!o.eqParentId)return}const{data:r}=await e("current"===d?"/basicInfo/department/listTree":"/basicInfo/department/listAllTree","post",o);l(r)})()},[JSON.stringify(o),s,p,d]),i(a,{treeData:f,placeholder:c,childrenKey:"childrenList",...m})}n.displayName="DepartmentSelectTree";export{n as default};
@@ -1,42 +1 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useEffect, useState } from "react";
3
- import { DICTIONARY_APP_KEY_ENUM } from "../../../enum/dictionary";
4
- import BasicSelectTree from "../Basic";
5
-
6
- /**
7
- * 数据字典下拉树组件
8
- */
9
- function DictionarySelectTree(props) {
10
- const {
11
- appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT,
12
- dictValue = "",
13
- nameKey = "dictLabel",
14
- idKey = "dictValue",
15
- ...restProps
16
- } = props;
17
-
18
- const [treeData, setTreeData] = useState([]);
19
-
20
- const getData = async () => {
21
- if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
22
- console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");
23
- return;
24
- }
25
-
26
- setTreeData([]);
27
- const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
28
- setTreeData(data);
29
- };
30
-
31
- useEffect(() => {
32
- dictValue && getData();
33
- }, [dictValue]);
34
-
35
- return (
36
- <BasicSelectTree treeData={treeData} nameKey={nameKey} idKey={idKey} {...restProps} />
37
- );
38
- }
39
-
40
- DictionarySelectTree.displayName = "DictionarySelectTree";
41
-
42
- export default DictionarySelectTree;
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as a}from"../../../enum/dictionary/index.js";import r from"../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function c(c){const{appKey:n=a.DEFAULT,dictValue:m="",nameKey:d="dictLabel",idKey:s="dictValue",...p}=c,[l,u]=t([]);return i(()=>{m&&(async()=>{if(!Object.values(a).includes(n))return void console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");u([]);const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:n,dictValue:m});u(t)})()},[m]),o(r,{treeData:l,nameKey:d,idKey:s,...p})}c.displayName="DictionarySelectTree";export{c as default};
@@ -1,72 +1 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useEffect, useState } from "react";
3
- import { DICTIONARY_APP_KEY_ENUM } from "../../../../enum/dictionary";
4
- import BasicSelectTree from "../../Basic";
5
-
6
- /**
7
- * 隐患级别下拉树组件(港务局版本)
8
- */
9
- function HiddenLevelSelectTree(props) {
10
- const {
11
- isShowNeglect = true,
12
- isShowLarger = true,
13
- isShowMajor = true,
14
- ...restProps
15
- } = props;
16
-
17
- const [treeData, setTreeData] = useState([]);
18
-
19
- // 过滤隐患级别的树数据
20
- const filterTreeData = (treeData) => {
21
- // 隐患级别的特定ID
22
- const HIDDEN_LEVEL_IDS = {
23
- neglect: "hiddenLevel1001", // 忽略隐患
24
- larger: "jdyh001", // 较大隐患
25
- major: "hiddenLevel0002", // 重大隐患
26
- };
27
-
28
- // 递归过滤树数据
29
- const filterTree = (nodes) => {
30
- if (!nodes || !Array.isArray(nodes))
31
- return [];
32
-
33
- return nodes.filter((node) => {
34
- // 根据不同的ID和对应的props来决定是否显示
35
- if (node.dictValue === HIDDEN_LEVEL_IDS.neglect)
36
- return isShowNeglect;
37
- if (node.dictValue === HIDDEN_LEVEL_IDS.larger)
38
- return isShowLarger;
39
- if (node.dictValue === HIDDEN_LEVEL_IDS.major)
40
- return isShowMajor;
41
-
42
- // 如果有子节点,递归过滤子节点
43
- if (node.children && node.children.length > 0)
44
- node.children = filterTree(node.children);
45
-
46
- // 默认显示其他节点
47
- return true;
48
- });
49
- };
50
-
51
- return filterTree(treeData);
52
- };
53
-
54
- const getData = async () => {
55
- setTreeData([]);
56
- const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey: DICTIONARY_APP_KEY_ENUM.GWJ, dictValue: "hiddenLevel" });
57
- const filterData = filterTreeData(data);
58
- setTreeData(filterData);
59
- };
60
-
61
- useEffect(() => {
62
- getData();
63
- }, []);
64
-
65
- return (
66
- <BasicSelectTree treeData={treeData} placeholder="隐患级别" onlyLastLevel={true} nameKey="dictLabel" idKey="dictValue" {...restProps} />
67
- );
68
- }
69
-
70
- HiddenLevelSelectTree.displayName = "HiddenLevelSelectTree";
71
-
72
- export default HiddenLevelSelectTree;
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as i,useEffect as t}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../../enum/dictionary/index.js";import a from"../../Basic/index.js";import{jsx as d}from"react/jsx-runtime";function c(c){const{isShowNeglect:l=!0,isShowLarger:n=!0,isShowMajor:o=!0,...s}=c,[m,h]=i([]);return t(()=>{(async()=>{h([]);const{data:i}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:r.GWJ,dictValue:"hiddenLevel"}),t=(e=>{const i=e=>e&&Array.isArray(e)?e.filter(e=>"hiddenLevel1001"===e.dictValue?l:"jdyh001"===e.dictValue?n:"hiddenLevel0002"===e.dictValue?o:(e.children&&e.children.length>0&&(e.children=i(e.children)),!0)):[];return i(e)})(i);h(t)})()},[]),d(a,{treeData:m,placeholder:"隐患级别",onlyLastLevel:!0,nameKey:"dictLabel",idKey:"dictValue",...s})}c.displayName="HiddenLevelSelectTree";export{c as default};
@@ -1,39 +1 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useEffect, useState } from "react";
3
- import BasicSelectTree from "../../Basic";
4
-
5
- /**
6
- * 隐患部位下拉树组件(港务局版本)
7
- */
8
- function HiddenPartSelectTree(props) {
9
- const {
10
- params = {},
11
- isNeedCorpInfoId = false,
12
- ...restProps
13
- } = props;
14
-
15
- const [treeData, setTreeData] = useState([]);
16
-
17
- const getData = async () => {
18
- setTreeData([]);
19
-
20
- // 根据参数决定是否发送请求
21
- if (isNeedCorpInfoId && !params.eqCorpinfoId)
22
- return;
23
-
24
- const { data } = await request("/hidden/hiddenRegion/listByTree", "post", params);
25
- setTreeData(data);
26
- };
27
-
28
- useEffect(() => {
29
- getData();
30
- }, [JSON.stringify(params), isNeedCorpInfoId]);
31
-
32
- return (
33
- <BasicSelectTree treeData={treeData} placeholder="隐患部位" nameKey="hiddenregion" idKey="hiddenregionId" {...restProps} />
34
- );
35
- }
36
-
37
- HiddenPartSelectTree.displayName = "HiddenPartSelectTree";
38
-
39
- export default HiddenPartSelectTree;
1
+ import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as r,useEffect as i}from"react";import t from"../../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function n(n){const{params:d={},isNeedCorpInfoId:a=!1,...m}=n,[s,p]=r([]);return i(()=>{(async()=>{if(p([]),a&&!d.eqCorpinfoId)return;const{data:r}=await e("/hidden/hiddenRegion/listByTree","post",d);p(r)})()},[JSON.stringify(d),a]),o(t,{treeData:s,placeholder:"隐患部位",nameKey:"hiddenregion",idKey:"hiddenregionId",...m})}n.displayName="HiddenPartSelectTree";export{n as default};
@@ -1,27 +1 @@
1
- import Industry from "../../../json/industry.json";
2
- import BasicSelectTree from "../Basic";
3
-
4
- /**
5
- * 行业类型下拉树组件
6
- */
7
- function IndustrySelectTree(props) {
8
- const {
9
- placeholder = "行业类型",
10
- ...restProps
11
- } = props;
12
-
13
- return (
14
- <BasicSelectTree
15
- treeData={Industry}
16
- placeholder={placeholder}
17
- nameKey="dict_label"
18
- idKey="dict_value"
19
- childrenKey="childrenList"
20
- {...restProps}
21
- />
22
- );
23
- }
24
-
25
- IndustrySelectTree.displayName = "IndustrySelectTree";
26
-
27
- export default IndustrySelectTree;
1
+ import e from"../../../json/industry.json";import r from"../Basic/index.js";import{jsx as t}from"react/jsx-runtime";function i(i){const{placeholder:a="行业类型",...n}=i;return t(r,{treeData:e,placeholder:a,nameKey:"dict_label",idKey:"dict_value",childrenKey:"childrenList",...n})}i.displayName="IndustrySelectTree";export{i as default};
@@ -1,94 +1 @@
1
- import { Button, Image, message, Modal } from "antd";
2
- import dayjs from "dayjs";
3
- import { useEffect, useRef, useState } from "react";
4
- import SignatureCanvas from "react-signature-canvas";
5
- import { base642File } from "../../utils";
6
-
7
- /**
8
- * 签字组件
9
- */
10
- function Signature(props) {
11
- const {
12
- onConfirm,
13
- width = 752,
14
- height = 300,
15
- url = "",
16
- ...restProps
17
- } = props;
18
-
19
- const [signatureModalOpen, setSignatureModalOpen] = useState(false);
20
- const signatureCanvas = useRef(null);
21
- const [base64, setBase64] = useState("");
22
- useEffect(() => {
23
- setBase64(url);
24
- }, [url]);
25
-
26
- const onOk = () => {
27
- if (signatureCanvas.current.isEmpty()) {
28
- message.warning("请签名");
29
- return;
30
- }
31
- const base64 = signatureCanvas.current.toDataURL();
32
- setBase64(base64);
33
- onConfirm({
34
- time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
35
- base64,
36
- file: base642File(base64),
37
- });
38
- signatureCanvas.current.clear();
39
- setSignatureModalOpen(false);
40
- };
41
-
42
- return (
43
- <>
44
- <div>
45
- <Button
46
- type="primary"
47
- onClick={() => {
48
- setSignatureModalOpen(true);
49
- }}
50
- >
51
- {base64 ? "重新签字" : "手写签字"}
52
- </Button>
53
- </div>
54
- {base64 && (
55
- <div style={{ border: "1px dashed #d9d9d9", width, height, marginTop: 16 }}>
56
- <Image src={base64} style={{ width, height, objectFit: "contain" }} />
57
- </div>
58
- )}
59
- <Modal
60
- title="签字"
61
- width={800}
62
- open={signatureModalOpen}
63
- maskClosable={false}
64
- onCancel={() => setSignatureModalOpen(false)}
65
- footer={[
66
- <Button key="clear" onClick={() => signatureCanvas.current.clear()}>重签</Button>,
67
- <Button
68
- key="cancel"
69
- onClick={() => {
70
- setSignatureModalOpen(false);
71
- signatureCanvas.current.clear();
72
- }}
73
- >
74
- 取消
75
- </Button>,
76
- <Button key="ok" type="primary" onClick={onOk}>确定</Button>,
77
- ]}
78
- >
79
- <div style={{ border: "1px dashed #d9d9d9" }}>
80
- <SignatureCanvas
81
- ref={signatureCanvas}
82
- penColor="black"
83
- canvasProps={{ width, height }}
84
- {...restProps}
85
- />
86
- </div>
87
- </Modal>
88
- </>
89
- );
90
- }
91
-
92
- Signature.displayName = "Signature";
93
-
94
- export default Signature;
1
+ import{Button as r,Image as e,Modal as i,message as t}from"antd";import n from"dayjs";import{useState as o,useRef as c,useEffect as a}from"react";import d from"react-signature-canvas";import{base642File as l}from"../../utils/index.js";import{jsxs as h,Fragment as m,jsx as s}from"react/jsx-runtime";function p(p){const{onConfirm:u,width:f=752,height:y=300,url:g="",...C}=p,[k,b]=o(!1),v=c(null),[w,x]=o("");return a(()=>{x(g)},[g]),h(m,{children:[s("div",{children:s(r,{type:"primary",onClick:()=>{b(!0)},children:w?"重新签字":"手写签字"})}),w&&s("div",{style:{border:"1px dashed #d9d9d9",width:f,height:y,marginTop:16},children:s(e,{src:w,style:{width:f,height:y,objectFit:"contain"}})}),s(i,{title:"签字",width:800,open:k,maskClosable:!1,onCancel:()=>b(!1),footer:[s(r,{onClick:()=>v.current.clear(),children:"重签"},"clear"),s(r,{onClick:()=>{b(!1),v.current.clear()},children:"取消"},"cancel"),s(r,{type:"primary",onClick:()=>{if(v.current.isEmpty())return void t.warning("请签名");const r=v.current.toDataURL();x(r),u({time:n().format("YYYY-MM-DD HH:mm:ss"),base64:r,file:l(r)}),v.current.clear(),b(!1)},children:"确定"},"ok")],children:s("div",{style:{border:"1px dashed #d9d9d9"},children:s(d,{ref:v,penColor:"black",canvasProps:{width:f,height:y},...C})})})]})}p.displayName="Signature";export{p as default};
@@ -1,73 +1 @@
1
- import TablePro from "@cqsjjb/jjb-react-admin-component/Table";
2
- import { getIndexColumn } from "../../utils/index";
3
- import dayjs from 'dayjs';
4
- import "./index.less";
5
-
6
- const CLEANUP_INTERVAL_DAYS = 10; // 清理间隔天数
7
- const LAST_CLEANUP_KEY = 'tableLocalStorageLastCleanup'; // 最后清理时间存储key
8
-
9
- // 清理本地存储中特定后缀的key
10
- function cleanupTableLocalStorage() {
11
- const now = dayjs();
12
- const lastCleanupStr = localStorage.getItem(LAST_CLEANUP_KEY);
13
- const lastCleanup = lastCleanupStr ? dayjs(lastCleanupStr) : null;
14
-
15
- // 如果没有上次清理时间或距离上次清理已超过10天
16
- if (!lastCleanup || now.diff(lastCleanup, 'day') >= CLEANUP_INTERVAL_DAYS) {
17
- // 查找并清理符合条件的key
18
- const keysToRemove = [];
19
- for (let i = 0; i < localStorage.length; i++) {
20
- const key = localStorage.key(i);
21
- if (key && (key.endsWith('#columnState') ||
22
- key.endsWith('#size') ||
23
- key.endsWith('#resizable'))) {
24
- keysToRemove.push(key);
25
- }
26
- }
27
-
28
- // 删除匹配的key
29
- keysToRemove.forEach(key => {
30
- localStorage.removeItem(key);
31
- });
32
-
33
- // 更新最后清理时间
34
- localStorage.setItem(LAST_CLEANUP_KEY, now.toISOString());
35
- }
36
- }
37
-
38
- function Table(props) {
39
- const {
40
- columns = [],
41
- showIndexColumn = true,
42
- ellipsis = true,
43
- align = "center",
44
- indexColumnFixed = "left",
45
- rowKey = "id",
46
- ...restProps
47
- } = props;
48
-
49
- // 组件初始化时执行清理
50
- cleanupTableLocalStorage();
51
-
52
- function settingColumns() {
53
- showIndexColumn && columns.unshift({ ...getIndexColumn(props.pagination), fixed: indexColumnFixed });
54
-
55
- const setAlign = column => ({
56
- align,
57
- ellipsis,
58
- ...column,
59
- ...(column.children ? { children: column.children.map(setAlign) } : {}),
60
- });
61
-
62
- return columns.map(setAlign);
63
- }
64
- return (
65
- <div className="table-layout card-layout">
66
- <TablePro rowKey={rowKey} columns={settingColumns()} bordered size="small" {...restProps} />
67
- </div>
68
- );
69
- }
70
-
71
- Table.displayName = "Table";
72
-
73
- export default Table;
1
+ import e from"@cqsjjb/jjb-react-admin-component/Table";import{getIndexColumn as t}from"../../utils/index.js";import o from"dayjs";import"./index.less";import{jsx as l}from"react/jsx-runtime";const n="tableLocalStorageLastCleanup";function a(a){const{columns:i=[],showIndexColumn:r=!0,ellipsis:s=!0,align:c="center",indexColumnFixed:m="left",rowKey:d="id",...u}=a;return function(){const e=o(),t=localStorage.getItem(n),l=t?o(t):null;if(!l||e.diff(l,"day")>=10){const t=[];for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);o&&(o.endsWith("#columnState")||o.endsWith("#size")||o.endsWith("#resizable"))&&t.push(o)}t.forEach(e=>{localStorage.removeItem(e)}),localStorage.setItem(n,e.toISOString())}}(),l("div",{className:"table-layout card-layout",children:l(e,{rowKey:d,columns:function(){r&&i.unshift({...t(a.pagination),fixed:m});const e=t=>({align:c,ellipsis:s,...t,...t.children?{children:t.children.map(e)}:{}});return i.map(e)}(),bordered:!0,size:"small",...u})})}a.displayName="Table";export{a as default};
@@ -9,6 +9,12 @@
9
9
  }
10
10
 
11
11
  .@{ant-prefix}-pro-table-list-toolbar-container {
12
- padding-top: 26px !important;
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
+ }