zy-react-library 1.0.63 → 1.0.65
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/Cascader/Basic/index.d.ts +2 -0
- package/components/Cascader/Basic/index.js +6 -0
- package/components/HiddenInfo/gwj/index.js +10 -6
- package/components/LeftTree/Basic/index.d.ts +2 -0
- package/components/LeftTree/Basic/index.js +5 -0
- package/components/Select/Basic/index.d.ts +2 -0
- package/components/Select/Basic/index.js +6 -0
- package/components/SelectTree/Basic/index.d.ts +2 -0
- package/components/SelectTree/Basic/index.js +6 -0
- package/hooks/useTable/index.js +6 -4
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Cascader } from "antd";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { processTreeDataByLevel } from "../../../utils";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -6,6 +7,7 @@ import { processTreeDataByLevel } from "../../../utils";
|
|
|
6
7
|
*/
|
|
7
8
|
function BasicCascader(props) {
|
|
8
9
|
const {
|
|
10
|
+
onGetData,
|
|
9
11
|
onChange,
|
|
10
12
|
onGetNodePaths,
|
|
11
13
|
onGetNodePathsIsIncludeOneself = true,
|
|
@@ -42,6 +44,10 @@ function BasicCascader(props) {
|
|
|
42
44
|
onChange?.(value, selectedOptions);
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
onGetData?.(data, processedData);
|
|
49
|
+
}, [data, processedData]);
|
|
50
|
+
|
|
45
51
|
return (
|
|
46
52
|
<Cascader
|
|
47
53
|
options={processedData}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { request } from "@cqsjjb/jjb-common-lib/http";
|
|
2
|
-
import { Descriptions, Divider } from "antd";
|
|
2
|
+
import { Descriptions, Divider, Spin } from "antd";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import HeaderBack from "../../HeaderBack";
|
|
@@ -39,12 +39,14 @@ function HiddenInfo(props) {
|
|
|
39
39
|
const [afterRectificationImageFiles, setAfterRectificationImageFiles] = useState([]);
|
|
40
40
|
const [rectificationPlanImageFiles, setRectificationPlanImageFiles] = useState([]);
|
|
41
41
|
const [acceptImageFiles, setAcceptImageFiles] = useState([]);
|
|
42
|
+
const [loading, setLoading] = useState(true);
|
|
42
43
|
const { getFile } = useGetFile();
|
|
43
44
|
const query = useGetUrlQuery();
|
|
44
45
|
|
|
45
46
|
const getData = async () => {
|
|
46
47
|
request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => {
|
|
47
48
|
setInfo(res.data);
|
|
49
|
+
setLoading(false);
|
|
48
50
|
});
|
|
49
51
|
const hiddenImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["3"], eqForeignKey: hiddenId || query[hiddenIdKey] });
|
|
50
52
|
setHiddenImageFiles(hiddenImageFiles);
|
|
@@ -70,7 +72,8 @@ function HiddenInfo(props) {
|
|
|
70
72
|
return (
|
|
71
73
|
<div>
|
|
72
74
|
{isShowHeaderBack && <HeaderBack title="查看" />}
|
|
73
|
-
<
|
|
75
|
+
<Spin spinning={loading}>
|
|
76
|
+
<div style={{ padding: 20 }}>
|
|
74
77
|
<Divider orientation="left">隐患信息</Divider>
|
|
75
78
|
<Descriptions
|
|
76
79
|
bordered
|
|
@@ -126,8 +129,8 @@ function HiddenInfo(props) {
|
|
|
126
129
|
column={1}
|
|
127
130
|
labelStyle={{ width: 200 }}
|
|
128
131
|
items={[
|
|
129
|
-
{ label: "整改部门", children: info.hiddenUserPresetsCO.
|
|
130
|
-
{ label: "整改人", children: info.hiddenUserPresetsCO.
|
|
132
|
+
{ label: "整改部门", children: info.hiddenUserPresetsCO.rectifyDeptName },
|
|
133
|
+
{ label: "整改人", children: info.hiddenUserPresetsCO.rectifyUserName },
|
|
131
134
|
...(info.rectificationType === 2
|
|
132
135
|
? [
|
|
133
136
|
{ label: "整改期限", children: dayjs(info.hiddenUserPresetsCO.rectifyDeadline).format("YYYY-MM-DD") },
|
|
@@ -135,8 +138,8 @@ function HiddenInfo(props) {
|
|
|
135
138
|
: []),
|
|
136
139
|
...(info.rectificationType === 1
|
|
137
140
|
? [
|
|
138
|
-
{ label: "验收部门", children: info.hiddenUserPresetsCO.
|
|
139
|
-
{ label: "验收人", children: info.hiddenUserPresetsCO.
|
|
141
|
+
{ label: "验收部门", children: info.hiddenUserPresetsCO.checkDeptName },
|
|
142
|
+
{ label: "验收人", children: info.hiddenUserPresetsCO.checkUserName },
|
|
140
143
|
]
|
|
141
144
|
: []),
|
|
142
145
|
]}
|
|
@@ -355,6 +358,7 @@ function HiddenInfo(props) {
|
|
|
355
358
|
]}
|
|
356
359
|
/>
|
|
357
360
|
</div>
|
|
361
|
+
</Spin>
|
|
358
362
|
</div>
|
|
359
363
|
);
|
|
360
364
|
}
|
|
@@ -9,6 +9,7 @@ const { Search } = Input;
|
|
|
9
9
|
*/
|
|
10
10
|
const BasicLeftTree = (props) => {
|
|
11
11
|
const {
|
|
12
|
+
onGetData,
|
|
12
13
|
onSelect,
|
|
13
14
|
onGetNodePaths,
|
|
14
15
|
onGetNodePathsIsIncludeOneself = true,
|
|
@@ -141,6 +142,10 @@ const BasicLeftTree = (props) => {
|
|
|
141
142
|
const filteredTreeData = filterTreeData(treeData, searchValue);
|
|
142
143
|
const processedTreeData = processTreeData(filteredTreeData);
|
|
143
144
|
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
onGetData?.(treeData);
|
|
147
|
+
}, [treeData]);
|
|
148
|
+
|
|
144
149
|
return (
|
|
145
150
|
<div style={{ width: 300 }}>
|
|
146
151
|
<Search
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Select } from "antd";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { getLabelName } from "../../../utils";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -6,6 +7,7 @@ import { getLabelName } from "../../../utils";
|
|
|
6
7
|
*/
|
|
7
8
|
function BasicSelect(props) {
|
|
8
9
|
const {
|
|
10
|
+
onGetData,
|
|
9
11
|
onChange,
|
|
10
12
|
onGetLabel,
|
|
11
13
|
placeholder = "",
|
|
@@ -23,6 +25,10 @@ function BasicSelect(props) {
|
|
|
23
25
|
onChange?.(event, option);
|
|
24
26
|
};
|
|
25
27
|
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
onGetData?.(data);
|
|
30
|
+
}, [data]);
|
|
31
|
+
|
|
26
32
|
return (
|
|
27
33
|
<Select placeholder={`请选择${placeholder}`} showSearch allowClear onChange={handleChange} {...restProps}>
|
|
28
34
|
{data.map((item) => {
|
|
@@ -21,6 +21,8 @@ export interface BasicSelectTreeProps extends TreeSelectProps {
|
|
|
21
21
|
level?: number;
|
|
22
22
|
/** 获取 label */
|
|
23
23
|
onGetLabel?: (label: string) => void;
|
|
24
|
+
/** 获取数据 */
|
|
25
|
+
onGetData?: (data: Record<string, any>[], processedData: Record<string, any>[]) => void;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TreeSelect } from "antd";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { getTreeNodePaths, processTreeDataByLevel } from "../../../utils";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -6,6 +7,7 @@ import { getTreeNodePaths, processTreeDataByLevel } from "../../../utils";
|
|
|
6
7
|
*/
|
|
7
8
|
function BasicSelectTree(props) {
|
|
8
9
|
const {
|
|
10
|
+
onGetData,
|
|
9
11
|
onChange,
|
|
10
12
|
onGetLabel,
|
|
11
13
|
onGetNodePaths,
|
|
@@ -48,6 +50,10 @@ function BasicSelectTree(props) {
|
|
|
48
50
|
onChange?.(value, label, extra);
|
|
49
51
|
};
|
|
50
52
|
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
onGetData?.(treeData, processedTreeData);
|
|
55
|
+
}, [treeData, processedTreeData]);
|
|
56
|
+
|
|
51
57
|
return (
|
|
52
58
|
<TreeSelect
|
|
53
59
|
showSearch
|
package/hooks/useTable/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tools } from "@cqsjjb/jjb-common-lib";
|
|
2
2
|
import { useAntdTable } from "ahooks";
|
|
3
|
+
import useGetUrlQuery from "../useGetUrlQuery";
|
|
3
4
|
|
|
4
5
|
const { query } = tools.router;
|
|
5
6
|
|
|
@@ -75,9 +76,10 @@ function setQuery(searchForm, pagination) {
|
|
|
75
76
|
* 从 URL 中获取查询参数
|
|
76
77
|
*/
|
|
77
78
|
function getQuery(keysStr, valuesStr) {
|
|
79
|
+
const query = useGetUrlQuery();
|
|
78
80
|
// 将键值字符串分割为数组
|
|
79
|
-
const keys = keysStr ? keysStr.split(",") : [];
|
|
80
|
-
const values = valuesStr ? valuesStr.split(",") : [];
|
|
81
|
+
const keys = query[keysStr] ? query[keysStr].split(",") : [];
|
|
82
|
+
const values = query[valuesStr] ? query[valuesStr].split(",") : [];
|
|
81
83
|
|
|
82
84
|
// 构建结果对象
|
|
83
85
|
const resultMap = {};
|
|
@@ -119,8 +121,8 @@ function useTable(service, options) {
|
|
|
119
121
|
} = restOptions;
|
|
120
122
|
|
|
121
123
|
// 获取存储的查询条件
|
|
122
|
-
const storageQueryCriteriaSearchForm = useStorageQueryCriteria ? getQuery(
|
|
123
|
-
const storageQueryCriteriaPagination = useStorageQueryCriteria && usePagination ? getQuery(
|
|
124
|
+
const storageQueryCriteriaSearchForm = useStorageQueryCriteria ? getQuery("searchFormKeys", "searchFormValues") : {};
|
|
125
|
+
const storageQueryCriteriaPagination = useStorageQueryCriteria && usePagination ? getQuery("paginationKeys", "paginationValues") : {};
|
|
124
126
|
|
|
125
127
|
// 确定实际使用的搜索表单和分页参数
|
|
126
128
|
const actualSearchForm = Object.keys(storageQueryCriteriaSearchForm).length > 0 ? storageQueryCriteriaSearchForm : {};
|