act-plus 1.1.43 → 1.1.44

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.
@@ -1,404 +0,0 @@
1
- import { defineAsyncComponent as $, inject as T, ref as K, watch as Te, resolveComponent as _, resolveDirective as ee, openBlock as n, createBlock as p, withCtx as C, createElementVNode as le, createVNode as ae, createTextVNode as W, toDisplayString as A, unref as i, withDirectives as oe, createElementBlock as k, Fragment as O, renderList as G, mergeProps as v, createCommentVNode as te, resolveDynamicComponent as De, toRaw as Ke } from "vue";
2
- import { _ as we, u as Ne, P as Ue, a as ke, b as Pe } from "./index-6818b5e9.js";
3
- import { ElNotification as Se } from "element-plus";
4
- import "vue-router";
5
- import "js-base64";
6
- import "monaco-editor";
7
- const Re = { class: "no-config-field" }, Le = { class: "dialog-footer" }, $e = {
8
- __name: "index",
9
- props: {
10
- visible: { type: Boolean, default: !1 },
11
- title: { type: String, default: "" },
12
- data: { type: Object, default: () => ({}) }
13
- },
14
- emits: ["update:visible", "refresh"],
15
- setup(w, { emit: se }) {
16
- const re = $(() => import("./index-6818b5e9.js").then((l) => l.t)), de = $(() => import("./index-5d5f6688.js")), ie = $(() => import("./index-6818b5e9.js").then((l) => l.s)), ne = $(() => import("./index-6818b5e9.js").then((l) => l.r)), { t: m } = Ne(), q = T("request"), ue = T("loadComponents"), P = T("formatDataType"), J = T("globalProps"), ce = T("stringToBoolean"), b = T("getFieldUiProps"), fe = T("disposeRequestData"), Q = se, f = w, S = K(!1), R = K(!1), x = K(null), L = K([]), o = K({}), M = K({}), pe = (l) => l.formColumnCol == null || l.customFiledsComponentes[l.customFiledsComponentes.customComponentName] ? 24 : l.formColumnCol ? l.formColumnCol : 24 / l.formRow, me = (l) => ["input", "textarea"].includes(l.fieldType) ? "blur" : (["select", "multipleSelect", "datetimerange", "treeSelect", "provinceCascade"].includes(l.fieldType), "change"), ye = async ({ node: l, resolve: c }, a) => {
17
- const d = b(a), { label: t, value: h, children: F, isLeaf: s } = { ...Pe, ...d.treeProps || {} };
18
- if (l[s])
19
- return c([]);
20
- const u = a.postRequestParams.filter((y) => y.submitType === "default").reduce((y, D) => (y[D.submitName] = P(D.paramsType, D.submitValue), y), {}), g = a.postRequestParams.filter((y) => y.submitType === "dynamic").map((y) => ({
21
- field: y.submitName,
22
- operate: y.submitMatchType,
23
- value: d.loadCode ? l == null ? void 0 : l.data.value : P(y.paramsType, y.submitValue)
24
- }));
25
- let V = {};
26
- Object.keys(u).length && (V = { ...V, ...u }), g.length && (V.dynamicFilters = g), d.loadCode && Reflect.has(V, d.loadCode) && (V[d.loadCode] = l == null ? void 0 : l.data.value);
27
- const { data: N } = await q({
28
- url: a.fieldRequestUrl,
29
- method: a.fieldRequestType || "GET",
30
- data: V
31
- }), B = (N || []).map((y) => ({ label: y[t], value: y[h], children: [], isLeaf: y[s] }));
32
- c(B);
33
- }, E = (l) => {
34
- if (!["input", "textarea"].includes(l)) {
35
- if (["multipleSelect", "dateRange"].includes(l))
36
- return [];
37
- if (["switch"].includes(l))
38
- return !1;
39
- }
40
- }, j = (l, c) => {
41
- if (["string"].includes(c))
42
- return l.sort((a, d) => a.sort - d.sort).join(";");
43
- if (["number"].includes(c))
44
- return Number(l);
45
- if (["array"].includes(c))
46
- return l.sort((a, d) => a.sort - d.sort);
47
- }, Y = (l, c = !1) => {
48
- if (["multipleSelect"].includes(l.fieldType))
49
- return f.data.rowData[l.fieldKey] ? f.data.rowData[l.fieldKey].split(";").map((d) => c ? { value: d } : d) : [];
50
- if (["virtualizedMultipleSelect"].includes(l.fieldType))
51
- return f.data.rowData[l.fieldKey] ? f.data.rowData[l.fieldKey].split(";") : [];
52
- if (["dateRange"].includes(l.fieldType)) {
53
- const d = l.fieldKey.split("&");
54
- return f.data.rowData[l.fieldKey] = d.map((t) => f.data.rowData[t]), f.data.rowData[l.fieldKey];
55
- }
56
- let a = f.data.rowData[l.fieldKey];
57
- if (["select"].includes(l.fieldType)) {
58
- const d = b(l);
59
- l.dataList && typeof l.dataList[0][d["value-key"] ? d["value-key"] : "value"] == "string" && a !== null && (a = c ? { value: a.toString() } : a.toString());
60
- }
61
- if (["virtualizedSelect"].includes(l.fieldType)) {
62
- const d = b(l);
63
- l.dataList && typeof l.dataList[0][d["value-key"] ? d["value-key"] : "value"] == "string" && a !== null && (a = a.toString());
64
- }
65
- return (a === "true" || a === "false") && (a = ce(a)), a;
66
- }, be = (l) => q({ url: f.data.dataItem.requestUrl, method: "post", data: l });
67
- Te(
68
- () => f.visible,
69
- async (l, c) => {
70
- var a;
71
- if (l)
72
- try {
73
- S.value = !0;
74
- const d = await fe(f.data.formList, f.data.rowData, !1, !0);
75
- L.value = await Promise.all(
76
- (((a = f.data) == null ? void 0 : a.formList) ?? []).sort((t, h) => t.sort - h.sort).map(async (t) => {
77
- const h = d.find((g) => t.fieldName == g.fieldName && t.fieldKey == g.fieldKey);
78
- h && (t.dataList = (h == null ? void 0 : h.dataList) ?? []), ["select", "multipleSelect"].includes(t.fieldType) && (o.value[`${t.fieldKey}ActImplicit`] = Object.keys(f.data.rowData).length && t.isFormSetValue ? Y(t, !0) : E(t.fieldType)), o.value[t.fieldKey] = Object.keys(f.data.rowData).length && t.isFormSetValue ? Y(t) : E(t.fieldType);
79
- const { isFiledCustom: F, customComponentName: s, customComponentUrl: u } = t.customFiledsComponentes;
80
- if (F && !t.customFiledsComponentes[s]) {
81
- const g = await ue(u, s);
82
- t.customFiledsComponentes[s] = g;
83
- }
84
- return t;
85
- })
86
- ), S.value = !1;
87
- } catch (d) {
88
- console.error(d), S.value = !1;
89
- }
90
- }
91
- );
92
- const he = (l) => {
93
- z(), l();
94
- }, z = () => {
95
- L.value = [], x.value.resetFields(), Q("update:visible", !1);
96
- }, _e = (l, c) => {
97
- const a = b(c), { fieldKey: d, fieldType: t } = c;
98
- if (t === "multipleSelect") {
99
- const h = l.filter((s) => typeof s == "string"), F = l.filter((s) => typeof s != "string").map((s) => s.value);
100
- o.value[a.createFieldKey] = h.length ? j(h, "string") : void 0, o.value[d] = F.length ? j(F, "string") : void 0;
101
- } else
102
- typeof l == "string" ? (o.value[a.createFieldKey] = l, o.value[d] = void 0) : (o.value[d] = l.value, delete o.value[a.createFieldKey]);
103
- }, ge = (l) => {
104
- l && l.validate((c) => {
105
- if (c) {
106
- const { dataItem: a, rowData: d } = f.data;
107
- let t = { ...Ke(o.value) };
108
- Object.keys(t).forEach((s) => {
109
- if (s.includes("ActImplicit")) {
110
- delete t[s];
111
- return;
112
- }
113
- const u = L.value.find((g) => g.fieldKey === s);
114
- s.includes("&") ? s.split("&").forEach((V, N) => {
115
- t[V] = t[s][N];
116
- }) : Array.isArray(t[s]) && u.fieldSubmitType == "string" && (t[s] = j(t[s], "string"));
117
- });
118
- const h = a.submitFields.filter((s) => s.matchType == "default").reduce((s, u) => (u.submitFieldType === "string" && (s[u.submitFieldName] = u.matchFieldName.toString()), s), {}), F = a.submitFields.filter((s) => s.matchType == "match").reduce((s, u) => (Reflect.has(u, "submitFieldMatchOrigin") && u.submitFieldMatchOrigin != "rowData" ? Reflect.has(J.matchData, u.submitFieldMatchOrigin) && (s[u.submitFieldName] = P(u.submitFieldType, J.matchData[u.submitFieldMatchOrigin][u.matchFieldName])) : s[u.submitFieldName] = P(u.submitFieldType, d[u.matchFieldName]), s), {});
119
- be({
120
- ...t,
121
- ...h,
122
- ...F
123
- }).then((s) => {
124
- try {
125
- Se({ title: m("act.tip"), message: m("act.saveSuccessfully"), type: "success", duration: 2500 }), z(), Q("refresh");
126
- } catch (u) {
127
- console.error(u);
128
- }
129
- R.value = !1;
130
- }).catch((s) => {
131
- console.error(s), R.value = !1;
132
- });
133
- }
134
- });
135
- }, ve = (l) => {
136
- const c = Object.keys(M.value).map((a) => {
137
- var d;
138
- return (d = M.value[a]) == null ? void 0 : d.updateFormData(o.value);
139
- }).filter((a) => a);
140
- Promise.all([l.validate(), ...c]).then((a) => {
141
- a.every((d) => d) && ge(l);
142
- }).catch((a) => (console.error(a), a));
143
- };
144
- return (l, c) => {
145
- var X;
146
- const a = _("el-input"), d = _("el-option"), t = _("el-select"), h = _("el-select-v2"), F = _("el-tree-select"), s = _("el-date-picker"), u = _("el-cascader"), g = _("el-switch"), V = _("el-form-item"), N = _("el-col"), B = _("el-row"), y = _("el-form"), D = _("el-button"), Ve = _("el-dialog"), Ce = ee("loading"), Fe = ee("debounce");
147
- return n(), p(Ve, {
148
- "model-value": f.visible,
149
- title: f.title,
150
- top: "5vh",
151
- width: (X = w.data.formConfig) == null ? void 0 : X.dialogWidth,
152
- draggable: "",
153
- overflow: "",
154
- "append-to-body": "",
155
- "destroy-on-close": "",
156
- "close-on-click-modal": !1,
157
- "before-close": he
158
- }, {
159
- footer: C(() => [
160
- le("span", Le, [
161
- ae(D, {
162
- loading: R.value,
163
- onClick: z
164
- }, {
165
- default: C(() => [
166
- W(A(i(m)("act.cancel")), 1)
167
- ]),
168
- _: 1
169
- }, 8, ["loading"]),
170
- oe((n(), p(D, {
171
- type: "primary",
172
- loading: R.value,
173
- onClick: c[1] || (c[1] = (H) => ve(x.value))
174
- }, {
175
- default: C(() => [
176
- W(A(i(m)("act.save")), 1)
177
- ]),
178
- _: 1
179
- }, 8, ["loading"])), [
180
- [Fe]
181
- ])
182
- ])
183
- ]),
184
- default: C(() => {
185
- var H, Z;
186
- return [
187
- oe((n(), p(y, {
188
- class: "a-form",
189
- ref_key: "formRef",
190
- ref: x,
191
- model: o.value,
192
- "label-suffix": ":",
193
- "label-width": (H = w.data.formConfig) == null ? void 0 : H.formLabelWidth,
194
- "label-position": (Z = w.data.formConfig) == null ? void 0 : Z.formLabelPosition
195
- }, {
196
- default: C(() => [
197
- ae(B, { gutter: 40 }, {
198
- default: C(() => [
199
- (n(!0), k(O, null, G(L.value, (e, I) => (n(), p(N, {
200
- span: pe(e),
201
- key: I
202
- }, {
203
- default: C(() => [
204
- e.customFiledsComponentes.isFiledCustom ? (n(), k(O, { key: 1 }, [
205
- e.customFiledsComponentes[e.customFiledsComponentes.customComponentName] ? (n(), p(De(e.customFiledsComponentes[e.customFiledsComponentes.customComponentName]), {
206
- key: 0,
207
- ref_for: !0,
208
- ref: (r) => M.value[e.customFiledsComponentes.customComponentName] = r,
209
- formConfig: w.data.formConfig,
210
- item: e,
211
- rowData: f.data.rowData,
212
- visible: f.visible,
213
- form: o.value,
214
- "onUpdate:form": c[0] || (c[0] = (r) => o.value = r)
215
- }, null, 40, ["formConfig", "item", "rowData", "visible", "form"])) : (n(), k("div", {
216
- class: "no-config",
217
- key: I
218
- }, [
219
- le("span", Re, "【" + A(e.fieldName) + "】", 1),
220
- W(A(i(m)("act.fieldCustom")), 1)
221
- ]))
222
- ], 64)) : (n(), p(V, {
223
- key: 0,
224
- label: e.fieldName,
225
- prop: ["select", "multipleSelect"].includes(e.fieldType) ? `${e.fieldKey}ActImplicit` : e.fieldKey,
226
- rules: [{ required: e.isFormFieldRequired, message: i(m)("act.requiredMessage"), trigger: me(e) }]
227
- }, {
228
- default: C(() => [
229
- e.fieldType === "input" ? (n(), p(a, v({
230
- key: 0,
231
- modelValue: o.value[e.fieldKey],
232
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
233
- placeholder: `${i(m)("act.inputPlaceholder")}${e.fieldName}`,
234
- clearable: "",
235
- ref_for: !0
236
- }, i(b)(e), {
237
- disabled: e.isFormDisabled
238
- }), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : te("", !0),
239
- e.fieldType === "inputNumber" ? (n(), p(i(re), v({
240
- key: 1,
241
- modelValue: o.value[e.fieldKey],
242
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
243
- placeholder: `${i(m)("act.inputPlaceholder")}${e.fieldName}`,
244
- clearable: "",
245
- ref_for: !0
246
- }, i(b)(e), {
247
- disabled: e.isFormDisabled
248
- }), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : e.fieldType === "textarea" ? (n(), p(a, v({
249
- key: 2,
250
- modelValue: o.value[e.fieldKey],
251
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
252
- placeholder: `${i(m)("act.inputPlaceholder")}${e.fieldName}`,
253
- rows: 4,
254
- ref_for: !0
255
- }, i(b)(e), {
256
- type: "textarea",
257
- disabled: e.isFormDisabled
258
- }), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : e.fieldType === "selectIcon" ? (n(), p(i(de), v({
259
- key: 3,
260
- modelValue: o.value[e.fieldKey],
261
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
262
- icons: e.dataList,
263
- placeholder: `${i(m)("act.selectPlaceholder")}${e.fieldName}`,
264
- ref_for: !0
265
- }, i(b)(e), {
266
- disabled: e.isFormDisabled
267
- }), {
268
- default: C(() => [
269
- (n(!0), k(O, null, G(e.dataList, (r, U) => (n(), p(d, {
270
- key: U,
271
- label: r.key,
272
- value: r.value
273
- }, null, 8, ["label", "value"]))), 128))
274
- ]),
275
- _: 2
276
- }, 1040, ["modelValue", "onUpdate:modelValue", "icons", "placeholder", "disabled"])) : ["select", "multipleSelect"].includes(e.fieldType) ? (n(), p(t, v({
277
- key: 4,
278
- modelValue: o.value[`${e.fieldKey}ActImplicit`],
279
- "onUpdate:modelValue": (r) => o.value[`${e.fieldKey}ActImplicit`] = r,
280
- placeholder: `${i(m)("act.selectPlaceholder")}${e.fieldName}`,
281
- clearable: "",
282
- filterable: "",
283
- "value-key": "value",
284
- ref_for: !0
285
- }, i(b)(e), {
286
- multiple: e.fieldType === "multipleSelect",
287
- disabled: e.isFormDisabled,
288
- onChange: (r) => _e(r, e)
289
- }), {
290
- default: C(() => [
291
- (n(!0), k(O, null, G(e.dataList, (r, U) => (n(), p(d, {
292
- key: U,
293
- label: r.key,
294
- value: r
295
- }, null, 8, ["label", "value"]))), 128))
296
- ]),
297
- _: 2
298
- }, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "disabled", "onChange"])) : ["virtualizedSelect", "virtualizedMultipleSelect"].includes(e.fieldType) ? (n(), p(h, v({
299
- key: 5,
300
- modelValue: o.value[e.fieldKey],
301
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
302
- options: e.dataList,
303
- props: { ...i(Ue) },
304
- placeholder: `${i(m)("act.selectPlaceholder")}${e.fieldName}`,
305
- clearable: "",
306
- filterable: "",
307
- ref_for: !0
308
- }, i(b)(e), {
309
- disabled: e.isFormDisabled,
310
- multiple: e.fieldType === "virtualizedMultipleSelect"
311
- }), null, 16, ["modelValue", "onUpdate:modelValue", "options", "props", "placeholder", "disabled", "multiple"])) : e.fieldType === "treeSelect" ? (n(), p(F, v({
312
- key: 6,
313
- modelValue: o.value[e.fieldKey],
314
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
315
- placeholder: `请选择${e.fieldName}`,
316
- props: { isLeaf: "isLeaf" },
317
- "render-after-expand": !1,
318
- "collapse-tags": "",
319
- "collapse-tags-tooltip": "",
320
- multiple: "",
321
- "show-checkbox": "",
322
- clearable: "",
323
- filterable: "",
324
- lazy: "",
325
- load: (r, U) => ye({ node: r, resolve: U }, e),
326
- ref_for: !0
327
- }, i(b)(e)), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "load"])) : e.fieldType === "date" ? (n(), p(s, v({
328
- key: 7,
329
- modelValue: o.value[e.fieldKey],
330
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
331
- type: "date",
332
- placeholder: `${i(m)("act.selectPlaceholder")}${i(m)("act.time")}`,
333
- "value-format": "YYYY-MM-DD HH:mm:ss",
334
- ref_for: !0
335
- }, i(b)(e), {
336
- disabled: e.isFormDisabled
337
- }), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : e.fieldType === "dateRange" ? (n(), p(s, v({
338
- key: 8,
339
- modelValue: o.value[e.fieldKey],
340
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
341
- type: "daterange",
342
- "start-placeholder": i(m)("act.startTime"),
343
- "end-placeholder": i(m)("act.endTime"),
344
- "value-format": "YYYY-MM-DD HH:mm:ss",
345
- ref_for: !0
346
- }, i(b)(e), {
347
- disabled: e.isFormDisabled
348
- }), null, 16, ["modelValue", "onUpdate:modelValue", "start-placeholder", "end-placeholder", "disabled"])) : e.fieldType === "provinceCascade" ? (n(), p(u, v({
349
- key: 9,
350
- modelValue: o.value[e.fieldKey],
351
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
352
- options: e.dataList,
353
- props: i(ke),
354
- clearable: "",
355
- filterable: "",
356
- placeholder: `${i(m)("act.selectPlaceholder")}${e.fieldName}`,
357
- ref_for: !0
358
- }, i(b)(e), {
359
- disabled: e.isFormDisabled
360
- }), null, 16, ["modelValue", "onUpdate:modelValue", "options", "props", "placeholder", "disabled"])) : e.fieldType === "switch" ? (n(), p(g, {
361
- key: 10,
362
- modelValue: o.value[e.fieldKey],
363
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
364
- "active-value": !0,
365
- "inactive-value": !1
366
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : e.fieldType === "upload" ? (n(), p(i(ie), v({
367
- key: 11,
368
- class: "form-upload",
369
- modelValue: o.value[e.fieldKey],
370
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
371
- request: i(q),
372
- ref_for: !0
373
- }, i(b)(e)), null, 16, ["modelValue", "onUpdate:modelValue", "request"])) : e.fieldType === "editor" ? (n(), p(i(ne), v({
374
- key: 12,
375
- modelValue: o.value[e.fieldKey],
376
- "onUpdate:modelValue": (r) => o.value[e.fieldKey] = r,
377
- disabled: e.isFormDisabled,
378
- placeholder: `${i(m)("act.inputPlaceholder")}${e.fieldName}`,
379
- ref_for: !0
380
- }, i(b)(e)), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "placeholder"])) : te("", !0)
381
- ]),
382
- _: 2
383
- }, 1032, ["label", "prop", "rules"]))
384
- ]),
385
- _: 2
386
- }, 1032, ["span"]))), 128))
387
- ]),
388
- _: 1
389
- })
390
- ]),
391
- _: 1
392
- }, 8, ["model", "label-width", "label-position"])), [
393
- [Ce, S.value]
394
- ])
395
- ];
396
- }),
397
- _: 1
398
- }, 8, ["model-value", "title", "width"]);
399
- };
400
- }
401
- }, je = /* @__PURE__ */ we($e, [["__scopeId", "data-v-37b49f83"]]);
402
- export {
403
- je as default
404
- };