szld-libs 0.2.64 → 0.2.66
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/dist/szld-components.es.js +4589 -4569
- package/dist/szld-components.umd.js +39 -39
- package/es/components/DynamicForm/index.d.ts +1 -1
- package/es/components/DynamicForm/index.js +2 -0
- package/es/components/DynamicForm/myCascader/index.d.ts +2 -1
- package/es/components/DynamicForm/myCascader/index.js +26 -20
- package/es/components/DynamicForm/myCheckbox/index.d.ts +1 -0
- package/es/components/DynamicForm/myCheckbox/index.js +6 -3
- package/es/components/DynamicForm/myRadio/index.d.ts +1 -0
- package/es/components/DynamicForm/myRadio/index.js +6 -3
- package/es/components/DynamicForm/mySelect/index.d.ts +2 -1
- package/es/components/DynamicForm/mySelect/index.js +29 -22
- package/es/components/DynamicForm/useDynamicForm.d.ts +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +5 -0
- package/lib/components/DynamicForm/index.d.ts +1 -1
- package/lib/components/DynamicForm/index.js +2 -0
- package/lib/components/DynamicForm/myCascader/index.d.ts +2 -1
- package/lib/components/DynamicForm/myCascader/index.js +26 -20
- package/lib/components/DynamicForm/myCheckbox/index.d.ts +1 -0
- package/lib/components/DynamicForm/myCheckbox/index.js +6 -3
- package/lib/components/DynamicForm/myRadio/index.d.ts +1 -0
- package/lib/components/DynamicForm/myRadio/index.js +6 -3
- package/lib/components/DynamicForm/mySelect/index.d.ts +2 -1
- package/lib/components/DynamicForm/mySelect/index.js +29 -22
- package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +5 -0
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ export interface Ijson {
|
|
|
33
33
|
'modal-height'?: number;
|
|
34
34
|
//代表弹窗列表表头内容
|
|
35
35
|
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
36
|
-
inputType?: 'local' | 'dictionary' | 'url';
|
|
36
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
37
37
|
data?: string[];
|
|
38
38
|
//代表调用【字典管理系统】的值
|
|
39
39
|
classify?: number | string | undefined;
|
|
@@ -20,6 +20,7 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
20
20
|
radioAlign = "horizontal",
|
|
21
21
|
interfaceTypeChildren = "YLLRDetailAttrlist",
|
|
22
22
|
interfaceTypeDict = "YLZDDictList",
|
|
23
|
+
interfaceTypeSysDict = "YLZDSysConfigList",
|
|
23
24
|
relatedidKey = "relatedid",
|
|
24
25
|
actionUrlKey = "action-url",
|
|
25
26
|
actionUrlExtraParams = {},
|
|
@@ -38,6 +39,7 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
38
39
|
formConfig,
|
|
39
40
|
interfaceTypeChildren,
|
|
40
41
|
interfaceTypeDict,
|
|
42
|
+
interfaceTypeSysDict,
|
|
41
43
|
relatedidKey,
|
|
42
44
|
actionUrlKey,
|
|
43
45
|
actionUrlExtraParams,
|
|
@@ -9,8 +9,9 @@ interface MyCascaderProps {
|
|
|
9
9
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
10
10
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
11
11
|
interfaceTypeDict: string;
|
|
12
|
+
interfaceTypeSysDict: string;
|
|
12
13
|
actionUrlKey: string;
|
|
13
14
|
actionUrlExtraParams: object;
|
|
14
15
|
}
|
|
15
|
-
declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default MyCascader;
|
|
@@ -10,6 +10,7 @@ const MyCascader = ({
|
|
|
10
10
|
commonRequestWidthParams,
|
|
11
11
|
commonRequest,
|
|
12
12
|
interfaceTypeDict,
|
|
13
|
+
interfaceTypeSysDict,
|
|
13
14
|
actionUrlKey,
|
|
14
15
|
actionUrlExtraParams
|
|
15
16
|
}) => {
|
|
@@ -20,7 +21,6 @@ const MyCascader = ({
|
|
|
20
21
|
handleLoadOptions();
|
|
21
22
|
}, [item.inputType, item.classify, item.data, item.options]);
|
|
22
23
|
const handleLoadOptions = async () => {
|
|
23
|
-
var _a;
|
|
24
24
|
if (item.inputType === "local") {
|
|
25
25
|
let localOptions = [];
|
|
26
26
|
if (item.data && Array.isArray(item.data)) {
|
|
@@ -33,25 +33,9 @@ const MyCascader = ({
|
|
|
33
33
|
}
|
|
34
34
|
setOptions(localOptions);
|
|
35
35
|
} else if (item.inputType === "dictionary") {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const response = await commonRequest(interfaceTypeDict, {
|
|
40
|
-
asctypeid: item.classify
|
|
41
|
-
});
|
|
42
|
-
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
43
|
-
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
44
|
-
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
45
|
-
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
46
|
-
}));
|
|
47
|
-
setOptions(dictionaryOptions);
|
|
48
|
-
}
|
|
49
|
-
} catch (error) {
|
|
50
|
-
message.error("加载选项失败");
|
|
51
|
-
} finally {
|
|
52
|
-
setLoading(false);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
36
|
+
await getDict(interfaceTypeSysDict);
|
|
37
|
+
} else if (item.inputType === "system-dictionary") {
|
|
38
|
+
getDict(interfaceTypeSysDict);
|
|
55
39
|
} else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
56
40
|
const res = await handleGetUrlData();
|
|
57
41
|
if (res && Array.isArray(res)) {
|
|
@@ -70,6 +54,28 @@ const MyCascader = ({
|
|
|
70
54
|
setOptions(defaultOptions);
|
|
71
55
|
}
|
|
72
56
|
};
|
|
57
|
+
const getDict = async (interfaceType) => {
|
|
58
|
+
var _a;
|
|
59
|
+
if (item.classify) {
|
|
60
|
+
setLoading(true);
|
|
61
|
+
try {
|
|
62
|
+
const response = await commonRequest(interfaceType, {
|
|
63
|
+
asctypeid: item.classify
|
|
64
|
+
});
|
|
65
|
+
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
66
|
+
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
67
|
+
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
68
|
+
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
69
|
+
}));
|
|
70
|
+
setOptions(dictionaryOptions);
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
message.error("加载选项失败");
|
|
74
|
+
} finally {
|
|
75
|
+
setLoading(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
73
79
|
const handleChange = (value2, selectedOptions) => {
|
|
74
80
|
if (onChange) {
|
|
75
81
|
onChange(value2);
|
|
@@ -11,6 +11,7 @@ export interface IMYRadio {
|
|
|
11
11
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
12
12
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
13
13
|
interfaceTypeDict: string;
|
|
14
|
+
interfaceTypeSysDict: string;
|
|
14
15
|
actionUrlKey: string;
|
|
15
16
|
actionUrlExtraParams: object;
|
|
16
17
|
}
|
|
@@ -13,6 +13,7 @@ const MyCheckbox = (props) => {
|
|
|
13
13
|
handleUrlOptions,
|
|
14
14
|
value,
|
|
15
15
|
interfaceTypeDict,
|
|
16
|
+
interfaceTypeSysDict,
|
|
16
17
|
actionUrlKey,
|
|
17
18
|
actionUrlExtraParams
|
|
18
19
|
} = props;
|
|
@@ -24,17 +25,19 @@ const MyCheckbox = (props) => {
|
|
|
24
25
|
const arr = (item == null ? void 0 : item.data) || [];
|
|
25
26
|
setList(arr.map((v) => ({ value: v, label: v })));
|
|
26
27
|
} else if ((item == null ? void 0 : item.inputType) === "dictionary") {
|
|
27
|
-
getList(item.classify);
|
|
28
|
+
getList(item.classify, interfaceTypeDict);
|
|
29
|
+
} else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
|
|
30
|
+
getList(item.classify, interfaceTypeSysDict);
|
|
28
31
|
} else if ((item == null ? void 0 : item.inputType) === "url") {
|
|
29
32
|
getUrlList();
|
|
30
33
|
}
|
|
31
34
|
}, [item == null ? void 0 : item.inputType]);
|
|
32
|
-
const getList = async (id) => {
|
|
35
|
+
const getList = async (id, interfaceType) => {
|
|
33
36
|
var _a;
|
|
34
37
|
if (!id) {
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
|
-
const res = await commonRequest(
|
|
40
|
+
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
38
41
|
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
39
42
|
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
40
43
|
setList(
|
|
@@ -12,6 +12,7 @@ export interface IMYRadio {
|
|
|
12
12
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
13
13
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
14
14
|
interfaceTypeDict: string;
|
|
15
|
+
interfaceTypeSysDict: string;
|
|
15
16
|
actionUrlKey: string;
|
|
16
17
|
actionUrlExtraParams: object;
|
|
17
18
|
}
|
|
@@ -13,6 +13,7 @@ const MyRadio = (props) => {
|
|
|
13
13
|
handleUrlOptions,
|
|
14
14
|
value,
|
|
15
15
|
interfaceTypeDict,
|
|
16
|
+
interfaceTypeSysDict,
|
|
16
17
|
actionUrlKey,
|
|
17
18
|
actionUrlExtraParams
|
|
18
19
|
} = props;
|
|
@@ -23,17 +24,19 @@ const MyRadio = (props) => {
|
|
|
23
24
|
const arr = (item == null ? void 0 : item.data) || [];
|
|
24
25
|
setList(arr.map((v) => ({ value: v, label: v })));
|
|
25
26
|
} else if ((item == null ? void 0 : item.inputType) === "dictionary") {
|
|
26
|
-
getList(item.classify);
|
|
27
|
+
getList(item.classify, interfaceTypeDict);
|
|
28
|
+
} else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
|
|
29
|
+
getList(item.classify, interfaceTypeSysDict);
|
|
27
30
|
} else if ((item == null ? void 0 : item.inputType) === "url") {
|
|
28
31
|
getUrlList();
|
|
29
32
|
}
|
|
30
33
|
}, [item == null ? void 0 : item.inputType]);
|
|
31
|
-
const getList = async (id) => {
|
|
34
|
+
const getList = async (id, interfaceType) => {
|
|
32
35
|
var _a;
|
|
33
36
|
if (!id) {
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
|
-
const res = await commonRequest(
|
|
39
|
+
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
37
40
|
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
38
41
|
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
39
42
|
setList(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ijson } from '../index.d';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: {
|
|
3
|
+
declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, }: {
|
|
4
4
|
item: Ijson;
|
|
5
5
|
readonly?: boolean | undefined;
|
|
6
6
|
style?: any;
|
|
@@ -10,6 +10,7 @@ declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonReques
|
|
|
10
10
|
value: string | number | (string | number)[];
|
|
11
11
|
onChange: (val: string | number | (string | number)[]) => void;
|
|
12
12
|
interfaceTypeDict: string;
|
|
13
|
+
interfaceTypeSysDict: string;
|
|
13
14
|
actionUrlKey: string;
|
|
14
15
|
actionUrlExtraParams: object;
|
|
15
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +11,7 @@ const MySelect = ({
|
|
|
11
11
|
value,
|
|
12
12
|
onChange,
|
|
13
13
|
interfaceTypeDict,
|
|
14
|
+
interfaceTypeSysDict,
|
|
14
15
|
actionUrlKey,
|
|
15
16
|
actionUrlExtraParams
|
|
16
17
|
}) => {
|
|
@@ -21,7 +22,7 @@ const MySelect = ({
|
|
|
21
22
|
handleLoadOptions();
|
|
22
23
|
}, [item.inputType, item.classify, item.data, item.options]);
|
|
23
24
|
const handleLoadOptions = async () => {
|
|
24
|
-
var _a, _b
|
|
25
|
+
var _a, _b;
|
|
25
26
|
if (item.inputType === "local") {
|
|
26
27
|
let localOptions = [];
|
|
27
28
|
if (item.data && Array.isArray(item.data)) {
|
|
@@ -34,29 +35,13 @@ const MySelect = ({
|
|
|
34
35
|
}
|
|
35
36
|
setOptions(localOptions);
|
|
36
37
|
} else if (item.inputType === "dictionary") {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const response = await commonRequest(interfaceTypeDict, {
|
|
41
|
-
asctypeid: item.classify
|
|
42
|
-
});
|
|
43
|
-
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
44
|
-
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
45
|
-
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
46
|
-
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
47
|
-
}));
|
|
48
|
-
setOptions(dictionaryOptions);
|
|
49
|
-
}
|
|
50
|
-
} catch (error) {
|
|
51
|
-
message.error("加载选项失败");
|
|
52
|
-
} finally {
|
|
53
|
-
setLoading(false);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
38
|
+
getDict(interfaceTypeDict);
|
|
39
|
+
} else if (item.inputType === "system-dictionary") {
|
|
40
|
+
getDict(interfaceTypeSysDict);
|
|
56
41
|
} else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
57
42
|
try {
|
|
58
|
-
const keyFieldList = ((
|
|
59
|
-
const delimiter = ((
|
|
43
|
+
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
44
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
60
45
|
if (!keyFieldList.length) {
|
|
61
46
|
message.error("请配置key-field");
|
|
62
47
|
return;
|
|
@@ -103,6 +88,28 @@ const MySelect = ({
|
|
|
103
88
|
setOptions(defaultOptions);
|
|
104
89
|
}
|
|
105
90
|
};
|
|
91
|
+
const getDict = async (interfaceType) => {
|
|
92
|
+
var _a;
|
|
93
|
+
if (item.classify) {
|
|
94
|
+
setLoading(true);
|
|
95
|
+
try {
|
|
96
|
+
const response = await commonRequest(interfaceType, {
|
|
97
|
+
asctypeid: item.classify
|
|
98
|
+
});
|
|
99
|
+
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
100
|
+
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
101
|
+
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
102
|
+
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
103
|
+
}));
|
|
104
|
+
setOptions(dictionaryOptions);
|
|
105
|
+
}
|
|
106
|
+
} catch (error) {
|
|
107
|
+
message.error("加载选项失败");
|
|
108
|
+
} finally {
|
|
109
|
+
setLoading(false);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
106
113
|
return /* @__PURE__ */ jsx(
|
|
107
114
|
Select,
|
|
108
115
|
{
|
|
@@ -24,6 +24,7 @@ function useDynamicForm(props) {
|
|
|
24
24
|
updateDelFileList,
|
|
25
25
|
interfaceTypeChildren,
|
|
26
26
|
interfaceTypeDict,
|
|
27
|
+
interfaceTypeSysDict,
|
|
27
28
|
relatedidKey,
|
|
28
29
|
actionUrlKey,
|
|
29
30
|
actionUrlExtraParams,
|
|
@@ -404,6 +405,7 @@ function useDynamicForm(props) {
|
|
|
404
405
|
commonRequest,
|
|
405
406
|
value: formatValue,
|
|
406
407
|
interfaceTypeDict,
|
|
408
|
+
interfaceTypeSysDict,
|
|
407
409
|
actionUrlKey,
|
|
408
410
|
actionUrlExtraParams,
|
|
409
411
|
onChange: (val) => {
|
|
@@ -470,6 +472,7 @@ function useDynamicForm(props) {
|
|
|
470
472
|
handleUrlOptions,
|
|
471
473
|
value: formatValue,
|
|
472
474
|
interfaceTypeDict,
|
|
475
|
+
interfaceTypeSysDict,
|
|
473
476
|
actionUrlKey,
|
|
474
477
|
actionUrlExtraParams,
|
|
475
478
|
onChange: (e) => {
|
|
@@ -490,6 +493,7 @@ function useDynamicForm(props) {
|
|
|
490
493
|
value: formatValue,
|
|
491
494
|
handleUrlOptions,
|
|
492
495
|
interfaceTypeDict,
|
|
496
|
+
interfaceTypeSysDict,
|
|
493
497
|
actionUrlKey,
|
|
494
498
|
actionUrlExtraParams,
|
|
495
499
|
onChange: (val) => {
|
|
@@ -524,6 +528,7 @@ function useDynamicForm(props) {
|
|
|
524
528
|
value: item.attrvalue,
|
|
525
529
|
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style },
|
|
526
530
|
interfaceTypeDict,
|
|
531
|
+
interfaceTypeSysDict,
|
|
527
532
|
actionUrlKey,
|
|
528
533
|
actionUrlExtraParams
|
|
529
534
|
}
|
|
@@ -33,7 +33,7 @@ export interface Ijson {
|
|
|
33
33
|
'modal-height'?: number;
|
|
34
34
|
//代表弹窗列表表头内容
|
|
35
35
|
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
36
|
-
inputType?: 'local' | 'dictionary' | 'url';
|
|
36
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
37
37
|
data?: string[];
|
|
38
38
|
//代表调用【字典管理系统】的值
|
|
39
39
|
classify?: number | string | undefined;
|
|
@@ -21,6 +21,7 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
21
21
|
radioAlign = "horizontal",
|
|
22
22
|
interfaceTypeChildren = "YLLRDetailAttrlist",
|
|
23
23
|
interfaceTypeDict = "YLZDDictList",
|
|
24
|
+
interfaceTypeSysDict = "YLZDSysConfigList",
|
|
24
25
|
relatedidKey = "relatedid",
|
|
25
26
|
actionUrlKey = "action-url",
|
|
26
27
|
actionUrlExtraParams = {},
|
|
@@ -39,6 +40,7 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
39
40
|
formConfig,
|
|
40
41
|
interfaceTypeChildren,
|
|
41
42
|
interfaceTypeDict,
|
|
43
|
+
interfaceTypeSysDict,
|
|
42
44
|
relatedidKey,
|
|
43
45
|
actionUrlKey,
|
|
44
46
|
actionUrlExtraParams,
|
|
@@ -9,8 +9,9 @@ interface MyCascaderProps {
|
|
|
9
9
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
10
10
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
11
11
|
interfaceTypeDict: string;
|
|
12
|
+
interfaceTypeSysDict: string;
|
|
12
13
|
actionUrlKey: string;
|
|
13
14
|
actionUrlExtraParams: object;
|
|
14
15
|
}
|
|
15
|
-
declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default MyCascader;
|
|
@@ -11,6 +11,7 @@ const MyCascader = ({
|
|
|
11
11
|
commonRequestWidthParams,
|
|
12
12
|
commonRequest,
|
|
13
13
|
interfaceTypeDict,
|
|
14
|
+
interfaceTypeSysDict,
|
|
14
15
|
actionUrlKey,
|
|
15
16
|
actionUrlExtraParams
|
|
16
17
|
}) => {
|
|
@@ -21,7 +22,6 @@ const MyCascader = ({
|
|
|
21
22
|
handleLoadOptions();
|
|
22
23
|
}, [item.inputType, item.classify, item.data, item.options]);
|
|
23
24
|
const handleLoadOptions = async () => {
|
|
24
|
-
var _a;
|
|
25
25
|
if (item.inputType === "local") {
|
|
26
26
|
let localOptions = [];
|
|
27
27
|
if (item.data && Array.isArray(item.data)) {
|
|
@@ -34,25 +34,9 @@ const MyCascader = ({
|
|
|
34
34
|
}
|
|
35
35
|
setOptions(localOptions);
|
|
36
36
|
} else if (item.inputType === "dictionary") {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const response = await commonRequest(interfaceTypeDict, {
|
|
41
|
-
asctypeid: item.classify
|
|
42
|
-
});
|
|
43
|
-
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
44
|
-
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
45
|
-
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
46
|
-
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
47
|
-
}));
|
|
48
|
-
setOptions(dictionaryOptions);
|
|
49
|
-
}
|
|
50
|
-
} catch (error) {
|
|
51
|
-
message.error("加载选项失败");
|
|
52
|
-
} finally {
|
|
53
|
-
setLoading(false);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
37
|
+
await getDict(interfaceTypeSysDict);
|
|
38
|
+
} else if (item.inputType === "system-dictionary") {
|
|
39
|
+
getDict(interfaceTypeSysDict);
|
|
56
40
|
} else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
57
41
|
const res = await handleGetUrlData();
|
|
58
42
|
if (res && Array.isArray(res)) {
|
|
@@ -71,6 +55,28 @@ const MyCascader = ({
|
|
|
71
55
|
setOptions(defaultOptions);
|
|
72
56
|
}
|
|
73
57
|
};
|
|
58
|
+
const getDict = async (interfaceType) => {
|
|
59
|
+
var _a;
|
|
60
|
+
if (item.classify) {
|
|
61
|
+
setLoading(true);
|
|
62
|
+
try {
|
|
63
|
+
const response = await commonRequest(interfaceType, {
|
|
64
|
+
asctypeid: item.classify
|
|
65
|
+
});
|
|
66
|
+
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
67
|
+
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
68
|
+
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
69
|
+
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
70
|
+
}));
|
|
71
|
+
setOptions(dictionaryOptions);
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
message.error("加载选项失败");
|
|
75
|
+
} finally {
|
|
76
|
+
setLoading(false);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
74
80
|
const handleChange = (value2, selectedOptions) => {
|
|
75
81
|
if (onChange) {
|
|
76
82
|
onChange(value2);
|
|
@@ -11,6 +11,7 @@ export interface IMYRadio {
|
|
|
11
11
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
12
12
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
13
13
|
interfaceTypeDict: string;
|
|
14
|
+
interfaceTypeSysDict: string;
|
|
14
15
|
actionUrlKey: string;
|
|
15
16
|
actionUrlExtraParams: object;
|
|
16
17
|
}
|
|
@@ -14,6 +14,7 @@ const MyCheckbox = (props) => {
|
|
|
14
14
|
handleUrlOptions,
|
|
15
15
|
value,
|
|
16
16
|
interfaceTypeDict,
|
|
17
|
+
interfaceTypeSysDict,
|
|
17
18
|
actionUrlKey,
|
|
18
19
|
actionUrlExtraParams
|
|
19
20
|
} = props;
|
|
@@ -25,17 +26,19 @@ const MyCheckbox = (props) => {
|
|
|
25
26
|
const arr = (item == null ? void 0 : item.data) || [];
|
|
26
27
|
setList(arr.map((v) => ({ value: v, label: v })));
|
|
27
28
|
} else if ((item == null ? void 0 : item.inputType) === "dictionary") {
|
|
28
|
-
getList(item.classify);
|
|
29
|
+
getList(item.classify, interfaceTypeDict);
|
|
30
|
+
} else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
|
|
31
|
+
getList(item.classify, interfaceTypeSysDict);
|
|
29
32
|
} else if ((item == null ? void 0 : item.inputType) === "url") {
|
|
30
33
|
getUrlList();
|
|
31
34
|
}
|
|
32
35
|
}, [item == null ? void 0 : item.inputType]);
|
|
33
|
-
const getList = async (id) => {
|
|
36
|
+
const getList = async (id, interfaceType) => {
|
|
34
37
|
var _a;
|
|
35
38
|
if (!id) {
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
38
|
-
const res = await commonRequest(
|
|
41
|
+
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
39
42
|
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
40
43
|
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
41
44
|
setList(
|
|
@@ -12,6 +12,7 @@ export interface IMYRadio {
|
|
|
12
12
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
13
13
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
14
14
|
interfaceTypeDict: string;
|
|
15
|
+
interfaceTypeSysDict: string;
|
|
15
16
|
actionUrlKey: string;
|
|
16
17
|
actionUrlExtraParams: object;
|
|
17
18
|
}
|
|
@@ -14,6 +14,7 @@ const MyRadio = (props) => {
|
|
|
14
14
|
handleUrlOptions,
|
|
15
15
|
value,
|
|
16
16
|
interfaceTypeDict,
|
|
17
|
+
interfaceTypeSysDict,
|
|
17
18
|
actionUrlKey,
|
|
18
19
|
actionUrlExtraParams
|
|
19
20
|
} = props;
|
|
@@ -24,17 +25,19 @@ const MyRadio = (props) => {
|
|
|
24
25
|
const arr = (item == null ? void 0 : item.data) || [];
|
|
25
26
|
setList(arr.map((v) => ({ value: v, label: v })));
|
|
26
27
|
} else if ((item == null ? void 0 : item.inputType) === "dictionary") {
|
|
27
|
-
getList(item.classify);
|
|
28
|
+
getList(item.classify, interfaceTypeDict);
|
|
29
|
+
} else if ((item == null ? void 0 : item.inputType) === "system-dictionary") {
|
|
30
|
+
getList(item.classify, interfaceTypeSysDict);
|
|
28
31
|
} else if ((item == null ? void 0 : item.inputType) === "url") {
|
|
29
32
|
getUrlList();
|
|
30
33
|
}
|
|
31
34
|
}, [item == null ? void 0 : item.inputType]);
|
|
32
|
-
const getList = async (id) => {
|
|
35
|
+
const getList = async (id, interfaceType) => {
|
|
33
36
|
var _a;
|
|
34
37
|
if (!id) {
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
|
-
const res = await commonRequest(
|
|
40
|
+
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
38
41
|
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
39
42
|
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
40
43
|
setList(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ijson } from '../index.d';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, actionUrlKey, actionUrlExtraParams, }: {
|
|
3
|
+
declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, }: {
|
|
4
4
|
item: Ijson;
|
|
5
5
|
readonly?: boolean | undefined;
|
|
6
6
|
style?: any;
|
|
@@ -10,6 +10,7 @@ declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonReques
|
|
|
10
10
|
value: string | number | (string | number)[];
|
|
11
11
|
onChange: (val: string | number | (string | number)[]) => void;
|
|
12
12
|
interfaceTypeDict: string;
|
|
13
|
+
interfaceTypeSysDict: string;
|
|
13
14
|
actionUrlKey: string;
|
|
14
15
|
actionUrlExtraParams: object;
|
|
15
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,6 +12,7 @@ const MySelect = ({
|
|
|
12
12
|
value,
|
|
13
13
|
onChange,
|
|
14
14
|
interfaceTypeDict,
|
|
15
|
+
interfaceTypeSysDict,
|
|
15
16
|
actionUrlKey,
|
|
16
17
|
actionUrlExtraParams
|
|
17
18
|
}) => {
|
|
@@ -22,7 +23,7 @@ const MySelect = ({
|
|
|
22
23
|
handleLoadOptions();
|
|
23
24
|
}, [item.inputType, item.classify, item.data, item.options]);
|
|
24
25
|
const handleLoadOptions = async () => {
|
|
25
|
-
var _a, _b
|
|
26
|
+
var _a, _b;
|
|
26
27
|
if (item.inputType === "local") {
|
|
27
28
|
let localOptions = [];
|
|
28
29
|
if (item.data && Array.isArray(item.data)) {
|
|
@@ -35,29 +36,13 @@ const MySelect = ({
|
|
|
35
36
|
}
|
|
36
37
|
setOptions(localOptions);
|
|
37
38
|
} else if (item.inputType === "dictionary") {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const response = await commonRequest(interfaceTypeDict, {
|
|
42
|
-
asctypeid: item.classify
|
|
43
|
-
});
|
|
44
|
-
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
45
|
-
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
46
|
-
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
47
|
-
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
48
|
-
}));
|
|
49
|
-
setOptions(dictionaryOptions);
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
message.error("加载选项失败");
|
|
53
|
-
} finally {
|
|
54
|
-
setLoading(false);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
39
|
+
getDict(interfaceTypeDict);
|
|
40
|
+
} else if (item.inputType === "system-dictionary") {
|
|
41
|
+
getDict(interfaceTypeSysDict);
|
|
57
42
|
} else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
58
43
|
try {
|
|
59
|
-
const keyFieldList = ((
|
|
60
|
-
const delimiter = ((
|
|
44
|
+
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
45
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
61
46
|
if (!keyFieldList.length) {
|
|
62
47
|
message.error("请配置key-field");
|
|
63
48
|
return;
|
|
@@ -104,6 +89,28 @@ const MySelect = ({
|
|
|
104
89
|
setOptions(defaultOptions);
|
|
105
90
|
}
|
|
106
91
|
};
|
|
92
|
+
const getDict = async (interfaceType) => {
|
|
93
|
+
var _a;
|
|
94
|
+
if (item.classify) {
|
|
95
|
+
setLoading(true);
|
|
96
|
+
try {
|
|
97
|
+
const response = await commonRequest(interfaceType, {
|
|
98
|
+
asctypeid: item.classify
|
|
99
|
+
});
|
|
100
|
+
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
101
|
+
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
102
|
+
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
103
|
+
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
104
|
+
}));
|
|
105
|
+
setOptions(dictionaryOptions);
|
|
106
|
+
}
|
|
107
|
+
} catch (error) {
|
|
108
|
+
message.error("加载选项失败");
|
|
109
|
+
} finally {
|
|
110
|
+
setLoading(false);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
107
114
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
115
|
antd.Select,
|
|
109
116
|
{
|