szld-libs 0.2.52 → 0.2.54
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/style.css +1 -1
- package/dist/szld-components.es.js +17007 -15272
- package/dist/szld-components.umd.js +55 -55
- package/es/components/DynamicForm/index.d.ts +102 -0
- package/es/components/DynamicForm/index.js +55 -0
- package/es/components/DynamicForm/myCascader/index.d.ts +13 -0
- package/es/components/DynamicForm/myCascader/index.js +186 -0
- package/es/components/DynamicForm/myCascader/vite.svg +1 -0
- package/es/components/DynamicForm/myCheckbox/index.d.ts +15 -0
- package/es/components/DynamicForm/myCheckbox/index.js +102 -0
- package/es/components/DynamicForm/myCheckbox/vite.svg +1 -0
- package/es/components/DynamicForm/myRadio/index.d.ts +16 -0
- package/es/components/DynamicForm/myRadio/index.js +100 -0
- package/es/components/DynamicForm/myRadio/vite.svg +1 -0
- package/es/components/DynamicForm/mySelect/index.d.ts +13 -0
- package/es/components/DynamicForm/mySelect/index.js +126 -0
- package/es/components/DynamicForm/mySelect/vite.svg +1 -0
- package/es/components/DynamicForm/myUpload/index.css +3 -0
- package/es/components/DynamicForm/myUpload/index.d.ts +15 -0
- package/es/components/DynamicForm/myUpload/index.js +102 -0
- package/es/components/DynamicForm/myUpload/vite.svg +1 -0
- package/es/components/DynamicForm/radioCard/index.d.ts +12 -0
- package/es/components/DynamicForm/radioCard/index.js +142 -0
- package/es/components/DynamicForm/radioCard/vite.svg +1 -0
- package/es/components/DynamicForm/selectModel/index.d.ts +21 -0
- package/es/components/DynamicForm/selectModel/index.js +197 -0
- package/es/components/DynamicForm/selectModel/vite.svg +1 -0
- package/es/components/DynamicForm/useDynamicForm.d.ts +26 -0
- package/es/components/DynamicForm/useDynamicForm.js +554 -0
- package/es/components/DynamicForm/vite.svg +1 -0
- package/es/main.d.ts +3 -1
- package/es/main.js +22 -18
- package/es/utils/method.d.ts +21 -0
- package/es/utils/method.js +186 -0
- package/lib/components/DynamicForm/index.d.ts +102 -0
- package/lib/components/DynamicForm/index.js +54 -0
- package/lib/components/DynamicForm/myCascader/index.d.ts +13 -0
- package/lib/components/DynamicForm/myCascader/index.js +185 -0
- package/lib/components/DynamicForm/myCascader/vite.svg +1 -0
- package/lib/components/DynamicForm/myCheckbox/index.d.ts +15 -0
- package/lib/components/DynamicForm/myCheckbox/index.js +101 -0
- package/lib/components/DynamicForm/myCheckbox/vite.svg +1 -0
- package/lib/components/DynamicForm/myRadio/index.d.ts +16 -0
- package/lib/components/DynamicForm/myRadio/index.js +99 -0
- package/lib/components/DynamicForm/myRadio/vite.svg +1 -0
- package/lib/components/DynamicForm/mySelect/index.d.ts +13 -0
- package/lib/components/DynamicForm/mySelect/index.js +125 -0
- package/lib/components/DynamicForm/mySelect/vite.svg +1 -0
- package/lib/components/DynamicForm/myUpload/index.css +3 -0
- package/lib/components/DynamicForm/myUpload/index.d.ts +15 -0
- package/lib/components/DynamicForm/myUpload/index.js +101 -0
- package/lib/components/DynamicForm/myUpload/vite.svg +1 -0
- package/lib/components/DynamicForm/radioCard/index.d.ts +12 -0
- package/lib/components/DynamicForm/radioCard/index.js +141 -0
- package/lib/components/DynamicForm/radioCard/vite.svg +1 -0
- package/lib/components/DynamicForm/selectModel/index.d.ts +21 -0
- package/lib/components/DynamicForm/selectModel/index.js +197 -0
- package/lib/components/DynamicForm/selectModel/vite.svg +1 -0
- package/lib/components/DynamicForm/useDynamicForm.d.ts +26 -0
- package/lib/components/DynamicForm/useDynamicForm.js +553 -0
- package/lib/components/DynamicForm/vite.svg +1 -0
- package/lib/main.d.ts +3 -1
- package/lib/main.js +5 -0
- package/lib/utils/method.d.ts +21 -0
- package/lib/utils/method.js +186 -0
- package/package.json +3 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
|
|
3
|
+
export interface IformConfigItem {
|
|
4
|
+
xh: number;
|
|
5
|
+
asid: string;
|
|
6
|
+
astype: number;
|
|
7
|
+
tname: string;
|
|
8
|
+
attrid: string;
|
|
9
|
+
attrname: string;
|
|
10
|
+
attrtype: number;
|
|
11
|
+
info: string;
|
|
12
|
+
info_base64: number;
|
|
13
|
+
createtime: string;
|
|
14
|
+
attrvalue: any;
|
|
15
|
+
serialnum: number;
|
|
16
|
+
children: IformConfigItem[];
|
|
17
|
+
json: Ijson;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Ijson {
|
|
21
|
+
input: InputType;
|
|
22
|
+
length?: number;
|
|
23
|
+
'label-value'?: string; //代表属性固定取值,并且不可在实例化时修改
|
|
24
|
+
hide: true;
|
|
25
|
+
'upload-accept'?: string;
|
|
26
|
+
'upload-max-count'?: number;
|
|
27
|
+
'upload-size'?: number;
|
|
28
|
+
//代表弹窗标题
|
|
29
|
+
'modal-caption'?: string;
|
|
30
|
+
//代表弹窗宽度
|
|
31
|
+
'modal-width'?: number;
|
|
32
|
+
//代表弹窗高度
|
|
33
|
+
'modal-height'?: number;
|
|
34
|
+
//代表弹窗列表表头内容
|
|
35
|
+
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
36
|
+
inputType?: 'local' | 'dictionary' | 'url';
|
|
37
|
+
data?: string[];
|
|
38
|
+
//代表调用【字典管理系统】的值
|
|
39
|
+
classify?: number | string | undefined;
|
|
40
|
+
//代表调用字典对应的归类名 ID
|
|
41
|
+
//代表从"action-url"从获取选择的数据
|
|
42
|
+
'action-url'?: string;
|
|
43
|
+
//代表执行一个动作的 UCE 的 url
|
|
44
|
+
'key-field'?: { list: string[]; delimiter: string };
|
|
45
|
+
default?: string | number | boolean | null | undefined | dayjs.Dayjs;
|
|
46
|
+
//代表属性默认值,如果没配置或空着,则代表没有默认值
|
|
47
|
+
instruction?: '';
|
|
48
|
+
//代表在实例化时对属性的填写说明,会作为提示语显示在属性名称旁
|
|
49
|
+
'instruction-color'?: '#000000';
|
|
50
|
+
//代表在实例化时对属性的填写说明,字体颜色的配置,如果不配置默认#333333
|
|
51
|
+
must?: true;
|
|
52
|
+
//代表属性值是否必填,true 为必填、false 为非必填,如果没配置则默认为 false
|
|
53
|
+
'cascader-delimiter'?: string;
|
|
54
|
+
options?: { label: string; value: string | number }[];
|
|
55
|
+
format?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 定义支持的输入类型枚举
|
|
59
|
+
export type InputType =
|
|
60
|
+
| 'text'
|
|
61
|
+
| 'textarea'
|
|
62
|
+
| 'number'
|
|
63
|
+
| 'select'
|
|
64
|
+
| 'mult-select'
|
|
65
|
+
| 'modal-select'
|
|
66
|
+
| 'modal-mult-select'
|
|
67
|
+
| 'date-picker'
|
|
68
|
+
| 'time-picker'
|
|
69
|
+
| 'week-picker'
|
|
70
|
+
| 'month-picker'
|
|
71
|
+
| 'quarter-picker'
|
|
72
|
+
| 'year-picker'
|
|
73
|
+
| 'second-picker'
|
|
74
|
+
| 'image'
|
|
75
|
+
| 'file'
|
|
76
|
+
| 'video'
|
|
77
|
+
| 'audio'
|
|
78
|
+
| 'label'
|
|
79
|
+
| 'radio'
|
|
80
|
+
| 'checkbox'
|
|
81
|
+
| 'cascader'
|
|
82
|
+
| string;
|
|
83
|
+
|
|
84
|
+
// 定义文件上传值类型
|
|
85
|
+
export interface CustomUploadFile {
|
|
86
|
+
FilePath: string;
|
|
87
|
+
FileName: string;
|
|
88
|
+
FileId: string;
|
|
89
|
+
url?: string;
|
|
90
|
+
name?: string;
|
|
91
|
+
uid?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IformItemStyle {
|
|
95
|
+
type: InputType;
|
|
96
|
+
style?: React.CSSProperties;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface Iselect {
|
|
100
|
+
label: string;
|
|
101
|
+
value: string | number;
|
|
102
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useImperativeHandle, Fragment } from "react";
|
|
3
|
+
import { Row } from "antd";
|
|
4
|
+
import useDynamicForm from "./useDynamicForm";
|
|
5
|
+
const DynamicForm = forwardRef((props, ref) => {
|
|
6
|
+
const {
|
|
7
|
+
formConfig,
|
|
8
|
+
setFormConfig,
|
|
9
|
+
form,
|
|
10
|
+
readonly = false,
|
|
11
|
+
relatedid,
|
|
12
|
+
colNum = 1,
|
|
13
|
+
colSpace = [0, 0],
|
|
14
|
+
instructionShowMode = "flex",
|
|
15
|
+
defaultWidth = 358,
|
|
16
|
+
commonRequestWidthParams,
|
|
17
|
+
uploadAction,
|
|
18
|
+
commonRequest,
|
|
19
|
+
formItemStyle = [],
|
|
20
|
+
radioAlign = "horizontal",
|
|
21
|
+
interfaceTypeChildren = "YLLRDetailAttrlist"
|
|
22
|
+
} = props;
|
|
23
|
+
const delFileListRef = useRef([]);
|
|
24
|
+
const updateDelFileList = (file) => {
|
|
25
|
+
delFileListRef.current.push(file);
|
|
26
|
+
};
|
|
27
|
+
const { handleRenderItem } = useDynamicForm({
|
|
28
|
+
commonRequestWidthParams,
|
|
29
|
+
uploadAction,
|
|
30
|
+
commonRequest,
|
|
31
|
+
setFormConfig,
|
|
32
|
+
updateDelFileList,
|
|
33
|
+
formConfig,
|
|
34
|
+
interfaceTypeChildren
|
|
35
|
+
});
|
|
36
|
+
useImperativeHandle(ref, () => ({
|
|
37
|
+
getDelFileList: () => {
|
|
38
|
+
return delFileListRef.current;
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
return /* @__PURE__ */ jsx(Row, { gutter: colSpace, children: formConfig.map((item, index) => /* @__PURE__ */ jsx(Fragment, { children: handleRenderItem({
|
|
42
|
+
item,
|
|
43
|
+
readonly,
|
|
44
|
+
colNum,
|
|
45
|
+
instructionShowMode,
|
|
46
|
+
relatedid,
|
|
47
|
+
form,
|
|
48
|
+
defaultWidth,
|
|
49
|
+
formItemStyle,
|
|
50
|
+
radioAlign
|
|
51
|
+
}) }, item.attrid || `form-item-${index}`)) });
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
DynamicForm as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
interface MyCascaderProps {
|
|
4
|
+
item: any;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
value?: string[];
|
|
7
|
+
onChange?: (value: any) => void;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
10
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
11
|
+
}
|
|
12
|
+
declare const MyCascader: ({ item, readonly, value, onChange, style, commonRequestWidthParams, commonRequest, }: MyCascaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default MyCascader;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { App, Cascader } from "antd";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
const MyCascader = ({
|
|
5
|
+
item,
|
|
6
|
+
readonly,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
style,
|
|
10
|
+
commonRequestWidthParams,
|
|
11
|
+
commonRequest
|
|
12
|
+
}) => {
|
|
13
|
+
const [options, setOptions] = useState([]);
|
|
14
|
+
const [loading, setLoading] = useState(false);
|
|
15
|
+
const { message } = App.useApp();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
handleLoadOptions();
|
|
18
|
+
}, [item.inputType, item.classify, item.data, item.options]);
|
|
19
|
+
const handleLoadOptions = async () => {
|
|
20
|
+
var _a;
|
|
21
|
+
if (item.inputType === "local") {
|
|
22
|
+
let localOptions = [];
|
|
23
|
+
if (item.data && Array.isArray(item.data)) {
|
|
24
|
+
localOptions = item.data.map((val) => ({
|
|
25
|
+
label: val,
|
|
26
|
+
value: val
|
|
27
|
+
}));
|
|
28
|
+
} else if (item.options && Array.isArray(item.options)) {
|
|
29
|
+
localOptions = item.options;
|
|
30
|
+
}
|
|
31
|
+
setOptions(localOptions);
|
|
32
|
+
} else if (item.inputType === "dictionary") {
|
|
33
|
+
if (item.classify) {
|
|
34
|
+
setLoading(true);
|
|
35
|
+
try {
|
|
36
|
+
const response = await commonRequest("YLZDDictList", {
|
|
37
|
+
asctypeid: item.classify
|
|
38
|
+
});
|
|
39
|
+
if (((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) && Array.isArray(response.data.list)) {
|
|
40
|
+
const dictionaryOptions = response.data.list.map((dictItem) => ({
|
|
41
|
+
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
42
|
+
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
43
|
+
}));
|
|
44
|
+
setOptions(dictionaryOptions);
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
message.error("加载选项失败");
|
|
48
|
+
} finally {
|
|
49
|
+
setLoading(false);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} else if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
53
|
+
const res = await handleGetUrlData();
|
|
54
|
+
if (res && Array.isArray(res)) {
|
|
55
|
+
setOptions(res);
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
let defaultOptions = [];
|
|
59
|
+
if (item.data && Array.isArray(item.data)) {
|
|
60
|
+
defaultOptions = item.data.map((val) => ({
|
|
61
|
+
label: val,
|
|
62
|
+
value: val
|
|
63
|
+
}));
|
|
64
|
+
} else if (item.options && Array.isArray(item.options)) {
|
|
65
|
+
defaultOptions = item.options;
|
|
66
|
+
}
|
|
67
|
+
setOptions(defaultOptions);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const handleChange = (value2, selectedOptions) => {
|
|
71
|
+
if (onChange) {
|
|
72
|
+
onChange(value2);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const handleGetUrlData = async (targetOption) => {
|
|
76
|
+
return new Promise(async (resolve, reject) => {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
79
|
+
const searchFields = (item == null ? void 0 : item["search-field"]) || [];
|
|
80
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "-";
|
|
81
|
+
if (!list.length) {
|
|
82
|
+
message.error("请配置key-field");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const params = {
|
|
86
|
+
"action-url": item == null ? void 0 : item["action-url"]
|
|
87
|
+
};
|
|
88
|
+
if (targetOption) {
|
|
89
|
+
searchFields.forEach((field) => {
|
|
90
|
+
params[field] = targetOption[field] || "";
|
|
91
|
+
});
|
|
92
|
+
params["level"] = Number(targetOption.level || 0) + 1 || "";
|
|
93
|
+
}
|
|
94
|
+
setLoading(true);
|
|
95
|
+
try {
|
|
96
|
+
const response = await commonRequestWidthParams(
|
|
97
|
+
{
|
|
98
|
+
PageName: "dns_relay",
|
|
99
|
+
Controlname: "CallActionUrl",
|
|
100
|
+
InterfaceType: "DPGLSysemName"
|
|
101
|
+
},
|
|
102
|
+
params
|
|
103
|
+
);
|
|
104
|
+
if (((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.list) && Array.isArray(response.data.list)) {
|
|
105
|
+
const dictionaryOptions = response.data.list.map((item2) => ({
|
|
106
|
+
...item2,
|
|
107
|
+
label: `${item2[list[0]] || ""}${delimiter}${item2[list[1]] || ""}`,
|
|
108
|
+
value: `${item2[list[0]] || ""}${delimiter}${item2[list[1]] || ""}`,
|
|
109
|
+
children: [],
|
|
110
|
+
isLeaf: (item2 == null ? void 0 : item2.subcount) === 0
|
|
111
|
+
}));
|
|
112
|
+
resolve(dictionaryOptions);
|
|
113
|
+
}
|
|
114
|
+
reject([]);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
message.error("加载选项失败");
|
|
117
|
+
reject([]);
|
|
118
|
+
} finally {
|
|
119
|
+
reject([]);
|
|
120
|
+
setLoading(false);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const loadData = async (selectedOptions) => {
|
|
125
|
+
const targetOption = selectedOptions[selectedOptions.length - 1];
|
|
126
|
+
const children = await handleGetUrlData(targetOption) || [];
|
|
127
|
+
targetOption.children = children;
|
|
128
|
+
setOptions([...options]);
|
|
129
|
+
return children;
|
|
130
|
+
};
|
|
131
|
+
const filter = (inputValue, path) => path.some((option) => option.label.toLowerCase().includes(inputValue.toLowerCase()));
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
Cascader,
|
|
134
|
+
{
|
|
135
|
+
showSearch: { filter },
|
|
136
|
+
loading,
|
|
137
|
+
placeholder: "请选择",
|
|
138
|
+
loadData,
|
|
139
|
+
disabled: readonly,
|
|
140
|
+
onChange: handleChange,
|
|
141
|
+
style: { ...style },
|
|
142
|
+
options,
|
|
143
|
+
value,
|
|
144
|
+
onOpenChange: async (visible) => {
|
|
145
|
+
var _a;
|
|
146
|
+
if (visible && (value == null ? void 0 : value.length)) {
|
|
147
|
+
const list = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
148
|
+
const searchFields = (item == null ? void 0 : item["search-field"]) || [];
|
|
149
|
+
if (!list.length || !searchFields.length) {
|
|
150
|
+
message.error("请配置key-field和search-field");
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const targetFieldIndex = list.findIndex((item2) => item2 === searchFields[0]);
|
|
154
|
+
if (targetFieldIndex === -1) {
|
|
155
|
+
message.error("key-field与search-field配置不匹配");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const values = value.map((v) => {
|
|
159
|
+
const arr = v.split("-");
|
|
160
|
+
return arr[targetFieldIndex] || "";
|
|
161
|
+
}).filter(Boolean);
|
|
162
|
+
let children = options;
|
|
163
|
+
for (const [index, el] of values.entries()) {
|
|
164
|
+
if (index === values.length - 1) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
const selectedOptions = children.filter((item2) => item2[searchFields[0]] === el);
|
|
168
|
+
if (selectedOptions.length === 0) {
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
const targetOption = selectedOptions[0];
|
|
172
|
+
if (targetOption.children && targetOption.children.length > 0) {
|
|
173
|
+
children = targetOption.children;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const newChildren = await loadData(selectedOptions);
|
|
177
|
+
children = newChildren;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
export {
|
|
185
|
+
MyCascader as default
|
|
186
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { Ijson } from '../index.d';
|
|
3
|
+
export interface IMYRadio {
|
|
4
|
+
value?: (string | number)[];
|
|
5
|
+
onChange?: (checkedValue: any[]) => void;
|
|
6
|
+
item: Ijson;
|
|
7
|
+
readonly?: boolean;
|
|
8
|
+
options?: any;
|
|
9
|
+
radioAlign?: 'vertical' | 'horizontal';
|
|
10
|
+
handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
|
|
11
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
12
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
13
|
+
}
|
|
14
|
+
declare const MyCheckbox: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default MyCheckbox;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { App, Checkbox } from "antd";
|
|
4
|
+
const MyCheckbox = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
item,
|
|
7
|
+
onChange,
|
|
8
|
+
readonly = false,
|
|
9
|
+
options,
|
|
10
|
+
radioAlign = "horizontal",
|
|
11
|
+
commonRequestWidthParams,
|
|
12
|
+
commonRequest,
|
|
13
|
+
handleUrlOptions,
|
|
14
|
+
value
|
|
15
|
+
} = props;
|
|
16
|
+
const { message } = App.useApp();
|
|
17
|
+
const [list, setList] = useState([]);
|
|
18
|
+
const [val, setVal] = useState(value || []);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if ((item == null ? void 0 : item.inputType) === "local") {
|
|
21
|
+
const arr = (item == null ? void 0 : item.data) || [];
|
|
22
|
+
setList(arr.map((v) => ({ value: v, label: v })));
|
|
23
|
+
} else if ((item == null ? void 0 : item.inputType) === "dictionary") {
|
|
24
|
+
getList(item.classify);
|
|
25
|
+
} else if ((item == null ? void 0 : item.inputType) === "url") {
|
|
26
|
+
getUrlList();
|
|
27
|
+
}
|
|
28
|
+
}, [item == null ? void 0 : item.inputType]);
|
|
29
|
+
const getList = async (id) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!id) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const res = await commonRequest("YLZDDictList", { asctypeid: id });
|
|
35
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
36
|
+
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
37
|
+
setList(
|
|
38
|
+
arr.map((v) => {
|
|
39
|
+
const value2 = v.dicid + "-" + v.info;
|
|
40
|
+
return { value: value2, label: value2 };
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const getUrlList = async () => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
try {
|
|
48
|
+
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
49
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
50
|
+
if (!keyFieldList.length) {
|
|
51
|
+
message.error("请配置key-field");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const response = await commonRequestWidthParams(
|
|
55
|
+
{
|
|
56
|
+
PageName: "dns_relay",
|
|
57
|
+
Controlname: "CallActionUrl",
|
|
58
|
+
InterfaceType: "DPGLSysemName"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"action-url": item == null ? void 0 : item["action-url"]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
if (response == null ? void 0 : response.data) {
|
|
65
|
+
const data = response == null ? void 0 : response.data;
|
|
66
|
+
const list2 = data == null ? void 0 : data.list;
|
|
67
|
+
let urlData = [];
|
|
68
|
+
if (Array.isArray(data)) {
|
|
69
|
+
urlData = data;
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(list2)) {
|
|
72
|
+
urlData = list2;
|
|
73
|
+
}
|
|
74
|
+
const urlOptions = urlData.map((val2) => ({
|
|
75
|
+
label: handleUrlOptions(val2, delimiter, keyFieldList),
|
|
76
|
+
value: handleUrlOptions(val2, delimiter, keyFieldList)
|
|
77
|
+
}));
|
|
78
|
+
setList([...urlOptions]);
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
message.error("加载选项失败");
|
|
82
|
+
} finally {
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
Checkbox.Group,
|
|
87
|
+
{
|
|
88
|
+
...options,
|
|
89
|
+
options: list,
|
|
90
|
+
value: val,
|
|
91
|
+
style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" },
|
|
92
|
+
onChange: (val2) => {
|
|
93
|
+
setVal(val2);
|
|
94
|
+
onChange == null ? void 0 : onChange(val2);
|
|
95
|
+
},
|
|
96
|
+
disabled: readonly
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
MyCheckbox as default
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RadioChangeEvent } from 'antd';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
import { Ijson } from '../index.d';
|
|
4
|
+
export interface IMYRadio {
|
|
5
|
+
onChange?: (e: RadioChangeEvent) => void;
|
|
6
|
+
value?: string | number;
|
|
7
|
+
item: Ijson;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
options?: any;
|
|
10
|
+
radioAlign?: 'vertical' | 'horizontal';
|
|
11
|
+
handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
|
|
12
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
13
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
14
|
+
}
|
|
15
|
+
declare const MyRadio: (props: IMYRadio) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default MyRadio;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { App, Radio } from "antd";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
const MyRadio = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
item,
|
|
7
|
+
onChange,
|
|
8
|
+
readonly = false,
|
|
9
|
+
options,
|
|
10
|
+
radioAlign = "horizontal",
|
|
11
|
+
commonRequestWidthParams,
|
|
12
|
+
commonRequest,
|
|
13
|
+
handleUrlOptions,
|
|
14
|
+
value
|
|
15
|
+
} = props;
|
|
16
|
+
const { message } = App.useApp();
|
|
17
|
+
const [list, setList] = useState([]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if ((item == null ? void 0 : item.inputType) === "local") {
|
|
20
|
+
const arr = (item == null ? void 0 : item.data) || [];
|
|
21
|
+
setList(arr.map((v) => ({ value: v, label: v })));
|
|
22
|
+
} else if ((item == null ? void 0 : item.inputType) === "dictionary") {
|
|
23
|
+
getList(item.classify);
|
|
24
|
+
} else if ((item == null ? void 0 : item.inputType) === "url") {
|
|
25
|
+
getUrlList();
|
|
26
|
+
}
|
|
27
|
+
}, [item == null ? void 0 : item.inputType]);
|
|
28
|
+
const getList = async (id) => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (!id) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const res = await commonRequest("YLZDDictList", { asctypeid: id });
|
|
34
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
35
|
+
const arr = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
36
|
+
setList(
|
|
37
|
+
arr.map((v) => {
|
|
38
|
+
const value2 = v.dicid + "-" + v.info;
|
|
39
|
+
return { value: value2, label: value2 };
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const getUrlList = async () => {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
try {
|
|
47
|
+
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) || [];
|
|
48
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
49
|
+
if (!keyFieldList.length) {
|
|
50
|
+
message.error("请配置key-field");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!commonRequestWidthParams)
|
|
54
|
+
return;
|
|
55
|
+
const response = await commonRequestWidthParams(
|
|
56
|
+
{
|
|
57
|
+
PageName: "dns_relay",
|
|
58
|
+
Controlname: "CallActionUrl",
|
|
59
|
+
InterfaceType: "DPGLSysemName"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"action-url": item == null ? void 0 : item["action-url"]
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
if (response == null ? void 0 : response.data) {
|
|
66
|
+
const data = response == null ? void 0 : response.data;
|
|
67
|
+
const list2 = data == null ? void 0 : data.list;
|
|
68
|
+
let urlData = [];
|
|
69
|
+
if (Array.isArray(data)) {
|
|
70
|
+
urlData = data;
|
|
71
|
+
}
|
|
72
|
+
if (Array.isArray(list2)) {
|
|
73
|
+
urlData = list2;
|
|
74
|
+
}
|
|
75
|
+
const urlOptions = urlData.map((val) => ({
|
|
76
|
+
label: handleUrlOptions(val, delimiter, keyFieldList),
|
|
77
|
+
value: handleUrlOptions(val, delimiter, keyFieldList)
|
|
78
|
+
}));
|
|
79
|
+
setList([...urlOptions]);
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
message.error("加载选项失败");
|
|
83
|
+
} finally {
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
Radio.Group,
|
|
88
|
+
{
|
|
89
|
+
...options,
|
|
90
|
+
options: list,
|
|
91
|
+
onChange,
|
|
92
|
+
disabled: readonly,
|
|
93
|
+
value,
|
|
94
|
+
style: radioAlign === "vertical" ? { display: "flex", flexDirection: "column", gap: "8px", width: "100%" } : { width: "100%" }
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
MyRadio as default
|
|
100
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ijson } from '../index.d';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
declare const MySelect: ({ item, readonly, style, handleUrlOptions, commonRequestWidthParams, commonRequest, value, onChange, }: {
|
|
4
|
+
item: Ijson;
|
|
5
|
+
readonly?: boolean | undefined;
|
|
6
|
+
style?: any;
|
|
7
|
+
handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
|
|
8
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
9
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
10
|
+
value: string | number | (string | number)[];
|
|
11
|
+
onChange: (val: string | number | (string | number)[]) => void;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default MySelect;
|