vue3-curd 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.
Files changed (48) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/src/api/app/translation/index.d.ts +9 -0
  3. package/dist/src/api/app/translation/types.d.ts +24 -0
  4. package/dist/src/api/system/commonDict/data/index.d.ts +8 -0
  5. package/dist/src/api/system/commonDict/data/types.d.ts +24 -0
  6. package/dist/src/api/system/dict/data/index.d.ts +8 -0
  7. package/dist/src/api/system/dict/data/types.d.ts +24 -0
  8. package/dist/src/api/system/oss/index.d.ts +6 -0
  9. package/dist/src/api/system/oss/types.d.ts +21 -0
  10. package/dist/src/components/CURD/composables/useDictData.d.ts +6 -0
  11. package/dist/src/components/CURD/composables/useFormData.d.ts +6 -0
  12. package/dist/src/components/CURD/composables/useTableData.d.ts +30 -0
  13. package/dist/src/components/CURD/constants.d.ts +20 -0
  14. package/dist/src/components/CURD/curdEdit.d.ts +55 -0
  15. package/dist/src/components/CURD/curdSearch.d.ts +17 -0
  16. package/dist/src/components/CURD/curdTable.d.ts +42 -0
  17. package/dist/src/components/CURD/index.d.ts +274 -0
  18. package/dist/src/components/CURD/types.d.ts +165 -0
  19. package/dist/src/components/CURD/utils.d.ts +15 -0
  20. package/dist/src/components/DictTag/index.d.ts +24 -0
  21. package/dist/src/components/Editor/index.d.ts +237 -0
  22. package/dist/src/components/FileUpload/index.d.ts +63 -0
  23. package/dist/src/components/ImageUpload/index.d.ts +107 -0
  24. package/dist/src/components/OssImagePreview/index.d.ts +26 -0
  25. package/dist/src/components/SvgIcon/index.d.ts +41 -0
  26. package/dist/src/components/TranslateInput/index.d.ts +27 -0
  27. package/dist/src/components/ossFile/index.d.ts +34 -0
  28. package/dist/src/directive/common/copyText.d.ts +5 -0
  29. package/dist/src/directive/curd-perm.d.ts +9 -0
  30. package/dist/src/index.d.ts +16 -0
  31. package/dist/src/plugin.d.ts +14 -0
  32. package/dist/src/plugins/modal.d.ts +20 -0
  33. package/dist/src/store/modules/dict.d.ts +56 -0
  34. package/dist/src/store/modules/translation.d.ts +88 -0
  35. package/dist/src/utils/dict.d.ts +8 -0
  36. package/dist/src/utils/download.d.ts +1 -0
  37. package/dist/src/utils/errorCode.d.ts +2 -0
  38. package/dist/src/utils/http.d.ts +7 -0
  39. package/dist/src/utils/index.d.ts +23 -0
  40. package/dist/src/utils/propTypes.d.ts +12 -0
  41. package/dist/src/utils/ruoyi.d.ts +15 -0
  42. package/dist/src/utils/translation.d.ts +5 -0
  43. package/dist/style.css +1 -0
  44. package/dist/vue3-curd.es.js +3089 -0
  45. package/dist/vue3-curd.es.js.map +1 -0
  46. package/dist/vue3-curd.umd.js +2 -0
  47. package/dist/vue3-curd.umd.js.map +1 -0
  48. package/package.json +103 -0
@@ -0,0 +1,3089 @@
1
+ import { ElTag as rl, ElImage as Be, ElIcon as xe, ElTable as Nl, ElTableColumn as Kl, ElCheckbox as nl, ElSwitch as sl, ElTooltip as Wl, ElButton as De, ElLoadingDirective as ql, ElPagination as Ql, ElUpload as Re, ElLink as Gl, ElDialog as cl, ElInput as Me, ElForm as ul, ElRow as dl, ElCol as il, ElFormItem as pl, ElInputNumber as Jl, ElSelect as fl, ElOption as hl, ElDatePicker as ml, ElCheckboxGroup as Xl, ElRadioGroup as Zl, ElRadio as ea, ElTreeSelect as yl, ElColorPicker as la, ElCard as gl, ElLoading as bl, ElMessage as Ve, ElMessageBox as we, ElNotification as Ee } from "element-plus/es";
2
+ import { defineComponent as fe, computed as Z, createElementBlock as T, openBlock as s, normalizeClass as je, unref as o, createElementVNode as re, Fragment as Y, renderList as Q, createBlock as f, createCommentVNode as X, withCtx as v, createTextVNode as z, toDisplayString as R, ref as I, watch as _e, normalizeStyle as he, createVNode as K, getCurrentInstance as ye, toRaw as Oe, onMounted as He, resolveDirective as vl, withDirectives as ie, renderSlot as Pe, withModifiers as aa, nextTick as Ie, TransitionGroup as ta, useCssVars as oa, resolveComponent as ra, isRef as Se, vShow as na, reactive as sa, createSlots as Le, withKeys as Qe, normalizeProps as Ge, guardReactiveProps as Je } from "vue";
3
+ import { createTypes as ca } from "vue-types";
4
+ import { PictureFilled as ze } from "@element-plus/icons-vue";
5
+ import ua from "axios";
6
+ import { compressAccurately as da } from "image-conversion";
7
+ import { defineStore as kl } from "pinia";
8
+ import "@vueup/vue-quill/dist/vue-quill.snow.css";
9
+ import { Quill as ia, QuillEditor as pa } from "@vueup/vue-quill";
10
+ import { useI18n as wl } from "vue-i18n";
11
+ import fa from "dayjs";
12
+ import ha from "file-saver";
13
+ const oe = ca({
14
+ func: void 0,
15
+ bool: void 0,
16
+ string: void 0,
17
+ number: void 0,
18
+ object: void 0,
19
+ integer: void 0
20
+ }), ma = ["xlink:href", "fill"], ya = /* @__PURE__ */ fe({
21
+ __name: "index",
22
+ props: {
23
+ iconClass: oe.string.isRequired,
24
+ className: oe.string.def(""),
25
+ color: oe.string.def("")
26
+ },
27
+ setup(e) {
28
+ const t = e, a = Z(() => `#icon-${t.iconClass}`), l = Z(() => t.className ? `svg-icon ${t.className}` : "svg-icon");
29
+ return (c, n) => (s(), T("svg", {
30
+ class: je(o(l)),
31
+ "aria-hidden": "true"
32
+ }, [
33
+ re("use", {
34
+ "xlink:href": o(a),
35
+ fill: e.color
36
+ }, null, 8, ma)
37
+ ], 2));
38
+ }
39
+ }), be = (e, t) => {
40
+ const a = e.__vccOpts || e;
41
+ for (const [l, c] of t)
42
+ a[l] = c;
43
+ return a;
44
+ }, Fe = /* @__PURE__ */ be(ya, [["__scopeId", "data-v-ed552a8d"]]), ga = /* @__PURE__ */ fe({
45
+ __name: "index",
46
+ props: {
47
+ options: {
48
+ type: Array,
49
+ default: null
50
+ },
51
+ value: {
52
+ type: [Number, String, Array, void 0],
53
+ default: ""
54
+ }
55
+ },
56
+ setup(e) {
57
+ const t = e, a = Z(() => {
58
+ const l = t.value;
59
+ if (l === "" || l === null || typeof l > "u")
60
+ return "";
61
+ if (Array.isArray(l)) {
62
+ const c = [];
63
+ return t.options.map((n) => {
64
+ (l.indexOf(n.value) > -1 || l.indexOf(n.label) > -1) && c.push(n);
65
+ }), c;
66
+ } else if (typeof l == "string") {
67
+ let c = [];
68
+ if (l.indexOf(",") > -1 ? c = l.split(",") : l.indexOf("、") > -1 && (c = l.split("、")), c.length > 0) {
69
+ const n = [];
70
+ return t.options.map((p) => {
71
+ (c.indexOf(p.value) > -1 || c.indexOf(p.label) > -1) && n.push(p);
72
+ }), n;
73
+ }
74
+ }
75
+ return t.options.find((c) => c.value == l || c.label == l) || l;
76
+ });
77
+ return (l, c) => {
78
+ const n = rl;
79
+ return Array.isArray(o(a)) ? (s(!0), T(Y, { key: 0 }, Q(o(a), (p) => (s(), T(Y, null, [
80
+ p.label ? (s(), f(n, {
81
+ "disable-transitions": !0,
82
+ key: p.value,
83
+ type: p.elTagType || "primary"
84
+ }, {
85
+ default: v(() => [
86
+ z(R(p.label), 1)
87
+ ]),
88
+ _: 2
89
+ }, 1032, ["type"])) : X("", !0)
90
+ ], 64))), 256)) : (s(), T(Y, { key: 1 }, [
91
+ o(a).label ? (s(), f(n, {
92
+ "disable-transitions": !0,
93
+ key: o(a).value,
94
+ type: o(a).elTagType || "primary"
95
+ }, {
96
+ default: v(() => [
97
+ z(R(o(a).label), 1)
98
+ ]),
99
+ _: 1
100
+ }, 8, ["type"])) : X("", !0)
101
+ ], 64));
102
+ };
103
+ }
104
+ }), Vl = /* @__PURE__ */ be(ga, [["__scopeId", "data-v-9a5060d2"]]);
105
+ let Ue = null, _l = () => ({}), Ne = "";
106
+ const ba = () => {
107
+ const e = ua.create({ baseURL: Ne, timeout: 5e4 });
108
+ return e.interceptors.response.use(
109
+ (t) => t.data,
110
+ (t) => Promise.reject(t)
111
+ ), e;
112
+ }, ke = () => (Ue || (Ue = ba()), Ue), va = (e) => {
113
+ Ue = e;
114
+ }, Ke = () => _l(), ka = (e) => {
115
+ _l = e;
116
+ }, We = () => Ne, wa = (e) => {
117
+ Ne = e || "";
118
+ };
119
+ function qe(e) {
120
+ return ke()({
121
+ url: "/resource/oss/listByIds/" + e,
122
+ method: "get"
123
+ });
124
+ }
125
+ function $l(e) {
126
+ return ke()({
127
+ url: "/resource/oss/" + e,
128
+ method: "delete"
129
+ });
130
+ }
131
+ const Va = { class: "image-slot" }, _a = { key: 1 }, $a = /* @__PURE__ */ fe({
132
+ __name: "index",
133
+ props: {
134
+ modelValue: [String, Object, Array, Number],
135
+ width: {
136
+ type: [Number, String],
137
+ default: ""
138
+ },
139
+ height: {
140
+ type: [Number, String],
141
+ default: ""
142
+ }
143
+ },
144
+ setup(e) {
145
+ const t = e, a = I(""), l = Z(() => a.value ? a.value.split(",")[0] : void 0), c = Z(() => {
146
+ if (!a.value) return;
147
+ const p = a.value.split(","), y = [];
148
+ return p.forEach((h) => y.push(h)), y;
149
+ }), n = Z(() => {
150
+ const p = t.width;
151
+ return typeof p == "string" ? p : `${p}px`;
152
+ });
153
+ return Z(() => {
154
+ const p = t.height;
155
+ return typeof p == "string" ? p : `${p}px`;
156
+ }), _e(() => t.modelValue, async (p) => {
157
+ if (p) {
158
+ let y;
159
+ Array.isArray(p) ? y = p : y = (await qe(p)).data, a.value = y.map((h) => h.url).join(",");
160
+ } else a.value = "";
161
+ }, { immediate: !0, deep: !0 }), (p, y) => {
162
+ const h = xe, V = Be;
163
+ return s(), T("div", null, [
164
+ o(l) ? (s(), f(V, {
165
+ key: 0,
166
+ src: `${o(l)}`,
167
+ fit: "scale-down",
168
+ loading: "lazy",
169
+ style: he(`width:${o(n)};height:${o(n)};`),
170
+ "preview-src-list": o(c),
171
+ "preview-teleported": ""
172
+ }, {
173
+ error: v(() => [
174
+ re("div", Va, [
175
+ K(h, null, {
176
+ default: v(() => [
177
+ K(o(ze))
178
+ ]),
179
+ _: 1
180
+ })
181
+ ])
182
+ ]),
183
+ _: 1
184
+ }, 8, ["src", "style", "preview-src-list"])) : (s(), T("div", _a, [
185
+ re("div", {
186
+ class: "image-slot",
187
+ style: he(`width:${o(n)};height:${o(n)};`)
188
+ }, [
189
+ K(h, null, {
190
+ default: v(() => [
191
+ K(o(ze))
192
+ ]),
193
+ _: 1
194
+ })
195
+ ], 4)
196
+ ]))
197
+ ]);
198
+ };
199
+ }
200
+ }), Sl = /* @__PURE__ */ be($a, [["__scopeId", "data-v-dc163acb"]]), Sa = { class: "image-slot" }, Da = /* @__PURE__ */ fe({
201
+ __name: "index",
202
+ props: {
203
+ data: {
204
+ type: Object,
205
+ default: () => ({})
206
+ },
207
+ width: {
208
+ type: [Number, String],
209
+ default: 60
210
+ },
211
+ height: {
212
+ type: [Number, String],
213
+ default: 60
214
+ }
215
+ },
216
+ setup(e) {
217
+ const t = e, a = Z(
218
+ () => typeof t.width == "string" ? t.width : `${t.width}px`
219
+ ), l = Z(
220
+ () => typeof t.height == "string" ? t.height : `${t.height}px`
221
+ );
222
+ return (c, n) => {
223
+ const p = xe, y = Be, h = Fe;
224
+ return [".jpg", ".png", ".jpeg"].indexOf(e.data.fileSuffix) > -1 ? (s(), f(y, {
225
+ key: 0,
226
+ src: e.data.url,
227
+ fit: "cover",
228
+ "preview-src-list": [e.data.url],
229
+ style: he(`width:${o(a)};height:${o(l)};`),
230
+ "preview-teleported": ""
231
+ }, {
232
+ error: v(() => [
233
+ re("div", Sa, [
234
+ K(p, null, {
235
+ default: v(() => [
236
+ K(o(ze))
237
+ ]),
238
+ _: 1
239
+ })
240
+ ])
241
+ ]),
242
+ _: 1
243
+ }, 8, ["src", "preview-src-list", "style"])) : [".xls", ".xlsx", ".csv"].indexOf(e.data.fileSuffix) > -1 ? (s(), f(h, {
244
+ key: 1,
245
+ "icon-class": "excel",
246
+ style: he(`width:${o(a)};height:${o(l)};`)
247
+ }, null, 8, ["style"])) : [".doc", ".docx"].indexOf(e.data.fileSuffix) > -1 ? (s(), f(h, {
248
+ key: 2,
249
+ "icon-class": "word",
250
+ style: he(`width:${o(a)};height:${o(l)};`)
251
+ }, null, 8, ["style"])) : [".pdf"].indexOf(e.data.fileSuffix) > -1 ? (s(), f(h, {
252
+ key: 3,
253
+ "icon-class": "pdf",
254
+ style: he(`width:${o(a)};height:${o(l)};`)
255
+ }, null, 8, ["style"])) : [".tet"].indexOf(e.data.fileSuffix) > -1 ? (s(), f(h, {
256
+ key: 4,
257
+ "icon-class": "tet",
258
+ style: he(`width:${o(a)};height:${o(l)};`)
259
+ }, null, 8, ["style"])) : [".zip"].indexOf(e.data.fileSuffix) > -1 ? (s(), f(h, {
260
+ key: 5,
261
+ "icon-class": "zip",
262
+ style: he(`width:${o(a)};height:${o(l)};`)
263
+ }, null, 8, ["style"])) : (s(), f(h, {
264
+ key: 6,
265
+ "icon-class": "unknown",
266
+ style: he(`width:${o(a)};height:${o(l)};`)
267
+ }, null, 8, ["style"]));
268
+ };
269
+ }
270
+ }), Dl = /* @__PURE__ */ be(Da, [["__scopeId", "data-v-04035581"]]), Cl = {
271
+ bool: [
272
+ { label: "是", value: "1" },
273
+ { label: "否", value: "0" },
274
+ { label: "是", value: "True" },
275
+ { label: "否", value: "False" }
276
+ ]
277
+ }, Ca = [
278
+ { prop: "createTime", width: "165px" },
279
+ { prop: "createBy", width: "100px" },
280
+ { prop: "orderNum", width: "80px" },
281
+ { prop: "sort", width: "80px" },
282
+ { prop: "code", width: "120px" },
283
+ { prop: "updateTime", width: "165px" }
284
+ ], Ta = [10, 15, 20, 30, 50, 100], Xe = {
285
+ pageSize: 15,
286
+ pageNum: 1,
287
+ total: 0,
288
+ orderByColumn: "",
289
+ isAsc: ""
290
+ }, Ae = {
291
+ FULL: "total, sizes, prev, pager, next",
292
+ SIMPLE: "total"
293
+ }, Ze = 30, Ea = 28;
294
+ function Ye(e) {
295
+ if (!e) return {};
296
+ const t = {};
297
+ for (const a in e) {
298
+ const l = e[a];
299
+ l !== "" && l !== null && l !== void 0 && (!Array.isArray(l) || l.length > 0) && (t[a] = l);
300
+ }
301
+ return t;
302
+ }
303
+ function Ua(e) {
304
+ if (e.width) return String(e.width);
305
+ const t = Ca.find((a) => a.prop === e.prop);
306
+ return t ? t.width : e.prop.includes("time") ? "100px" : "auto";
307
+ }
308
+ function Aa(e, t) {
309
+ if (!t.prop) return "";
310
+ let a;
311
+ if (t.prop.includes(".") ? a = t.prop.split(".").reduce((c, n) => c == null ? void 0 : c[n], e) : a = e[t.prop], a != null) {
312
+ const l = t.prefix || "", c = t.suffix || "";
313
+ return `${l}${a}${c}`;
314
+ }
315
+ return "";
316
+ }
317
+ function Oa(e) {
318
+ e.forEach((t) => {
319
+ t.form || (t.form = { order: 100 }), t.form.order == null && (t.form.order = 100), !t.form.type && t.type && (t.form.type = t.type), !t.form.prop && t.prop && (t.form.prop = t.prop), t.search && !t.search.dictType && t.dictType && (t.search.dictType = t.dictType), !t.form.dictType && t.dictType && (t.form.dictType = t.dictType), !t.form.inactiveValue && t.inactiveValue && (t.form.inactiveValue = t.inactiveValue), !t.form.activeValue && t.activeValue && (t.form.activeValue = t.activeValue), t.form.type === "checkbox" && (t.label = ""), t.search && (t.search.prop = t.search.prop ?? t.prop);
320
+ });
321
+ }
322
+ function Pa(e) {
323
+ e.forEach((t) => {
324
+ if (!t.form) return;
325
+ const a = t.form.rules || [];
326
+ t.form.required && a.push({
327
+ required: !0,
328
+ message: `${t.label}必填`,
329
+ trigger: "blur"
330
+ }), t.form.rules = a.length > 0 ? a : void 0;
331
+ });
332
+ }
333
+ function Tl(e, t = "order") {
334
+ return [...e].sort((a, l) => {
335
+ const c = (y, h) => {
336
+ const V = h.split(".");
337
+ let i = y;
338
+ for (const M of V)
339
+ i = i == null ? void 0 : i[M];
340
+ return i ?? 100;
341
+ }, n = c(a, t), p = c(l, t);
342
+ return n - p;
343
+ });
344
+ }
345
+ function Ia(e, t, a) {
346
+ return e.filter((l) => !(l.canEdit === !1 || a && l.canUpdate === !1 || !a && l.canCreate === !1));
347
+ }
348
+ function La(e, t) {
349
+ if (!t.show) return !0;
350
+ for (const a in t.show)
351
+ if (t.show[a].includes(e[a]))
352
+ return !0;
353
+ return !1;
354
+ }
355
+ function za(e, t) {
356
+ if (!t.disable && !t.enable) return !1;
357
+ for (const a in t.disable)
358
+ if (t.disable[a].includes(e[a]))
359
+ return !0;
360
+ for (const a in t.enable)
361
+ if (!t.enable[a].includes(e[a]))
362
+ return !0;
363
+ return !1;
364
+ }
365
+ function Ya(e, t, a, l) {
366
+ t && t[0] && t[1] && (e[a] = `${t[0]},${t[1]}`, l == null || l.addDateRange(e, t, a));
367
+ }
368
+ function Ba(e) {
369
+ const { proxy: t } = ye(), a = I([]), l = I(!1), c = I([]), n = I({}), p = I(), y = I({
370
+ ...Xe,
371
+ pageSize: e.initialPageSize ?? Xe.pageSize
372
+ }), h = I(Ta), V = I(Ae.FULL), i = async () => {
373
+ var E;
374
+ if (!e.listApi) {
375
+ e.data ? a.value = Array.isArray(e.data) ? e.data : ((E = e.data) == null ? void 0 : E.value) || [] : a.value = [];
376
+ return;
377
+ }
378
+ l.value = !0;
379
+ try {
380
+ const b = await M(null), U = await e.listApi(b);
381
+ e.afterQuery && await e.afterQuery(U);
382
+ let O = U.rows || U.data;
383
+ e.treeProps && (O = t == null ? void 0 : t.handleTree(U.data, e.rowKey)), a.value = O, y.value.total = U.total;
384
+ const W = U.total / y.value.pageSize <= 1;
385
+ V.value = W ? Ae.SIMPLE : Ae.FULL, t == null || t.$forceUpdate();
386
+ } catch (b) {
387
+ console.error("Query failed:", b);
388
+ } finally {
389
+ l.value = !1;
390
+ }
391
+ }, M = async (E) => {
392
+ E && (n.value = Ye(E));
393
+ let b = e.queryParams || {};
394
+ if (e.beforeQuery) {
395
+ const U = await e.beforeQuery({});
396
+ b = {
397
+ ...y.value,
398
+ ...b,
399
+ ...n.value,
400
+ ...U
401
+ };
402
+ } else
403
+ b = {
404
+ ...y.value,
405
+ ...b,
406
+ ...n.value
407
+ };
408
+ return b;
409
+ }, C = (E) => {
410
+ E && (n.value = Ye(E)), i();
411
+ }, j = (E) => {
412
+ y.value.pageNum !== E && (y.value.pageNum = E, i());
413
+ }, P = (E) => {
414
+ y.value.pageSize !== E && (y.value.pageSize = E, i());
415
+ }, H = (E) => {
416
+ E.order && (y.value.orderByColumn = E.prop, y.value.isAsc = E.order), i();
417
+ }, J = (E) => {
418
+ c.value = E, e.selectionChange && e.selectionChange(E);
419
+ }, ee = () => {
420
+ const E = e.queryParams || {};
421
+ E.orderByColumn && (y.value.orderByColumn = E.orderByColumn, p.value = {
422
+ prop: E.orderByColumn,
423
+ order: E.isAsc === "asc" ? "ascending" : "descending"
424
+ }), E.isAsc && (y.value.isAsc = E.isAsc);
425
+ };
426
+ return {
427
+ listData: a,
428
+ loading: l,
429
+ multipleSelection: c,
430
+ pageOptions: y,
431
+ listSize: h,
432
+ pagingLayout: V,
433
+ defaultSort: p,
434
+ executeQuery: i,
435
+ getQueryParams: M,
436
+ refreshTable: C,
437
+ handlePageChange: j,
438
+ handleSizeChange: P,
439
+ handleSortChange: H,
440
+ handleSelectionChange: J,
441
+ initData: async () => {
442
+ ee(), await i();
443
+ }
444
+ };
445
+ }
446
+ function El() {
447
+ const { proxy: e } = ye(), t = async (n) => {
448
+ for (const p of n)
449
+ if (p.type === "dictTag") {
450
+ const y = await (e == null ? void 0 : e.useOneDict(p.dictType));
451
+ p.data = Oe(y);
452
+ } else if (p.type === "commonDictTag") {
453
+ const y = await (e == null ? void 0 : e.useOneCommonDict(p.dictType));
454
+ p.data = Oe(y);
455
+ }
456
+ }, a = async (n) => {
457
+ if (!n.search) return;
458
+ switch (n.search.type) {
459
+ case "selectApi":
460
+ n.search.api ? await l(n) : console.error(`${n.prop}中search对象未设置api参数`);
461
+ break;
462
+ case "treeSelectApi":
463
+ n.search.api ? await c(n) : console.error(`${n.prop}中search对象未设置api参数`);
464
+ break;
465
+ case "selectCommonDict":
466
+ n.search.data = await (e == null ? void 0 : e.useOneCommonDict(n.search.dictType));
467
+ break;
468
+ case "selectDict":
469
+ n.search.data = await (e == null ? void 0 : e.useOneDict(n.search.dictType));
470
+ break;
471
+ }
472
+ }, l = async (n) => {
473
+ var y;
474
+ if (!((y = n.search) != null && y.api)) return;
475
+ const p = {
476
+ pageNum: 1,
477
+ pageSize: 1e3,
478
+ filedName: n.prop,
479
+ ...n.search.apiParams || {}
480
+ };
481
+ try {
482
+ const h = await n.search.api(p);
483
+ n.search.data = h.data || h.rows;
484
+ } catch (h) {
485
+ console.error(`Failed to load API data for ${n.prop}:`, h);
486
+ }
487
+ }, c = async (n) => {
488
+ var p;
489
+ if ((p = n.search) != null && p.api)
490
+ try {
491
+ const y = await n.search.api({ pageNum: 1, pageSize: 1e3 });
492
+ if (n.search.data = y.data || y.rows || y, n.search.data && Array.isArray(n.search.data)) {
493
+ const V = (n.search.props || { value: "id", label: "label", children: "children" }).value || "id";
494
+ n.search.defaultExpandedKeys = n.search.data.map((i) => i[V]);
495
+ }
496
+ } catch (y) {
497
+ console.error(`Failed to load tree API data for ${n.prop}:`, y);
498
+ }
499
+ };
500
+ return {
501
+ initColumnDicts: t,
502
+ initSearchDicts: a,
503
+ initSelectApi: l
504
+ };
505
+ }
506
+ const xa = {
507
+ key: 2,
508
+ class: "image-style"
509
+ }, Ra = {
510
+ key: 3,
511
+ class: "image-style"
512
+ }, Ma = {
513
+ key: 8,
514
+ class: "color-cell"
515
+ }, ja = { style: { margin: "20px 0px" } }, Ha = /* @__PURE__ */ fe({
516
+ __name: "curdTable",
517
+ props: {
518
+ dataSource: {},
519
+ maxHeight: {}
520
+ },
521
+ emits: ["actionEvent", "selectionChange", "rowClick"],
522
+ setup(e, { expose: t, emit: a }) {
523
+ const { proxy: l } = ye(), c = a, n = e, p = Z(() => n.dataSource.maxHeight ?? n.maxHeight), y = I(), {
524
+ listData: h,
525
+ loading: V,
526
+ multipleSelection: i,
527
+ pageOptions: M,
528
+ listSize: C,
529
+ pagingLayout: j,
530
+ defaultSort: P,
531
+ refreshTable: H,
532
+ handlePageChange: J,
533
+ handleSizeChange: ee,
534
+ handleSortChange: S,
535
+ handleSelectionChange: E,
536
+ initData: b,
537
+ getQueryParams: U
538
+ } = Ba(n.dataSource), { initColumnDicts: O } = El(), W = I(Cl), $ = (_) => _ == null ? void 0 : _[n.dataSource.rowKey], d = Z(() => n.dataSource.actions ? n.dataSource.actions.filter(
539
+ (_) => _.action !== "create" && _.action !== "back" && (!_.position || _.position === "table")
540
+ ) : []), D = (_) => {
541
+ var N;
542
+ return !((N = n.dataSource.disabledCheckedRowKeys) != null && N.includes($(_)));
543
+ }, A = Z(() => {
544
+ const _ = n.dataSource.actionColumnWidth;
545
+ if (_ != null && _ !== "")
546
+ return typeof _ == "number" ? `${_}px` : _;
547
+ let N = d.value.length * Ea;
548
+ return N < Ze && (N = Ze), `${N + 40}px`;
549
+ }), F = (_, N) => La(_, N), G = (_, N) => za(_, N), se = (_) => Ua(_), w = (_) => {
550
+ var le;
551
+ const N = _.align || n.dataSource.align;
552
+ return N || (((le = _.label) == null ? void 0 : le.indexOf("時間")) > -1 || !1 || _.type == "dictTag" || _.type == "image" || _.type == "switch" ? "center" : "left");
553
+ }, L = (_, N) => {
554
+ const le = l == null ? void 0 : l.useDict(_.dictType)[_.dictType];
555
+ if (le != null) {
556
+ const te = N[_.prop], ae = le.filter((ge) => ge.value == te);
557
+ return ae.length == 0 ? "" : ae[0].label;
558
+ } else console.error(_.dictType + " 字典不存在");
559
+ }, q = (_, N) => {
560
+ const le = W.value[_.dictType];
561
+ if (le != null) {
562
+ const te = N[_.prop], ae = le.find((ge) => ge.value == te);
563
+ return ae == null ? "" : ae.label;
564
+ } else console.error(_.dictType + " 字典不存在");
565
+ }, B = (_, N) => {
566
+ if (_.data != null) {
567
+ const le = N[_.prop], te = _.data.find((ae) => ae.value == le);
568
+ return te == null ? "" : te.label;
569
+ } else console.error("未配置data屬性");
570
+ }, ne = (_, N) => {
571
+ if (_.data != null) {
572
+ const le = N[_.prop], te = _.data.find((ae) => ae.value == le);
573
+ return te == null ? "info" : te.tagType;
574
+ } else console.error("未配置data屬性");
575
+ }, ue = (_, N) => Aa(_, N), me = (_) => {
576
+ const N = Array.isArray(_) ? _ : [];
577
+ E(N), c("selectionChange", N);
578
+ }, ce = (_, N, le) => {
579
+ var te, ae;
580
+ return (ae = (te = n.dataSource).rowClick) == null ? void 0 : ae.call(te, _, N, le);
581
+ }, pe = (_, N) => c("actionEvent", _, N), u = () => i.value, m = async () => {
582
+ var N, le;
583
+ if (!n.dataSource.showSelection || !((N = n.dataSource.checkedRowKeys) != null && N.length)) return;
584
+ await Ie();
585
+ const _ = y.value;
586
+ if (_ != null && _.toggleRowSelection)
587
+ for (const te of h.value) {
588
+ const ae = $(te);
589
+ if (ae == null) continue;
590
+ const ge = String(ae);
591
+ (le = n.dataSource.checkedRowKeys) != null && le.includes(ge) && _.toggleRowSelection(te, !0);
592
+ }
593
+ }, r = async () => {
594
+ var N, le;
595
+ if (!n.dataSource.showSelection || !((N = n.dataSource.disabledCheckedRowKeys) != null && N.length)) return;
596
+ await Ie();
597
+ const _ = y.value;
598
+ if (_ != null && _.toggleRowSelection)
599
+ for (const te of h.value) {
600
+ const ae = $(te);
601
+ if (ae == null) continue;
602
+ const ge = String(ae);
603
+ (le = n.dataSource.disabledCheckedRowKeys) != null && le.includes(ge) && _.toggleRowSelection(te, !0);
604
+ }
605
+ }, g = async () => {
606
+ await O(n.dataSource.columns), await b(), await r(), await m();
607
+ };
608
+ return He(() => g()), t({ refreshTable: H, getSelection: u, initData: g, getQueryParams: U }), (_, N) => {
609
+ const le = Kl, te = Be, ae = nl, ge = sl, $e = rl, xl = Vl, Rl = Fe, Ce = De, Ml = Wl, jl = Nl, Hl = Ql, Te = vl("hasPermi"), Fl = ql;
610
+ return s(), T("div", null, [
611
+ ie((s(), f(jl, {
612
+ ref_key: "curdTableRef",
613
+ ref: y,
614
+ data: o(h),
615
+ "row-key": n.dataSource.rowKey,
616
+ "element-loading-text": _.$t("數據加載中..."),
617
+ stripe: "",
618
+ "tree-props": n.dataSource.treeProps,
619
+ "default-sort": o(P),
620
+ onSelectionChange: me,
621
+ onSortChange: o(S),
622
+ onRowClick: ce,
623
+ "default-expand-all": n.dataSource.treeDefaultExpandAll ?? !1,
624
+ "max-height": o(p),
625
+ "highlight-current-row": ""
626
+ }, {
627
+ empty: v(() => [
628
+ re("div", ja, R(_.$t("未查詢到數據")), 1)
629
+ ]),
630
+ default: v(() => [
631
+ n.dataSource.showSelection ? (s(), f(le, {
632
+ key: 0,
633
+ type: "selection",
634
+ width: "60",
635
+ selectable: D,
636
+ align: "center"
637
+ })) : X("", !0),
638
+ n.dataSource.showIndex ? (s(), f(le, {
639
+ key: 1,
640
+ type: "index",
641
+ width: "70",
642
+ align: "center",
643
+ label: "序號"
644
+ })) : X("", !0),
645
+ (s(!0), T(Y, null, Q(n.dataSource.columns, (k) => (s(), T(Y, {
646
+ key: k.prop || k.key
647
+ }, [
648
+ k.width !== 0 ? (s(), f(le, {
649
+ key: 0,
650
+ label: _.$t(k.label),
651
+ width: se(k),
652
+ "min-width": k.minWidth,
653
+ prop: k.prop,
654
+ align: w(k),
655
+ sortable: k.sort ? "custom" : !1,
656
+ "show-overflow-tooltip": k.showOverflowTooltip || !0,
657
+ fixed: k.fixed
658
+ }, {
659
+ default: v(({ row: x }) => [
660
+ k.slot ? Pe(_.$slots, k.slot, {
661
+ key: 0,
662
+ row: x,
663
+ column: k,
664
+ value: x[k.prop]
665
+ }, void 0, !0) : k.type === "image" && x[k.prop] ? (s(), f(Sl, {
666
+ key: 1,
667
+ modelValue: x[k.prop],
668
+ "onUpdate:modelValue": (de) => x[k.prop] = de,
669
+ class: "image-preview",
670
+ width: 24,
671
+ height: 24
672
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : k.type === "networkImage" ? (s(), T("view", xa, [
673
+ K(te, {
674
+ src: x[k.prop],
675
+ fit: "cover",
676
+ style: { height: "24px" }
677
+ }, null, 8, ["src"])
678
+ ])) : k.type === "imageUrl" ? (s(), T("view", Ra, [
679
+ K(te, {
680
+ src: x[k.prop],
681
+ fit: "cover",
682
+ style: { height: "24px" }
683
+ }, null, 8, ["src"])
684
+ ])) : k.type === "date" ? (s(), T(Y, { key: 4 }, [
685
+ z(R(_.parseTime(x[k.prop], "{y}-{m}-{d}")), 1)
686
+ ], 64)) : k.type === "timestamp" ? (s(), T(Y, { key: 5 }, [
687
+ z(R(_.parseTime(x[k.prop])), 1)
688
+ ], 64)) : k.type === "bool" ? (s(), f(ae, {
689
+ key: 6,
690
+ modelValue: x[k.prop],
691
+ "onUpdate:modelValue": (de) => x[k.prop] = de,
692
+ onClick: N[0] || (N[0] = aa(() => {
693
+ }, ["stop", "prevent"]))
694
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : k.type === "switch" ? (s(), f(ge, {
695
+ key: 7,
696
+ modelValue: x[k.prop],
697
+ "onUpdate:modelValue": (de) => x[k.prop] = de,
698
+ "active-value": k.activeValue || "0",
699
+ "inactive-value": k.inactiveValue || "1",
700
+ size: "small",
701
+ "before-change": () => !1
702
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "active-value", "inactive-value"])) : k.type === "color" ? (s(), T("div", Ma, [
703
+ re("div", {
704
+ class: "color-cell-item",
705
+ style: he({ backgroundColor: x[k.prop] || "#ffffff" })
706
+ }, null, 4)
707
+ ])) : k.type === "fromDict" ? (s(), T(Y, { key: 9 }, [
708
+ z(R(L(k, x)), 1)
709
+ ], 64)) : k.type === "fromDataTag" ? (s(), f($e, {
710
+ key: 10,
711
+ type: ne(k, x),
712
+ effect: k.tagEffect ?? "light",
713
+ class: "el-column-tag"
714
+ }, {
715
+ default: v(() => [
716
+ z(R(B(k, x)), 1)
717
+ ]),
718
+ _: 2
719
+ }, 1032, ["type", "effect"])) : k.type === "localDict" ? (s(), f($e, {
720
+ key: 11,
721
+ type: k.tagType || "info",
722
+ effect: k.tagEffect || "light",
723
+ class: "el-column-tag"
724
+ }, {
725
+ default: v(() => [
726
+ z(R(q(
727
+ k,
728
+ x
729
+ )), 1)
730
+ ]),
731
+ _: 2
732
+ }, 1032, ["type", "effect"])) : k.type === "tag" ? (s(), f($e, {
733
+ key: 12,
734
+ type: k.tagType || "info",
735
+ effect: k.tagEffect || "light",
736
+ class: "el-column-tag",
737
+ plain: ""
738
+ }, {
739
+ default: v(() => [
740
+ z(R(x[k.prop]), 1)
741
+ ]),
742
+ _: 2
743
+ }, 1032, ["type", "effect"])) : k.type === "tagArrayObj" ? (s(!0), T(Y, { key: 13 }, Q(x[k.prop], (de) => (s(), f($e, {
744
+ type: k.tagType || "info",
745
+ effect: k.tagEffect || "light",
746
+ class: "el-column-tag",
747
+ key: de[k.displayField],
748
+ plain: ""
749
+ }, {
750
+ default: v(() => [
751
+ z(R(de[k.displayField]), 1)
752
+ ]),
753
+ _: 2
754
+ }, 1032, ["type", "effect"]))), 128)) : k.type === "tags" ? (s(!0), T(Y, { key: 14 }, Q(x[k.prop], (de) => (s(), f($e, {
755
+ type: k.tagType || "info",
756
+ effect: k.tagEffect || "light",
757
+ class: "el-column-tag",
758
+ key: de[k.tagLabel],
759
+ plain: ""
760
+ }, {
761
+ default: v(() => [
762
+ z(R(de[k.tagLabel]), 1)
763
+ ]),
764
+ _: 2
765
+ }, 1032, ["type", "effect"]))), 128)) : k.type === "dictTag" || k.type === "commonDictTag" ? (s(), f(xl, {
766
+ key: 15,
767
+ options: k.data || [],
768
+ value: x[k.prop]
769
+ }, null, 8, ["options", "value"])) : k.type === "svg" ? (s(), f(Rl, {
770
+ key: 16,
771
+ "icon-class": x.icon
772
+ }, null, 8, ["icon-class"])) : k.type === "ossFile" ? (s(), f(Dl, {
773
+ key: 17,
774
+ data: x,
775
+ width: 32,
776
+ height: 32
777
+ }, null, 8, ["data"])) : (s(), T(Y, { key: 18 }, [
778
+ z(R(ue(x, k)), 1)
779
+ ], 64))
780
+ ]),
781
+ _: 2
782
+ }, 1032, ["label", "width", "min-width", "prop", "align", "sortable", "show-overflow-tooltip", "fixed"])) : X("", !0)
783
+ ], 64))), 128)),
784
+ o(d).length > 0 ? (s(), f(le, {
785
+ key: 2,
786
+ align: "center",
787
+ fixed: "right",
788
+ label: _.$t("操作"),
789
+ width: o(A)
790
+ }, {
791
+ default: v(({ row: k }) => [
792
+ (s(!0), T(Y, null, Q(o(d), (x) => (s(), f(Ml, {
793
+ content: _.$t(x.text),
794
+ placement: "top",
795
+ key: x.action
796
+ }, {
797
+ default: v(() => [
798
+ F(k, x) ? (s(), T(Y, { key: 0 }, [
799
+ x.action === "update" ? ie((s(), f(Ce, {
800
+ key: 0,
801
+ link: "",
802
+ type: "primary",
803
+ icon: "Edit",
804
+ onClick: (de) => pe(x, k),
805
+ disabled: G(k, x)
806
+ }, null, 8, ["onClick", "disabled"])), [
807
+ [Te, x.permission || null]
808
+ ]) : x.action === "delete" ? ie((s(), f(Ce, {
809
+ key: 1,
810
+ link: "",
811
+ type: "primary",
812
+ icon: "Delete",
813
+ onClick: (de) => pe(x, k),
814
+ disabled: G(k, x)
815
+ }, null, 8, ["onClick", "disabled"])), [
816
+ [Te, x.permission || null]
817
+ ]) : x.action === "view" || x.action === "viewDetail" ? ie((s(), f(Ce, {
818
+ key: 2,
819
+ link: "",
820
+ type: "primary",
821
+ icon: "View",
822
+ onClick: (de) => pe(x, k),
823
+ disabled: G(k, x)
824
+ }, null, 8, ["onClick", "disabled"])), [
825
+ [Te, x.permission || null]
826
+ ]) : ie((s(), f(Ce, {
827
+ key: 3,
828
+ link: "",
829
+ type: "primary",
830
+ icon: x.icon,
831
+ onClick: (de) => pe(x, k),
832
+ disabled: G(k, x)
833
+ }, null, 8, ["icon", "onClick", "disabled"])), [
834
+ [Te, x.permission || null]
835
+ ])
836
+ ], 64)) : X("", !0)
837
+ ]),
838
+ _: 2
839
+ }, 1032, ["content"]))), 128))
840
+ ]),
841
+ _: 1
842
+ }, 8, ["label", "width"])) : X("", !0)
843
+ ]),
844
+ _: 3
845
+ }, 8, ["data", "row-key", "element-loading-text", "tree-props", "default-sort", "onSortChange", "default-expand-all", "max-height"])), [
846
+ [Fl, o(V)]
847
+ ]),
848
+ n.dataSource.paging !== !1 ? (s(), f(Hl, {
849
+ key: 0,
850
+ class: "paging",
851
+ background: "",
852
+ layout: o(j),
853
+ onSizeChange: o(ee),
854
+ onCurrentChange: o(J),
855
+ "page-size": o(M).pageSize,
856
+ "current-page": o(M).pageNum,
857
+ "onUpdate:currentPage": N[1] || (N[1] = (k) => o(M).pageNum = k),
858
+ total: o(M).total,
859
+ "page-sizes": o(C)
860
+ }, null, 8, ["layout", "onSizeChange", "onCurrentChange", "page-size", "current-page", "total", "page-sizes"])) : X("", !0)
861
+ ]);
862
+ };
863
+ }
864
+ }), el = /* @__PURE__ */ be(Ha, [["__scopeId", "data-v-5f05b778"]]), Fa = { class: "upload-file" }, Na = {
865
+ key: 0,
866
+ class: "el-upload__tip"
867
+ }, Ka = { style: { color: "#f56c6c" } }, Wa = { style: { color: "#f56c6c" } }, qa = { class: "el-icon-document" }, Qa = { class: "ele-upload-list__item-content-action" }, Ga = /* @__PURE__ */ fe({
868
+ __name: "index",
869
+ props: {
870
+ modelValue: [String, Object, Array],
871
+ // 数量限制
872
+ limit: oe.number.def(5),
873
+ // 大小限制(MB)
874
+ fileSize: oe.number.def(5),
875
+ // 文件类型, 例如['png', 'jpg', 'jpeg']
876
+ fileType: oe.array.def(["doc", "xls", "ppt", "txt", "pdf"]),
877
+ // 是否显示提示
878
+ showTip: oe.bool.def(!0),
879
+ // 是否显示文件列表
880
+ showFileList: oe.bool.def(!0)
881
+ },
882
+ emits: ["update:modelValue"],
883
+ setup(e, { emit: t }) {
884
+ const a = e, { proxy: l } = ye(), c = t, n = I(0), p = I([]), y = We(), h = I(y + "/resource/oss/upload"), V = I(Ke()), i = I([]), M = Z(
885
+ () => a.showTip && (a.fileType || a.fileSize)
886
+ ), C = I();
887
+ _e(() => a.modelValue, async (U) => {
888
+ if (U) {
889
+ if (!a.showFileList) return;
890
+ let O = 1, W = [];
891
+ Array.isArray(U) ? W = U : W = (await qe(U)).data.map((d) => ({ name: d.originalName, url: d.url, ossId: d.ossId })), i.value = W.map(($) => ($ = { name: $.name, url: $.url, ossId: $.ossId }, $.uid = $.uid || (/* @__PURE__ */ new Date()).getTime() + O++, $));
892
+ } else
893
+ return i.value = [], [];
894
+ }, { deep: !0, immediate: !0 });
895
+ const j = (U) => {
896
+ if (a.fileType.length) {
897
+ const O = U.name.split("."), W = O[O.length - 1];
898
+ if (!(a.fileType.indexOf(W) >= 0))
899
+ return l == null || l.$modal.msgError(`文件格式不正確, 請上傳${a.fileType.join("/")}格式文件!`), !1;
900
+ }
901
+ return a.fileSize && !(U.size / 1024 / 1024 < a.fileSize) ? (l == null || l.$modal.msgError(`上傳文件大小不超過 ${a.fileSize} MB!`), !1) : (l == null || l.$modal.loading("正在上傳文件,請稍等..."), n.value++, !0);
902
+ }, P = () => {
903
+ l == null || l.$modal.msgError(`上傳文件數量不能超過 ${a.limit} 个!`);
904
+ }, H = () => {
905
+ l == null || l.$modal.msgError("上傳文件失敗");
906
+ }, J = (U, O) => {
907
+ var W;
908
+ U.code === 200 ? (p.value.push({ name: U.data.fileName, url: U.data.url, ossId: U.data.ossId }), S()) : (n.value--, l == null || l.$modal.closeLoading(), l == null || l.$modal.msgError(U.msg), (W = C.value) == null || W.handleRemove(O), S());
909
+ }, ee = (U) => {
910
+ const O = i.value[U].ossId;
911
+ $l(O), i.value.splice(U, 1), c("update:modelValue", b(i.value));
912
+ }, S = () => {
913
+ n.value > 0 && p.value.length === n.value && (i.value = i.value.filter((U) => U.url !== void 0).concat(p.value), p.value = [], n.value = 0, c("update:modelValue", b(i.value)), l == null || l.$modal.closeLoading());
914
+ }, E = (U) => U.lastIndexOf("/") > -1 ? U.slice(U.lastIndexOf("/") + 1) : U, b = (U, O) => {
915
+ let W = "";
916
+ return O = O || ",", U.forEach(($) => {
917
+ $.ossId && (W += $.ossId + O);
918
+ }), W != "" ? W.substring(0, W.length - 1) : "";
919
+ };
920
+ return (U, O) => {
921
+ const W = De, $ = Re, d = Gl;
922
+ return s(), T("div", Fa, [
923
+ K($, {
924
+ multiple: "",
925
+ action: o(h),
926
+ "before-upload": j,
927
+ "file-list": o(i),
928
+ limit: e.limit,
929
+ "on-error": H,
930
+ "on-exceed": P,
931
+ "on-success": J,
932
+ "show-file-list": !1,
933
+ headers: o(V),
934
+ class: "upload-file-uploader",
935
+ ref_key: "fileUploadRef",
936
+ ref: C
937
+ }, {
938
+ default: v(() => [
939
+ K(W, { type: "primary" }, {
940
+ default: v(() => O[0] || (O[0] = [
941
+ z("选取文件")
942
+ ])),
943
+ _: 1
944
+ })
945
+ ]),
946
+ _: 1
947
+ }, 8, ["action", "file-list", "limit", "headers"]),
948
+ o(M) ? (s(), T("div", Na, [
949
+ O[3] || (O[3] = z(" 請上傳 ")),
950
+ e.fileSize ? (s(), T(Y, { key: 0 }, [
951
+ O[1] || (O[1] = z(" 大小不超過 ")),
952
+ re("b", Ka, R(e.fileSize) + "MB", 1)
953
+ ], 64)) : X("", !0),
954
+ e.fileType ? (s(), T(Y, { key: 1 }, [
955
+ O[2] || (O[2] = z(" 格式為 ")),
956
+ re("b", Wa, R(e.fileType.join("/")), 1)
957
+ ], 64)) : X("", !0),
958
+ O[4] || (O[4] = z(" 的文件 "))
959
+ ])) : X("", !0),
960
+ e.showFileList ? (s(), f(ta, {
961
+ key: 1,
962
+ class: "upload-file-list el-upload-list el-upload-list--text",
963
+ name: "el-fade-in-linear",
964
+ tag: "ul"
965
+ }, {
966
+ default: v(() => [
967
+ (s(!0), T(Y, null, Q(o(i), (D, A) => (s(), T("li", {
968
+ key: D.uid,
969
+ class: "el-upload-list__item ele-upload-list__item-content"
970
+ }, [
971
+ K(d, {
972
+ href: `${D.url}`,
973
+ underline: !1,
974
+ target: "_blank"
975
+ }, {
976
+ default: v(() => [
977
+ re("span", qa, R(E(D.name)), 1)
978
+ ]),
979
+ _: 2
980
+ }, 1032, ["href"]),
981
+ re("div", Qa, [
982
+ K(d, {
983
+ underline: !1,
984
+ onClick: (F) => ee(A),
985
+ type: "danger"
986
+ }, {
987
+ default: v(() => O[5] || (O[5] = [
988
+ z("删除")
989
+ ])),
990
+ _: 2
991
+ }, 1032, ["onClick"])
992
+ ])
993
+ ]))), 128))
994
+ ]),
995
+ _: 1
996
+ })) : X("", !0)
997
+ ]);
998
+ };
999
+ }
1000
+ }), Ul = /* @__PURE__ */ be(Ga, [["__scopeId", "data-v-027e6121"]]), Ja = {
1001
+ key: 0,
1002
+ class: "el-upload__tip"
1003
+ }, Xa = { style: { color: "#f56c6c" } }, Za = { style: { color: "#f56c6c" } }, et = { style: { color: "#f56c6c" } }, lt = ["src"], at = /* @__PURE__ */ fe({
1004
+ __name: "index",
1005
+ props: {
1006
+ modelValue: {
1007
+ type: [String, Object, Array],
1008
+ default: () => []
1009
+ },
1010
+ // 圖片數量限制
1011
+ limit: oe.number.def(5),
1012
+ // 大小限制(MB)
1013
+ fileSize: oe.number.def(5),
1014
+ // 文件類型, 例如['png', 'jpg', 'jpeg']
1015
+ fileType: oe.array.def(["png", "jpg", "jpeg"]),
1016
+ // 是否顯示提示
1017
+ isShowTip: {
1018
+ type: Boolean,
1019
+ default: !0
1020
+ },
1021
+ // 建議圖片尺寸,如 "200×200px"
1022
+ imageSize: oe.string.def(""),
1023
+ // 是否支援壓縮,預設否
1024
+ compressSupport: {
1025
+ type: Boolean,
1026
+ default: !1
1027
+ },
1028
+ // 壓縮目標大小,單位KB。預設300KB以上文件才壓縮,並壓縮至300KB以內
1029
+ compressTargetSize: oe.number.def(300),
1030
+ // 自訂高度
1031
+ height: oe.string.def("148px")
1032
+ },
1033
+ emits: ["update:modelValue"],
1034
+ setup(e, { emit: t }) {
1035
+ oa(($) => ({
1036
+ "9d14746a": a.height
1037
+ }));
1038
+ const a = e, { proxy: l } = ye(), c = t, n = I(0), p = I([]), y = I(""), h = I(!1), V = We(), i = I(V + "/resource/oss/upload"), M = I(Ke()), C = I([]), j = Z(() => a.isShowTip && (a.fileType || a.fileSize || a.imageSize)), P = I(), H = Z(() => a.fileType.map(($) => `.${$}`).join(","));
1039
+ _e(
1040
+ () => a.modelValue,
1041
+ async ($) => {
1042
+ if ($) {
1043
+ let d = [];
1044
+ Array.isArray($) ? d = $ : d = (await qe($)).data, C.value = d.map((D) => {
1045
+ let A;
1046
+ return typeof D == "string" ? A = { name: D, url: D } : A = { name: D.ossId, url: D.url, ossId: D.ossId }, A;
1047
+ });
1048
+ } else
1049
+ return C.value = [], [];
1050
+ },
1051
+ { deep: !0, immediate: !0 }
1052
+ );
1053
+ const J = ($) => {
1054
+ let d = !1;
1055
+ if (a.fileType.length) {
1056
+ let D = "";
1057
+ $.name.lastIndexOf(".") > -1 && (D = $.name.slice($.name.lastIndexOf(".") + 1)), d = a.fileType.some((A) => !!($.type.indexOf(A) > -1 || D && D.indexOf(A) > -1));
1058
+ } else
1059
+ d = $.type.indexOf("image") > -1;
1060
+ if (!d)
1061
+ return l == null || l.$modal.msgError(`文件格式不正確, 請上傳${a.fileType.join("/")}圖片格式文件!`), !1;
1062
+ if ($.name.includes(","))
1063
+ return l == null || l.$modal.msgError("文件名不正確,不能包含英文逗號!"), !1;
1064
+ if (a.fileSize && !($.size / 1024 / 1024 < a.fileSize))
1065
+ return l == null || l.$modal.msgError(`上傳圖片大小不能超過 ${a.fileSize} MB!`), !1;
1066
+ if (a.compressSupport && $.size / 1024 > a.compressTargetSize)
1067
+ return l == null || l.$modal.loading("正在上傳圖片,請稍候..."), n.value++, da($, a.compressTargetSize);
1068
+ l == null || l.$modal.loading("正在上傳圖片,請稍候..."), n.value++;
1069
+ }, ee = () => {
1070
+ l == null || l.$modal.msgError(`上傳文件數量不能超過 ${a.limit} 個!`);
1071
+ }, S = ($, d) => {
1072
+ var D;
1073
+ $.code === 200 ? (p.value.push({ name: $.data.fileName, url: $.data.url, ossId: $.data.ossId }), b()) : (n.value--, l == null || l.$modal.closeLoading(), l == null || l.$modal.msgError($.msg), (D = P.value) == null || D.handleRemove(d), b());
1074
+ }, E = ($) => {
1075
+ const d = C.value.map((D) => D.name).indexOf($.name);
1076
+ if (d > -1 && p.value.length === n.value) {
1077
+ const D = C.value[d].ossId;
1078
+ return $l(D), C.value.splice(d, 1), c("update:modelValue", W(C.value)), !1;
1079
+ }
1080
+ return !0;
1081
+ }, b = () => {
1082
+ n.value > 0 && p.value.length === n.value && (C.value = C.value.filter(($) => $.url !== void 0).concat(p.value), p.value = [], n.value = 0, c("update:modelValue", W(C.value)), l == null || l.$modal.closeLoading());
1083
+ }, U = () => {
1084
+ l == null || l.$modal.msgError("上傳圖片失敗"), l == null || l.$modal.closeLoading();
1085
+ }, O = ($) => {
1086
+ y.value = $.url, h.value = !0;
1087
+ }, W = ($, d) => {
1088
+ let D = "";
1089
+ d = d || ",";
1090
+ for (const A in $)
1091
+ $[A].ossId !== void 0 && $[A].url.indexOf("blob:") !== 0 && (D += $[A].ossId + d);
1092
+ return D != "" ? D.substring(0, D.length - 1) : "";
1093
+ };
1094
+ return ($, d) => {
1095
+ const D = ra("plus"), A = xe, F = Re, G = cl;
1096
+ return s(), T("div", null, [
1097
+ K(F, {
1098
+ ref_key: "imageUploadRef",
1099
+ ref: P,
1100
+ multiple: "",
1101
+ action: o(i),
1102
+ "list-type": "picture-card",
1103
+ "on-success": S,
1104
+ "before-upload": J,
1105
+ limit: e.limit,
1106
+ accept: o(H),
1107
+ "on-error": U,
1108
+ "on-exceed": ee,
1109
+ "before-remove": E,
1110
+ "show-file-list": !0,
1111
+ headers: o(M),
1112
+ "file-list": o(C),
1113
+ "on-preview": O,
1114
+ class: je({ hide: o(C).length >= e.limit })
1115
+ }, {
1116
+ default: v(() => [
1117
+ K(A, { class: "avatar-uploader-icon" }, {
1118
+ default: v(() => [
1119
+ K(D)
1120
+ ]),
1121
+ _: 1
1122
+ })
1123
+ ]),
1124
+ _: 1
1125
+ }, 8, ["action", "limit", "accept", "headers", "file-list", "class"]),
1126
+ o(j) ? (s(), T("div", Ja, [
1127
+ d[4] || (d[4] = z(" 請上傳 ")),
1128
+ e.fileSize ? (s(), T(Y, { key: 0 }, [
1129
+ d[1] || (d[1] = z(" 大小不超過 ")),
1130
+ re("b", Xa, R(e.fileSize) + "MB", 1)
1131
+ ], 64)) : X("", !0),
1132
+ e.fileType ? (s(), T(Y, { key: 1 }, [
1133
+ e.fileSize ? (s(), T(Y, { key: 0 }, [
1134
+ z("、")
1135
+ ], 64)) : X("", !0),
1136
+ d[2] || (d[2] = z("格式為 ")),
1137
+ re("b", Za, R(e.fileType.join("/")), 1)
1138
+ ], 64)) : X("", !0),
1139
+ e.imageSize ? (s(), T(Y, { key: 2 }, [
1140
+ e.fileSize || e.fileType ? (s(), T(Y, { key: 0 }, [
1141
+ z("。")
1142
+ ], 64)) : X("", !0),
1143
+ d[3] || (d[3] = z("建議尺寸 ")),
1144
+ re("b", et, R(e.imageSize), 1)
1145
+ ], 64)) : X("", !0),
1146
+ d[5] || (d[5] = z(" 的文件 "))
1147
+ ])) : X("", !0),
1148
+ K(G, {
1149
+ modelValue: o(h),
1150
+ "onUpdate:modelValue": d[0] || (d[0] = (se) => Se(h) ? h.value = se : null),
1151
+ title: "預覽",
1152
+ width: "800px",
1153
+ "append-to-body": ""
1154
+ }, {
1155
+ default: v(() => [
1156
+ re("img", {
1157
+ src: o(y),
1158
+ style: { display: "block", "max-width": "100%", margin: "0 auto" }
1159
+ }, null, 8, lt)
1160
+ ]),
1161
+ _: 1
1162
+ }, 8, ["modelValue"])
1163
+ ]);
1164
+ };
1165
+ }
1166
+ }), Al = /* @__PURE__ */ be(at, [["__scopeId", "data-v-c17cf859"]]), tt = (e) => ke()({
1167
+ url: "/app/translation/getByName",
1168
+ method: "post",
1169
+ headers: {
1170
+ repeatSubmit: !1
1171
+ },
1172
+ data: { name: e }
1173
+ }), ot = (e) => ke()({
1174
+ url: "/app/translation/batchAdd",
1175
+ method: "post",
1176
+ data: e
1177
+ }), ll = kl("translation", () => {
1178
+ const e = I([]);
1179
+ return {
1180
+ translation: e,
1181
+ getTranslation: (c) => {
1182
+ if (c == null && c == "")
1183
+ return null;
1184
+ try {
1185
+ for (let n = 0; n < e.value.length; n++)
1186
+ if (e.value[n].key == c)
1187
+ return e.value[n].value;
1188
+ } catch {
1189
+ return null;
1190
+ }
1191
+ return null;
1192
+ },
1193
+ setTranslation: (c, n) => {
1194
+ c !== null && c !== "" && e.value.push({
1195
+ key: c,
1196
+ value: n
1197
+ });
1198
+ },
1199
+ clearTranslation: () => {
1200
+ e.value = [];
1201
+ }
1202
+ };
1203
+ }), rt = async (e) => {
1204
+ const t = I({}), a = ll().getTranslation(e);
1205
+ if (a)
1206
+ t.value[e] = a;
1207
+ else {
1208
+ const { data: l } = await tt(e);
1209
+ t.value[e] = l, ll().setTranslation(e, l);
1210
+ }
1211
+ return t.value;
1212
+ }, nt = { style: { width: "100%" } }, st = { style: { "margin-bottom": "2px" } }, Ol = /* @__PURE__ */ fe({
1213
+ __name: "index",
1214
+ props: ["modelValue", "placeholder", "disabled", "type", "rows", "showWordLimit", "maxlength"],
1215
+ emits: ["update:modelValue", "focus"],
1216
+ setup(e, { expose: t, emit: a }) {
1217
+ const l = a, c = e, n = I([{ name: "繁體", id: "zhHk", selected: !0, text: "" }, { name: "簡體", id: "zhCn", selected: !1, text: "" }, { name: "英文", id: "enUs", selected: !1, text: "" }]), p = I(!1), y = I(!1), h = (P, H) => {
1218
+ P.text = H, P.id == "zhHk" && l("update:modelValue", H);
1219
+ }, V = async (P) => {
1220
+ P.id == "zhHk" && await i();
1221
+ }, i = async () => {
1222
+ if (p.value) return;
1223
+ const P = n.value[0].text;
1224
+ if (P != "") {
1225
+ p.value = !0;
1226
+ const H = await rt(P);
1227
+ if (p.value = !1, H[P] != null) {
1228
+ for (let J = 0; J < n.value.length; J++)
1229
+ if (!n.value[J].text) {
1230
+ const ee = n.value[J];
1231
+ ee.text = H[P][ee.id];
1232
+ }
1233
+ }
1234
+ }
1235
+ }, M = async (P) => {
1236
+ n.value.map((H) => H.selected = !1), P.selected = !0;
1237
+ }, C = () => {
1238
+ const P = { name: n.value[0].text };
1239
+ return n.value.forEach((H) => P[H.id] = H.text), P;
1240
+ }, j = () => l("focus");
1241
+ return _e(() => c.modelValue, (P) => {
1242
+ if (P) {
1243
+ const H = n.value.filter((J) => J.selected)[0];
1244
+ H.text = P, y.value || i(), y.value = !0;
1245
+ }
1246
+ }, {
1247
+ immediate: !0,
1248
+ deep: !0
1249
+ }), t({ getTranslate: C }), (P, H) => {
1250
+ const J = De, ee = Me;
1251
+ return s(), T("div", nt, [
1252
+ re("div", st, [
1253
+ (s(!0), T(Y, null, Q(o(n), (S) => (s(), f(J, {
1254
+ size: "small",
1255
+ key: S.id,
1256
+ type: S.selected ? "primary" : "default",
1257
+ onClick: (E) => M(S),
1258
+ style: { "margin-right": "-8px" }
1259
+ }, {
1260
+ default: v(() => [
1261
+ z(R(S.name), 1)
1262
+ ]),
1263
+ _: 2
1264
+ }, 1032, ["type", "onClick"]))), 128))
1265
+ ]),
1266
+ (s(!0), T(Y, null, Q(o(n), (S) => ie((s(), f(ee, {
1267
+ key: S.id,
1268
+ modelValue: S.text,
1269
+ "onUpdate:modelValue": (E) => S.text = E,
1270
+ type: c.type,
1271
+ placeholder: c.placeholder + "(" + S.name + ")",
1272
+ disabled: c.disabled,
1273
+ rows: c.rows,
1274
+ "show-word-limit": c.showWordLimit,
1275
+ maxlength: c.maxlength,
1276
+ onInput: (E) => h(S, E),
1277
+ onBlur: (E) => V(S),
1278
+ onFocus: H[0] || (H[0] = (E) => j())
1279
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "disabled", "rows", "show-word-limit", "maxlength", "onInput", "onBlur"])), [
1280
+ [na, S.selected]
1281
+ ])), 128))
1282
+ ]);
1283
+ };
1284
+ }
1285
+ }), ct = { class: "editor" }, Pl = /* @__PURE__ */ fe({
1286
+ __name: "index",
1287
+ props: {
1288
+ /* 编辑器的内容 */
1289
+ modelValue: oe.string,
1290
+ /* 高度 */
1291
+ height: oe.number.def(400),
1292
+ /* 最小高度 */
1293
+ minHeight: oe.number.def(400),
1294
+ /* 只读 */
1295
+ readOnly: oe.bool.def(!1),
1296
+ /* 上传文件大小限制(MB) */
1297
+ fileSize: oe.number.def(5),
1298
+ /* 类型(base64格式、url格式) */
1299
+ type: oe.string.def("url")
1300
+ },
1301
+ emits: ["update:modelValue"],
1302
+ setup(e) {
1303
+ const t = e, { proxy: a } = ye(), l = sa({
1304
+ headers: Ke(),
1305
+ url: We() + "/resource/oss/upload"
1306
+ }), c = I(), n = I(), p = I({
1307
+ theme: "snow",
1308
+ bounds: document.body,
1309
+ debug: "warn",
1310
+ modules: {
1311
+ // 工具栏配置
1312
+ toolbar: {
1313
+ container: [
1314
+ ["bold", "italic", "underline", "strike"],
1315
+ // 加粗 斜体 下划线 删除线
1316
+ ["blockquote", "code-block"],
1317
+ // 引用 代码块
1318
+ [{ list: "ordered" }, { list: "bullet" }],
1319
+ // 有序、无序列表
1320
+ [{ indent: "-1" }, { indent: "+1" }],
1321
+ // 缩进
1322
+ [{ size: ["small", !1, "large", "huge"] }],
1323
+ // 字体大小
1324
+ [{ header: [1, 2, 3, 4, 5, 6, !1] }],
1325
+ // 标题
1326
+ [{ color: [] }, { background: [] }],
1327
+ // 字体颜色、字体背景颜色
1328
+ [{ align: [] }],
1329
+ // 对齐方式
1330
+ ["clean"],
1331
+ // 清除文本格式
1332
+ ["link", "image", "video"]
1333
+ // 链接、图片、视频
1334
+ ],
1335
+ handlers: {
1336
+ image: (C) => {
1337
+ C ? n.value.click() : ia.format("image", !0);
1338
+ }
1339
+ }
1340
+ }
1341
+ },
1342
+ placeholder: "请输入内容",
1343
+ readOnly: t.readOnly
1344
+ }), y = Z(() => {
1345
+ const C = {};
1346
+ return t.minHeight && (C.minHeight = `${t.minHeight}px`), t.height && (C.height = `${t.height}px`), C;
1347
+ }), h = I("");
1348
+ _e(
1349
+ () => t.modelValue,
1350
+ (C) => {
1351
+ C !== h.value && (h.value = C || "<p></p>");
1352
+ },
1353
+ { immediate: !0 }
1354
+ );
1355
+ const V = (C) => {
1356
+ if (C.code === 200) {
1357
+ const j = Oe(c.value).getQuill(), P = j.selection.savedRange.index;
1358
+ j.insertEmbed(P, "image", C.data.url), j.setSelection(P + 1), a == null || a.$modal.closeLoading();
1359
+ } else
1360
+ a == null || a.$modal.msgError("图片插入失败"), a == null || a.$modal.closeLoading();
1361
+ }, i = (C) => ["image/jpeg", "image/jpg", "image/png", "image/svg"].includes(C.type) ? t.fileSize && !(C.size / 1024 / 1024 < t.fileSize) ? (a == null || a.$modal.msgError(`上传文件大小不能超过 ${t.fileSize} MB!`), !1) : (a == null || a.$modal.loading("正在上传文件,请稍候..."), !0) : (a == null || a.$modal.msgError("图片格式错误!"), !1), M = (C) => {
1362
+ a == null || a.$modal.msgError("上传文件失败");
1363
+ };
1364
+ return (C, j) => {
1365
+ const P = Re;
1366
+ return s(), T(Y, null, [
1367
+ re("div", null, [
1368
+ e.type === "url" ? (s(), f(P, {
1369
+ key: 0,
1370
+ action: o(l).url,
1371
+ "before-upload": i,
1372
+ "on-success": V,
1373
+ "on-error": M,
1374
+ class: "editor-img-uploader",
1375
+ name: "file",
1376
+ "show-file-list": !1,
1377
+ headers: o(l).headers
1378
+ }, {
1379
+ default: v(() => [
1380
+ re("i", {
1381
+ ref_key: "uploadRef",
1382
+ ref: n
1383
+ }, null, 512)
1384
+ ]),
1385
+ _: 1
1386
+ }, 8, ["action", "headers"])) : X("", !0)
1387
+ ]),
1388
+ re("div", ct, [
1389
+ K(o(pa), {
1390
+ ref_key: "quillEditorRef",
1391
+ ref: c,
1392
+ content: o(h),
1393
+ "onUpdate:content": j[0] || (j[0] = (H) => Se(h) ? h.value = H : null),
1394
+ "content-type": "html",
1395
+ options: o(p),
1396
+ style: he(o(y)),
1397
+ onTextChange: j[1] || (j[1] = (H) => C.$emit("update:modelValue", o(h)))
1398
+ }, null, 8, ["content", "options", "style"])
1399
+ ])
1400
+ ], 64);
1401
+ };
1402
+ }
1403
+ });
1404
+ function ut(e, t) {
1405
+ if (arguments.length === 0 || !e)
1406
+ return null;
1407
+ const a = t || "{y}-{m}-{d} {h}:{i}:{s}";
1408
+ let l;
1409
+ typeof e == "object" ? l = e : (typeof e == "string" && /^[0-9]+$/.test(e) ? e = parseInt(e) : typeof e == "string" && (e = e.replace(new RegExp(/-/gm), "/").replace("T", " ").replace(new RegExp(/\.[\d]{3}/gm), "")), typeof e == "number" && e.toString().length === 10 && (e = e * 1e3), l = new Date(e));
1410
+ const c = {
1411
+ y: l.getFullYear(),
1412
+ m: l.getMonth() + 1,
1413
+ d: l.getDate(),
1414
+ h: l.getHours(),
1415
+ i: l.getMinutes(),
1416
+ s: l.getSeconds(),
1417
+ a: l.getDay()
1418
+ };
1419
+ return a.replace(/{(y|m|d|h|i|s|a)+}/g, (n, p) => {
1420
+ let y = c[p];
1421
+ return p === "a" ? ["日", "一", "二", "三", "四", "五", "六"][y] : (n.length > 0 && y < 10 && (y = "0" + y), y || 0);
1422
+ });
1423
+ }
1424
+ const dt = (e, t, a) => {
1425
+ const l = e;
1426
+ return l.params = typeof l.params == "object" && l.params !== null && !Array.isArray(l.params) ? l.params : {}, t = Array.isArray(t) ? t : [], t[0] && t[0].length == 10 && (t[0] = t[0] + " 00:00:00", t[1] = t[1] + " 23:59:59"), typeof a > "u" ? (l.params.beginTime = t[0], l.params.endTime = t[1]) : (a = a.charAt(0).toUpperCase() + a.slice(1), l.params["begin" + a] = t[0], l.params["end" + a] = t[1]), l;
1427
+ }, it = (e, t) => {
1428
+ if (t === void 0)
1429
+ return "";
1430
+ const a = [];
1431
+ return Object.keys(e).some((l) => {
1432
+ if (e[l].value == "" + t)
1433
+ return a.push(e[l].label), !0;
1434
+ }), a.length === 0 && a.push(t), a.join("");
1435
+ }, pt = (e, t, a) => {
1436
+ if (t === void 0 || t.length === 0)
1437
+ return "";
1438
+ Array.isArray(t) && (t = t.join(","));
1439
+ const l = [], c = a === void 0 ? "," : a, n = t.split(c);
1440
+ return Object.keys(t.split(c)).some((p) => {
1441
+ let y = !1;
1442
+ Object.keys(e).some((h) => {
1443
+ e[h].value == "" + n[p] && (l.push(e[h].label + c), y = !0);
1444
+ }), y || l.push(n[p] + c);
1445
+ }), l.join("").substring(0, l.join("").length - 1);
1446
+ }, ft = (e, t, a, l) => {
1447
+ const c = {
1448
+ id: t || "id",
1449
+ parentId: a || "parentId",
1450
+ childrenList: l || "children"
1451
+ }, n = {}, p = [];
1452
+ for (const y of e) {
1453
+ const h = y[c.id];
1454
+ n[h] = y, y[c.childrenList] || (y[c.childrenList] = []);
1455
+ }
1456
+ for (const y of e) {
1457
+ const h = y[c.parentId], V = n[h];
1458
+ V ? V[c.childrenList].push(y) : p.push(y);
1459
+ }
1460
+ return p;
1461
+ }, ht = (e) => {
1462
+ let t = "";
1463
+ for (const a of Object.keys(e)) {
1464
+ const l = e[a], c = encodeURIComponent(a) + "=";
1465
+ if (l !== null && l !== "" && typeof l < "u")
1466
+ if (typeof l == "object") {
1467
+ for (const n of Object.keys(l))
1468
+ if (l[n] !== null && l[n] !== "" && typeof l[n] < "u") {
1469
+ const p = a + "[" + n + "]", y = encodeURIComponent(p) + "=";
1470
+ t += y + encodeURIComponent(l[n]) + "&";
1471
+ }
1472
+ } else
1473
+ t += c + encodeURIComponent(l) + "&";
1474
+ }
1475
+ return t;
1476
+ }, mt = (e) => e.type !== "application/json", Il = (e) => {
1477
+ if (!e && typeof e != "object")
1478
+ throw new Error("error arguments", "deepClone");
1479
+ const t = e.constructor === Array ? [] : {};
1480
+ return Object.keys(e).forEach((a) => {
1481
+ e[a] && typeof e[a] == "object" ? t[a] = Il(e[a]) : t[a] = e[a];
1482
+ }), t;
1483
+ };
1484
+ function yt(e, t) {
1485
+ const { proxy: a } = ye(), l = I({}), c = async (h) => {
1486
+ const V = h.form;
1487
+ if (!V) return "";
1488
+ switch (V.type) {
1489
+ case "checkboxGroup":
1490
+ case "checkboxDict":
1491
+ return [];
1492
+ case "treeSelectApi":
1493
+ if (V.api) {
1494
+ const i = await V.api({ pageNum: 1, pageSize: 1e3, ...V.apiParams });
1495
+ if (V.data = i.rows || i.data, V.data && Array.isArray(V.data) && !Array.isArray(V.defaultExpandedKeys) && V.autoExpandFirstLevel !== !1) {
1496
+ const M = V.props || { value: "id" }, C = V.valueKey || M.value || "id";
1497
+ V.defaultExpandedKeys = V.data.map((j) => j[C]);
1498
+ }
1499
+ }
1500
+ return "";
1501
+ case "radioApi":
1502
+ case "selectApi":
1503
+ if (V.api) {
1504
+ const i = await V.api({ pageNum: 1, pageSize: 1e3, ...V.apiParams });
1505
+ V.data = i.rows || i.data;
1506
+ }
1507
+ return "";
1508
+ case "checkboxCommonDict":
1509
+ return V.data = await (a == null ? void 0 : a.useOneCommonDict(V.dictType)), [];
1510
+ case "radioCommonDict":
1511
+ case "selectCommonDict":
1512
+ return V.data = await (a == null ? void 0 : a.useOneCommonDict(V.dictType)), "";
1513
+ case "radioDict":
1514
+ case "selectDict":
1515
+ return V.data = await (a == null ? void 0 : a.useOneDict(V.dictType)), "";
1516
+ case "daterange":
1517
+ case "timerange":
1518
+ return [];
1519
+ default:
1520
+ return "";
1521
+ }
1522
+ }, n = async (h) => {
1523
+ var C;
1524
+ let V = {};
1525
+ const i = e.columns, M = h !== void 0 ? h : t;
1526
+ for (const j of i) {
1527
+ const P = ((C = j.form) == null ? void 0 : C.prop) || j.prop;
1528
+ V[P] = await c(j);
1529
+ }
1530
+ if (M && typeof M == "object") {
1531
+ const j = Il(M);
1532
+ V = { ...V, ...j };
1533
+ }
1534
+ e.initEditData && e.initEditData(V), e.beforeInitEdit && e.beforeInitEdit(V), p(V), l.value = V;
1535
+ }, p = (h) => {
1536
+ e.columns.forEach((i) => {
1537
+ var j, P, H, J, ee;
1538
+ const M = (j = i.form) == null ? void 0 : j.type, C = ((P = i.form) == null ? void 0 : P.prop) || i.prop;
1539
+ switch (M) {
1540
+ case "checkboxCommonDict":
1541
+ Array.isArray(h[C]) && (h[C] = h[C].map((b) => b[i.form.value] || b));
1542
+ break;
1543
+ case "selectDict":
1544
+ case "radioDict":
1545
+ case "switch":
1546
+ h[C] = h[C] || ((H = i.form) == null ? void 0 : H.defaultValue);
1547
+ break;
1548
+ case "daterange":
1549
+ case "timerange":
1550
+ const S = (J = i.form) == null ? void 0 : J.rangeBeginProp, E = (ee = i.form) == null ? void 0 : ee.rangeEndProp;
1551
+ S && E && h[S] && h[E] ? h[C] = [h[S], h[E]] : typeof h[C] == "string" && h[C].includes(",") ? h[C] = h[C].split(",") : (!h[C] || !Array.isArray(h[C])) && (h[C] = h[C] || []);
1552
+ break;
1553
+ }
1554
+ });
1555
+ };
1556
+ return {
1557
+ formData: l,
1558
+ initFormData: n,
1559
+ prepareSaveData: async (h) => {
1560
+ const V = { ...l.value, ...h };
1561
+ if (e.columns.forEach((i) => {
1562
+ var j, P, H, J;
1563
+ const M = (j = i.form) == null ? void 0 : j.type, C = ((P = i.form) == null ? void 0 : P.prop) || i.prop;
1564
+ if ((M === "daterange" || M === "timerange") && Array.isArray(V[C])) {
1565
+ const ee = V[C], S = (H = i.form) == null ? void 0 : H.rangeBeginProp, E = (J = i.form) == null ? void 0 : J.rangeEndProp;
1566
+ S && E && ee.length >= 2 && (V[S] = ee[0], V[E] = ee[1]);
1567
+ }
1568
+ }), delete V.orderByColumn, delete V.isAsc, e.beforeSave) {
1569
+ const i = await e.beforeSave(V);
1570
+ if (i === !1) return !1;
1571
+ i && typeof i == "object" ? Object.assign(h, i) : Object.assign(h, V);
1572
+ } else
1573
+ Object.assign(h, V);
1574
+ return !0;
1575
+ }
1576
+ };
1577
+ }
1578
+ const gt = { key: 20 }, bt = { class: "color-picker-tips" }, vt = /* @__PURE__ */ fe({
1579
+ __name: "curdEdit",
1580
+ props: {
1581
+ dataSource: {},
1582
+ editData: {},
1583
+ action: {},
1584
+ modelValue: { type: Boolean }
1585
+ },
1586
+ emits: ["close", "actionEvent"],
1587
+ setup(e, { emit: t }) {
1588
+ const { t: a } = wl(), { proxy: l } = ye(), c = e, n = I(!1), p = I(), y = t, h = I(), V = I(Cl), { formData: i, initFormData: M, prepareSaveData: C } = yt(
1589
+ c.dataSource,
1590
+ c.editData
1591
+ ), j = Z(() => {
1592
+ const U = !!c.editData[c.dataSource.rowKey], O = Ia(c.dataSource.columns, U, U);
1593
+ return Tl(O, "form.order");
1594
+ }), P = Z(() => c.dataSource.formInline || !1), H = (b) => {
1595
+ if (Array.isArray(b.defaultExpandedKeys))
1596
+ return b.defaultExpandedKeys;
1597
+ if (b.autoExpandFirstLevel === !1)
1598
+ return [];
1599
+ const U = b.data || [], O = b.props || { value: "id" }, W = b.valueKey || O.value || "id";
1600
+ return Array.isArray(U) ? U.map(($) => $[W]).filter(($) => $ !== void 0) : [];
1601
+ }, J = () => Pa(c.dataSource.columns), ee = () => {
1602
+ var b;
1603
+ (b = h.value) == null || b.validate(async (U) => {
1604
+ var O, W, $, d, D;
1605
+ if (!U) return !1;
1606
+ try {
1607
+ const A = { ...c.dataSource.queryParams || {} };
1608
+ if (await C(A) === !1) return !1;
1609
+ c.editData[c.dataSource.rowKey] ? await ((W = (O = c.dataSource).updateApi) == null ? void 0 : W.call(O, A)) : await ((d = ($ = c.dataSource).addApi) == null ? void 0 : d.call($, A)), await S(), E(!0), l == null || l.$modal.msgSuccess(a("數據存儲成功")), (D = h.value) == null || D.resetFields();
1610
+ } catch (A) {
1611
+ console.error("Save failed:", A);
1612
+ }
1613
+ return !1;
1614
+ });
1615
+ }, S = async () => {
1616
+ const b = p.value;
1617
+ if (b != null) {
1618
+ const U = [];
1619
+ for (let O = 0; O < b.length; O++) {
1620
+ const W = b[O].getTranslate();
1621
+ U.push(W);
1622
+ }
1623
+ await ot(U);
1624
+ }
1625
+ }, E = (b = !1) => {
1626
+ var U;
1627
+ (U = h.value) == null || U.resetFields(), y("close", b);
1628
+ };
1629
+ return _e(() => c.modelValue, (b) => {
1630
+ b && (J(), M(c.editData)), n.value = b;
1631
+ }), (b, U) => {
1632
+ const O = Jl, W = hl, $ = fl, d = ml, D = Al, A = Ul, F = Me, G = nl, se = Xl, w = sl, L = ea, q = Zl, B = yl, ne = la, ue = pl, me = il, ce = dl, pe = ul, u = De, m = cl;
1633
+ return s(), f(m, {
1634
+ title: c.action.title || c.action.text,
1635
+ modelValue: o(n),
1636
+ "onUpdate:modelValue": U[1] || (U[1] = (r) => Se(n) ? n.value = r : null),
1637
+ onClose: E,
1638
+ "destroy-on-close": "",
1639
+ "append-to-bod": "",
1640
+ width: c.action.width || (o(P) ? 750 : 550),
1641
+ class: "curdEditDialog"
1642
+ }, {
1643
+ footer: v(() => [
1644
+ re("div", null, [
1645
+ K(u, {
1646
+ onClick: U[0] || (U[0] = (r) => E(!1))
1647
+ }, {
1648
+ default: v(() => [
1649
+ z(R(b.$t("關閉")), 1)
1650
+ ]),
1651
+ _: 1
1652
+ }),
1653
+ K(u, {
1654
+ type: "primary",
1655
+ onClick: ee
1656
+ }, {
1657
+ default: v(() => [
1658
+ z(R(b.$t("存儲")), 1)
1659
+ ]),
1660
+ _: 1
1661
+ })
1662
+ ])
1663
+ ]),
1664
+ default: v(() => [
1665
+ K(pe, {
1666
+ model: o(i),
1667
+ ref_key: "curdFormRef",
1668
+ ref: h,
1669
+ "label-width": c.action.labelWidth || c.dataSource.formLabelWidth || "auto",
1670
+ "label-position": c.action.labelPosition || "right",
1671
+ class: "p-l-3 p-r-3"
1672
+ }, {
1673
+ default: v(() => [
1674
+ K(ce, { gutter: 20 }, {
1675
+ default: v(() => [
1676
+ (s(!0), T(Y, null, Q(o(j), (r) => (s(), f(me, {
1677
+ span: r.form.inline === !1 ? 24 : o(P) ? 12 : 24,
1678
+ key: r.prop,
1679
+ class: "el-p"
1680
+ }, {
1681
+ default: v(() => [
1682
+ K(ue, {
1683
+ prop: r.form.prop || r.prop,
1684
+ label: b.$t(r.label),
1685
+ name: r.form.prop || r.prop,
1686
+ rules: r.form.rules,
1687
+ required: r.form.required
1688
+ }, {
1689
+ default: v(() => [
1690
+ r.form.type === "number" ? (s(), f(O, {
1691
+ key: 0,
1692
+ modelValue: o(i)[r.form.prop || r.prop],
1693
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1694
+ style: { width: "100%" },
1695
+ min: r.form.min,
1696
+ max: r.form.max,
1697
+ placeholder: b.$t("請輸入") + b.$t(r.label)
1698
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "max", "placeholder"])) : r.form.type === "select" ? (s(), f($, {
1699
+ key: 1,
1700
+ multiple: r.form.multiple,
1701
+ style: { width: "100%" },
1702
+ modelValue: o(i)[r.form.prop || r.prop],
1703
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1704
+ placeholder: b.$t("請選擇") + b.$t(r.label),
1705
+ filterable: r.form.filterable ?? !0
1706
+ }, {
1707
+ default: v(() => [
1708
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(W, {
1709
+ key: g[r.form.value] || g.value,
1710
+ label: g[r.form.label] || g.label,
1711
+ value: g[r.form.value] || g.value
1712
+ }, null, 8, ["label", "value"]))), 128))
1713
+ ]),
1714
+ _: 2
1715
+ }, 1032, ["multiple", "modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : r.form.type === "selectDict" ? (s(), f($, {
1716
+ key: 2,
1717
+ multiple: r.form.multiple,
1718
+ style: { width: "100%" },
1719
+ modelValue: o(i)[r.form.prop || r.prop],
1720
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1721
+ placeholder: b.$t("請選擇") + b.$t(r.label),
1722
+ filterable: r.form.filterable ?? !0
1723
+ }, {
1724
+ default: v(() => [
1725
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(W, {
1726
+ key: g[r.form.value] || g.value,
1727
+ label: g[r.form.label] || g.label,
1728
+ value: g[r.form.value] || g.value
1729
+ }, null, 8, ["label", "value"]))), 128))
1730
+ ]),
1731
+ _: 2
1732
+ }, 1032, ["multiple", "modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : r.form.type === "selectCommonDict" ? (s(), f($, {
1733
+ key: 3,
1734
+ multiple: r.form.multiple,
1735
+ style: { width: "100%" },
1736
+ modelValue: o(i)[r.form.prop || r.prop],
1737
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1738
+ placeholder: b.$t("請選擇") + b.$t(r.label),
1739
+ filterable: r.form.filterable ?? !0
1740
+ }, {
1741
+ default: v(() => [
1742
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(W, {
1743
+ key: g.value,
1744
+ label: g.label,
1745
+ value: g.value
1746
+ }, null, 8, ["label", "value"]))), 128))
1747
+ ]),
1748
+ _: 2
1749
+ }, 1032, ["multiple", "modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : r.form.type === "selectApi" ? (s(), f($, {
1750
+ key: 4,
1751
+ multiple: r.form.multiple,
1752
+ style: { width: "100%" },
1753
+ modelValue: o(i)[r.form.prop || r.prop],
1754
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1755
+ placeholder: b.$t("請選擇") + b.$t(r.label),
1756
+ filterable: r.form.filterable ?? !0
1757
+ }, {
1758
+ default: v(() => [
1759
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(W, {
1760
+ key: g[r.form.value],
1761
+ label: g[r.form.label],
1762
+ value: g[r.form.value]
1763
+ }, null, 8, ["label", "value"]))), 128))
1764
+ ]),
1765
+ _: 2
1766
+ }, 1032, ["multiple", "modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : r.form.type === "date" ? (s(), f(d, {
1767
+ key: 5,
1768
+ format: "YYYY-MM-DD",
1769
+ "value-format": "YYYY-MM-DD",
1770
+ modelValue: o(i)[r.form.prop || r.prop],
1771
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1772
+ type: "date",
1773
+ placeholder: b.$t("請選擇日期"),
1774
+ style: { width: "100%" }
1775
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : r.form.type === "datetime" ? (s(), f(d, {
1776
+ key: 6,
1777
+ format: "YYYY-MM-DD HH:mm:ss",
1778
+ "value-format": "YYYY-MM-DD HH:mm:ss",
1779
+ modelValue: o(i)[r.form.prop || r.prop],
1780
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1781
+ type: "datetime",
1782
+ placeholder: b.$t("請選擇日期時間"),
1783
+ style: { width: "100%" }
1784
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : r.form.type === "daterange" ? (s(), f(d, {
1785
+ key: 7,
1786
+ modelValue: o(i)[r.form.prop || r.prop],
1787
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1788
+ type: "daterange",
1789
+ format: "YYYY-MM-DD",
1790
+ "value-format": "YYYY-MM-DD",
1791
+ "range-separator": b.$t("至"),
1792
+ "start-placeholder": b.$t("開始日期"),
1793
+ "end-placeholder": b.$t("結束日期"),
1794
+ style: { width: "100%" }
1795
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : r.form.type === "timerange" ? (s(), f(d, {
1796
+ key: 8,
1797
+ modelValue: o(i)[r.form.prop || r.prop],
1798
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1799
+ type: "datetimerange",
1800
+ format: "YYYY-MM-DD HH:mm",
1801
+ "value-format": "YYYY-MM-DD HH:mm:ss",
1802
+ "range-separator": b.$t("至"),
1803
+ "start-placeholder": b.$t("開始時間"),
1804
+ "end-placeholder": b.$t("結束時間"),
1805
+ style: { width: "100%" }
1806
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : r.form.type === "image" ? (s(), f(D, {
1807
+ key: 9,
1808
+ limit: r.form.limit || 1,
1809
+ modelValue: o(i)[r.form.prop || r.prop],
1810
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1811
+ }, null, 8, ["limit", "modelValue", "onUpdate:modelValue"])) : r.form.type === "file" ? (s(), f(A, {
1812
+ key: 10,
1813
+ limit: r.form.limit || 1,
1814
+ modelValue: o(i)[r.form.prop || r.prop],
1815
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1816
+ fileType: r.form.fileType,
1817
+ fileSize: r.form.fileSize
1818
+ }, null, 8, ["limit", "modelValue", "onUpdate:modelValue", "fileType", "fileSize"])) : r.form.type === "password" ? (s(), f(F, {
1819
+ key: 11,
1820
+ "auto-complete": "new-password",
1821
+ modelValue: o(i)[r.form.prop || r.prop],
1822
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1823
+ type: "password",
1824
+ placeholder: b.$t("請輸入") + b.$t(r.label)
1825
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : r.form.type === "checkboxGroup" ? (s(), f(se, {
1826
+ key: 12,
1827
+ class: "checkbox-group",
1828
+ modelValue: o(i)[r.form.prop || r.prop],
1829
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1830
+ }, {
1831
+ default: v(() => [
1832
+ (s(!0), T(Y, null, Q(r.form.list, (g) => (s(), f(G, {
1833
+ key: g[r.form.value],
1834
+ label: g[r.form.label],
1835
+ value: g[r.form.value]
1836
+ }, null, 8, ["label", "value"]))), 128))
1837
+ ]),
1838
+ _: 2
1839
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : r.form.type === "checkboxCommonDict" ? (s(), f(se, {
1840
+ key: 13,
1841
+ class: "checkbox-group",
1842
+ modelValue: o(i)[r.form.prop || r.prop],
1843
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1844
+ }, {
1845
+ default: v(() => [
1846
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(G, {
1847
+ label: g.value,
1848
+ key: g.value,
1849
+ value: g.value
1850
+ }, {
1851
+ default: v(() => [
1852
+ z(R(g.label), 1)
1853
+ ]),
1854
+ _: 2
1855
+ }, 1032, ["label", "value"]))), 128))
1856
+ ]),
1857
+ _: 2
1858
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : r.form.type === "switch" ? (s(), f(w, {
1859
+ key: 14,
1860
+ modelValue: o(i)[r.form.prop || r.prop],
1861
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1862
+ "active-value": r.form.activeValue || "0",
1863
+ "inactive-value": r.form.inactiveValue || "1"
1864
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "active-value", "inactive-value"])) : r.form.type === "radioDict" ? (s(), f(q, {
1865
+ key: 15,
1866
+ modelValue: o(i)[r.form.prop || r.prop],
1867
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1868
+ }, {
1869
+ default: v(() => [
1870
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(L, {
1871
+ key: g.value,
1872
+ value: g.value
1873
+ }, {
1874
+ default: v(() => [
1875
+ z(R(g.label), 1)
1876
+ ]),
1877
+ _: 2
1878
+ }, 1032, ["value"]))), 128))
1879
+ ]),
1880
+ _: 2
1881
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : r.form.type === "treeSelectApi" ? (s(), f(B, {
1882
+ key: 16,
1883
+ modelValue: o(i)[r.form.prop || r.prop],
1884
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1885
+ data: r.form.data,
1886
+ props: r.form.props,
1887
+ "value-key": r.form.valueKey,
1888
+ "default-expanded-keys": H(r.form),
1889
+ filterable: r.form.filterable ?? !0,
1890
+ placeholder: b.$t("請選擇") + b.$t(r.label),
1891
+ "check-strictly": ""
1892
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data", "props", "value-key", "default-expanded-keys", "filterable", "placeholder"])) : r.form.type === "radioCommonDict" ? (s(), f(q, {
1893
+ key: 17,
1894
+ modelValue: o(i)[r.form.prop || r.prop],
1895
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1896
+ }, {
1897
+ default: v(() => [
1898
+ (s(!0), T(Y, null, Q(r.form.data, (g) => (s(), f(L, {
1899
+ key: g.value,
1900
+ label: g.value
1901
+ }, {
1902
+ default: v(() => [
1903
+ z(R(g.label), 1)
1904
+ ]),
1905
+ _: 2
1906
+ }, 1032, ["label"]))), 128))
1907
+ ]),
1908
+ _: 2
1909
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : r.form.type === "radioLocalDict" ? (s(), f(q, {
1910
+ key: 18,
1911
+ modelValue: o(i)[r.form.prop || r.prop],
1912
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1913
+ }, {
1914
+ default: v(() => [
1915
+ (s(!0), T(Y, null, Q(o(V)[r.form.dictType], (g) => (s(), f(L, {
1916
+ key: g.value,
1917
+ label: g.value
1918
+ }, {
1919
+ default: v(() => [
1920
+ z(R(g.label), 1)
1921
+ ]),
1922
+ _: 2
1923
+ }, 1032, ["label"]))), 128))
1924
+ ]),
1925
+ _: 2
1926
+ }, 1032, ["modelValue", "onUpdate:modelValue"])) : r.form.type === "checkbox" ? (s(), f(G, {
1927
+ key: 19,
1928
+ label: b.$t(r.label),
1929
+ modelValue: o(i)[r.form.prop || r.prop],
1930
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1931
+ }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : r.form.type === "color" ? (s(), T("div", gt, [
1932
+ K(ne, {
1933
+ modelValue: o(i)[r.form.prop || r.prop],
1934
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g
1935
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1936
+ re("span", bt, R(b.$t("需点击选择器中的确定按钮")), 1)
1937
+ ])) : r.form.type === "inputNumber" ? (s(), f(O, {
1938
+ key: 21,
1939
+ min: r.form.min || 0,
1940
+ modelValue: o(i)[r.form.prop || r.prop],
1941
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1942
+ step: 1
1943
+ }, null, 8, ["min", "modelValue", "onUpdate:modelValue"])) : r.form.type === "richtext" ? (s(), f(Pl, {
1944
+ key: 22,
1945
+ modelValue: o(i)[r.form.prop || r.prop],
1946
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1947
+ height: r.form.max || 320,
1948
+ "min-height": r.form.min || 220
1949
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "height", "min-height"])) : (s(), T(Y, { key: 23 }, [
1950
+ r.form.translate === !0 ? (s(), f(Ol, {
1951
+ ref_for: !0,
1952
+ ref_key: "translateInputRef",
1953
+ ref: p,
1954
+ key: o(i)[b.dataSource.rowKey],
1955
+ modelValue: o(i)[r.form.prop || r.prop],
1956
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1957
+ disabled: r.form.disabled || !1,
1958
+ type: r.form.type,
1959
+ placeholder: b.$t("請輸入") + b.$t(r.label),
1960
+ rows: r.form.rows || 3,
1961
+ "show-word-limit": r.form.showWordLimit || !1,
1962
+ maxlength: r.form.limit || -1
1963
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "type", "placeholder", "rows", "show-word-limit", "maxlength"])) : (s(), f(F, {
1964
+ key: 1,
1965
+ modelValue: o(i)[r.form.prop || r.prop],
1966
+ "onUpdate:modelValue": (g) => o(i)[r.form.prop || r.prop] = g,
1967
+ disabled: r.form.disabled || !1,
1968
+ type: r.form.type,
1969
+ placeholder: b.$t("請輸入") + b.$t(r.label),
1970
+ rows: r.form.rows || 3,
1971
+ "show-word-limit": r.form.showWordLimit || !1,
1972
+ maxlength: r.form.limit || -1
1973
+ }, Le({ _: 2 }, [
1974
+ r.form.suffix ? {
1975
+ name: "suffix",
1976
+ fn: v(() => [
1977
+ z(R(r.form.suffix), 1)
1978
+ ]),
1979
+ key: "0"
1980
+ } : void 0,
1981
+ r.form.prefix ? {
1982
+ name: "prefix",
1983
+ fn: v(() => [
1984
+ z(R(r.form.prefix), 1)
1985
+ ]),
1986
+ key: "1"
1987
+ } : void 0
1988
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "disabled", "type", "placeholder", "rows", "show-word-limit", "maxlength"]))
1989
+ ], 64))
1990
+ ]),
1991
+ _: 2
1992
+ }, 1032, ["prop", "label", "name", "rules", "required"])
1993
+ ]),
1994
+ _: 2
1995
+ }, 1032, ["span"]))), 128))
1996
+ ]),
1997
+ _: 1
1998
+ })
1999
+ ]),
2000
+ _: 1
2001
+ }, 8, ["model", "label-width", "label-position"])
2002
+ ]),
2003
+ _: 1
2004
+ }, 8, ["title", "modelValue", "width"]);
2005
+ };
2006
+ }
2007
+ }), al = /* @__PURE__ */ be(vt, [["__scopeId", "data-v-aa73b22b"]]), kt = {
2008
+ key: 1,
2009
+ class: "curd-search-card",
2010
+ style: { "margin-bottom": "0px !important" }
2011
+ }, wt = {
2012
+ key: 2,
2013
+ class: "curd-search-card"
2014
+ }, Vt = /* @__PURE__ */ fe({
2015
+ __name: "curdSearch",
2016
+ props: {
2017
+ dataSource: {},
2018
+ selectedCount: { default: 0 }
2019
+ },
2020
+ emits: ["actionEvent"],
2021
+ setup(e, { expose: t, emit: a }) {
2022
+ const { t: l } = wl(), { proxy: c } = ye(), n = a, p = e, y = Z(() => {
2023
+ const d = p.dataSource.actions;
2024
+ return d == null ? [] : d.filter((A) => A.position === "top" || A.action === "create" || A.action === "back").map((A) => {
2025
+ const F = { ...A };
2026
+ return F.action === "create" ? (F.cssType = "primary", F.icon = "Plus") : F.action === "back" && (F.icon = "ArrowLeft"), F;
2027
+ });
2028
+ }), h = Z(() => y.value.find((d) => d.action === "create") ?? null), V = Z(() => {
2029
+ var d;
2030
+ return ((d = p.dataSource.actions) == null ? void 0 : d.find((D) => D.action === "delete")) ?? null;
2031
+ }), i = Z(() => y.value.filter((d) => d.action !== "create")), M = (d) => {
2032
+ n("actionEvent", d);
2033
+ }, C = Z(() => p.dataSource.searchColumnsPerRow ?? 4), j = Z(() => Math.floor(24 / C.value)), P = Z(() => p.dataSource.showSearchCard ?? !0), H = Z(() => {
2034
+ if (p.dataSource.searchActionColSpan != null)
2035
+ return p.dataSource.searchActionColSpan;
2036
+ const d = E.value.length % C.value, A = 24 - (d === 0 ? C.value : d) * j.value;
2037
+ return A <= 0 ? 24 : A;
2038
+ }), J = Z(() => E.value.length % C.value === 0 ? "15px !important" : "0px !important"), { initSearchDicts: ee } = El(), S = I({}), E = I([]), b = () => {
2039
+ n("actionEvent", { action: "filter" });
2040
+ }, U = async () => {
2041
+ try {
2042
+ let d = O();
2043
+ if (d = { ...p.dataSource.queryParams || {}, ...d }, p.dataSource.beforeExport && await p.dataSource.beforeExport(d) === !1)
2044
+ return;
2045
+ const D = fa().format("YYYYMMDDHHmmss");
2046
+ let A = p.dataSource.exportFileName ? `${p.dataSource.exportFileName}` : "export";
2047
+ A += `_${D}.xlsx`, c == null || c.download(p.dataSource.exportUrl, d, A);
2048
+ } catch (d) {
2049
+ console.error("Export failed:", d), c == null || c.$modal.msgError(l("導出失敗"));
2050
+ }
2051
+ }, O = () => {
2052
+ const d = { ...S.value };
2053
+ return E.value.forEach((D) => {
2054
+ var A, F;
2055
+ if (((A = D.search) == null ? void 0 : A.type) === "daterange" || ((F = D.search) == null ? void 0 : F.type) === "timerange") {
2056
+ const G = d[D.search.prop];
2057
+ G && G[0] && G[1] && Ya(d, G, D.search.prop, c), delete d[D.search.prop];
2058
+ }
2059
+ }), Ye(d);
2060
+ }, W = async () => {
2061
+ await $(), n("actionEvent", { action: "filter" }, {});
2062
+ }, $ = async () => {
2063
+ const d = p.dataSource.columns.filter((A) => A.search);
2064
+ E.value = Tl(
2065
+ d.map((A, F) => (A.search.order || (A.search.order = F + 100), A)),
2066
+ "search.order"
2067
+ ), await Ie();
2068
+ const D = {};
2069
+ for (let A = 0; A < d.length; A++) {
2070
+ const F = d[A];
2071
+ if (!F.search) continue;
2072
+ const G = F.search.prop || "", se = F.search.type || "";
2073
+ se === "daterange" || se === "timerange" ? D[G] = F.search.default ? F.search.default.split(",") : [] : ((se === "selectApi" || se === "treeSelectApi" || se === "selectDict") && await ee(F), D[G] = F.search.default);
2074
+ }
2075
+ S.value = D;
2076
+ };
2077
+ return He(() => $()), t({ initData: $, getQueryParams: O }), (d, D) => {
2078
+ var pe;
2079
+ const A = ml, F = hl, G = fl, se = yl, w = Me, L = pl, q = il, B = De, ne = dl, ue = ul, me = gl, ce = vl("hasPermi");
2080
+ return o(E).length > 0 && o(P) ? (s(), f(me, {
2081
+ key: 0,
2082
+ class: "curd-search-card",
2083
+ shadow: "hover",
2084
+ style: { "margin-bottom": "12px !important" },
2085
+ "body-style": { paddingTop: "18px !important", paddingBottom: o(J) }
2086
+ }, {
2087
+ default: v(() => [
2088
+ K(ue, {
2089
+ model: o(S),
2090
+ inline: !0,
2091
+ "label-width": p.dataSource.searchLabelWidth || 68
2092
+ }, {
2093
+ default: v(() => [
2094
+ K(ne, { gutter: 20 }, {
2095
+ default: v(() => [
2096
+ (s(!0), T(Y, null, Q(o(E), (u) => (s(), f(q, {
2097
+ span: o(j),
2098
+ key: u.search.prop
2099
+ }, {
2100
+ default: v(() => [
2101
+ K(L, {
2102
+ label: d.$t(u.label),
2103
+ name: u.search.prop,
2104
+ style: { width: "100%" },
2105
+ "label-width": u.search.labelWidth
2106
+ }, {
2107
+ default: v(() => [
2108
+ u.search.type === "daterange" ? (s(), f(A, {
2109
+ key: 0,
2110
+ modelValue: o(S)[u.search.prop],
2111
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2112
+ type: "daterange",
2113
+ format: "YYYY-MM-DD",
2114
+ "value-format": "YYYY-MM-DD",
2115
+ "range-separator": d.$t("至"),
2116
+ "start-placeholder": d.$t("開始日期"),
2117
+ "end-placeholder": d.$t("結束日期"),
2118
+ style: { width: "100%" },
2119
+ clearable: "",
2120
+ onChange: b
2121
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : u.search.type === "timerange" ? (s(), f(A, {
2122
+ key: 1,
2123
+ modelValue: o(S)[u.search.prop],
2124
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2125
+ type: "datetimerange",
2126
+ format: "YYYY-MM-DD HH:mm",
2127
+ "value-format": "YYYY-MM-DD HH:mm:ss",
2128
+ "range-separator": d.$t("至"),
2129
+ "start-placeholder": d.$t("開始時間"),
2130
+ "end-placeholder": d.$t("結束時間"),
2131
+ style: { width: "100%" },
2132
+ clearable: "",
2133
+ onChange: b
2134
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : u.search.type === "selectApi" ? (s(), f(G, {
2135
+ key: 2,
2136
+ modelValue: o(S)[u.search.prop],
2137
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2138
+ placeholder: d.$t("請選擇") + d.$t(u.label) + d.$t("查詢"),
2139
+ style: { width: "100%" },
2140
+ clearable: "",
2141
+ onChange: b,
2142
+ filterable: u.search.filterable ?? !0
2143
+ }, {
2144
+ default: v(() => [
2145
+ (s(!0), T(Y, null, Q(u.search.data, (m) => (s(), f(F, {
2146
+ key: m[u.search.value],
2147
+ label: m[u.search.label],
2148
+ value: m[u.search.value]
2149
+ }, null, 8, ["label", "value"]))), 128))
2150
+ ]),
2151
+ _: 2
2152
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "selectData" ? (s(), f(G, {
2153
+ key: 3,
2154
+ modelValue: o(S)[u.search.prop],
2155
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2156
+ placeholder: d.$t("請選擇") + d.$t(u.label) + d.$t("查詢"),
2157
+ style: { width: "100%" },
2158
+ clearable: "",
2159
+ onChange: b,
2160
+ filterable: u.search.filterable ?? !0
2161
+ }, {
2162
+ default: v(() => [
2163
+ (s(!0), T(Y, null, Q(u.search.data, (m) => (s(), f(F, {
2164
+ key: m[u.search.value],
2165
+ label: m[u.search.label],
2166
+ value: m[u.search.value]
2167
+ }, null, 8, ["label", "value"]))), 128))
2168
+ ]),
2169
+ _: 2
2170
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "selectDict" ? (s(), f(G, {
2171
+ key: 4,
2172
+ modelValue: o(S)[u.search.prop],
2173
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2174
+ placeholder: d.$t("請選擇") + d.$t(u.label) + d.$t("查詢"),
2175
+ style: { width: "100%" },
2176
+ clearable: "",
2177
+ onChange: b,
2178
+ filterable: u.search.filterable ?? !0
2179
+ }, {
2180
+ default: v(() => [
2181
+ (s(!0), T(Y, null, Q(u.search.data || [], (m) => (s(), f(F, {
2182
+ key: m[u.search.value] || m.value,
2183
+ label: m[u.search.label] || m.label,
2184
+ value: m[u.search.value] || m.value
2185
+ }, null, 8, ["label", "value"]))), 128))
2186
+ ]),
2187
+ _: 2
2188
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "selectCommonDict" ? (s(), f(G, {
2189
+ key: 5,
2190
+ modelValue: o(S)[u.search.prop],
2191
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2192
+ placeholder: d.$t("請選擇") + d.$t(u.label) + d.$t("查詢"),
2193
+ style: { width: "100%" },
2194
+ clearable: "",
2195
+ onChange: b,
2196
+ filterable: u.search.filterable ?? !0
2197
+ }, {
2198
+ default: v(() => [
2199
+ (s(!0), T(Y, null, Q(u.search.data || [], (m) => (s(), f(F, {
2200
+ key: m[u.search.value] || m.value,
2201
+ label: m[u.search.label] || m.label,
2202
+ value: m[u.search.value] || m.value
2203
+ }, null, 8, ["label", "value"]))), 128))
2204
+ ]),
2205
+ _: 2
2206
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "treeSelectApi" ? (s(), f(se, {
2207
+ key: 6,
2208
+ modelValue: o(S)[u.search.prop],
2209
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2210
+ data: u.search.data,
2211
+ props: u.search.props,
2212
+ "value-key": u.search.valueKey,
2213
+ "default-expanded-keys": u.search.defaultExpandedKeys,
2214
+ placeholder: d.$t("請選擇") + d.$t(u.label) + d.$t("查詢"),
2215
+ style: { width: "100%" },
2216
+ "check-strictly": "",
2217
+ clearable: "",
2218
+ onChange: b
2219
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data", "props", "value-key", "default-expanded-keys", "placeholder"])) : u.search.type === "number" ? (s(), f(w, {
2220
+ key: 7,
2221
+ type: "number",
2222
+ modelValue: o(S)[u.search.prop],
2223
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2224
+ placeholder: d.$t("請輸入") + d.$t(u.label) + d.$t("查詢"),
2225
+ style: { width: "100%" },
2226
+ clearable: ""
2227
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (s(), f(w, {
2228
+ key: 8,
2229
+ type: "text",
2230
+ modelValue: o(S)[u.search.prop],
2231
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2232
+ style: { width: "100%" },
2233
+ placeholder: d.$t("請輸入") + d.$t(u.label) + d.$t("查詢"),
2234
+ onKeyup: Qe(b, ["enter"]),
2235
+ clearable: ""
2236
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
2237
+ ]),
2238
+ _: 2
2239
+ }, 1032, ["label", "name", "label-width"])
2240
+ ]),
2241
+ _: 2
2242
+ }, 1032, ["span"]))), 128)),
2243
+ K(q, { span: o(H) }, {
2244
+ default: v(() => {
2245
+ var u;
2246
+ return [
2247
+ K(B, {
2248
+ onClick: b,
2249
+ plain: ""
2250
+ }, {
2251
+ default: v(() => [
2252
+ z(R(d.$t("查詢")), 1)
2253
+ ]),
2254
+ _: 1
2255
+ }),
2256
+ K(B, {
2257
+ onClick: W,
2258
+ plain: ""
2259
+ }, {
2260
+ default: v(() => [
2261
+ z(R(d.$t("清空")), 1)
2262
+ ]),
2263
+ _: 1
2264
+ }),
2265
+ o(h) ? ie((s(), f(B, {
2266
+ key: 0,
2267
+ type: o(h).cssType,
2268
+ icon: o(h).icon,
2269
+ plain: "",
2270
+ onClick: D[0] || (D[0] = (m) => M(o(h)))
2271
+ }, {
2272
+ default: v(() => [
2273
+ z(R(d.$t(o(h).text || "新增")), 1)
2274
+ ]),
2275
+ _: 1
2276
+ }, 8, ["type", "icon"])), [
2277
+ [ce, o(h).permission || null]
2278
+ ]) : X("", !0),
2279
+ p.dataSource.showBatchDeleteButton ? ie((s(), f(B, {
2280
+ key: 1,
2281
+ type: "danger",
2282
+ icon: "Delete",
2283
+ plain: "",
2284
+ disabled: d.selectedCount === 0,
2285
+ onClick: D[1] || (D[1] = (m) => n("actionEvent", { action: "batchDelete" }))
2286
+ }, {
2287
+ default: v(() => [
2288
+ z(R(d.$t("批量刪除")), 1)
2289
+ ]),
2290
+ _: 1
2291
+ }, 8, ["disabled"])), [
2292
+ [ce, ((u = o(V)) == null ? void 0 : u.permission) || null]
2293
+ ]) : X("", !0),
2294
+ p.dataSource.exportUrl ? (s(), f(B, {
2295
+ key: 2,
2296
+ type: "primary",
2297
+ icon: "Download",
2298
+ plain: "",
2299
+ onClick: U
2300
+ }, {
2301
+ default: v(() => [
2302
+ z(R(p.dataSource.exportButtonName || d.$t("導出")), 1)
2303
+ ]),
2304
+ _: 1
2305
+ })) : X("", !0),
2306
+ (s(!0), T(Y, null, Q(o(i), (m) => ie((s(), f(B, {
2307
+ key: m.text,
2308
+ onClick: (r) => M(m),
2309
+ type: m.cssType,
2310
+ icon: m.icon,
2311
+ plain: ""
2312
+ }, {
2313
+ default: v(() => [
2314
+ z(R(d.$t(m.text)), 1)
2315
+ ]),
2316
+ _: 2
2317
+ }, 1032, ["onClick", "type", "icon"])), [
2318
+ [ce, m.permission || null]
2319
+ ])), 128))
2320
+ ];
2321
+ }),
2322
+ _: 1
2323
+ }, 8, ["span"])
2324
+ ]),
2325
+ _: 1
2326
+ })
2327
+ ]),
2328
+ _: 1
2329
+ }, 8, ["model", "label-width"])
2330
+ ]),
2331
+ _: 1
2332
+ }, 8, ["body-style"])) : o(E).length > 0 && !o(P) ? (s(), T("div", kt, [
2333
+ K(ue, {
2334
+ model: o(S),
2335
+ inline: !0,
2336
+ "label-width": p.dataSource.searchLabelWidth || 68
2337
+ }, {
2338
+ default: v(() => [
2339
+ K(ne, { gutter: 20 }, {
2340
+ default: v(() => [
2341
+ (s(!0), T(Y, null, Q(o(E), (u) => (s(), f(q, {
2342
+ span: o(j),
2343
+ key: u.search.prop
2344
+ }, {
2345
+ default: v(() => [
2346
+ K(L, {
2347
+ label: u.label,
2348
+ name: u.search.prop,
2349
+ style: { width: "100%" },
2350
+ "label-width": u.search.labelWidth
2351
+ }, {
2352
+ default: v(() => [
2353
+ u.search.type === "daterange" ? (s(), f(A, {
2354
+ key: 0,
2355
+ modelValue: o(S)[u.search.prop],
2356
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2357
+ type: "daterange",
2358
+ format: "YYYY-MM-DD",
2359
+ "value-format": "YYYY-MM-DD",
2360
+ "range-separator": d.$t("至"),
2361
+ "start-placeholder": d.$t("開始日期"),
2362
+ "end-placeholder": d.$t("結束日期"),
2363
+ style: { width: "100%" },
2364
+ clearable: "",
2365
+ onChange: b
2366
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : u.search.type === "timerange" ? (s(), f(A, {
2367
+ key: 1,
2368
+ modelValue: o(S)[u.search.prop],
2369
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2370
+ type: "datetimerange",
2371
+ format: "YYYY-MM-DD HH:mm",
2372
+ "value-format": "YYYY-MM-DD HH:mm:ss",
2373
+ "range-separator": d.$t("至"),
2374
+ "start-placeholder": d.$t("開始時間"),
2375
+ "end-placeholder": d.$t("結束時間"),
2376
+ style: { width: "100%" },
2377
+ clearable: "",
2378
+ onChange: b
2379
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "range-separator", "start-placeholder", "end-placeholder"])) : u.search.type === "selectApi" ? (s(), f(G, {
2380
+ key: 2,
2381
+ modelValue: o(S)[u.search.prop],
2382
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2383
+ placeholder: d.$t("請選擇" + u.label + "查詢"),
2384
+ style: { width: "100%" },
2385
+ clearable: "",
2386
+ onChange: b,
2387
+ filterable: u.search.filterable ?? !0
2388
+ }, {
2389
+ default: v(() => [
2390
+ (s(!0), T(Y, null, Q(u.search.data, (m) => (s(), f(F, {
2391
+ key: m[u.search.value],
2392
+ label: m[u.search.label],
2393
+ value: m[u.search.value]
2394
+ }, null, 8, ["label", "value"]))), 128))
2395
+ ]),
2396
+ _: 2
2397
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "selectData" ? (s(), f(G, {
2398
+ key: 3,
2399
+ modelValue: o(S)[u.search.prop],
2400
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2401
+ placeholder: d.$t("請選擇" + u.label + "查詢"),
2402
+ style: { width: "100%" },
2403
+ clearable: "",
2404
+ onChange: b,
2405
+ filterable: u.search.filterable ?? !0
2406
+ }, {
2407
+ default: v(() => [
2408
+ (s(!0), T(Y, null, Q(u.search.data, (m) => (s(), f(F, {
2409
+ key: m[u.search.value],
2410
+ label: m[u.search.label],
2411
+ value: m[u.search.value]
2412
+ }, null, 8, ["label", "value"]))), 128))
2413
+ ]),
2414
+ _: 2
2415
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "selectDict" ? (s(), f(G, {
2416
+ key: 4,
2417
+ modelValue: o(S)[u.search.prop],
2418
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2419
+ placeholder: d.$t("請選擇" + u.label + "查詢"),
2420
+ style: { width: "100%" },
2421
+ clearable: "",
2422
+ onChange: b,
2423
+ filterable: u.search.filterable ?? !0
2424
+ }, {
2425
+ default: v(() => [
2426
+ (s(!0), T(Y, null, Q(u.search.data || [], (m) => (s(), f(F, {
2427
+ key: m[u.search.value] || m.value,
2428
+ label: m[u.search.label] || m.label,
2429
+ value: m[u.search.value] || m.value
2430
+ }, null, 8, ["label", "value"]))), 128))
2431
+ ]),
2432
+ _: 2
2433
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "selectCommonDict" ? (s(), f(G, {
2434
+ key: 5,
2435
+ modelValue: o(S)[u.search.prop],
2436
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2437
+ placeholder: d.$t("請選擇" + u.label + "查詢"),
2438
+ style: { width: "100%" },
2439
+ clearable: "",
2440
+ onChange: b,
2441
+ filterable: u.search.filterable ?? !0
2442
+ }, {
2443
+ default: v(() => [
2444
+ (s(!0), T(Y, null, Q(u.search.data || [], (m) => (s(), f(F, {
2445
+ key: m[u.search.value] || m.value,
2446
+ label: m[u.search.label] || m.label,
2447
+ value: m[u.search.value] || m.value
2448
+ }, null, 8, ["label", "value"]))), 128))
2449
+ ]),
2450
+ _: 2
2451
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "filterable"])) : u.search.type === "treeSelectApi" ? (s(), f(se, {
2452
+ key: 6,
2453
+ modelValue: o(S)[u.search.prop],
2454
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2455
+ data: u.search.data,
2456
+ props: u.search.props,
2457
+ "value-key": u.search.valueKey,
2458
+ "default-expanded-keys": u.search.defaultExpandedKeys,
2459
+ placeholder: d.$t("請選擇" + u.label + "查詢"),
2460
+ style: { width: "100%" },
2461
+ "check-strictly": "",
2462
+ clearable: "",
2463
+ onChange: b
2464
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data", "props", "value-key", "default-expanded-keys", "placeholder"])) : u.search.type === "number" ? (s(), f(w, {
2465
+ key: 7,
2466
+ type: "number",
2467
+ modelValue: o(S)[u.search.prop],
2468
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2469
+ placeholder: d.$t("請輸入" + u.label + "查詢"),
2470
+ style: { width: "100%" },
2471
+ clearable: ""
2472
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (s(), f(w, {
2473
+ key: 8,
2474
+ type: "text",
2475
+ modelValue: o(S)[u.search.prop],
2476
+ "onUpdate:modelValue": (m) => o(S)[u.search.prop] = m,
2477
+ style: { width: "100%" },
2478
+ placeholder: d.$t("請輸入" + u.label + "查詢"),
2479
+ onKeyup: Qe(b, ["enter"]),
2480
+ clearable: ""
2481
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
2482
+ ]),
2483
+ _: 2
2484
+ }, 1032, ["label", "name", "label-width"])
2485
+ ]),
2486
+ _: 2
2487
+ }, 1032, ["span"]))), 128)),
2488
+ K(q, { span: o(H) }, {
2489
+ default: v(() => {
2490
+ var u;
2491
+ return [
2492
+ K(B, {
2493
+ onClick: b,
2494
+ plain: ""
2495
+ }, {
2496
+ default: v(() => [
2497
+ z(R(d.$t("查詢")), 1)
2498
+ ]),
2499
+ _: 1
2500
+ }),
2501
+ K(B, {
2502
+ onClick: W,
2503
+ plain: ""
2504
+ }, {
2505
+ default: v(() => [
2506
+ z(R(d.$t("清空")), 1)
2507
+ ]),
2508
+ _: 1
2509
+ }),
2510
+ o(h) ? ie((s(), f(B, {
2511
+ key: 0,
2512
+ type: o(h).cssType,
2513
+ icon: o(h).icon,
2514
+ plain: "",
2515
+ onClick: D[2] || (D[2] = (m) => M(o(h)))
2516
+ }, {
2517
+ default: v(() => [
2518
+ z(R(d.$t(o(h).text || "新增")), 1)
2519
+ ]),
2520
+ _: 1
2521
+ }, 8, ["type", "icon"])), [
2522
+ [ce, o(h).permission || null]
2523
+ ]) : X("", !0),
2524
+ p.dataSource.showBatchDeleteButton ? ie((s(), f(B, {
2525
+ key: 1,
2526
+ type: "danger",
2527
+ icon: "Delete",
2528
+ plain: "",
2529
+ disabled: d.selectedCount === 0,
2530
+ onClick: D[3] || (D[3] = (m) => n("actionEvent", { action: "batchDelete" }))
2531
+ }, {
2532
+ default: v(() => [
2533
+ z(R(d.$t("批量刪除")), 1)
2534
+ ]),
2535
+ _: 1
2536
+ }, 8, ["disabled"])), [
2537
+ [ce, ((u = o(V)) == null ? void 0 : u.permission) || null]
2538
+ ]) : X("", !0),
2539
+ p.dataSource.exportUrl ? (s(), f(B, {
2540
+ key: 2,
2541
+ type: "primary",
2542
+ icon: "Download",
2543
+ plain: "",
2544
+ onClick: U
2545
+ }, {
2546
+ default: v(() => [
2547
+ z(R(d.$t("導出")), 1)
2548
+ ]),
2549
+ _: 1
2550
+ })) : X("", !0),
2551
+ (s(!0), T(Y, null, Q(o(i), (m) => ie((s(), f(B, {
2552
+ key: m.text,
2553
+ onClick: (r) => M(m),
2554
+ type: m.cssType,
2555
+ icon: m.icon,
2556
+ plain: ""
2557
+ }, {
2558
+ default: v(() => [
2559
+ z(R(d.$t(m.text)), 1)
2560
+ ]),
2561
+ _: 2
2562
+ }, 1032, ["onClick", "type", "icon"])), [
2563
+ [ce, m.permission || null]
2564
+ ])), 128))
2565
+ ];
2566
+ }),
2567
+ _: 1
2568
+ }, 8, ["span"])
2569
+ ]),
2570
+ _: 1
2571
+ })
2572
+ ]),
2573
+ _: 1
2574
+ }, 8, ["model", "label-width"])
2575
+ ])) : o(y).length > 0 ? (s(), T("div", wt, [
2576
+ o(h) ? ie((s(), f(B, {
2577
+ key: 0,
2578
+ type: o(h).cssType,
2579
+ icon: o(h).icon,
2580
+ plain: "",
2581
+ onClick: D[4] || (D[4] = (u) => M(o(h)))
2582
+ }, {
2583
+ default: v(() => [
2584
+ z(R(o(h).text || "新增"), 1)
2585
+ ]),
2586
+ _: 1
2587
+ }, 8, ["type", "icon"])), [
2588
+ [ce, o(h).permission || null]
2589
+ ]) : X("", !0),
2590
+ p.dataSource.showBatchDeleteButton ? ie((s(), f(B, {
2591
+ key: 1,
2592
+ type: "danger",
2593
+ icon: "Delete",
2594
+ plain: "",
2595
+ disabled: d.selectedCount === 0,
2596
+ onClick: D[5] || (D[5] = (u) => n("actionEvent", { action: "batchDelete" }))
2597
+ }, {
2598
+ default: v(() => D[6] || (D[6] = [
2599
+ z("批量刪除")
2600
+ ])),
2601
+ _: 1
2602
+ }, 8, ["disabled"])), [
2603
+ [ce, ((pe = o(V)) == null ? void 0 : pe.permission) || null]
2604
+ ]) : X("", !0),
2605
+ p.dataSource.exportUrl ? (s(), f(B, {
2606
+ key: 2,
2607
+ type: "primary",
2608
+ icon: "Download",
2609
+ plain: "",
2610
+ onClick: U
2611
+ }, {
2612
+ default: v(() => [
2613
+ z(R(p.dataSource.exportButtonName || "導出"), 1)
2614
+ ]),
2615
+ _: 1
2616
+ })) : X("", !0),
2617
+ (s(!0), T(Y, null, Q(o(i), (u) => ie((s(), f(B, {
2618
+ key: u.text,
2619
+ onClick: (m) => M(u),
2620
+ type: u.cssType,
2621
+ icon: u.icon,
2622
+ plain: ""
2623
+ }, {
2624
+ default: v(() => [
2625
+ z(R(d.$t(u.text)), 1)
2626
+ ]),
2627
+ _: 2
2628
+ }, 1032, ["onClick", "type", "icon"])), [
2629
+ [ce, u.permission || null]
2630
+ ])), 128))
2631
+ ])) : X("", !0);
2632
+ };
2633
+ }
2634
+ }), _t = /* @__PURE__ */ be(Vt, [["__scopeId", "data-v-225efee8"]]), $t = { key: 1 }, St = /* @__PURE__ */ fe({
2635
+ __name: "index",
2636
+ props: {
2637
+ dataSource: {},
2638
+ showCard: { type: Boolean, default: !0 },
2639
+ showToolbar: { type: Boolean, default: !0 },
2640
+ showPadding: { type: Boolean, default: !0 },
2641
+ maxHeight: {}
2642
+ },
2643
+ emits: ["actionEvent", "beforeQuery"],
2644
+ setup(e, { expose: t, emit: a }) {
2645
+ const { proxy: l } = ye(), c = a, n = e, p = Z(
2646
+ () => n.dataSource.maxHeight != null ? void 0 : n.maxHeight
2647
+ ), y = I(!1), h = I({}), V = I({}), i = I(), M = I(), C = I(0), j = Z(() => {
2648
+ const w = (n.dataSource.columns || []).map((L) => L.slot).filter((L) => !!L);
2649
+ return Array.from(new Set(w));
2650
+ }), P = (w) => {
2651
+ C.value = Array.isArray(w) ? w.length : 0;
2652
+ }, H = (w = !1) => {
2653
+ y.value = !1, h.value = {}, w === !0 && J();
2654
+ }, J = () => {
2655
+ var w;
2656
+ return (w = i.value) == null ? void 0 : w.refreshTable();
2657
+ }, ee = async () => {
2658
+ var w;
2659
+ return await ((w = i.value) == null ? void 0 : w.initData());
2660
+ }, S = () => {
2661
+ var w;
2662
+ return (w = M.value) == null ? void 0 : w.initData();
2663
+ }, E = async (w, L) => {
2664
+ let q = L;
2665
+ n.dataSource.beforeAction && (q = await n.dataSource.beforeAction(w, L)), b(w, q);
2666
+ }, b = (w, L) => {
2667
+ if (typeof w.action == "function") {
2668
+ w.action(L);
2669
+ return;
2670
+ }
2671
+ const B = {
2672
+ update: () => U(w, L),
2673
+ delete: () => O(w, L),
2674
+ batchDelete: () => W(),
2675
+ create: () => $(w, L),
2676
+ view: () => D(w, L),
2677
+ filter: () => A(),
2678
+ back: () => se()
2679
+ }[w.action];
2680
+ B ? B() : c("actionEvent", w, L);
2681
+ }, U = async (w, L) => {
2682
+ n.dataSource.beforeUpdate && await n.dataSource.beforeUpdate(L) === !1 || (h.value = L, V.value = w, y.value = !0);
2683
+ }, O = async (w, L) => {
2684
+ var q, B, ne;
2685
+ try {
2686
+ if (n.dataSource.beforeDelete && await n.dataSource.beforeDelete(L) === !1)
2687
+ return;
2688
+ const ue = L[n.dataSource.rowKey];
2689
+ if (!ue) {
2690
+ l == null || l.$modal.msgError("rowKey参数不正确");
2691
+ return;
2692
+ }
2693
+ const me = w.confirm || w.confirmText || "確認刪除此數據嗎?";
2694
+ await (l == null ? void 0 : l.$modal.confirm(me)), await ((B = (q = n.dataSource).deleteApi) == null ? void 0 : B.call(q, ue)), l == null || l.$modal.msgSuccess("刪除成功"), (ne = i.value) == null || ne.refreshTable();
2695
+ } catch (ue) {
2696
+ ue !== "cancel" && console.error("Delete failed:", ue);
2697
+ }
2698
+ }, W = async () => {
2699
+ var q, B, ne, ue, me;
2700
+ if (!n.dataSource.deleteApi) {
2701
+ l == null || l.$modal.msgError("deleteApi 方法未設置");
2702
+ return;
2703
+ }
2704
+ const w = ((B = (q = i.value) == null ? void 0 : q.getSelection) == null ? void 0 : B.call(q)) ?? [];
2705
+ if (!w.length) {
2706
+ l == null || l.$modal.msgWarning("請先勾選要刪除的數據");
2707
+ return;
2708
+ }
2709
+ await (l == null ? void 0 : l.$modal.confirm(`確認刪除選中的 ${w.length} 條數據嗎?`));
2710
+ const L = [];
2711
+ for (const ce of w) {
2712
+ if (n.dataSource.beforeDelete && await n.dataSource.beforeDelete(ce) === !1)
2713
+ continue;
2714
+ const pe = ce[n.dataSource.rowKey];
2715
+ pe != null && L.push(pe);
2716
+ }
2717
+ L.length && (await ((ue = (ne = n.dataSource).deleteApi) == null ? void 0 : ue.call(ne, L)), l == null || l.$modal.msgSuccess("刪除成功"), (me = i.value) == null || me.refreshTable());
2718
+ }, $ = async (w, L) => {
2719
+ n.dataSource.beforeCreate && await n.dataSource.beforeCreate(L || {}) === !1 || (h.value = L || {}, V.value = w, y.value = !0);
2720
+ }, d = async (w = {}) => {
2721
+ const L = w && (Object.prototype.hasOwnProperty.call(w, "data") || Object.prototype.hasOwnProperty.call(w, "title") || Object.prototype.hasOwnProperty.call(w, "text") || Object.prototype.hasOwnProperty.call(w, "width") || Object.prototype.hasOwnProperty.call(w, "labelWidth") || Object.prototype.hasOwnProperty.call(w, "labelPosition")), q = L ? w.data || {} : w || {}, B = {
2722
+ action: "create",
2723
+ ...L ? {
2724
+ title: w.title,
2725
+ text: w.text,
2726
+ width: w.width,
2727
+ labelWidth: w.labelWidth,
2728
+ labelPosition: w.labelPosition
2729
+ } : {}
2730
+ };
2731
+ await $(B, q);
2732
+ }, D = (w, L) => {
2733
+ let q = w.url;
2734
+ const B = w.pm;
2735
+ if (B && L[B]) {
2736
+ const ne = q.includes("?") ? "&" : "?";
2737
+ q += `${ne}${B}=${L[B]}`;
2738
+ }
2739
+ l == null || l.$router.push(q);
2740
+ }, A = () => {
2741
+ var L, q;
2742
+ const w = (L = M.value) == null ? void 0 : L.getQueryParams();
2743
+ (q = i.value) == null || q.refreshTable(w || {});
2744
+ }, F = () => {
2745
+ var w;
2746
+ return (w = M.value) == null ? void 0 : w.getQueryParams();
2747
+ }, G = () => {
2748
+ var w;
2749
+ return (w = i.value) == null ? void 0 : w.getSelection();
2750
+ }, se = () => l == null ? void 0 : l.$router.back();
2751
+ return He(() => Oa(n.dataSource.columns)), t({ refreshTable: J, initSearch: S, initTable: ee, openCreate: d, getQueryParams: F, getSelection: G }), (w, L) => {
2752
+ const q = gl;
2753
+ return s(), T("div", {
2754
+ class: je({ "p-3": w.showPadding })
2755
+ }, [
2756
+ K(_t, {
2757
+ dataSource: n.dataSource,
2758
+ selectedCount: o(C),
2759
+ ref_key: "curdSearchRef",
2760
+ ref: M,
2761
+ onActionEvent: E
2762
+ }, null, 8, ["dataSource", "selectedCount"]),
2763
+ w.showCard ? (s(), f(q, {
2764
+ key: 0,
2765
+ "body-style": { paddingBottom: n.dataSource.paging === !1 ? "20px" : "0px" },
2766
+ shadow: "hover"
2767
+ }, {
2768
+ default: v(() => [
2769
+ K(el, {
2770
+ ref_key: "curdTableRef",
2771
+ ref: i,
2772
+ onActionEvent: E,
2773
+ onSelectionChange: P,
2774
+ dataSource: n.dataSource,
2775
+ maxHeight: o(p)
2776
+ }, Le({ _: 2 }, [
2777
+ Q(o(j), (B) => ({
2778
+ name: B,
2779
+ fn: v((ne) => [
2780
+ Pe(w.$slots, B, Ge(Je(ne)))
2781
+ ])
2782
+ }))
2783
+ ]), 1032, ["dataSource", "maxHeight"]),
2784
+ K(al, {
2785
+ onClose: H,
2786
+ modelValue: o(y),
2787
+ "onUpdate:modelValue": L[0] || (L[0] = (B) => Se(y) ? y.value = B : null),
2788
+ dataSource: n.dataSource,
2789
+ action: o(V),
2790
+ editData: o(h)
2791
+ }, null, 8, ["modelValue", "dataSource", "action", "editData"])
2792
+ ]),
2793
+ _: 3
2794
+ }, 8, ["body-style"])) : (s(), T("div", $t, [
2795
+ K(el, {
2796
+ ref_key: "curdTableRef",
2797
+ ref: i,
2798
+ onActionEvent: E,
2799
+ onSelectionChange: P,
2800
+ dataSource: n.dataSource,
2801
+ maxHeight: o(p)
2802
+ }, Le({ _: 2 }, [
2803
+ Q(o(j), (B) => ({
2804
+ name: B,
2805
+ fn: v((ne) => [
2806
+ Pe(w.$slots, B, Ge(Je(ne)))
2807
+ ])
2808
+ }))
2809
+ ]), 1032, ["dataSource", "maxHeight"]),
2810
+ K(al, {
2811
+ onClose: H,
2812
+ modelValue: o(y),
2813
+ "onUpdate:modelValue": L[1] || (L[1] = (B) => Se(y) ? y.value = B : null),
2814
+ dataSource: n.dataSource,
2815
+ action: o(V),
2816
+ editData: o(h)
2817
+ }, null, 8, ["modelValue", "dataSource", "action", "editData"])
2818
+ ]))
2819
+ ], 2);
2820
+ };
2821
+ }
2822
+ });
2823
+ let Ll = () => !0, zl = () => !0;
2824
+ const Dt = (e) => {
2825
+ e.hasPermi && (Ll = e.hasPermi), e.hasRoles && (zl = e.hasRoles);
2826
+ }, Ct = {
2827
+ mounted(e, t) {
2828
+ var l;
2829
+ const { value: a } = t;
2830
+ a != null && Array.isArray(a) && a.length > 0 && (Ll(a) || (l = e.parentNode) == null || l.removeChild(e));
2831
+ }
2832
+ }, Tt = {
2833
+ mounted(e, t) {
2834
+ var l;
2835
+ const { value: a } = t;
2836
+ a != null && Array.isArray(a) && a.length > 0 && (zl(a) || (l = e.parentNode) == null || l.removeChild(e));
2837
+ }
2838
+ }, tl = {
2839
+ 401: "认证失败,无法访问系统资源",
2840
+ 403: "当前操作没有权限",
2841
+ 404: "访问资源不存在",
2842
+ default: "系统未知错误,请反馈给管理员"
2843
+ };
2844
+ function Et(e, t, a) {
2845
+ const l = bl.service({
2846
+ text: "正在下載數據,請稍後",
2847
+ background: "rgba(0, 0, 0, 0.7)"
2848
+ });
2849
+ return ke().post(e, t, {
2850
+ transformRequest: [(c) => ht(c)],
2851
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
2852
+ responseType: "blob"
2853
+ }).then(async (c) => {
2854
+ if (mt(c)) {
2855
+ const p = new Blob([c]);
2856
+ ha.saveAs(p, a);
2857
+ } else {
2858
+ const p = await new Blob([c]).text(), y = JSON.parse(p), h = tl[y.code] || y.msg || tl.default;
2859
+ Ve.error(h);
2860
+ }
2861
+ l.close();
2862
+ }).catch((c) => {
2863
+ console.error(c), Ve.error("下载文件出现错误,请联系管理员!"), l.close();
2864
+ });
2865
+ }
2866
+ let ol;
2867
+ const Ut = {
2868
+ // 消息提示
2869
+ msg(e) {
2870
+ Ve.info(e);
2871
+ },
2872
+ // 错误消息
2873
+ msgError(e) {
2874
+ Ve.error(e);
2875
+ },
2876
+ // 成功消息
2877
+ msgSuccess(e) {
2878
+ Ve.success(e);
2879
+ },
2880
+ // 警告消息
2881
+ msgWarning(e) {
2882
+ Ve.warning(e);
2883
+ },
2884
+ // 弹出提示
2885
+ alert(e) {
2886
+ we.alert(e, "系統提示");
2887
+ },
2888
+ // 错误提示
2889
+ alertError(e) {
2890
+ we.alert(e, "系統提示", { type: "error" });
2891
+ },
2892
+ // 成功提示
2893
+ alertSuccess(e) {
2894
+ we.alert(e, "系統提示", { type: "success" });
2895
+ },
2896
+ // 警告提示
2897
+ alertWarning(e) {
2898
+ we.alert(e, "系統提示", { type: "warning" });
2899
+ },
2900
+ // 通知提示
2901
+ notify(e) {
2902
+ Ee.info(e);
2903
+ },
2904
+ // 错误通知
2905
+ notifyError(e) {
2906
+ Ee.error(e);
2907
+ },
2908
+ // 成功通知
2909
+ notifySuccess(e) {
2910
+ Ee.success(e);
2911
+ },
2912
+ // 警告通知
2913
+ notifyWarning(e) {
2914
+ Ee.warning(e);
2915
+ },
2916
+ // 确认窗体
2917
+ confirm(e) {
2918
+ return we.confirm(e, "系統提示", {
2919
+ confirmButtonText: "確認",
2920
+ cancelButtonText: "取消",
2921
+ type: "warning"
2922
+ });
2923
+ },
2924
+ // 提交内容
2925
+ prompt(e, t, a = "") {
2926
+ return we.prompt(e, t || "系統提示", {
2927
+ confirmButtonText: "確認",
2928
+ cancelButtonText: "取消",
2929
+ type: "warning",
2930
+ inputType: a,
2931
+ inputPlaceholder: e
2932
+ });
2933
+ },
2934
+ // 打开遮罩层
2935
+ loading(e) {
2936
+ ol = bl.service({
2937
+ lock: !0,
2938
+ text: e,
2939
+ background: "rgba(0, 0, 0, 0.7)"
2940
+ });
2941
+ },
2942
+ // 关闭遮罩层
2943
+ closeLoading() {
2944
+ ol.close();
2945
+ }
2946
+ };
2947
+ function Yl(e) {
2948
+ return ke()({
2949
+ url: "/system/dict/data/type/" + e,
2950
+ method: "get"
2951
+ });
2952
+ }
2953
+ function Bl(e) {
2954
+ return ke()({
2955
+ url: "/system/common/dict/data/type/" + e,
2956
+ method: "get"
2957
+ });
2958
+ }
2959
+ const ve = kl("dict", () => {
2960
+ const e = I(/* @__PURE__ */ new Map());
2961
+ return {
2962
+ dict: e,
2963
+ getDict: (n) => n && e.value.get(n) || null,
2964
+ setDict: (n, p) => {
2965
+ if (!n)
2966
+ return !1;
2967
+ try {
2968
+ return e.value.set(n, p), !0;
2969
+ } catch (y) {
2970
+ return console.error("Error in setDict:", y), !1;
2971
+ }
2972
+ },
2973
+ removeDict: (n) => {
2974
+ if (!n)
2975
+ return !1;
2976
+ try {
2977
+ return e.value.delete(n);
2978
+ } catch (p) {
2979
+ return console.error("Error in removeDict:", p), !1;
2980
+ }
2981
+ },
2982
+ cleanDict: () => {
2983
+ e.value.clear();
2984
+ }
2985
+ };
2986
+ }), At = (...e) => {
2987
+ const t = I({});
2988
+ return e.forEach(async (a) => {
2989
+ t.value[a] = [];
2990
+ const l = ve().getDict(a);
2991
+ l ? t.value[a] = l : await Yl(a).then((c) => {
2992
+ t.value[a] = c.data.map(
2993
+ (n) => ({ label: n.dictLabel, value: n.dictValue, elTagType: n.listClass, elTagClass: n.cssClass })
2994
+ ), ve().setDict(a, t.value[a]);
2995
+ });
2996
+ }), t.value;
2997
+ }, Ot = async (e) => {
2998
+ const t = ve().getDict(e);
2999
+ if (t && t.length > 0) return t;
3000
+ {
3001
+ const l = (await Yl(e)).data.map(
3002
+ (c) => ({ label: c.dictLabel, value: c.dictValue, elTagType: c.listClass, elTagClass: c.cssClass, remark: c.remark })
3003
+ );
3004
+ return ve().setDict(e, l), l;
3005
+ }
3006
+ }, Pt = (...e) => {
3007
+ const t = I({});
3008
+ return e.forEach(async (a) => {
3009
+ t.value[a] = [];
3010
+ const l = ve().getDict(a);
3011
+ l && l.length > 0 ? t.value[a] = l : await Bl(a).then((c) => {
3012
+ t.value[a] = c.data.map(
3013
+ (n) => ({ label: n.dictLabel, value: n.dictValue, elTagType: n.listClass, elTagClass: n.cssClass, remark: n.remark })
3014
+ ), ve().setDict(a, t.value[a]);
3015
+ });
3016
+ }), t.value;
3017
+ }, It = async (e) => {
3018
+ const t = ve().getDict(e);
3019
+ if (t && t.length > 0) return t;
3020
+ {
3021
+ const l = (await Bl(e)).data.map((c) => ({ label: c.dictLabel, value: c.dictValue, elTagType: c.listClass, elTagClass: c.cssClass }));
3022
+ return ve().setDict(e, l), l;
3023
+ }
3024
+ }, Lt = {
3025
+ beforeMount(e, { value: t, arg: a }) {
3026
+ if (a === "callback")
3027
+ e.$copyCallback = t;
3028
+ else {
3029
+ e.$copyValue = t;
3030
+ const l = () => {
3031
+ zt(e.$copyValue), e.$copyCallback && e.$copyCallback(e.$copyValue);
3032
+ };
3033
+ e.addEventListener("click", l), e.$destroyCopy = () => e.removeEventListener("click", l);
3034
+ }
3035
+ }
3036
+ };
3037
+ function zt(e, { target: t = document.body } = {}) {
3038
+ const a = document.createElement("textarea"), l = document.activeElement;
3039
+ a.value = e, a.setAttribute("readonly", ""), a.style.contain = "strict", a.style.position = "absolute", a.style.left = "-9999px", a.style.fontSize = "12pt";
3040
+ const c = document.getSelection();
3041
+ let n;
3042
+ c && (n = (c == null ? void 0 : c.rangeCount) > 0 && c.getRangeAt(0)), t.append(a), a.select(), a.selectionStart = 0, a.selectionEnd = e.length;
3043
+ let p = !1;
3044
+ try {
3045
+ p = document.execCommand("copy");
3046
+ } catch (y) {
3047
+ console.error(y);
3048
+ }
3049
+ return a.remove(), n && (c == null || c.removeAllRanges(), c == null || c.addRange(n)), l && l.focus(), p;
3050
+ }
3051
+ const Yt = {
3052
+ Curd: St,
3053
+ DictTag: Vl,
3054
+ SvgIcon: Fe,
3055
+ OssImagePreview: Sl,
3056
+ OssFile: Dl,
3057
+ Editor: Pl,
3058
+ TranslateInput: Ol,
3059
+ ImageUpload: Al,
3060
+ FileUpload: Ul
3061
+ }, Bt = (e, t = {}) => {
3062
+ t.baseUrl != null && wa(t.baseUrl), t.request && va(t.request), t.globalHeaders && ka(t.globalHeaders), (t.hasPermi || t.hasRoles) && Dt(t);
3063
+ for (const [l, c] of Object.entries(Yt))
3064
+ e.component(l, c);
3065
+ const a = e.config.globalProperties;
3066
+ a.$modal = Ut, a.download = Et, a.useDict = At, a.useOneDict = Ot, a.useOneCommonDict = It, a.useCommonDict = Pt, a.parseTime = ut, a.addDateRange = dt, a.handleTree = ft, a.selectDictLabel = it, a.selectDictLabels = pt, e.directive("hasPermi", Ct), e.directive("hasRoles", Tt), e.directive("copyText", Lt);
3067
+ }, Jt = { install: Bt };
3068
+ export {
3069
+ St as Curd,
3070
+ Vl as DictTag,
3071
+ Pl as Editor,
3072
+ Ul as FileUpload,
3073
+ Al as ImageUpload,
3074
+ Dl as OssFile,
3075
+ Sl as OssImagePreview,
3076
+ Fe as SvgIcon,
3077
+ Ol as TranslateInput,
3078
+ Jt as default,
3079
+ Et as download,
3080
+ We as getBaseUrl,
3081
+ Ke as getGlobalHeaders,
3082
+ ke as getRequest,
3083
+ Bt as install,
3084
+ wa as setBaseUrl,
3085
+ ka as setGlobalHeaders,
3086
+ Dt as setPermissionChecker,
3087
+ va as setRequest
3088
+ };
3089
+ //# sourceMappingURL=vue3-curd.es.js.map