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 BasicSelect 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
|
-
setData(data);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
DictionarySelect.displayName = "DictionarySelect";
|
|
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 BasicSelect from '../Basic/index.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function DictionarySelect(props) {
|
|
8
|
+
const {
|
|
9
|
+
appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT,
|
|
10
|
+
dictValue = "",
|
|
11
|
+
nameKey = "dictLabel",
|
|
12
|
+
idKey = "dictValue",
|
|
13
|
+
...restProps
|
|
14
|
+
} = props;
|
|
15
|
+
const [data, setData] = 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
|
+
setData([]);
|
|
22
|
+
const {
|
|
23
|
+
data
|
|
24
|
+
} = await request("/config/dict-trees/list/by/dictValues", "get", {
|
|
25
|
+
appKey,
|
|
26
|
+
dictValue
|
|
27
|
+
});
|
|
28
|
+
setData(data);
|
|
29
|
+
};
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
dictValue && getData();
|
|
32
|
+
}, [dictValue]);
|
|
33
|
+
return /*#__PURE__*/jsx(BasicSelect, {
|
|
34
|
+
data: data,
|
|
35
|
+
nameKey: nameKey,
|
|
36
|
+
idKey: idKey,
|
|
37
|
+
...restProps
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
DictionarySelect.displayName = "DictionarySelect";
|
|
41
|
+
|
|
42
|
+
export { DictionarySelect as default };
|
|
@@ -1,49 +1,45 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import {
|
|
3
|
-
import BasicSelect from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
PersonnelSelect.displayName = "PersonnelSelect";
|
|
48
|
-
|
|
49
|
-
export default PersonnelSelect;
|
|
1
|
+
import { request } from '@cqsjjb/jjb-common-lib/http';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import BasicSelect from '../../Basic/index.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function PersonnelSelect(props) {
|
|
7
|
+
const {
|
|
8
|
+
params = {},
|
|
9
|
+
placeholder = "人员",
|
|
10
|
+
isNeedCorpInfoId = false,
|
|
11
|
+
isNeedDepartmentId = true,
|
|
12
|
+
isNeedPostId = false,
|
|
13
|
+
extraParams = {
|
|
14
|
+
noMain: "",
|
|
15
|
+
eqEmploymentFlag: 1
|
|
16
|
+
},
|
|
17
|
+
...restProps
|
|
18
|
+
} = props;
|
|
19
|
+
const [data, setData] = useState([]);
|
|
20
|
+
const getData = async () => {
|
|
21
|
+
setData([]);
|
|
22
|
+
// 根据参数决定是否发送请求
|
|
23
|
+
if (isNeedCorpInfoId && !params.corpinfoId) return;
|
|
24
|
+
if (isNeedDepartmentId && !params.departmentId) return;
|
|
25
|
+
if (isNeedPostId && !params.postId) return;
|
|
26
|
+
const {
|
|
27
|
+
data
|
|
28
|
+
} = await request("/basicInfo/user/listAll", "get", {
|
|
29
|
+
...params,
|
|
30
|
+
...extraParams
|
|
31
|
+
});
|
|
32
|
+
setData(data);
|
|
33
|
+
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
getData();
|
|
36
|
+
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId, JSON.stringify(extraParams)]);
|
|
37
|
+
return /*#__PURE__*/jsx(BasicSelect, {
|
|
38
|
+
data: data,
|
|
39
|
+
placeholder: placeholder,
|
|
40
|
+
...restProps
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
PersonnelSelect.displayName = "PersonnelSelect";
|
|
44
|
+
|
|
45
|
+
export { PersonnelSelect as default };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { CloseCircleOutlined } from
|
|
2
|
-
import { Select } from
|
|
1
|
+
import { CloseCircleOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Select } from 'antd';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
* 可创建选项的选择器组件
|
|
6
|
-
*/
|
|
7
5
|
function SelectCreate(props) {
|
|
8
6
|
const {
|
|
9
7
|
items,
|
|
@@ -13,43 +11,38 @@ function SelectCreate(props) {
|
|
|
13
11
|
onDelete,
|
|
14
12
|
...restProps
|
|
15
13
|
} = props;
|
|
16
|
-
|
|
17
|
-
const handlerDelete = (option) => {
|
|
14
|
+
const handlerDelete = option => {
|
|
18
15
|
onDelete?.(option);
|
|
19
16
|
};
|
|
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
|
-
</Select>
|
|
50
|
-
);
|
|
17
|
+
return /*#__PURE__*/jsx(Select, {
|
|
18
|
+
mode: "tags",
|
|
19
|
+
maxCount: maxCount,
|
|
20
|
+
placeholder: `请选择${label},无对应选项可直接输入创建选项`,
|
|
21
|
+
optionRender: option => /*#__PURE__*/jsxs("div", {
|
|
22
|
+
style: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "space-between"
|
|
26
|
+
},
|
|
27
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
28
|
+
children: option.label
|
|
29
|
+
}), showDelete && /*#__PURE__*/jsx(CloseCircleOutlined, {
|
|
30
|
+
style: {
|
|
31
|
+
marginRight: 10
|
|
32
|
+
},
|
|
33
|
+
onClick: e => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
handlerDelete(option);
|
|
36
|
+
}
|
|
37
|
+
})]
|
|
38
|
+
}),
|
|
39
|
+
...restProps,
|
|
40
|
+
children: items.map(item => /*#__PURE__*/jsx(Select.Option, {
|
|
41
|
+
value: item.id,
|
|
42
|
+
children: item.name
|
|
43
|
+
}, item.id))
|
|
44
|
+
});
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
SelectCreate.displayName = "SelectCreate";
|
|
54
47
|
|
|
55
|
-
export default
|
|
48
|
+
export { SelectCreate as default };
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import Area from
|
|
2
|
-
import BasicSelectTree from
|
|
1
|
+
import Area from '../../../json/area.json';
|
|
2
|
+
import BasicSelectTree from '../Basic/index.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
* 属地下拉树组件
|
|
6
|
-
*/
|
|
7
5
|
function AreaSelectTree(props) {
|
|
8
6
|
const {
|
|
9
7
|
placeholder = "属地",
|
|
10
8
|
...restProps
|
|
11
9
|
} = props;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{...restProps}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
10
|
+
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
11
|
+
treeData: Area,
|
|
12
|
+
placeholder: placeholder,
|
|
13
|
+
nameKey: "label",
|
|
14
|
+
idKey: "value",
|
|
15
|
+
...restProps
|
|
16
|
+
});
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
AreaSelectTree.displayName = "AreaSelectTree";
|
|
25
19
|
|
|
26
|
-
export default
|
|
20
|
+
export { AreaSelectTree as default };
|
|
@@ -1,102 +1,105 @@
|
|
|
1
|
-
import { TreeSelect } from
|
|
2
|
-
import { useEffect } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
const
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
import { TreeSelect } from 'antd';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { processTreeDataByLevel, processTreeDataForOnlyLastLevel, getDataType, getTreeNodePaths, arrayObjectDeduplication } from '../../../utils/index.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function BasicSelectTree(props) {
|
|
7
|
+
const {
|
|
8
|
+
onGetData,
|
|
9
|
+
onChange,
|
|
10
|
+
onGetLabel,
|
|
11
|
+
onGetNodePaths,
|
|
12
|
+
onGetNodePathsIsIncludeOneself = true,
|
|
13
|
+
placeholder = "",
|
|
14
|
+
treeData = [],
|
|
15
|
+
nameKey = "name",
|
|
16
|
+
idKey = "id",
|
|
17
|
+
childrenKey = "children",
|
|
18
|
+
level,
|
|
19
|
+
onlyLastLevel = false,
|
|
20
|
+
...restProps
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
// 根据 level 处理树数据
|
|
24
|
+
let processedTreeData = level ? processTreeDataByLevel({
|
|
25
|
+
data: treeData,
|
|
26
|
+
level,
|
|
27
|
+
childrenKey,
|
|
28
|
+
currentLevel: 1
|
|
29
|
+
}) : treeData;
|
|
30
|
+
|
|
31
|
+
// 根据 onlyLastLevel 处理树数据
|
|
32
|
+
processedTreeData = processTreeDataForOnlyLastLevel({
|
|
33
|
+
data: processedTreeData,
|
|
34
|
+
childrenKey,
|
|
35
|
+
onlyLastLevel
|
|
36
|
+
});
|
|
37
|
+
const handleChange = (value, label, extra) => {
|
|
38
|
+
if (value) {
|
|
39
|
+
if (getDataType(value) === "Array") {
|
|
40
|
+
const parentNodes = [];
|
|
41
|
+
for (let i = 0; i < value.length; i++) {
|
|
42
|
+
const targetId = restProps.labelInValue || restProps.treeCheckStrictly ? value[i].value : value[i];
|
|
43
|
+
const currentParentNodes = getTreeNodePaths({
|
|
44
|
+
data: treeData,
|
|
45
|
+
targetId,
|
|
46
|
+
idKey,
|
|
47
|
+
childrenKey,
|
|
48
|
+
isIncludeOneself: onGetNodePathsIsIncludeOneself
|
|
49
|
+
});
|
|
50
|
+
parentNodes.push(...currentParentNodes);
|
|
51
|
+
}
|
|
52
|
+
const deduplicationParentNodes = arrayObjectDeduplication(parentNodes, idKey);
|
|
53
|
+
onGetNodePaths?.(deduplicationParentNodes);
|
|
54
|
+
onGetLabel?.(restProps.labelInValue || restProps.treeCheckStrictly ? value.map(item => item.label) : label);
|
|
55
|
+
} else {
|
|
56
|
+
const targetId = restProps.labelInValue || restProps.treeCheckStrictly ? value.value : value;
|
|
57
|
+
const parentNodes = getTreeNodePaths({
|
|
58
|
+
data: treeData,
|
|
59
|
+
targetId,
|
|
60
|
+
idKey,
|
|
61
|
+
childrenKey,
|
|
62
|
+
isIncludeOneself: onGetNodePathsIsIncludeOneself
|
|
63
|
+
});
|
|
64
|
+
onGetNodePaths?.(parentNodes);
|
|
65
|
+
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
onGetNodePaths?.([]);
|
|
69
|
+
onGetLabel?.("");
|
|
70
|
+
}
|
|
71
|
+
onChange?.(restProps.labelInValue || restProps.treeCheckStrictly ? value.map(item => item.value) : value, label, extra);
|
|
72
|
+
};
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
onGetData?.(treeData, processedTreeData);
|
|
75
|
+
}, [treeData, processedTreeData]);
|
|
76
|
+
return /*#__PURE__*/jsx(TreeSelect, {
|
|
77
|
+
showSearch: true,
|
|
78
|
+
style: {
|
|
79
|
+
width: "100%"
|
|
80
|
+
},
|
|
81
|
+
styles: {
|
|
82
|
+
popup: {
|
|
83
|
+
root: {
|
|
84
|
+
maxHeight: 400,
|
|
85
|
+
overflow: "auto"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
placeholder: `请选择${placeholder}`,
|
|
90
|
+
onChange: handleChange,
|
|
91
|
+
allowClear: true,
|
|
92
|
+
treeData: processedTreeData,
|
|
93
|
+
fieldNames: {
|
|
94
|
+
label: nameKey,
|
|
95
|
+
value: idKey,
|
|
96
|
+
children: childrenKey
|
|
97
|
+
},
|
|
98
|
+
treeNodeFilterProp: nameKey,
|
|
99
|
+
showCheckedStrategy: TreeSelect.SHOW_ALL,
|
|
100
|
+
...restProps
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
BasicSelectTree.displayName = "BasicSelectTree";
|
|
104
|
+
|
|
105
|
+
export { BasicSelectTree as default };
|
|
@@ -1,46 +1,40 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import {
|
|
3
|
-
import BasicSelectTree from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
DepartmentSelectTree.displayName = "DepartmentSelectTree";
|
|
45
|
-
|
|
46
|
-
export default DepartmentSelectTree;
|
|
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';
|
|
5
|
+
|
|
6
|
+
function DepartmentSelectTree(props) {
|
|
7
|
+
const {
|
|
8
|
+
params = {},
|
|
9
|
+
placeholder = "部门",
|
|
10
|
+
isNeedCorpInfoId = false,
|
|
11
|
+
isNeedParentId = false,
|
|
12
|
+
searchType = "current",
|
|
13
|
+
...restProps
|
|
14
|
+
} = props;
|
|
15
|
+
const [treeData, setTreeData] = useState([]);
|
|
16
|
+
const getData = async () => {
|
|
17
|
+
setTreeData([]);
|
|
18
|
+
if (searchType === "current") {
|
|
19
|
+
// 根据参数决定是否发送请求
|
|
20
|
+
if (isNeedCorpInfoId && !params.eqCorpinfoId) return;
|
|
21
|
+
if (isNeedParentId && !params.eqParentId) return;
|
|
22
|
+
}
|
|
23
|
+
const {
|
|
24
|
+
data
|
|
25
|
+
} = await request(searchType === "current" ? "/basicInfo/department/listTree" : "/basicInfo/department/listAllTree", "post", params);
|
|
26
|
+
setTreeData(data);
|
|
27
|
+
};
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
getData();
|
|
30
|
+
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedParentId, searchType]);
|
|
31
|
+
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
32
|
+
treeData: treeData,
|
|
33
|
+
placeholder: placeholder,
|
|
34
|
+
childrenKey: "childrenList",
|
|
35
|
+
...restProps
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
DepartmentSelectTree.displayName = "DepartmentSelectTree";
|
|
39
|
+
|
|
40
|
+
export { DepartmentSelectTree as default };
|