zy-react-library 1.0.106 → 1.0.108
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.
|
@@ -1,45 +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
|
-
...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;
|
|
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
|
+
...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;
|
|
@@ -43,7 +43,7 @@ function useGetFile(returnType = "object") {
|
|
|
43
43
|
{ eqType, eqForeignKey },
|
|
44
44
|
)
|
|
45
45
|
.then((res) => {
|
|
46
|
-
resolve(addingPrefixToFile(res.data).map(item => ({ ...item, type:
|
|
46
|
+
resolve(addingPrefixToFile(res.data).map(item => ({ ...item, type: undefined })));
|
|
47
47
|
})
|
|
48
48
|
.catch((err) => {
|
|
49
49
|
reject(err);
|
package/package.json
CHANGED
package/utils/index.js
CHANGED
|
@@ -64,9 +64,10 @@ export function image2Base642(file) {
|
|
|
64
64
|
/**
|
|
65
65
|
base64转File对象
|
|
66
66
|
*/
|
|
67
|
-
export function base642File(base64, filename =
|
|
67
|
+
export function base642File(base64, filename = 'file') {
|
|
68
68
|
const arr = base64.split(",");
|
|
69
69
|
const mime = arr[0].match(/:(.*?);/)[1];
|
|
70
|
+
const ext = mime.split('/')[1];
|
|
70
71
|
const bstr = atob(arr[1]);
|
|
71
72
|
let n = bstr.length;
|
|
72
73
|
const u8arr = new Uint8Array(n);
|
|
@@ -75,7 +76,7 @@ export function base642File(base64, filename = "file") {
|
|
|
75
76
|
u8arr[n] = bstr.charCodeAt(n);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
return new File([u8arr], filename
|
|
79
|
+
return new File([u8arr], `${filename}.${ext}`, { type: mime });
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
/**
|