cc1-form 1.1.15 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cc1-form.css +1 -1
- package/dist/cc1-form.js +148 -148
- package/dist/cc1-form.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/cc1-form.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@media(max-width:650px){.curd-row .col-1,.curd-row .col-2,.curd-row .col-3,.curd-row .col-4,.curd-row .col-5,.curd-row .col-6,.curd-row .col-7,.curd-row .col-8,.curd-row .col-9,.curd-row .col-10,.curd-row .col-11,.curd-row .col-12{width:100%!important}}.curd-row.stripe{border-bottom:1px solid #eee;border-left:1px solid #eee;border-right:1px solid #eee}.curd-row.stripe .form-item-label{border-right:1px solid #eee}.curd-row.stripe:first-child{border-top:1px solid #eee}.curd-row.stripe:nth-child(odd){background-color:#f5f7fa}.curd-row.stripe .el-form-item__label{position:relative;padding:0 20px 0 0}.curd-row.stripe .el-form-item__label:after{content:"";position:absolute;top:-10px;right:10px;width:1px;height:52px;background-color:#eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;top:-10px;left:0;width:1px;height:52px;background-color:#eee}@media(max-width:650px){.curd-row.stripe [class^=col-]:nth-child(2n){border-top:1px solid #eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;opacity:0}}.curd-row.stripe .el-form-item{margin-bottom:0;height:50px;align-items:center;padding:0 10px}.cc1-form-box{min-height:500px}.cc1-form-box .el-table th.el-table__cell{word-break:break-word;color:#000000d9;background-color:#fafafa}.cc1-form-box .curd-search .el-form-item{margin-bottom:10px}.cc1-form-box .curd-search .el-form--inline .el-form-item{margin-right:10px}.cc1-form-box .hide-label .el-form-item__label{display:none}.cc1-form-box .mt-10{margin-top:10px}.cc1-form-box .mb-10{margin-bottom:10px}.cc1-form-box .curd-search .el-select{width:192px}.cc1-form-box .refresh-btn{width:16px;height:16px;border-radius:50%;padding:6px;font-size:14px;border:1px solid #dcdfe6;background-color:#fff;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:#909399;cursor:pointer}.cc1-form-box .refresh-btn:hover{background-color:#f5f7fa}.cc1-form-box .table-text-click{color:var(--table-text-click-color);cursor:pointer
|
|
1
|
+
@media(max-width:650px){.curd-row .col-1,.curd-row .col-2,.curd-row .col-3,.curd-row .col-4,.curd-row .col-5,.curd-row .col-6,.curd-row .col-7,.curd-row .col-8,.curd-row .col-9,.curd-row .col-10,.curd-row .col-11,.curd-row .col-12{width:100%!important}}.curd-row.stripe{border-bottom:1px solid #eee;border-left:1px solid #eee;border-right:1px solid #eee}.curd-row.stripe .form-item-label{border-right:1px solid #eee}.curd-row.stripe:first-child{border-top:1px solid #eee}.curd-row.stripe:nth-child(odd){background-color:#f5f7fa}.curd-row.stripe .el-form-item__label{position:relative;padding:0 20px 0 0}.curd-row.stripe .el-form-item__label:after{content:"";position:absolute;top:-10px;right:10px;width:1px;height:52px;background-color:#eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;top:-10px;left:0;width:1px;height:52px;background-color:#eee}@media(max-width:650px){.curd-row.stripe [class^=col-]:nth-child(2n){border-top:1px solid #eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;opacity:0}}.curd-row.stripe .el-form-item{margin-bottom:0;height:50px;align-items:center;padding:0 10px}.cc1-form-box{min-height:500px}.cc1-form-box .el-table th.el-table__cell{word-break:break-word;color:#000000d9;background-color:#fafafa}.cc1-form-box .curd-search .el-form-item{margin-bottom:10px}.cc1-form-box .curd-search .el-form--inline .el-form-item{margin-right:10px}.cc1-form-box .hide-label .el-form-item__label{display:none}.cc1-form-box .mt-10{margin-top:10px}.cc1-form-box .mb-10{margin-bottom:10px}.cc1-form-box .curd-search .el-select{width:192px}.cc1-form-box .refresh-btn{width:16px;height:16px;border-radius:50%;padding:6px;font-size:14px;border:1px solid #dcdfe6;background-color:#fff;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:#909399;cursor:pointer}.cc1-form-box .refresh-btn:hover{background-color:#f5f7fa}.cc1-form-box .table-text-click{color:var(--table-text-click-color);cursor:pointer}.cc1-form-box .table-text-click:hover{text-decoration:underline}
|
package/dist/cc1-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as H, reactive as oe, onMounted as ne, resolveComponent as ae, createElementBlock as k, createCommentVNode as v, openBlock as c, renderSlot as C, createElementVNode as O, createVNode as V, withCtx as b, createTextVNode as
|
|
2
|
-
import { ElMessage as pe, ElLoading as fe, ElForm as Y, ElFormItem as J, ElInput as W, ElSwitch as Z, ElSelect as B, ElOption as K, ElTreeSelect as re, ElDatePicker as ee, ElDialog as te, ElButton as
|
|
1
|
+
import { defineComponent as H, reactive as oe, onMounted as ne, resolveComponent as ae, createElementBlock as k, createCommentVNode as v, openBlock as c, renderSlot as C, createElementVNode as O, createVNode as V, withCtx as b, createTextVNode as D, Fragment as S, renderList as j, createBlock as y, normalizeClass as M, normalizeStyle as se, ref as N, nextTick as ie, unref as n, mergeProps as E, toHandlers as F, resolveDynamicComponent as Q, toDisplayString as U, resolveDirective as de, withDirectives as ue, withKeys as ce } from "vue";
|
|
2
|
+
import { ElMessage as pe, ElLoading as fe, ElForm as Y, ElFormItem as J, ElInput as W, ElSwitch as Z, ElSelect as B, ElOption as K, ElTreeSelect as re, ElDatePicker as ee, ElDialog as te, ElButton as I, ElDropdown as me, ElDropdownMenu as he, ElDropdownItem as G, ElTable as be, ElTableColumn as X, ElPagination as ye } from "element-plus";
|
|
3
3
|
class $ {
|
|
4
4
|
/**
|
|
5
5
|
* 路由
|
|
@@ -156,7 +156,7 @@ class $ {
|
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
class
|
|
159
|
+
class z {
|
|
160
160
|
/**
|
|
161
161
|
* 自定义组件
|
|
162
162
|
*/
|
|
@@ -189,7 +189,7 @@ class L {
|
|
|
189
189
|
)
|
|
190
190
|
*/
|
|
191
191
|
static setOptionsData = (r, d, s) => {
|
|
192
|
-
const f =
|
|
192
|
+
const f = z.findOptions(r, d);
|
|
193
193
|
f && (f.data = s);
|
|
194
194
|
};
|
|
195
195
|
static form = {
|
|
@@ -202,12 +202,12 @@ class L {
|
|
|
202
202
|
* @param option 组件配置
|
|
203
203
|
*/
|
|
204
204
|
parentId: (r, d, s, f) => {
|
|
205
|
-
r ? d.type === $.EDialog.Insert ? (d.form.parentId = r._id, d.form.sort = r.children.length + 1) : d.form.parentId = r.parentId.substring(r.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = s.length + 1),
|
|
205
|
+
r ? d.type === $.EDialog.Insert ? (d.form.parentId = r._id, d.form.sort = r.children.length + 1) : d.form.parentId = r.parentId.substring(r.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = s.length + 1), z.setOptionsData(f, "parentId", [{ _id: "0", title: "根", children: s }]);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
class
|
|
210
|
+
class L {
|
|
211
211
|
/**
|
|
212
212
|
* 获取id函数-可以直接覆盖
|
|
213
213
|
*/
|
|
@@ -222,7 +222,7 @@ class T {
|
|
|
222
222
|
s.forEach((m) => {
|
|
223
223
|
let u = m.default ?? "";
|
|
224
224
|
m.type === "number" && (u = m.default ?? 0), m.type === "boolean" && (u = m.default ?? !1), m.type === "time" && (u = m.default ?? /* @__PURE__ */ new Date()), f[m.value] === void 0 && (f[m.value] = u);
|
|
225
|
-
}), f._id || (f._id =
|
|
225
|
+
}), f._id || (f._id = L.getIdFun());
|
|
226
226
|
});
|
|
227
227
|
};
|
|
228
228
|
/**
|
|
@@ -234,13 +234,13 @@ class T {
|
|
|
234
234
|
*/
|
|
235
235
|
static add = (r, d, s, f) => {
|
|
236
236
|
const m = JSONUtil.cp(s);
|
|
237
|
-
|
|
237
|
+
L.setId(r, d, s), d[r].push(
|
|
238
238
|
m.reduce(
|
|
239
239
|
(u, e) => {
|
|
240
240
|
let a = e.default ?? "";
|
|
241
241
|
return e.type === "number" && (a = e.default ?? 0), e.type === "boolean" && (a = e.default ?? !1), e.type === "time" && (a = e.default ?? /* @__PURE__ */ new Date()), u[e.value] = a, u;
|
|
242
242
|
},
|
|
243
|
-
{ _id:
|
|
243
|
+
{ _id: L.getIdFun() }
|
|
244
244
|
)
|
|
245
245
|
), f?.(d);
|
|
246
246
|
};
|
|
@@ -263,7 +263,7 @@ class T {
|
|
|
263
263
|
static getNoIdData = (r, d) => {
|
|
264
264
|
const s = JSONUtil.cp(r);
|
|
265
265
|
return s.forEach((f) => {
|
|
266
|
-
f._id && delete f._id, d && f[d] &&
|
|
266
|
+
f._id && delete f._id, d && f[d] && L.getNoIdData(f[d], d);
|
|
267
267
|
}), s;
|
|
268
268
|
};
|
|
269
269
|
}
|
|
@@ -313,18 +313,18 @@ const ge = {
|
|
|
313
313
|
const d = p, s = oe({
|
|
314
314
|
show: !1,
|
|
315
315
|
add: (m, u, e) => {
|
|
316
|
-
|
|
316
|
+
L.add(m, u, e, () => {
|
|
317
317
|
f("change");
|
|
318
318
|
});
|
|
319
319
|
},
|
|
320
320
|
remove: (m, u, e) => {
|
|
321
|
-
|
|
321
|
+
L.remove(m, u, e, () => {
|
|
322
322
|
f("change");
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
ne(() => {
|
|
327
|
-
|
|
327
|
+
L.setId(d.field, d.row, d.itemFields), s.show = !0;
|
|
328
328
|
});
|
|
329
329
|
const f = r;
|
|
330
330
|
return (m, u) => {
|
|
@@ -338,17 +338,17 @@ const ge = {
|
|
|
338
338
|
onClick: u[0] || (u[0] = (i) => s.add(p.field, p.row, p.itemFields))
|
|
339
339
|
}, {
|
|
340
340
|
default: b(() => [...u[2] || (u[2] = [
|
|
341
|
-
|
|
341
|
+
D("添加", -1)
|
|
342
342
|
])]),
|
|
343
343
|
_: 1
|
|
344
344
|
})
|
|
345
345
|
]),
|
|
346
|
-
(c(!0), k(S, null,
|
|
346
|
+
(c(!0), k(S, null, j(p.row[p.field], (i) => (c(), k("div", we, [
|
|
347
347
|
C(m.$slots, "item-start", {
|
|
348
348
|
item: i,
|
|
349
349
|
row: p.row
|
|
350
350
|
}),
|
|
351
|
-
(c(!0), k(S, null,
|
|
351
|
+
(c(!0), k(S, null, j(p.itemFields, (o) => (c(), y(a, {
|
|
352
352
|
modelValue: i[o.value],
|
|
353
353
|
"onUpdate:modelValue": (t) => i[o.value] = t,
|
|
354
354
|
style: se({ width: p.inputWidth }),
|
|
@@ -366,7 +366,7 @@ const ge = {
|
|
|
366
366
|
onClick: (o) => s.remove(p.field, p.row, i)
|
|
367
367
|
}, {
|
|
368
368
|
default: b(() => [...u[3] || (u[3] = [
|
|
369
|
-
|
|
369
|
+
D("删除", -1)
|
|
370
370
|
])]),
|
|
371
371
|
_: 1
|
|
372
372
|
}, 8, ["onClick"])
|
|
@@ -407,9 +407,9 @@ const ge = {
|
|
|
407
407
|
const l = (h) => {
|
|
408
408
|
if (u.formDefault[h.key] = h.value, h.isForm) {
|
|
409
409
|
h.form = h.form || { span: o }, h.form.span = h.form.span ?? o;
|
|
410
|
-
let R = h.form.span, g = t.reduce((
|
|
411
|
-
const
|
|
412
|
-
t.push({ item: h, span: R }), (
|
|
410
|
+
let R = h.form.span, g = t.reduce((T, P) => T + P.span, R);
|
|
411
|
+
const _ = t.length;
|
|
412
|
+
t.push({ item: h, span: R }), (_ === 1 && t[0].span === 0 || g >= i || R === 0 && _ > 1) && (a.push(t), t = []), h.rules && (u.rules[h.key] = h.rules);
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
e.column.forEach((h) => {
|
|
@@ -430,11 +430,11 @@ const ge = {
|
|
|
430
430
|
rules: u.rules
|
|
431
431
|
}, {
|
|
432
432
|
default: b(() => [
|
|
433
|
-
u.show ? (c(!0), k(S, { key: 0 },
|
|
433
|
+
u.show ? (c(!0), k(S, { key: 0 }, j(u.formColumn, (i) => (c(), k("div", ke, [
|
|
434
434
|
C(e.$slots, "form-start", {
|
|
435
435
|
row: u.form
|
|
436
436
|
}),
|
|
437
|
-
(c(!0), k(S, null,
|
|
437
|
+
(c(!0), k(S, null, j(i, (o) => (c(), k(S, null, [
|
|
438
438
|
n(d)(o.item.show?.form, u.form) ?? !0 ? (c(), k("div", {
|
|
439
439
|
key: 0,
|
|
440
440
|
class: M(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
|
|
@@ -453,59 +453,59 @@ const ge = {
|
|
|
453
453
|
row: u.form,
|
|
454
454
|
item: o.item
|
|
455
455
|
}, () => [
|
|
456
|
-
o.item.type === "input" ? (c(), y(n(W),
|
|
456
|
+
o.item.type === "input" ? (c(), y(n(W), E({
|
|
457
457
|
key: 0,
|
|
458
458
|
modelValue: u.form[o.item.key],
|
|
459
459
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
460
|
-
}, { ref_for: !0 }, o.item.options?.input,
|
|
460
|
+
}, { ref_for: !0 }, o.item.options?.input, F(o.item.options?.input?.on || {}), {
|
|
461
461
|
disabled: u.getDisabled(o.item)
|
|
462
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), y(n(Z),
|
|
462
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), y(n(Z), E({
|
|
463
463
|
key: 1,
|
|
464
464
|
modelValue: u.form[o.item.key],
|
|
465
465
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
466
|
-
}, { ref_for: !0 }, o.item.options?.switch,
|
|
466
|
+
}, { ref_for: !0 }, o.item.options?.switch, F(o.item.options?.switch?.on || {}), {
|
|
467
467
|
disabled: u.getDisabled(o.item)
|
|
468
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), y(n(B),
|
|
468
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), y(n(B), E({
|
|
469
469
|
key: 2,
|
|
470
470
|
modelValue: u.form[o.item.key],
|
|
471
471
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
472
|
-
}, { ref_for: !0 }, o.item.options?.select,
|
|
472
|
+
}, { ref_for: !0 }, o.item.options?.select, F(o.item.options?.select?.on || {}), {
|
|
473
473
|
disabled: u.getDisabled(o.item),
|
|
474
474
|
style: { width: "100%" }
|
|
475
475
|
}), {
|
|
476
476
|
default: b(() => [
|
|
477
|
-
(c(!0), k(S, null,
|
|
477
|
+
(c(!0), k(S, null, j(o.item.options?.select?.data, (t) => (c(), y(n(K), {
|
|
478
478
|
key: t.value,
|
|
479
479
|
label: t.label,
|
|
480
480
|
value: t.value
|
|
481
481
|
}, null, 8, ["label", "value"]))), 128))
|
|
482
482
|
]),
|
|
483
483
|
_: 2
|
|
484
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), y(le,
|
|
484
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), y(le, E({
|
|
485
485
|
key: 3,
|
|
486
486
|
row: u.form,
|
|
487
487
|
field: o.item.key
|
|
488
|
-
}, { ref_for: !0 }, o.item.options?.list,
|
|
488
|
+
}, { ref_for: !0 }, o.item.options?.list, F(o.item.options?.list?.on || {}), {
|
|
489
489
|
disabled: u.getDisabled(o.item),
|
|
490
490
|
style: { width: "100%" }
|
|
491
|
-
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), y(n(re),
|
|
491
|
+
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), y(n(re), E({
|
|
492
492
|
key: 4,
|
|
493
493
|
modelValue: u.form[o.item.key],
|
|
494
494
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
495
|
-
}, { ref_for: !0 }, o.item.options?.treeSelect,
|
|
495
|
+
}, { ref_for: !0 }, o.item.options?.treeSelect, F(o.item.options?.treeSelect?.on || {}), {
|
|
496
496
|
disabled: u.getDisabled(o.item),
|
|
497
497
|
style: { width: "100%" }
|
|
498
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), y(n(ee),
|
|
498
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), y(n(ee), E({
|
|
499
499
|
key: 5,
|
|
500
500
|
modelValue: u.form[o.item.key],
|
|
501
501
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
502
|
-
}, { ref_for: !0 }, o.item.options?.datetime,
|
|
502
|
+
}, { ref_for: !0 }, o.item.options?.datetime, F(o.item.options?.datetime?.on || {}), {
|
|
503
503
|
disabled: u.getDisabled(o.item)
|
|
504
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(
|
|
504
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(z).customComponent[o.item.type] ? (c(), y(Q(n(z).customComponent[o.item.type]), E({
|
|
505
505
|
key: 6,
|
|
506
506
|
modelValue: u.form[o.item.key],
|
|
507
507
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
508
|
-
}, { ref_for: !0 }, o.item.options?.[o.item.type],
|
|
508
|
+
}, { ref_for: !0 }, o.item.options?.[o.item.type], F(o.item.options?.[o.item.type]?.on || {}), {
|
|
509
509
|
disabled: u.getDisabled(o.item)
|
|
510
510
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : v("", !0)
|
|
511
511
|
]),
|
|
@@ -612,18 +612,18 @@ const Ee = { class: "dialog-footer" }, xe = /* @__PURE__ */ H({
|
|
|
612
612
|
}, {
|
|
613
613
|
footer: b(() => [
|
|
614
614
|
O("span", Ee, [
|
|
615
|
-
V(n(
|
|
615
|
+
V(n(I), { onClick: i }, {
|
|
616
616
|
default: b(() => [...t[1] || (t[1] = [
|
|
617
|
-
|
|
617
|
+
D("取消", -1)
|
|
618
618
|
])]),
|
|
619
619
|
_: 1
|
|
620
620
|
}),
|
|
621
|
-
V(n(
|
|
621
|
+
V(n(I), {
|
|
622
622
|
type: "primary",
|
|
623
623
|
onClick: a
|
|
624
624
|
}, {
|
|
625
625
|
default: b(() => [...t[2] || (t[2] = [
|
|
626
|
-
|
|
626
|
+
D("确认", -1)
|
|
627
627
|
])]),
|
|
628
628
|
_: 1
|
|
629
629
|
})
|
|
@@ -653,7 +653,7 @@ function $e(p, r) {
|
|
|
653
653
|
])]);
|
|
654
654
|
}
|
|
655
655
|
const Oe = /* @__PURE__ */ De(Ue, [["render", $e]]);
|
|
656
|
-
class
|
|
656
|
+
class x {
|
|
657
657
|
/** 全局配置 */
|
|
658
658
|
static config = {
|
|
659
659
|
/** 表格行键 - 默认_id */
|
|
@@ -680,19 +680,19 @@ class E {
|
|
|
680
680
|
};
|
|
681
681
|
/** 设置全局默认配置 */
|
|
682
682
|
static setConfig = (r) => {
|
|
683
|
-
|
|
683
|
+
x.config = ObjectUtil.deepMerge(x.config, r);
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
686
|
const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
687
687
|
class: "absolute row fit",
|
|
688
688
|
style: { overflow: "hidden" }
|
|
689
|
-
}, Re = { class: "col column" },
|
|
689
|
+
}, Re = { class: "col column" }, _e = {
|
|
690
690
|
key: 0,
|
|
691
691
|
class: "relative curd-search"
|
|
692
|
-
},
|
|
692
|
+
}, je = { class: "mb-10 flex justify-between items-center" }, ze = {
|
|
693
693
|
class: "flex items-center",
|
|
694
694
|
style: { gap: "10px" }
|
|
695
|
-
},
|
|
695
|
+
}, Le = { key: 0 }, Te = { key: 1 }, Me = { key: 2 }, Ke = { class: "export-btn" }, Ne = {
|
|
696
696
|
class: "flex items-center",
|
|
697
697
|
style: { gap: "10px" }
|
|
698
698
|
}, Pe = { class: "col fit-width relative" }, Ae = { class: "absolute column fit" }, Be = ["onClick"], Je = { class: "row justify-end mt-10 mb-10" }, We = {
|
|
@@ -757,7 +757,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
757
757
|
const a = (i) => {
|
|
758
758
|
let o = [];
|
|
759
759
|
return i.forEach((t) => {
|
|
760
|
-
o.push(t[
|
|
760
|
+
o.push(t[x.config.tableRowKey]), t.children && t.children.length > 0 && (o = o.concat(a(t.children)));
|
|
761
761
|
}), o;
|
|
762
762
|
};
|
|
763
763
|
e.table.expand.rowKeys = a(e.table.data);
|
|
@@ -789,10 +789,10 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
789
789
|
const a = s.option.api.list;
|
|
790
790
|
try {
|
|
791
791
|
const i = await a({
|
|
792
|
-
[
|
|
793
|
-
[
|
|
792
|
+
[x.config.page.size]: e.page.size,
|
|
793
|
+
[x.config.page.num]: e.page.num,
|
|
794
794
|
...e.search.getFormData()
|
|
795
|
-
}), o =
|
|
795
|
+
}), o = x.config.result, t = i.data || { [o.list]: i };
|
|
796
796
|
let l = (Array.isArray(t[o.list]), t[o.list]);
|
|
797
797
|
e.table.data = s.option.data ? await s.option.data(l) : l, e.page.total = t[o.total] || 0;
|
|
798
798
|
} catch (i) {
|
|
@@ -833,17 +833,17 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
833
833
|
try {
|
|
834
834
|
if (s.option.tools?.export?.all) {
|
|
835
835
|
await s.option.tools?.export?.all({
|
|
836
|
-
[
|
|
837
|
-
[
|
|
836
|
+
[x.config.page.size]: e.page.size,
|
|
837
|
+
[x.config.page.num]: e.page.num,
|
|
838
838
|
...e.search.getFormData()
|
|
839
839
|
});
|
|
840
840
|
return;
|
|
841
841
|
}
|
|
842
842
|
const a = s.option.api.list, i = await a({
|
|
843
|
-
[
|
|
844
|
-
[
|
|
843
|
+
[x.config.page.size]: 999999,
|
|
844
|
+
[x.config.page.num]: 1
|
|
845
845
|
});
|
|
846
|
-
return (i.data || { [
|
|
846
|
+
return (i.data || { [x.config.result.list]: i })[x.config.result.list];
|
|
847
847
|
} catch (a) {
|
|
848
848
|
console.error(a);
|
|
849
849
|
} finally {
|
|
@@ -879,7 +879,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
879
879
|
if (s.option.form?.editAll)
|
|
880
880
|
return a;
|
|
881
881
|
let i = {
|
|
882
|
-
[
|
|
882
|
+
[x.config.tableRowKey]: e.update.edit.data[x.config.tableRowKey]
|
|
883
883
|
};
|
|
884
884
|
return Object.keys(e.update.edit.data).forEach((o) => {
|
|
885
885
|
a[o] !== e.update.edit.data[o] && (i[o] = a[o]);
|
|
@@ -976,8 +976,8 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
976
976
|
try {
|
|
977
977
|
if (!a) return;
|
|
978
978
|
await a({
|
|
979
|
-
[
|
|
980
|
-
(i) => i[
|
|
979
|
+
[x.config.tableRowKey]: e.remove.items.map(
|
|
980
|
+
(i) => i[x.config.tableRowKey]
|
|
981
981
|
),
|
|
982
982
|
items: e.remove.items
|
|
983
983
|
}), $.success(w.tCurd("operationSuccess")), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
|
|
@@ -1007,7 +1007,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1007
1007
|
},
|
|
1008
1008
|
table: {
|
|
1009
1009
|
headerCellClassName: "table-header",
|
|
1010
|
-
rowKey:
|
|
1010
|
+
rowKey: x.config.tableRowKey,
|
|
1011
1011
|
emptyText: w.tCurd("noData"),
|
|
1012
1012
|
highlightCurrentRow: !0
|
|
1013
1013
|
}
|
|
@@ -1031,7 +1031,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1031
1031
|
inactiveValue: !1,
|
|
1032
1032
|
inactiveLabel: w.tCurd("switchOff"),
|
|
1033
1033
|
tableBeforeChange: async (R, g) => {
|
|
1034
|
-
const
|
|
1034
|
+
const _ = o.options?.switch;
|
|
1035
1035
|
try {
|
|
1036
1036
|
await f.value?.open({
|
|
1037
1037
|
title: w.tCurd("confirmModify"),
|
|
@@ -1039,14 +1039,14 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1039
1039
|
}), e.table.loading = !0;
|
|
1040
1040
|
try {
|
|
1041
1041
|
return s.option.api.update ? (await s.option.api.update({
|
|
1042
|
-
[
|
|
1043
|
-
[R]: g[R] ===
|
|
1044
|
-
final(
|
|
1042
|
+
[x.config.tableRowKey]: g[x.config.tableRowKey],
|
|
1043
|
+
[R]: g[R] === _.activeValue ? _.inactiveValue : _.activeValue,
|
|
1044
|
+
final(T, P, A) {
|
|
1045
1045
|
e.table.loading = !1;
|
|
1046
1046
|
}
|
|
1047
1047
|
}), e.table.loading = !1, $.success(w.tCurd("operationSuccess")), e.table.getList(), !0) : void 0;
|
|
1048
|
-
} catch (
|
|
1049
|
-
return console.error(
|
|
1048
|
+
} catch (T) {
|
|
1049
|
+
return console.error(T), !1;
|
|
1050
1050
|
} finally {
|
|
1051
1051
|
e.table.loading = !1;
|
|
1052
1052
|
}
|
|
@@ -1056,8 +1056,8 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
},
|
|
1058
1058
|
treeSelect: {
|
|
1059
|
-
rowKey:
|
|
1060
|
-
nodeKey:
|
|
1059
|
+
rowKey: x.config.tableRowKey,
|
|
1060
|
+
nodeKey: x.config.tableRowKey,
|
|
1061
1061
|
multiple: !0,
|
|
1062
1062
|
renderAfterExpand: !1,
|
|
1063
1063
|
showCheckbox: !0,
|
|
@@ -1102,9 +1102,9 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1102
1102
|
const h = (g) => {
|
|
1103
1103
|
if (e.update.formDefault[g.key] = g.value, g.table.table && (g.show.table && e.table.column.show.list.push(g.key), g.table.table && e.table.column.show.listSource.push(g.key)), g.isForm) {
|
|
1104
1104
|
g.form = g.form || { span: t }, g.form.span = g.form.span ?? t;
|
|
1105
|
-
let
|
|
1105
|
+
let _ = g.form.span, T = l.reduce((A, q) => A + q.span, _);
|
|
1106
1106
|
const P = l.length;
|
|
1107
|
-
if (l.push({ item: g, span:
|
|
1107
|
+
if (l.push({ item: g, span: _ }), (P === 1 && l[0].span === 0 || T >= o || _ === 0 && P > 1) && (i.push(l), l = []), g.rules) {
|
|
1108
1108
|
const A = {
|
|
1109
1109
|
input: w.tCurd("placeholderInput"),
|
|
1110
1110
|
select: w.tCurd("placeholderSelect")
|
|
@@ -1123,7 +1123,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1123
1123
|
g.isForm = !0, h(g);
|
|
1124
1124
|
}), s.option.table?.column?.forEach((g) => {
|
|
1125
1125
|
g.isForm = !1, h(g);
|
|
1126
|
-
}), e.search.column.list = a.column.concat(a.table?.column || []), e.table.column.list = e.search.column.list.filter((g) => g.table?.table), e.search.column.list.sort((g,
|
|
1126
|
+
}), e.search.column.list = a.column.concat(a.table?.column || []), e.table.column.list = e.search.column.list.filter((g) => g.table?.table), e.search.column.list.sort((g, _) => g.sort?.search - _.sort?.search), e.table.column.list.sort((g, _) => g.sort?.table - _.sort?.table), l.length > 0 && i.push(l), e.update.formColumn = i;
|
|
1127
1127
|
const R = s.option.search?.formDefault;
|
|
1128
1128
|
R && Object.keys(R).forEach((g) => {
|
|
1129
1129
|
e.search.formDefault[g] = R[g];
|
|
@@ -1142,7 +1142,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1142
1142
|
O("div", Ie, [
|
|
1143
1143
|
C(a.$slots, "box-left"),
|
|
1144
1144
|
O("div", Re, [
|
|
1145
|
-
p.option.search?.show !== !1 ? (c(), k("div",
|
|
1145
|
+
p.option.search?.show !== !1 ? (c(), k("div", _e, [
|
|
1146
1146
|
V(n(Y), {
|
|
1147
1147
|
model: e.search.form,
|
|
1148
1148
|
inline: ""
|
|
@@ -1151,7 +1151,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1151
1151
|
C(a.$slots, "search-start", {
|
|
1152
1152
|
row: e.search.form
|
|
1153
1153
|
}),
|
|
1154
|
-
(c(!0), k(S, null,
|
|
1154
|
+
(c(!0), k(S, null, j(e.search.column.list, (t) => (c(), k(S, {
|
|
1155
1155
|
key: t.key
|
|
1156
1156
|
}, [
|
|
1157
1157
|
(typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (c(), y(n(J), {
|
|
@@ -1165,21 +1165,21 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1165
1165
|
C(a.$slots, "search-" + t.key, {
|
|
1166
1166
|
row: e.search.form
|
|
1167
1167
|
}, () => [
|
|
1168
|
-
t.type === "input" ? (c(), y(n(W), {
|
|
1168
|
+
t.type === "input" ? (c(), y(n(W), E({
|
|
1169
1169
|
key: 0,
|
|
1170
1170
|
modelValue: e.search.form[t.key],
|
|
1171
1171
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l,
|
|
1172
1172
|
placeholder: e.search.getPlaceholder(t),
|
|
1173
1173
|
clearable: "",
|
|
1174
1174
|
disabled: t.disabled?.search
|
|
1175
|
-
}, null,
|
|
1175
|
+
}, { ref_for: !0 }, t.options?.input, F(t.options?.input?.on || {})), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (c(), y(n(B), E({
|
|
1176
1176
|
key: 1,
|
|
1177
1177
|
modelValue: e.search.form[t.key],
|
|
1178
1178
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l,
|
|
1179
1179
|
placeholder: e.search.getPlaceholder(t, n(w).tCurd("placeholderSelect")),
|
|
1180
1180
|
clearable: "",
|
|
1181
1181
|
disabled: t.disabled?.search
|
|
1182
|
-
}, {
|
|
1182
|
+
}, { ref_for: !0 }, t.options?.switch, F(t.options?.switch?.on || {})), {
|
|
1183
1183
|
default: b(() => [
|
|
1184
1184
|
(c(), y(n(K), {
|
|
1185
1185
|
key: t.options?.switch?.activeValue,
|
|
@@ -1193,33 +1193,33 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1193
1193
|
}, null, 8, ["label", "value"]))
|
|
1194
1194
|
]),
|
|
1195
1195
|
_: 2
|
|
1196
|
-
},
|
|
1196
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (c(), y(n(B), E({
|
|
1197
1197
|
key: 2,
|
|
1198
1198
|
modelValue: e.search.form[t.key],
|
|
1199
1199
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l,
|
|
1200
1200
|
placeholder: e.search.getPlaceholder(t, n(w).tCurd("placeholderSelect")),
|
|
1201
1201
|
clearable: "",
|
|
1202
1202
|
disabled: t.disabled?.search
|
|
1203
|
-
}, {
|
|
1203
|
+
}, { ref_for: !0 }, t.options?.select, F(t.options?.select?.on || {})), {
|
|
1204
1204
|
default: b(() => [
|
|
1205
|
-
(c(!0), k(S, null,
|
|
1205
|
+
(c(!0), k(S, null, j(t.options?.select?.data, (l) => (c(), y(n(K), {
|
|
1206
1206
|
key: l.value,
|
|
1207
1207
|
label: l.label,
|
|
1208
1208
|
value: l.value
|
|
1209
1209
|
}, null, 8, ["label", "value"]))), 128))
|
|
1210
1210
|
]),
|
|
1211
1211
|
_: 2
|
|
1212
|
-
},
|
|
1212
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "datetime" ? (c(), y(n(ee), E({
|
|
1213
1213
|
key: 3,
|
|
1214
1214
|
modelValue: e.search.form[t.key],
|
|
1215
1215
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l
|
|
1216
|
-
}, { ref_for: !0 }, t.options?.datetime,
|
|
1216
|
+
}, { ref_for: !0 }, t.options?.datetime, F(t.options?.datetime?.on || {}), {
|
|
1217
1217
|
disabled: t.disabled?.search
|
|
1218
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(
|
|
1218
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(z).customComponent[t.type] ? (c(), y(Q(n(z).customComponent[t.type]), E({
|
|
1219
1219
|
key: 4,
|
|
1220
1220
|
modelValue: e.search.form[t.key],
|
|
1221
1221
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l
|
|
1222
|
-
}, { ref_for: !0 }, t.options?.[t.type],
|
|
1222
|
+
}, { ref_for: !0 }, t.options?.[t.type], F(t.options?.[t.type]?.on || {}), {
|
|
1223
1223
|
disabled: t.disabled?.search
|
|
1224
1224
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : v("", !0)
|
|
1225
1225
|
]),
|
|
@@ -1235,22 +1235,22 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1235
1235
|
}),
|
|
1236
1236
|
p.option.tools?.search || p.option.tools?.reset ? (c(), y(n(J), { key: 0 }, {
|
|
1237
1237
|
default: b(() => [
|
|
1238
|
-
p.option.tools?.search ? (c(), y(n(
|
|
1238
|
+
p.option.tools?.search ? (c(), y(n(I), {
|
|
1239
1239
|
key: 0,
|
|
1240
1240
|
type: "primary",
|
|
1241
1241
|
onClick: e.search.submit
|
|
1242
1242
|
}, {
|
|
1243
1243
|
default: b(() => [
|
|
1244
|
-
|
|
1244
|
+
D(U(n(w).tCurd("search")), 1)
|
|
1245
1245
|
]),
|
|
1246
1246
|
_: 1
|
|
1247
1247
|
}, 8, ["onClick"])) : v("", !0),
|
|
1248
|
-
p.option.tools?.reset ? (c(), y(n(
|
|
1248
|
+
p.option.tools?.reset ? (c(), y(n(I), {
|
|
1249
1249
|
key: 1,
|
|
1250
1250
|
onClick: e.search.reset
|
|
1251
1251
|
}, {
|
|
1252
1252
|
default: b(() => [
|
|
1253
|
-
|
|
1253
|
+
D(U(n(w).tCurd("reset")), 1)
|
|
1254
1254
|
]),
|
|
1255
1255
|
_: 1
|
|
1256
1256
|
}, 8, ["onClick"])) : v("", !0)
|
|
@@ -1264,37 +1264,37 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1264
1264
|
_: 3
|
|
1265
1265
|
}, 8, ["model"])
|
|
1266
1266
|
])) : v("", !0),
|
|
1267
|
-
O("div",
|
|
1268
|
-
O("div",
|
|
1269
|
-
n(u)(p.option.tools?.add) ? (c(), k("div",
|
|
1270
|
-
V(n(
|
|
1267
|
+
O("div", je, [
|
|
1268
|
+
O("div", ze, [
|
|
1269
|
+
n(u)(p.option.tools?.add) ? (c(), k("div", Le, [
|
|
1270
|
+
V(n(I), {
|
|
1271
1271
|
type: "primary",
|
|
1272
1272
|
onClick: i[0] || (i[0] = (t) => e.update.open(n(d).Insert))
|
|
1273
1273
|
}, {
|
|
1274
1274
|
default: b(() => [
|
|
1275
|
-
|
|
1275
|
+
D(U(n(w).tCurd("add")), 1)
|
|
1276
1276
|
]),
|
|
1277
1277
|
_: 1
|
|
1278
1278
|
})
|
|
1279
1279
|
])) : v("", !0),
|
|
1280
|
-
p.option.table?.selectable && n(u)(p.option.tools?.delete) ? (c(), k("div",
|
|
1281
|
-
V(n(
|
|
1280
|
+
p.option.table?.selectable && n(u)(p.option.tools?.delete) ? (c(), k("div", Te, [
|
|
1281
|
+
V(n(I), {
|
|
1282
1282
|
type: "danger",
|
|
1283
1283
|
onClick: i[1] || (i[1] = (t) => e.remove.open(e.table.selection.list))
|
|
1284
1284
|
}, {
|
|
1285
1285
|
default: b(() => [
|
|
1286
|
-
|
|
1286
|
+
D(U(n(w).tCurd("delete")), 1)
|
|
1287
1287
|
]),
|
|
1288
1288
|
_: 1
|
|
1289
1289
|
})
|
|
1290
1290
|
])) : v("", !0),
|
|
1291
1291
|
p.option.tools?.expand ? (c(), k("div", Me, [
|
|
1292
|
-
V(n(
|
|
1292
|
+
V(n(I), {
|
|
1293
1293
|
type: "warning",
|
|
1294
1294
|
onClick: i[2] || (i[2] = (t) => e.table.expand.all())
|
|
1295
1295
|
}, {
|
|
1296
1296
|
default: b(() => [
|
|
1297
|
-
|
|
1297
|
+
D(U(n(w).tCurd("expandCollapse")), 1)
|
|
1298
1298
|
]),
|
|
1299
1299
|
_: 1
|
|
1300
1300
|
})
|
|
@@ -1311,19 +1311,19 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1311
1311
|
command: "select"
|
|
1312
1312
|
}, {
|
|
1313
1313
|
default: b(() => [
|
|
1314
|
-
|
|
1314
|
+
D(U(n(w).tCurd("exportSelect")), 1)
|
|
1315
1315
|
]),
|
|
1316
1316
|
_: 1
|
|
1317
1317
|
})) : v("", !0),
|
|
1318
1318
|
V(n(G), { command: "page" }, {
|
|
1319
1319
|
default: b(() => [
|
|
1320
|
-
|
|
1320
|
+
D(U(n(w).tCurd("exportPage")), 1)
|
|
1321
1321
|
]),
|
|
1322
1322
|
_: 1
|
|
1323
1323
|
}),
|
|
1324
1324
|
V(n(G), { command: "all" }, {
|
|
1325
1325
|
default: b(() => [
|
|
1326
|
-
|
|
1326
|
+
D(U(n(w).tCurd("exportAll")), 1)
|
|
1327
1327
|
]),
|
|
1328
1328
|
_: 1
|
|
1329
1329
|
})
|
|
@@ -1333,12 +1333,12 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1333
1333
|
]),
|
|
1334
1334
|
default: b(() => [
|
|
1335
1335
|
O("div", Ke, [
|
|
1336
|
-
V(n(
|
|
1336
|
+
V(n(I), {
|
|
1337
1337
|
type: "warning",
|
|
1338
1338
|
loading: e.export.loading
|
|
1339
1339
|
}, {
|
|
1340
1340
|
default: b(() => [
|
|
1341
|
-
|
|
1341
|
+
D(U(n(w).tCurd("export")), 1)
|
|
1342
1342
|
]),
|
|
1343
1343
|
_: 1
|
|
1344
1344
|
}, 8, ["loading"])
|
|
@@ -1362,7 +1362,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1362
1362
|
]),
|
|
1363
1363
|
O("div", Pe, [
|
|
1364
1364
|
O("div", Ae, [
|
|
1365
|
-
ue((c(), y(n(be),
|
|
1365
|
+
ue((c(), y(n(be), E({
|
|
1366
1366
|
data: e.table.data,
|
|
1367
1367
|
border: p.option.table?.border === void 0 ? !0 : p.option.table?.border
|
|
1368
1368
|
}, p.option.table, {
|
|
@@ -1377,17 +1377,17 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1377
1377
|
selectable: typeof p.option.table?.selectable == "function" ? p.option.table?.selectable : void 0,
|
|
1378
1378
|
width: "55"
|
|
1379
1379
|
}, null, 8, ["selectable"])) : v("", !0),
|
|
1380
|
-
(c(!0), k(S, null,
|
|
1380
|
+
(c(!0), k(S, null, j(e.table.column.list, (t) => (c(), k(S, {
|
|
1381
1381
|
key: t.key
|
|
1382
1382
|
}, [
|
|
1383
|
-
e.table.column.show.list.includes(t.key) ? (c(), y(n(X),
|
|
1383
|
+
e.table.column.show.list.includes(t.key) ? (c(), y(n(X), E({
|
|
1384
1384
|
key: 0,
|
|
1385
1385
|
prop: t.key,
|
|
1386
1386
|
label: t.label
|
|
1387
1387
|
}, { ref_for: !0 }, t.table), {
|
|
1388
1388
|
default: b(({ row: l }) => [
|
|
1389
1389
|
p.option.table?.inlineEdit && e.inlineEdit.row === l && (t.type === "input" || t.type === "select") ? (c(), k(S, { key: 0 }, [
|
|
1390
|
-
t.type === "input" ? (c(), y(n(W),
|
|
1390
|
+
t.type === "input" ? (c(), y(n(W), E({
|
|
1391
1391
|
key: 0,
|
|
1392
1392
|
modelValue: e.inlineEdit.form[t.key],
|
|
1393
1393
|
"onUpdate:modelValue": (h) => e.inlineEdit.form[t.key] = h
|
|
@@ -1395,7 +1395,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1395
1395
|
size: "small",
|
|
1396
1396
|
style: { width: "100%" },
|
|
1397
1397
|
onKeyup: ce(e.inlineEdit.submit, ["enter"])
|
|
1398
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onKeyup"])) : t.type === "select" ? (c(), y(n(B),
|
|
1398
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onKeyup"])) : t.type === "select" ? (c(), y(n(B), E({
|
|
1399
1399
|
key: 1,
|
|
1400
1400
|
modelValue: e.inlineEdit.form[t.key],
|
|
1401
1401
|
"onUpdate:modelValue": (h) => e.inlineEdit.form[t.key] = h
|
|
@@ -1404,7 +1404,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1404
1404
|
style: { width: "100%" }
|
|
1405
1405
|
}), {
|
|
1406
1406
|
default: b(() => [
|
|
1407
|
-
(c(!0), k(S, null,
|
|
1407
|
+
(c(!0), k(S, null, j(t.options?.select?.data, (h) => (c(), y(n(K), {
|
|
1408
1408
|
key: h.value,
|
|
1409
1409
|
label: h.label,
|
|
1410
1410
|
value: h.value
|
|
@@ -1417,7 +1417,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1417
1417
|
row: l,
|
|
1418
1418
|
item: t
|
|
1419
1419
|
}, () => [
|
|
1420
|
-
t.type === "switch" ? (c(), y(n(Z),
|
|
1420
|
+
t.type === "switch" ? (c(), y(n(Z), E({
|
|
1421
1421
|
key: 0,
|
|
1422
1422
|
modelValue: l[t.key],
|
|
1423
1423
|
"onUpdate:modelValue": (h) => l[t.key] = h,
|
|
@@ -1425,7 +1425,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1425
1425
|
}, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (c(), k("span", {
|
|
1426
1426
|
key: 1,
|
|
1427
1427
|
style: se({
|
|
1428
|
-
"--table-text-click-color": n(
|
|
1428
|
+
"--table-text-click-color": n(x).config.table.click.color
|
|
1429
1429
|
}),
|
|
1430
1430
|
class: M({ "table-text-click": t.table?.click?.callback }),
|
|
1431
1431
|
onClick: (h) => t.table?.click?.callback?.(l)
|
|
@@ -1444,59 +1444,59 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1444
1444
|
}, {
|
|
1445
1445
|
default: b(({ row: t }) => [
|
|
1446
1446
|
C(a.$slots, "table-op-left", { row: t }),
|
|
1447
|
-
n(u)(p.option.tools?.add, t) ? (c(), y(n(
|
|
1447
|
+
n(u)(p.option.tools?.add, t) ? (c(), y(n(I), {
|
|
1448
1448
|
key: 0,
|
|
1449
1449
|
link: "",
|
|
1450
1450
|
type: "primary",
|
|
1451
1451
|
onClick: (l) => e.update.open(n(d).Insert, t)
|
|
1452
1452
|
}, {
|
|
1453
1453
|
default: b(() => [
|
|
1454
|
-
|
|
1454
|
+
D(U(n(w).tCurd("add")), 1)
|
|
1455
1455
|
]),
|
|
1456
1456
|
_: 1
|
|
1457
1457
|
}, 8, ["onClick"])) : v("", !0),
|
|
1458
1458
|
p.option.table?.inlineEdit && e.inlineEdit.row === t ? (c(), k(S, { key: 1 }, [
|
|
1459
|
-
V(n(
|
|
1459
|
+
V(n(I), {
|
|
1460
1460
|
link: "",
|
|
1461
1461
|
onClick: e.inlineEdit.close
|
|
1462
1462
|
}, {
|
|
1463
1463
|
default: b(() => [
|
|
1464
|
-
|
|
1464
|
+
D(U(n(w).tCurd("cancel")), 1)
|
|
1465
1465
|
]),
|
|
1466
1466
|
_: 1
|
|
1467
1467
|
}, 8, ["onClick"]),
|
|
1468
|
-
V(n(
|
|
1468
|
+
V(n(I), {
|
|
1469
1469
|
link: "",
|
|
1470
1470
|
type: "primary",
|
|
1471
1471
|
onClick: e.inlineEdit.submit,
|
|
1472
1472
|
loading: e.inlineEdit.loading
|
|
1473
1473
|
}, {
|
|
1474
1474
|
default: b(() => [
|
|
1475
|
-
|
|
1475
|
+
D(U(n(w).tCurd("confirm")), 1)
|
|
1476
1476
|
]),
|
|
1477
1477
|
_: 1
|
|
1478
1478
|
}, 8, ["onClick", "loading"]),
|
|
1479
1479
|
C(a.$slots, "table-op-edit-right", { row: t })
|
|
1480
1480
|
], 64)) : (c(), k(S, { key: 2 }, [
|
|
1481
|
-
n(u)(p.option.tools?.update, t) ? (c(), y(n(
|
|
1481
|
+
n(u)(p.option.tools?.update, t) ? (c(), y(n(I), {
|
|
1482
1482
|
key: 0,
|
|
1483
1483
|
link: "",
|
|
1484
1484
|
type: "warning",
|
|
1485
1485
|
onClick: (l) => e.update.open(n(d).Update, t)
|
|
1486
1486
|
}, {
|
|
1487
1487
|
default: b(() => [
|
|
1488
|
-
|
|
1488
|
+
D(U(n(w).tCurd("edit")), 1)
|
|
1489
1489
|
]),
|
|
1490
1490
|
_: 1
|
|
1491
1491
|
}, 8, ["onClick"])) : v("", !0),
|
|
1492
|
-
n(u)(p.option.tools?.delete, t) ? (c(), y(n(
|
|
1492
|
+
n(u)(p.option.tools?.delete, t) ? (c(), y(n(I), {
|
|
1493
1493
|
key: 1,
|
|
1494
1494
|
link: "",
|
|
1495
1495
|
type: "danger",
|
|
1496
1496
|
onClick: (l) => e.remove.open([t])
|
|
1497
1497
|
}, {
|
|
1498
1498
|
default: b(() => [
|
|
1499
|
-
|
|
1499
|
+
D(U(n(w).tCurd("delete")), 1)
|
|
1500
1500
|
]),
|
|
1501
1501
|
_: 1
|
|
1502
1502
|
}, 8, ["onClick"])) : v("", !0),
|
|
@@ -1530,7 +1530,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1530
1530
|
]),
|
|
1531
1531
|
C(a.$slots, "box-right")
|
|
1532
1532
|
]),
|
|
1533
|
-
V(n(te),
|
|
1533
|
+
V(n(te), E({
|
|
1534
1534
|
modelValue: e.update.show,
|
|
1535
1535
|
"onUpdate:modelValue": i[6] || (i[6] = (t) => e.update.show = t),
|
|
1536
1536
|
title: e.update.title,
|
|
@@ -1539,21 +1539,21 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1539
1539
|
}, p.option.dialog), {
|
|
1540
1540
|
footer: b(() => [
|
|
1541
1541
|
O("span", qe, [
|
|
1542
|
-
V(n(
|
|
1542
|
+
V(n(I), {
|
|
1543
1543
|
onClick: e.update.close
|
|
1544
1544
|
}, {
|
|
1545
1545
|
default: b(() => [
|
|
1546
|
-
|
|
1546
|
+
D(U(n(w).tCurd("close")), 1)
|
|
1547
1547
|
]),
|
|
1548
1548
|
_: 1
|
|
1549
1549
|
}, 8, ["onClick"]),
|
|
1550
|
-
V(n(
|
|
1550
|
+
V(n(I), {
|
|
1551
1551
|
type: "primary",
|
|
1552
1552
|
onClick: e.update.submit,
|
|
1553
1553
|
loading: e.update.loading
|
|
1554
1554
|
}, {
|
|
1555
1555
|
default: b(() => [
|
|
1556
|
-
|
|
1556
|
+
D(U(n(w).tCurd("submit")), 1)
|
|
1557
1557
|
]),
|
|
1558
1558
|
_: 1
|
|
1559
1559
|
}, 8, ["onClick", "loading"])
|
|
@@ -1567,7 +1567,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1567
1567
|
rules: e.update.rules
|
|
1568
1568
|
}, {
|
|
1569
1569
|
default: b(() => [
|
|
1570
|
-
e.update.showContent ? (c(!0), k(S, { key: 0 },
|
|
1570
|
+
e.update.showContent ? (c(!0), k(S, { key: 0 }, j(e.update.formColumn, (t) => (c(), k(S, null, [
|
|
1571
1571
|
n(u)(
|
|
1572
1572
|
t.map((l) => l.item.show?.form),
|
|
1573
1573
|
e.update.form
|
|
@@ -1580,7 +1580,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1580
1580
|
C(a.$slots, "form-start", {
|
|
1581
1581
|
row: e.update.form
|
|
1582
1582
|
}),
|
|
1583
|
-
(c(!0), k(S, null,
|
|
1583
|
+
(c(!0), k(S, null, j(t, (l) => (c(), k(S, null, [
|
|
1584
1584
|
n(u)(l.item.show?.form, e.update.form) ? (c(), k("div", {
|
|
1585
1585
|
key: 0,
|
|
1586
1586
|
class: M(l.item.form.span > 0 ? `col-${l.item.form.span}` : "col")
|
|
@@ -1604,59 +1604,59 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1604
1604
|
row: e.update.form,
|
|
1605
1605
|
item: l.item
|
|
1606
1606
|
}, () => [
|
|
1607
|
-
l.item.type === "input" ? (c(), y(n(W),
|
|
1607
|
+
l.item.type === "input" ? (c(), y(n(W), E({
|
|
1608
1608
|
key: 0,
|
|
1609
1609
|
modelValue: e.update.form[l.item.key],
|
|
1610
1610
|
"onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
|
|
1611
|
-
}, { ref_for: !0 }, l.item.options?.input,
|
|
1611
|
+
}, { ref_for: !0 }, l.item.options?.input, F(l.item.options?.input?.on || {}), {
|
|
1612
1612
|
disabled: e.update.getDisabled(l.item)
|
|
1613
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), y(n(Z),
|
|
1613
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), y(n(Z), E({
|
|
1614
1614
|
key: 1,
|
|
1615
1615
|
modelValue: e.update.form[l.item.key],
|
|
1616
1616
|
"onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
|
|
1617
1617
|
}, { ref_for: !0 }, l.item.options?.switch, {
|
|
1618
1618
|
disabled: e.update.getDisabled(l.item)
|
|
1619
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), y(n(B),
|
|
1619
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), y(n(B), E({
|
|
1620
1620
|
key: 2,
|
|
1621
1621
|
modelValue: e.update.form[l.item.key],
|
|
1622
1622
|
"onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
|
|
1623
|
-
}, { ref_for: !0 }, l.item.options?.select,
|
|
1623
|
+
}, { ref_for: !0 }, l.item.options?.select, F(l.item.options?.select?.on || {}), {
|
|
1624
1624
|
disabled: e.update.getDisabled(l.item),
|
|
1625
1625
|
style: { width: "100%" }
|
|
1626
1626
|
}), {
|
|
1627
1627
|
default: b(() => [
|
|
1628
|
-
(c(!0), k(S, null,
|
|
1628
|
+
(c(!0), k(S, null, j(l.item.options?.select?.data, (h) => (c(), y(n(K), {
|
|
1629
1629
|
key: h.value,
|
|
1630
1630
|
label: h.label,
|
|
1631
1631
|
value: h.value
|
|
1632
1632
|
}, null, 8, ["label", "value"]))), 128))
|
|
1633
1633
|
]),
|
|
1634
1634
|
_: 2
|
|
1635
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), y(le,
|
|
1635
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), y(le, E({
|
|
1636
1636
|
key: 3,
|
|
1637
1637
|
row: e.update.form,
|
|
1638
1638
|
field: l.item.key
|
|
1639
|
-
}, { ref_for: !0 }, l.item.options?.list,
|
|
1639
|
+
}, { ref_for: !0 }, l.item.options?.list, F(l.item.options?.list?.on || {}), {
|
|
1640
1640
|
disabled: e.update.getDisabled(l.item),
|
|
1641
1641
|
style: { width: "100%" }
|
|
1642
|
-
}), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), y(n(re),
|
|
1642
|
+
}), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), y(n(re), E({
|
|
1643
1643
|
key: 4,
|
|
1644
1644
|
modelValue: e.update.form[l.item.key],
|
|
1645
1645
|
"onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
|
|
1646
|
-
}, { ref_for: !0 }, l.item.options?.treeSelect,
|
|
1646
|
+
}, { ref_for: !0 }, l.item.options?.treeSelect, F(l.item.options?.treeSelect?.on || {}), {
|
|
1647
1647
|
disabled: e.update.getDisabled(l.item),
|
|
1648
1648
|
style: { width: "100%" }
|
|
1649
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), y(n(ee),
|
|
1649
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), y(n(ee), E({
|
|
1650
1650
|
key: 5,
|
|
1651
1651
|
modelValue: e.update.form[l.item.key],
|
|
1652
1652
|
"onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
|
|
1653
|
-
}, { ref_for: !0 }, l.item.options?.datetime,
|
|
1653
|
+
}, { ref_for: !0 }, l.item.options?.datetime, F(l.item.options?.datetime?.on || {}), {
|
|
1654
1654
|
disabled: e.update.getDisabled(l.item)
|
|
1655
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(
|
|
1655
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(z).customComponent[l.item.type] ? (c(), y(Q(n(z).customComponent[l.item.type]), E({
|
|
1656
1656
|
key: 6,
|
|
1657
1657
|
modelValue: e.update.form[l.item.key],
|
|
1658
1658
|
"onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
|
|
1659
|
-
}, { ref_for: !0 }, l.item.options?.[l.item.type],
|
|
1659
|
+
}, { ref_for: !0 }, l.item.options?.[l.item.type], F(l.item.options?.[l.item.type]?.on || {}), {
|
|
1660
1660
|
disabled: e.update.getDisabled(l.item)
|
|
1661
1661
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : v("", !0)
|
|
1662
1662
|
]),
|
|
@@ -1694,21 +1694,21 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
|
|
|
1694
1694
|
}, {
|
|
1695
1695
|
footer: b(() => [
|
|
1696
1696
|
O("span", Ge, [
|
|
1697
|
-
V(n(
|
|
1697
|
+
V(n(I), {
|
|
1698
1698
|
onClick: e.remove.close
|
|
1699
1699
|
}, {
|
|
1700
1700
|
default: b(() => [
|
|
1701
|
-
|
|
1701
|
+
D(U(n(w).tCurd("close")), 1)
|
|
1702
1702
|
]),
|
|
1703
1703
|
_: 1
|
|
1704
1704
|
}, 8, ["onClick"]),
|
|
1705
|
-
V(n(
|
|
1705
|
+
V(n(I), {
|
|
1706
1706
|
type: "danger",
|
|
1707
1707
|
onClick: e.remove.submit,
|
|
1708
1708
|
loading: e.remove.loading
|
|
1709
1709
|
}, {
|
|
1710
1710
|
default: b(() => [
|
|
1711
|
-
|
|
1711
|
+
D(U(n(w).tCurd("confirmDelete")), 1)
|
|
1712
1712
|
]),
|
|
1713
1713
|
_: 1
|
|
1714
1714
|
}, 8, ["onClick", "loading"])
|
|
@@ -1771,7 +1771,7 @@ class et {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
const Qe = (p, r) => {
|
|
1773
1773
|
if (p.component("TCurd", Xe), p.component("TFormList", le), p.component("TColumn", Ce), r?.customComponent) {
|
|
1774
|
-
|
|
1774
|
+
z.customComponent = r.customComponent;
|
|
1775
1775
|
for (const d in r.customComponent)
|
|
1776
1776
|
p.component(d, r.customComponent[d]);
|
|
1777
1777
|
}
|
|
@@ -1779,13 +1779,13 @@ const Qe = (p, r) => {
|
|
|
1779
1779
|
install: Qe
|
|
1780
1780
|
};
|
|
1781
1781
|
export {
|
|
1782
|
-
|
|
1782
|
+
L as ArrUtil,
|
|
1783
1783
|
ve as ExcelUtil,
|
|
1784
1784
|
Ce as TColumn,
|
|
1785
1785
|
Xe as TCurd,
|
|
1786
1786
|
et as TFile,
|
|
1787
|
-
|
|
1788
|
-
|
|
1787
|
+
z as TForm,
|
|
1788
|
+
x as TFormConfig,
|
|
1789
1789
|
le as TFormList,
|
|
1790
1790
|
$ as TSys,
|
|
1791
1791
|
tt as default,
|
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.cc1Form={},w.Vue,w.ElementPlus))})(this,(function(w,e,f){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,c)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(c):r):typeof s=="function"?s(c):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const c=await b.moduleObj[s]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(s,c,r={}){const m=Date.now();if(!this.tipMessages[s]||m-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=m;const h=Object.assign({message:s,type:c},r);f.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,c={})=>{this.showMessage(s,"error",c)};static success=(s,c={})=>{this.showMessage(s,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=f.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,c=!0)=>{if(c){let r=screen.width/2-500,m=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+m+", left="+r)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(c,r)=>{let m=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(m,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(d){let t=d.toDataURL("image/png");c(t)})}catch(d){r(d)}})}class E{static customComponent={};static findOptions=(s,c)=>{const r=s.column.find(h=>h.key===c),m=h=>h.replace(/-([a-z])/g,(d,t)=>t.toUpperCase());if(r)return r.options[m(r.type)]};static setOptionsData=(s,c,r)=>{const m=E.findOptions(s,c);m&&(m.data=r)};static form={openBefore:{parentId:(s,c,r,m)=>{s?c.type===b.EDialog.Insert?(c.form.parentId=s._id,c.form.sort=s.children.length+1):c.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=r.length+1),E.setOptionsData(m,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,c,r)=>{c[s]||(c[s]=[]),c[s].forEach(m=>{r.forEach(h=>{let d=h.default??"";h.type==="number"&&(d=h.default??0),h.type==="boolean"&&(d=h.default??!1),h.type==="time"&&(d=h.default??new Date),m[h.value]===void 0&&(m[h.value]=d)}),m._id||(m._id=B.getIdFun())})};static add=(s,c,r,m)=>{const h=JSONUtil.cp(r);B.setId(s,c,r),c[s].push(h.reduce((d,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),d[t.value]=n,d},{_id:B.getIdFun()})),m?.(c)};static remove=(s,c,r,m)=>{c[s]=c[s].filter(h=>h._id!==r._id),m?.(c)};static getNoIdData=(s,c)=>{const r=JSONUtil.cp(s);return r.forEach(m=>{m._id&&delete m._id,c&&m[c]&&B.getNoIdData(m[c],c)}),r}}const I={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},N=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(p,{emit:s}){const c=p,r=e.reactive({show:!1,add:(h,d,t)=>{B.add(h,d,t,()=>{m("change")})},remove:(h,d,t)=>{B.remove(h,d,t,()=>{m("change")})}});e.onMounted(()=>{B.setId(c.field,c.row,c.itemFields),r.show=!0});const m=s;return(h,d)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:d[0]||(d[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(n,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:d[1]||(d[1]=o=>m("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>r.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),z={class:"row curd-row"},F=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const c=b.isFun,r=b.EDialog,m=e.ref(),h=p,d=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||r.Insert)===r.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;d.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(d.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,g=o.reduce((x,S)=>x+S.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||g>=i||C===0&&V>1)&&(n.push(o),o=[]),u.rules&&(d.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),d.formColumn=n,d.form=JSONUtil.cp(d.formDefault)},init:async()=>{d.show=!1,await e.nextTick(),d.initColumnForm()}});return d.initColumnForm(),s({ref:m,conf:d}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:m,model:d.form,rules:d.rules},{default:e.withCtx(()=>[d.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.formColumn,i=>(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"form-start",{row:d.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(l.item.show?.form,d.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:d.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:d.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:d.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:d.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:d.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class O{static exportToExcel=async(s,c,r)=>{if(!s||s.length===0)return;const m=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return c.forEach(l=>{i[l.label]=n[l.key]}),i}),d=m.utils.json_to_sheet(h),t=m.utils.book_new();m.utils.book_append_sheet(t,d,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,m.writeFile(t,`${r}.xlsx`)}}function fe(p){return p}const R={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...c){return typeof s=="function"?s(...c):(s=String(s),s.replace(/{([^}]+)}/g,(r,m,h)=>typeof c[h]<"u"?c[h]:`{${m}}`))}static tCurd(s,...c){return this.t(this.curd[s],...c)}static curd=R}const j={class:"dialog-footer"},M=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const c=e.ref(!1),r=e.ref("确认修改"),m=e.ref("确认要修改状态吗?");let h=null,d=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(m.value=l.content),c.value=!0,new Promise((o,a)=>{h=o,d=a})),n=()=>{c.value=!1,h?.(!0),h=null,d=null},i=()=>{c.value=!1,d?.(new Error("用户取消操作")),h=null,d=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(f.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=a=>c.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",j,[e.createVNode(e.unref(f.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(m.value),1)]),_:1},8,["modelValue","title"]))}}),_=(p,s)=>{const c=p.__vccOpts||p;for(const[r,m]of s)c[r]=m;return c},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function A(p,s){return e.openBlock(),e.createElementBlock("svg",H,[...s[0]||(s[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const J=_(K,[["render",A]]);class y{static config={tableRowKey:"_id",page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},table:{click:{color:"#409EFF"}}};static setConfig=s=>{y.config=ObjectUtil.deepMerge(y.config,s)}}const W={class:"col relative cc1-form-box"},q={class:"absolute row fit",style:{overflow:"hidden"}},G={class:"col column"},X={key:0,class:"relative curd-search"},Q={class:"mb-10 flex justify-between items-center"},Y={class:"flex items-center",style:{gap:"10px"}},Z={key:0},P={key:1},v={key:2},ee={class:"export-btn"},te={class:"flex items-center",style:{gap:"10px"}},oe={class:"col fit-width relative"},le={class:"absolute column fit"},ae=["onClick"],ne={class:"row justify-end mt-10 mb-10"},re={class:"row form-item-content",style:{width:"100%"}},se={class:"col"},ie={class:"dialog-footer"},ce={class:"dialog-footer"},T=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const c=b.EDialog,r=p,m=e.ref(),h=e.ref(),d=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=k.tCurd("placeholderInput"))=>n.text?.search?.placeholder===void 0?`${i}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(n[l.key]=t.search.form[l.key])});const i=r.option.search?.before?.(n);return i&&(n=i),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(i=>{r.option.search?.resetMode==="none"?n[i]=void 0:n[i]=t.search.formDefault[i]}),t.search.form=JSONUtil.cp(n),t.page.num=1,r.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:r.option.page?.size||10,sizeList:r.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:r.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=i=>{let l=[];return i.forEach(o=>{l.push(o[y.config.tableRowKey]),o.children&&o.children.length>0&&(l=l.concat(n(o.children)))}),l};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=r.option.api.list;try{const i=await n({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()}),l=y.config.result,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=r.option.data?await r.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}}},export:{run:{start:async n=>{let i=await t.export.run[n](),l=r.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=r.option.tools?.export||{};a.before&&a.before(o),O.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()});return}const n=r.option.api.list,i=await n({[y.config.page.size]:999999,[y.config.page.num]:1});return(i.data||{[y.config.result.list]:i})[y.config.result.list]}catch(n){console.error(n)}finally{t.export.loading=!1}}},loading:!1,click:n=>{t.export.loading||t.export.run.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[y.config.tableRowKey]:t.update.edit.data[y.config.tableRowKey]};return Object.keys(t.update.edit.data).forEach(l=>{n[l]!==t.update.edit.data[l]&&(i[l]=n[l])}),i}},open:(n,i)=>{t.update.showContent||FunUtil.throttle(async()=>{const l=n===c.Insert;if(!l&&r.option.table?.inlineEdit){t.inlineEdit.open(i);return}t.update.type=n,t.update.edit.data=i,t.update.title=l?k.tCurd("add"):k.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await r.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(b.fail(k.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===c.Insert?r.option.api.create:r.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await r.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!n)return;await n({...i}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:n=>{t.inlineEdit.row=n,t.inlineEdit.form=JSONUtil.cp(n)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const n=r.option.api.update;let i=JSONUtil.cp(t.inlineEdit.form);delete i.children;try{if(!n)return;await n({...i}),t.inlineEdit.close(),await t.table.getList(),b.success(k.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail(k.tCurd("selectDataToDelete"));return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=r.option.api.delete;try{if(!n)return;await n({[y.config.tableRowKey]:t.remove.items.map(i=>i[y.config.tableRowKey]),items:t.remove.items}),b.success(k.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:y.config.tableRowKey,emptyText:k.tCurd("noData"),highlightCurrentRow:!0}},l=r.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const n=r.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:k.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:k.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await m.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[y.config.tableRowKey]:g[y.config.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(x,S,D){t.table.loading=!1}}),t.table.loading=!1,b.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(x){return console.error(x),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:y.config.tableRowKey,nodeKey:y.config.tableRowKey,multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};n.column.forEach(i),n.table?.column?.forEach(i)},initColumnForm:()=>{const n=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=r.option.form?.maxSpan||12,o=r.option.form?.defaultSpan||l/2;let a=[];const u=g=>{if(t.update.formDefault[g.key]=g.value,g.table.table&&(g.show.table&&t.table.column.show.list.push(g.key),g.table.table&&t.table.column.show.listSource.push(g.key)),g.isForm){g.form=g.form||{span:o},g.form.span=g.form.span??o;let V=g.form.span,x=a.reduce((D,U)=>D+U.span,V);const S=a.length;if(a.push({item:g,span:V}),(S===1&&a[0].span===0||x>=l||V===0&&S>1)&&(i.push(a),a=[]),g.rules){const D={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},U=(D[g.type]||D.input)+g.label;t.update.rules[g.key]=typeof g.rules=="boolean"?[{required:!0,message:U,trigger:"blur"}]:g.rules}}};n.column.forEach(g=>{g.isForm=!0,u(g)}),r.option.table?.column?.forEach(g=>{g.isForm=!1,u(g)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(g=>g.table?.table),t.search.column.list.sort((g,V)=>g.sort?.search-V.sort?.search),t.table.column.list.sort((g,V)=>g.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=r.option.search?.formDefault;C&&Object.keys(C).forEach(g=>{t.search.formDefault[g]=C[g]}),n.column.forEach(g=>{g.show?.search||(t.search.formDefault[g.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{r.option.init!==!1&&t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",q,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",G,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",X,[e.createVNode(e.unref(f.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:3,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.datetime,e.toHandlers(o.options?.datetime?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[o.type]),e.mergeProps({key:4,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.[o.type],e.toHandlers(o.options?.[o.type]?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"search-"+o.key+"-right",{row:t.search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),p.option.tools?.search||p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0},{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createElementVNode("div",Y,[e.unref(d)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(d)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",v,[e.createVNode(e.unref(f.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(f.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(f.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(f.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(f.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(f.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(f.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",te,[e.renderSlot(n.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(J)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(f.ElTable),e.mergeProps({data:t.table.data,border:p.option.table?.border===void 0?!0:p.option.table?.border},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(d)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[p.option.table?.inlineEdit&&t.inlineEdit.row===a&&(o.type==="input"||o.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:1,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(n.$slots,"table-"+o.key,{key:1,row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":e.unref(y).config.table.click.color}),class:e.normalizeClass({"table-text-click":o.table?.click?.callback}),onClick:u=>o.table?.click?.callback?.(a)},e.toDisplayString(a[o.key]),15,ae))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(d)(p.option.tools?.add)||e.unref(d)(p.option.tools?.update)||e.unref(d)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:1,label:e.unref(k).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(d)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.table?.inlineEdit&&t.inlineEdit.row===o?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(f.ElButton),{link:"",onClick:t.inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{link:"",type:"primary",onClick:t.inlineEdit.submit,loading:t.inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(n.$slots,"table-op-edit-right",{row:o})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(d)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"warning",onClick:a=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(d)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})],64))]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",ne,[e.createVNode(e.unref(f.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(f.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ie,[e.createVNode(e.unref(f.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",se,[e.renderSlot(n.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+a.item.key+"-right",{row:t.update.form,item:a.item})]),e.renderSlot(n.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(f.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ce,[e.createVNode(e.unref(f.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(M,{ref_key:"switchConfirmRef",ref:m},null,512)])}}});class de{static async download(s,c="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",c),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,c)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),m=URL.createObjectURL(r),h=document.createElement("a");h.href=m,h.download=`${c||"config"}.json`,h.click()};static importFile=async s=>new Promise((c,r)=>{const m=document.createElement("input");m.type="file";const h=s?.accept||".json";m.accept=h,m.style.display="none",m.onchange=d=>{const t=d.target.files[0];if(!t){b.fail("未选择文件"),r("未选择文件");return}const n=new FileReader;n.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;c(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(m)},document.body.appendChild(m),m.click()})}const $=(p,s)=>{if(p.component("TCurd",T),p.component("TFormList",N),p.component("TColumn",F),s?.customComponent){E.customComponent=s.customComponent;for(const c in s.customComponent)p.component(c,s.customComponent[c])}},pe={install:$};w.ArrUtil=B,w.ExcelUtil=O,w.TColumn=F,w.TCurd=T,w.TFile=de,w.TForm=E,w.TFormConfig=y,w.TFormList=N,w.TSys=b,w.default=pe,w.install=$,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.cc1Form={},w.Vue,w.ElementPlus))})(this,(function(w,e,f){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,c)=>Array.isArray(s)?s.some(n=>typeof n=="function"?n(c):n):typeof s=="function"?s(c):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const c=await b.moduleObj[s]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(s,c,n={}){const m=Date.now();if(!this.tipMessages[s]||m-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=m;const h=Object.assign({message:s,type:c},n);f.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,c={})=>{this.showMessage(s,"error",c)};static success=(s,c={})=>{this.showMessage(s,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=f.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,c=!0)=>{if(c){let n=screen.width/2-500,m=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+m+", left="+n)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(c,n)=>{let m=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(m,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(d){let t=d.toDataURL("image/png");c(t)})}catch(d){n(d)}})}class E{static customComponent={};static findOptions=(s,c)=>{const n=s.column.find(h=>h.key===c),m=h=>h.replace(/-([a-z])/g,(d,t)=>t.toUpperCase());if(n)return n.options[m(n.type)]};static setOptionsData=(s,c,n)=>{const m=E.findOptions(s,c);m&&(m.data=n)};static form={openBefore:{parentId:(s,c,n,m)=>{s?c.type===b.EDialog.Insert?(c.form.parentId=s._id,c.form.sort=s.children.length+1):c.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=n.length+1),E.setOptionsData(m,"parentId",[{_id:"0",title:"根",children:n}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,c,n)=>{c[s]||(c[s]=[]),c[s].forEach(m=>{n.forEach(h=>{let d=h.default??"";h.type==="number"&&(d=h.default??0),h.type==="boolean"&&(d=h.default??!1),h.type==="time"&&(d=h.default??new Date),m[h.value]===void 0&&(m[h.value]=d)}),m._id||(m._id=B.getIdFun())})};static add=(s,c,n,m)=>{const h=JSONUtil.cp(n);B.setId(s,c,n),c[s].push(h.reduce((d,t)=>{let r=t.default??"";return t.type==="number"&&(r=t.default??0),t.type==="boolean"&&(r=t.default??!1),t.type==="time"&&(r=t.default??new Date),d[t.value]=r,d},{_id:B.getIdFun()})),m?.(c)};static remove=(s,c,n,m)=>{c[s]=c[s].filter(h=>h._id!==n._id),m?.(c)};static getNoIdData=(s,c)=>{const n=JSONUtil.cp(s);return n.forEach(m=>{m._id&&delete m._id,c&&m[c]&&B.getNoIdData(m[c],c)}),n}}const I={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},N=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(p,{emit:s}){const c=p,n=e.reactive({show:!1,add:(h,d,t)=>{B.add(h,d,t,()=>{m("change")})},remove:(h,d,t)=>{B.remove(h,d,t,()=>{m("change")})}});e.onMounted(()=>{B.setId(c.field,c.row,c.itemFields),n.show=!0});const m=s;return(h,d)=>{const t=e.resolveComponent("el-button"),r=e.resolveComponent("el-input");return n.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:d[0]||(d[0]=i=>n.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(r,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:d[1]||(d[1]=o=>m("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>n.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),z={class:"row curd-row"},F=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const c=b.isFun,n=b.EDialog,m=e.ref(),h=p,d=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||n.Insert)===n.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;d.formColumn=[];const r=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(d.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,g=o.reduce((x,S)=>x+S.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||g>=i||C===0&&V>1)&&(r.push(o),o=[]),u.rules&&(d.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&r.push(o),d.formColumn=r,d.form=JSONUtil.cp(d.formDefault)},init:async()=>{d.show=!1,await e.nextTick(),d.initColumnForm()}});return d.initColumnForm(),s({ref:m,conf:d}),(t,r)=>(e.openBlock(),e.createBlock(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:m,model:d.form,rules:d.rules},{default:e.withCtx(()=>[d.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.formColumn,i=>(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"form-start",{row:d.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(l.item.show?.form,d.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:d.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:d.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:d.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:d.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:d.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class O{static exportToExcel=async(s,c,n)=>{if(!s||s.length===0)return;const m=await b.loadModule("xlsx"),h=s.map(r=>{const i={};return c.forEach(l=>{i[l.label]=r[l.key]}),i}),d=m.utils.json_to_sheet(h),t=m.utils.book_new();m.utils.book_append_sheet(t,d,"Sheet1"),n?typeof n=="function"&&(n=n()):n=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,m.writeFile(t,`${n}.xlsx`)}}function fe(p){return p}const R={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...c){return typeof s=="function"?s(...c):(s=String(s),s.replace(/{([^}]+)}/g,(n,m,h)=>typeof c[h]<"u"?c[h]:`{${m}}`))}static tCurd(s,...c){return this.t(this.curd[s],...c)}static curd=R}const _={class:"dialog-footer"},j=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const c=e.ref(!1),n=e.ref("确认修改"),m=e.ref("确认要修改状态吗?");let h=null,d=null;const t=l=>(l?.title&&(n.value=l.title),l?.content&&(m.value=l.content),c.value=!0,new Promise((o,a)=>{h=o,d=a})),r=()=>{c.value=!1,h?.(!0),h=null,d=null},i=()=>{c.value=!1,d?.(new Error("用户取消操作")),h=null,d=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(f.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=a=>c.value=a),title:n.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",_,[e.createVNode(e.unref(f.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:r},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(m.value),1)]),_:1},8,["modelValue","title"]))}}),M=(p,s)=>{const c=p.__vccOpts||p;for(const[n,m]of s)c[n]=m;return c},H={},K={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function A(p,s){return e.openBlock(),e.createElementBlock("svg",K,[...s[0]||(s[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const J=M(H,[["render",A]]);class y{static config={tableRowKey:"_id",page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},table:{click:{color:"#409EFF"}}};static setConfig=s=>{y.config=ObjectUtil.deepMerge(y.config,s)}}const W={class:"col relative cc1-form-box"},q={class:"absolute row fit",style:{overflow:"hidden"}},G={class:"col column"},X={key:0,class:"relative curd-search"},Q={class:"mb-10 flex justify-between items-center"},Y={class:"flex items-center",style:{gap:"10px"}},Z={key:0},P={key:1},v={key:2},ee={class:"export-btn"},te={class:"flex items-center",style:{gap:"10px"}},oe={class:"col fit-width relative"},le={class:"absolute column fit"},ae=["onClick"],re={class:"row justify-end mt-10 mb-10"},ne={class:"row form-item-content",style:{width:"100%"}},se={class:"col"},ie={class:"dialog-footer"},ce={class:"dialog-footer"},T=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const c=b.EDialog,n=p,m=e.ref(),h=e.ref(),d=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(r,i=k.tCurd("placeholderInput"))=>r.text?.search?.placeholder===void 0?`${i}${r.label}`:r.text?.search?.placeholder,getFormData:()=>{let r={};n.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(r[l.key]=t.search.form[l.key])});const i=n.option.search?.before?.(r);return i&&(r=i),r},reset:()=>{const r=t.search.formDefault;Object.keys(r).forEach(i=>{n.option.search?.resetMode==="none"?r[i]=void 0:r[i]=t.search.formDefault[i]}),t.search.form=JSONUtil.cp(r),t.page.num=1,n.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:n.option.page?.size||10,sizeList:n.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:n.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const r=i=>{let l=[];return i.forEach(o=>{l.push(o[y.config.tableRowKey]),o.children&&o.children.length>0&&(l=l.concat(r(o.children)))}),l};t.table.expand.rowKeys=r(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const r=n.option.api.list;try{const i=await r({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()}),l=y.config.result,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=n.option.data?await n.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:r=>{t.table.selection.list=r}}},export:{run:{start:async r=>{let i=await t.export.run[r](),l=n.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=n.option.tools?.export||{};a.before&&a.before(o),O.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(n.option.tools?.export?.all){await n.option.tools?.export?.all({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()});return}const r=n.option.api.list,i=await r({[y.config.page.size]:999999,[y.config.page.num]:1});return(i.data||{[y.config.result.list]:i})[y.config.result.list]}catch(r){console.error(r)}finally{t.export.loading=!1}}},loading:!1,click:r=>{t.export.loading||t.export.run.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:r=>r.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:r=>{if(n.option.form?.editAll)return r;let i={[y.config.tableRowKey]:t.update.edit.data[y.config.tableRowKey]};return Object.keys(t.update.edit.data).forEach(l=>{r[l]!==t.update.edit.data[l]&&(i[l]=r[l])}),i}},open:(r,i)=>{t.update.showContent||FunUtil.throttle(async()=>{const l=r===c.Insert;if(!l&&n.option.table?.inlineEdit){t.inlineEdit.open(i);return}t.update.type=r,t.update.edit.data=i,t.update.title=l?k.tCurd("add"):k.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await n.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,n.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(b.fail(k.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const r=t.update.type===c.Insert?n.option.api.create:n.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await n.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!r)return;await r({...i}),t.update.close(),await t.table.getList(),n.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:r=>{t.inlineEdit.row=r,t.inlineEdit.form=JSONUtil.cp(r)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const r=n.option.api.update;let i=JSONUtil.cp(t.inlineEdit.form);delete i.children;try{if(!r)return;await r({...i}),t.inlineEdit.close(),await t.table.getList(),b.success(k.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:r=>{if(r.length===0){b.fail(k.tCurd("selectDataToDelete"));return}t.remove.items=r,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const r=n.option.api.delete;try{if(!r)return;await r({[y.config.tableRowKey]:t.remove.items.map(i=>i[y.config.tableRowKey]),items:t.remove.items}),b.success(k.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:y.config.tableRowKey,emptyText:k.tCurd("noData"),highlightCurrentRow:!0}},l=n.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const r=n.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:k.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:k.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await m.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return n.option.api.update?(await n.option.api.update({[y.config.tableRowKey]:g[y.config.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(x,S,D){t.table.loading=!1}}),t.table.loading=!1,b.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(x){return console.error(x),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:y.config.tableRowKey,nodeKey:y.config.tableRowKey,multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};r.column.forEach(i),r.table?.column?.forEach(i)},initColumnForm:()=>{const r=n.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=n.option.form?.maxSpan||12,o=n.option.form?.defaultSpan||l/2;let a=[];const u=g=>{if(t.update.formDefault[g.key]=g.value,g.table.table&&(g.show.table&&t.table.column.show.list.push(g.key),g.table.table&&t.table.column.show.listSource.push(g.key)),g.isForm){g.form=g.form||{span:o},g.form.span=g.form.span??o;let V=g.form.span,x=a.reduce((D,U)=>D+U.span,V);const S=a.length;if(a.push({item:g,span:V}),(S===1&&a[0].span===0||x>=l||V===0&&S>1)&&(i.push(a),a=[]),g.rules){const D={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},U=(D[g.type]||D.input)+g.label;t.update.rules[g.key]=typeof g.rules=="boolean"?[{required:!0,message:U,trigger:"blur"}]:g.rules}}};r.column.forEach(g=>{g.isForm=!0,u(g)}),n.option.table?.column?.forEach(g=>{g.isForm=!1,u(g)}),t.search.column.list=r.column.concat(r.table?.column||[]),t.table.column.list=t.search.column.list.filter(g=>g.table?.table),t.search.column.list.sort((g,V)=>g.sort?.search-V.sort?.search),t.table.column.list.sort((g,V)=>g.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=n.option.search?.formDefault;C&&Object.keys(C).forEach(g=>{t.search.formDefault[g]=C[g]}),r.column.forEach(g=>{g.show?.search||(t.search.formDefault[g.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{n.option.init!==!1&&t.table.getList()}),s({conf:t}),(r,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",q,[e.renderSlot(r.$slots,"box-left"),e.createElementVNode("div",G,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",X,[e.createVNode(e.unref(f.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},{ref_for:!0},o.options?.input,e.toHandlers(o.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{ref_for:!0},o.options?.switch,e.toHandlers(o.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{ref_for:!0},o.options?.select,e.toHandlers(o.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:3,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.datetime,e.toHandlers(o.options?.datetime?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[o.type]),e.mergeProps({key:4,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.[o.type],e.toHandlers(o.options?.[o.type]?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(r.$slots,"search-"+o.key+"-right",{row:t.search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(r.$slots,"search-center",{row:t.search.form}),p.option.tools?.search||p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0},{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createElementVNode("div",Y,[e.unref(d)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(d)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",v,[e.createVNode(e.unref(f.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(f.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(f.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(f.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(f.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(f.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(f.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"tools-left")]),e.createElementVNode("div",te,[e.renderSlot(r.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(J)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(f.ElTable),e.mergeProps({data:t.table.data,border:p.option.table?.border===void 0?!0:p.option.table?.border},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(d)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[p.option.table?.inlineEdit&&t.inlineEdit.row===a&&(o.type==="input"||o.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:1,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(r.$slots,"table-"+o.key,{key:1,row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":e.unref(y).config.table.click.color}),class:e.normalizeClass({"table-text-click":o.table?.click?.callback}),onClick:u=>o.table?.click?.callback?.(a)},e.toDisplayString(a[o.key]),15,ae))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(d)(p.option.tools?.add)||e.unref(d)(p.option.tools?.update)||e.unref(d)(p.option.tools?.delete)||r.$slots["table-op-left"]||r.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:1,label:e.unref(k).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(r.$slots,"table-op-left",{row:o}),e.unref(d)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.table?.inlineEdit&&t.inlineEdit.row===o?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(f.ElButton),{link:"",onClick:t.inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{link:"",type:"primary",onClick:t.inlineEdit.submit,loading:t.inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(r.$slots,"table-op-edit-right",{row:o})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(d)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"warning",onClick:a=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(d)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"table-op-right",{row:o})],64))]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",re,[e.createVNode(e.unref(f.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(r.$slots,"box-right")]),e.createVNode(e.unref(f.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ie,[e.createVNode(e.unref(f.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(r.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ne,[e.renderSlot(r.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",se,[e.renderSlot(r.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(r.$slots,"form-"+a.item.key+"-right",{row:t.update.form,item:a.item})]),e.renderSlot(r.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(r.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(f.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ce,[e.createVNode(e.unref(f.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(j,{ref_key:"switchConfirmRef",ref:m},null,512)])}}});class de{static async download(s,c="download.png"){const n=document.createElement("a");n.style.display="none",n.href=s,n.setAttribute("download",c),typeof n.download>"u"&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,c)=>{const n=new Blob([JSON.stringify(s)],{type:"application/json"}),m=URL.createObjectURL(n),h=document.createElement("a");h.href=m,h.download=`${c||"config"}.json`,h.click()};static importFile=async s=>new Promise((c,n)=>{const m=document.createElement("input");m.type="file";const h=s?.accept||".json";m.accept=h,m.style.display="none",m.onchange=d=>{const t=d.target.files[0];if(!t){b.fail("未选择文件"),n("未选择文件");return}const r=new FileReader;r.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;c(l)},r.onerror=()=>{b.fail("文件读取失败"),n("文件读取失败")},r.readAsText(t),document.body.removeChild(m)},document.body.appendChild(m),m.click()})}const $=(p,s)=>{if(p.component("TCurd",T),p.component("TFormList",N),p.component("TColumn",F),s?.customComponent){E.customComponent=s.customComponent;for(const c in s.customComponent)p.component(c,s.customComponent[c])}},pe={install:$};w.ArrUtil=B,w.ExcelUtil=O,w.TColumn=F,w.TCurd=T,w.TFile=de,w.TForm=E,w.TFormConfig=y,w.TFormList=N,w.TSys=b,w.default=pe,w.install=$,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|