cc1-form 1.1.6 → 1.1.7
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.js +58 -52
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/index.vue.d.ts +23 -23
- package/package.json +1 -1
package/dist/cc1-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as B, reactive as
|
|
2
|
-
import { ElMessage as ue, ElLoading as ce, ElForm as H, ElFormItem as N, ElInput as G, ElSwitch as q, ElSelect as A, ElOption as K, ElTreeSelect as
|
|
1
|
+
import { defineComponent as B, reactive as Y, onMounted as oe, resolveComponent as te, createElementBlock as k, createCommentVNode as C, openBlock as c, renderSlot as x, createElementVNode as S, createVNode as v, withCtx as h, createTextVNode as D, Fragment as O, renderList as T, createBlock as g, normalizeClass as M, normalizeStyle as ne, ref as z, nextTick as re, unref as r, mergeProps as U, toHandlers as R, resolveDynamicComponent as le, toDisplayString as E, resolveDirective as ie, withDirectives as de } from "vue";
|
|
2
|
+
import { ElMessage as ue, ElLoading as ce, ElForm as H, ElFormItem as N, ElInput as G, ElSwitch as q, ElSelect as A, ElOption as K, ElTreeSelect as ae, ElDatePicker as X, ElDialog as Q, ElButton as F, ElDropdown as pe, ElDropdownMenu as fe, ElDropdownItem as J, ElTable as me, ElTableColumn as W, ElPagination as he } from "element-plus";
|
|
3
3
|
class $ {
|
|
4
4
|
/**
|
|
5
5
|
* 路由
|
|
@@ -289,7 +289,7 @@ const be = {
|
|
|
289
289
|
}, ye = {
|
|
290
290
|
class: "row items-center",
|
|
291
291
|
style: { gap: "10px", width: "100%" }
|
|
292
|
-
},
|
|
292
|
+
}, Z = /* @__PURE__ */ B({
|
|
293
293
|
__name: "list",
|
|
294
294
|
props: {
|
|
295
295
|
row: {
|
|
@@ -325,7 +325,7 @@ const be = {
|
|
|
325
325
|
},
|
|
326
326
|
emits: ["change"],
|
|
327
327
|
setup(p, { emit: n }) {
|
|
328
|
-
const d = p, a =
|
|
328
|
+
const d = p, a = Y({
|
|
329
329
|
show: !1,
|
|
330
330
|
add: (m, u, e) => {
|
|
331
331
|
j.add(m, u, e, () => {
|
|
@@ -338,15 +338,15 @@ const be = {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
|
-
|
|
341
|
+
oe(() => {
|
|
342
342
|
j.setId(d.field, d.row, d.itemFields), a.show = !0;
|
|
343
343
|
});
|
|
344
344
|
const f = n;
|
|
345
345
|
return (m, u) => {
|
|
346
|
-
const e =
|
|
346
|
+
const e = te("el-button"), s = te("el-input");
|
|
347
347
|
return a.show ? (c(), k("div", be, [
|
|
348
348
|
x(m.$slots, "list-start", { row: p.row }),
|
|
349
|
-
|
|
349
|
+
S("div", null, [
|
|
350
350
|
v(e, {
|
|
351
351
|
link: "",
|
|
352
352
|
type: "primary",
|
|
@@ -407,7 +407,7 @@ const be = {
|
|
|
407
407
|
}
|
|
408
408
|
},
|
|
409
409
|
setup(p, { expose: n }) {
|
|
410
|
-
const d = $.isFun, a = $.EDialog, f = z(), m = p, u =
|
|
410
|
+
const d = $.isFun, a = $.EDialog, f = z(), m = p, u = Y({
|
|
411
411
|
rules: {},
|
|
412
412
|
show: !0,
|
|
413
413
|
form: {},
|
|
@@ -468,19 +468,19 @@ const be = {
|
|
|
468
468
|
row: u.form,
|
|
469
469
|
item: o.item
|
|
470
470
|
}, () => [
|
|
471
|
-
o.item.type === "input" ? (c(), g(r(G),
|
|
471
|
+
o.item.type === "input" ? (c(), g(r(G), U({
|
|
472
472
|
key: 0,
|
|
473
473
|
modelValue: u.form[o.item.key],
|
|
474
474
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
475
475
|
}, { ref_for: !0 }, o.item.options?.input, R(o.item.options?.input?.on || {}), {
|
|
476
476
|
disabled: u.getDisabled(o.item)
|
|
477
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(r(q),
|
|
477
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(r(q), U({
|
|
478
478
|
key: 1,
|
|
479
479
|
modelValue: u.form[o.item.key],
|
|
480
480
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
481
481
|
}, { ref_for: !0 }, o.item.options?.switch, R(o.item.options?.switch?.on || {}), {
|
|
482
482
|
disabled: u.getDisabled(o.item)
|
|
483
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(r(A),
|
|
483
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(r(A), U({
|
|
484
484
|
key: 2,
|
|
485
485
|
modelValue: u.form[o.item.key],
|
|
486
486
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
@@ -496,27 +496,27 @@ const be = {
|
|
|
496
496
|
}, null, 8, ["label", "value"]))), 128))
|
|
497
497
|
]),
|
|
498
498
|
_: 2
|
|
499
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(
|
|
499
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(Z, U({
|
|
500
500
|
key: 3,
|
|
501
501
|
row: u.form,
|
|
502
502
|
field: o.item.key
|
|
503
503
|
}, { ref_for: !0 }, o.item.options?.list, R(o.item.options?.list?.on || {}), {
|
|
504
504
|
disabled: u.getDisabled(o.item),
|
|
505
505
|
style: { width: "100%" }
|
|
506
|
-
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(r(
|
|
506
|
+
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(r(ae), U({
|
|
507
507
|
key: 4,
|
|
508
508
|
modelValue: u.form[o.item.key],
|
|
509
509
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
510
510
|
}, { ref_for: !0 }, o.item.options?.treeSelect, R(o.item.options?.treeSelect?.on || {}), {
|
|
511
511
|
disabled: u.getDisabled(o.item),
|
|
512
512
|
style: { width: "100%" }
|
|
513
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(r(
|
|
513
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(r(X), U({
|
|
514
514
|
key: 5,
|
|
515
515
|
modelValue: u.form[o.item.key],
|
|
516
516
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
517
517
|
}, { ref_for: !0 }, o.item.options?.datetime, R(o.item.options?.datetime?.on || {}), {
|
|
518
518
|
disabled: u.getDisabled(o.item)
|
|
519
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : r(V).customComponent[o.item.type] ? (c(), g(
|
|
519
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : r(V).customComponent[o.item.type] ? (c(), g(le(r(V).customComponent[o.item.type]), U({
|
|
520
520
|
key: 6,
|
|
521
521
|
modelValue: u.form[o.item.key],
|
|
522
522
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
@@ -616,7 +616,7 @@ const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
|
|
|
616
616
|
};
|
|
617
617
|
return n({
|
|
618
618
|
open: e
|
|
619
|
-
}), (o, t) => (c(), g(r(
|
|
619
|
+
}), (o, t) => (c(), g(r(Q), {
|
|
620
620
|
modelValue: d.value,
|
|
621
621
|
"onUpdate:modelValue": t[0] || (t[0] = (l) => d.value = l),
|
|
622
622
|
title: a.value,
|
|
@@ -624,7 +624,7 @@ const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
|
|
|
624
624
|
width: "400px"
|
|
625
625
|
}, {
|
|
626
626
|
footer: h(() => [
|
|
627
|
-
|
|
627
|
+
S("span", ve, [
|
|
628
628
|
v(r(F), { onClick: i }, {
|
|
629
629
|
default: h(() => [...t[1] || (t[1] = [
|
|
630
630
|
D("取消", -1)
|
|
@@ -643,7 +643,7 @@ const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
|
|
|
643
643
|
])
|
|
644
644
|
]),
|
|
645
645
|
default: h(() => [
|
|
646
|
-
|
|
646
|
+
S("div", null, E(f.value), 1)
|
|
647
647
|
]),
|
|
648
648
|
_: 1
|
|
649
649
|
}, 8, ["modelValue", "title"]));
|
|
@@ -659,7 +659,7 @@ const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
|
|
|
659
659
|
};
|
|
660
660
|
function Ue(p, n) {
|
|
661
661
|
return c(), k("svg", Ee, [...n[0] || (n[0] = [
|
|
662
|
-
|
|
662
|
+
S("path", {
|
|
663
663
|
fill: "currentColor",
|
|
664
664
|
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"
|
|
665
665
|
}, null, -1)
|
|
@@ -691,7 +691,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
691
691
|
}
|
|
692
692
|
},
|
|
693
693
|
setup(p, { expose: n }) {
|
|
694
|
-
const d = $.EDialog, a = p, f = z(), m = z(), u = $.isFun, e =
|
|
694
|
+
const d = $.EDialog, a = p, f = z(), m = z(), u = $.isFun, e = Y({
|
|
695
695
|
search: {
|
|
696
696
|
column: {
|
|
697
697
|
list: []
|
|
@@ -987,7 +987,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
987
987
|
return a.option.api.update ? (await a.option.api.update({
|
|
988
988
|
[V.tableRowKey]: y[V.tableRowKey],
|
|
989
989
|
[I]: y[I] === _.activeValue ? _.inactiveValue : _.activeValue,
|
|
990
|
-
final(L, P,
|
|
990
|
+
final(L, P, ee) {
|
|
991
991
|
e.table.loading = !1;
|
|
992
992
|
}
|
|
993
993
|
}), e.table.loading = !1, $.success(w.tCurd("operationSuccess")), e.table.getList(), !0) : void 0;
|
|
@@ -1048,7 +1048,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1048
1048
|
const b = (y) => {
|
|
1049
1049
|
if (e.update.formDefault[y.key] = y.value, y.table.table && (y.show.table && e.table.column.show.list.push(y.key), y.table.table && e.table.column.show.listSource.push(y.key)), y.isForm) {
|
|
1050
1050
|
y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
|
|
1051
|
-
let _ = y.form.span, L = l.reduce((
|
|
1051
|
+
let _ = y.form.span, L = l.reduce((ee, se) => ee + se.span, _);
|
|
1052
1052
|
const P = l.length;
|
|
1053
1053
|
l.push({ item: y, span: _ }), (P === 1 && l[0].span === 0 || L >= o || _ === 0 && P > 1) && (i.push(l), l = []), y.rules && (e.update.rules[y.key] = y.rules);
|
|
1054
1054
|
}
|
|
@@ -1066,16 +1066,16 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1066
1066
|
}), e.search.form = JSONUtil.cp(e.search.formDefault);
|
|
1067
1067
|
}
|
|
1068
1068
|
});
|
|
1069
|
-
return e.init(),
|
|
1069
|
+
return e.init(), oe(() => {
|
|
1070
1070
|
e.table.getList();
|
|
1071
1071
|
}), n({
|
|
1072
1072
|
conf: e
|
|
1073
1073
|
}), (s, i) => {
|
|
1074
1074
|
const o = ie("loading");
|
|
1075
1075
|
return c(), k("div", $e, [
|
|
1076
|
-
|
|
1076
|
+
S("div", Oe, [
|
|
1077
1077
|
x(s.$slots, "box-left"),
|
|
1078
|
-
|
|
1078
|
+
S("div", Fe, [
|
|
1079
1079
|
p.option.search?.show !== !1 ? (c(), k("div", Ie, [
|
|
1080
1080
|
v(r(H), {
|
|
1081
1081
|
model: e.search.form,
|
|
@@ -1143,7 +1143,13 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1143
1143
|
}, null, 8, ["label", "value"]))), 128))
|
|
1144
1144
|
]),
|
|
1145
1145
|
_: 2
|
|
1146
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) :
|
|
1146
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "datetime" ? (c(), g(r(X), U({
|
|
1147
|
+
key: 3,
|
|
1148
|
+
modelValue: e.search.form[t.key],
|
|
1149
|
+
"onUpdate:modelValue": (l) => e.search.form[t.key] = l
|
|
1150
|
+
}, { ref_for: !0 }, t.options?.datetime, R(t.options?.datetime?.on || {}), {
|
|
1151
|
+
disabled: t.disabled?.search
|
|
1152
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
|
|
1147
1153
|
])
|
|
1148
1154
|
]),
|
|
1149
1155
|
_: 2
|
|
@@ -1183,8 +1189,8 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1183
1189
|
_: 3
|
|
1184
1190
|
}, 8, ["model"])
|
|
1185
1191
|
])) : C("", !0),
|
|
1186
|
-
|
|
1187
|
-
|
|
1192
|
+
S("div", _e, [
|
|
1193
|
+
S("div", Re, [
|
|
1188
1194
|
r(u)(p.option.tools?.add) ? (c(), k("div", Te, [
|
|
1189
1195
|
v(r(F), {
|
|
1190
1196
|
type: "primary",
|
|
@@ -1251,7 +1257,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1251
1257
|
})
|
|
1252
1258
|
]),
|
|
1253
1259
|
default: h(() => [
|
|
1254
|
-
|
|
1260
|
+
S("div", Me, [
|
|
1255
1261
|
v(r(F), {
|
|
1256
1262
|
type: "warning",
|
|
1257
1263
|
loading: e.export.loading
|
|
@@ -1267,7 +1273,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1267
1273
|
}, 8, ["onCommand"])) : C("", !0),
|
|
1268
1274
|
x(s.$slots, "tools-left")
|
|
1269
1275
|
]),
|
|
1270
|
-
|
|
1276
|
+
S("div", ze, [
|
|
1271
1277
|
x(s.$slots, "tools-right"),
|
|
1272
1278
|
p.option.tools?.refresh === void 0 || p.option.tools?.refresh ? (c(), k("div", {
|
|
1273
1279
|
key: 0,
|
|
@@ -1279,9 +1285,9 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1279
1285
|
])) : C("", !0)
|
|
1280
1286
|
])
|
|
1281
1287
|
]),
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
de((c(), g(r(me),
|
|
1288
|
+
S("div", Pe, [
|
|
1289
|
+
S("div", Ke, [
|
|
1290
|
+
de((c(), g(r(me), U({
|
|
1285
1291
|
data: e.table.data
|
|
1286
1292
|
}, p.option.table, {
|
|
1287
1293
|
onSelectionChange: e.table.selection.change,
|
|
@@ -1298,7 +1304,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1298
1304
|
(c(!0), k(O, null, T(e.table.column.list, (t) => (c(), k(O, {
|
|
1299
1305
|
key: t.key
|
|
1300
1306
|
}, [
|
|
1301
|
-
e.table.column.show.list.includes(t.key) ? (c(), g(r(W),
|
|
1307
|
+
e.table.column.show.list.includes(t.key) ? (c(), g(r(W), U({
|
|
1302
1308
|
key: 0,
|
|
1303
1309
|
prop: t.key,
|
|
1304
1310
|
label: t.label
|
|
@@ -1308,7 +1314,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1308
1314
|
row: l,
|
|
1309
1315
|
item: t
|
|
1310
1316
|
}, () => [
|
|
1311
|
-
t.type === "switch" ? (c(), g(r(q),
|
|
1317
|
+
t.type === "switch" ? (c(), g(r(q), U({
|
|
1312
1318
|
key: 0,
|
|
1313
1319
|
modelValue: l[t.key],
|
|
1314
1320
|
"onUpdate:modelValue": (b) => l[t.key] = b,
|
|
@@ -1374,7 +1380,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1374
1380
|
])
|
|
1375
1381
|
])
|
|
1376
1382
|
]),
|
|
1377
|
-
|
|
1383
|
+
S("div", Ne, [
|
|
1378
1384
|
v(r(he), {
|
|
1379
1385
|
"current-page": e.page.num,
|
|
1380
1386
|
"onUpdate:currentPage": i[4] || (i[4] = (t) => e.page.num = t),
|
|
@@ -1392,7 +1398,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1392
1398
|
]),
|
|
1393
1399
|
x(s.$slots, "box-right")
|
|
1394
1400
|
]),
|
|
1395
|
-
v(r(
|
|
1401
|
+
v(r(Q), U({
|
|
1396
1402
|
modelValue: e.update.show,
|
|
1397
1403
|
"onUpdate:modelValue": i[6] || (i[6] = (t) => e.update.show = t),
|
|
1398
1404
|
title: e.update.title,
|
|
@@ -1400,7 +1406,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1400
1406
|
"before-close": e.update.close
|
|
1401
1407
|
}, p.option.dialog), {
|
|
1402
1408
|
footer: h(() => [
|
|
1403
|
-
|
|
1409
|
+
S("span", Je, [
|
|
1404
1410
|
v(r(F), {
|
|
1405
1411
|
onClick: e.update.close
|
|
1406
1412
|
}, {
|
|
@@ -1456,29 +1462,29 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1456
1462
|
"label-width": l.item.form?.labelWidth || "100px"
|
|
1457
1463
|
}, {
|
|
1458
1464
|
default: h(() => [
|
|
1459
|
-
|
|
1465
|
+
S("div", Ae, [
|
|
1460
1466
|
x(s.$slots, "form-" + l.item.key + "-start", {
|
|
1461
1467
|
row: e.update.form,
|
|
1462
1468
|
item: l.item
|
|
1463
1469
|
}),
|
|
1464
|
-
|
|
1470
|
+
S("div", Be, [
|
|
1465
1471
|
x(s.$slots, "form-" + l.item.key, {
|
|
1466
1472
|
row: e.update.form,
|
|
1467
1473
|
item: l.item
|
|
1468
1474
|
}, () => [
|
|
1469
|
-
l.item.type === "input" ? (c(), g(r(G),
|
|
1475
|
+
l.item.type === "input" ? (c(), g(r(G), U({
|
|
1470
1476
|
key: 0,
|
|
1471
1477
|
modelValue: e.update.form[l.item.key],
|
|
1472
1478
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1473
1479
|
}, { ref_for: !0 }, l.item.options?.input, R(l.item.options?.input?.on || {}), {
|
|
1474
1480
|
disabled: e.update.getDisabled(l.item)
|
|
1475
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), g(r(q),
|
|
1481
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), g(r(q), U({
|
|
1476
1482
|
key: 1,
|
|
1477
1483
|
modelValue: e.update.form[l.item.key],
|
|
1478
1484
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1479
1485
|
}, { ref_for: !0 }, l.item.options?.switch, {
|
|
1480
1486
|
disabled: e.update.getDisabled(l.item)
|
|
1481
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), g(r(A),
|
|
1487
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), g(r(A), U({
|
|
1482
1488
|
key: 2,
|
|
1483
1489
|
modelValue: e.update.form[l.item.key],
|
|
1484
1490
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
@@ -1494,27 +1500,27 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1494
1500
|
}, null, 8, ["label", "value"]))), 128))
|
|
1495
1501
|
]),
|
|
1496
1502
|
_: 2
|
|
1497
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), g(
|
|
1503
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), g(Z, U({
|
|
1498
1504
|
key: 3,
|
|
1499
1505
|
row: e.update.form,
|
|
1500
1506
|
field: l.item.key
|
|
1501
1507
|
}, { ref_for: !0 }, l.item.options?.list, R(l.item.options?.list?.on || {}), {
|
|
1502
1508
|
disabled: e.update.getDisabled(l.item),
|
|
1503
1509
|
style: { width: "100%" }
|
|
1504
|
-
}), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), g(r(
|
|
1510
|
+
}), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), g(r(ae), U({
|
|
1505
1511
|
key: 4,
|
|
1506
1512
|
modelValue: e.update.form[l.item.key],
|
|
1507
1513
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1508
1514
|
}, { ref_for: !0 }, l.item.options?.treeSelect, R(l.item.options?.treeSelect?.on || {}), {
|
|
1509
1515
|
disabled: e.update.getDisabled(l.item),
|
|
1510
1516
|
style: { width: "100%" }
|
|
1511
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), g(r(
|
|
1517
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), g(r(X), U({
|
|
1512
1518
|
key: 5,
|
|
1513
1519
|
modelValue: e.update.form[l.item.key],
|
|
1514
1520
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1515
1521
|
}, { ref_for: !0 }, l.item.options?.datetime, R(l.item.options?.datetime?.on || {}), {
|
|
1516
1522
|
disabled: e.update.getDisabled(l.item)
|
|
1517
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : r(V).customComponent[l.item.type] ? (c(), g(
|
|
1523
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : r(V).customComponent[l.item.type] ? (c(), g(le(r(V).customComponent[l.item.type]), U({
|
|
1518
1524
|
key: 6,
|
|
1519
1525
|
modelValue: e.update.form[l.item.key],
|
|
1520
1526
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
@@ -1544,14 +1550,14 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1544
1550
|
]),
|
|
1545
1551
|
_: 3
|
|
1546
1552
|
}, 16, ["modelValue", "title", "before-close"]),
|
|
1547
|
-
v(r(
|
|
1553
|
+
v(r(Q), {
|
|
1548
1554
|
modelValue: e.remove.show,
|
|
1549
1555
|
"onUpdate:modelValue": i[7] || (i[7] = (t) => e.remove.show = t),
|
|
1550
1556
|
title: e.remove.title,
|
|
1551
1557
|
"close-on-click-modal": !1
|
|
1552
1558
|
}, {
|
|
1553
1559
|
footer: h(() => [
|
|
1554
|
-
|
|
1560
|
+
S("span", We, [
|
|
1555
1561
|
v(r(F), {
|
|
1556
1562
|
onClick: e.remove.close
|
|
1557
1563
|
}, {
|
|
@@ -1573,7 +1579,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1573
1579
|
])
|
|
1574
1580
|
]),
|
|
1575
1581
|
default: h(() => [
|
|
1576
|
-
|
|
1582
|
+
S("div", null, E(r(w).tCurd("confirmDeleteMessage", e.remove.items.length)), 1)
|
|
1577
1583
|
]),
|
|
1578
1584
|
_: 1
|
|
1579
1585
|
}, 8, ["modelValue", "title"]),
|
|
@@ -1628,7 +1634,7 @@ class Qe {
|
|
|
1628
1634
|
});
|
|
1629
1635
|
}
|
|
1630
1636
|
const Ge = (p, n) => {
|
|
1631
|
-
if (p.component("TCurd", He), p.component("TFormList",
|
|
1637
|
+
if (p.component("TCurd", He), p.component("TFormList", Z), p.component("TColumn", we), n?.customComponent) {
|
|
1632
1638
|
V.customComponent = n.customComponent;
|
|
1633
1639
|
for (const d in n.customComponent)
|
|
1634
1640
|
p.component(d, n.customComponent[d]);
|
|
@@ -1643,7 +1649,7 @@ export {
|
|
|
1643
1649
|
He as TCurd,
|
|
1644
1650
|
Qe as TFile,
|
|
1645
1651
|
V as TForm,
|
|
1646
|
-
|
|
1652
|
+
Z as TFormList,
|
|
1647
1653
|
$ as TSys,
|
|
1648
1654
|
Ye as default,
|
|
1649
1655
|
Ge as install
|
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,m){"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,d)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(d):r):typeof s=="function"?s(d):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const d=await b.moduleObj[s]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(s,d,r={}){const f=Date.now();if(!this.tipMessages[s]||f-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=f;const h=Object.assign({message:s,type:d},r);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,d={})=>{this.showMessage(s,"error",d)};static success=(s,d={})=>{this.showMessage(s,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,d=!0)=>{if(d){let r=screen.width/2-500,f=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="+f+", 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(d,r)=>{let f=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(f,{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(c){let t=c.toDataURL("image/png");d(t)})}catch(c){r(c)}})}class k{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static tableRowKey="_id";static customComponent={};static findOptions=(s,d)=>{const r=s.column.find(h=>h.key===d),f=h=>h.replace(/-([a-z])/g,(c,t)=>t.toUpperCase());if(r)return r.options[f(r.type)]};static setOptionsData=(s,d,r)=>{const f=k.findOptions(s,d);f&&(f.data=r)};static form={openBefore:{parentId:(s,d,r,f)=>{s?d.type===b.EDialog.Insert?(d.form.parentId=s._id,d.form.sort=s.children.length+1):d.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=r.length+1),k.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,d,r)=>{d[s]||(d[s]=[]),d[s].forEach(f=>{r.forEach(h=>{let c=h.default??"";h.type==="number"&&(c=h.default??0),h.type==="boolean"&&(c=h.default??!1),h.type==="time"&&(c=h.default??new Date),f[h.value]===void 0&&(f[h.value]=c)}),f._id||(f._id=B.getIdFun())})};static add=(s,d,r,f)=>{const h=JSONUtil.cp(r);B.setId(s,d,r),d[s].push(h.reduce((c,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),c[t.value]=n,c},{_id:B.getIdFun()})),f?.(d)};static remove=(s,d,r,f)=>{d[s]=d[s].filter(h=>h._id!==r._id),f?.(d)};static getNoIdData=(s,d)=>{const r=JSONUtil.cp(s);return r.forEach(f=>{f._id&&delete f._id,d&&f[d]&&B.getNoIdData(f[d],d)}),r}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},S=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 d=p,r=e.reactive({show:!1,add:(h,c,t)=>{B.add(h,c,t,()=>{f("change")})},remove:(h,c,t)=>{B.remove(h,c,t,()=>{f("change")})}});e.onMounted(()=>{B.setId(d.field,d.row,d.itemFields),r.show=!0});const f=s;return(h,c)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:c[0]||(c[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...c[2]||(c[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",$,[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:c[1]||(c[1]=o=>f("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(()=>[...c[3]||(c[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const d=b.isFun,r=b.EDialog,f=e.ref(),h=p,c=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;c.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(c.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((E,x)=>E+x.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&&(c.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),c.formColumn=n,c.form=JSONUtil.cp(c.formDefault)},init:async()=>{c.show=!1,await e.nextTick(),c.initColumnForm()}});return c.initColumnForm(),s({ref:f,conf:c}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:f,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.formColumn,i=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"form-start",{row:c.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,c.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(m.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:c.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:c.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:c.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(m.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(S,e.mergeProps({key:3,row:c.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(k).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:c.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:c.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class N{static exportToExcel=async(s,d,r)=>{if(!s||s.length===0)return;const f=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return d.forEach(l=>{i[l.label]=n[l.key]}),i}),c=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,c,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${r}.xlsx`)}}function ce(p){return p}const _={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",submit:"提交",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class y{static t(s,...d){return typeof s=="function"?s(...d):(s=String(s),s.replace(/{([^}]+)}/g,(r,f,h)=>typeof d[h]<"u"?d[h]:`{${f}}`))}static tCurd(s,...d){return this.t(this.curd[s],...d)}static curd=_}const L={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const d=e.ref(!1),r=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,c=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,a)=>{h=o,c=a})),n=()=>{d.value=!1,h?.(!0),h=null,c=null},i=()=>{d.value=!1,c?.(new Error("用户取消操作")),h=null,c=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=a=>d.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(m.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(m.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(f.value),1)]),_:1},8,["modelValue","title"]))}}),z=(p,s)=>{const d=p.__vccOpts||p;for(const[r,f]of s)d[r]=f;return d},j={},M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function H(p,s){return e.openBlock(),e.createElementBlock("svg",M,[...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 K=z(j,[["render",H]]),A={class:"col relative cc1-form-box"},J={class:"absolute row fit",style:{overflow:"hidden"}},W={class:"col column"},q={key:0,class:"relative curd-search"},G={class:"mb-10 flex justify-between items-center"},X={class:"flex items-center",style:{gap:"10px"}},Q={key:0},Y={key:1},Z={key:2},P={class:"export-btn"},v={class:"flex items-center",style:{gap:"10px"}},ee={class:"col fit-width relative"},te={class:"absolute column fit"},oe={class:"row justify-end mt-10 mb-10"},le={class:"row form-item-content",style:{width:"100%"}},ae={class:"col"},re={class:"dialog-footer"},ne={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const d=b.EDialog,r=p,f=e.ref(),h=e.ref(),c=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=y.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==="default"?n[i]=t.search.formDefault[i]:n[i]=void 0}),t.search.form=JSONUtil.cp(n),t.page.num=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[k.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({[k.pageField.size]:t.page.size,[k.pageField.num]:t.page.num,...t.search.getFormData()}),l=k.resultField,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),N.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(y.tCurd("noData")),new Error(y.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();return}const n=r.option.api.list,i=await n({[k.pageField.size]:999999,[k.pageField.num]:1});return(i.data||{[k.resultField.list]:i})[k.resultField.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:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[k.tableRowKey]:t.update.edit.data[k.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()=>{t.update.type=n;const l=n===d.Insert;t.update.edit.data=i,t.update.title=l?y.tCurd("add"):y.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(y.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===d.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)}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail(y.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({[k.tableRowKey]:t.remove.items.map(i=>i[k.tableRowKey]),items:t.remove.items}),b.success(y.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:k.tableRowKey,emptyText:y.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:y.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:y.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await f.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[k.tableRowKey]:g[k.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(E,x,T){t.table.loading=!1}}),t.table.loading=!1,b.success(y.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(E){return console.error(E),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:k.tableRowKey,nodeKey:k.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,E=a.reduce((T,de)=>T+de.span,V);const x=a.length;a.push({item:g,span:V}),(x===1&&a[0].span===0||E>=l||V===0&&x>1)&&(i.push(a),a=[]),g.rules&&(t.update.rules[g.key]=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(()=>{t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",J,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",W,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",q,[e.createVNode(e.unref(m.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(m.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(m.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(m.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(y).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.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(m.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(m.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(y).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(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(m.ElFormItem),null,{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.unref(c)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(c)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(m.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(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",v,[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(K)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:t.table.data},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(c)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(m.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(m.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.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(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(c)(p.option.tools?.add)||e.unref(c)(p.option.tools?.update)||e.unref(c)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:1,label:e.unref(y).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(c)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:a=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",oe,[e.createVNode(e.unref(m.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(m.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",re,[e.createVNode(e.unref(m.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.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(c)(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(c)(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(m.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",le,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",ae,[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(m.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(m.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(m.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(m.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(S,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(m.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(m.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(k).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k).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+"-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(m.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",ne,[e.createVNode(e.unref(m.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(y).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(R,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class se{static async download(s,d="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",d),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,d)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),f=URL.createObjectURL(r),h=document.createElement("a");h.href=f,h.download=`${d||"config"}.json`,h.click()};static importFile=async s=>new Promise((d,r)=>{const f=document.createElement("input");f.type="file";const h=s?.accept||".json";f.accept=h,f.style.display="none",f.onchange=c=>{const t=c.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;d(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const U=(p,s)=>{if(p.component("TCurd",F),p.component("TFormList",S),p.component("TColumn",D),s?.customComponent){k.customComponent=s.customComponent;for(const d in s.customComponent)p.component(d,s.customComponent[d])}},ie={install:U};w.ArrUtil=B,w.ExcelUtil=N,w.TColumn=D,w.TCurd=F,w.TFile=se,w.TForm=k,w.TFormList=S,w.TSys=b,w.default=ie,w.install=U,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,m){"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,d)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(d):r):typeof s=="function"?s(d):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const d=await b.moduleObj[s]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(s,d,r={}){const f=Date.now();if(!this.tipMessages[s]||f-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=f;const h=Object.assign({message:s,type:d},r);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,d={})=>{this.showMessage(s,"error",d)};static success=(s,d={})=>{this.showMessage(s,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,d=!0)=>{if(d){let r=screen.width/2-500,f=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="+f+", 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(d,r)=>{let f=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(f,{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(c){let t=c.toDataURL("image/png");d(t)})}catch(c){r(c)}})}class y{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static tableRowKey="_id";static customComponent={};static findOptions=(s,d)=>{const r=s.column.find(h=>h.key===d),f=h=>h.replace(/-([a-z])/g,(c,t)=>t.toUpperCase());if(r)return r.options[f(r.type)]};static setOptionsData=(s,d,r)=>{const f=y.findOptions(s,d);f&&(f.data=r)};static form={openBefore:{parentId:(s,d,r,f)=>{s?d.type===b.EDialog.Insert?(d.form.parentId=s._id,d.form.sort=s.children.length+1):d.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=r.length+1),y.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,d,r)=>{d[s]||(d[s]=[]),d[s].forEach(f=>{r.forEach(h=>{let c=h.default??"";h.type==="number"&&(c=h.default??0),h.type==="boolean"&&(c=h.default??!1),h.type==="time"&&(c=h.default??new Date),f[h.value]===void 0&&(f[h.value]=c)}),f._id||(f._id=B.getIdFun())})};static add=(s,d,r,f)=>{const h=JSONUtil.cp(r);B.setId(s,d,r),d[s].push(h.reduce((c,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),c[t.value]=n,c},{_id:B.getIdFun()})),f?.(d)};static remove=(s,d,r,f)=>{d[s]=d[s].filter(h=>h._id!==r._id),f?.(d)};static getNoIdData=(s,d)=>{const r=JSONUtil.cp(s);return r.forEach(f=>{f._id&&delete f._id,d&&f[d]&&B.getNoIdData(f[d],d)}),r}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},S=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 d=p,r=e.reactive({show:!1,add:(h,c,t)=>{B.add(h,c,t,()=>{f("change")})},remove:(h,c,t)=>{B.remove(h,c,t,()=>{f("change")})}});e.onMounted(()=>{B.setId(d.field,d.row,d.itemFields),r.show=!0});const f=s;return(h,c)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:c[0]||(c[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...c[2]||(c[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",$,[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:c[1]||(c[1]=o=>f("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(()=>[...c[3]||(c[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const d=b.isFun,r=b.EDialog,f=e.ref(),h=p,c=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;c.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(c.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((E,x)=>E+x.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&&(c.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),c.formColumn=n,c.form=JSONUtil.cp(c.formDefault)},init:async()=>{c.show=!1,await e.nextTick(),c.initColumnForm()}});return c.initColumnForm(),s({ref:f,conf:c}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:f,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.formColumn,i=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"form-start",{row:c.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,c.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(m.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:c.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:c.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:c.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(m.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(S,e.mergeProps({key:3,row:c.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(y).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:c.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:c.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class N{static exportToExcel=async(s,d,r)=>{if(!s||s.length===0)return;const f=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return d.forEach(l=>{i[l.label]=n[l.key]}),i}),c=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,c,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${r}.xlsx`)}}function ce(p){return p}const _={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",submit:"提交",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...d){return typeof s=="function"?s(...d):(s=String(s),s.replace(/{([^}]+)}/g,(r,f,h)=>typeof d[h]<"u"?d[h]:`{${f}}`))}static tCurd(s,...d){return this.t(this.curd[s],...d)}static curd=_}const L={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const d=e.ref(!1),r=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,c=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,a)=>{h=o,c=a})),n=()=>{d.value=!1,h?.(!0),h=null,c=null},i=()=>{d.value=!1,c?.(new Error("用户取消操作")),h=null,c=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=a=>d.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(m.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(m.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(f.value),1)]),_:1},8,["modelValue","title"]))}}),z=(p,s)=>{const d=p.__vccOpts||p;for(const[r,f]of s)d[r]=f;return d},j={},M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function H(p,s){return e.openBlock(),e.createElementBlock("svg",M,[...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 K=z(j,[["render",H]]),A={class:"col relative cc1-form-box"},J={class:"absolute row fit",style:{overflow:"hidden"}},W={class:"col column"},q={key:0,class:"relative curd-search"},G={class:"mb-10 flex justify-between items-center"},X={class:"flex items-center",style:{gap:"10px"}},Q={key:0},Y={key:1},Z={key:2},P={class:"export-btn"},v={class:"flex items-center",style:{gap:"10px"}},ee={class:"col fit-width relative"},te={class:"absolute column fit"},oe={class:"row justify-end mt-10 mb-10"},le={class:"row form-item-content",style:{width:"100%"}},ae={class:"col"},re={class:"dialog-footer"},ne={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const d=b.EDialog,r=p,f=e.ref(),h=e.ref(),c=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==="default"?n[i]=t.search.formDefault[i]:n[i]=void 0}),t.search.form=JSONUtil.cp(n),t.page.num=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.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.pageField.size]:t.page.size,[y.pageField.num]:t.page.num,...t.search.getFormData()}),l=y.resultField,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),N.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();return}const n=r.option.api.list,i=await n({[y.pageField.size]:999999,[y.pageField.num]:1});return(i.data||{[y.resultField.list]:i})[y.resultField.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:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[y.tableRowKey]:t.update.edit.data[y.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()=>{t.update.type=n;const l=n===d.Insert;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===d.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)}},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.tableRowKey]:t.remove.items.map(i=>i[y.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.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 f.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.tableRowKey]:g[y.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(E,x,T){t.table.loading=!1}}),t.table.loading=!1,b.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(E){return console.error(E),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:y.tableRowKey,nodeKey:y.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,E=a.reduce((T,de)=>T+de.span,V);const x=a.length;a.push({item:g,span:V}),(x===1&&a[0].span===0||E>=l||V===0&&x>1)&&(i.push(a),a=[]),g.rules&&(t.update.rules[g.key]=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(()=>{t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",J,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",W,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",q,[e.createVNode(e.unref(m.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(m.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(m.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(m.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(m.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(m.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(m.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(m.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(m.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.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(m.ElFormItem),null,{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.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(m.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.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.unref(c)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(c)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(m.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",Z,[e.createVNode(e.unref(m.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(m.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.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(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(e.unref(m.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",v,[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(K)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:t.table.data},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(c)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(m.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(m.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.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(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(c)(p.option.tools?.add)||e.unref(c)(p.option.tools?.update)||e.unref(c)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.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(c)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:a=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,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})]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",oe,[e.createVNode(e.unref(m.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(m.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",re,[e.createVNode(e.unref(m.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(m.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(m.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(c)(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(c)(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(m.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",le,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",ae,[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(m.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(m.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(m.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(m.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(S,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(m.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(m.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(y).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y).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+"-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(m.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",ne,[e.createVNode(e.unref(m.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(m.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(R,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class se{static async download(s,d="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",d),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,d)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),f=URL.createObjectURL(r),h=document.createElement("a");h.href=f,h.download=`${d||"config"}.json`,h.click()};static importFile=async s=>new Promise((d,r)=>{const f=document.createElement("input");f.type="file";const h=s?.accept||".json";f.accept=h,f.style.display="none",f.onchange=c=>{const t=c.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;d(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const U=(p,s)=>{if(p.component("TCurd",F),p.component("TFormList",S),p.component("TColumn",D),s?.customComponent){y.customComponent=s.customComponent;for(const d in s.customComponent)p.component(d,s.customComponent[d])}},ie={install:U};w.ArrUtil=B,w.ExcelUtil=N,w.TColumn=D,w.TCurd=F,w.TFile=se,w.TForm=y,w.TFormList=S,w.TSys=b,w.default=ie,w.install=U,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -348,11 +348,11 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
348
348
|
row: Record<string, any>;
|
|
349
349
|
}, __VLS_14: string, __VLS_15: {
|
|
350
350
|
row: Record<string, any>;
|
|
351
|
-
},
|
|
351
|
+
}, __VLS_45: {
|
|
352
352
|
row: Record<string, any>;
|
|
353
|
-
},
|
|
353
|
+
}, __VLS_67: {
|
|
354
354
|
row: Record<string, any>;
|
|
355
|
-
},
|
|
355
|
+
}, __VLS_121: {}, __VLS_123: {}, __VLS_146: string, __VLS_147: {
|
|
356
356
|
row: any;
|
|
357
357
|
item: {
|
|
358
358
|
key: string;
|
|
@@ -436,13 +436,13 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
436
436
|
table?: number | undefined;
|
|
437
437
|
} | undefined;
|
|
438
438
|
};
|
|
439
|
-
},
|
|
439
|
+
}, __VLS_157: {
|
|
440
440
|
row: any;
|
|
441
|
-
},
|
|
441
|
+
}, __VLS_183: {
|
|
442
442
|
row: any;
|
|
443
|
-
},
|
|
443
|
+
}, __VLS_194: {}, __VLS_206: {
|
|
444
444
|
row: any;
|
|
445
|
-
},
|
|
445
|
+
}, __VLS_213: string, __VLS_214: {
|
|
446
446
|
row: any;
|
|
447
447
|
item: {
|
|
448
448
|
key: string;
|
|
@@ -526,7 +526,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
526
526
|
table?: number | undefined;
|
|
527
527
|
} | undefined;
|
|
528
528
|
};
|
|
529
|
-
},
|
|
529
|
+
}, __VLS_217: string, __VLS_218: {
|
|
530
530
|
row: any;
|
|
531
531
|
item: {
|
|
532
532
|
key: string;
|
|
@@ -610,7 +610,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
610
610
|
table?: number | undefined;
|
|
611
611
|
} | undefined;
|
|
612
612
|
};
|
|
613
|
-
},
|
|
613
|
+
}, __VLS_252: string, __VLS_253: {
|
|
614
614
|
row: any;
|
|
615
615
|
item: {
|
|
616
616
|
key: string;
|
|
@@ -694,41 +694,41 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
694
694
|
table?: number | undefined;
|
|
695
695
|
} | undefined;
|
|
696
696
|
};
|
|
697
|
-
},
|
|
697
|
+
}, __VLS_255: {
|
|
698
698
|
row: any;
|
|
699
699
|
};
|
|
700
700
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
701
701
|
[K in NonNullable<typeof __VLS_14>]?: (props: typeof __VLS_15) => any;
|
|
702
702
|
} & {
|
|
703
|
-
[K in NonNullable<typeof
|
|
704
|
-
} & {
|
|
705
|
-
[K in NonNullable<typeof __VLS_209>]?: (props: typeof __VLS_210) => any;
|
|
703
|
+
[K in NonNullable<typeof __VLS_146>]?: (props: typeof __VLS_147) => any;
|
|
706
704
|
} & {
|
|
707
705
|
[K in NonNullable<typeof __VLS_213>]?: (props: typeof __VLS_214) => any;
|
|
708
706
|
} & {
|
|
709
|
-
[K in NonNullable<typeof
|
|
707
|
+
[K in NonNullable<typeof __VLS_217>]?: (props: typeof __VLS_218) => any;
|
|
708
|
+
} & {
|
|
709
|
+
[K in NonNullable<typeof __VLS_252>]?: (props: typeof __VLS_253) => any;
|
|
710
710
|
} & {
|
|
711
711
|
'box-left'?: (props: typeof __VLS_1) => any;
|
|
712
712
|
} & {
|
|
713
713
|
'search-start'?: (props: typeof __VLS_7) => any;
|
|
714
714
|
} & {
|
|
715
|
-
'search-center'?: (props: typeof
|
|
715
|
+
'search-center'?: (props: typeof __VLS_45) => any;
|
|
716
716
|
} & {
|
|
717
|
-
'search-end'?: (props: typeof
|
|
717
|
+
'search-end'?: (props: typeof __VLS_67) => any;
|
|
718
718
|
} & {
|
|
719
|
-
'tools-left'?: (props: typeof
|
|
719
|
+
'tools-left'?: (props: typeof __VLS_121) => any;
|
|
720
720
|
} & {
|
|
721
|
-
'tools-right'?: (props: typeof
|
|
721
|
+
'tools-right'?: (props: typeof __VLS_123) => any;
|
|
722
722
|
} & {
|
|
723
|
-
'table-op-left'?: (props: typeof
|
|
723
|
+
'table-op-left'?: (props: typeof __VLS_157) => any;
|
|
724
724
|
} & {
|
|
725
|
-
'table-op-right'?: (props: typeof
|
|
725
|
+
'table-op-right'?: (props: typeof __VLS_183) => any;
|
|
726
726
|
} & {
|
|
727
|
-
'box-right'?: (props: typeof
|
|
727
|
+
'box-right'?: (props: typeof __VLS_194) => any;
|
|
728
728
|
} & {
|
|
729
|
-
'form-start'?: (props: typeof
|
|
729
|
+
'form-start'?: (props: typeof __VLS_206) => any;
|
|
730
730
|
} & {
|
|
731
|
-
'form-end'?: (props: typeof
|
|
731
|
+
'form-end'?: (props: typeof __VLS_255) => any;
|
|
732
732
|
}>;
|
|
733
733
|
declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
734
734
|
/**
|