zy-react-library 1.3.8 → 1.3.10
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/Area/index.d.ts +4 -4
- package/components/Cascader/Dictionary/index.d.ts +4 -4
- package/components/Cascader/Dictionary/index.js +1 -1
- package/components/Cascader/Industry/index.d.ts +4 -4
- package/components/FormBuilder/FormItemsRenderer.d.ts +9 -2
- package/components/LeftTree/Area/index.d.ts +4 -4
- package/components/LeftTree/Department/Gwj/index.d.ts +4 -4
- package/components/LeftTree/Department/Gwj/index.js +1 -1
- package/components/LeftTree/Dictionary/index.d.ts +4 -4
- package/components/LeftTree/Dictionary/index.js +1 -1
- package/components/Select/Dictionary/index.d.ts +3 -3
- package/components/Select/Dictionary/index.js +1 -1
- package/components/Select/Personnel/Gwj/index.d.ts +3 -3
- package/components/Select/Personnel/Gwj/index.js +1 -1
- package/components/SelectTree/Area/index.d.ts +4 -4
- package/components/SelectTree/Department/Gwj/index.d.ts +4 -4
- package/components/SelectTree/Department/Gwj/index.js +1 -1
- package/components/SelectTree/Dictionary/index.d.ts +4 -4
- package/components/SelectTree/Dictionary/index.js +1 -1
- package/components/SelectTree/HiddenLevel/Gwj/index.d.ts +4 -4
- package/components/SelectTree/HiddenPart/Gwj/index.d.ts +4 -4
- package/components/SelectTree/Industry/index.d.ts +4 -4
- package/hooks/useGetFile/index.d.ts +3 -3
- package/hooks/useGetUserInfo/index.d.ts +2 -2
- package/package.json +1 -1
- package/utils/index.d.ts +10 -0
- package/utils/index.js +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicCascaderProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface AreaCascaderItem {
|
|
5
5
|
value: string;
|
|
6
6
|
label: string;
|
|
7
|
-
children:
|
|
7
|
+
children: AreaCascaderItem[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,9 +12,9 @@ interface Data {
|
|
|
12
12
|
*/
|
|
13
13
|
export interface AreaCascaderProps extends Omit<BasicCascaderProps, "options" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
14
14
|
/** 获取父级节点 */
|
|
15
|
-
onGetNodePaths?: (nodes:
|
|
15
|
+
onGetNodePaths?: (nodes: AreaCascaderItem[]) => void;
|
|
16
16
|
/** 获取数据 */
|
|
17
|
-
onGetData?: (data:
|
|
17
|
+
onGetData?: (data: AreaCascaderItem[], processedData: AreaCascaderItem[]) => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicCascaderProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface DictionaryCascaderItem {
|
|
5
5
|
dictValue: string;
|
|
6
6
|
dictLabel: string;
|
|
7
|
-
children:
|
|
7
|
+
children: DictionaryCascaderItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -21,9 +21,9 @@ export interface DictionaryCascaderProps extends Omit<BasicCascaderProps, "optio
|
|
|
21
21
|
/** 树形数据 value 字段,默认 dictValue */
|
|
22
22
|
idKey?: string;
|
|
23
23
|
/** 获取父级节点 */
|
|
24
|
-
onGetNodePaths?: (nodes:
|
|
24
|
+
onGetNodePaths?: (nodes: DictionaryCascaderItem[]) => void;
|
|
25
25
|
/** 获取数据 */
|
|
26
|
-
onGetData?: (data:
|
|
26
|
+
onGetData?: (data: DictionaryCascaderItem[], processedData: DictionaryCascaderItem[]) => void;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as a,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as t}from"../../../enum/dictionary/index.js";import r from"../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as a,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as t}from"../../../enum/dictionary/index.js";import{executeWithCache as r}from"../../../utils/index.js";import o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=t.DEFAULT,dictValue:d="",nameKey:m="dictLabel",idKey:p="dictValue",...u}=n,[y,l]=a([]);return i(()=>{(async()=>{if(!Object.values(t).includes(s))return void console.error(`【DictionaryCascader】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionaryCascader】 缺少 dictValue 参数");const a={appKey:s,dictValue:d};await r(a,async()=>{const{data:a}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return a},l)})()},[d]),c(o,{data:y,nameKey:m,idKey:p,...u})}n.displayName="DictionaryCascader";export{n as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicCascaderProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface IndustryCascaderItem {
|
|
5
5
|
dict_value: string;
|
|
6
6
|
dict_label: string;
|
|
7
|
-
childrenList:
|
|
7
|
+
childrenList: IndustryCascaderItem[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,9 +12,9 @@ interface Data {
|
|
|
12
12
|
*/
|
|
13
13
|
export interface IndustryCascaderProps extends Omit<BasicCascaderProps, "options" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
14
14
|
/** 获取父级节点 */
|
|
15
|
-
onGetNodePaths?: (nodes:
|
|
15
|
+
onGetNodePaths?: (nodes: IndustryCascaderItem[]) => void;
|
|
16
16
|
/** 获取数据 */
|
|
17
|
-
onGetData?: (data:
|
|
17
|
+
onGetData?: (data: IndustryCascaderItem[], processedData: IndustryCascaderItem[]) => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -7,7 +7,14 @@ import type { ReactElement, ReactNode } from "react";
|
|
|
7
7
|
import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender";
|
|
8
8
|
import type { DeepPartial } from "./FormBuilder";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Form.List name 类型
|
|
12
|
+
*/
|
|
10
13
|
export type FormListOptionName<Values> = [number, NamePath<Values>];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Form.List 依赖项类型
|
|
17
|
+
*/
|
|
11
18
|
export type FormListOptionDependencies<Values> = Array<(NamePath<Values> | number)[]> | NamePath<Values>;
|
|
12
19
|
|
|
13
20
|
/**
|
|
@@ -72,12 +79,12 @@ export interface FormListUniqueProps<Values = any, AllValues = Values> {
|
|
|
72
79
|
/**
|
|
73
80
|
* 条件类型辅助工具
|
|
74
81
|
*/
|
|
75
|
-
type WhenTrue<Condition extends boolean, T> = Condition extends true ? never : T;
|
|
82
|
+
export type WhenTrue<Condition extends boolean, T> = Condition extends true ? never : T;
|
|
76
83
|
|
|
77
84
|
/**
|
|
78
85
|
* 表单配置项属性类型辅助工具
|
|
79
86
|
*/
|
|
80
|
-
type FormOptionProperty<IsOnlyForLabel extends boolean, IsCustomizeRender extends boolean, T> = WhenTrue<IsOnlyForLabel, WhenTrue<IsCustomizeRender, T>>;
|
|
87
|
+
export type FormOptionProperty<IsOnlyForLabel extends boolean, IsCustomizeRender extends boolean, T> = WhenTrue<IsOnlyForLabel, WhenTrue<IsCustomizeRender, T>>;
|
|
81
88
|
|
|
82
89
|
/**
|
|
83
90
|
* 表单配置项公共字段
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicLeftTreeProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface AreaLeftTreeItem {
|
|
5
5
|
value: string;
|
|
6
6
|
label: string;
|
|
7
|
-
children:
|
|
7
|
+
children: AreaLeftTreeItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -13,9 +13,9 @@ interface Data {
|
|
|
13
13
|
*/
|
|
14
14
|
export interface AreaLeftTreeProps extends Omit<BasicLeftTreeProps, "treeData" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
15
15
|
/** 获取父级节点 */
|
|
16
|
-
onGetNodePaths?: (nodes:
|
|
16
|
+
onGetNodePaths?: (nodes: AreaLeftTreeItem[]) => void;
|
|
17
17
|
/** 获取数据 */
|
|
18
|
-
onGetData?: (data:
|
|
18
|
+
onGetData?: (data: AreaLeftTreeItem[], processedData: AreaLeftTreeItem[]) => void;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -2,10 +2,10 @@ import type { FC } from "react";
|
|
|
2
2
|
import type { DepartmentSelectTreeProps } from "../../../SelectTree/Department/Gwj";
|
|
3
3
|
import type { BasicLeftTreeProps } from "../../Basic";
|
|
4
4
|
|
|
5
|
-
interface
|
|
5
|
+
export interface DepartmentLeftTreeItem {
|
|
6
6
|
id: string;
|
|
7
7
|
name: string;
|
|
8
|
-
childrenList:
|
|
8
|
+
childrenList: DepartmentLeftTreeItem[];
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -18,9 +18,9 @@ export interface DepartmentLeftTreeProps extends Omit<BasicLeftTreeProps, "treeD
|
|
|
18
18
|
/** 查询的企业类型 */
|
|
19
19
|
searchType?: DepartmentSelectTreeProps["searchType"];
|
|
20
20
|
/** 获取父级节点 */
|
|
21
|
-
onGetNodePaths?: (nodes:
|
|
21
|
+
onGetNodePaths?: (nodes: DepartmentLeftTreeItem[]) => void;
|
|
22
22
|
/** 获取数据 */
|
|
23
|
-
onGetData?: (data:
|
|
23
|
+
onGetData?: (data: DepartmentLeftTreeItem[], processedData: DepartmentLeftTreeItem[]) => void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as r}from"react";import n from"../../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as r}from"react";import{executeWithCache as n}from"../../../../utils/index.js";import i from"../../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function p(p){const{params:s={},searchType:o="current",...l}=p,[d,m]=t([]);return r(()=>{(async()=>{let t="";const r={...s,time:(new Date).getTime()};"current"===o&&(t="/basicInfo/department/listTree",delete r.inType,delete r.enterpriseType),"all"===o&&(t="/basicInfo/department/listAllTree",delete r.inType,delete r.enterpriseType,delete r.eqCorpinfoId,delete r.eqParentId),"inType"===o&&(t="/basicInfo/department/listAllTreeByCorpType",delete r.eqCorpinfoId,delete r.eqParentId,r.enterpriseType&&!Array.isArray(r.enterpriseType)&&(r.enterpriseType=[r.enterpriseType]));const i={searchType:o,params:s};await n(i,async()=>{const{data:n}=await e(t,"post",r);return n},m)})()},[]),a(i,{treeData:d,childrenKey:"childrenList",...l})}p.displayName="DepartmentLeftTree";export{p as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicLeftTreeProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface DictionaryLeftTreeItem {
|
|
5
5
|
dictValue: string;
|
|
6
6
|
dictLabel: string;
|
|
7
|
-
children:
|
|
7
|
+
children: DictionaryLeftTreeItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -21,9 +21,9 @@ export interface DictionaryLeftTreeProps extends Omit<BasicLeftTreeProps, "treeD
|
|
|
21
21
|
/** 树形数据 value 字段,默认 dictValue */
|
|
22
22
|
idKey?: string;
|
|
23
23
|
/** 获取父级节点 */
|
|
24
|
-
onGetNodePaths?: (nodes:
|
|
24
|
+
onGetNodePaths?: (nodes: DictionaryLeftTreeItem[]) => void;
|
|
25
25
|
/** 获取数据 */
|
|
26
|
-
onGetData?: (data:
|
|
26
|
+
onGetData?: (data: DictionaryLeftTreeItem[], processedData: DictionaryLeftTreeItem[]) => void;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../enum/dictionary/index.js";import a from"../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../enum/dictionary/index.js";import{executeWithCache as a}from"../../../utils/index.js";import o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=r.DEFAULT,dictValue:d="",nameKey:m="dictLabel",idKey:p="dictValue",...u}=n,[y,l]=t([]);return i(()=>{(async()=>{if(!Object.values(r).includes(s))return void console.error(`【DictionaryLeftTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionaryLeftTree】 缺少 dictValue 参数");const t={appKey:s,dictValue:d};await a(t,async()=>{const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return t},l)})()},[d]),c(o,{treeData:y,nameKey:m,idKey:p,...u})}n.displayName="DictionaryLeftTree";export{n as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface DictionarySelectItem {
|
|
5
5
|
dictValue: string;
|
|
6
6
|
dictLabel: string;
|
|
7
7
|
[key: string]: any;
|
|
@@ -20,9 +20,9 @@ export interface DictionarySelectProps extends Omit<BasicSelectProps, "data" | "
|
|
|
20
20
|
/** 树形数据 value 字段,默认 dictValue */
|
|
21
21
|
idKey?: string;
|
|
22
22
|
/** 获取选中的项 */
|
|
23
|
-
onGetOption?: (option:
|
|
23
|
+
onGetOption?: (option: DictionarySelectItem | DictionarySelectItem[]) => void;
|
|
24
24
|
/** 获取数据 */
|
|
25
|
-
onGetData?: (data:
|
|
25
|
+
onGetData?: (data: DictionarySelectItem[]) => void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as a}from"../../../enum/dictionary/index.js";import r from"../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as a}from"../../../enum/dictionary/index.js";import{executeWithCache as r}from"../../../utils/index.js";import o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=a.DEFAULT,dictValue:d="",nameKey:l="dictLabel",idKey:m="dictValue",...p}=n,[u,y]=t([]);return i(()=>{(async()=>{if(!Object.values(a).includes(s))return void console.error(`【DictionarySelect】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionarySelect】 缺少 dictValue 参数");const t={appKey:s,dictValue:d};await r(t,async()=>{const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return t},y)})()},[d]),c(o,{data:u,nameKey:l,idKey:m,...p})}n.displayName="DictionarySelect";export{n as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectProps } from "../../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface PersonnelSelectItem {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
7
|
corpinfoId: string;
|
|
@@ -59,9 +59,9 @@ export interface PersonnelSelectProps extends Omit<BasicSelectProps, "data" | "p
|
|
|
59
59
|
/** 额外请求参数 */
|
|
60
60
|
extraParams?: ExtraParams;
|
|
61
61
|
/** 获取选中的项 */
|
|
62
|
-
onGetOption?: (option:
|
|
62
|
+
onGetOption?: (option: PersonnelSelectItem | PersonnelSelectItem[]) => void;
|
|
63
63
|
/** 获取数据 */
|
|
64
|
-
onGetData?: (data:
|
|
64
|
+
onGetData?: (data: PersonnelSelectItem[]) => void;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as r}from"react";import o from"../../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as r}from"react";import{executeWithCache as o}from"../../../../utils/index.js";import n from"../../Basic/index.js";import{jsx as i}from"react/jsx-runtime";function a(a){const{params:s={},placeholder:m="人员",isNeedCorpInfoId:p=!1,isNeedDepartmentId:d=!0,isNeedPostId:f=!1,extraParams:c={},...l}=a,u={noMain:"",eqEmploymentFlag:1},[I,y]=t([]);return r(()=>{(async()=>{if(!p&&!d&&!f)return void console.error("【PersonnelSelect】 请至少传入一个参数");if(p&&(!s.corpinfoId||"string"!=typeof s.corpinfoId))return;if(d&&(!s.departmentId||"string"!=typeof s.departmentId))return;if(f&&(!s.postId||"string"!=typeof s.postId))return;const t={...u,...c},r={params:s,extraParams:t};await o(r,async()=>{const{data:r}=await e("/basicInfo/user/listAll","get",{...s,...t,time:(new Date).getTime()});return r},y)})()},[JSON.stringify(s),p,d,f,JSON.stringify(c)]),i(n,{data:I,placeholder:m,...l})}a.displayName="PersonnelSelect";export{a as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectTreeProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface AreaSelectTreeItem {
|
|
5
5
|
value: string;
|
|
6
6
|
label: string;
|
|
7
|
-
children:
|
|
7
|
+
children: AreaSelectTreeItem[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,9 +12,9 @@ interface Data {
|
|
|
12
12
|
*/
|
|
13
13
|
export interface AreaSelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
14
14
|
/** 获取父级节点 */
|
|
15
|
-
onGetNodePaths?: (nodes:
|
|
15
|
+
onGetNodePaths?: (nodes: AreaSelectTreeItem[]) => void;
|
|
16
16
|
/** 获取数据 */
|
|
17
|
-
onGetData?: (data:
|
|
17
|
+
onGetData?: (data: AreaSelectTreeItem[], processedData: AreaSelectTreeItem[]) => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectTreeProps } from "../../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface DepartmentSelectTreeItem {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
|
-
childrenList:
|
|
7
|
+
childrenList: DepartmentSelectTreeItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -47,9 +47,9 @@ export interface DepartmentSelectTreeProps extends Omit<BasicSelectTreeProps, "t
|
|
|
47
47
|
/** 查询的企业类型,默认current,current 接收 eqCorpinfoId 或者 eqParentId,all 不接受任何参数,inType 接收 inType 或者 enterpriseType */
|
|
48
48
|
searchType?: "current" | "all" | "inType";
|
|
49
49
|
/** 获取父级节点 */
|
|
50
|
-
onGetNodePaths?: (nodes:
|
|
50
|
+
onGetNodePaths?: (nodes: DepartmentSelectTreeItem[]) => void;
|
|
51
51
|
/** 获取数据 */
|
|
52
|
-
onGetData?: (data:
|
|
52
|
+
onGetData?: (data: DepartmentSelectTreeItem[], processedData: DepartmentSelectTreeItem[]) => void;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as t}from"react";import n from"../../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as t}from"react";import{executeWithCache as n}from"../../../../utils/index.js";import i from"../../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function p(p){const{params:s={},placeholder:o="部门",isNeedCorpInfoId:d=!1,isNeedParentId:l=!1,searchType:c="current",...m}=p,[y,f]=r([]);return t(()=>{(async()=>{if("current"===c){if(d&&!s.eqCorpinfoId)return;if(l&&!s.eqParentId)return}let r="";const t={...s,time:(new Date).getTime()};"current"===c&&(r="/basicInfo/department/listTree",delete t.inType,delete t.enterpriseType),"all"===c&&(r="/basicInfo/department/listAllTree",delete t.inType,delete t.enterpriseType,delete t.eqCorpinfoId,delete t.eqParentId),"inType"===c&&(r="/basicInfo/department/listAllTreeByCorpType",delete t.eqCorpinfoId,delete t.eqParentId,t.enterpriseType&&!Array.isArray(t.enterpriseType)&&(t.enterpriseType=[t.enterpriseType]));const i={searchType:c,params:s};await n(i,async()=>{const{data:n}=await e(r,"post",t);return n},f)})()},[JSON.stringify(s),d,l,c]),a(i,{treeData:y,placeholder:o,childrenKey:"childrenList",...m})}p.displayName="DepartmentSelectTree";export{p as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectTreeProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface DictionarySelectTreeItem {
|
|
5
5
|
dictValue: string;
|
|
6
6
|
dictLabel: string;
|
|
7
|
-
children:
|
|
7
|
+
children: DictionarySelectTreeItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -21,9 +21,9 @@ export interface DictionarySelectTreeProps extends Omit<BasicSelectTreeProps, "t
|
|
|
21
21
|
/** 树形数据 value 字段,默认 dictValue */
|
|
22
22
|
idKey?: string;
|
|
23
23
|
/** 获取父级节点 */
|
|
24
|
-
onGetNodePaths?: (nodes:
|
|
24
|
+
onGetNodePaths?: (nodes: DictionarySelectTreeItem[]) => void;
|
|
25
25
|
/** 获取数据 */
|
|
26
|
-
onGetData?: (data:
|
|
26
|
+
onGetData?: (data: DictionarySelectTreeItem[], processedData: DictionarySelectTreeItem[]) => void;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../enum/dictionary/index.js";import a from"../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../enum/dictionary/index.js";import{executeWithCache as a}from"../../../utils/index.js";import o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=r.DEFAULT,dictValue:d="",nameKey:l="dictLabel",idKey:m="dictValue",...p}=n,[u,y]=t([]);return i(()=>{(async()=>{if(!Object.values(r).includes(s))return void console.error(`【DictionarySelectTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中,当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionarySelectTree】 缺少 dictValue 参数");const t={appKey:s,dictValue:d};await a(t,async()=>{const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return t},y)})()},[d]),c(o,{treeData:u,nameKey:l,idKey:m,...p})}n.displayName="DictionarySelectTree";export{n as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectTreeProps } from "../../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface HiddenLevelSelectTreeItem {
|
|
5
5
|
dictValue: string;
|
|
6
6
|
dictLabel: string;
|
|
7
|
-
children:
|
|
7
|
+
children: HiddenLevelSelectTreeItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -19,9 +19,9 @@ export interface HiddenLevelSelectTreeProps extends Omit<BasicSelectTreeProps, "
|
|
|
19
19
|
/** 是否显示重大隐患,默认 true */
|
|
20
20
|
isShowMajor?: boolean;
|
|
21
21
|
/** 获取父级节点 */
|
|
22
|
-
onGetNodePaths?: (nodes:
|
|
22
|
+
onGetNodePaths?: (nodes: HiddenLevelSelectTreeItem[]) => void;
|
|
23
23
|
/** 获取数据 */
|
|
24
|
-
onGetData?: (data:
|
|
24
|
+
onGetData?: (data: HiddenLevelSelectTreeItem[], processedData: HiddenLevelSelectTreeItem[]) => void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectTreeProps } from "../../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface HiddenPartSelectTreeItem {
|
|
5
5
|
hiddenregionId: string;
|
|
6
6
|
hiddenregion: string;
|
|
7
|
-
children:
|
|
7
|
+
children: HiddenPartSelectTreeItem[];
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -25,9 +25,9 @@ export interface HiddenPartSelectTreeProps extends Omit<BasicSelectTreeProps, "t
|
|
|
25
25
|
/** 是否需要企业id,默认 false */
|
|
26
26
|
isNeedCorpInfoId?: boolean;
|
|
27
27
|
/** 获取父级节点 */
|
|
28
|
-
onGetNodePaths?: (nodes:
|
|
28
|
+
onGetNodePaths?: (nodes: HiddenPartSelectTreeItem[]) => void;
|
|
29
29
|
/** 获取数据 */
|
|
30
|
-
onGetData?: (data:
|
|
30
|
+
onGetData?: (data: HiddenPartSelectTreeItem[], processedData: HiddenPartSelectTreeItem[]) => void;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
2
|
import type { BasicSelectTreeProps } from "../Basic";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface IndustrySelectTreeItem {
|
|
5
5
|
dict_value: string;
|
|
6
6
|
dict_label: string;
|
|
7
|
-
childrenList:
|
|
7
|
+
childrenList: IndustrySelectTreeItem[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,9 +12,9 @@ interface Data {
|
|
|
12
12
|
*/
|
|
13
13
|
export interface IndustrySelectTreeProps extends Omit<BasicSelectTreeProps, "treeData" | "placeholder" | "nameKey" | "idKey" | "childrenKey" | "onGetNodePaths" | "onGetData"> {
|
|
14
14
|
/** 获取父级节点 */
|
|
15
|
-
onGetNodePaths?: (nodes:
|
|
15
|
+
onGetNodePaths?: (nodes: IndustrySelectTreeItem[]) => void;
|
|
16
16
|
/** 获取数据 */
|
|
17
|
-
onGetData?: (data:
|
|
17
|
+
onGetData?: (data: IndustrySelectTreeItem[], processedData: IndustrySelectTreeItem[]) => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface GetFileItem {
|
|
2
2
|
/** 文件路径 */
|
|
3
3
|
filePath: string;
|
|
4
4
|
/** 文件名称 */
|
|
@@ -33,9 +33,9 @@ export interface MultipleGetFileOptions extends BaseParams {
|
|
|
33
33
|
dataSource: Record<string, any>[];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export type SingleFileResponse =
|
|
36
|
+
export type SingleFileResponse = GetFileItem[];
|
|
37
37
|
|
|
38
|
-
export type MultipleFileResponse = Array<Record<string, any> & { files:
|
|
38
|
+
export type MultipleFileResponse = Array<Record<string, any> & { files: GetFileItem[] }>;
|
|
39
39
|
|
|
40
40
|
export interface GetFileFunction {
|
|
41
41
|
(options: SingleGetFileOptions): Promise<SingleFileResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface UserInfoData {
|
|
2
2
|
corpinfoId: string;
|
|
3
3
|
corpinfoName: string;
|
|
4
4
|
departmentId: string;
|
|
@@ -12,7 +12,7 @@ interface Data {
|
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type getUserInfoFunction = () => Promise<
|
|
15
|
+
export type getUserInfoFunction = () => Promise<UserInfoData>;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* 获取用户信息
|
package/package.json
CHANGED
package/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
1
2
|
import type { BasePaginationConfig } from "../hooks/useTable";
|
|
2
3
|
|
|
3
4
|
// 定义 getDataType 函数可能返回的所有类型
|
|
@@ -377,3 +378,12 @@ export function dynamicLoadCss(url: string): Promise<void>;
|
|
|
377
378
|
* 是否空html,用于给富文本编辑器使用
|
|
378
379
|
*/
|
|
379
380
|
export function normalizeEmptyHtml(html: string): string;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* 带缓存的请求执行函数
|
|
384
|
+
*/
|
|
385
|
+
export function executeWithCache<T>(
|
|
386
|
+
cacheKey: string | object,
|
|
387
|
+
requestFn: () => Promise<T>,
|
|
388
|
+
setData: Dispatch<SetStateAction<T[]>>,
|
|
389
|
+
): Promise<T>;
|
package/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request}from"@cqsjjb/jjb-common-lib/http.js";import dayjs from"dayjs";import{ID_NUMBER}from"../regular/index.js";function serialNumber(e,t){return(e.current-1)*e.pageSize+(t+1)}function toArrayString(value){return value?eval(value).map(String):[]}function interceptTheSuffix(e,t){return e.substring(e.lastIndexOf("."),e.length).toLowerCase()===t.toLowerCase()}function image2Base64(e){return new Promise(t=>{const n=new Image;n.src=e,n.crossOrigin="Anonymous",n.onload=function(){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,n.width,n.height);const r=n.src.substring(n.src.lastIndexOf(".")+1).toLowerCase();t(e.toDataURL(`image/${r}`))}})}function image2Base642(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=e=>{t(e.target.result)},r.onerror=e=>{n(e)}})}function base642File(e,t="file"){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],
|
|
1
|
+
import{request}from"@cqsjjb/jjb-common-lib/http.js";import dayjs from"dayjs";import{ID_NUMBER}from"../regular/index.js";function serialNumber(e,t){return(e.current-1)*e.pageSize+(t+1)}function toArrayString(value){return value?eval(value).map(String):[]}function interceptTheSuffix(e,t){return e.substring(e.lastIndexOf("."),e.length).toLowerCase()===t.toLowerCase()}function image2Base64(e){return new Promise(t=>{const n=new Image;n.src=e,n.crossOrigin="Anonymous",n.onload=function(){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,n.width,n.height);const r=n.src.substring(n.src.lastIndexOf(".")+1).toLowerCase();t(e.toDataURL(`image/${r}`))}})}function image2Base642(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=e=>{t(e.target.result)},r.onerror=e=>{n(e)}})}function base642File(e,t="file"){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],a=r.split("/")[1],i=atob(n[1]);let s=i.length;const o=new Uint8Array(s);for(;s--;)o[s]=i.charCodeAt(s);return new File([o],`${t}.${a}`,{type:r})}function checkImgExists(e){return new Promise((t,n)=>{const r=new Image;r.src=e,r.onload=function(e){t(e)},r.onerror=function(e){n(e)}})}function getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)}function ArrayDeduplication(e){return[...new Set(e)]}function arrayObjectDeduplication(e,t){const n={};return e.reduce((e,r)=>(n[r[t]]||(n[r[t]]=!0,e.push(r)),e),[])}function findCharIndex(e){const{str:t,char:n,num:r}=e;let a=t.indexOf(n);if(-1===a)return-1;for(let e=0;e<r-1;e++)if(a=t.indexOf(n,a+1),-1===a)return-1;return a}function randoms(e,t){return Math.random()*(t-e+1)+e}function numFormat(e){if(e){const t=e.toString().split("."),n=t[0].split("").reverse();let r=[];for(let e=0;e<n.length;e++)e%3==0&&0!==e&&r.push(","),r.push(n[e]);return r.reverse(),r=t[1]?r.join("").concat(`.${t[1]}`):r.join(""),r}}function isEmpty(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}function getUrlParam(e){const t=new RegExp(`(^|&)${e}=([^&]*)(&|$)`),n=window.location.search.substr(1).match(t);return null!=n?decodeURI(n[2]):""}function paging(e){const{list:t,currentPage:n,pageSize:r}=e;return t.filter((e,t)=>t<+n*+r&&t>=(+n-1)*+r)}function getFileSuffix(e){return e.substring(e.lastIndexOf(".")+1)}function getFileName(e){return e?e.substring(e.lastIndexOf("/")+1):""}function readTxtDocument(e){return new Promise(t=>{const n=getFileUrl()+e,r=new XMLHttpRequest;r.open("get",n,!0),r.responseType="blob",r.onload=function(e){const n=new FileReader;n.readAsText(e.target.response,"GB2312"),n.onload=function(){t(n.result)}},r.send()})}function secondConversion(e){if(!e)return 0;const t=Number.parseInt((e/60/60).toString(),10),n=Number.parseInt((e/60%60).toString(),10),r=Number.parseInt((e%60).toString(),10);return t?`${t}小时${n}分钟${r}秒`:n?`${n}分钟${r}秒`:`${r}秒`}function addingPrefixToFile(e,t={}){if(!e)return[];const{pathKey:n="filePath",nameKey:r="fileName",idKey:a="id"}=t,i=getFileUrl();return e.filter(e=>e[n]).map(e=>({url:i+e[n],name:e[r]||getFileName(e[n]),id:e[a],...e}))}function getLabelName(e){const{status:t,list:n,idKey:r="bianma",nameKey:a="name"}=e;return(n.find(e=>e[r]?.toString()===t?.toString())||{[a]:""})[a]}function calculateFileSize(e){return e>1024?`${(""+e/1024).substring(0,(""+e/1024).lastIndexOf(".")+3)}MB`:`${e}KB`}function idCardGetDateAndGender(e){let t="",n="";if(ID_NUMBER.test(e)){const r=e.substring(6,14),a=e.substring(16,17),i=`${r.substring(0,4)}-${r.substring(4,6)}-${r.substring(6,8)}`,s=new Date(i.replace(/-/g,"/")),o=s.getMonth()+1;let c;const l=s.getDate();let u;c=o<10?`0${o}`:o,u=l<10?`0${l}`:l,t=a%2==1?"1":"0",n=`${s.getFullYear()}-${c}-${u}`}return{sex:t,date:n}}function getMatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>n.includes(e[r]))}function getUnmatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>!n.includes(e[r]))}function listTransTree(e){const{json:t,idKey:n,parentIdKey:r,childrenKey:a}=e,i=[],s={};let o=0,c=0;const l=t.length;for(;o<l;o++)s[t[o][n]]=t[o];for(;c<l;c++){const e=t[c],n=s[e[r]];n?(!n[a]&&(n[a]=[]),n[a].push(e)):i.push(e)}return i}function isEmptyToWhether(e,t={}){const{yesText:n="是",noText:r="否",yesValue:a="1"}=t;return isEmpty(e)?"":e.toString()===a.toString()?n:r}function createGuid(e=32){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()));return t}function getIndexColumn(e){return{title:"序号",key:"index",width:70,render:(t,n,r)=>!1===e?r+1:serialNumber(e,r)}}function getTreeNodePaths(e){const{data:t,targetId:n,idKey:r,childrenKey:a,path:i=[],isIncludeOneself:s}=e;for(let e=0;e<t.length;e++){const o=t[e],c=[...i,o];if(o[r]===n)return s?c:i;if(o[a]&&o[a].length>0){const e=getTreeNodePaths({data:o[a],targetId:n,idKey:r,childrenKey:a,path:c,isIncludeOneself:s});if(e)return e}}return null}function processTreeDataByLevel(e){const{data:t,level:n,childrenKey:r,currentLevel:a=1}=e;return t.map(e=>{const t={...e};return n&&a>=n?(t.isLeaf=!0,delete t[r]):e[r]&&e[r].length>0?t[r]=processTreeDataByLevel({data:e[r],currentLevel:a+1,level:n,childrenKey:r}):t.isLeaf=!0,t})}function processTreeDataForOnlyLastLevel(e){const{data:t,childrenKey:n,onlyLastLevel:r=!1}=e;return r?t.map(e=>{const t=e[n]&&e[n].length>0,a={...e,selectable:!t};return t&&(a[n]=processTreeDataForOnlyLastLevel({data:e[n],childrenKey:n,onlyLastLevel:r})),a}):t}function validatorEndTime(e){let{startTime:t,message:n="结束时间不能早于开始时间",type:r=""}=e||{};return{validator:(e,a)=>{if(!a||!t)return Promise.resolve();if(!r){const e=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;/^\d{4}-\d{2}-\d{2}$/.test(t)?r="date":e.test(t)&&(r="datetime")}return(dayjs.isDayjs(a)?a:dayjs(a)).isBefore(dayjs(t),"date"===r?"day":"seconds")?Promise.reject(n):Promise.resolve()}}}function validatorTimeGTCurrentDay(e){const{message:t="需要大于当前时间",type:n="date"}=e||{};return{validator:(e,r)=>{if(!r)return Promise.resolve();const a=dayjs.isDayjs(r)?r:dayjs(r),i=dayjs();return("date"===n?a.isAfter(i,"day"):a.isAfter(i,"seconds"))?Promise.resolve():Promise.reject(t)}}}function validatorTimeGECurrentDay(e){const{message:t="需要大于等于当前时间",type:n="date"}=e||{};return{validator:(e,r)=>{if(!r)return Promise.resolve();const a=dayjs.isDayjs(r)?r:dayjs(r),i=dayjs();return("date"===n?a.isBefore(i,"day"):a.isBefore(i,"seconds"))?Promise.reject(t):Promise.resolve()}}}function dynamicLoadJs(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,document.body.appendChild(r)})}function dynamicLoadCss(e){return new Promise((t,n)=>{const r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}function normalizeEmptyHtml(e){if(!e)return"";const t=e.replace(/\s+/g,"").toLowerCase();return"<p><br></p>"===t||"<p></p>"===t||""===t?"":e}function getFileUrl(){return window.fileUrl||process.env.app.fileUrl}async function getFileUrlFromServer(){if(window.fileUrl)return;const{data:e}=await request("/basicInfo/imgFiles/getImagePath","get");window.fileUrl=e}const requestCacheMap=new Map;async function executeWithCache(e,t,n){n([]);const r="string"==typeof e?e:JSON.stringify(e);if(requestCacheMap.has(r))return n(requestCacheMap.get(r)),requestCacheMap.get(r);const a=await t();return requestCacheMap.set(r,a),n(a),a}export{ArrayDeduplication,addingPrefixToFile,arrayObjectDeduplication,base642File,calculateFileSize,checkImgExists,createGuid,dynamicLoadCss,dynamicLoadJs,executeWithCache,findCharIndex,getDataType,getFileName,getFileSuffix,getFileUrl,getFileUrlFromServer,getIndexColumn,getLabelName,getMatchedItems,getTreeNodePaths,getUnmatchedItems,getUrlParam,idCardGetDateAndGender,image2Base64,image2Base642,interceptTheSuffix,isEmpty,isEmptyToWhether,listTransTree,normalizeEmptyHtml,numFormat,paging,processTreeDataByLevel,processTreeDataForOnlyLastLevel,randoms,readTxtDocument,secondConversion,serialNumber,toArrayString,validatorEndTime,validatorTimeGECurrentDay,validatorTimeGTCurrentDay};
|