act-plus 1.1.39 → 1.1.41

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