act-plus 1.1.39 → 1.1.40

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