zy-react-library 1.0.51 → 1.0.52
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/components/FormBuilder/FormItemsRenderer.d.ts +2 -0
- package/components/FormBuilder/FormItemsRenderer.js +9 -4
- package/components/LeftTree/Department/Gwj/index.d.ts +3 -1
- package/components/LeftTree/Department/Gwj/index.js +32 -32
- package/components/Map/index.js +1 -1
- package/components/Select/Basic/index.d.ts +23 -0
- package/components/Select/Basic/index.js +32 -0
- package/components/Select/Personnel/Gwj/index.d.ts +37 -0
- package/components/Select/Personnel/Gwj/index.js +45 -0
- package/components/SelectTree/Basic/index.d.ts +2 -0
- package/components/SelectTree/Department/Gwj/index.d.ts +8 -2
- package/components/SelectTree/Department/Gwj/index.js +14 -3
- package/package.json +1 -1
|
@@ -133,6 +133,11 @@ const FormItemsRenderer = ({
|
|
|
133
133
|
return option.rules ? (Array.isArray(option.rules) ? option.rules : [option.rules]) : [];
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
+
// 获取key
|
|
137
|
+
const getKey = (option) => {
|
|
138
|
+
return option.key || option.name
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
// 渲染表单控件
|
|
137
142
|
const renderFormControl = (option) => {
|
|
138
143
|
const componentProps = getComponentProps(option);
|
|
@@ -278,7 +283,7 @@ const FormItemsRenderer = ({
|
|
|
278
283
|
// 如果是分割线
|
|
279
284
|
if (option.render === FORM_ITEM_RENDER_ENUM.DIVIDER) {
|
|
280
285
|
return (
|
|
281
|
-
<Col key={option
|
|
286
|
+
<Col key={getKey(option) || index} span={itemSpan} style={style}>
|
|
282
287
|
<Divider orientation="left">{option.label}</Divider>
|
|
283
288
|
</Col>
|
|
284
289
|
);
|
|
@@ -291,7 +296,7 @@ const FormItemsRenderer = ({
|
|
|
291
296
|
? (renderFormControl(option))
|
|
292
297
|
: (
|
|
293
298
|
<Form.Item
|
|
294
|
-
key={option
|
|
299
|
+
key={getKey(option) || index}
|
|
295
300
|
noStyle
|
|
296
301
|
preserve={false}
|
|
297
302
|
shouldUpdate={option.shouldUpdate ?? option?.componentProps?.shouldUpdate}
|
|
@@ -307,7 +312,7 @@ const FormItemsRenderer = ({
|
|
|
307
312
|
return null;
|
|
308
313
|
|
|
309
314
|
return (
|
|
310
|
-
<Col key={option
|
|
315
|
+
<Col key={getKey(option) || index} span={itemSpan} style={style}>
|
|
311
316
|
<Form.Item
|
|
312
317
|
name={option.name}
|
|
313
318
|
label={renderLabel(option)}
|
|
@@ -337,7 +342,7 @@ const FormItemsRenderer = ({
|
|
|
337
342
|
return null;
|
|
338
343
|
|
|
339
344
|
return (
|
|
340
|
-
<Col key={option
|
|
345
|
+
<Col key={getKey(option) || index} span={itemSpan} style={style}>
|
|
341
346
|
{
|
|
342
347
|
option.customizeRender
|
|
343
348
|
? (renderFormControl(option))
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicLeftTreeProps } from "../../Basic";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 请求参数
|
|
6
|
+
*/
|
|
4
7
|
export interface Params {
|
|
5
8
|
/** 企业id */
|
|
6
9
|
eqCorpinfoId?: string;
|
|
7
10
|
/** 父级部门id */
|
|
8
11
|
eqParentId?: string;
|
|
9
|
-
[key: string]: any;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { request } from "@cqsjjb/jjb-common-lib/http";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import BasicLeftTree from "../../Basic";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 部门左侧树组件(港务局版本)
|
|
7
|
-
*/
|
|
8
|
-
function DepartmentLeftTree(props) {
|
|
9
|
-
const {
|
|
10
|
-
params = {},
|
|
11
|
-
...restProps
|
|
12
|
-
} = props;
|
|
13
|
-
|
|
14
|
-
const [treeData, setTreeData] = useState([]);
|
|
15
|
-
|
|
16
|
-
const getData = async () => {
|
|
17
|
-
const { data } = await request("/basic-info/department/listTree", "post", params);
|
|
18
|
-
setTreeData(data);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
getData();
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<BasicLeftTree treeData={treeData} {...restProps} />
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
DepartmentLeftTree.displayName = "DepartmentLeftTree";
|
|
31
|
-
|
|
32
|
-
export default DepartmentLeftTree;
|
|
1
|
+
import { request } from "@cqsjjb/jjb-common-lib/http";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import BasicLeftTree from "../../Basic";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 部门左侧树组件(港务局版本)
|
|
7
|
+
*/
|
|
8
|
+
function DepartmentLeftTree(props) {
|
|
9
|
+
const {
|
|
10
|
+
params = {},
|
|
11
|
+
...restProps
|
|
12
|
+
} = props;
|
|
13
|
+
|
|
14
|
+
const [treeData, setTreeData] = useState([]);
|
|
15
|
+
|
|
16
|
+
const getData = async () => {
|
|
17
|
+
const { data } = await request("/basic-info/department/listTree", "post", params);
|
|
18
|
+
setTreeData(data);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
getData();
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<BasicLeftTree treeData={treeData} {...restProps} />
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
DepartmentLeftTree.displayName = "DepartmentLeftTree";
|
|
31
|
+
|
|
32
|
+
export default DepartmentLeftTree;
|
package/components/Map/index.js
CHANGED
|
@@ -38,7 +38,7 @@ const Map = (props) => {
|
|
|
38
38
|
</Form.Item>
|
|
39
39
|
</Col>
|
|
40
40
|
<Col span={12}>
|
|
41
|
-
<Form.Item label="纬度" required={required}
|
|
41
|
+
<Form.Item label="纬度" required={required}>
|
|
42
42
|
<div style={{ display: "flex", gap: 10 }}>
|
|
43
43
|
<Form.Item name={latitudeProps} noStyle rules={[{ required, message: "请选择纬度" }]}>
|
|
44
44
|
<Input disabled />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SelectProps } from "antd/es/select";
|
|
2
|
+
import type { FC } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 组件属性
|
|
6
|
+
*/
|
|
7
|
+
export interface BasicSelectProps extends SelectProps {
|
|
8
|
+
/** 数据源 */
|
|
9
|
+
data: Record<string, any>[];
|
|
10
|
+
/** 数据 label 字段,默认 name */
|
|
11
|
+
nameKey?: string;
|
|
12
|
+
/** 数据 value 字段,默认 id */
|
|
13
|
+
idKey?: string;
|
|
14
|
+
/** 占位符 */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 基础下拉组件(不建议直接使用此组件,二次继承使用)
|
|
20
|
+
*/
|
|
21
|
+
declare const BasicSelectTree: FC<BasicSelectProps>;
|
|
22
|
+
|
|
23
|
+
export default BasicSelectTree;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Select } from "antd";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 基础下拉组件(不建议直接使用此组件,二次继承使用)
|
|
5
|
+
*/
|
|
6
|
+
function BasicSelect(props) {
|
|
7
|
+
const {
|
|
8
|
+
placeholder = "",
|
|
9
|
+
data = [],
|
|
10
|
+
nameKey = "name",
|
|
11
|
+
idKey = "id",
|
|
12
|
+
...restProps
|
|
13
|
+
} = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Select placeholder={`请选择${placeholder}`} showSearch allowClear {...restProps}>
|
|
17
|
+
{data.map((item) => {
|
|
18
|
+
const value = item[idKey];
|
|
19
|
+
const label = item[nameKey];
|
|
20
|
+
return (
|
|
21
|
+
<Select.Option key={value} value={value}>
|
|
22
|
+
{label}
|
|
23
|
+
</Select.Option>
|
|
24
|
+
);
|
|
25
|
+
})}
|
|
26
|
+
</Select>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
BasicSelect.displayName = "BasicSelect";
|
|
31
|
+
|
|
32
|
+
export default BasicSelect;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { BasicSelectProps } from "../../Basic";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 请求参数
|
|
6
|
+
*/
|
|
7
|
+
export interface Params {
|
|
8
|
+
/** 企业id */
|
|
9
|
+
corpinfoId?: string;
|
|
10
|
+
/** 岗位id */
|
|
11
|
+
postId?: string;
|
|
12
|
+
/** 部门id */
|
|
13
|
+
departmentId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 组件属性
|
|
18
|
+
*/
|
|
19
|
+
export interface DepartmentSelectProps extends Omit<BasicSelectProps, "data"> {
|
|
20
|
+
/** 请求参数 */
|
|
21
|
+
params?: Params;
|
|
22
|
+
/** 占位符,默认"人员" */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** 是否需要企业id,默认 false */
|
|
25
|
+
isNeedCorpInfoId?: boolean;
|
|
26
|
+
/** 是否需要岗位id,默认 false */
|
|
27
|
+
isNeedPostId?: boolean;
|
|
28
|
+
/** 是否需要部门id,默认 true */
|
|
29
|
+
isNeedDepartmentId?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 基础下拉组件(港务局版本)
|
|
34
|
+
*/
|
|
35
|
+
declare const DepartmentSelect: FC<DepartmentSelectProps>;
|
|
36
|
+
|
|
37
|
+
export default DepartmentSelect;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { request } from "@cqsjjb/jjb-common-lib/http";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import BasicSelect from "~/components/Select/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
|
+
...restProps
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
const [data, setData] = useState([]);
|
|
19
|
+
|
|
20
|
+
const getData = async () => {
|
|
21
|
+
setData([]);
|
|
22
|
+
// 根据参数决定是否发送请求
|
|
23
|
+
if (isNeedCorpInfoId && !params.corpinfoId)
|
|
24
|
+
return;
|
|
25
|
+
if (isNeedDepartmentId && !params.departmentId)
|
|
26
|
+
return;
|
|
27
|
+
if (isNeedPostId && !params.postId)
|
|
28
|
+
return;
|
|
29
|
+
|
|
30
|
+
const { data } = await request("/basic-info/user/listAll", "get", params);
|
|
31
|
+
setData(data);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
getData();
|
|
36
|
+
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId]);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<BasicSelect data={data} placeholder={placeholder} {...restProps} />
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
PersonnelSelect.displayName = "PersonnelSelect";
|
|
44
|
+
|
|
45
|
+
export default PersonnelSelect;
|
|
@@ -5,13 +5,19 @@ import { Params } from "../../../LeftTree/Department/Gwj";
|
|
|
5
5
|
/**
|
|
6
6
|
* 组件属性
|
|
7
7
|
*/
|
|
8
|
-
export interface DepartmentSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData"
|
|
8
|
+
export interface DepartmentSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData"> {
|
|
9
9
|
/** 请求参数 */
|
|
10
10
|
params?: Params;
|
|
11
|
+
/** 占位符,默认"部门“ */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** 是否需要企业id,默认 false */
|
|
14
|
+
isNeedCorpInfoId?: boolean;
|
|
15
|
+
/** 是否需要父级部门id,默认 false */
|
|
16
|
+
isNeedParentId?: boolean;
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
20
|
+
* 基础下拉树组件(港务局版本)
|
|
15
21
|
*/
|
|
16
22
|
declare const DepartmentSelectTree: FC<DepartmentSelectTreeProps>;
|
|
17
23
|
|
|
@@ -3,27 +3,38 @@ import { useEffect, useState } from "react";
|
|
|
3
3
|
import BasicLeftTree from "../../Basic";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* 基础下拉树组件(港务局版本)
|
|
7
7
|
*/
|
|
8
8
|
function DepartmentSelectTree(props) {
|
|
9
9
|
const {
|
|
10
10
|
params = {},
|
|
11
|
+
placeholder = "部门",
|
|
12
|
+
isNeedCorpInfoId = false,
|
|
13
|
+
isNeedParentId = false,
|
|
11
14
|
...restProps
|
|
12
15
|
} = props;
|
|
13
16
|
|
|
14
17
|
const [treeData, setTreeData] = useState([]);
|
|
15
18
|
|
|
16
19
|
const getData = async () => {
|
|
20
|
+
setTreeData([]);
|
|
21
|
+
|
|
22
|
+
// 根据参数决定是否发送请求
|
|
23
|
+
if (isNeedCorpInfoId && !params.eqCorpinfoId)
|
|
24
|
+
return;
|
|
25
|
+
if (isNeedParentId && !params.eqParentId)
|
|
26
|
+
return;
|
|
27
|
+
|
|
17
28
|
const { data } = await request("/basic-info/department/listTree", "post", params);
|
|
18
29
|
setTreeData(data);
|
|
19
30
|
};
|
|
20
31
|
|
|
21
32
|
useEffect(() => {
|
|
22
33
|
getData();
|
|
23
|
-
}, []);
|
|
34
|
+
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedParentId]);
|
|
24
35
|
|
|
25
36
|
return (
|
|
26
|
-
<BasicLeftTree treeData={treeData} placeholder=
|
|
37
|
+
<BasicLeftTree treeData={treeData} placeholder={placeholder} {...restProps} />
|
|
27
38
|
);
|
|
28
39
|
}
|
|
29
40
|
|