zy-react-library 1.1.1 → 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.
Files changed (75) hide show
  1. package/README.md +5 -1
  2. package/components/Cascader/Area/index.js +11 -11
  3. package/components/Cascader/Basic/index.js +23 -30
  4. package/components/Cascader/Dictionary/index.js +42 -42
  5. package/components/Cascader/Industry/index.js +12 -11
  6. package/components/Editor/index.js +43 -63
  7. package/components/FormBuilder/FormBuilder.js +97 -87
  8. package/components/FormBuilder/FormItemsRenderer.js +579 -581
  9. package/components/FormBuilder/index.js +5 -3
  10. package/components/HeaderBack/index.js +39 -32
  11. package/components/HiddenInfo/gwj/index.js +507 -439
  12. package/components/Icon/AddIcon/index.js +6 -6
  13. package/components/Icon/BackIcon/index.js +6 -6
  14. package/components/Icon/DeleteIcon/index.js +6 -6
  15. package/components/Icon/DownloadIcon/index.js +6 -6
  16. package/components/Icon/EditIcon/index.js +6 -6
  17. package/components/Icon/ExportIcon/index.js +6 -6
  18. package/components/Icon/ImportIcon/index.js +6 -6
  19. package/components/Icon/LocationIcon/index.js +6 -6
  20. package/components/Icon/PrintIcon/index.js +6 -6
  21. package/components/Icon/ResetIcon/index.js +6 -6
  22. package/components/Icon/SearchIcon/index.js +6 -6
  23. package/components/Icon/VideoIcon/index.js +6 -6
  24. package/components/Icon/ViewIcon/index.js +6 -6
  25. package/components/ImportFile/index.js +94 -91
  26. package/components/LeftTree/Area/index.js +15 -15
  27. package/components/LeftTree/Basic/index.js +54 -65
  28. package/components/LeftTree/Department/Gwj/index.js +29 -32
  29. package/components/LeftTree/Dictionary/index.js +42 -42
  30. package/components/Map/MapSelector.js +280 -254
  31. package/components/Map/index.js +90 -77
  32. package/components/Page/index.js +43 -34
  33. package/components/Pdf/index.js +92 -90
  34. package/components/PreviewImg/index.js +26 -32
  35. package/components/PreviewPdf/index.js +78 -86
  36. package/components/Search/index.js +147 -141
  37. package/components/Select/Basic/index.js +70 -76
  38. package/components/Select/Dictionary/index.js +42 -42
  39. package/components/Select/Personnel/Gwj/index.js +45 -49
  40. package/components/SelectCreate/index.js +33 -40
  41. package/components/SelectTree/Area/index.js +11 -17
  42. package/components/SelectTree/Basic/index.js +105 -102
  43. package/components/SelectTree/Department/Gwj/index.js +40 -46
  44. package/components/SelectTree/Dictionary/index.js +42 -42
  45. package/components/SelectTree/HiddenLevel/Gwj/index.js +33 -35
  46. package/components/SelectTree/HiddenPart/Gwj/index.js +16 -19
  47. package/components/SelectTree/Industry/index.js +12 -18
  48. package/components/Signature/index.js +68 -62
  49. package/components/Table/index.js +77 -73
  50. package/components/Table/index.less +7 -1
  51. package/components/TooltipPreviewImg/index.js +28 -27
  52. package/components/Upload/index.js +229 -275
  53. package/components/Video/AliPlayer.js +182 -160
  54. package/components/Video/index.js +71 -90
  55. package/css/common.less +4 -0
  56. package/enum/dictionary/index.js +5 -3
  57. package/enum/formItemRender/index.js +37 -35
  58. package/enum/hidden/gwj/index.js +65 -26
  59. package/enum/uploadFile/gwj/index.js +166 -84
  60. package/hooks/useDeleteFile/index.js +24 -30
  61. package/hooks/useDictionary/index.js +28 -30
  62. package/hooks/useDownloadBlob/index.js +78 -77
  63. package/hooks/useDownloadFile/index.js +76 -79
  64. package/hooks/useGetFile/index.js +32 -32
  65. package/hooks/useGetUrlQuery/index.js +1 -2
  66. package/hooks/useGetUserInfo/index.js +19 -26
  67. package/hooks/useIdle/index.js +9 -11
  68. package/hooks/useImportFile/index.js +30 -28
  69. package/hooks/useIsExistenceDuplicateSelection/index.js +25 -18
  70. package/hooks/useTable/index.js +49 -38
  71. package/hooks/useUploadFile/index.js +142 -147
  72. package/hooks/useUrlQueryCriteria/index.js +20 -13
  73. package/package.json +14 -1
  74. package/regular/index.js +34 -39
  75. package/utils/index.js +515 -511
@@ -1,42 +1,42 @@
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 BasicSelect from "../Basic";
5
-
6
- /**
7
- * 数据字典下拉组件
8
- */
9
- function DictionarySelect(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 [data, setData] = 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
- setData([]);
27
- const { data } = await request("/config/dict-trees/list/by/dictValues", "get", { appKey, dictValue });
28
- setData(data);
29
- };
30
-
31
- useEffect(() => {
32
- dictValue && getData();
33
- }, [dictValue]);
34
-
35
- return (
36
- <BasicSelect data={data} nameKey={nameKey} idKey={idKey} {...restProps} />
37
- );
38
- }
39
-
40
- DictionarySelect.displayName = "DictionarySelect";
41
-
42
- export default DictionarySelect;
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 "@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 } 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 "@ant-design/icons";
2
- import { Select } from "antd";
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
- 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
- );
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 SelectCreate;
48
+ export { SelectCreate as default };
@@ -1,26 +1,20 @@
1
- import Area from "../../../json/area.json";
2
- import BasicSelectTree from "../Basic";
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
- return (
14
- <BasicSelectTree
15
- treeData={Area}
16
- placeholder={placeholder}
17
- nameKey="label"
18
- idKey="value"
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 AreaSelectTree;
20
+ export { AreaSelectTree as default };
@@ -1,102 +1,105 @@
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 } 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 "@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 } 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 };