szld-libs 0.2.98 → 0.3.1
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 +32089 -20004
- package/dist/szld-components.umd.js +72 -60
- package/es/components/DynamicForm/index.d.ts +2 -0
- package/es/components/DynamicForm/index.js +3 -2
- package/es/components/DynamicForm/selectModel/index.js +1 -1
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +27 -0
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +242 -0
- package/es/components/DynamicForm/selectModelBackfillFormItem/vite.svg +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +22 -1
- package/es/components/DynamicFormMobile/func.d.ts +35 -0
- package/es/components/DynamicFormMobile/func.js +204 -0
- package/es/components/DynamicFormMobile/index.d.ts +116 -0
- package/es/components/DynamicFormMobile/index.js +134 -0
- package/es/components/DynamicFormMobile/myCascader/index.d.ts +17 -0
- package/es/components/DynamicFormMobile/myCascader/index.js +196 -0
- package/es/components/DynamicFormMobile/myCascader/vite.svg +1 -0
- package/es/components/DynamicFormMobile/myCheckbox/index.d.ts +19 -0
- package/es/components/DynamicFormMobile/myCheckbox/index.js +109 -0
- package/es/components/DynamicFormMobile/myCheckbox/vite.svg +1 -0
- package/es/components/DynamicFormMobile/myRadio/index.d.ts +20 -0
- package/es/components/DynamicFormMobile/myRadio/index.js +107 -0
- package/es/components/DynamicFormMobile/myRadio/vite.svg +1 -0
- package/es/components/DynamicFormMobile/mySelect/index.css +31 -0
- package/es/components/DynamicFormMobile/mySelect/index.d.ts +16 -0
- package/es/components/DynamicFormMobile/mySelect/index.js +147 -0
- package/es/components/DynamicFormMobile/mySelect/vite.svg +1 -0
- package/es/components/DynamicFormMobile/myUpload/index.css +3 -0
- package/es/components/DynamicFormMobile/myUpload/index.d.ts +16 -0
- package/es/components/DynamicFormMobile/myUpload/index.js +103 -0
- package/es/components/DynamicFormMobile/myUpload/vite.svg +1 -0
- package/es/components/DynamicFormMobile/radioCard/index.d.ts +12 -0
- package/es/components/DynamicFormMobile/radioCard/index.js +142 -0
- package/es/components/DynamicFormMobile/radioCard/vite.svg +1 -0
- package/es/components/DynamicFormMobile/selectModel/index.d.ts +22 -0
- package/es/components/DynamicFormMobile/selectModel/index.js +235 -0
- package/es/components/DynamicFormMobile/selectModel/vite.svg +1 -0
- package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +27 -0
- package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +242 -0
- package/es/components/DynamicFormMobile/selectModelBackfillFormItem/vite.svg +1 -0
- package/es/components/DynamicFormMobile/useDynamicForm.d.ts +43 -0
- package/es/components/DynamicFormMobile/useDynamicForm.js +772 -0
- package/es/components/DynamicFormMobile/vite.svg +1 -0
- package/es/index.css +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +36 -30
- package/es/main.d.ts +2 -1
- package/es/main.js +22 -20
- package/es/mock/index.d.ts +1 -305
- package/es/mock/index.js +20 -364
- package/es/services/index.js +3 -5
- package/es/services/request.js +2 -2
- package/es/utils/method.d.ts +4 -1
- package/es/utils/method.js +25 -8
- package/lib/components/DynamicForm/index.d.ts +2 -0
- package/lib/components/DynamicForm/index.js +3 -2
- package/lib/components/DynamicForm/selectModel/index.js +1 -1
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +27 -0
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +242 -0
- package/lib/components/DynamicForm/selectModelBackfillFormItem/vite.svg +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +22 -1
- package/lib/components/DynamicFormMobile/func.d.ts +35 -0
- package/lib/components/DynamicFormMobile/func.js +204 -0
- package/lib/components/DynamicFormMobile/index.d.ts +116 -0
- package/lib/components/DynamicFormMobile/index.js +133 -0
- package/lib/components/DynamicFormMobile/myCascader/index.d.ts +17 -0
- package/lib/components/DynamicFormMobile/myCascader/index.js +195 -0
- package/lib/components/DynamicFormMobile/myCascader/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/myCheckbox/index.d.ts +19 -0
- package/lib/components/DynamicFormMobile/myCheckbox/index.js +108 -0
- package/lib/components/DynamicFormMobile/myCheckbox/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/myRadio/index.d.ts +20 -0
- package/lib/components/DynamicFormMobile/myRadio/index.js +106 -0
- package/lib/components/DynamicFormMobile/myRadio/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/mySelect/index.css +31 -0
- package/lib/components/DynamicFormMobile/mySelect/index.d.ts +16 -0
- package/lib/components/DynamicFormMobile/mySelect/index.js +146 -0
- package/lib/components/DynamicFormMobile/mySelect/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/myUpload/index.css +3 -0
- package/lib/components/DynamicFormMobile/myUpload/index.d.ts +16 -0
- package/lib/components/DynamicFormMobile/myUpload/index.js +102 -0
- package/lib/components/DynamicFormMobile/myUpload/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/radioCard/index.d.ts +12 -0
- package/lib/components/DynamicFormMobile/radioCard/index.js +141 -0
- package/lib/components/DynamicFormMobile/radioCard/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/selectModel/index.d.ts +22 -0
- package/lib/components/DynamicFormMobile/selectModel/index.js +235 -0
- package/lib/components/DynamicFormMobile/selectModel/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +27 -0
- package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +242 -0
- package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +43 -0
- package/lib/components/DynamicFormMobile/useDynamicForm.js +771 -0
- package/lib/components/DynamicFormMobile/vite.svg +1 -0
- package/lib/index.css +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +36 -30
- package/lib/main.d.ts +2 -1
- package/lib/main.js +2 -0
- package/lib/mock/index.d.ts +1 -305
- package/lib/mock/index.js +19 -363
- package/lib/services/index.js +3 -5
- package/lib/services/request.js +2 -2
- package/lib/utils/method.d.ts +4 -1
- package/lib/utils/method.js +25 -8
- package/package.json +1 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const antd = require("antd");
|
|
5
|
+
const react = require("react");
|
|
6
|
+
function SelectModel(props) {
|
|
7
|
+
const { item, disabled, style, commonRequestWidthParams, CustomModalComponent, attrid, form } = props;
|
|
8
|
+
const attrValue = antd.Form.useWatch(attrid, form);
|
|
9
|
+
const { message } = antd.App.useApp();
|
|
10
|
+
const mode = item.input;
|
|
11
|
+
const [value, setValue] = react.useState(props.value);
|
|
12
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
|
+
const [selectedRowKeys, setSelectedRowKeys] = react.useState([]);
|
|
14
|
+
const [selectedRecords, setSelectedRecords] = react.useState([]);
|
|
15
|
+
const [loading, setLoading] = react.useState(false);
|
|
16
|
+
const [params, setParams] = react.useState({
|
|
17
|
+
PageNum: 1,
|
|
18
|
+
PageSize: 6
|
|
19
|
+
});
|
|
20
|
+
const [dataSource, setDataSource] = react.useState([]);
|
|
21
|
+
const [total, setTotal] = react.useState(0);
|
|
22
|
+
const columns = buildColumns();
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
if (!modalVisible) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
getData();
|
|
28
|
+
}, [modalVisible, params]);
|
|
29
|
+
const onSelectChange = (keys, selectedRows) => {
|
|
30
|
+
setSelectedRowKeys(keys);
|
|
31
|
+
setSelectedRecords(selectedRows);
|
|
32
|
+
};
|
|
33
|
+
const getData = async () => {
|
|
34
|
+
var _a;
|
|
35
|
+
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
36
|
+
setLoading(true);
|
|
37
|
+
try {
|
|
38
|
+
const response = await commonRequestWidthParams(
|
|
39
|
+
{
|
|
40
|
+
PageName: "dns_relay",
|
|
41
|
+
Controlname: "CallActionUrl",
|
|
42
|
+
InterfaceType: ""
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"action-url": item == null ? void 0 : item["action-url"],
|
|
46
|
+
...params,
|
|
47
|
+
...(item == null ? void 0 : item["action-url-extra-params"]) || {}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
if ((response == null ? void 0 : response.ReturnValue) === 0) {
|
|
51
|
+
message.error(response.msg);
|
|
52
|
+
setLoading(false);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const data = response == null ? void 0 : response.data;
|
|
56
|
+
const tempData = (_a = data == null ? void 0 : data.list) == null ? void 0 : _a.map((item2, index) => {
|
|
57
|
+
const _rowKey = (params.PageNum - 1) * params.PageSize + index;
|
|
58
|
+
return {
|
|
59
|
+
...item2,
|
|
60
|
+
_rowKey
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
const tempSelectedRecords = (tempData == null ? void 0 : tempData.filter((item2) => selectedRowKeys.includes(item2._rowKey))) || [];
|
|
64
|
+
setSelectedRecords(tempSelectedRecords);
|
|
65
|
+
setDataSource([...tempData || []]);
|
|
66
|
+
setTotal((data == null ? void 0 : data.number) || 0);
|
|
67
|
+
setLoading(false);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
setLoading(false);
|
|
70
|
+
message.error(error.msg || "参数错误");
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
message.error("请配置action-url");
|
|
75
|
+
};
|
|
76
|
+
const openModal = () => {
|
|
77
|
+
var _a;
|
|
78
|
+
if (disabled) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (value) {
|
|
82
|
+
const keyField = item == null ? void 0 : item["key-field"];
|
|
83
|
+
const el = keyField == null ? void 0 : keyField[attrid];
|
|
84
|
+
const { delimiter = "-", list = [] } = el || {};
|
|
85
|
+
if (!keyField) {
|
|
86
|
+
message.error("请配置key-field");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
switch (mode) {
|
|
90
|
+
case "mul-field-modal-select":
|
|
91
|
+
const id = (_a = value == null ? void 0 : value.split(delimiter)) == null ? void 0 : _a[0];
|
|
92
|
+
const index = dataSource == null ? void 0 : dataSource.findIndex((item2) => Object.values(item2).includes(id));
|
|
93
|
+
setSelectedRowKeys([index]);
|
|
94
|
+
break;
|
|
95
|
+
case "modal-mult-select":
|
|
96
|
+
const values = value == null ? void 0 : value.split(",");
|
|
97
|
+
const tempKeys = values == null ? void 0 : values.map((item2) => {
|
|
98
|
+
var _a2;
|
|
99
|
+
const id2 = (_a2 = item2.split(delimiter)) == null ? void 0 : _a2[0];
|
|
100
|
+
return dataSource == null ? void 0 : dataSource.findIndex((item3) => id2.includes((item3 == null ? void 0 : item3.typeid) || (item3 == null ? void 0 : item3.instanceid)));
|
|
101
|
+
});
|
|
102
|
+
setSelectedRowKeys(tempKeys);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
setModalVisible(true);
|
|
107
|
+
};
|
|
108
|
+
const handleOk = async () => {
|
|
109
|
+
try {
|
|
110
|
+
const value2 = await buildValueFromSelectedRows(selectedRecords, item);
|
|
111
|
+
setValue((value2 == null ? void 0 : value2[attrid]) || "");
|
|
112
|
+
props.onSure(value2);
|
|
113
|
+
setModalVisible(false);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
message.error(error.msg || "参数错误");
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const handleCancel = () => {
|
|
119
|
+
setParams({
|
|
120
|
+
...params,
|
|
121
|
+
PageNum: 1
|
|
122
|
+
});
|
|
123
|
+
setModalVisible(false);
|
|
124
|
+
};
|
|
125
|
+
function buildColumns() {
|
|
126
|
+
const modalFieldList = item["modal-field-list"];
|
|
127
|
+
let columns2 = [];
|
|
128
|
+
for (let fieldName in modalFieldList) {
|
|
129
|
+
let title = modalFieldList[fieldName];
|
|
130
|
+
const column = { dataIndex: fieldName, title };
|
|
131
|
+
columns2 = [...columns2, column];
|
|
132
|
+
}
|
|
133
|
+
return columns2;
|
|
134
|
+
}
|
|
135
|
+
const onPageChange = (pageNum) => {
|
|
136
|
+
setParams({
|
|
137
|
+
...params,
|
|
138
|
+
PageNum: pageNum
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
antd.Select,
|
|
144
|
+
{
|
|
145
|
+
placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择",
|
|
146
|
+
onClick: openModal,
|
|
147
|
+
open: false,
|
|
148
|
+
value: attrValue,
|
|
149
|
+
disabled,
|
|
150
|
+
style
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
CustomModalComponent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
+
CustomModalComponent,
|
|
155
|
+
{
|
|
156
|
+
title: item["modal-caption"] || "",
|
|
157
|
+
open: modalVisible,
|
|
158
|
+
onOk: handleOk,
|
|
159
|
+
onCancel: handleCancel,
|
|
160
|
+
modalStyle: { width: item["modal-width"] ?? 600, minHeight: item["modal-height"] ?? 400 },
|
|
161
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
162
|
+
antd.Table,
|
|
163
|
+
{
|
|
164
|
+
columns,
|
|
165
|
+
loading,
|
|
166
|
+
dataSource,
|
|
167
|
+
rowKey: (record) => record._rowKey,
|
|
168
|
+
scroll: { y: "calc(80vh - 300px)" },
|
|
169
|
+
rowSelection: {
|
|
170
|
+
type: mode === "mul-field-modal-select" ? "radio" : "checkbox",
|
|
171
|
+
selectedRowKeys,
|
|
172
|
+
onChange: onSelectChange
|
|
173
|
+
},
|
|
174
|
+
pagination: {
|
|
175
|
+
total,
|
|
176
|
+
current: params.PageNum,
|
|
177
|
+
pageSize: params.PageSize,
|
|
178
|
+
onChange: onPageChange
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
) || /* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
antd.Modal,
|
|
185
|
+
{
|
|
186
|
+
title: item["modal-caption"],
|
|
187
|
+
open: modalVisible,
|
|
188
|
+
onOk: handleOk,
|
|
189
|
+
onCancel: handleCancel,
|
|
190
|
+
width: item["modal-width"] ?? 600,
|
|
191
|
+
okButtonProps: { disabled: selectedRowKeys.length === 0 },
|
|
192
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
193
|
+
antd.Table,
|
|
194
|
+
{
|
|
195
|
+
columns,
|
|
196
|
+
loading,
|
|
197
|
+
dataSource,
|
|
198
|
+
rowKey: (record) => record._rowKey,
|
|
199
|
+
rowSelection: {
|
|
200
|
+
type: mode === "mul-field-modal-select" ? "radio" : "checkbox",
|
|
201
|
+
selectedRowKeys,
|
|
202
|
+
onChange: onSelectChange
|
|
203
|
+
},
|
|
204
|
+
pagination: {
|
|
205
|
+
total,
|
|
206
|
+
current: params.PageNum,
|
|
207
|
+
pageSize: params.PageSize,
|
|
208
|
+
onChange: onPageChange
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
function buildValueFromSelectedRows(selectedRows, attributeEnrollFormat) {
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
try {
|
|
219
|
+
var keyfields = attributeEnrollFormat["key-field"];
|
|
220
|
+
if (!keyfields) {
|
|
221
|
+
reject({ msg: "请配置key-field" });
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
let res = {};
|
|
225
|
+
selectedRows.forEach((item) => {
|
|
226
|
+
for (let [key, value] of Object.entries(keyfields)) {
|
|
227
|
+
const list = (value == null ? void 0 : value.list) ?? [];
|
|
228
|
+
const delimiter = (value == null ? void 0 : value.delimiter) ?? "-";
|
|
229
|
+
const arr = list.map((v) => {
|
|
230
|
+
return item == null ? void 0 : item[v];
|
|
231
|
+
});
|
|
232
|
+
res[key] = arr.join(delimiter);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
resolve(res);
|
|
236
|
+
} catch (error) {
|
|
237
|
+
reject({ msg: "key-field参数配置错误" });
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
exports.buildValueFromSelectedRows = buildValueFromSelectedRows;
|
|
242
|
+
exports.default = SelectModel;
|
|
@@ -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>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const icons = require("@ant-design/icons");
|
|
3
4
|
const func = require("./func");
|
|
4
5
|
const method = require("../../utils/method");
|
|
6
|
+
const SelectModelBackfillFormItem = require("./selectModelBackfillFormItem");
|
|
5
7
|
const react = require("react");
|
|
6
8
|
const isoWeek = require("dayjs/plugin/isoWeek");
|
|
7
9
|
const SelectModel = require("./selectModel");
|
|
@@ -12,7 +14,6 @@ const RadioCard = require("./radioCard");
|
|
|
12
14
|
const MySelect = require("./mySelect");
|
|
13
15
|
const MyUpload = require("./myUpload");
|
|
14
16
|
const MyRadio = require("./myRadio");
|
|
15
|
-
const icons = require("@ant-design/icons");
|
|
16
17
|
const antd = require("antd");
|
|
17
18
|
dayjs.extend(isoWeek);
|
|
18
19
|
function useDynamicForm(props) {
|
|
@@ -433,6 +434,7 @@ function useDynamicForm(props) {
|
|
|
433
434
|
}) => {
|
|
434
435
|
var _a, _b, _c, _d;
|
|
435
436
|
const mode = item.json.input || "text";
|
|
437
|
+
const attrid = item.attrid;
|
|
436
438
|
const formatValue = func.handleSetFormItemInitialValue(item);
|
|
437
439
|
const message2 = ((_a = item.json) == null ? void 0 : _a["default-prompt"]) || "";
|
|
438
440
|
const disableDateGoover = ((_b = item.json) == null ? void 0 : _b["disable-date-goover"]) || false;
|
|
@@ -534,6 +536,25 @@ function useDynamicForm(props) {
|
|
|
534
536
|
}
|
|
535
537
|
);
|
|
536
538
|
}
|
|
539
|
+
case "mul-field-modal-select": {
|
|
540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
541
|
+
SelectModelBackfillFormItem,
|
|
542
|
+
{
|
|
543
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
|
|
544
|
+
item: item.json,
|
|
545
|
+
form,
|
|
546
|
+
attrid,
|
|
547
|
+
value: item.attrvalue || item.json.default || "",
|
|
548
|
+
commonRequestWidthParams,
|
|
549
|
+
commonRequest,
|
|
550
|
+
onSure: async (value) => {
|
|
551
|
+
form.setFieldsValue(value);
|
|
552
|
+
},
|
|
553
|
+
disabled: readonly,
|
|
554
|
+
CustomModalComponent
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
537
558
|
case "date-picker":
|
|
538
559
|
case "time-picker":
|
|
539
560
|
case "week-picker":
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IformConfigItem, Ijson } from './index.d';
|
|
2
|
+
import { RangePickerProps } from 'antd/es/date-picker';
|
|
3
|
+
import { AxiosResponse } from 'axios';
|
|
4
|
+
export declare const handleGetPlaceholder: (itemWithJson: IformConfigItem) => string;
|
|
5
|
+
/**
|
|
6
|
+
* 处理表单项目初始值
|
|
7
|
+
* 根据输入类型转换初始值为组件所需格式
|
|
8
|
+
*/
|
|
9
|
+
export declare const handleSetFormItemInitialValue: (itemWithJson: IformConfigItem) => any;
|
|
10
|
+
export declare const disabledDate: RangePickerProps['disabledDate'];
|
|
11
|
+
/**
|
|
12
|
+
* 处理URL选项
|
|
13
|
+
* 将URL中的指定字段拼接为字符串
|
|
14
|
+
*/
|
|
15
|
+
export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
|
|
16
|
+
/**
|
|
17
|
+
* 根据配置处理成下拉数据
|
|
18
|
+
* @param param0
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare const handleSelectOptions: ({ commonRequestWidthParams, commonRequest, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, item, }: {
|
|
22
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
23
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
24
|
+
interfaceTypeDict?: string | undefined;
|
|
25
|
+
interfaceTypeSysDict?: string | undefined;
|
|
26
|
+
actionUrlKey?: string | undefined;
|
|
27
|
+
actionUrlExtraParams?: object | undefined;
|
|
28
|
+
item: Ijson;
|
|
29
|
+
}) => Promise<any[]>;
|
|
30
|
+
/**
|
|
31
|
+
* attrList 格式的单层数组 处理成对象{attrid:attrname}
|
|
32
|
+
*/
|
|
33
|
+
export declare const handleGetSingleAttrListObj: (children: any[]) => {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}[];
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dayjs = require("dayjs");
|
|
4
|
+
const antd = require("antd");
|
|
5
|
+
const handleGetPlaceholder = (itemWithJson) => {
|
|
6
|
+
const { input = "" } = itemWithJson.json || {};
|
|
7
|
+
let placeholder = "请输入";
|
|
8
|
+
if ([
|
|
9
|
+
"radio",
|
|
10
|
+
"checkbox",
|
|
11
|
+
"select",
|
|
12
|
+
"mult-select",
|
|
13
|
+
"modal-select",
|
|
14
|
+
"date-picker",
|
|
15
|
+
"range-picker",
|
|
16
|
+
"multiple-date-picker",
|
|
17
|
+
"time-picker",
|
|
18
|
+
"week-picker",
|
|
19
|
+
"month-picker",
|
|
20
|
+
"quarter-picker",
|
|
21
|
+
"year-picker",
|
|
22
|
+
"second-picker"
|
|
23
|
+
].includes(input)) {
|
|
24
|
+
placeholder = "请选择";
|
|
25
|
+
}
|
|
26
|
+
if (["image", "file", "video", "audio"].includes(input)) {
|
|
27
|
+
placeholder = "请上传";
|
|
28
|
+
}
|
|
29
|
+
return placeholder;
|
|
30
|
+
};
|
|
31
|
+
const handleSetFormItemInitialValue = (itemWithJson) => {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
|
|
34
|
+
let initialValue = itemWithJson.attrvalue || ((_b = itemWithJson.json) == null ? void 0 : _b.default) || "";
|
|
35
|
+
if (inputType === "label" && initialValue) {
|
|
36
|
+
initialValue = ((_c = itemWithJson.json) == null ? void 0 : _c["label-value"]) ?? initialValue ?? "-";
|
|
37
|
+
}
|
|
38
|
+
if (inputType === "range-picker" && initialValue) {
|
|
39
|
+
try {
|
|
40
|
+
initialValue = initialValue == null ? void 0 : initialValue.split("~");
|
|
41
|
+
initialValue = initialValue.map((v) => v);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
initialValue = void 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (inputType === "multiple-date-picker" && initialValue) {
|
|
47
|
+
try {
|
|
48
|
+
initialValue = initialValue == null ? void 0 : initialValue.split(",");
|
|
49
|
+
initialValue = initialValue.map((v) => dayjs());
|
|
50
|
+
} catch (error) {
|
|
51
|
+
initialValue = void 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (inputType === "cascader" && initialValue && typeof initialValue === "string") {
|
|
55
|
+
const delimiter = (_d = itemWithJson.json) == null ? void 0 : _d["cascader-delimiter"];
|
|
56
|
+
if (delimiter) {
|
|
57
|
+
initialValue = initialValue.split(delimiter).filter(Boolean);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (["mult-select", "checkbox"].includes(inputType) && initialValue && typeof initialValue === "string") {
|
|
61
|
+
initialValue = initialValue.split(",").filter(Boolean);
|
|
62
|
+
}
|
|
63
|
+
if (["image", "video", "audio", "file"].includes(inputType) && initialValue) {
|
|
64
|
+
try {
|
|
65
|
+
const fileList = Array.isArray(initialValue) ? initialValue : JSON.parse(initialValue);
|
|
66
|
+
initialValue = fileList.map((file) => ({
|
|
67
|
+
...file,
|
|
68
|
+
url: file.FilePath,
|
|
69
|
+
name: file.FileName,
|
|
70
|
+
uid: file.FileId
|
|
71
|
+
}));
|
|
72
|
+
} catch (error) {
|
|
73
|
+
initialValue = [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (itemWithJson.attrtype === 1) {
|
|
77
|
+
initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
|
|
78
|
+
}
|
|
79
|
+
return initialValue || void 0;
|
|
80
|
+
};
|
|
81
|
+
const disabledDate = (current) => {
|
|
82
|
+
return current && current < dayjs().startOf("day");
|
|
83
|
+
};
|
|
84
|
+
const handleUrlOptions = (val, delimiter, list) => {
|
|
85
|
+
let arr = [];
|
|
86
|
+
list.forEach((item) => {
|
|
87
|
+
arr.push(val == null ? void 0 : val[item]);
|
|
88
|
+
});
|
|
89
|
+
return arr.join(delimiter || "-");
|
|
90
|
+
};
|
|
91
|
+
const handleSelectOptions = async ({
|
|
92
|
+
commonRequestWidthParams,
|
|
93
|
+
commonRequest,
|
|
94
|
+
interfaceTypeDict = "YLZDDictList",
|
|
95
|
+
interfaceTypeSysDict = "YLZDSysConfigList",
|
|
96
|
+
actionUrlKey = "action-url",
|
|
97
|
+
actionUrlExtraParams = {},
|
|
98
|
+
item
|
|
99
|
+
}) => {
|
|
100
|
+
var _a;
|
|
101
|
+
let options = [];
|
|
102
|
+
const getDict = async (interfaceType) => {
|
|
103
|
+
var _a2;
|
|
104
|
+
let list = [];
|
|
105
|
+
if (item.classify) {
|
|
106
|
+
try {
|
|
107
|
+
const response = await commonRequest(interfaceType, {
|
|
108
|
+
asctypeid: item.classify
|
|
109
|
+
});
|
|
110
|
+
if (((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.list) && Array.isArray(response.data.list)) {
|
|
111
|
+
list = response.data.list.map((dictItem) => ({
|
|
112
|
+
label: `${dictItem.dicid || ""}-${dictItem.info || ""}`,
|
|
113
|
+
value: `${dictItem.dicid || ""}-${dictItem.info || ""}`
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
antd.message.error("加载选项失败");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return list;
|
|
121
|
+
};
|
|
122
|
+
const getUrlOptions = async () => {
|
|
123
|
+
var _a2, _b;
|
|
124
|
+
try {
|
|
125
|
+
const keyFieldList = ((_a2 = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a2.list) || [];
|
|
126
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) || "";
|
|
127
|
+
if (!keyFieldList.length) {
|
|
128
|
+
antd.message.error("请配置key-field");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const response = await commonRequestWidthParams(
|
|
132
|
+
{
|
|
133
|
+
PageName: "dns_relay",
|
|
134
|
+
Controlname: "CallActionUrl",
|
|
135
|
+
InterfaceType: ""
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
[actionUrlKey]: item == null ? void 0 : item["action-url"],
|
|
139
|
+
...actionUrlExtraParams
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
if (response == null ? void 0 : response.data) {
|
|
143
|
+
const data = response == null ? void 0 : response.data;
|
|
144
|
+
const list = (data == null ? void 0 : data.list) || [];
|
|
145
|
+
let urlData = [];
|
|
146
|
+
if (Array.isArray(data)) {
|
|
147
|
+
urlData = data;
|
|
148
|
+
}
|
|
149
|
+
if (Array.isArray(list)) {
|
|
150
|
+
urlData = list;
|
|
151
|
+
}
|
|
152
|
+
options = urlData.map((val) => ({
|
|
153
|
+
label: handleUrlOptions(val, delimiter, keyFieldList),
|
|
154
|
+
value: handleUrlOptions(val, delimiter, keyFieldList)
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
} catch (error) {
|
|
158
|
+
antd.message.error("加载选项失败");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
if (item.inputType === "local") {
|
|
162
|
+
options = ((_a = item.data) == null ? void 0 : _a.map((val) => ({
|
|
163
|
+
label: val,
|
|
164
|
+
value: val
|
|
165
|
+
}))) || [];
|
|
166
|
+
if (item.options && Array.isArray(item.options)) {
|
|
167
|
+
options = item.options;
|
|
168
|
+
}
|
|
169
|
+
} else if (item.inputType === "dictionary") {
|
|
170
|
+
options = await getDict(interfaceTypeDict);
|
|
171
|
+
} else if (item.inputType === "system-dictionary") {
|
|
172
|
+
options = await getDict(interfaceTypeSysDict);
|
|
173
|
+
}
|
|
174
|
+
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
175
|
+
await getUrlOptions();
|
|
176
|
+
}
|
|
177
|
+
return options;
|
|
178
|
+
};
|
|
179
|
+
const handleGetSingleAttrListObj = (children) => {
|
|
180
|
+
if (!(children == null ? void 0 : children.length)) {
|
|
181
|
+
return [];
|
|
182
|
+
}
|
|
183
|
+
const dealList = (children2) => children2 == null ? void 0 : children2.map((v) => {
|
|
184
|
+
const obj = {};
|
|
185
|
+
if (Array.isArray(v)) {
|
|
186
|
+
v.forEach((x) => {
|
|
187
|
+
var _a;
|
|
188
|
+
if ((_a = x == null ? void 0 : x.children) == null ? void 0 : _a.length) {
|
|
189
|
+
obj[x.attrid] = dealList(x.children);
|
|
190
|
+
} else {
|
|
191
|
+
obj[x.attrid] = x.attrvalue;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return obj;
|
|
196
|
+
});
|
|
197
|
+
return dealList(children);
|
|
198
|
+
};
|
|
199
|
+
exports.disabledDate = disabledDate;
|
|
200
|
+
exports.handleGetPlaceholder = handleGetPlaceholder;
|
|
201
|
+
exports.handleGetSingleAttrListObj = handleGetSingleAttrListObj;
|
|
202
|
+
exports.handleSelectOptions = handleSelectOptions;
|
|
203
|
+
exports.handleSetFormItemInitialValue = handleSetFormItemInitialValue;
|
|
204
|
+
exports.handleUrlOptions = handleUrlOptions;
|
|
@@ -0,0 +1,116 @@
|
|
|
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: any[];
|
|
17
|
+
json: Ijson;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Ijson {
|
|
21
|
+
'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
|
|
22
|
+
'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
|
|
23
|
+
'default-prompt'?: string; // 提示信息
|
|
24
|
+
'regexp-message'?: string; // 正则表达式提示信息
|
|
25
|
+
regexp: any; // 正则表达式
|
|
26
|
+
'properties-width'?: number; // 属性集表单宽度
|
|
27
|
+
'properties-multiple'?: boolean; // 是否支持可增减的表单列表
|
|
28
|
+
propertiesID: string;
|
|
29
|
+
'combination-name'?: string; // 组合表单名称
|
|
30
|
+
combinations: any; // 组合表单配置
|
|
31
|
+
input: InputType;
|
|
32
|
+
length?: number;
|
|
33
|
+
'label-value'?: string; //代表属性固定取值,并且不可在实例化时修改
|
|
34
|
+
hide: true;
|
|
35
|
+
'upload-accept'?: string;
|
|
36
|
+
'upload-max-count'?: number;
|
|
37
|
+
'upload-size'?: number;
|
|
38
|
+
//代表弹窗标题
|
|
39
|
+
'modal-caption'?: string;
|
|
40
|
+
//代表弹窗宽度
|
|
41
|
+
'modal-width'?: number;
|
|
42
|
+
//代表弹窗高度
|
|
43
|
+
'modal-height'?: number;
|
|
44
|
+
//代表弹窗列表表头内容
|
|
45
|
+
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
46
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
47
|
+
data?: string[];
|
|
48
|
+
//代表调用【字典管理系统】的值
|
|
49
|
+
classify?: number | string | undefined;
|
|
50
|
+
//代表调用字典对应的归类名 ID
|
|
51
|
+
//代表从"action-url"从获取选择的数据
|
|
52
|
+
'action-url'?: string;
|
|
53
|
+
//代表执行一个动作的 UCE 的 url
|
|
54
|
+
'key-field'?: { list: string[]; delimiter: string };
|
|
55
|
+
default?: string | number | boolean | null | undefined | dayjs.Dayjs;
|
|
56
|
+
//代表属性默认值,如果没配置或空着,则代表没有默认值
|
|
57
|
+
instruction?: '';
|
|
58
|
+
//代表在实例化时对属性的填写说明,会作为提示语显示在属性名称旁
|
|
59
|
+
'instruction-color'?: '#000000';
|
|
60
|
+
//代表在实例化时对属性的填写说明,字体颜色的配置,如果不配置默认#333333
|
|
61
|
+
must?: true;
|
|
62
|
+
//代表属性值是否必填,true 为必填、false 为非必填,如果没配置则默认为 false
|
|
63
|
+
'cascader-delimiter'?: string;
|
|
64
|
+
options?: { label: string; value: string | number }[];
|
|
65
|
+
format?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 定义支持的输入类型枚举
|
|
69
|
+
export type InputType =
|
|
70
|
+
| 'text'
|
|
71
|
+
| 'password'
|
|
72
|
+
| 'textarea'
|
|
73
|
+
| 'number'
|
|
74
|
+
| 'select'
|
|
75
|
+
| 'mult-select'
|
|
76
|
+
| 'modal-select'
|
|
77
|
+
| 'modal-mult-select'
|
|
78
|
+
| 'date-picker'
|
|
79
|
+
| 'time-picker'
|
|
80
|
+
| 'week-picker'
|
|
81
|
+
| 'month-picker'
|
|
82
|
+
| 'quarter-picker'
|
|
83
|
+
| 'range-picker'
|
|
84
|
+
| 'multiple-date-picker'
|
|
85
|
+
| 'year-picker'
|
|
86
|
+
| 'second-picker'
|
|
87
|
+
| 'image'
|
|
88
|
+
| 'file'
|
|
89
|
+
| 'video'
|
|
90
|
+
| 'audio'
|
|
91
|
+
| 'label'
|
|
92
|
+
| 'radio'
|
|
93
|
+
| 'checkbox'
|
|
94
|
+
| 'cascader'
|
|
95
|
+
| 'mult-field-modal-select' // 弹窗选择对应多个表单字段
|
|
96
|
+
| string;
|
|
97
|
+
|
|
98
|
+
// 定义文件上传值类型
|
|
99
|
+
export interface CustomUploadFile {
|
|
100
|
+
FilePath: string;
|
|
101
|
+
FileName: string;
|
|
102
|
+
FileId: string;
|
|
103
|
+
url?: string;
|
|
104
|
+
name?: string;
|
|
105
|
+
uid?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface IformItemStyle {
|
|
109
|
+
type: InputType;
|
|
110
|
+
style?: React.CSSProperties;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface Iselect {
|
|
114
|
+
label: string;
|
|
115
|
+
value: string | number;
|
|
116
|
+
}
|