zy-react-library 1.1.2 → 1.1.3
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.js +1 -20
- package/components/Cascader/Basic/index.js +1 -57
- package/components/Cascader/Dictionary/index.js +1 -42
- package/components/Cascader/Industry/index.js +1 -21
- package/components/Editor/index.js +1 -82
- package/components/FormBuilder/FormBuilder.js +1 -97
- package/components/FormBuilder/FormItemsRenderer.js +1 -589
- package/components/FormBuilder/index.js +1 -5
- package/components/HeaderBack/index.js +1 -44
- package/components/HiddenInfo/gwj/index.js +1 -586
- package/components/Icon/AddIcon/index.js +1 -9
- package/components/Icon/BackIcon/index.js +1 -9
- package/components/Icon/DeleteIcon/index.js +1 -9
- package/components/Icon/DownloadIcon/index.js +1 -9
- package/components/Icon/EditIcon/index.js +1 -9
- package/components/Icon/ExportIcon/index.js +1 -9
- package/components/Icon/ImportIcon/index.js +1 -9
- package/components/Icon/LocationIcon/index.js +1 -9
- package/components/Icon/PrintIcon/index.js +1 -9
- package/components/Icon/ResetIcon/index.js +1 -9
- package/components/Icon/SearchIcon/index.js +1 -9
- package/components/Icon/VideoIcon/index.js +1 -9
- package/components/Icon/ViewIcon/index.js +1 -9
- package/components/ImportFile/index.js +1 -94
- package/components/LeftTree/Area/index.js +1 -15
- package/components/LeftTree/Basic/index.js +1 -160
- package/components/LeftTree/Department/Gwj/index.js +1 -29
- package/components/LeftTree/Dictionary/index.js +1 -42
- package/components/Map/MapSelector.js +1 -280
- package/components/Map/index.js +1 -90
- package/components/Page/index.js +1 -59
- package/components/Pdf/index.js +1 -136
- package/components/PreviewImg/index.js +1 -26
- package/components/PreviewPdf/index.js +1 -78
- package/components/Search/index.js +1 -147
- package/components/Select/Basic/index.js +1 -70
- package/components/Select/Dictionary/index.js +1 -42
- package/components/Select/Personnel/Gwj/index.js +1 -45
- package/components/SelectCreate/index.js +1 -48
- package/components/SelectTree/Area/index.js +1 -20
- package/components/SelectTree/Basic/index.js +1 -105
- package/components/SelectTree/Department/Gwj/index.js +1 -40
- package/components/SelectTree/Dictionary/index.js +1 -42
- package/components/SelectTree/HiddenLevel/Gwj/index.js +1 -70
- package/components/SelectTree/HiddenPart/Gwj/index.js +1 -36
- package/components/SelectTree/Industry/index.js +1 -21
- package/components/Signature/index.js +1 -100
- package/components/Table/index.js +1 -77
- package/components/TooltipPreviewImg/index.js +1 -28
- package/components/Upload/index.js +1 -229
- package/components/Video/AliPlayer.js +1 -182
- package/components/Video/index.js +1 -71
- package/enum/dictionary/index.js +1 -9
- package/enum/formItemRender/index.js +1 -39
- package/enum/hidden/gwj/index.js +1 -70
- package/enum/uploadFile/gwj/index.js +1 -258
- package/hooks/useDeleteFile/index.js +1 -95
- package/hooks/useDictionary/index.js +1 -64
- package/hooks/useDownloadBlob/index.js +1 -80
- package/hooks/useDownloadFile/index.js +1 -78
- package/hooks/useGetFile/index.js +1 -74
- package/hooks/useGetUrlQuery/index.js +1 -15
- package/hooks/useGetUserInfo/index.js +1 -42
- package/hooks/useIdle/index.js +1 -65
- package/hooks/useImportFile/index.js +1 -61
- package/hooks/useIsExistenceDuplicateSelection/index.js +1 -27
- package/hooks/useTable/index.js +1 -124
- package/hooks/useUploadFile/index.js +1 -144
- package/hooks/useUrlQueryCriteria/index.js +1 -84
- package/package.json +5 -1
- package/regular/index.js +1 -56
- package/utils/index.js +1 -591
|
@@ -1,147 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Form, Row, Col, Button } from 'antd';
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import FormItemsRenderer from '../FormBuilder/FormItemsRenderer.js';
|
|
5
|
-
import ResetIcon from '../Icon/ResetIcon/index.js';
|
|
6
|
-
import SearchIcon from '../Icon/SearchIcon/index.js';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
const Search = props => {
|
|
10
|
-
const {
|
|
11
|
-
labelCol = {
|
|
12
|
-
span: 6
|
|
13
|
-
},
|
|
14
|
-
options = [],
|
|
15
|
-
values = {},
|
|
16
|
-
onFinish,
|
|
17
|
-
onSubmit,
|
|
18
|
-
onReset,
|
|
19
|
-
searchText = "搜索",
|
|
20
|
-
resetText = "重置",
|
|
21
|
-
showSearchButton = true,
|
|
22
|
-
showResetButton = true,
|
|
23
|
-
extraButtons,
|
|
24
|
-
form,
|
|
25
|
-
...restProps
|
|
26
|
-
} = props;
|
|
27
|
-
const [collapse, setCollapse] = useState(true);
|
|
28
|
-
const [span, setSpan] = useState(6);
|
|
29
|
-
const [showCollapseButton, setShowCollapseButton] = useState(false);
|
|
30
|
-
const classNameRef = useRef(`search-${Date.now()}`);
|
|
31
|
-
|
|
32
|
-
// 计算是否需要显示展开/收起按钮
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (!options || options.length === 0) return;
|
|
35
|
-
const calculateLayout = () => {
|
|
36
|
-
const colEl = document.querySelectorAll(`.${classNameRef.current}>.${window.process.env.app.antd["ant-prefix"]}-col`);
|
|
37
|
-
const colElLength = colEl.length;
|
|
38
|
-
const excludeLast = colElLength - (extraButtons ? 2 : 1);
|
|
39
|
-
const spanMap = {
|
|
40
|
-
0: 24,
|
|
41
|
-
1: 18,
|
|
42
|
-
2: 12,
|
|
43
|
-
3: 6
|
|
44
|
-
};
|
|
45
|
-
setSpan(spanMap[excludeLast % 4] || 6);
|
|
46
|
-
setShowCollapseButton(excludeLast > 3);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// 延迟执行以确保 DOM 已渲染
|
|
50
|
-
setTimeout(calculateLayout, 0);
|
|
51
|
-
}, [options, extraButtons]);
|
|
52
|
-
|
|
53
|
-
// 处理表单提交
|
|
54
|
-
const handleSubmit = () => {
|
|
55
|
-
const values = form.getFieldsValue();
|
|
56
|
-
onFinish?.(values, "submit");
|
|
57
|
-
onSubmit?.(values);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// 处理重置
|
|
61
|
-
const handleReset = () => {
|
|
62
|
-
// form.resetFields();
|
|
63
|
-
// const values = form.getFieldsValue();
|
|
64
|
-
// onFinish?.(values, "reset");
|
|
65
|
-
// onReset?.(values);
|
|
66
|
-
|
|
67
|
-
const currentValues = form.getFieldsValue();
|
|
68
|
-
const resetValues = {};
|
|
69
|
-
Object.keys(currentValues).forEach(key => {
|
|
70
|
-
resetValues[key] = values.hasOwnProperty(key) ? values[key] : undefined;
|
|
71
|
-
});
|
|
72
|
-
form.setFieldsValue(resetValues);
|
|
73
|
-
onFinish?.(values, "reset");
|
|
74
|
-
onReset?.(values);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// 切换展开/收起
|
|
78
|
-
const toggleCollapse = () => {
|
|
79
|
-
setCollapse(!collapse);
|
|
80
|
-
};
|
|
81
|
-
return /*#__PURE__*/jsx("div", {
|
|
82
|
-
className: "search-layout card-layout",
|
|
83
|
-
children: /*#__PURE__*/jsx(Form, {
|
|
84
|
-
form: form,
|
|
85
|
-
labelCol: labelCol,
|
|
86
|
-
initialValues: values,
|
|
87
|
-
...restProps,
|
|
88
|
-
children: /*#__PURE__*/jsxs(Row, {
|
|
89
|
-
className: classNameRef.current,
|
|
90
|
-
children: [/*#__PURE__*/jsx(FormItemsRenderer, {
|
|
91
|
-
options: options,
|
|
92
|
-
labelCol: labelCol,
|
|
93
|
-
span: 6,
|
|
94
|
-
collapse: collapse,
|
|
95
|
-
useAutoGenerateRequired: false,
|
|
96
|
-
initialValues: values
|
|
97
|
-
}), /*#__PURE__*/jsx(Col, {
|
|
98
|
-
span: showCollapseButton ? collapse ? 6 : span : span,
|
|
99
|
-
children: /*#__PURE__*/jsxs(Form.Item, {
|
|
100
|
-
label: " ",
|
|
101
|
-
labelCol: {
|
|
102
|
-
span: 2
|
|
103
|
-
},
|
|
104
|
-
colon: false,
|
|
105
|
-
style: {
|
|
106
|
-
textAlign: "right"
|
|
107
|
-
},
|
|
108
|
-
children: [showSearchButton && /*#__PURE__*/jsx(Button, {
|
|
109
|
-
type: "primary",
|
|
110
|
-
icon: /*#__PURE__*/jsx(SearchIcon, {}),
|
|
111
|
-
onClick: handleSubmit,
|
|
112
|
-
children: searchText
|
|
113
|
-
}), showResetButton && /*#__PURE__*/jsx(Button, {
|
|
114
|
-
style: {
|
|
115
|
-
marginLeft: 8
|
|
116
|
-
},
|
|
117
|
-
icon: /*#__PURE__*/jsx(ResetIcon, {}),
|
|
118
|
-
onClick: handleReset,
|
|
119
|
-
children: resetText
|
|
120
|
-
}), showCollapseButton && /*#__PURE__*/jsx(Button, {
|
|
121
|
-
type: "link",
|
|
122
|
-
icon: collapse ? /*#__PURE__*/jsx(DownOutlined, {}) : /*#__PURE__*/jsx(UpOutlined, {}),
|
|
123
|
-
onClick: toggleCollapse,
|
|
124
|
-
style: {
|
|
125
|
-
marginLeft: 8
|
|
126
|
-
},
|
|
127
|
-
children: collapse ? "展开" : "收起"
|
|
128
|
-
})]
|
|
129
|
-
})
|
|
130
|
-
}), extraButtons && /*#__PURE__*/jsx(Col, {
|
|
131
|
-
span: 24,
|
|
132
|
-
children: /*#__PURE__*/jsx(Form.Item, {
|
|
133
|
-
label: " ",
|
|
134
|
-
colon: false,
|
|
135
|
-
labelCol: {
|
|
136
|
-
span: 0
|
|
137
|
-
},
|
|
138
|
-
children: extraButtons
|
|
139
|
-
})
|
|
140
|
-
})]
|
|
141
|
-
})
|
|
142
|
-
})
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
Search.displayName = "Search";
|
|
146
|
-
|
|
147
|
-
export { Search as default };
|
|
1
|
+
import{DownOutlined as e,UpOutlined as t}from"@ant-design/icons";import{Form as o,Row as n,Col as l,Button as r}from"antd";import{useState as i,useRef as s,useEffect as a}from"react";import c from"../FormBuilder/FormItemsRenderer.js";import m from"../Icon/ResetIcon/index.js";import d from"../Icon/SearchIcon/index.js";import{jsx as p,jsxs as u}from"react/jsx-runtime";const h=h=>{const{labelCol:f={span:6},options:y=[],values:b={},onFinish:g,onSubmit:x,onReset:C,searchText:I="搜索",resetText:w="重置",showSearchButton:F=!0,showResetButton:j=!0,extraButtons:k,form:R,...S}=h,[V,v]=i(!0),[B,A]=i(6),[N,T]=i(!1),$=s(`search-${Date.now()}`);return a(()=>{y&&0!==y.length&&setTimeout(()=>{const e=document.querySelectorAll(`.${$.current}>.${window.process.env.app.antd["ant-prefix"]}-col`).length-(k?2:1);A({0:24,1:18,2:12,3:6}[e%4]||6),T(e>3)},0)},[y,k]),p("div",{className:"search-layout card-layout",children:p(o,{form:R,labelCol:f,initialValues:b,...S,children:u(n,{className:$.current,children:[p(c,{options:y,labelCol:f,span:6,collapse:V,useAutoGenerateRequired:!1,initialValues:b}),p(l,{span:N&&V?6:B,children:u(o.Item,{label:" ",labelCol:{span:2},colon:!1,style:{textAlign:"right"},children:[F&&p(r,{type:"primary",icon:p(d,{}),onClick:()=>{const e=R.getFieldsValue();g?.(e,"submit"),x?.(e)},children:I}),j&&p(r,{style:{marginLeft:8},icon:p(m,{}),onClick:()=>{const e=R.getFieldsValue(),t={};Object.keys(e).forEach(e=>{t[e]=b.hasOwnProperty(e)?b[e]:void 0}),R.setFieldsValue(t),g?.(b,"reset"),C?.(b)},children:w}),N&&p(r,{type:"link",icon:p(V?e:t,{}),onClick:()=>{v(!V)},style:{marginLeft:8},children:V?"展开":"收起"})]})}),k&&p(l,{span:24,children:p(o.Item,{label:" ",colon:!1,labelCol:{span:0},children:k})})]})})})};h.displayName="Search";export{h as default};
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
function BasicSelect(props) {
|
|
6
|
-
const {
|
|
7
|
-
onGetData,
|
|
8
|
-
onChange,
|
|
9
|
-
onGetLabel,
|
|
10
|
-
onGetOption,
|
|
11
|
-
placeholder = "",
|
|
12
|
-
data = [],
|
|
13
|
-
nameKey = "name",
|
|
14
|
-
idKey = "id",
|
|
15
|
-
labelRender,
|
|
16
|
-
...restProps
|
|
17
|
-
} = props;
|
|
18
|
-
const handleChange = (event, option) => {
|
|
19
|
-
if (Array.isArray(event)) {
|
|
20
|
-
if (event.length > 0) {
|
|
21
|
-
const findItems = [];
|
|
22
|
-
const names = [];
|
|
23
|
-
event.forEach(item => {
|
|
24
|
-
const findItem = data.find(dataItem => dataItem[idKey] === item);
|
|
25
|
-
if (findItem) {
|
|
26
|
-
findItems.push(findItem);
|
|
27
|
-
names.push(findItem[nameKey]);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
onGetLabel?.(names);
|
|
31
|
-
onGetOption?.(findItems);
|
|
32
|
-
} else {
|
|
33
|
-
onGetLabel?.([]);
|
|
34
|
-
onGetOption?.([]);
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
if (event) {
|
|
38
|
-
const findItem = data.find(item => item[idKey] === event);
|
|
39
|
-
onGetLabel?.(findItem[nameKey]);
|
|
40
|
-
onGetOption?.(findItem);
|
|
41
|
-
} else {
|
|
42
|
-
onGetLabel?.("");
|
|
43
|
-
onGetOption?.({});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
onChange?.(event, option);
|
|
47
|
-
};
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
onGetData?.(data);
|
|
50
|
-
}, [data]);
|
|
51
|
-
return /*#__PURE__*/jsx(Select, {
|
|
52
|
-
placeholder: `请选择${placeholder}`,
|
|
53
|
-
showSearch: true,
|
|
54
|
-
allowClear: true,
|
|
55
|
-
optionFilterProp: "children",
|
|
56
|
-
onChange: handleChange,
|
|
57
|
-
...restProps,
|
|
58
|
-
children: data.map(item => {
|
|
59
|
-
const value = item[idKey];
|
|
60
|
-
const label = labelRender ? labelRender(item) : item[nameKey];
|
|
61
|
-
return /*#__PURE__*/jsx(Select.Option, {
|
|
62
|
-
value: value,
|
|
63
|
-
children: label
|
|
64
|
-
}, value);
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
BasicSelect.displayName = "BasicSelect";
|
|
69
|
-
|
|
70
|
-
export { BasicSelect as default };
|
|
1
|
+
import{Select as e}from"antd";import{useEffect as n}from"react";import{jsx as r}from"react/jsx-runtime";function a(a){const{onGetData:o,onChange:t,onGetLabel:i,onGetOption:l,placeholder:c="",data:s=[],nameKey:d="name",idKey:p="id",labelRender:h,...f}=a;return n(()=>{o?.(s)},[s]),r(e,{placeholder:`请选择${c}`,showSearch:!0,allowClear:!0,optionFilterProp:"children",onChange:(e,n)=>{if(Array.isArray(e))if(e.length>0){const n=[],r=[];e.forEach(e=>{const a=s.find(n=>n[p]===e);a&&(n.push(a),r.push(a[d]))}),i?.(r),l?.(n)}else i?.([]),l?.([]);else if(e){const n=s.find(n=>n[p]===e);i?.(n[d]),l?.(n)}else i?.(""),l?.({});t?.(e,n)},...f,children:s.map(n=>{const a=n[p],o=h?h(n):n[d];return r(e.Option,{value:a,children:o},a)})})}a.displayName="BasicSelect";export{a as default};
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http";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 o}from"react/jsx-runtime";function c(c){const{appKey:n=a.DEFAULT,dictValue:d="",nameKey:m="dictLabel",idKey:s="dictValue",...p}=c,[l,u]=t([]);return i(()=>{d&&(async()=>{if(!Object.values(a).includes(n))return void console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");u([]);const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:n,dictValue:d});u(t)})()},[d]),o(r,{data:l,nameKey:m,idKey:s,...p})}c.displayName="DictionarySelect";export{c as default};
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
import
|
|
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
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as t,useEffect as r}from"react";import a from"../../Basic/index.js";import{jsx as o}from"react/jsx-runtime";function i(i){const{params:n={},placeholder:s="人员",isNeedCorpInfoId:m=!1,isNeedDepartmentId:d=!0,isNeedPostId:p=!1,extraParams:c={noMain:"",eqEmploymentFlag:1},...f}=i,[l,u]=t([]);return r(()=>{(async()=>{if(u([]),m&&!n.corpinfoId)return;if(d&&!n.departmentId)return;if(p&&!n.postId)return;const{data:t}=await e("/basicInfo/user/listAll","get",{...n,...c});u(t)})()},[JSON.stringify(n),m,d,p,JSON.stringify(c)]),o(a,{data:l,placeholder:s,...f})}i.displayName="PersonnelSelect";export{i as default};
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Select } from 'antd';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
function SelectCreate(props) {
|
|
6
|
-
const {
|
|
7
|
-
items,
|
|
8
|
-
showDelete = true,
|
|
9
|
-
label = "",
|
|
10
|
-
maxCount = 1,
|
|
11
|
-
onDelete,
|
|
12
|
-
...restProps
|
|
13
|
-
} = props;
|
|
14
|
-
const handlerDelete = option => {
|
|
15
|
-
onDelete?.(option);
|
|
16
|
-
};
|
|
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
|
-
});
|
|
45
|
-
}
|
|
46
|
-
SelectCreate.displayName = "SelectCreate";
|
|
47
|
-
|
|
48
|
-
export { SelectCreate as default };
|
|
1
|
+
import{CloseCircleOutlined as e}from"@ant-design/icons";import{Select as t}from"antd";import{jsx as n,jsxs as i}from"react/jsx-runtime";function a(a){const{items:o,showDelete:l=!0,label:r="",maxCount:s=1,onDelete:m,...d}=a;return n(t,{mode:"tags",maxCount:s,placeholder:`请选择${r},无对应选项可直接输入创建选项`,optionRender:t=>i("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n("span",{children:t.label}),l&&n(e,{style:{marginRight:10},onClick:e=>{e.stopPropagation(),(e=>{m?.(e)})(t)}})]}),...d,children:o.map(e=>n(t.Option,{value:e.id,children:e.name},e.id))})}a.displayName="SelectCreate";export{a as default};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import BasicSelectTree from '../Basic/index.js';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
function AreaSelectTree(props) {
|
|
6
|
-
const {
|
|
7
|
-
placeholder = "属地",
|
|
8
|
-
...restProps
|
|
9
|
-
} = props;
|
|
10
|
-
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
11
|
-
treeData: Area,
|
|
12
|
-
placeholder: placeholder,
|
|
13
|
-
nameKey: "label",
|
|
14
|
-
idKey: "value",
|
|
15
|
-
...restProps
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
AreaSelectTree.displayName = "AreaSelectTree";
|
|
19
|
-
|
|
20
|
-
export { AreaSelectTree as default };
|
|
1
|
+
import e from"../../../json/area.json";import r from"../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function o(o){const{placeholder:t="属地",...l}=o;return a(r,{treeData:e,placeholder:t,nameKey:"label",idKey:"value",...l})}o.displayName="AreaSelectTree";export{o as default};
|
|
@@ -1,105 +1 @@
|
|
|
1
|
-
import {
|
|
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
|
+
import{TreeSelect as e}from"antd";import{useEffect as l}from"react";import{processTreeDataByLevel as t,processTreeDataForOnlyLastLevel as a,getDataType as r,getTreeNodePaths as n,arrayObjectDeduplication as o}from"../../../utils/index.js";import{jsx as c}from"react/jsx-runtime";function i(i){const{onGetData:d,onChange:s,onGetLabel:h,onGetNodePaths:u,onGetNodePathsIsIncludeOneself:y=!0,placeholder:m="",treeData:p=[],nameKey:f="name",idKey:v="id",childrenKey:I="children",level:K,onlyLastLevel:g=!1,...C}=i;let L=K?t({data:p,level:K,childrenKey:I,currentLevel:1}):p;return L=a({data:L,childrenKey:I,onlyLastLevel:g}),l(()=>{d?.(p,L)},[p,L]),c(e,{showSearch:!0,style:{width:"100%"},styles:{popup:{root:{maxHeight:400,overflow:"auto"}}},placeholder:`请选择${m}`,onChange:(e,l,t)=>{if(e)if("Array"===r(e)){const t=[];for(let l=0;l<e.length;l++){const a=C.labelInValue||C.treeCheckStrictly?e[l].value:e[l],r=n({data:p,targetId:a,idKey:v,childrenKey:I,isIncludeOneself:y});t.push(...r)}const a=o(t,v);u?.(a),h?.(C.labelInValue||C.treeCheckStrictly?e.map(e=>e.label):l)}else{const l=C.labelInValue||C.treeCheckStrictly?e.value:e,t=n({data:p,targetId:l,idKey:v,childrenKey:I,isIncludeOneself:y});u?.(t),h?.(t[t.length-1][f])}else u?.([]),h?.("");s?.(C.labelInValue||C.treeCheckStrictly?e.map(e=>e.value):e,l,t)},allowClear:!0,treeData:L,fieldNames:{label:f,value:v,children:I},treeNodeFilterProp:f,showCheckedStrategy:e.SHOW_ALL,...C})}i.displayName="BasicSelectTree";export{i as default};
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as r,useEffect as t}from"react";import a from"../../Basic/index.js";import{jsx as i}from"react/jsx-runtime";function n(n){const{params:o={},placeholder:c="部门",isNeedCorpInfoId:s=!1,isNeedParentId:p=!1,searchType:d="current",...m}=n,[f,l]=r([]);return t(()=>{(async()=>{if(l([]),"current"===d){if(s&&!o.eqCorpinfoId)return;if(p&&!o.eqParentId)return}const{data:r}=await e("current"===d?"/basicInfo/department/listTree":"/basicInfo/department/listAllTree","post",o);l(r)})()},[JSON.stringify(o),s,p,d]),i(a,{treeData:f,placeholder:c,childrenKey:"childrenList",...m})}n.displayName="DepartmentSelectTree";export{n as default};
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { DICTIONARY_APP_KEY_ENUM } from '../../../enum/dictionary/index.js';
|
|
4
|
-
import BasicSelectTree from '../Basic/index.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function DictionarySelectTree(props) {
|
|
8
|
-
const {
|
|
9
|
-
appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT,
|
|
10
|
-
dictValue = "",
|
|
11
|
-
nameKey = "dictLabel",
|
|
12
|
-
idKey = "dictValue",
|
|
13
|
-
...restProps
|
|
14
|
-
} = props;
|
|
15
|
-
const [treeData, setTreeData] = 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
|
-
setTreeData([]);
|
|
22
|
-
const {
|
|
23
|
-
data
|
|
24
|
-
} = await request("/config/dict-trees/list/by/dictValues", "get", {
|
|
25
|
-
appKey,
|
|
26
|
-
dictValue
|
|
27
|
-
});
|
|
28
|
-
setTreeData(data);
|
|
29
|
-
};
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
dictValue && getData();
|
|
32
|
-
}, [dictValue]);
|
|
33
|
-
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
34
|
-
treeData: treeData,
|
|
35
|
-
nameKey: nameKey,
|
|
36
|
-
idKey: idKey,
|
|
37
|
-
...restProps
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
DictionarySelectTree.displayName = "DictionarySelectTree";
|
|
41
|
-
|
|
42
|
-
export { DictionarySelectTree as default };
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http";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 o}from"react/jsx-runtime";function c(c){const{appKey:n=a.DEFAULT,dictValue:m="",nameKey:d="dictLabel",idKey:s="dictValue",...p}=c,[l,u]=t([]);return i(()=>{m&&(async()=>{if(!Object.values(a).includes(n))return void console.error("传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中");u([]);const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:n,dictValue:m});u(t)})()},[m]),o(r,{treeData:l,nameKey:d,idKey:s,...p})}c.displayName="DictionarySelectTree";export{c as default};
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { DICTIONARY_APP_KEY_ENUM } from '../../../../enum/dictionary/index.js';
|
|
4
|
-
import BasicSelectTree from '../../Basic/index.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function HiddenLevelSelectTree(props) {
|
|
8
|
-
const {
|
|
9
|
-
isShowNeglect = true,
|
|
10
|
-
isShowLarger = true,
|
|
11
|
-
isShowMajor = true,
|
|
12
|
-
...restProps
|
|
13
|
-
} = props;
|
|
14
|
-
const [treeData, setTreeData] = useState([]);
|
|
15
|
-
|
|
16
|
-
// 过滤隐患级别的树数据
|
|
17
|
-
const filterTreeData = treeData => {
|
|
18
|
-
// 隐患级别的特定ID
|
|
19
|
-
const HIDDEN_LEVEL_IDS = {
|
|
20
|
-
neglect: "hiddenLevel1001",
|
|
21
|
-
// 忽略隐患
|
|
22
|
-
larger: "jdyh001",
|
|
23
|
-
// 较大隐患
|
|
24
|
-
major: "hiddenLevel0002" // 重大隐患
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// 递归过滤树数据
|
|
28
|
-
const filterTree = nodes => {
|
|
29
|
-
if (!nodes || !Array.isArray(nodes)) return [];
|
|
30
|
-
return nodes.filter(node => {
|
|
31
|
-
// 根据不同的ID和对应的props来决定是否显示
|
|
32
|
-
if (node.dictValue === HIDDEN_LEVEL_IDS.neglect) return isShowNeglect;
|
|
33
|
-
if (node.dictValue === HIDDEN_LEVEL_IDS.larger) return isShowLarger;
|
|
34
|
-
if (node.dictValue === HIDDEN_LEVEL_IDS.major) return isShowMajor;
|
|
35
|
-
|
|
36
|
-
// 如果有子节点,递归过滤子节点
|
|
37
|
-
if (node.children && node.children.length > 0) node.children = filterTree(node.children);
|
|
38
|
-
|
|
39
|
-
// 默认显示其他节点
|
|
40
|
-
return true;
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
return filterTree(treeData);
|
|
44
|
-
};
|
|
45
|
-
const getData = async () => {
|
|
46
|
-
setTreeData([]);
|
|
47
|
-
const {
|
|
48
|
-
data
|
|
49
|
-
} = await request("/config/dict-trees/list/by/dictValues", "get", {
|
|
50
|
-
appKey: DICTIONARY_APP_KEY_ENUM.GWJ,
|
|
51
|
-
dictValue: "hiddenLevel"
|
|
52
|
-
});
|
|
53
|
-
const filterData = filterTreeData(data);
|
|
54
|
-
setTreeData(filterData);
|
|
55
|
-
};
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
getData();
|
|
58
|
-
}, []);
|
|
59
|
-
return /*#__PURE__*/jsx(BasicSelectTree, {
|
|
60
|
-
treeData: treeData,
|
|
61
|
-
placeholder: "\u9690\u60A3\u7EA7\u522B",
|
|
62
|
-
onlyLastLevel: true,
|
|
63
|
-
nameKey: "dictLabel",
|
|
64
|
-
idKey: "dictValue",
|
|
65
|
-
...restProps
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
HiddenLevelSelectTree.displayName = "HiddenLevelSelectTree";
|
|
69
|
-
|
|
70
|
-
export { HiddenLevelSelectTree as default };
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http";import{useState as i,useEffect as t}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../../enum/dictionary/index.js";import a from"../../Basic/index.js";import{jsx as d}from"react/jsx-runtime";function c(c){const{isShowNeglect:l=!0,isShowLarger:n=!0,isShowMajor:o=!0,...s}=c,[m,h]=i([]);return t(()=>{(async()=>{h([]);const{data:i}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:r.GWJ,dictValue:"hiddenLevel"}),t=(e=>{const i=e=>e&&Array.isArray(e)?e.filter(e=>"hiddenLevel1001"===e.dictValue?l:"jdyh001"===e.dictValue?n:"hiddenLevel0002"===e.dictValue?o:(e.children&&e.children.length>0&&(e.children=i(e.children)),!0)):[];return i(e)})(i);h(t)})()},[]),d(a,{treeData:m,placeholder:"隐患级别",onlyLastLevel:!0,nameKey:"dictLabel",idKey:"dictValue",...s})}c.displayName="HiddenLevelSelectTree";export{c as default};
|