mixlinker-actionitem 1.0.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/README.md +124 -0
- package/dist/ActionItem.vue.d.ts +49 -0
- package/dist/ActionItemComponent.d.ts +338 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1323 -0
- package/dist/style.css +1 -0
- package/package.json +58 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
var ge = Object.defineProperty;
|
|
2
|
+
var _e = (P, e, t) => e in P ? ge(P, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : P[e] = t;
|
|
3
|
+
var B = (P, e, t) => _e(P, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { defineComponent as T, createElementBlock as W, openBlock as R, createElementVNode as N, reactive as O, ref as j, watch as he, computed as ve, onUnmounted as be, h as n, resolveComponent as X, normalizeStyle as Z, unref as w, createCommentVNode as Y, createVNode as K, toDisplayString as Q, withCtx as L, Fragment as ke, renderList as xe, createBlock as Ve, createTextVNode as ee } from "vue";
|
|
5
|
+
import { ElFormItem as J, ElButton as H, ElInput as U, ElUpload as De, ElMessage as te, ElTimePicker as re, ElDatePicker as ae, ElSwitch as se, ElInputNumber as ie, ElCheckboxGroup as ne, ElCheckbox as oe, ElRadioGroup as le, ElRadio as ue, ElSelect as ce, ElOption as me } from "element-plus";
|
|
6
|
+
/*! Element Plus Icons Vue v2.3.2 */
|
|
7
|
+
var we = /* @__PURE__ */ T({
|
|
8
|
+
name: "Delete",
|
|
9
|
+
__name: "delete",
|
|
10
|
+
setup(P) {
|
|
11
|
+
return (e, t) => (R(), W("svg", {
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
viewBox: "0 0 1024 1024"
|
|
14
|
+
}, [
|
|
15
|
+
N("path", {
|
|
16
|
+
fill: "currentColor",
|
|
17
|
+
d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
|
|
18
|
+
})
|
|
19
|
+
]));
|
|
20
|
+
}
|
|
21
|
+
}), de = we, Fe = /* @__PURE__ */ T({
|
|
22
|
+
name: "Plus",
|
|
23
|
+
__name: "plus",
|
|
24
|
+
setup(P) {
|
|
25
|
+
return (e, t) => (R(), W("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
viewBox: "0 0 1024 1024"
|
|
28
|
+
}, [
|
|
29
|
+
N("path", {
|
|
30
|
+
fill: "currentColor",
|
|
31
|
+
d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
|
|
32
|
+
})
|
|
33
|
+
]));
|
|
34
|
+
}
|
|
35
|
+
}), fe = Fe, Pe = /* @__PURE__ */ T({
|
|
36
|
+
name: "UploadFilled",
|
|
37
|
+
__name: "upload-filled",
|
|
38
|
+
setup(P) {
|
|
39
|
+
return (e, t) => (R(), W("svg", {
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
viewBox: "0 0 1024 1024"
|
|
42
|
+
}, [
|
|
43
|
+
N("path", {
|
|
44
|
+
fill: "currentColor",
|
|
45
|
+
d: "M544 864V672h128L512 480 352 672h128v192H320v-1.6c-5.376.32-10.496 1.6-16 1.6A240 240 0 0 1 64 624c0-123.136 93.12-223.488 212.608-237.248A239.81 239.81 0 0 1 512 192a239.87 239.87 0 0 1 235.456 194.752c119.488 13.76 212.48 114.112 212.48 237.248a240 240 0 0 1-240 240c-5.376 0-10.56-1.28-16-1.6v1.6z"
|
|
46
|
+
})
|
|
47
|
+
]));
|
|
48
|
+
}
|
|
49
|
+
}), Ie = Pe;
|
|
50
|
+
class ye {
|
|
51
|
+
constructor(e, t) {
|
|
52
|
+
// 配置数据
|
|
53
|
+
B(this, "config");
|
|
54
|
+
// 表单数据(响应式)
|
|
55
|
+
B(this, "formData");
|
|
56
|
+
// JSON 编辑器状态
|
|
57
|
+
B(this, "showJsonEditor");
|
|
58
|
+
B(this, "jsonInput");
|
|
59
|
+
// 样式配置
|
|
60
|
+
B(this, "style");
|
|
61
|
+
// WebSocket 相关
|
|
62
|
+
B(this, "ws", null);
|
|
63
|
+
B(this, "wsConnected");
|
|
64
|
+
B(this, "wsCallbacks", {});
|
|
65
|
+
var r;
|
|
66
|
+
this.config = O(e || {}), this.formData = O({}), this.showJsonEditor = j(!1), this.jsonInput = j(""), this.wsConnected = j(!1), this.style = O({
|
|
67
|
+
bgColor: (t == null ? void 0 : t.bgColor) || "#fff",
|
|
68
|
+
titleColor: (t == null ? void 0 : t.titleColor) || "#333",
|
|
69
|
+
radiusSize: (t == null ? void 0 : t.radiusSize) ?? 8,
|
|
70
|
+
labelWidth: (t == null ? void 0 : t.labelWidth) ?? 100,
|
|
71
|
+
isHideTitle: (t == null ? void 0 : t.isHideTitle) ?? !1,
|
|
72
|
+
showButtons: (t == null ? void 0 : t.showButtons) ?? !0
|
|
73
|
+
}), (r = e == null ? void 0 : e.params) != null && r.length && this.initFormData();
|
|
74
|
+
}
|
|
75
|
+
// ==================== WebSocket 通讯 ====================
|
|
76
|
+
/**
|
|
77
|
+
* 连接 WebSocket
|
|
78
|
+
*/
|
|
79
|
+
connectWebSocket(e, t) {
|
|
80
|
+
var r, s;
|
|
81
|
+
this.ws && this.ws.close(), this.wsCallbacks = t || {};
|
|
82
|
+
try {
|
|
83
|
+
this.ws = new WebSocket(e), this.ws.onopen = () => {
|
|
84
|
+
var a, c;
|
|
85
|
+
this.wsConnected.value = !0, (c = (a = this.wsCallbacks).onConnect) == null || c.call(a);
|
|
86
|
+
}, this.ws.onmessage = (a) => {
|
|
87
|
+
var c, i;
|
|
88
|
+
try {
|
|
89
|
+
const u = JSON.parse(a.data);
|
|
90
|
+
this.setSocketData(u), (i = (c = this.wsCallbacks).onData) == null || i.call(c, u);
|
|
91
|
+
} catch (u) {
|
|
92
|
+
console.error("WebSocket 消息解析失败:", u);
|
|
93
|
+
}
|
|
94
|
+
}, this.ws.onclose = () => {
|
|
95
|
+
var a, c;
|
|
96
|
+
this.wsConnected.value = !1, (c = (a = this.wsCallbacks).onDisconnect) == null || c.call(a);
|
|
97
|
+
}, this.ws.onerror = (a) => {
|
|
98
|
+
var c, i;
|
|
99
|
+
console.error("WebSocket 错误:", a), (i = (c = this.wsCallbacks).onError) == null || i.call(c, a);
|
|
100
|
+
};
|
|
101
|
+
} catch (a) {
|
|
102
|
+
console.error("WebSocket 连接失败:", a), (s = (r = this.wsCallbacks).onError) == null || s.call(r, a);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 断开 WebSocket
|
|
107
|
+
*/
|
|
108
|
+
disconnectWebSocket() {
|
|
109
|
+
this.ws && (this.ws.close(), this.ws = null);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 发送 WebSocket 消息
|
|
113
|
+
*/
|
|
114
|
+
sendWebSocketMessage(e) {
|
|
115
|
+
return this.ws && this.ws.readyState === WebSocket.OPEN ? (this.ws.send(typeof e == "string" ? e : JSON.stringify(e)), !0) : !1;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 处理 WebSocket 接收的数据
|
|
119
|
+
* 支持多种格式:
|
|
120
|
+
* 1. { result: { action_item: {...} } }
|
|
121
|
+
* 2. { result: { params: [...] } }
|
|
122
|
+
* 3. { code: 200, result: { params: [...] } } (uid 机制)
|
|
123
|
+
* 4. 直接 { params: [...] }
|
|
124
|
+
*/
|
|
125
|
+
setSocketData(e) {
|
|
126
|
+
if (!e) return;
|
|
127
|
+
if (e.code !== void 0 && e.code !== 200) {
|
|
128
|
+
console.error("WebSocket 响应错误:", e.msg || e.code);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const t = e.result || e, r = t.action_item || t;
|
|
132
|
+
r != null && r.params && this.parseBackendData(r);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 发送请求到后端(uid 机制)
|
|
136
|
+
*/
|
|
137
|
+
sendRequest(e, t, r) {
|
|
138
|
+
const s = {
|
|
139
|
+
action: e,
|
|
140
|
+
uid: r || "",
|
|
141
|
+
...t
|
|
142
|
+
};
|
|
143
|
+
return this.sendWebSocketMessage(s);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 请求表单配置
|
|
147
|
+
*/
|
|
148
|
+
requestConfig(e, t, r) {
|
|
149
|
+
return this.sendRequest("get_config_json", { block: e, name: t }, r);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 提交表单数据
|
|
153
|
+
*/
|
|
154
|
+
submitToServer(e) {
|
|
155
|
+
const t = this.exportToOriginalFormat();
|
|
156
|
+
return this.sendRequest("submit_form", { data: t }, e);
|
|
157
|
+
}
|
|
158
|
+
// ==================== 数据加载方法 ====================
|
|
159
|
+
/**
|
|
160
|
+
* 加载配置
|
|
161
|
+
*/
|
|
162
|
+
loadConfig(e) {
|
|
163
|
+
this.config.action_name = e.action_name, this.config.description = e.description, this.config.block = e.block, this.config.action = e.action, this.config.params = e.params, this.config.data = e, this.initFormData();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 解析后端数据
|
|
167
|
+
*/
|
|
168
|
+
parseBackendData(e) {
|
|
169
|
+
e && (this.config.action_name = e.action_name, this.config.description = e.description, this.config.params = e.params, this.config.block = e.block, this.config.action = e.action, this.config.data = e, this.initFormData());
|
|
170
|
+
}
|
|
171
|
+
// ==================== 参数获取方法 ====================
|
|
172
|
+
/**
|
|
173
|
+
* 获取参数列表
|
|
174
|
+
*/
|
|
175
|
+
getParams() {
|
|
176
|
+
return Array.isArray(this.config.params) ? this.config.params : [];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 是否有参数
|
|
180
|
+
*/
|
|
181
|
+
get hasParams() {
|
|
182
|
+
return this.getParams().length > 0;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 获取可见参数(排除 hidden 和联动隐藏的)
|
|
186
|
+
*/
|
|
187
|
+
getVisibleParams() {
|
|
188
|
+
return this.getParams().filter(
|
|
189
|
+
(e) => e.form_type !== "hidden" && !this.isFieldHidden(e)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
// ==================== 表单数据初始化 ====================
|
|
193
|
+
/**
|
|
194
|
+
* 初始化表单数据
|
|
195
|
+
*/
|
|
196
|
+
initFormData() {
|
|
197
|
+
var t;
|
|
198
|
+
const e = (t = this.config.data) == null ? void 0 : t.values;
|
|
199
|
+
this.getParams().forEach((r) => {
|
|
200
|
+
e && e[r.key] !== void 0 ? this.formData[r.key] = e[r.key] : this.formData[r.key] = this.getDefaultValue(r);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 重置表单
|
|
205
|
+
*/
|
|
206
|
+
resetForm() {
|
|
207
|
+
this.initFormData();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 获取默认值(支持递归嵌套)
|
|
211
|
+
*/
|
|
212
|
+
getDefaultValue(e) {
|
|
213
|
+
var t;
|
|
214
|
+
if (e.form_type === "sub_form" && e.properties && !e.items) {
|
|
215
|
+
const r = {};
|
|
216
|
+
return e.properties.forEach((s) => {
|
|
217
|
+
r[s.key] = this.getDefaultValue(s);
|
|
218
|
+
}), r;
|
|
219
|
+
}
|
|
220
|
+
return e.form_type === "sub_form" && e.items ? Array.isArray(e.default_value) ? e.default_value : [] : e.form_type === "checkbox_group" ? Array.isArray(e.default_value) ? e.default_value : [] : e.default_value !== null && e.default_value !== void 0 ? e.default_value : e.form_type === "switch" ? !1 : e.form_type === "number" ? ((t = e.format) == null ? void 0 : t.min) ?? 0 : "";
|
|
221
|
+
}
|
|
222
|
+
// ==================== 路径操作方法 ====================
|
|
223
|
+
/**
|
|
224
|
+
* 通过路径获取值
|
|
225
|
+
*/
|
|
226
|
+
getValueByPath(e, t) {
|
|
227
|
+
if (t)
|
|
228
|
+
return t.split(".").reduce((r, s) => r == null ? void 0 : r[s], e);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 通过路径设置值
|
|
232
|
+
*/
|
|
233
|
+
setValueByPath(e, t, r) {
|
|
234
|
+
const s = t.split("."), a = s.pop(), c = s.reduce((i, u) => ((!i[u] || typeof i[u] != "object") && (i[u] = {}), i[u]), e);
|
|
235
|
+
c[a] = r;
|
|
236
|
+
}
|
|
237
|
+
// ==================== 动态属性处理(联动核心) ====================
|
|
238
|
+
/**
|
|
239
|
+
* 评估条件表达式(支持比较运算符)
|
|
240
|
+
*/
|
|
241
|
+
evaluateCondition(e, t) {
|
|
242
|
+
const r = parseFloat(e);
|
|
243
|
+
return isNaN(r) ? !1 : t.startsWith(">=") ? r >= parseFloat(t.slice(2)) : t.startsWith("<=") ? r <= parseFloat(t.slice(2)) : t.startsWith(">") ? r > parseFloat(t.slice(1)) : t.startsWith("<") ? r < parseFloat(t.slice(1)) : t.startsWith("=") ? r === parseFloat(t.slice(1)) : !1;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* 获取动态属性(根据 rules 条件)
|
|
247
|
+
*/
|
|
248
|
+
getDynamicProperty(e, t, r) {
|
|
249
|
+
var a;
|
|
250
|
+
if (!((a = e.rules) != null && a.length)) return;
|
|
251
|
+
const s = r || this.formData;
|
|
252
|
+
for (const c of e.rules) {
|
|
253
|
+
const i = c.related_key;
|
|
254
|
+
if (!i) continue;
|
|
255
|
+
let u;
|
|
256
|
+
if (i.includes(".properties.")) {
|
|
257
|
+
const y = i.split(".properties.");
|
|
258
|
+
u = this.getValueByPath(s, y.join("."));
|
|
259
|
+
} else i.includes(".") ? u = this.getValueByPath(s, i) : u = s[i];
|
|
260
|
+
for (const y of c.conditions) {
|
|
261
|
+
let V = !1;
|
|
262
|
+
if (Array.isArray(y.value) ? V = y.value.includes(u) : typeof y.value == "string" && /^[><=]/.test(y.value) ? V = this.evaluateCondition(u, y.value) : V = y.value === u, V && y.property && y.property[t] !== void 0)
|
|
263
|
+
return y.property[t];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* 判断字段在上下文中是否隐藏(用于嵌套路径)
|
|
269
|
+
*/
|
|
270
|
+
isHiddenInContext(e, t, r) {
|
|
271
|
+
var s, a, c;
|
|
272
|
+
if (!((s = e.rules) != null && s.length)) return !1;
|
|
273
|
+
for (const i of e.rules) {
|
|
274
|
+
const u = i.related_key;
|
|
275
|
+
if (!u) continue;
|
|
276
|
+
const y = t ? `${t}.${u}` : u, V = this.getValueByPath(r, y), $ = (a = i.conditions) == null ? void 0 : a.find((q) => q.value === V);
|
|
277
|
+
if ((c = $ == null ? void 0 : $.property) != null && c.hidden) return !0;
|
|
278
|
+
}
|
|
279
|
+
return !1;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 字段是否隐藏
|
|
283
|
+
*/
|
|
284
|
+
isFieldHidden(e, t) {
|
|
285
|
+
return this.getDynamicProperty(e, "hidden", t) === !0;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 字段是否禁用
|
|
289
|
+
*/
|
|
290
|
+
isFieldDisabled(e, t) {
|
|
291
|
+
return this.getDynamicProperty(e, "disabled", t) === !0;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* 字段是否必填(动态)
|
|
295
|
+
*/
|
|
296
|
+
isFieldRequired(e, t) {
|
|
297
|
+
const r = this.getDynamicProperty(e, "required", t);
|
|
298
|
+
return r !== void 0 ? r : e.required || !1;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 获取字段 placeholder
|
|
302
|
+
*/
|
|
303
|
+
getFieldPlaceholder(e, t) {
|
|
304
|
+
return this.getDynamicProperty(e, "placeholder", t) || e.description || `请输入${e.cn_name}`;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 获取字段 tooltip
|
|
308
|
+
*/
|
|
309
|
+
getFieldTooltip(e, t) {
|
|
310
|
+
return this.getDynamicProperty(e, "tooltip", t) || e.description;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* 获取字段选项(支持联动)
|
|
314
|
+
*/
|
|
315
|
+
getFieldOptions(e, t) {
|
|
316
|
+
return this.getDynamicProperty(e, "enum", t) || e.enum || [];
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* 获取动态默认值
|
|
320
|
+
*/
|
|
321
|
+
getDynamicDefaultValue(e, t) {
|
|
322
|
+
const r = this.getDynamicProperty(e, "default_value", t);
|
|
323
|
+
return r !== void 0 ? r : this.getDefaultValue(e);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* 字段变化时处理依赖
|
|
327
|
+
*/
|
|
328
|
+
onFieldChange(e, t) {
|
|
329
|
+
this.getParams().forEach((r) => {
|
|
330
|
+
if (r.rules)
|
|
331
|
+
for (const s of r.rules) {
|
|
332
|
+
const a = s.related_key;
|
|
333
|
+
if (!a) continue;
|
|
334
|
+
if (a === e.key || a.startsWith(e.key + ".") || a.includes(".properties." + e.key)) {
|
|
335
|
+
const i = this.getDynamicProperty(r, "default_value");
|
|
336
|
+
if (i !== void 0)
|
|
337
|
+
this.formData[r.key] = i;
|
|
338
|
+
else if (r.form_type === "select" || r.form_type === "radio_group") {
|
|
339
|
+
const u = this.getFieldOptions(r), y = this.formData[r.key];
|
|
340
|
+
y && !u.find((V) => V.value === y) && (this.formData[r.key] = "");
|
|
341
|
+
} else if (r.form_type === "checkbox_group") {
|
|
342
|
+
const u = this.getFieldOptions(r), y = this.formData[r.key] || [];
|
|
343
|
+
this.formData[r.key] = y.filter(
|
|
344
|
+
(V) => u.find(($) => $.value === V)
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
// ==================== 子表单处理 ====================
|
|
352
|
+
/**
|
|
353
|
+
* 添加子表单行
|
|
354
|
+
*/
|
|
355
|
+
addSubItem(e) {
|
|
356
|
+
var a, c;
|
|
357
|
+
Array.isArray(this.formData[e.key]) || (this.formData[e.key] = []);
|
|
358
|
+
const t = (a = e.format) == null ? void 0 : a.max_items;
|
|
359
|
+
if (t && this.formData[e.key].length >= t)
|
|
360
|
+
return !1;
|
|
361
|
+
const r = ((c = e.items) == null ? void 0 : c.properties) || e.properties || [], s = {};
|
|
362
|
+
return r.forEach((i) => {
|
|
363
|
+
s[i.key] = this.getDefaultValue(i);
|
|
364
|
+
}), this.formData[e.key].push(s), !0;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* 删除子表单行
|
|
368
|
+
*/
|
|
369
|
+
removeSubItem(e, t) {
|
|
370
|
+
var a, c, i;
|
|
371
|
+
const r = this.getParams().find((u) => u.key === e), s = (a = r == null ? void 0 : r.format) == null ? void 0 : a.min_items;
|
|
372
|
+
return s && ((c = this.formData[e]) == null ? void 0 : c.length) <= s ? !1 : ((i = this.formData[e]) == null || i.splice(t, 1), !0);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* 获取子表单字段选项(支持行内联动)
|
|
376
|
+
*/
|
|
377
|
+
getSubFieldOptions(e, t, r) {
|
|
378
|
+
var s, a, c;
|
|
379
|
+
if ((s = e.enum) != null && s.length && !((a = e.rules) != null && a.length)) return e.enum;
|
|
380
|
+
if (e.rules)
|
|
381
|
+
for (const i of e.rules) {
|
|
382
|
+
if (!i.related_key) continue;
|
|
383
|
+
let u;
|
|
384
|
+
const y = i.related_key;
|
|
385
|
+
if (y.includes(".properties.")) {
|
|
386
|
+
const V = y.split(".properties.").pop();
|
|
387
|
+
u = V ? t[V] : void 0;
|
|
388
|
+
} else
|
|
389
|
+
u = t[y];
|
|
390
|
+
for (const V of i.conditions)
|
|
391
|
+
if (V.value === u && ((c = V.property) != null && c.enum))
|
|
392
|
+
return V.property.enum;
|
|
393
|
+
}
|
|
394
|
+
return e.enum || [];
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* 子表单字段变化
|
|
398
|
+
*/
|
|
399
|
+
onSubFieldChange(e, t, r) {
|
|
400
|
+
var a;
|
|
401
|
+
(((a = e.items) == null ? void 0 : a.properties) || e.properties || []).forEach((c) => {
|
|
402
|
+
var i, u;
|
|
403
|
+
if (c.rules) {
|
|
404
|
+
for (const y of c.rules)
|
|
405
|
+
if (((i = y.related_key) == null ? void 0 : i.split(".").pop()) === t.key) {
|
|
406
|
+
const $ = this.getSubFieldOptions(c, r, e);
|
|
407
|
+
(c.form_type === "select" || c.form_type === "radio_group") && ($.find((q) => q.value === r[c.key]) || (r[c.key] = ""));
|
|
408
|
+
for (const q of y.conditions)
|
|
409
|
+
q.value === r[t.key] && ((u = q.property) == null ? void 0 : u.default_value) !== void 0 && (r[c.key] = q.property.default_value);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* 子表单字段是否禁用
|
|
416
|
+
*/
|
|
417
|
+
isSubFieldDisabled(e, t) {
|
|
418
|
+
var r, s, a;
|
|
419
|
+
if (!((r = e.rules) != null && r.length)) return !1;
|
|
420
|
+
for (const c of e.rules) {
|
|
421
|
+
const i = (s = c.related_key) == null ? void 0 : s.split(".").pop();
|
|
422
|
+
if (!i) continue;
|
|
423
|
+
const u = t[i];
|
|
424
|
+
for (const y of c.conditions)
|
|
425
|
+
if (y.value === u && ((a = y.property) != null && a.disabled))
|
|
426
|
+
return !0;
|
|
427
|
+
}
|
|
428
|
+
return !1;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* 子表单字段是否隐藏
|
|
432
|
+
*/
|
|
433
|
+
isSubFieldHidden(e, t) {
|
|
434
|
+
var r, s, a;
|
|
435
|
+
if (!((r = e.rules) != null && r.length)) return !1;
|
|
436
|
+
for (const c of e.rules) {
|
|
437
|
+
const i = (s = c.related_key) == null ? void 0 : s.split(".").pop();
|
|
438
|
+
if (!i) continue;
|
|
439
|
+
const u = t[i];
|
|
440
|
+
for (const y of c.conditions)
|
|
441
|
+
if (y.value === u && ((a = y.property) != null && a.hidden))
|
|
442
|
+
return !0;
|
|
443
|
+
}
|
|
444
|
+
return !1;
|
|
445
|
+
}
|
|
446
|
+
// ==================== 值处理方法 ====================
|
|
447
|
+
/**
|
|
448
|
+
* 处理 trim
|
|
449
|
+
*/
|
|
450
|
+
processValue(e, t) {
|
|
451
|
+
var r;
|
|
452
|
+
return (r = e.format) != null && r.trim && typeof t == "string" ? t.trim() : t;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* 解析日期值(支持 today, today+N, today-N)
|
|
456
|
+
*/
|
|
457
|
+
parseDateValue(e) {
|
|
458
|
+
if (!e) return null;
|
|
459
|
+
if (e === "today") return /* @__PURE__ */ new Date();
|
|
460
|
+
if (e.startsWith("today+")) {
|
|
461
|
+
const t = parseInt(e.slice(6)), r = /* @__PURE__ */ new Date();
|
|
462
|
+
return r.setDate(r.getDate() + t), r;
|
|
463
|
+
}
|
|
464
|
+
if (e.startsWith("today-")) {
|
|
465
|
+
const t = parseInt(e.slice(6)), r = /* @__PURE__ */ new Date();
|
|
466
|
+
return r.setDate(r.getDate() - t), r;
|
|
467
|
+
}
|
|
468
|
+
return new Date(e);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* 获取日期限制函数
|
|
472
|
+
*/
|
|
473
|
+
getDateDisabled(e) {
|
|
474
|
+
const t = e.format;
|
|
475
|
+
return t ? (r) => {
|
|
476
|
+
if (t.min_date) {
|
|
477
|
+
const s = this.parseDateValue(t.min_date);
|
|
478
|
+
if (s && r < s) return !0;
|
|
479
|
+
}
|
|
480
|
+
if (t.max_date) {
|
|
481
|
+
const s = this.parseDateValue(t.max_date);
|
|
482
|
+
if (s && r > s) return !0;
|
|
483
|
+
}
|
|
484
|
+
return !1;
|
|
485
|
+
} : () => !1;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* 获取文件上传 accept
|
|
489
|
+
*/
|
|
490
|
+
getFileAccept(e) {
|
|
491
|
+
var r;
|
|
492
|
+
const t = (r = e.format) == null ? void 0 : r.file_type;
|
|
493
|
+
return t != null && t.length ? t.join(",") : "*";
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* 获取文件大小限制(MB)
|
|
497
|
+
*/
|
|
498
|
+
getFileSizeLimit(e) {
|
|
499
|
+
var r;
|
|
500
|
+
const t = (r = e.format) == null ? void 0 : r.max_size;
|
|
501
|
+
return t ? t / (1024 * 1024) : 10;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* 验证文件
|
|
505
|
+
*/
|
|
506
|
+
validateFile(e, t) {
|
|
507
|
+
var s;
|
|
508
|
+
const r = e.format;
|
|
509
|
+
if (!r) return { valid: !0 };
|
|
510
|
+
if ((s = r.file_type) != null && s.length) {
|
|
511
|
+
const a = t.type, c = t.name.toLowerCase();
|
|
512
|
+
if (!r.file_type.some((u) => u.startsWith(".") ? c.endsWith(u) : a === u || a.startsWith(u.replace("*", ""))))
|
|
513
|
+
return { valid: !1, error: `文件类型不支持,允许: ${r.file_type.join(", ")}` };
|
|
514
|
+
}
|
|
515
|
+
return r.max_size && t.size > r.max_size ? { valid: !1, error: `文件大小超过限制 ${r.max_size / (1024 * 1024)}MB` } : r.min_size && t.size < r.min_size ? { valid: !1, error: `文件大小不能小于 ${r.min_size / 1024}KB` } : { valid: !0 };
|
|
516
|
+
}
|
|
517
|
+
// ==================== 校验方法 ====================
|
|
518
|
+
/**
|
|
519
|
+
* 使用正则表达式验证字段值
|
|
520
|
+
*/
|
|
521
|
+
validateWithRegex(e, t) {
|
|
522
|
+
var s;
|
|
523
|
+
const r = (s = e.format) == null ? void 0 : s.pattern;
|
|
524
|
+
if (!r || t === void 0 || t === null || t === "")
|
|
525
|
+
return { valid: !0 };
|
|
526
|
+
try {
|
|
527
|
+
return new RegExp(r).test(String(t)) ? { valid: !0 } : { valid: !1, error: `${e.cn_name}格式不正确` };
|
|
528
|
+
} catch (a) {
|
|
529
|
+
return console.error(`正则表达式错误: ${r}`, a), { valid: !0 };
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* 验证所有字段
|
|
534
|
+
*/
|
|
535
|
+
validateAllFields() {
|
|
536
|
+
const e = [];
|
|
537
|
+
return this.getParams().forEach((t) => {
|
|
538
|
+
if (this.isFieldHidden(t)) return;
|
|
539
|
+
const r = this.formData[t.key];
|
|
540
|
+
if (this.isFieldRequired(t) && (r == null || r === "" || Array.isArray(r) && r.length === 0)) {
|
|
541
|
+
e.push({ key: t.key, error: `${t.cn_name}不能为空` });
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
const s = this.validateWithRegex(t, r);
|
|
545
|
+
!s.valid && s.error && e.push({ key: t.key, error: s.error });
|
|
546
|
+
}), { valid: e.length === 0, errors: e };
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* 构建校验规则(用于 Element Plus Form)
|
|
550
|
+
*/
|
|
551
|
+
buildValidationRules(e) {
|
|
552
|
+
const t = [], r = this.getDynamicProperty(e, "required");
|
|
553
|
+
(r !== void 0 ? r : e.required) && t.push({ required: !0, message: `请输入${e.cn_name}`, trigger: "blur" });
|
|
554
|
+
const a = e.format;
|
|
555
|
+
return a && (a.pattern && t.push({
|
|
556
|
+
pattern: new RegExp(a.pattern),
|
|
557
|
+
message: `${e.cn_name}格式不正确`,
|
|
558
|
+
trigger: "blur"
|
|
559
|
+
}), a.length && t.push({
|
|
560
|
+
len: a.length,
|
|
561
|
+
message: `${e.cn_name}长度必须为 ${a.length} 个字符`,
|
|
562
|
+
trigger: "blur"
|
|
563
|
+
}), (a.min_length || a.max_length) && t.push({
|
|
564
|
+
min: a.min_length,
|
|
565
|
+
max: a.max_length,
|
|
566
|
+
message: a.min_length && a.max_length ? `长度在 ${a.min_length} 到 ${a.max_length} 个字符` : a.min_length ? `最少 ${a.min_length} 个字符` : `最多 ${a.max_length} 个字符`,
|
|
567
|
+
trigger: "blur"
|
|
568
|
+
}), e.form_type === "number" && ((a.min !== void 0 || a.max !== void 0) && t.push({
|
|
569
|
+
type: "number",
|
|
570
|
+
min: a.min,
|
|
571
|
+
max: a.max,
|
|
572
|
+
message: a.min !== void 0 && a.max !== void 0 ? `数值范围 ${a.min} 到 ${a.max}` : a.min !== void 0 ? `最小值 ${a.min}` : `最大值 ${a.max}`,
|
|
573
|
+
trigger: "blur"
|
|
574
|
+
}), a.integer && t.push({
|
|
575
|
+
validator: (c, i, u) => {
|
|
576
|
+
i !== void 0 && !Number.isInteger(i) ? u(new Error(`${e.cn_name}必须为整数`)) : u();
|
|
577
|
+
},
|
|
578
|
+
trigger: "blur"
|
|
579
|
+
})), (e.form_type === "checkbox_group" || e.form_type === "sub_form" && e.items) && (a.min_items !== void 0 && t.push({
|
|
580
|
+
type: "array",
|
|
581
|
+
min: a.min_items,
|
|
582
|
+
message: `至少选择 ${a.min_items} 项`,
|
|
583
|
+
trigger: "change"
|
|
584
|
+
}), a.max_items !== void 0 && t.push({
|
|
585
|
+
type: "array",
|
|
586
|
+
max: a.max_items,
|
|
587
|
+
message: `最多选择 ${a.max_items} 项`,
|
|
588
|
+
trigger: "change"
|
|
589
|
+
}))), t;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* 获取表单校验规则(支持嵌套路径)
|
|
593
|
+
*/
|
|
594
|
+
getFormRules() {
|
|
595
|
+
const e = {}, t = (r, s = "") => {
|
|
596
|
+
r.forEach((a) => {
|
|
597
|
+
const c = s ? `${s}.${a.key}` : a.key;
|
|
598
|
+
if (a.form_type === "sub_form" && a.properties && !a.items) {
|
|
599
|
+
t(a.properties, c);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (a.form_type === "sub_form" && a.items)
|
|
603
|
+
return;
|
|
604
|
+
const i = this.buildValidationRules(a);
|
|
605
|
+
i.length && (e[c] = i);
|
|
606
|
+
});
|
|
607
|
+
};
|
|
608
|
+
return t(this.getParams()), e;
|
|
609
|
+
}
|
|
610
|
+
// ==================== JSON 编辑器 ====================
|
|
611
|
+
/**
|
|
612
|
+
* 应用 JSON 配置
|
|
613
|
+
*/
|
|
614
|
+
applyJson() {
|
|
615
|
+
try {
|
|
616
|
+
const e = JSON.parse(this.jsonInput.value);
|
|
617
|
+
if (e.params && Array.isArray(e.params))
|
|
618
|
+
this.loadConfig(e);
|
|
619
|
+
else if (Array.isArray(e))
|
|
620
|
+
this.loadConfig({ params: e });
|
|
621
|
+
else if (e.key && e.form_type)
|
|
622
|
+
this.loadConfig({ params: [e] });
|
|
623
|
+
else
|
|
624
|
+
return { success: !1, error: "无法识别的 JSON 格式" };
|
|
625
|
+
return this.showJsonEditor.value = !1, { success: !0 };
|
|
626
|
+
} catch (e) {
|
|
627
|
+
return { success: !1, error: e.message || "JSON 格式错误" };
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
// ==================== 数据导出(生成 JSON) ====================
|
|
631
|
+
/**
|
|
632
|
+
* 导出为原始格式(生成 JSON 用)
|
|
633
|
+
*/
|
|
634
|
+
exportToOriginalFormat() {
|
|
635
|
+
return this.convertFormDataToOriginal(this.formData, this.getParams());
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* 导出为目标 JSON 格式(别名)
|
|
639
|
+
*/
|
|
640
|
+
exportTargetJson() {
|
|
641
|
+
return this.exportToOriginalFormat();
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* 递归转换 formData 为原始格式
|
|
645
|
+
*/
|
|
646
|
+
convertFormDataToOriginal(e, t) {
|
|
647
|
+
const r = {};
|
|
648
|
+
return t.forEach((s) => {
|
|
649
|
+
var c;
|
|
650
|
+
let a = e[s.key];
|
|
651
|
+
a = this.processValue(s, a), s.form_type === "sub_form" ? s.properties && !s.items ? r[s.key] = this.convertFormDataToOriginal(a || {}, s.properties) : (c = s.items) != null && c.properties && (r[s.key] = Array.isArray(a) ? a.map(
|
|
652
|
+
(i, u) => this.convertArrayItemToOriginal(i, s.items.properties, u)
|
|
653
|
+
) : []) : s.db_type === "boolean" && typeof a == "boolean" ? r[s.key] = a ? "true" : "false" : r[s.key] = a;
|
|
654
|
+
}), r;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* 转换数组项为原始格式
|
|
658
|
+
*/
|
|
659
|
+
convertArrayItemToOriginal(e, t, r) {
|
|
660
|
+
const s = {};
|
|
661
|
+
return t.forEach((a) => {
|
|
662
|
+
a.form_type === "sub_form" && a.properties ? s[a.key] = this.convertFormDataToOriginal(e[a.key] || {}, a.properties) : a.auto_index ? s[a.key] = String(r + 1) : s[a.key] = this.processValue(a, e[a.key]);
|
|
663
|
+
}), s;
|
|
664
|
+
}
|
|
665
|
+
// ==================== 监听器与销毁 ====================
|
|
666
|
+
/**
|
|
667
|
+
* 设置参数变化监听
|
|
668
|
+
*/
|
|
669
|
+
watchParams(e) {
|
|
670
|
+
he(
|
|
671
|
+
() => this.config.params,
|
|
672
|
+
() => {
|
|
673
|
+
this.initFormData(), e == null || e();
|
|
674
|
+
},
|
|
675
|
+
{ immediate: !0, deep: !0 }
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* 销毁(清理 WebSocket)
|
|
680
|
+
*/
|
|
681
|
+
destroy() {
|
|
682
|
+
this.disconnectWebSocket();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
// ==================== 常用正则表达式 ====================
|
|
686
|
+
B(ye, "REGEX_PATTERNS", {
|
|
687
|
+
PHONE: "^1[3-9]\\d{9}$",
|
|
688
|
+
EMAIL: "^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$",
|
|
689
|
+
ID_CARD: "^\\d{17}[\\dXx]$",
|
|
690
|
+
CHINESE: "^[\\u4e00-\\u9fa5]+$",
|
|
691
|
+
ENGLISH: "^[a-zA-Z]+$",
|
|
692
|
+
NUMBER: "^\\d+$",
|
|
693
|
+
URL: "^https?://[\\w.-]+",
|
|
694
|
+
IP: "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$"
|
|
695
|
+
});
|
|
696
|
+
const Ce = {
|
|
697
|
+
key: 0,
|
|
698
|
+
class: "empty-state"
|
|
699
|
+
}, Se = { key: 1 }, Ae = {
|
|
700
|
+
key: 0,
|
|
701
|
+
class: "form-header"
|
|
702
|
+
}, Ee = { key: 0 }, $e = { class: "form-footer" }, ze = /* @__PURE__ */ T({
|
|
703
|
+
__name: "ActionItem",
|
|
704
|
+
props: {
|
|
705
|
+
config: {},
|
|
706
|
+
style: {},
|
|
707
|
+
layout: { default: "line" }
|
|
708
|
+
},
|
|
709
|
+
emits: ["submit", "generate", "confirm", "cancel"],
|
|
710
|
+
setup(P, { expose: e, emit: t }) {
|
|
711
|
+
const r = P, s = t, a = j(), c = j(0);
|
|
712
|
+
ve(() => i.config.layout || r.layout || "line");
|
|
713
|
+
const i = new ye(r.config, r.style);
|
|
714
|
+
he(() => r.config, (l) => {
|
|
715
|
+
l && (i.loadConfig(l), c.value = 0);
|
|
716
|
+
}, { deep: !0 }), e({ acti: i, formRef: a }), be(() => {
|
|
717
|
+
i.destroy();
|
|
718
|
+
}), T({
|
|
719
|
+
name: "TabPanelContent",
|
|
720
|
+
props: {
|
|
721
|
+
param: { type: Object, required: !0 },
|
|
722
|
+
rootData: { type: Object, required: !0 },
|
|
723
|
+
actionItem: { type: Object, required: !0 }
|
|
724
|
+
},
|
|
725
|
+
setup(l) {
|
|
726
|
+
const o = l.param, h = l.rootData, m = l.actionItem, f = o.key;
|
|
727
|
+
return () => {
|
|
728
|
+
var d;
|
|
729
|
+
if (o.form_type === "sub_form" && o.properties) {
|
|
730
|
+
const v = m.getValueByPath(h, f);
|
|
731
|
+
(!v || typeof v != "object" || Array.isArray(v)) && m.setValueByPath(h, f, {});
|
|
732
|
+
const I = o.properties.filter(
|
|
733
|
+
(p) => !m.isHiddenInContext(p, f, h)
|
|
734
|
+
);
|
|
735
|
+
return n(
|
|
736
|
+
"div",
|
|
737
|
+
{ class: "tab-panel-content" },
|
|
738
|
+
I.map(
|
|
739
|
+
(p) => n(u, {
|
|
740
|
+
param: p,
|
|
741
|
+
rootData: h,
|
|
742
|
+
actionItem: m,
|
|
743
|
+
key: p.key,
|
|
744
|
+
parentPath: f
|
|
745
|
+
})
|
|
746
|
+
)
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
return o.form_type === "sub_form" && ((d = o.items) != null && d.properties) ? n(u, { param: o, rootData: h, actionItem: m, key: o.key, parentPath: "" }) : n(u, { param: o, rootData: h, actionItem: m, key: o.key, parentPath: "" });
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
const u = T({
|
|
754
|
+
name: "FormField",
|
|
755
|
+
props: {
|
|
756
|
+
param: { type: Object, required: !0 },
|
|
757
|
+
rootData: { type: Object, required: !0 },
|
|
758
|
+
actionItem: { type: Object, required: !0 },
|
|
759
|
+
parentPath: { type: String, default: "" }
|
|
760
|
+
},
|
|
761
|
+
setup(l) {
|
|
762
|
+
var A;
|
|
763
|
+
const o = l.param, h = l.rootData, m = l.actionItem, f = o.key, d = l.parentPath ? `${l.parentPath}.${f}` : f, v = o.form_type === "sub_form" && o.properties && !o.items, I = o.form_type === "sub_form" && ((A = o.items) == null ? void 0 : A.properties), p = j(0);
|
|
764
|
+
return () => {
|
|
765
|
+
var E, x;
|
|
766
|
+
if (m.isHiddenInContext(o, l.parentPath, h)) return null;
|
|
767
|
+
if (v) {
|
|
768
|
+
const F = m.getValueByPath(h, d);
|
|
769
|
+
(!F || typeof F != "object" || Array.isArray(F)) && m.setValueByPath(h, d, {});
|
|
770
|
+
const C = o.properties.filter(
|
|
771
|
+
(_) => !m.isHiddenInContext(_, d, h)
|
|
772
|
+
);
|
|
773
|
+
if (o.layout && C.length > 0) {
|
|
774
|
+
const _ = C.filter((g) => g.form_type === "sub_form"), S = C.filter((g) => g.form_type !== "sub_form");
|
|
775
|
+
return n(J, {
|
|
776
|
+
label: o.cn_name,
|
|
777
|
+
class: "sub-form-field tab-inline-field"
|
|
778
|
+
}, () => [
|
|
779
|
+
n("div", { class: "sub-form-wrapper", style: { border: "none", padding: "0" } }, [
|
|
780
|
+
// 先渲染普通字段(如果有)
|
|
781
|
+
...S.map(
|
|
782
|
+
(g) => n(u, { param: g, rootData: h, actionItem: m, key: g.key, parentPath: d })
|
|
783
|
+
),
|
|
784
|
+
// 根据 layout 类型渲染
|
|
785
|
+
o.layout === "tab" && _.length > 0 ? n("div", { class: "sub-tab-container", style: { width: "100%" } }, [
|
|
786
|
+
// 标签页头部 - 横向排列,和标签同一行
|
|
787
|
+
n(
|
|
788
|
+
"div",
|
|
789
|
+
{
|
|
790
|
+
class: "sub-tab-header",
|
|
791
|
+
style: {
|
|
792
|
+
display: "flex",
|
|
793
|
+
flexDirection: "row",
|
|
794
|
+
flexWrap: "nowrap",
|
|
795
|
+
alignItems: "center",
|
|
796
|
+
borderBottom: "1px solid #e4e7ed",
|
|
797
|
+
width: "100%"
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
_.map(
|
|
801
|
+
(g, D) => n("div", {
|
|
802
|
+
class: ["sub-tab-item", { active: p.value === D }],
|
|
803
|
+
key: g.key,
|
|
804
|
+
style: {
|
|
805
|
+
padding: "10px 20px",
|
|
806
|
+
fontSize: "14px",
|
|
807
|
+
color: p.value === D ? "#409eff" : "#303133",
|
|
808
|
+
cursor: "pointer",
|
|
809
|
+
borderBottom: p.value === D ? "2px solid #409eff" : "2px solid transparent",
|
|
810
|
+
marginBottom: "-1px",
|
|
811
|
+
whiteSpace: "nowrap",
|
|
812
|
+
fontWeight: p.value === D ? "500" : "400"
|
|
813
|
+
},
|
|
814
|
+
onClick: () => {
|
|
815
|
+
p.value = D;
|
|
816
|
+
}
|
|
817
|
+
}, g.cn_name)
|
|
818
|
+
)
|
|
819
|
+
),
|
|
820
|
+
// 标签页内容
|
|
821
|
+
n(
|
|
822
|
+
"div",
|
|
823
|
+
{ class: "sub-tab-content", style: { padding: "16px 0" } },
|
|
824
|
+
_.map(
|
|
825
|
+
(g, D) => n("div", {
|
|
826
|
+
class: "sub-tab-panel",
|
|
827
|
+
key: g.key,
|
|
828
|
+
style: { display: p.value === D ? "block" : "none" }
|
|
829
|
+
}, [
|
|
830
|
+
n(y, { param: g, rootData: h, actionItem: m, parentPath: d, key: g.key })
|
|
831
|
+
])
|
|
832
|
+
)
|
|
833
|
+
)
|
|
834
|
+
]) : (
|
|
835
|
+
// line 模式:直接列表展示
|
|
836
|
+
n(
|
|
837
|
+
"div",
|
|
838
|
+
{ class: "sub-line-container" },
|
|
839
|
+
_.map(
|
|
840
|
+
(g) => n("div", { class: "sub-line-item", key: g.key }, [
|
|
841
|
+
n("div", { class: "sub-line-title" }, g.cn_name),
|
|
842
|
+
n(y, { param: g, rootData: h, actionItem: m, parentPath: d })
|
|
843
|
+
])
|
|
844
|
+
)
|
|
845
|
+
)
|
|
846
|
+
)
|
|
847
|
+
])
|
|
848
|
+
]);
|
|
849
|
+
}
|
|
850
|
+
return o.cn_name ? n(
|
|
851
|
+
J,
|
|
852
|
+
{ label: o.cn_name, class: "sub-form-field" },
|
|
853
|
+
() => n(
|
|
854
|
+
"div",
|
|
855
|
+
{ class: "sub-form-inline" },
|
|
856
|
+
C.map(
|
|
857
|
+
(_) => n(u, {
|
|
858
|
+
param: _,
|
|
859
|
+
rootData: h,
|
|
860
|
+
actionItem: m,
|
|
861
|
+
key: _.key,
|
|
862
|
+
parentPath: d
|
|
863
|
+
})
|
|
864
|
+
)
|
|
865
|
+
)
|
|
866
|
+
) : n(
|
|
867
|
+
"div",
|
|
868
|
+
{ class: "sub-form-inline" },
|
|
869
|
+
C.map(
|
|
870
|
+
(_) => n(u, {
|
|
871
|
+
param: _,
|
|
872
|
+
rootData: h,
|
|
873
|
+
actionItem: m,
|
|
874
|
+
key: _.key,
|
|
875
|
+
parentPath: d
|
|
876
|
+
})
|
|
877
|
+
)
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
if (I) {
|
|
881
|
+
let F = m.getValueByPath(h, d);
|
|
882
|
+
Array.isArray(F) || (m.setValueByPath(h, d, []), F = m.getValueByPath(h, d));
|
|
883
|
+
const C = o.items.properties, _ = C.filter((D) => D.form_type !== "hidden"), S = (E = o.format) == null ? void 0 : E.max_items, g = ((x = o.format) == null ? void 0 : x.min_items) || 0;
|
|
884
|
+
return n(J, { label: o.cn_name }, () => [
|
|
885
|
+
n("div", { class: "sub-form" }, [
|
|
886
|
+
// 所有行
|
|
887
|
+
...F.map(
|
|
888
|
+
(D, b) => n("div", { class: "sub-item", key: b }, [
|
|
889
|
+
n(
|
|
890
|
+
"div",
|
|
891
|
+
{ class: "sub-fields" },
|
|
892
|
+
_.map((z) => m.isSubFieldHidden(z, D) ? null : n("div", { class: "sub-field", key: z.key }, [
|
|
893
|
+
n("span", { class: "sub-label" }, [
|
|
894
|
+
m.isFieldRequired(z, D) ? n("span", { class: "required-star" }, "*") : null,
|
|
895
|
+
z.cn_name
|
|
896
|
+
]),
|
|
897
|
+
$(z, D, m, o)
|
|
898
|
+
]))
|
|
899
|
+
),
|
|
900
|
+
n(H, {
|
|
901
|
+
type: "danger",
|
|
902
|
+
icon: de,
|
|
903
|
+
circle: !0,
|
|
904
|
+
size: "small",
|
|
905
|
+
disabled: F.length <= g,
|
|
906
|
+
onClick: () => F.splice(b, 1)
|
|
907
|
+
})
|
|
908
|
+
])
|
|
909
|
+
),
|
|
910
|
+
// 添加按钮
|
|
911
|
+
n(H, {
|
|
912
|
+
type: "primary",
|
|
913
|
+
icon: fe,
|
|
914
|
+
disabled: S ? F.length >= S : !1,
|
|
915
|
+
onClick: () => {
|
|
916
|
+
const D = {};
|
|
917
|
+
C.forEach((b) => {
|
|
918
|
+
D[b.key] = m.getDefaultValue(b);
|
|
919
|
+
}), F.push(D);
|
|
920
|
+
}
|
|
921
|
+
}, () => "添加")
|
|
922
|
+
])
|
|
923
|
+
]);
|
|
924
|
+
}
|
|
925
|
+
const k = { label: o.cn_name, prop: d };
|
|
926
|
+
return m.isFieldRequired(o) && (k.rules = [{ required: !0, message: `请输入${o.cn_name}`, trigger: "blur" }]), n(J, k, () => V(o, d, h, m));
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
}), y = T({
|
|
930
|
+
name: "SubFormContent",
|
|
931
|
+
props: {
|
|
932
|
+
param: { type: Object, required: !0 },
|
|
933
|
+
rootData: { type: Object, required: !0 },
|
|
934
|
+
actionItem: { type: Object, required: !0 },
|
|
935
|
+
parentPath: { type: String, default: "" }
|
|
936
|
+
},
|
|
937
|
+
setup(l) {
|
|
938
|
+
const o = l.param, h = l.rootData, m = l.actionItem, f = l.parentPath ? `${l.parentPath}.${o.key}` : o.key;
|
|
939
|
+
return () => {
|
|
940
|
+
var I, p, A;
|
|
941
|
+
if ((I = o.items) != null && I.properties) {
|
|
942
|
+
let k = m.getValueByPath(h, f);
|
|
943
|
+
Array.isArray(k) || (m.setValueByPath(h, f, []), k = m.getValueByPath(h, f));
|
|
944
|
+
const E = o.items.properties, x = E.filter((_) => _.form_type !== "hidden"), F = (p = o.format) == null ? void 0 : p.max_items, C = ((A = o.format) == null ? void 0 : A.min_items) || 0;
|
|
945
|
+
return n("div", { class: "sub-form" }, [
|
|
946
|
+
// 所有行
|
|
947
|
+
...k.map(
|
|
948
|
+
(_, S) => n("div", { class: "sub-item", key: S }, [
|
|
949
|
+
n(
|
|
950
|
+
"div",
|
|
951
|
+
{ class: "sub-fields" },
|
|
952
|
+
x.map((g) => m.isSubFieldHidden(g, _) ? null : n("div", { class: "sub-field", key: g.key }, [
|
|
953
|
+
n("span", { class: "sub-label" }, [
|
|
954
|
+
m.isFieldRequired(g, _) ? n("span", { class: "required-star" }, "*") : null,
|
|
955
|
+
g.cn_name
|
|
956
|
+
]),
|
|
957
|
+
$(g, _, m, o)
|
|
958
|
+
]))
|
|
959
|
+
),
|
|
960
|
+
n(H, {
|
|
961
|
+
type: "danger",
|
|
962
|
+
icon: de,
|
|
963
|
+
circle: !0,
|
|
964
|
+
size: "small",
|
|
965
|
+
disabled: k.length <= C,
|
|
966
|
+
onClick: () => k.splice(S, 1)
|
|
967
|
+
})
|
|
968
|
+
])
|
|
969
|
+
),
|
|
970
|
+
// 添加按钮
|
|
971
|
+
n(H, {
|
|
972
|
+
type: "primary",
|
|
973
|
+
icon: fe,
|
|
974
|
+
disabled: F ? k.length >= F : !1,
|
|
975
|
+
onClick: () => {
|
|
976
|
+
const _ = {};
|
|
977
|
+
E.forEach((S) => {
|
|
978
|
+
_[S.key] = m.getDefaultValue(S);
|
|
979
|
+
}), k.push(_);
|
|
980
|
+
}
|
|
981
|
+
}, () => "添加")
|
|
982
|
+
]);
|
|
983
|
+
}
|
|
984
|
+
if (!o.properties) return null;
|
|
985
|
+
const d = m.getValueByPath(h, f);
|
|
986
|
+
(!d || typeof d != "object" || Array.isArray(d)) && m.setValueByPath(h, f, {});
|
|
987
|
+
const v = o.properties.filter(
|
|
988
|
+
(k) => !m.isHiddenInContext(k, f, h)
|
|
989
|
+
);
|
|
990
|
+
return n(
|
|
991
|
+
"div",
|
|
992
|
+
{ class: "sub-form-content" },
|
|
993
|
+
v.map(
|
|
994
|
+
(k) => n(u, { param: k, rootData: h, actionItem: m, key: k.key, parentPath: f })
|
|
995
|
+
)
|
|
996
|
+
);
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
function V(l, o, h, m) {
|
|
1001
|
+
var A, k, E, x, F, C, _, S, g, D;
|
|
1002
|
+
const f = m.isFieldDisabled(l), d = m.getValueByPath(h, o), v = (b) => {
|
|
1003
|
+
m.setValueByPath(h, o, b), m.onFieldChange(l, b);
|
|
1004
|
+
}, I = m.getFieldPlaceholder(l), p = m.getFieldOptions(l);
|
|
1005
|
+
switch (l.form_type) {
|
|
1006
|
+
case "text":
|
|
1007
|
+
return n(U, {
|
|
1008
|
+
modelValue: d ?? "",
|
|
1009
|
+
"onUpdate:modelValue": v,
|
|
1010
|
+
placeholder: I,
|
|
1011
|
+
disabled: f,
|
|
1012
|
+
size: "small",
|
|
1013
|
+
clearable: !0
|
|
1014
|
+
});
|
|
1015
|
+
case "textarea":
|
|
1016
|
+
return n(U, {
|
|
1017
|
+
type: "textarea",
|
|
1018
|
+
modelValue: d ?? "",
|
|
1019
|
+
"onUpdate:modelValue": v,
|
|
1020
|
+
placeholder: I,
|
|
1021
|
+
disabled: f,
|
|
1022
|
+
rows: 3,
|
|
1023
|
+
maxlength: (A = l.format) == null ? void 0 : A.max_length,
|
|
1024
|
+
showWordLimit: !!((k = l.format) != null && k.max_length)
|
|
1025
|
+
});
|
|
1026
|
+
case "select":
|
|
1027
|
+
return n(ce, {
|
|
1028
|
+
modelValue: d ?? "",
|
|
1029
|
+
"onUpdate:modelValue": v,
|
|
1030
|
+
placeholder: `请选择${l.cn_name}`,
|
|
1031
|
+
disabled: f,
|
|
1032
|
+
style: "width:100%",
|
|
1033
|
+
size: "small",
|
|
1034
|
+
clearable: !0
|
|
1035
|
+
}, () => p.map(
|
|
1036
|
+
(b) => n(me, { key: b.value, label: b.cn_name, value: b.value })
|
|
1037
|
+
));
|
|
1038
|
+
case "radio_group":
|
|
1039
|
+
return n(le, {
|
|
1040
|
+
modelValue: d ?? "",
|
|
1041
|
+
"onUpdate:modelValue": v,
|
|
1042
|
+
disabled: f
|
|
1043
|
+
}, () => p.map(
|
|
1044
|
+
(b) => n(ue, { key: b.value, value: b.value }, () => b.cn_name)
|
|
1045
|
+
));
|
|
1046
|
+
case "checkbox_group":
|
|
1047
|
+
return n(ne, {
|
|
1048
|
+
modelValue: d ?? [],
|
|
1049
|
+
"onUpdate:modelValue": v,
|
|
1050
|
+
disabled: f
|
|
1051
|
+
}, () => p.map(
|
|
1052
|
+
(b) => n(oe, { key: b.value, value: b.value }, () => b.cn_name)
|
|
1053
|
+
));
|
|
1054
|
+
case "number":
|
|
1055
|
+
return n(ie, {
|
|
1056
|
+
modelValue: d ?? 0,
|
|
1057
|
+
"onUpdate:modelValue": v,
|
|
1058
|
+
disabled: f,
|
|
1059
|
+
min: (E = l.format) == null ? void 0 : E.min,
|
|
1060
|
+
max: (x = l.format) == null ? void 0 : x.max,
|
|
1061
|
+
precision: (F = l.format) == null ? void 0 : F.precision,
|
|
1062
|
+
step: (C = l.format) != null && C.precision ? Math.pow(10, -l.format.precision) : 1,
|
|
1063
|
+
style: "width:100%",
|
|
1064
|
+
size: "small",
|
|
1065
|
+
controlsPosition: "right"
|
|
1066
|
+
});
|
|
1067
|
+
case "switch":
|
|
1068
|
+
return n(se, {
|
|
1069
|
+
modelValue: d === !0 || d === "true",
|
|
1070
|
+
"onUpdate:modelValue": v,
|
|
1071
|
+
disabled: f
|
|
1072
|
+
});
|
|
1073
|
+
case "date_picker":
|
|
1074
|
+
return n(ae, {
|
|
1075
|
+
modelValue: d ?? "",
|
|
1076
|
+
"onUpdate:modelValue": v,
|
|
1077
|
+
type: "date",
|
|
1078
|
+
placeholder: `请选择${l.cn_name}`,
|
|
1079
|
+
disabled: f,
|
|
1080
|
+
format: "YYYY-MM-DD",
|
|
1081
|
+
valueFormat: "YYYY-MM-DD",
|
|
1082
|
+
disabledDate: m.getDateDisabled(l),
|
|
1083
|
+
style: "width:100%",
|
|
1084
|
+
size: "small"
|
|
1085
|
+
});
|
|
1086
|
+
case "time_picker":
|
|
1087
|
+
return n(re, {
|
|
1088
|
+
modelValue: d ?? "",
|
|
1089
|
+
"onUpdate:modelValue": v,
|
|
1090
|
+
placeholder: `请选择${l.cn_name}`,
|
|
1091
|
+
disabled: f,
|
|
1092
|
+
format: (S = (_ = l.format) == null ? void 0 : _.min_time) != null && S.includes(":") && l.format.min_time.split(":").length === 3 ? "HH:mm:ss" : "HH:mm",
|
|
1093
|
+
style: "width:100%",
|
|
1094
|
+
size: "small"
|
|
1095
|
+
});
|
|
1096
|
+
case "file_upload":
|
|
1097
|
+
return n("div", { class: "file-upload-wrapper" }, [
|
|
1098
|
+
n(De, {
|
|
1099
|
+
action: "#",
|
|
1100
|
+
autoUpload: !1,
|
|
1101
|
+
disabled: f,
|
|
1102
|
+
accept: m.getFileAccept(l),
|
|
1103
|
+
limit: ((g = l.format) == null ? void 0 : g.max_items) || 1,
|
|
1104
|
+
fileList: Array.isArray(d) ? d : d ? [d] : [],
|
|
1105
|
+
onChange: (b, z) => {
|
|
1106
|
+
var G;
|
|
1107
|
+
const M = m.validateFile(l, b.raw);
|
|
1108
|
+
if (!M.valid) {
|
|
1109
|
+
te.error(M.error), z.pop();
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
v((G = l.format) != null && G.max_items && l.format.max_items > 1 ? z : b);
|
|
1113
|
+
},
|
|
1114
|
+
onRemove: (b, z) => {
|
|
1115
|
+
var M;
|
|
1116
|
+
v((M = l.format) != null && M.max_items && l.format.max_items > 1 ? z : null);
|
|
1117
|
+
}
|
|
1118
|
+
}, () => n(H, { type: "primary", icon: Ie, size: "small" }, () => "选择文件")),
|
|
1119
|
+
(D = l.format) != null && D.max_size ? n("span", { class: "upload-tip" }, `最大 ${(l.format.max_size / (1024 * 1024)).toFixed(1)}MB`) : null
|
|
1120
|
+
]);
|
|
1121
|
+
default:
|
|
1122
|
+
return n(U, {
|
|
1123
|
+
modelValue: d ?? "",
|
|
1124
|
+
"onUpdate:modelValue": v,
|
|
1125
|
+
disabled: f,
|
|
1126
|
+
size: "small",
|
|
1127
|
+
placeholder: I
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
function $(l, o, h, m) {
|
|
1132
|
+
var A, k, E;
|
|
1133
|
+
const f = l.key, d = h.isSubFieldDisabled(l, o), v = h.getSubFieldOptions(l, o, m), I = l.description || `请输入${l.cn_name}`, p = (x) => {
|
|
1134
|
+
o[f] = x, h.onSubFieldChange(m, l, o);
|
|
1135
|
+
};
|
|
1136
|
+
switch (l.form_type) {
|
|
1137
|
+
case "text":
|
|
1138
|
+
return n(U, {
|
|
1139
|
+
modelValue: o[f] ?? "",
|
|
1140
|
+
"onUpdate:modelValue": p,
|
|
1141
|
+
placeholder: I,
|
|
1142
|
+
disabled: d,
|
|
1143
|
+
size: "small",
|
|
1144
|
+
clearable: !0
|
|
1145
|
+
});
|
|
1146
|
+
case "textarea":
|
|
1147
|
+
return n(U, {
|
|
1148
|
+
type: "textarea",
|
|
1149
|
+
modelValue: o[f] ?? "",
|
|
1150
|
+
"onUpdate:modelValue": p,
|
|
1151
|
+
placeholder: I,
|
|
1152
|
+
disabled: d,
|
|
1153
|
+
rows: 2
|
|
1154
|
+
});
|
|
1155
|
+
case "select":
|
|
1156
|
+
return n(ce, {
|
|
1157
|
+
modelValue: o[f] ?? "",
|
|
1158
|
+
"onUpdate:modelValue": p,
|
|
1159
|
+
placeholder: `请选择${l.cn_name}`,
|
|
1160
|
+
disabled: d,
|
|
1161
|
+
style: "width:100%",
|
|
1162
|
+
size: "small",
|
|
1163
|
+
clearable: !0
|
|
1164
|
+
}, () => v.map(
|
|
1165
|
+
(x) => n(me, { key: x.value, label: x.cn_name, value: x.value })
|
|
1166
|
+
));
|
|
1167
|
+
case "radio_group":
|
|
1168
|
+
return n(le, {
|
|
1169
|
+
modelValue: o[f] ?? "",
|
|
1170
|
+
"onUpdate:modelValue": p,
|
|
1171
|
+
disabled: d,
|
|
1172
|
+
size: "small"
|
|
1173
|
+
}, () => v.map(
|
|
1174
|
+
(x) => n(ue, { key: x.value, value: x.value }, () => x.cn_name)
|
|
1175
|
+
));
|
|
1176
|
+
case "checkbox_group":
|
|
1177
|
+
return n(ne, {
|
|
1178
|
+
modelValue: o[f] ?? [],
|
|
1179
|
+
"onUpdate:modelValue": p,
|
|
1180
|
+
disabled: d,
|
|
1181
|
+
size: "small"
|
|
1182
|
+
}, () => v.map(
|
|
1183
|
+
(x) => n(oe, { key: x.value, value: x.value }, () => x.cn_name)
|
|
1184
|
+
));
|
|
1185
|
+
case "number":
|
|
1186
|
+
return n(ie, {
|
|
1187
|
+
modelValue: o[f] ?? 0,
|
|
1188
|
+
"onUpdate:modelValue": p,
|
|
1189
|
+
disabled: d,
|
|
1190
|
+
min: (A = l.format) == null ? void 0 : A.min,
|
|
1191
|
+
max: (k = l.format) == null ? void 0 : k.max,
|
|
1192
|
+
precision: (E = l.format) == null ? void 0 : E.precision,
|
|
1193
|
+
style: "width:100%",
|
|
1194
|
+
size: "small",
|
|
1195
|
+
controlsPosition: "right"
|
|
1196
|
+
});
|
|
1197
|
+
case "switch":
|
|
1198
|
+
return n(se, {
|
|
1199
|
+
modelValue: o[f] === !0 || o[f] === "true",
|
|
1200
|
+
"onUpdate:modelValue": p,
|
|
1201
|
+
disabled: d,
|
|
1202
|
+
size: "small"
|
|
1203
|
+
});
|
|
1204
|
+
case "date_picker":
|
|
1205
|
+
return n(ae, {
|
|
1206
|
+
modelValue: o[f] ?? "",
|
|
1207
|
+
"onUpdate:modelValue": p,
|
|
1208
|
+
type: "date",
|
|
1209
|
+
placeholder: `请选择${l.cn_name}`,
|
|
1210
|
+
disabled: d,
|
|
1211
|
+
format: "YYYY-MM-DD",
|
|
1212
|
+
valueFormat: "YYYY-MM-DD",
|
|
1213
|
+
style: "width:100%",
|
|
1214
|
+
size: "small"
|
|
1215
|
+
});
|
|
1216
|
+
case "time_picker":
|
|
1217
|
+
return n(re, {
|
|
1218
|
+
modelValue: o[f] ?? "",
|
|
1219
|
+
"onUpdate:modelValue": p,
|
|
1220
|
+
placeholder: `请选择${l.cn_name}`,
|
|
1221
|
+
disabled: d,
|
|
1222
|
+
style: "width:100%",
|
|
1223
|
+
size: "small"
|
|
1224
|
+
});
|
|
1225
|
+
default:
|
|
1226
|
+
return n(U, {
|
|
1227
|
+
modelValue: o[f] ?? "",
|
|
1228
|
+
"onUpdate:modelValue": p,
|
|
1229
|
+
disabled: d,
|
|
1230
|
+
size: "small",
|
|
1231
|
+
placeholder: I
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
const q = async () => {
|
|
1236
|
+
if (a.value)
|
|
1237
|
+
try {
|
|
1238
|
+
await a.value.validate();
|
|
1239
|
+
const l = i.exportToOriginalFormat();
|
|
1240
|
+
s("confirm", l);
|
|
1241
|
+
} catch {
|
|
1242
|
+
te.warning("请检查表单填写");
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
const l = i.exportToOriginalFormat();
|
|
1246
|
+
s("confirm", l);
|
|
1247
|
+
}
|
|
1248
|
+
}, pe = () => {
|
|
1249
|
+
s("cancel");
|
|
1250
|
+
};
|
|
1251
|
+
return (l, o) => {
|
|
1252
|
+
const h = X("el-empty"), m = X("el-form");
|
|
1253
|
+
return R(), W("div", {
|
|
1254
|
+
class: "action-item-form",
|
|
1255
|
+
style: Z({ background: w(i).style.bgColor, borderRadius: w(i).style.radiusSize + "px" })
|
|
1256
|
+
}, [
|
|
1257
|
+
w(i).hasParams ? Y("", !0) : (R(), W("div", Ce, [
|
|
1258
|
+
K(h, {
|
|
1259
|
+
description: "暂无配置",
|
|
1260
|
+
"image-size": 80
|
|
1261
|
+
})
|
|
1262
|
+
])),
|
|
1263
|
+
w(i).hasParams ? (R(), W("div", Se, [
|
|
1264
|
+
w(i).config.action_name && !w(i).style.isHideTitle ? (R(), W("div", Ae, [
|
|
1265
|
+
N("h3", {
|
|
1266
|
+
style: Z({ color: w(i).style.titleColor })
|
|
1267
|
+
}, Q(w(i).config.action_name), 5),
|
|
1268
|
+
w(i).config.description ? (R(), W("p", Ee, Q(w(i).config.description), 1)) : Y("", !0)
|
|
1269
|
+
])) : Y("", !0),
|
|
1270
|
+
K(m, {
|
|
1271
|
+
ref_key: "formRef",
|
|
1272
|
+
ref: a,
|
|
1273
|
+
model: w(i).formData,
|
|
1274
|
+
rules: w(i).getFormRules(),
|
|
1275
|
+
"label-width": w(i).style.labelWidth + "px"
|
|
1276
|
+
}, {
|
|
1277
|
+
default: L(() => [
|
|
1278
|
+
(R(!0), W(ke, null, xe(w(i).getVisibleParams(), (f) => (R(), Ve(w(u), {
|
|
1279
|
+
key: f.key,
|
|
1280
|
+
param: f,
|
|
1281
|
+
rootData: w(i).formData,
|
|
1282
|
+
actionItem: w(i)
|
|
1283
|
+
}, null, 8, ["param", "rootData", "actionItem"]))), 128))
|
|
1284
|
+
]),
|
|
1285
|
+
_: 1
|
|
1286
|
+
}, 8, ["model", "rules", "label-width"]),
|
|
1287
|
+
N("div", $e, [
|
|
1288
|
+
K(w(H), { onClick: pe }, {
|
|
1289
|
+
default: L(() => [...o[0] || (o[0] = [
|
|
1290
|
+
ee("取消", -1)
|
|
1291
|
+
])]),
|
|
1292
|
+
_: 1
|
|
1293
|
+
}),
|
|
1294
|
+
K(w(H), {
|
|
1295
|
+
type: "primary",
|
|
1296
|
+
onClick: q
|
|
1297
|
+
}, {
|
|
1298
|
+
default: L(() => [...o[1] || (o[1] = [
|
|
1299
|
+
ee("确认", -1)
|
|
1300
|
+
])]),
|
|
1301
|
+
_: 1
|
|
1302
|
+
})
|
|
1303
|
+
])
|
|
1304
|
+
])) : Y("", !0)
|
|
1305
|
+
], 4);
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
}), Be = (P, e) => {
|
|
1309
|
+
const t = P.__vccOpts || P;
|
|
1310
|
+
for (const [r, s] of e)
|
|
1311
|
+
t[r] = s;
|
|
1312
|
+
return t;
|
|
1313
|
+
}, Re = /* @__PURE__ */ Be(ze, [["__scopeId", "data-v-083c5f60"]]), Te = {
|
|
1314
|
+
install(P) {
|
|
1315
|
+
P.component("ActionItem", Re);
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
export {
|
|
1319
|
+
Re as ActionItem,
|
|
1320
|
+
ye as ActionItemComponent,
|
|
1321
|
+
Te as ActionItemPlugin,
|
|
1322
|
+
Re as default
|
|
1323
|
+
};
|