szld-libs 0.3.80 → 0.3.82
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 +7207 -7269
- package/dist/szld-components.umd.js +39 -39
- package/es/components/DynamicFormMobile/func.d.ts +1 -2
- package/es/components/DynamicFormMobile/func.js +1 -2
- package/es/components/DynamicFormMobile/myCheckbox/index.d.ts +1 -1
- package/es/components/DynamicFormMobile/myCheckbox/index.js +15 -68
- package/es/components/DynamicFormMobile/myRadio/index.d.ts +1 -1
- package/es/components/DynamicFormMobile/myRadio/index.js +15 -70
- package/es/components/DynamicFormMobile/useDynamicForm.d.ts +2 -2
- package/es/hooks/useUniversalTable.d.ts +3 -2
- package/es/hooks/useUniversalTable.js +51 -34
- package/lib/components/DynamicFormMobile/func.d.ts +1 -2
- package/lib/components/DynamicFormMobile/func.js +1 -2
- package/lib/components/DynamicFormMobile/myCheckbox/index.d.ts +1 -1
- package/lib/components/DynamicFormMobile/myCheckbox/index.js +15 -68
- package/lib/components/DynamicFormMobile/myRadio/index.d.ts +1 -1
- package/lib/components/DynamicFormMobile/myRadio/index.js +15 -70
- package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +2 -2
- package/lib/hooks/useUniversalTable.d.ts +3 -2
- package/lib/hooks/useUniversalTable.js +51 -34
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
|
|
|
29
29
|
* @param param0
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item,
|
|
32
|
+
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
|
|
33
33
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
34
34
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
35
35
|
interfaceTypeDict?: string | undefined;
|
|
@@ -37,7 +37,6 @@ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonReq
|
|
|
37
37
|
actionUrlKey?: string | undefined;
|
|
38
38
|
actionUrlExtraParams?: object | undefined;
|
|
39
39
|
item: Ijson;
|
|
40
|
-
langConfig?: any[] | undefined;
|
|
41
40
|
}) => Promise<any[]>;
|
|
42
41
|
/**
|
|
43
42
|
* 单层详情数据对应到单个属性集
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { App, Checkbox } from "antd";
|
|
4
|
+
import { handleSelectOptions } from "../../DynamicForm/func";
|
|
4
5
|
const MyCheckbox = (props) => {
|
|
5
6
|
const {
|
|
6
7
|
item,
|
|
@@ -18,77 +19,23 @@ const MyCheckbox = (props) => {
|
|
|
18
19
|
actionUrlExtraParams,
|
|
19
20
|
langId
|
|
20
21
|
} = props;
|
|
21
|
-
|
|
22
|
+
App.useApp();
|
|
22
23
|
const [list, setList] = useState([]);
|
|
23
24
|
const [val, setVal] = useState(value || []);
|
|
24
25
|
useEffect(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (!id) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
42
|
-
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
43
|
-
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
44
|
-
setList(
|
|
45
|
-
arr.map((v) => {
|
|
46
|
-
const value2 = v.dicid + "-" + v.info;
|
|
47
|
-
return { value: value2, label: value2 };
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const getUrlList = async () => {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
try {
|
|
55
|
-
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
56
|
-
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
57
|
-
if (!keyFieldList.length) {
|
|
58
|
-
message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const response = await commonRequestWidthParams(
|
|
62
|
-
{
|
|
63
|
-
PageName: "dns_relay",
|
|
64
|
-
Controlname: "CallActionUrl",
|
|
65
|
-
InterfaceType: ""
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
[actionUrlKey]: item == null ? void 0 : item["action-url"],
|
|
69
|
-
...actionUrlExtraParams
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
if (response == null ? void 0 : response.data) {
|
|
73
|
-
const data = response == null ? void 0 : response.data;
|
|
74
|
-
const list2 = data == null ? void 0 : data.list;
|
|
75
|
-
let urlData = [];
|
|
76
|
-
if (Array.isArray(data)) {
|
|
77
|
-
urlData = data;
|
|
78
|
-
}
|
|
79
|
-
if (Array.isArray(list2)) {
|
|
80
|
-
urlData = list2;
|
|
81
|
-
}
|
|
82
|
-
const urlOptions = urlData.map((val2) => ({
|
|
83
|
-
label: handleUrlOptions(val2, delimiter, keyFieldList),
|
|
84
|
-
value: handleUrlOptions(val2, delimiter, keyFieldList)
|
|
85
|
-
}));
|
|
86
|
-
setList([...urlOptions]);
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
|
|
90
|
-
} finally {
|
|
91
|
-
}
|
|
26
|
+
handleLoadOptions();
|
|
27
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
28
|
+
const handleLoadOptions = async () => {
|
|
29
|
+
const list2 = await handleSelectOptions({
|
|
30
|
+
commonRequestWidthParams,
|
|
31
|
+
commonRequest,
|
|
32
|
+
interfaceTypeDict,
|
|
33
|
+
interfaceTypeSysDict,
|
|
34
|
+
actionUrlKey,
|
|
35
|
+
actionUrlExtraParams,
|
|
36
|
+
item
|
|
37
|
+
});
|
|
38
|
+
setList(list2);
|
|
92
39
|
};
|
|
93
40
|
return /* @__PURE__ */ jsx(
|
|
94
41
|
Checkbox.Group,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RadioChangeEvent } from 'antd';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
import { Ijson } from '
|
|
3
|
+
import { Ijson } from '../../DynamicForm/index.d';
|
|
4
4
|
export interface IMYRadio {
|
|
5
5
|
onChange?: (e: RadioChangeEvent) => void;
|
|
6
6
|
value?: string | number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { App, Radio } from "antd";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
+
import { handleSelectOptions } from "../../DynamicForm/func";
|
|
4
5
|
const MyRadio = (props) => {
|
|
5
6
|
const {
|
|
6
7
|
item,
|
|
@@ -18,78 +19,22 @@ const MyRadio = (props) => {
|
|
|
18
19
|
actionUrlExtraParams,
|
|
19
20
|
langId
|
|
20
21
|
} = props;
|
|
21
|
-
|
|
22
|
+
App.useApp();
|
|
22
23
|
const [list, setList] = useState([]);
|
|
23
24
|
useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!id) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
41
|
-
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
42
|
-
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
43
|
-
setList(
|
|
44
|
-
arr.map((v) => {
|
|
45
|
-
const value2 = v.dicid + "-" + v.info;
|
|
46
|
-
return { value: value2, label: value2 };
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const getUrlList = async () => {
|
|
52
|
-
var _a, _b;
|
|
53
|
-
try {
|
|
54
|
-
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
55
|
-
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
56
|
-
if (!keyFieldList.length) {
|
|
57
|
-
message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (!commonRequestWidthParams)
|
|
61
|
-
return;
|
|
62
|
-
const response = await commonRequestWidthParams(
|
|
63
|
-
{
|
|
64
|
-
PageName: "dns_relay",
|
|
65
|
-
Controlname: "CallActionUrl",
|
|
66
|
-
InterfaceType: ""
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
[actionUrlKey]: item == null ? void 0 : item["action-url"],
|
|
70
|
-
...actionUrlExtraParams
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
if (response == null ? void 0 : response.data) {
|
|
74
|
-
const data = response == null ? void 0 : response.data;
|
|
75
|
-
const list2 = data == null ? void 0 : data.list;
|
|
76
|
-
let urlData = [];
|
|
77
|
-
if (Array.isArray(data)) {
|
|
78
|
-
urlData = data;
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(list2)) {
|
|
81
|
-
urlData = list2;
|
|
82
|
-
}
|
|
83
|
-
const urlOptions = urlData.map((val) => ({
|
|
84
|
-
label: handleUrlOptions(val, delimiter, keyFieldList),
|
|
85
|
-
value: handleUrlOptions(val, delimiter, keyFieldList)
|
|
86
|
-
}));
|
|
87
|
-
setList([...urlOptions]);
|
|
88
|
-
}
|
|
89
|
-
} catch (error) {
|
|
90
|
-
message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
|
|
91
|
-
} finally {
|
|
92
|
-
}
|
|
25
|
+
handleLoadOptions();
|
|
26
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
27
|
+
const handleLoadOptions = async () => {
|
|
28
|
+
const list2 = await handleSelectOptions({
|
|
29
|
+
commonRequestWidthParams,
|
|
30
|
+
commonRequest,
|
|
31
|
+
interfaceTypeDict,
|
|
32
|
+
interfaceTypeSysDict,
|
|
33
|
+
actionUrlKey,
|
|
34
|
+
actionUrlExtraParams,
|
|
35
|
+
item
|
|
36
|
+
});
|
|
37
|
+
setList(list2);
|
|
93
38
|
};
|
|
94
39
|
return /* @__PURE__ */ jsx(
|
|
95
40
|
Radio.Group,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IformConfigItem, IformItemStyle } from '
|
|
2
|
+
import { IformConfigItem, IformItemStyle } from '../DynamicForm/index.d';
|
|
3
3
|
import { AxiosResponse } from 'axios';
|
|
4
4
|
import { FormListFieldData, UploadFile } from 'antd';
|
|
5
5
|
import { FormInstance } from 'react-vant';
|
|
@@ -40,6 +40,6 @@ declare function useDynamicForm(props: IDynamicFormProps): {
|
|
|
40
40
|
formListField?: NestedFormListFieldData | undefined;
|
|
41
41
|
isShowLabel?: boolean | undefined;
|
|
42
42
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
-
handleSetFormItemInitialValue: (itemWithJson: IformConfigItem) => any;
|
|
43
|
+
handleSetFormItemInitialValue: (itemWithJson: import(".").IformConfigItem) => any;
|
|
44
44
|
};
|
|
45
45
|
export default useDynamicForm;
|
|
@@ -29,7 +29,7 @@ declare function useUniversalTable(): {
|
|
|
29
29
|
formItems: import("szld-libs/lib/components/CreateForm").CreateFormItemProps<import("szld-libs/lib/components/CreateForm").ValueType>[];
|
|
30
30
|
selList: any[];
|
|
31
31
|
}>;
|
|
32
|
-
handleUniversalDelete: ({ commonRequest, refresh, interfaceType, record, configData, title, okText, cancelText, getTitle, pageID, }: {
|
|
32
|
+
handleUniversalDelete: ({ commonRequest, refresh, interfaceType, record, configData, title, okText, cancelText, getTitle, pageID, deleteItem, }: {
|
|
33
33
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
34
34
|
refresh: () => void;
|
|
35
35
|
interfaceType?: string | undefined;
|
|
@@ -40,7 +40,8 @@ declare function useUniversalTable(): {
|
|
|
40
40
|
cancelText?: string | undefined;
|
|
41
41
|
getTitle?: ((pageID: string, dataID: string, defaultTitle?: string) => string) | undefined;
|
|
42
42
|
pageID?: string | undefined;
|
|
43
|
-
|
|
43
|
+
deleteItem?: Record<string, any> | undefined;
|
|
44
|
+
}) => Promise<void>;
|
|
44
45
|
handleUniversalSearch: ({ values, currentSelList, currentActive, onSearch, tabItems, }: {
|
|
45
46
|
values: any;
|
|
46
47
|
currentSelList: any[];
|
|
@@ -205,7 +205,6 @@ function useUniversalTable() {
|
|
|
205
205
|
formItemProps: { style: { marginBottom: 10, minWidth: 127 } }
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
;
|
|
209
208
|
return { formItems, selList: selListData };
|
|
210
209
|
} catch (error) {
|
|
211
210
|
return { formItems: [], selList: [] };
|
|
@@ -307,7 +306,7 @@ function useUniversalTable() {
|
|
|
307
306
|
return numA - numB;
|
|
308
307
|
});
|
|
309
308
|
};
|
|
310
|
-
const handleUniversalDelete = ({
|
|
309
|
+
const handleUniversalDelete = async ({
|
|
311
310
|
commonRequest,
|
|
312
311
|
refresh,
|
|
313
312
|
interfaceType = "YLFWLRInstanceDelete",
|
|
@@ -317,41 +316,59 @@ function useUniversalTable() {
|
|
|
317
316
|
okText,
|
|
318
317
|
cancelText,
|
|
319
318
|
getTitle,
|
|
320
|
-
pageID
|
|
319
|
+
pageID,
|
|
320
|
+
deleteItem
|
|
321
321
|
}) => {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const params = {
|
|
330
|
-
instanceid: record == null ? void 0 : record.instanceid,
|
|
331
|
-
asid: record == null ? void 0 : record.asid,
|
|
332
|
-
...obj
|
|
333
|
-
};
|
|
334
|
-
modal.confirm({
|
|
335
|
-
title: title || "",
|
|
336
|
-
icon: null,
|
|
337
|
-
okType: "danger",
|
|
338
|
-
okText: okText || "",
|
|
339
|
-
cancelText: cancelText || "",
|
|
340
|
-
onOk: () => {
|
|
341
|
-
return new Promise(async (resolve, reject) => {
|
|
342
|
-
const res = await commonRequest(interfaceType, params);
|
|
343
|
-
const msg = getTitle && getTitle(pageID || "", res == null ? void 0 : res["msg-code"], res == null ? void 0 : res.msg) || "删除失败";
|
|
344
|
-
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
345
|
-
message.success(msg);
|
|
346
|
-
refresh();
|
|
347
|
-
resolve(res);
|
|
348
|
-
} else {
|
|
349
|
-
message.error(msg || "删除失败");
|
|
350
|
-
reject(res);
|
|
351
|
-
}
|
|
322
|
+
var _a, _b;
|
|
323
|
+
try {
|
|
324
|
+
let mustAttrid = (configData == null ? void 0 : configData["must-attrid"]) || [];
|
|
325
|
+
const sourceNumber = (deleteItem == null ? void 0 : deleteItem["source-number"]) || "";
|
|
326
|
+
if (!(mustAttrid == null ? void 0 : mustAttrid.length) && sourceNumber) {
|
|
327
|
+
const res = await commonRequest("YLKHDSelPCParam", {
|
|
328
|
+
"source-number": Number(sourceNumber)
|
|
352
329
|
});
|
|
330
|
+
if (res && res.ReturnValue === 1 && res.data) {
|
|
331
|
+
mustAttrid = ((_b = (_a = res.data) == null ? void 0 : _a["sourceNumber"]) == null ? void 0 : _b["must-attrid"]) || [];
|
|
332
|
+
}
|
|
353
333
|
}
|
|
354
|
-
|
|
334
|
+
if (!(mustAttrid == null ? void 0 : mustAttrid.length)) {
|
|
335
|
+
message.error("请先配置must-attrid");
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const obj = {};
|
|
339
|
+
for (const [key, value] of Object.entries(record)) {
|
|
340
|
+
if (mustAttrid.includes(key)) {
|
|
341
|
+
obj[key] = value;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const params = {
|
|
345
|
+
instanceid: record == null ? void 0 : record.instanceid,
|
|
346
|
+
asid: record == null ? void 0 : record.asid,
|
|
347
|
+
...obj
|
|
348
|
+
};
|
|
349
|
+
modal.confirm({
|
|
350
|
+
title: title || "",
|
|
351
|
+
icon: null,
|
|
352
|
+
okType: "danger",
|
|
353
|
+
okText: okText || "",
|
|
354
|
+
cancelText: cancelText || "",
|
|
355
|
+
onOk: () => {
|
|
356
|
+
return new Promise(async (resolve, reject) => {
|
|
357
|
+
const res = await commonRequest(interfaceType, params);
|
|
358
|
+
const msg = getTitle && getTitle(pageID || "", res == null ? void 0 : res["msg-code"], res == null ? void 0 : res.msg) || "删除失败";
|
|
359
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
360
|
+
message.success(msg);
|
|
361
|
+
refresh();
|
|
362
|
+
resolve(res);
|
|
363
|
+
} else {
|
|
364
|
+
message.error(msg || "删除失败");
|
|
365
|
+
reject(res);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
} catch (error) {
|
|
371
|
+
}
|
|
355
372
|
};
|
|
356
373
|
const handleUniversalSearch = ({
|
|
357
374
|
values,
|
|
@@ -29,7 +29,7 @@ export declare const getTitle: (langConfig: any[], dataID?: string) => any;
|
|
|
29
29
|
* @param param0
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item,
|
|
32
|
+
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
|
|
33
33
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
34
34
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
35
35
|
interfaceTypeDict?: string | undefined;
|
|
@@ -37,7 +37,6 @@ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonReq
|
|
|
37
37
|
actionUrlKey?: string | undefined;
|
|
38
38
|
actionUrlExtraParams?: object | undefined;
|
|
39
39
|
item: Ijson;
|
|
40
|
-
langConfig?: any[] | undefined;
|
|
41
40
|
}) => Promise<any[]>;
|
|
42
41
|
/**
|
|
43
42
|
* 单层详情数据对应到单个属性集
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const react = require("react");
|
|
4
4
|
const antd = require("antd");
|
|
5
|
+
const func = require("../../DynamicForm/func");
|
|
5
6
|
const MyCheckbox = (props) => {
|
|
6
7
|
const {
|
|
7
8
|
item,
|
|
@@ -19,77 +20,23 @@ const MyCheckbox = (props) => {
|
|
|
19
20
|
actionUrlExtraParams,
|
|
20
21
|
langId
|
|
21
22
|
} = props;
|
|
22
|
-
|
|
23
|
+
antd.App.useApp();
|
|
23
24
|
const [list, setList] = react.useState([]);
|
|
24
25
|
const [val, setVal] = react.useState(value || []);
|
|
25
26
|
react.useEffect(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!id) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
43
|
-
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
44
|
-
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
45
|
-
setList(
|
|
46
|
-
arr.map((v) => {
|
|
47
|
-
const value2 = v.dicid + "-" + v.info;
|
|
48
|
-
return { value: value2, label: value2 };
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const getUrlList = async () => {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
try {
|
|
56
|
-
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
57
|
-
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
58
|
-
if (!keyFieldList.length) {
|
|
59
|
-
message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const response = await commonRequestWidthParams(
|
|
63
|
-
{
|
|
64
|
-
PageName: "dns_relay",
|
|
65
|
-
Controlname: "CallActionUrl",
|
|
66
|
-
InterfaceType: ""
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
[actionUrlKey]: item == null ? void 0 : item["action-url"],
|
|
70
|
-
...actionUrlExtraParams
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
if (response == null ? void 0 : response.data) {
|
|
74
|
-
const data = response == null ? void 0 : response.data;
|
|
75
|
-
const list2 = data == null ? void 0 : data.list;
|
|
76
|
-
let urlData = [];
|
|
77
|
-
if (Array.isArray(data)) {
|
|
78
|
-
urlData = data;
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(list2)) {
|
|
81
|
-
urlData = list2;
|
|
82
|
-
}
|
|
83
|
-
const urlOptions = urlData.map((val2) => ({
|
|
84
|
-
label: handleUrlOptions(val2, delimiter, keyFieldList),
|
|
85
|
-
value: handleUrlOptions(val2, delimiter, keyFieldList)
|
|
86
|
-
}));
|
|
87
|
-
setList([...urlOptions]);
|
|
88
|
-
}
|
|
89
|
-
} catch (error) {
|
|
90
|
-
message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
|
|
91
|
-
} finally {
|
|
92
|
-
}
|
|
27
|
+
handleLoadOptions();
|
|
28
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
29
|
+
const handleLoadOptions = async () => {
|
|
30
|
+
const list2 = await func.handleSelectOptions({
|
|
31
|
+
commonRequestWidthParams,
|
|
32
|
+
commonRequest,
|
|
33
|
+
interfaceTypeDict,
|
|
34
|
+
interfaceTypeSysDict,
|
|
35
|
+
actionUrlKey,
|
|
36
|
+
actionUrlExtraParams,
|
|
37
|
+
item
|
|
38
|
+
});
|
|
39
|
+
setList(list2);
|
|
93
40
|
};
|
|
94
41
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
95
42
|
antd.Checkbox.Group,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RadioChangeEvent } from 'antd';
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
|
-
import { Ijson } from '
|
|
3
|
+
import { Ijson } from '../../DynamicForm/index.d';
|
|
4
4
|
export interface IMYRadio {
|
|
5
5
|
onChange?: (e: RadioChangeEvent) => void;
|
|
6
6
|
value?: string | number;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const antd = require("antd");
|
|
4
4
|
const react = require("react");
|
|
5
|
+
const func = require("../../DynamicForm/func");
|
|
5
6
|
const MyRadio = (props) => {
|
|
6
7
|
const {
|
|
7
8
|
item,
|
|
@@ -19,78 +20,22 @@ const MyRadio = (props) => {
|
|
|
19
20
|
actionUrlExtraParams,
|
|
20
21
|
langId
|
|
21
22
|
} = props;
|
|
22
|
-
|
|
23
|
+
antd.App.useApp();
|
|
23
24
|
const [list, setList] = react.useState([]);
|
|
24
25
|
react.useEffect(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (!id) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const res = await commonRequest(interfaceType, { asctypeid: id });
|
|
42
|
-
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
43
|
-
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
44
|
-
setList(
|
|
45
|
-
arr.map((v) => {
|
|
46
|
-
const value2 = v.dicid + "-" + v.info;
|
|
47
|
-
return { value: value2, label: value2 };
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const getUrlList = async () => {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
try {
|
|
55
|
-
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
56
|
-
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
57
|
-
if (!keyFieldList.length) {
|
|
58
|
-
message.error(langId === "10001" ? "请配置key-field" : "Please configure key-field");
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (!commonRequestWidthParams)
|
|
62
|
-
return;
|
|
63
|
-
const response = await commonRequestWidthParams(
|
|
64
|
-
{
|
|
65
|
-
PageName: "dns_relay",
|
|
66
|
-
Controlname: "CallActionUrl",
|
|
67
|
-
InterfaceType: ""
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
[actionUrlKey]: item == null ? void 0 : item["action-url"],
|
|
71
|
-
...actionUrlExtraParams
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
if (response == null ? void 0 : response.data) {
|
|
75
|
-
const data = response == null ? void 0 : response.data;
|
|
76
|
-
const list2 = data == null ? void 0 : data.list;
|
|
77
|
-
let urlData = [];
|
|
78
|
-
if (Array.isArray(data)) {
|
|
79
|
-
urlData = data;
|
|
80
|
-
}
|
|
81
|
-
if (Array.isArray(list2)) {
|
|
82
|
-
urlData = list2;
|
|
83
|
-
}
|
|
84
|
-
const urlOptions = urlData.map((val) => ({
|
|
85
|
-
label: handleUrlOptions(val, delimiter, keyFieldList),
|
|
86
|
-
value: handleUrlOptions(val, delimiter, keyFieldList)
|
|
87
|
-
}));
|
|
88
|
-
setList([...urlOptions]);
|
|
89
|
-
}
|
|
90
|
-
} catch (error) {
|
|
91
|
-
message.error(langId === "10001" ? "加载选项失败" : "Failed to load options");
|
|
92
|
-
} finally {
|
|
93
|
-
}
|
|
26
|
+
handleLoadOptions();
|
|
27
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
28
|
+
const handleLoadOptions = async () => {
|
|
29
|
+
const list2 = await func.handleSelectOptions({
|
|
30
|
+
commonRequestWidthParams,
|
|
31
|
+
commonRequest,
|
|
32
|
+
interfaceTypeDict,
|
|
33
|
+
interfaceTypeSysDict,
|
|
34
|
+
actionUrlKey,
|
|
35
|
+
actionUrlExtraParams,
|
|
36
|
+
item
|
|
37
|
+
});
|
|
38
|
+
setList(list2);
|
|
94
39
|
};
|
|
95
40
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
41
|
antd.Radio.Group,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IformConfigItem, IformItemStyle } from '
|
|
2
|
+
import { IformConfigItem, IformItemStyle } from '../DynamicForm/index.d';
|
|
3
3
|
import { AxiosResponse } from 'axios';
|
|
4
4
|
import { FormListFieldData, UploadFile } from 'antd';
|
|
5
5
|
import { FormInstance } from 'react-vant';
|
|
@@ -40,6 +40,6 @@ declare function useDynamicForm(props: IDynamicFormProps): {
|
|
|
40
40
|
formListField?: NestedFormListFieldData | undefined;
|
|
41
41
|
isShowLabel?: boolean | undefined;
|
|
42
42
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
-
handleSetFormItemInitialValue: (itemWithJson: IformConfigItem) => any;
|
|
43
|
+
handleSetFormItemInitialValue: (itemWithJson: import(".").IformConfigItem) => any;
|
|
44
44
|
};
|
|
45
45
|
export default useDynamicForm;
|