cc1-form 1.1.24 → 1.1.25
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 +102 -102
- package/dist/cc1-form.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/cc1-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ElMessage as ue, ElLoading as ce, ElForm as Q, ElFormItem as J, ElInput as q, ElSwitch as _, ElSelect as W, ElOption as P, ElTreeSelect as ae, ElDatePicker as ee, ElDialog as Y, ElButton as
|
|
2
|
-
import { defineComponent as N, reactive as te, onMounted as ne, resolveComponent as H, createElementBlock as w, createCommentVNode as v, openBlock as m, renderSlot as k, createElementVNode as $, createVNode as V, withCtx as h, createTextVNode as E, Fragment as D, renderList as M, createBlock as
|
|
1
|
+
import { ElMessage as ue, ElLoading as ce, ElForm as Q, ElFormItem as J, ElInput as q, ElSwitch as _, ElSelect as W, ElOption as P, ElTreeSelect as ae, ElDatePicker as ee, ElDialog as Y, ElButton as I, ElTableColumn as Z, ElDropdown as fe, ElDropdownMenu as me, ElDropdownItem as X, ElTable as pe, ElPagination as he } from "element-plus";
|
|
2
|
+
import { defineComponent as N, reactive as te, onMounted as ne, resolveComponent as H, createElementBlock as w, createCommentVNode as v, openBlock as m, renderSlot as k, createElementVNode as $, createVNode as V, withCtx as h, createTextVNode as E, Fragment as D, renderList as M, createBlock as y, normalizeClass as T, normalizeStyle as ie, ref as K, nextTick as be, unref as o, mergeProps as C, toHandlers as O, resolveDynamicComponent as G, toDisplayString as x, getCurrentInstance as ye, createSlots as se, withKeys as ge, resolveDirective as we, withDirectives as ke, normalizeProps as ve, guardReactiveProps as Ce } from "vue";
|
|
3
3
|
class U {
|
|
4
4
|
/**
|
|
5
5
|
* Vue Router 实例,需在应用初始化时赋值
|
|
@@ -647,7 +647,7 @@ const Ve = {
|
|
|
647
647
|
item: p,
|
|
648
648
|
row: t.row
|
|
649
649
|
}),
|
|
650
|
-
(m(!0), w(D, null, M(t.itemFields, (c) => (m(),
|
|
650
|
+
(m(!0), w(D, null, M(t.itemFields, (c) => (m(), y(f, {
|
|
651
651
|
modelValue: p[c.value],
|
|
652
652
|
"onUpdate:modelValue": (i) => p[c.value] = i,
|
|
653
653
|
style: ie({ width: t.inputWidth }),
|
|
@@ -703,16 +703,16 @@ const Ve = {
|
|
|
703
703
|
a.formColumn = [];
|
|
704
704
|
const f = [], p = e.option.form?.maxSpan || 12, c = e.option.form?.defaultSpan || p;
|
|
705
705
|
let i = [];
|
|
706
|
-
const d = (
|
|
707
|
-
if (a.formDefault[
|
|
708
|
-
|
|
709
|
-
let
|
|
706
|
+
const d = (b) => {
|
|
707
|
+
if (a.formDefault[b.key] = b.value, b.isForm) {
|
|
708
|
+
b.form = b.form || { span: c }, b.form.span = b.form.span ?? c;
|
|
709
|
+
let F = b.form.span, j = i.reduce((B, de) => B + de.span, F);
|
|
710
710
|
const z = i.length;
|
|
711
|
-
i.push({ item:
|
|
711
|
+
i.push({ item: b, span: F }), (z === 1 && i[0].span === 0 || j >= p || F === 0 && z > 1) && (f.push(i), i = []), b.rules && (a.rules[b.key] = b.rules);
|
|
712
712
|
}
|
|
713
713
|
};
|
|
714
|
-
u.column.forEach((
|
|
715
|
-
|
|
714
|
+
u.column.forEach((b) => {
|
|
715
|
+
b.isForm = !0, d(b);
|
|
716
716
|
}), i.length > 0 && f.push(i), a.formColumn = f, a.form = JSONUtil.cp(a.formDefault);
|
|
717
717
|
},
|
|
718
718
|
init: async () => {
|
|
@@ -722,7 +722,7 @@ const Ve = {
|
|
|
722
722
|
return a.initColumnForm(), s({
|
|
723
723
|
ref: n,
|
|
724
724
|
conf: a
|
|
725
|
-
}), (u, f) => (m(),
|
|
725
|
+
}), (u, f) => (m(), y(o(Q), {
|
|
726
726
|
ref_key: "ruleFormRef",
|
|
727
727
|
ref: n,
|
|
728
728
|
model: a.form,
|
|
@@ -752,19 +752,19 @@ const Ve = {
|
|
|
752
752
|
row: a.form,
|
|
753
753
|
item: c.item
|
|
754
754
|
}, () => [
|
|
755
|
-
c.item.type === "input" ? (m(),
|
|
755
|
+
c.item.type === "input" ? (m(), y(o(q), C({
|
|
756
756
|
key: 0,
|
|
757
757
|
modelValue: a.form[c.item.key],
|
|
758
758
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
759
759
|
}, { ref_for: !0 }, c.item.options?.input, O(c.item.options?.input?.on || {}), {
|
|
760
760
|
disabled: a.getDisabled(c.item)
|
|
761
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "switch" ? (m(),
|
|
761
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "switch" ? (m(), y(o(_), C({
|
|
762
762
|
key: 1,
|
|
763
763
|
modelValue: a.form[c.item.key],
|
|
764
764
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
765
765
|
}, { ref_for: !0 }, c.item.options?.switch, O(c.item.options?.switch?.on || {}), {
|
|
766
766
|
disabled: a.getDisabled(c.item)
|
|
767
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "select" ? (m(),
|
|
767
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "select" ? (m(), y(o(W), C({
|
|
768
768
|
key: 2,
|
|
769
769
|
modelValue: a.form[c.item.key],
|
|
770
770
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
@@ -773,34 +773,34 @@ const Ve = {
|
|
|
773
773
|
style: { width: "100%" }
|
|
774
774
|
}), {
|
|
775
775
|
default: h(() => [
|
|
776
|
-
(m(!0), w(D, null, M(c.item.options?.select?.data, (i) => (m(),
|
|
776
|
+
(m(!0), w(D, null, M(c.item.options?.select?.data, (i) => (m(), y(o(P), {
|
|
777
777
|
key: i.value,
|
|
778
778
|
label: i.label,
|
|
779
779
|
value: i.value
|
|
780
780
|
}, null, 8, ["label", "value"]))), 128))
|
|
781
781
|
]),
|
|
782
782
|
_: 2
|
|
783
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "list" ? (m(),
|
|
783
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "list" ? (m(), y(oe, C({
|
|
784
784
|
key: 3,
|
|
785
785
|
row: a.form,
|
|
786
786
|
field: c.item.key
|
|
787
787
|
}, { ref_for: !0 }, c.item.options?.list, O(c.item.options?.list?.on || {}), {
|
|
788
788
|
disabled: a.getDisabled(c.item),
|
|
789
789
|
style: { width: "100%" }
|
|
790
|
-
}), null, 16, ["row", "field", "disabled"])) : c.item.type === "tree-select" ? (m(),
|
|
790
|
+
}), null, 16, ["row", "field", "disabled"])) : c.item.type === "tree-select" ? (m(), y(o(ae), C({
|
|
791
791
|
key: 4,
|
|
792
792
|
modelValue: a.form[c.item.key],
|
|
793
793
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
794
794
|
}, { ref_for: !0 }, c.item.options?.treeSelect, O(c.item.options?.treeSelect?.on || {}), {
|
|
795
795
|
disabled: a.getDisabled(c.item),
|
|
796
796
|
style: { width: "100%" }
|
|
797
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "datetime" ? (m(),
|
|
797
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type === "datetime" ? (m(), y(o(ee), C({
|
|
798
798
|
key: 5,
|
|
799
799
|
modelValue: a.form[c.item.key],
|
|
800
800
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
801
801
|
}, { ref_for: !0 }, c.item.options?.datetime, O(c.item.options?.datetime?.on || {}), {
|
|
802
802
|
disabled: a.getDisabled(c.item)
|
|
803
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type && o(L).customComponent[c.item.type] ? (m(),
|
|
803
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type && o(L).customComponent[c.item.type] ? (m(), y(G(o(L).customComponent[c.item.type]), C({
|
|
804
804
|
key: 6,
|
|
805
805
|
modelValue: a.form[c.item.key],
|
|
806
806
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
@@ -1006,9 +1006,9 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1006
1006
|
...l.search.getFormData()
|
|
1007
1007
|
}), a = S.config.result, u = e.data || { [a.list]: e };
|
|
1008
1008
|
let f = (Array.isArray(u[a.list]), u[a.list]);
|
|
1009
|
-
const p = l.update.formColumn.flat(), c = JSONUtil.cp(f).map((i) => (Object.keys(i).forEach((
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1009
|
+
const p = l.update.formColumn.flat(), c = JSONUtil.cp(f).map((i) => (Object.keys(i).forEach((b) => {
|
|
1010
|
+
const F = p.find((j) => j.item.key === b);
|
|
1011
|
+
F && ["select", "radio"].includes(F.item.type) && (F.item.table.format || (F.item.table.format = (j) => F.item.options[F.item.type].data?.find((z) => z.value == j[b])?.label || j[b]));
|
|
1012
1012
|
}), i));
|
|
1013
1013
|
l.table.data = t.option.data ? await t.option.data(c, f) : c, l.page.total = u[a.total] || 0;
|
|
1014
1014
|
} catch (e) {
|
|
@@ -1350,16 +1350,16 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1350
1350
|
let f = [];
|
|
1351
1351
|
const p = (d) => {
|
|
1352
1352
|
if (d.children) {
|
|
1353
|
-
l.table.column.show.list.push(d.key), d.children.forEach((
|
|
1354
|
-
p(
|
|
1353
|
+
l.table.column.show.list.push(d.key), d.children.forEach((b) => {
|
|
1354
|
+
p(b);
|
|
1355
1355
|
});
|
|
1356
1356
|
return;
|
|
1357
1357
|
}
|
|
1358
1358
|
if (l.update.formDefault[d.key] = d.value, d.table.table && (d.show.table && l.table.column.show.list.push(d.key), d.table.table && l.table.column.show.listSource.push(d.key)), d.isForm) {
|
|
1359
1359
|
d.form = d.form || { span: u }, d.form.span = d.form.span ?? u;
|
|
1360
|
-
let
|
|
1360
|
+
let b = d.form.span, F = f.reduce((z, B) => z + B.span, b);
|
|
1361
1361
|
const j = f.length;
|
|
1362
|
-
if (f.push({ item: d, span:
|
|
1362
|
+
if (f.push({ item: d, span: b }), (j === 1 && f[0].span === 0 || F >= a || b === 0 && j > 1) && (e.push(f), f = []), d.rules) {
|
|
1363
1363
|
const z = {
|
|
1364
1364
|
input: g.tCurd("placeholderInput"),
|
|
1365
1365
|
select: g.tCurd("placeholderSelect")
|
|
@@ -1373,14 +1373,14 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1373
1373
|
] : d.rules;
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
|
-
}, c = (d,
|
|
1377
|
-
d.isForm =
|
|
1376
|
+
}, c = (d, b) => {
|
|
1377
|
+
d.isForm = b, Array.isArray(d.children) && d.children.forEach((F) => c(F, b));
|
|
1378
1378
|
};
|
|
1379
1379
|
n.column.forEach((d) => {
|
|
1380
1380
|
d.isForm = !0, c(d, !0), p(d);
|
|
1381
1381
|
}), t.option.table?.column?.forEach((d) => {
|
|
1382
1382
|
c(d, !1), p(d);
|
|
1383
|
-
}), l.search.column.list = n.column.concat(n.table?.column || []), l.table.column.list = l.search.column.list.filter((d) => d.table?.table), l.search.column.list.sort((d,
|
|
1383
|
+
}), l.search.column.list = n.column.concat(n.table?.column || []), l.table.column.list = l.search.column.list.filter((d) => d.table?.table), l.search.column.list.sort((d, b) => d.sort?.search - b.sort?.search), l.table.column.list.sort((d, b) => d.sort?.table - b.sort?.table), f.length > 0 && e.push(f), l.update.formColumn = e;
|
|
1384
1384
|
const i = t.option.search?.formDefault;
|
|
1385
1385
|
i && Object.keys(i).forEach((d) => {
|
|
1386
1386
|
l.search.formDefault[d] = i[d];
|
|
@@ -1406,7 +1406,7 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1406
1406
|
};
|
|
1407
1407
|
return s({
|
|
1408
1408
|
open: u
|
|
1409
|
-
}), (c, i) => (m(),
|
|
1409
|
+
}), (c, i) => (m(), y(o(Y), {
|
|
1410
1410
|
modelValue: r.value,
|
|
1411
1411
|
"onUpdate:modelValue": i[0] || (i[0] = (d) => r.value = d),
|
|
1412
1412
|
title: l.value,
|
|
@@ -1415,13 +1415,13 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1415
1415
|
}, {
|
|
1416
1416
|
footer: h(() => [
|
|
1417
1417
|
$("span", Oe, [
|
|
1418
|
-
V(o(
|
|
1418
|
+
V(o(I), { onClick: p }, {
|
|
1419
1419
|
default: h(() => [...i[1] || (i[1] = [
|
|
1420
1420
|
E("取消", -1)
|
|
1421
1421
|
])]),
|
|
1422
1422
|
_: 1
|
|
1423
1423
|
}),
|
|
1424
|
-
V(o(
|
|
1424
|
+
V(o(I), {
|
|
1425
1425
|
type: "primary",
|
|
1426
1426
|
onClick: f
|
|
1427
1427
|
}, {
|
|
@@ -1482,7 +1482,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1482
1482
|
return m(!0), w(D, null, M(t.columnList, (a) => (m(), w(D, {
|
|
1483
1483
|
key: a.key
|
|
1484
1484
|
}, [
|
|
1485
|
-
t.conf.table.column.show.list.includes(a.key) ? (m(),
|
|
1485
|
+
t.conf.table.column.show.list.includes(a.key) ? (m(), y(o(Z), C({
|
|
1486
1486
|
key: 0,
|
|
1487
1487
|
prop: a.key,
|
|
1488
1488
|
label: a.label
|
|
@@ -1490,7 +1490,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1490
1490
|
header: h(() => [
|
|
1491
1491
|
k(l.$slots, "table-header-" + a.key, { item: a }, () => [
|
|
1492
1492
|
$("div", Pe, [
|
|
1493
|
-
a.table?.tooltip ? (m(),
|
|
1493
|
+
a.table?.tooltip ? (m(), y(e, {
|
|
1494
1494
|
key: 0,
|
|
1495
1495
|
effect: "dark",
|
|
1496
1496
|
content: a.table?.tooltip,
|
|
@@ -1510,7 +1510,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1510
1510
|
default: h(({ row: u }) => [
|
|
1511
1511
|
a.children ? (m(), w(D, { key: 0 }, [
|
|
1512
1512
|
n[0] || (n[0] = E(" ", -1)),
|
|
1513
|
-
(m(),
|
|
1513
|
+
(m(), y(G(o(r)), {
|
|
1514
1514
|
conf: t.conf,
|
|
1515
1515
|
columnList: a.children,
|
|
1516
1516
|
option: t.option
|
|
@@ -1524,7 +1524,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1524
1524
|
]), 1032, ["conf", "columnList", "option"]))
|
|
1525
1525
|
], 64)) : (m(), w(D, { key: 1 }, [
|
|
1526
1526
|
o(s)(a.show?.form, t.conf.inlineEdit.form, o(U).EDialog.Update) && t.option.table?.inlineEdit && t.conf.inlineEdit.row === u && (a.type === "input" || a.type === "select") ? (m(), w(D, { key: 0 }, [
|
|
1527
|
-
a.type === "input" ? (m(),
|
|
1527
|
+
a.type === "input" ? (m(), y(o(q), C({
|
|
1528
1528
|
key: 0,
|
|
1529
1529
|
modelValue: t.conf.inlineEdit.form[a.key],
|
|
1530
1530
|
"onUpdate:modelValue": (f) => t.conf.inlineEdit.form[a.key] = f
|
|
@@ -1532,7 +1532,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1532
1532
|
size: "small",
|
|
1533
1533
|
style: { width: "100%" },
|
|
1534
1534
|
onKeyup: ge(t.conf.inlineEdit.submit, ["enter"])
|
|
1535
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onKeyup"])) : a.type === "select" ? (m(),
|
|
1535
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onKeyup"])) : a.type === "select" ? (m(), y(o(W), C({
|
|
1536
1536
|
key: 1,
|
|
1537
1537
|
modelValue: t.conf.inlineEdit.form[a.key],
|
|
1538
1538
|
"onUpdate:modelValue": (f) => t.conf.inlineEdit.form[a.key] = f
|
|
@@ -1541,7 +1541,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1541
1541
|
style: { width: "100%" }
|
|
1542
1542
|
}), {
|
|
1543
1543
|
default: h(() => [
|
|
1544
|
-
(m(!0), w(D, null, M(a.options?.select?.data, (f) => (m(),
|
|
1544
|
+
(m(!0), w(D, null, M(a.options?.select?.data, (f) => (m(), y(o(P), {
|
|
1545
1545
|
key: f.value,
|
|
1546
1546
|
label: f.label,
|
|
1547
1547
|
value: f.value
|
|
@@ -1554,7 +1554,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1554
1554
|
row: u,
|
|
1555
1555
|
item: a
|
|
1556
1556
|
}, () => [
|
|
1557
|
-
a.type === "switch" ? (m(),
|
|
1557
|
+
a.type === "switch" ? (m(), y(o(_), C({
|
|
1558
1558
|
key: 0,
|
|
1559
1559
|
modelValue: u[a.key],
|
|
1560
1560
|
"onUpdate:modelValue": (f) => u[a.key] = f,
|
|
@@ -1584,19 +1584,19 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1584
1584
|
setup(t) {
|
|
1585
1585
|
return (s, r) => {
|
|
1586
1586
|
const l = H("el-radio"), n = H("el-radio-group");
|
|
1587
|
-
return t.item.item.type === "input" ? (m(),
|
|
1587
|
+
return t.item.item.type === "input" ? (m(), y(o(q), C({
|
|
1588
1588
|
key: 0,
|
|
1589
1589
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1590
1590
|
"onUpdate:modelValue": r[0] || (r[0] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1591
1591
|
}, t.item.item.options?.input, O(t.item.item.options?.input?.on || {}), {
|
|
1592
1592
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1593
|
-
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "switch" ? (m(),
|
|
1593
|
+
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "switch" ? (m(), y(o(_), C({
|
|
1594
1594
|
key: 1,
|
|
1595
1595
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1596
1596
|
"onUpdate:modelValue": r[1] || (r[1] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1597
1597
|
}, t.item.item.options?.switch, {
|
|
1598
1598
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1599
|
-
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "select" ? (m(),
|
|
1599
|
+
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "select" ? (m(), y(o(W), C({
|
|
1600
1600
|
key: 2,
|
|
1601
1601
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1602
1602
|
"onUpdate:modelValue": r[2] || (r[2] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
@@ -1605,14 +1605,14 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1605
1605
|
style: { width: "100%" }
|
|
1606
1606
|
}), {
|
|
1607
1607
|
default: h(() => [
|
|
1608
|
-
(m(!0), w(D, null, M(t.item.item.options?.select?.data, (e) => (m(),
|
|
1608
|
+
(m(!0), w(D, null, M(t.item.item.options?.select?.data, (e) => (m(), y(o(P), {
|
|
1609
1609
|
key: e.value,
|
|
1610
1610
|
label: e.label,
|
|
1611
1611
|
value: e.value
|
|
1612
1612
|
}, null, 8, ["label", "value"]))), 128))
|
|
1613
1613
|
]),
|
|
1614
1614
|
_: 1
|
|
1615
|
-
}, 16, ["modelValue", "disabled"])) : t.item.item.type === "radio" ? (m(),
|
|
1615
|
+
}, 16, ["modelValue", "disabled"])) : t.item.item.type === "radio" ? (m(), y(n, C({
|
|
1616
1616
|
key: 3,
|
|
1617
1617
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1618
1618
|
"onUpdate:modelValue": r[3] || (r[3] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
@@ -1621,34 +1621,34 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1621
1621
|
style: { width: "100%" }
|
|
1622
1622
|
}), {
|
|
1623
1623
|
default: h(() => [
|
|
1624
|
-
(m(!0), w(D, null, M(t.item.item.options?.radio?.data, (e) => (m(),
|
|
1624
|
+
(m(!0), w(D, null, M(t.item.item.options?.radio?.data, (e) => (m(), y(l, {
|
|
1625
1625
|
key: e.value,
|
|
1626
1626
|
label: e.label,
|
|
1627
1627
|
value: e.value
|
|
1628
1628
|
}, null, 8, ["label", "value"]))), 128))
|
|
1629
1629
|
]),
|
|
1630
1630
|
_: 1
|
|
1631
|
-
}, 16, ["modelValue", "disabled"])) : t.item.item.type === "list" ? (m(),
|
|
1631
|
+
}, 16, ["modelValue", "disabled"])) : t.item.item.type === "list" ? (m(), y(oe, C({
|
|
1632
1632
|
key: 4,
|
|
1633
1633
|
row: t.conf.update.form,
|
|
1634
1634
|
field: t.item.item.key
|
|
1635
1635
|
}, t.item.item.options?.list, O(t.item.item.options?.list?.on || {}), {
|
|
1636
1636
|
disabled: t.conf.update.getDisabled(t.item.item),
|
|
1637
1637
|
style: { width: "100%" }
|
|
1638
|
-
}), null, 16, ["row", "field", "disabled"])) : t.item.item.type === "tree-select" ? (m(),
|
|
1638
|
+
}), null, 16, ["row", "field", "disabled"])) : t.item.item.type === "tree-select" ? (m(), y(o(ae), C({
|
|
1639
1639
|
key: 5,
|
|
1640
1640
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1641
1641
|
"onUpdate:modelValue": r[4] || (r[4] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1642
1642
|
}, t.item.item.options?.treeSelect, O(t.item.item.options?.treeSelect?.on || {}), {
|
|
1643
1643
|
disabled: t.conf.update.getDisabled(t.item.item),
|
|
1644
1644
|
style: { width: "100%" }
|
|
1645
|
-
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "datetime" ? (m(),
|
|
1645
|
+
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "datetime" ? (m(), y(o(ee), C({
|
|
1646
1646
|
key: 6,
|
|
1647
1647
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1648
1648
|
"onUpdate:modelValue": r[5] || (r[5] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1649
1649
|
}, t.item.item.options?.datetime, O(t.item.item.options?.datetime?.on || {}), {
|
|
1650
1650
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1651
|
-
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type && o(L).customComponent[t.item.item.type] ? (m(),
|
|
1651
|
+
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type && o(L).customComponent[t.item.item.type] ? (m(), y(G(o(L).customComponent[t.item.item.type]), C({
|
|
1652
1652
|
key: 7,
|
|
1653
1653
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1654
1654
|
"onUpdate:modelValue": r[6] || (r[6] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
@@ -1707,7 +1707,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1707
1707
|
(m(!0), w(D, null, M(o(e).search.column.list, (i) => (m(), w(D, {
|
|
1708
1708
|
key: i.key
|
|
1709
1709
|
}, [
|
|
1710
|
-
(typeof i.show?.search == "function" ? i.show?.search(o(e).search.form) : i.show?.search) ? (m(),
|
|
1710
|
+
(typeof i.show?.search == "function" ? i.show?.search(o(e).search.form) : i.show?.search) ? (m(), y(o(J), {
|
|
1711
1711
|
key: 0,
|
|
1712
1712
|
label: typeof i.text?.search?.label == "string" ? i.text?.search?.label : i.label,
|
|
1713
1713
|
class: T({
|
|
@@ -1718,14 +1718,14 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1718
1718
|
k(f.$slots, "search-" + i.key, {
|
|
1719
1719
|
row: o(e).search.form
|
|
1720
1720
|
}, () => [
|
|
1721
|
-
i.type === "input" ? (m(),
|
|
1721
|
+
i.type === "input" ? (m(), y(o(q), C({
|
|
1722
1722
|
key: 0,
|
|
1723
1723
|
modelValue: o(e).search.form[i.key],
|
|
1724
1724
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d,
|
|
1725
1725
|
placeholder: o(e).search.getPlaceholder(i),
|
|
1726
1726
|
clearable: "",
|
|
1727
1727
|
disabled: i.disabled?.search
|
|
1728
|
-
}, { ref_for: !0 }, i.options?.input, O(i.options?.input?.on || {})), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : i.type === "switch" ? (m(),
|
|
1728
|
+
}, { ref_for: !0 }, i.options?.input, O(i.options?.input?.on || {})), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : i.type === "switch" ? (m(), y(o(W), C({
|
|
1729
1729
|
key: 1,
|
|
1730
1730
|
modelValue: o(e).search.form[i.key],
|
|
1731
1731
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d,
|
|
@@ -1734,19 +1734,19 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1734
1734
|
disabled: i.disabled?.search
|
|
1735
1735
|
}, { ref_for: !0 }, i.options?.switch, O(i.options?.switch?.on || {})), {
|
|
1736
1736
|
default: h(() => [
|
|
1737
|
-
(m(),
|
|
1737
|
+
(m(), y(o(P), {
|
|
1738
1738
|
key: i.options?.switch?.activeValue,
|
|
1739
1739
|
label: i.options?.switch?.activeLabel,
|
|
1740
1740
|
value: i.options?.switch?.activeValue
|
|
1741
1741
|
}, null, 8, ["label", "value"])),
|
|
1742
|
-
(m(),
|
|
1742
|
+
(m(), y(o(P), {
|
|
1743
1743
|
key: i.options?.switch?.inactiveValue,
|
|
1744
1744
|
label: i.options?.switch?.inactiveLabel,
|
|
1745
1745
|
value: i.options?.switch?.inactiveValue
|
|
1746
1746
|
}, null, 8, ["label", "value"]))
|
|
1747
1747
|
]),
|
|
1748
1748
|
_: 2
|
|
1749
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : i.type === "select" ? (m(),
|
|
1749
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : i.type === "select" ? (m(), y(o(W), C({
|
|
1750
1750
|
key: 2,
|
|
1751
1751
|
modelValue: o(e).search.form[i.key],
|
|
1752
1752
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d,
|
|
@@ -1755,20 +1755,20 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1755
1755
|
disabled: i.disabled?.search
|
|
1756
1756
|
}, { ref_for: !0 }, i.options?.select, O(i.options?.select?.on || {})), {
|
|
1757
1757
|
default: h(() => [
|
|
1758
|
-
(m(!0), w(D, null, M(i.options?.select?.data, (d) => (m(),
|
|
1758
|
+
(m(!0), w(D, null, M(i.options?.select?.data, (d) => (m(), y(o(P), {
|
|
1759
1759
|
key: d.value,
|
|
1760
1760
|
label: d.label,
|
|
1761
1761
|
value: d.value
|
|
1762
1762
|
}, null, 8, ["label", "value"]))), 128))
|
|
1763
1763
|
]),
|
|
1764
1764
|
_: 2
|
|
1765
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : i.type === "datetime" ? (m(),
|
|
1765
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : i.type === "datetime" ? (m(), y(o(ee), C({
|
|
1766
1766
|
key: 3,
|
|
1767
1767
|
modelValue: o(e).search.form[i.key],
|
|
1768
1768
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d
|
|
1769
1769
|
}, { ref_for: !0 }, i.options?.datetime, O(i.options?.datetime?.on || {}), {
|
|
1770
1770
|
disabled: i.disabled?.search
|
|
1771
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : i.type && o(L).customComponent[i.type] ? (m(),
|
|
1771
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : i.type && o(L).customComponent[i.type] ? (m(), y(G(o(L).customComponent[i.type]), C({
|
|
1772
1772
|
key: 4,
|
|
1773
1773
|
modelValue: o(e).search.form[i.key],
|
|
1774
1774
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d
|
|
@@ -1786,9 +1786,9 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1786
1786
|
k(f.$slots, "search-center", {
|
|
1787
1787
|
row: o(e).search.form
|
|
1788
1788
|
}),
|
|
1789
|
-
t.option.tools?.search || t.option.tools?.reset ? (m(),
|
|
1789
|
+
t.option.tools?.search || t.option.tools?.reset ? (m(), y(o(J), { key: 0 }, {
|
|
1790
1790
|
default: h(() => [
|
|
1791
|
-
t.option.tools?.search ? (m(),
|
|
1791
|
+
t.option.tools?.search ? (m(), y(o(I), {
|
|
1792
1792
|
key: 0,
|
|
1793
1793
|
type: "primary",
|
|
1794
1794
|
onClick: o(e).search.submit
|
|
@@ -1798,7 +1798,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1798
1798
|
]),
|
|
1799
1799
|
_: 1
|
|
1800
1800
|
}, 8, ["onClick"])) : v("", !0),
|
|
1801
|
-
t.option.tools?.reset ? (m(),
|
|
1801
|
+
t.option.tools?.reset ? (m(), y(o(I), {
|
|
1802
1802
|
key: 1,
|
|
1803
1803
|
onClick: o(e).search.reset
|
|
1804
1804
|
}, {
|
|
@@ -1820,7 +1820,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1820
1820
|
$("div", Ge, [
|
|
1821
1821
|
$("div", Xe, [
|
|
1822
1822
|
o(n)(t.option.tools?.add) ? (m(), w("div", Qe, [
|
|
1823
|
-
V(o(
|
|
1823
|
+
V(o(I), {
|
|
1824
1824
|
type: "primary",
|
|
1825
1825
|
onClick: p[0] || (p[0] = (i) => o(e).update.open(o(r).Insert))
|
|
1826
1826
|
}, {
|
|
@@ -1831,7 +1831,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1831
1831
|
})
|
|
1832
1832
|
])) : v("", !0),
|
|
1833
1833
|
t.option.table?.selectable && o(n)(t.option.tools?.delete) ? (m(), w("div", Ye, [
|
|
1834
|
-
V(o(
|
|
1834
|
+
V(o(I), {
|
|
1835
1835
|
type: "danger",
|
|
1836
1836
|
onClick: p[1] || (p[1] = (i) => o(e).remove.open(o(e).table.selection.list))
|
|
1837
1837
|
}, {
|
|
@@ -1842,7 +1842,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1842
1842
|
})
|
|
1843
1843
|
])) : v("", !0),
|
|
1844
1844
|
t.option.tools?.expand ? (m(), w("div", Ze, [
|
|
1845
|
-
V(o(
|
|
1845
|
+
V(o(I), {
|
|
1846
1846
|
type: "warning",
|
|
1847
1847
|
onClick: p[2] || (p[2] = (i) => o(e).table.expand.all())
|
|
1848
1848
|
}, {
|
|
@@ -1852,14 +1852,14 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1852
1852
|
_: 1
|
|
1853
1853
|
})
|
|
1854
1854
|
])) : v("", !0),
|
|
1855
|
-
t.option.tools?.export?.show ? (m(),
|
|
1855
|
+
t.option.tools?.export?.show ? (m(), y(o(fe), {
|
|
1856
1856
|
key: 3,
|
|
1857
1857
|
onCommand: o(e).export.click
|
|
1858
1858
|
}, {
|
|
1859
1859
|
dropdown: h(() => [
|
|
1860
1860
|
V(o(me), null, {
|
|
1861
1861
|
default: h(() => [
|
|
1862
|
-
t.option.table?.selectable ? (m(),
|
|
1862
|
+
t.option.table?.selectable ? (m(), y(o(X), {
|
|
1863
1863
|
key: 0,
|
|
1864
1864
|
command: "select"
|
|
1865
1865
|
}, {
|
|
@@ -1886,7 +1886,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1886
1886
|
]),
|
|
1887
1887
|
default: h(() => [
|
|
1888
1888
|
$("div", _e, [
|
|
1889
|
-
V(o(
|
|
1889
|
+
V(o(I), {
|
|
1890
1890
|
type: "warning",
|
|
1891
1891
|
loading: o(e).export.loading
|
|
1892
1892
|
}, {
|
|
@@ -1915,7 +1915,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1915
1915
|
]),
|
|
1916
1916
|
$("div", tt, [
|
|
1917
1917
|
$("div", ot, [
|
|
1918
|
-
ke((m(),
|
|
1918
|
+
ke((m(), y(o(pe), C({
|
|
1919
1919
|
data: o(e).table.data,
|
|
1920
1920
|
border: t.option.table?.border === void 0 ? !0 : t.option.table?.border
|
|
1921
1921
|
}, t.option.table, {
|
|
@@ -1924,7 +1924,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1924
1924
|
onExpandChange: o(e).table.expand.change
|
|
1925
1925
|
}), {
|
|
1926
1926
|
default: h(() => [
|
|
1927
|
-
t.option.table?.selectable || o(n)(t.option.tools?.delete) || t.option.tools?.export?.show ? (m(),
|
|
1927
|
+
t.option.table?.selectable || o(n)(t.option.tools?.delete) || t.option.tools?.export?.show ? (m(), y(o(Z), {
|
|
1928
1928
|
key: 0,
|
|
1929
1929
|
type: "selection",
|
|
1930
1930
|
selectable: typeof t.option.table?.selectable == "function" ? t.option.table?.selectable : void 0,
|
|
@@ -1937,12 +1937,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1937
1937
|
}, se({ _: 2 }, [
|
|
1938
1938
|
M(f.$slots, (i, d) => ({
|
|
1939
1939
|
name: d,
|
|
1940
|
-
fn: h((
|
|
1941
|
-
k(f.$slots, d, ve(Ce(
|
|
1940
|
+
fn: h((b) => [
|
|
1941
|
+
k(f.$slots, d, ve(Ce(b || {})))
|
|
1942
1942
|
])
|
|
1943
1943
|
}))
|
|
1944
1944
|
]), 1032, ["conf", "columnList", "option"]),
|
|
1945
|
-
o(n)(t.option.table?.add) || o(n)(t.option.table?.update) || o(n)(t.option.table?.delete) || o(n)(t.option.table?.view) || f.$slots["table-op-left"] || f.$slots["table-op-right"] ? (m(),
|
|
1945
|
+
o(n)(t.option.table?.add) || o(n)(t.option.table?.update) || o(n)(t.option.table?.delete) || o(n)(t.option.table?.view) || f.$slots["table-op-left"] || f.$slots["table-op-right"] ? (m(), y(o(Z), C({
|
|
1946
1946
|
key: 1,
|
|
1947
1947
|
width: o(e).table.op.width(o(n)(t.option.table?.add), o(n)(t.option.table?.update), o(n)(t.option.table?.delete), o(n)(t.option.table?.view), f.$slots["table-op-left"], f.$slots["table-op-right"]),
|
|
1948
1948
|
align: "center",
|
|
@@ -1956,7 +1956,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1956
1956
|
default: h(({ row: i }) => [
|
|
1957
1957
|
k(f.$slots, "table-op-left", { row: i }),
|
|
1958
1958
|
t.option.table?.inlineEdit && o(e).inlineEdit.row === i ? (m(), w(D, { key: 0 }, [
|
|
1959
|
-
V(o(
|
|
1959
|
+
V(o(I), {
|
|
1960
1960
|
link: "",
|
|
1961
1961
|
type: "info",
|
|
1962
1962
|
onClick: o(e).inlineEdit.close
|
|
@@ -1966,7 +1966,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1966
1966
|
]),
|
|
1967
1967
|
_: 1
|
|
1968
1968
|
}, 8, ["onClick"]),
|
|
1969
|
-
V(o(
|
|
1969
|
+
V(o(I), {
|
|
1970
1970
|
link: "",
|
|
1971
1971
|
type: "primary",
|
|
1972
1972
|
onClick: o(e).inlineEdit.submit,
|
|
@@ -1979,7 +1979,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1979
1979
|
}, 8, ["onClick", "loading"]),
|
|
1980
1980
|
k(f.$slots, "table-op-edit-right", { row: i })
|
|
1981
1981
|
], 64)) : (m(), w(D, { key: 1 }, [
|
|
1982
|
-
o(n)(t.option.table?.add, i) ? (m(),
|
|
1982
|
+
o(n)(t.option.table?.add, i) ? (m(), y(o(I), {
|
|
1983
1983
|
key: 0,
|
|
1984
1984
|
link: "",
|
|
1985
1985
|
type: "primary",
|
|
@@ -1990,7 +1990,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1990
1990
|
]),
|
|
1991
1991
|
_: 1
|
|
1992
1992
|
}, 8, ["onClick"])) : v("", !0),
|
|
1993
|
-
o(n)(t.option.table?.view, i) ? (m(),
|
|
1993
|
+
o(n)(t.option.table?.view, i) ? (m(), y(o(I), {
|
|
1994
1994
|
key: 1,
|
|
1995
1995
|
link: "",
|
|
1996
1996
|
type: "primary",
|
|
@@ -2001,7 +2001,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2001
2001
|
]),
|
|
2002
2002
|
_: 1
|
|
2003
2003
|
}, 8, ["onClick"])) : v("", !0),
|
|
2004
|
-
o(n)(t.option.table?.update, i) ? (m(),
|
|
2004
|
+
o(n)(t.option.table?.update, i) ? (m(), y(o(I), {
|
|
2005
2005
|
key: 2,
|
|
2006
2006
|
link: "",
|
|
2007
2007
|
type: "warning",
|
|
@@ -2012,7 +2012,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2012
2012
|
]),
|
|
2013
2013
|
_: 1
|
|
2014
2014
|
}, 8, ["onClick"])) : v("", !0),
|
|
2015
|
-
o(n)(t.option.table?.delete, i) ? (m(),
|
|
2015
|
+
o(n)(t.option.table?.delete, i) ? (m(), y(o(I), {
|
|
2016
2016
|
key: 3,
|
|
2017
2017
|
link: "",
|
|
2018
2018
|
type: "danger",
|
|
@@ -2036,7 +2036,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2036
2036
|
])
|
|
2037
2037
|
]),
|
|
2038
2038
|
$("div", lt, [
|
|
2039
|
-
t.option.page?.show === void 0 || t.option.page?.show ? (m(),
|
|
2039
|
+
t.option.page?.show === void 0 || t.option.page?.show ? (m(), y(o(he), {
|
|
2040
2040
|
key: 0,
|
|
2041
2041
|
"current-page": o(e).page.num,
|
|
2042
2042
|
"onUpdate:currentPage": p[4] || (p[4] = (i) => o(e).page.num = i),
|
|
@@ -2062,7 +2062,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2062
2062
|
}, t.option.dialog), {
|
|
2063
2063
|
footer: h(() => [
|
|
2064
2064
|
$("span", rt, [
|
|
2065
|
-
V(o(
|
|
2065
|
+
V(o(I), {
|
|
2066
2066
|
onClick: o(e).update.close
|
|
2067
2067
|
}, {
|
|
2068
2068
|
default: h(() => [
|
|
@@ -2070,7 +2070,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2070
2070
|
]),
|
|
2071
2071
|
_: 1
|
|
2072
2072
|
}, 8, ["onClick"]),
|
|
2073
|
-
o(e).update.type !== o(r).View ? (m(),
|
|
2073
|
+
o(e).update.type !== o(r).View ? (m(), y(o(I), {
|
|
2074
2074
|
key: 0,
|
|
2075
2075
|
type: "primary",
|
|
2076
2076
|
onClick: o(e).update.submit,
|
|
@@ -2093,12 +2093,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2093
2093
|
default: h(() => [
|
|
2094
2094
|
o(e).update.showContent ? (m(!0), w(D, { key: 0 }, M(o(e).update.formColumn, (i) => (m(), w(D, null, [
|
|
2095
2095
|
o(n)(() => {
|
|
2096
|
-
const d = [],
|
|
2097
|
-
if (
|
|
2098
|
-
return
|
|
2099
|
-
d.push(...
|
|
2096
|
+
const d = [], b = (F) => {
|
|
2097
|
+
if (F.children)
|
|
2098
|
+
return b(F.children);
|
|
2099
|
+
d.push(...F.map((j) => j.item.show?.form));
|
|
2100
2100
|
};
|
|
2101
|
-
return
|
|
2101
|
+
return b(i), d;
|
|
2102
2102
|
}, o(e).update.form, o(e).update.type) ? (m(), w("div", {
|
|
2103
2103
|
key: 0,
|
|
2104
2104
|
class: T(["row curd-row", {
|
|
@@ -2113,43 +2113,43 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2113
2113
|
key: 0,
|
|
2114
2114
|
class: T(d.item.form.span > 0 ? `col-${d.item.form.span}` : "col")
|
|
2115
2115
|
}, [
|
|
2116
|
-
d.item.children ? (m(!0), w(D, { key: 0 }, M(d.children, (
|
|
2116
|
+
d.item.children ? (m(!0), w(D, { key: 0 }, M(d.children, (b) => (m(), y(o(J), {
|
|
2117
2117
|
class: T({
|
|
2118
|
-
"hide-label": typeof
|
|
2118
|
+
"hide-label": typeof b.item.text?.form?.label == "boolean" ? !b.item.text?.form?.label : !1
|
|
2119
2119
|
}),
|
|
2120
|
-
label: typeof
|
|
2121
|
-
prop:
|
|
2122
|
-
"label-width":
|
|
2120
|
+
label: typeof b.item.text?.form?.label == "string" ? b.item.text?.form?.label : b.item.label,
|
|
2121
|
+
prop: b.item.key,
|
|
2122
|
+
"label-width": b.item.form?.labelWidth || "100px"
|
|
2123
2123
|
}, {
|
|
2124
2124
|
default: h(() => [
|
|
2125
2125
|
$("div", at, [
|
|
2126
|
-
k(f.$slots, "form-" +
|
|
2126
|
+
k(f.$slots, "form-" + b.item.key + "-start", {
|
|
2127
2127
|
row: o(e).update.form,
|
|
2128
|
-
item:
|
|
2128
|
+
item: b.item
|
|
2129
2129
|
}),
|
|
2130
2130
|
$("div", nt, [
|
|
2131
|
-
k(f.$slots, "form-" +
|
|
2131
|
+
k(f.$slots, "form-" + b.item.key, {
|
|
2132
2132
|
row: o(e).update.form,
|
|
2133
|
-
item:
|
|
2133
|
+
item: b.item
|
|
2134
2134
|
}, () => [
|
|
2135
2135
|
V(le, {
|
|
2136
2136
|
conf: o(e),
|
|
2137
2137
|
item: d
|
|
2138
2138
|
}, null, 8, ["conf", "item"])
|
|
2139
2139
|
]),
|
|
2140
|
-
k(f.$slots, "form-" +
|
|
2140
|
+
k(f.$slots, "form-" + b.item.key + "-right", {
|
|
2141
2141
|
row: o(e).update.form,
|
|
2142
|
-
item:
|
|
2142
|
+
item: b.item
|
|
2143
2143
|
})
|
|
2144
2144
|
]),
|
|
2145
|
-
k(f.$slots, "form-" +
|
|
2145
|
+
k(f.$slots, "form-" + b.item.key + "-end", {
|
|
2146
2146
|
row: o(e).update.form,
|
|
2147
|
-
item:
|
|
2147
|
+
item: b.item
|
|
2148
2148
|
})
|
|
2149
2149
|
])
|
|
2150
2150
|
]),
|
|
2151
2151
|
_: 2
|
|
2152
|
-
}, 1032, ["class", "label", "prop", "label-width"]))), 256)) : (m(),
|
|
2152
|
+
}, 1032, ["class", "label", "prop", "label-width"]))), 256)) : (m(), y(o(J), {
|
|
2153
2153
|
key: 1,
|
|
2154
2154
|
class: T({
|
|
2155
2155
|
"hide-label": typeof d.item.text?.form?.label == "boolean" ? !d.item.text?.form?.label : !1
|
|
@@ -2208,7 +2208,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2208
2208
|
}, {
|
|
2209
2209
|
footer: h(() => [
|
|
2210
2210
|
$("span", dt, [
|
|
2211
|
-
V(o(
|
|
2211
|
+
V(o(I), {
|
|
2212
2212
|
onClick: o(e).remove.close
|
|
2213
2213
|
}, {
|
|
2214
2214
|
default: h(() => [
|
|
@@ -2216,7 +2216,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2216
2216
|
]),
|
|
2217
2217
|
_: 1
|
|
2218
2218
|
}, 8, ["onClick"]),
|
|
2219
|
-
V(o(
|
|
2219
|
+
V(o(I), {
|
|
2220
2220
|
type: "danger",
|
|
2221
2221
|
onClick: o(e).remove.submit,
|
|
2222
2222
|
loading: o(e).remove.loading
|
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("element-plus"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.cc1Form={},u.ElementPlus,u.Vue))})(this,(function(u,p,e){"use strict";class g{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(i,...s)=>Array.isArray(i)?i.some(l=>typeof l=="function"?l(...s):l):typeof i=="function"?i(...s):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async i=>{if(!g.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const s=await g.moduleObj[i]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(i,s,l={}){const a=Date.now();if(!this.tipMessages[i]||a-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=a;const t=Object.assign({message:i,type:s},l);p.ElMessage(t),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,s={})=>{this.showMessage(i,"error",s)};static success=(i,s={})=>{this.showMessage(i,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=p.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,s=!0)=>{if(s){let l=screen.width/2-500,a=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+l)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(s,l)=>{let a=document.getElementById(i.id);const t=await g.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let d=n.toDataURL("image/png");s(d)})}catch(n){l(n)}})}class b{static config={page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},dialog:{width:"980px",closeOnClickModal:!1},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0},columnConfig:{type:"input",form:{labelWidth:"100px",width:"100%"},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=i=>{b.config=ObjectUtil.deepMerge(b.config,i)}}class C{static customComponent={};static findOptions=(i,s)=>{const l=i.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(n,d)=>d.toUpperCase());if(l)return l.options[a(l.type)]};static setOptionsData=(i,s,l)=>{const a=C.findOptions(i,s);a&&(a.data=l)};static form={openBefore:{parentId:(i,s,l,a)=>{const t=b.config.table.rowKey;i?s.type===g.EDialog.Insert?(s.form.parentId=i[t],s.form.sort=i.children.length+1):s.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=l.length+1),C.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:l}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(i,s,l)=>{s[i]||(s[i]=[]);const a=b.config.table.rowKey;s[i].forEach(t=>{l.forEach(n=>{let d=n.default??"";n.type==="number"&&(d=n.default??0),n.type==="boolean"&&(d=n.default??!1),n.type==="time"&&(d=n.default??new Date),t[n.value]===void 0&&(t[n.value]=d)}),t[a]||(t[a]=B.getIdFun())})};static add=(i,s,l,a)=>{const t=JSONUtil.cp(l);B.setId(i,s,l);const n=b.config.table.rowKey;s[i].push(t.reduce((d,m)=>{let h=m.default??"";return m.type==="number"&&(h=m.default??0),m.type==="boolean"&&(h=m.default??!1),m.type==="time"&&(h=m.default??new Date),d[m.value]=h,d},{[n]:B.getIdFun()})),a?.(s)};static remove=(i,s,l,a)=>{const t=b.config.table.rowKey;s[i]=s[i].filter(n=>n[t]!==l[t]),a?.(s)};static getNoIdData=(i,s)=>{const l=JSONUtil.cp(i),a=b.config.table.rowKey;return l.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&B.getNoIdData(t[s],s)}),l}}const L={key:0,class:"column",style:{width:"100%",gap:"10px"}},I={class:"row items-center",style:{gap:"10px",width:"100%"}},N=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(o,{emit:i}){const s=o,l=e.reactive({show:!1,add:(t,n,d)=>{B.add(t,n,d,()=>{a("change")})},remove:(t,n,d)=>{B.remove(t,n,d,()=>{a("change")})}});e.onMounted(()=>{B.setId(s.field,s.row,s.itemFields),l.show=!0});const a=i;return(t,n)=>{const d=e.resolveComponent("el-button"),m=e.resolveComponent("el-input");return l.show?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"list-start",{row:o.row}),e.createElementVNode("div",null,[e.createVNode(d,{link:"",type:"primary",onClick:n[0]||(n[0]=h=>l.add(o.field,o.row,o.itemFields))},{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.row[o.field],h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"item-start",{item:h,row:o.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.itemFields,f=>(e.openBlock(),e.createBlock(m,{modelValue:h[f.value],"onUpdate:modelValue":r=>h[f.value]=r,style:e.normalizeStyle({width:o.inputWidth}),class:e.normalizeClass(o.inputClass),placeholder:f[o.label]||f[o.value],onChange:n[1]||(n[1]=r=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:o.row}),e.createVNode(d,{link:"",type:"danger",onClick:f=>l.remove(o.field,o.row,h)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:o.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(o,{expose:i}){const s=g.isFun,l=g.EDialog,a=e.ref(),t=o,n=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:d=>d.disabled?.[(t.type||l.Insert)===l.Insert?"create":"update"],initColumnForm:async()=>{const d=t.option;n.formColumn=[];const m=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let r=[];const c=k=>{if(n.formDefault[k.key]=k.value,k.isForm){k.form=k.form||{span:f},k.form.span=k.form.span??f;let w=k.form.span,V=r.reduce((S,Ce)=>S+Ce.span,w);const E=r.length;r.push({item:k,span:w}),(E===1&&r[0].span===0||V>=h||w===0&&E>1)&&(m.push(r),r=[]),k.rules&&(n.rules[k.key]=k.rules)}};d.column.forEach(k=>{k.isForm=!0,c(k)}),r.length>0&&m.push(r),n.formColumn=m,n.form=JSONUtil.cp(n.formDefault)},init:async()=>{n.show=!1,await e.nextTick(),n.initColumnForm()}});return n.initColumnForm(),i({ref:a,conf:n}),(d,m)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:a,model:n.form,rules:n.rules},{default:e.withCtx(()=>[n.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.formColumn,h=>(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(d.$slots,"form-start",{row:n.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(f.item.show?.form,n.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f.item.form.span>0?`col-${f.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"form-"+f.item.key+"-start",{row:n.form,item:f.item}),e.renderSlot(d.$slots,"form-"+f.item.key,{row:n.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:n.form,field:f.item.key},{ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(C).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(d.$slots,"form-"+f.item.key+"-end",{row:n.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(d.$slots,"form-end",{row:n.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ve(o){return o}const j={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class y{static t(i,...s){if(typeof i=="function")return i(...s);i=String(i);let l=0;return i.replace(/{([^}]+)}/g,(a,t)=>l<s.length?String(s[l++]):`{${t}}`)}static setI18n=i=>{y.curd=ObjectUtil.deepMerge(y.curd,i)};static tCurd(i,...s){return this.t(this.curd[i],...s)}static curd=j}class F{static exportToExcel=async(i,s,l)=>{if(!i||i.length===0)return;const a=await g.loadModule("xlsx"),t=i.map(m=>{const h={};return s.forEach(f=>{h[f.label]=m[f.key]}),h}),n=a.utils.json_to_sheet(t),d=a.utils.book_new();a.utils.book_append_sheet(d,n,"Sheet1"),l?typeof l=="function"&&(l=l()):l=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(d,`${l}.xlsx`)}}const x=g.EDialog,z=o=>{const i=e.ref(),s=e.ref(),l=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,t=y.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${t}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};o.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(l.search.form):n.show?.search)&&(a[n.key]=l.search.form[n.key])});const t=o.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const a=l.search.formDefault;Object.keys(a).forEach(t=>{o.option.search?.resetMode==="none"?a[t]=void 0:a[t]=l.search.formDefault[t]}),l.search.form=JSONUtil.cp(a),l.page.num=1,o.option.init!==!1&&l.table.getList()},submit:()=>{l.page.num=1,l.table.getList()}},page:{size:o.option.page?.size||10,sizeList:o.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:o.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...a)=>a.filter(n=>n).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{if(l.table.expand.isExpand)l.table.expand.rowKeys=[];else{const a=t=>{let n=[];return t.forEach(d=>{n.push(d[o.option.table.rowKey]),d.children&&d.children.length>0&&(n=n.concat(a(d.children)))}),n};l.table.expand.rowKeys=a(l.table.data)}l.table.expand.isExpand=!l.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{l.table.loading=!0;const a=o.option.api.list;try{await l.initApiData("init");const t=await a({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()}),n=b.config.result,d=t.data||{[n.list]:t};let m=(Array.isArray(d[n.list]),d[n.list]);const h=l.update.formColumn.flat(),f=JSONUtil.cp(m).map(r=>(Object.keys(r).forEach(k=>{const w=h.find(V=>V.item.key===k);w&&w.item.type==="select"&&(w.item.table.format||(w.item.table.format=V=>w.item.options?.select?.data?.find(E=>E.value==V[k])?.label))}),r));l.table.data=o.option.data?await o.option.data(f,m):f,l.page.total=d[n.total]||0}catch(t){console.error(t)}finally{l.table.loading=!1}},selection:{list:[],change:a=>{l.table.selection.list=a}}},export:{run:{start:async a=>{let t=await l.export.run[a](),n=o.option.column;const d=JSONUtil.cp({data:t,columns:n}),m=o.option.tools?.export||{};m.before&&m.before(d),F.exportToExcel(d.data,d.columns,m.fileName)},select:()=>{if(l.table.selection.list.length===0)throw g.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return l.table.selection.list},page:()=>{if(l.table.data.length===0)throw g.fail(y.tCurd("noData")),new Error(y.tCurd("noData"));return l.table.data},all:async()=>{l.export.loading=!0;try{if(o.option.tools?.export?.all){await o.option.tools?.export?.all({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()});return}const a=o.option.api.list,t=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(a){console.error(a)}finally{l.export.loading=!1}}},loading:!1,click:a=>{l.export.loading||l.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:x.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>l.update.type===x.View?!0:a.disabled?.[l.update.type===x.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(o.option.form?.editAll)return a;let t={[o.option.table?.rowKey]:l.update.edit.data[o.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(n=>{a[n]!==l.update.edit.data[n]&&(t[n]=a[n])}),t}},view:{},open:(a,t)=>{l.update.showContent||FunUtil.throttle(async()=>{g.loading(!0);try{await l.initApiData("update");const n=a===x.Insert;if(!n&&o.option.table?.inlineEdit){l.inlineEdit.open(t);return}l.update.type=a,l.update.edit.data=t,l.update.title=y.tCurd(n?"add":a===x.View?"view":"edit"),l.update.form=JSONUtil.cp(n?l.update.formDefault:t),await o.option.form?.openBefore?.(t,l.update),l.update.show=!0,l.update.showContent=!0,o.option.form?.openAfter?.(t,l.update)}catch(n){console.error(n)}finally{g.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(d,m)=>new Promise((h,f)=>{d||(g.fail(y.tCurd("checkFormData")),f(!1)),h()})),l.update.loading=!0;const a=l.update.type===x.Insert?o.option.api.create:o.option.api.update;let t=JSONUtil.cp(l.update.form);delete t.children,await o.option.form?.submitBefore?.(t,l.update);const n=new Set(o.option.column.filter(d=>d.type==="datetime").map(d=>d.key));Object.keys(t).forEach(d=>{if(n.has(d)&&t[d]!=null){const m=new Date(t[d]).getTime();isNaN(m)||(t[d]=m)}});try{if(!a)return;await a({...t}),l.update.close(),await l.table.getList(),o.option.form?.submitAfter?.(t,l.update)}catch(d){console.error(d)}finally{l.update.loading=!1}})},close:()=>{l.update.show=!1,setTimeout(()=>{l.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{l.inlineEdit.row=a,l.inlineEdit.form=JSONUtil.cp(a)},close:()=>{l.inlineEdit.row=null,l.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{l.inlineEdit.loading=!0;const a=o.option.api.update;let t=JSONUtil.cp(l.inlineEdit.form);delete t.children;try{if(!a)return;await a({...t}),l.inlineEdit.close(),await l.table.getList(),g.success(y.tCurd("operationSuccess"))}catch(n){console.error(n)}finally{l.inlineEdit.loading=!1}})}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{l.remove.show=!1},open:a=>{if(a.length===0){g.fail(y.tCurd("selectDataToDelete"));return}l.remove.items=a,l.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{l.remove.loading=!0;const a=o.option.api.delete;try{if(!a)return;await a({[o.option.table?.rowKey]:l.remove.items.map(t=>t[o.option.table?.rowKey]),items:l.remove.items}),g.success(y.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(t){console.error(t)}finally{l.remove.loading=!1}})}},init:()=>{l.initCurdConfig(),l.initColumnOptions(),l.initColumnForm()},apiDataMap:{},initApiData:async a=>{const t=[],n=d=>{if(d.children&&d.children.length){d.children.forEach(m=>n(m));return}if(d.type==="select"&&d.options?.select?.dataApi&&d.options?.select?.dataApiConfig?.[a]){if(l.apiDataMap[d.key]&&d.options?.select?.dataApiConfig?.once)return;const m=(async()=>{try{let h=await d.options?.select?.dataApi?.();if(h){const f=d.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),d.options.select.data=h,l.apiDataMap[d.key]=h}}catch{}})();t.push(m)}};return o.option.column.forEach(d=>{n(d)}),await Promise.all(t),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=y.tCurd("noData");const t=ObjectUtil.deepMerge(a,o.option||{});Object.keys(t).forEach(n=>{o.option[n]=t[n]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:y.tCurd("switchOn"),inactiveLabel:y.tCurd("switchOff")}});const t=n=>{if(n.table=ObjectUtil.deepMerge(a.table,n.table||{}),n.children){n.children.forEach(d=>{t(d)});return}n.options=ObjectUtil.deepMerge(a.options,n.options||{}),n.form=ObjectUtil.deepMerge(a.form,n.form||{}),n.show=ObjectUtil.deepMerge(a.show,n.show||{}),n.sort=ObjectUtil.deepMerge(a.sort,n.sort||{}),n.type=n.type||a.type,n.type==="switch"&&(n.options.switch.tableBeforeChange=async(d,m)=>{const h=n.options?.switch;try{await i.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),l.table.loading=!0;try{return o.option.api.update?(await o.option.api.update({[o.option.table?.rowKey]:m[o.option.table?.rowKey],[d]:m[d]===h.activeValue?h.inactiveValue:h.activeValue,final(f,r,c){l.table.loading=!1}}),l.table.loading=!1,g.success(y.tCurd("operationSuccess")),l.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{l.table.loading=!1}}catch{return!1}}),n.type==="tree-select"&&(n.options.treeSelect.rowKey=o.option.table?.rowKey,n.options.treeSelect.nodeKey=o.option.table?.rowKey)};o.option.column.forEach(t),o.option.table?.column?.forEach(t)},initColumnForm:()=>{const a=o.option;l.update.formColumn=[],l.table.column.show={list:[],listSource:[]};const t=[],n=o.option.form?.maxSpan||12,d=o.option.form?.defaultSpan||n/2;let m=[];const h=c=>{if(c.children){l.table.column.show.list.push(c.key),c.children.forEach(k=>{h(k)});return}if(l.update.formDefault[c.key]=c.value,c.table.table&&(c.show.table&&l.table.column.show.list.push(c.key),c.table.table&&l.table.column.show.listSource.push(c.key)),c.isForm){c.form=c.form||{span:d},c.form.span=c.form.span??d;let k=c.form.span,w=m.reduce((E,S)=>E+S.span,k);const V=m.length;if(m.push({item:c,span:k}),(V===1&&m[0].span===0||w>=n||k===0&&V>1)&&(t.push(m),m=[]),c.rules){const E={input:y.tCurd("placeholderInput"),select:y.tCurd("placeholderSelect")},S=(E[c.type]||E.input)+c.label;l.update.rules[c.key]=typeof c.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:c.rules}}},f=(c,k)=>{c.isForm=k,Array.isArray(c.children)&&c.children.forEach(w=>f(w,k))};a.column.forEach(c=>{c.isForm=!0,f(c,!0),h(c)}),o.option.table?.column?.forEach(c=>{f(c,!1),h(c)}),l.search.column.list=a.column.concat(a.table?.column||[]),l.table.column.list=l.search.column.list.filter(c=>c.table?.table),l.search.column.list.sort((c,k)=>c.sort?.search-k.sort?.search),l.table.column.list.sort((c,k)=>c.sort?.table-k.sort?.table),m.length>0&&t.push(m),l.update.formColumn=t;const r=o.option.search?.formDefault;r&&Object.keys(r).forEach(c=>{l.search.formDefault[c]=r[c]}),a.column.forEach(c=>{c.show?.search||(l.search.formDefault[c.key]=void 0)}),l.search.form=JSONUtil.cp(l.search.formDefault)}});return l.init(),e.onMounted(()=>{o.option.init!==!1&&l.table.getList()}),{conf:l,switchConfirmRef:i,ruleFormRef:s}},A={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(o,{expose:i}){const s=e.ref(!1),l=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,n=null;const d=f=>(f?.title&&(l.value=f.title),f?.content&&(a.value=f.content),s.value=!0,new Promise((r,c)=>{t=r,n=c})),m=()=>{s.value=!1,t?.(!0),t=null,n=null},h=()=>{s.value=!1,n?.(new Error("用户取消操作")),t=null,n=null};return i({open:d}),(f,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=c=>s.value=c),title:l.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",A,[e.createVNode(e.unref(p.ElButton),{onClick:h},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:m},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"]))}}),U=(o,i)=>{const s=o.__vccOpts||o;for(const[l,a]of i)s[l]=a;return s},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(o,i){return e.openBlock(),e.createElementBlock("svg",H,[...i[0]||(i[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 W=U(K,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(o,i){return e.openBlock(),e.createElementBlock("svg",G,[...i[0]||(i[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)])])}const Q=U(q,[["render",X]]),Y={class:"row flex-center table-header-label"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(o){const i=g.isFun,s=e.getCurrentInstance().type;return(l,a)=>{const t=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.key},[o.conf.table.column.show.list.includes(n.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:n.key,label:n.label},{ref_for:!0},n.table),{header:e.withCtx(()=>[e.renderSlot(l.$slots,"table-header-"+n.key,{item:n},()=>[e.createElementVNode("div",Y,[n.table?.tooltip?(e.openBlock(),e.createBlock(t,{key:0,effect:"dark",content:n.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:1},8,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])])]),default:e.withCtx(({row:d})=>[n.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s)),{conf:o.conf,columnList:n.children,option:o.option},e.createSlots({_:2},[e.renderList(l.$slots,(m,h)=>({name:h,fn:e.withCtx(f=>[e.renderSlot(l.$slots,h,e.mergeProps({ref_for:!0},f||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(n.show?.form,o.conf.inlineEdit.form,e.unref(g).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===d&&(n.type==="input"||n.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.select?.data,m=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(l.$slots,"table-"+n.key,{key:1,row:d,item:n},()=>[n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":m=>d[n.key]=m,"before-change":()=>n.options?.switch?.tableBeforeChange?.(n.key,d)},{ref_for:!0},n.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":n.table?.click?.color}),class:e.normalizeClass({"table-text-click":n.table?.click?.callback}),onClick:m=>n.table?.click?.callback?.(d)},e.toDisplayString(n.table?.format?n.table?.format(d):d[n.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),$=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(o){return(i,s)=>{const l=e.resolveComponent("el-radio"),a=e.resolveComponent("el-radio-group");return o.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.input,e.toHandlers(o.item.item.options?.input?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.switch,{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.select,e.toHandlers(o.item.item.options?.select?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="radio"?(e.openBlock(),e.createBlock(a,e.mergeProps({key:3,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.radio,e.toHandlers(o.item.item.options?.radio?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(l,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:4,row:o.conf.update.form,field:o.item.item.key},o.item.item.options?.list,e.toHandlers(o.item.item.options?.list?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:5,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.treeSelect,e.toHandlers(o.item.item.options?.treeSelect?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):o.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:6,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.datetime,e.toHandlers(o.item.item.options?.datetime?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type&&e.unref(C).customComponent[o.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[o.item.item.type]),e.mergeProps({key:7,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[6]||(s[6]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.[o.item.item.type],e.toHandlers(o.item.item.options?.[o.item.item.type]?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}}),v={class:"col relative cc1-form-box"},ee={class:"absolute row fit",style:{overflow:"hidden"}},te={class:"col column fit-width no-wrap"},oe={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ne={class:"flex items-center",style:{gap:"10px"}},ae={key:0},re={key:1},ie={key:2},se={class:"export-btn"},ce={class:"flex items-center",style:{gap:"10px"}},de={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},me={class:"row justify-end mt-10 mb-10"},pe={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ke={class:"row form-item-content",style:{width:"100%"}},ye={class:"col"},ge={class:"dialog-footer"},be={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(o,{expose:i}){const s=g.EDialog,l=o,a=g.isFun,{conf:t,switchConfirmRef:n,ruleFormRef:d}=z(l);return i({conf:t}),(m,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(m.$slots,"box-left"),e.createElementVNode("div",te,[o.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(p.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(t).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-"+r.key,{row:e.unref(t).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.input,e.toHandlers(r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.switch,e.toHandlers(r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.select,e.toHandlers(r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.datetime,e.toHandlers(r.options?.datetime?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(C).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.[r.type],e.toHandlers(r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(m.$slots,"search-"+r.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(m.$slots,"search-center",{row:e.unref(t).search.form}),o.option.tools?.search||o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0},{default:e.withCtx(()=>[o.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.unref(a)(o.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:h[0]||(h[0]=r=>e.unref(t).update.open(e.unref(s).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.table?.selectable&&e.unref(a)(o.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:h[1]||(h[1]=r=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:h[2]||(h[2]=r=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[o.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(p.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(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(p.ElButton),{type:"warning",loading:e.unref(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(m.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(m.$slots,"tools-right"),o.option.tools?.refresh===void 0||o.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...r)=>e.unref(t).table.getList&&e.unref(t).table.getList(...r))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",de,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:e.unref(t).table.data,border:o.option.table?.border===void 0?!0:o.option.table?.border},o.option.table,{onSelectionChange:e.unref(t).table.selection.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change}),{default:e.withCtx(()=>[o.option.table?.selectable||e.unref(a)(o.option.tools?.delete)||o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof o.option.table?.selectable=="function"?o.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(_,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:o.option},e.createSlots({_:2},[e.renderList(m.$slots,(r,c)=>({name:c,fn:e.withCtx(k=>[e.renderSlot(m.$slots,c,e.normalizeProps(e.guardReactiveProps(k||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(o.option.table?.add)||e.unref(a)(o.option.table?.update)||e.unref(a)(o.option.table?.delete)||e.unref(a)(o.option.table?.view)||m.$slots["table-op-left"]||m.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(a)(o.option.table?.add),e.unref(a)(o.option.table?.update),e.unref(a)(o.option.table?.delete),e.unref(a)(o.option.table?.view),m.$slots["table-op-left"],m.$slots["table-op-right"]),align:"center",fixed:"right"},o.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(m.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.renderSlot(m.$slots,"table-op-left",{row:r}),o.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(p.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{link:"",type:"primary",onClick:e.unref(t).inlineEdit.submit,loading:e.unref(t).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(m.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(o.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).Insert,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.view,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).View,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"warning",onClick:c=>e.unref(t).update.open(e.unref(s).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:3,link:"",type:"danger",onClick:c=>e.unref(t).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-op-right",{row:r})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",me,[o.option.page?.show===void 0||o.option.page?.show?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=r=>e.unref(t).page.num=r),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=r=>e.unref(t).page.size=r),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":7,layout:e.unref(t).page.layout,total:e.unref(t).page.total,onSizeChange:e.unref(t).table.getList,onCurrentChange:e.unref(t).table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(m.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=r=>e.unref(t).update.show=r),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},o.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ge,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(s).View?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:d,model:e.unref(t).update.form,rules:e.unref(t).update.rules},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(t).update.formColumn,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(()=>{const c=[],k=w=>{if(w.children)return k(w.children);c.push(...w.map(V=>V.item.show?.form))};return k(r),c},e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:o.option.form?.stripe===void 0?!0:o.option.form?.stripe}])},[e.renderSlot(m.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(c.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[c.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.children,k=>(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof k.item.text?.form?.label=="boolean"?!k.item.text?.form?.label:!1}),label:typeof k.item.text?.form?.label=="string"?k.item.text?.form?.label:k.item.label,prop:k.item.key,"label-width":k.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[e.renderSlot(m.$slots,"form-"+k.item.key+"-start",{row:e.unref(t).update.form,item:k.item}),e.createElementVNode("div",he,[e.renderSlot(m.$slots,"form-"+k.item.key,{row:e.unref(t).update.form,item:k.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+k.item.key+"-right",{row:e.unref(t).update.form,item:k.item})]),e.renderSlot(m.$slots,"form-"+k.item.key+"-end",{row:e.unref(t).update.form,item:k.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof c.item.text?.form?.label=="boolean"?!c.item.text?.form?.label:!1}),label:typeof c.item.text?.form?.label=="string"?c.item.text?.form?.label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ke,[e.renderSlot(m.$slots,"form-"+c.item.key+"-start",{row:e.unref(t).update.form,item:c.item}),e.createElementVNode("div",ye,[e.renderSlot(m.$slots,"form-"+c.item.key,{row:e.unref(t).update.form,item:c.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+c.item.key+"-right",{row:e.unref(t).update.form,item:c.item})]),e.renderSlot(m.$slots,"form-"+c.item.key+"-end",{row:e.unref(t).update.form,item:c.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(m.$slots,"form-end",{row:e.unref(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(p.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=r=>e.unref(t).remove.show=r),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(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",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(R,{ref_key:"switchConfirmRef",ref:n},null,512)])}}});class ue{static async download(i,s="download.png"){const l=document.createElement("a");l.style.display="none",l.href=i,l.setAttribute("download",s),typeof l.download>"u"&&l.setAttribute("target","_blank"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i)}static exportJSONFile=(i,s)=>{const l=new Blob([JSON.stringify(i)],{type:"application/json"}),a=URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async i=>new Promise((s,l)=>{const a=document.createElement("input");a.type="file";const t=i?.accept||".json";a.accept=t,a.style.display="none",a.onchange=n=>{const d=n.target.files[0];if(!d){g.fail("未选择文件"),l("未选择文件");return}const m=new FileReader;m.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},m.onerror=()=>{g.fail("文件读取失败"),l("文件读取失败")},m.readAsText(d),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(o,i)=>{if(o.component("TCurd",O),o.component("TFormList",N),o.component("TColumn",D),i?.customComponent){C.customComponent=i.customComponent;for(const s in i.customComponent)o.component(s,i.customComponent[s])}},we={install:T};u.ArrUtil=B,u.ExcelUtil=F,u.TColumn=D,u.TCurd=O,u.TFile=ue,u.TForm=C,u.TFormConfig=b,u.TFormI18n=y,u.TFormList=N,u.TSys=g,u.default=we,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("element-plus"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.cc1Form={},u.ElementPlus,u.Vue))})(this,(function(u,p,e){"use strict";class g{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(i,...s)=>Array.isArray(i)?i.some(l=>typeof l=="function"?l(...s):l):typeof i=="function"?i(...s):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async i=>{if(!g.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const s=await g.moduleObj[i]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(i,s,l={}){const a=Date.now();if(!this.tipMessages[i]||a-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=a;const t=Object.assign({message:i,type:s},l);p.ElMessage(t),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,s={})=>{this.showMessage(i,"error",s)};static success=(i,s={})=>{this.showMessage(i,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=p.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,s=!0)=>{if(s){let l=screen.width/2-500,a=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+l)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(s,l)=>{let a=document.getElementById(i.id);const t=await g.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let d=n.toDataURL("image/png");s(d)})}catch(n){l(n)}})}class b{static config={page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},dialog:{width:"980px",closeOnClickModal:!1},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0},columnConfig:{type:"input",form:{labelWidth:"100px",width:"100%"},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=i=>{b.config=ObjectUtil.deepMerge(b.config,i)}}class C{static customComponent={};static findOptions=(i,s)=>{const l=i.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(n,d)=>d.toUpperCase());if(l)return l.options[a(l.type)]};static setOptionsData=(i,s,l)=>{const a=C.findOptions(i,s);a&&(a.data=l)};static form={openBefore:{parentId:(i,s,l,a)=>{const t=b.config.table.rowKey;i?s.type===g.EDialog.Insert?(s.form.parentId=i[t],s.form.sort=i.children.length+1):s.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=l.length+1),C.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:l}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(i,s,l)=>{s[i]||(s[i]=[]);const a=b.config.table.rowKey;s[i].forEach(t=>{l.forEach(n=>{let d=n.default??"";n.type==="number"&&(d=n.default??0),n.type==="boolean"&&(d=n.default??!1),n.type==="time"&&(d=n.default??new Date),t[n.value]===void 0&&(t[n.value]=d)}),t[a]||(t[a]=B.getIdFun())})};static add=(i,s,l,a)=>{const t=JSONUtil.cp(l);B.setId(i,s,l);const n=b.config.table.rowKey;s[i].push(t.reduce((d,m)=>{let h=m.default??"";return m.type==="number"&&(h=m.default??0),m.type==="boolean"&&(h=m.default??!1),m.type==="time"&&(h=m.default??new Date),d[m.value]=h,d},{[n]:B.getIdFun()})),a?.(s)};static remove=(i,s,l,a)=>{const t=b.config.table.rowKey;s[i]=s[i].filter(n=>n[t]!==l[t]),a?.(s)};static getNoIdData=(i,s)=>{const l=JSONUtil.cp(i),a=b.config.table.rowKey;return l.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&B.getNoIdData(t[s],s)}),l}}const L={key:0,class:"column",style:{width:"100%",gap:"10px"}},I={class:"row items-center",style:{gap:"10px",width:"100%"}},N=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(o,{emit:i}){const s=o,l=e.reactive({show:!1,add:(t,n,d)=>{B.add(t,n,d,()=>{a("change")})},remove:(t,n,d)=>{B.remove(t,n,d,()=>{a("change")})}});e.onMounted(()=>{B.setId(s.field,s.row,s.itemFields),l.show=!0});const a=i;return(t,n)=>{const d=e.resolveComponent("el-button"),m=e.resolveComponent("el-input");return l.show?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"list-start",{row:o.row}),e.createElementVNode("div",null,[e.createVNode(d,{link:"",type:"primary",onClick:n[0]||(n[0]=h=>l.add(o.field,o.row,o.itemFields))},{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.row[o.field],h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"item-start",{item:h,row:o.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.itemFields,f=>(e.openBlock(),e.createBlock(m,{modelValue:h[f.value],"onUpdate:modelValue":r=>h[f.value]=r,style:e.normalizeStyle({width:o.inputWidth}),class:e.normalizeClass(o.inputClass),placeholder:f[o.label]||f[o.value],onChange:n[1]||(n[1]=r=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:o.row}),e.createVNode(d,{link:"",type:"danger",onClick:f=>l.remove(o.field,o.row,h)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:o.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(o,{expose:i}){const s=g.isFun,l=g.EDialog,a=e.ref(),t=o,n=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:d=>d.disabled?.[(t.type||l.Insert)===l.Insert?"create":"update"],initColumnForm:async()=>{const d=t.option;n.formColumn=[];const m=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let r=[];const c=k=>{if(n.formDefault[k.key]=k.value,k.isForm){k.form=k.form||{span:f},k.form.span=k.form.span??f;let w=k.form.span,V=r.reduce((S,Ce)=>S+Ce.span,w);const E=r.length;r.push({item:k,span:w}),(E===1&&r[0].span===0||V>=h||w===0&&E>1)&&(m.push(r),r=[]),k.rules&&(n.rules[k.key]=k.rules)}};d.column.forEach(k=>{k.isForm=!0,c(k)}),r.length>0&&m.push(r),n.formColumn=m,n.form=JSONUtil.cp(n.formDefault)},init:async()=>{n.show=!1,await e.nextTick(),n.initColumnForm()}});return n.initColumnForm(),i({ref:a,conf:n}),(d,m)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:a,model:n.form,rules:n.rules},{default:e.withCtx(()=>[n.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.formColumn,h=>(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(d.$slots,"form-start",{row:n.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(f.item.show?.form,n.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f.item.form.span>0?`col-${f.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"form-"+f.item.key+"-start",{row:n.form,item:f.item}),e.renderSlot(d.$slots,"form-"+f.item.key,{row:n.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:n.form,field:f.item.key},{ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(C).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(d.$slots,"form-"+f.item.key+"-end",{row:n.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(d.$slots,"form-end",{row:n.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ve(o){return o}const z={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class y{static t(i,...s){if(typeof i=="function")return i(...s);i=String(i);let l=0;return i.replace(/{([^}]+)}/g,(a,t)=>l<s.length?String(s[l++]):`{${t}}`)}static setI18n=i=>{y.curd=ObjectUtil.deepMerge(y.curd,i)};static tCurd(i,...s){return this.t(this.curd[i],...s)}static curd=z}class F{static exportToExcel=async(i,s,l)=>{if(!i||i.length===0)return;const a=await g.loadModule("xlsx"),t=i.map(m=>{const h={};return s.forEach(f=>{h[f.label]=m[f.key]}),h}),n=a.utils.json_to_sheet(t),d=a.utils.book_new();a.utils.book_append_sheet(d,n,"Sheet1"),l?typeof l=="function"&&(l=l()):l=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(d,`${l}.xlsx`)}}const x=g.EDialog,j=o=>{const i=e.ref(),s=e.ref(),l=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,t=y.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${t}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};o.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(l.search.form):n.show?.search)&&(a[n.key]=l.search.form[n.key])});const t=o.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const a=l.search.formDefault;Object.keys(a).forEach(t=>{o.option.search?.resetMode==="none"?a[t]=void 0:a[t]=l.search.formDefault[t]}),l.search.form=JSONUtil.cp(a),l.page.num=1,o.option.init!==!1&&l.table.getList()},submit:()=>{l.page.num=1,l.table.getList()}},page:{size:o.option.page?.size||10,sizeList:o.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:o.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...a)=>a.filter(n=>n).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{if(l.table.expand.isExpand)l.table.expand.rowKeys=[];else{const a=t=>{let n=[];return t.forEach(d=>{n.push(d[o.option.table.rowKey]),d.children&&d.children.length>0&&(n=n.concat(a(d.children)))}),n};l.table.expand.rowKeys=a(l.table.data)}l.table.expand.isExpand=!l.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{l.table.loading=!0;const a=o.option.api.list;try{await l.initApiData("init");const t=await a({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()}),n=b.config.result,d=t.data||{[n.list]:t};let m=(Array.isArray(d[n.list]),d[n.list]);const h=l.update.formColumn.flat(),f=JSONUtil.cp(m).map(r=>(Object.keys(r).forEach(k=>{const w=h.find(V=>V.item.key===k);w&&["select","radio"].includes(w.item.type)&&(w.item.table.format||(w.item.table.format=V=>w.item.options[w.item.type].data?.find(E=>E.value==V[k])?.label||V[k]))}),r));l.table.data=o.option.data?await o.option.data(f,m):f,l.page.total=d[n.total]||0}catch(t){console.error(t)}finally{l.table.loading=!1}},selection:{list:[],change:a=>{l.table.selection.list=a}}},export:{run:{start:async a=>{let t=await l.export.run[a](),n=o.option.column;const d=JSONUtil.cp({data:t,columns:n}),m=o.option.tools?.export||{};m.before&&m.before(d),F.exportToExcel(d.data,d.columns,m.fileName)},select:()=>{if(l.table.selection.list.length===0)throw g.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return l.table.selection.list},page:()=>{if(l.table.data.length===0)throw g.fail(y.tCurd("noData")),new Error(y.tCurd("noData"));return l.table.data},all:async()=>{l.export.loading=!0;try{if(o.option.tools?.export?.all){await o.option.tools?.export?.all({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()});return}const a=o.option.api.list,t=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(a){console.error(a)}finally{l.export.loading=!1}}},loading:!1,click:a=>{l.export.loading||l.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:x.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>l.update.type===x.View?!0:a.disabled?.[l.update.type===x.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(o.option.form?.editAll)return a;let t={[o.option.table?.rowKey]:l.update.edit.data[o.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(n=>{a[n]!==l.update.edit.data[n]&&(t[n]=a[n])}),t}},view:{},open:(a,t)=>{l.update.showContent||FunUtil.throttle(async()=>{g.loading(!0);try{await l.initApiData("update");const n=a===x.Insert;if(!n&&o.option.table?.inlineEdit){l.inlineEdit.open(t);return}l.update.type=a,l.update.edit.data=t,l.update.title=y.tCurd(n?"add":a===x.View?"view":"edit"),l.update.form=JSONUtil.cp(n?l.update.formDefault:t),await o.option.form?.openBefore?.(t,l.update),l.update.show=!0,l.update.showContent=!0,o.option.form?.openAfter?.(t,l.update)}catch(n){console.error(n)}finally{g.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(d,m)=>new Promise((h,f)=>{d||(g.fail(y.tCurd("checkFormData")),f(!1)),h()})),l.update.loading=!0;const a=l.update.type===x.Insert?o.option.api.create:o.option.api.update;let t=JSONUtil.cp(l.update.form);delete t.children,await o.option.form?.submitBefore?.(t,l.update);const n=new Set(o.option.column.filter(d=>d.type==="datetime").map(d=>d.key));Object.keys(t).forEach(d=>{if(n.has(d)&&t[d]!=null){const m=new Date(t[d]).getTime();isNaN(m)||(t[d]=m)}});try{if(!a)return;await a({...t}),l.update.close(),await l.table.getList(),o.option.form?.submitAfter?.(t,l.update)}catch(d){console.error(d)}finally{l.update.loading=!1}})},close:()=>{l.update.show=!1,setTimeout(()=>{l.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{l.inlineEdit.row=a,l.inlineEdit.form=JSONUtil.cp(a)},close:()=>{l.inlineEdit.row=null,l.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{l.inlineEdit.loading=!0;const a=o.option.api.update;let t=JSONUtil.cp(l.inlineEdit.form);delete t.children;try{if(!a)return;await a({...t}),l.inlineEdit.close(),await l.table.getList(),g.success(y.tCurd("operationSuccess"))}catch(n){console.error(n)}finally{l.inlineEdit.loading=!1}})}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{l.remove.show=!1},open:a=>{if(a.length===0){g.fail(y.tCurd("selectDataToDelete"));return}l.remove.items=a,l.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{l.remove.loading=!0;const a=o.option.api.delete;try{if(!a)return;await a({[o.option.table?.rowKey]:l.remove.items.map(t=>t[o.option.table?.rowKey]),items:l.remove.items}),g.success(y.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(t){console.error(t)}finally{l.remove.loading=!1}})}},init:()=>{l.initCurdConfig(),l.initColumnOptions(),l.initColumnForm()},apiDataMap:{},initApiData:async a=>{const t=[],n=d=>{if(d.children&&d.children.length){d.children.forEach(m=>n(m));return}if(d.type==="select"&&d.options?.select?.dataApi&&d.options?.select?.dataApiConfig?.[a]){if(l.apiDataMap[d.key]&&d.options?.select?.dataApiConfig?.once)return;const m=(async()=>{try{let h=await d.options?.select?.dataApi?.();if(h){const f=d.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),d.options.select.data=h,l.apiDataMap[d.key]=h}}catch{}})();t.push(m)}};return o.option.column.forEach(d=>{n(d)}),await Promise.all(t),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=y.tCurd("noData");const t=ObjectUtil.deepMerge(a,o.option||{});Object.keys(t).forEach(n=>{o.option[n]=t[n]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:y.tCurd("switchOn"),inactiveLabel:y.tCurd("switchOff")}});const t=n=>{if(n.table=ObjectUtil.deepMerge(a.table,n.table||{}),n.children){n.children.forEach(d=>{t(d)});return}n.options=ObjectUtil.deepMerge(a.options,n.options||{}),n.form=ObjectUtil.deepMerge(a.form,n.form||{}),n.show=ObjectUtil.deepMerge(a.show,n.show||{}),n.sort=ObjectUtil.deepMerge(a.sort,n.sort||{}),n.type=n.type||a.type,n.type==="switch"&&(n.options.switch.tableBeforeChange=async(d,m)=>{const h=n.options?.switch;try{await i.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),l.table.loading=!0;try{return o.option.api.update?(await o.option.api.update({[o.option.table?.rowKey]:m[o.option.table?.rowKey],[d]:m[d]===h.activeValue?h.inactiveValue:h.activeValue,final(f,r,c){l.table.loading=!1}}),l.table.loading=!1,g.success(y.tCurd("operationSuccess")),l.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{l.table.loading=!1}}catch{return!1}}),n.type==="tree-select"&&(n.options.treeSelect.rowKey=o.option.table?.rowKey,n.options.treeSelect.nodeKey=o.option.table?.rowKey)};o.option.column.forEach(t),o.option.table?.column?.forEach(t)},initColumnForm:()=>{const a=o.option;l.update.formColumn=[],l.table.column.show={list:[],listSource:[]};const t=[],n=o.option.form?.maxSpan||12,d=o.option.form?.defaultSpan||n/2;let m=[];const h=c=>{if(c.children){l.table.column.show.list.push(c.key),c.children.forEach(k=>{h(k)});return}if(l.update.formDefault[c.key]=c.value,c.table.table&&(c.show.table&&l.table.column.show.list.push(c.key),c.table.table&&l.table.column.show.listSource.push(c.key)),c.isForm){c.form=c.form||{span:d},c.form.span=c.form.span??d;let k=c.form.span,w=m.reduce((E,S)=>E+S.span,k);const V=m.length;if(m.push({item:c,span:k}),(V===1&&m[0].span===0||w>=n||k===0&&V>1)&&(t.push(m),m=[]),c.rules){const E={input:y.tCurd("placeholderInput"),select:y.tCurd("placeholderSelect")},S=(E[c.type]||E.input)+c.label;l.update.rules[c.key]=typeof c.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:c.rules}}},f=(c,k)=>{c.isForm=k,Array.isArray(c.children)&&c.children.forEach(w=>f(w,k))};a.column.forEach(c=>{c.isForm=!0,f(c,!0),h(c)}),o.option.table?.column?.forEach(c=>{f(c,!1),h(c)}),l.search.column.list=a.column.concat(a.table?.column||[]),l.table.column.list=l.search.column.list.filter(c=>c.table?.table),l.search.column.list.sort((c,k)=>c.sort?.search-k.sort?.search),l.table.column.list.sort((c,k)=>c.sort?.table-k.sort?.table),m.length>0&&t.push(m),l.update.formColumn=t;const r=o.option.search?.formDefault;r&&Object.keys(r).forEach(c=>{l.search.formDefault[c]=r[c]}),a.column.forEach(c=>{c.show?.search||(l.search.formDefault[c.key]=void 0)}),l.search.form=JSONUtil.cp(l.search.formDefault)}});return l.init(),e.onMounted(()=>{o.option.init!==!1&&l.table.getList()}),{conf:l,switchConfirmRef:i,ruleFormRef:s}},A={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(o,{expose:i}){const s=e.ref(!1),l=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,n=null;const d=f=>(f?.title&&(l.value=f.title),f?.content&&(a.value=f.content),s.value=!0,new Promise((r,c)=>{t=r,n=c})),m=()=>{s.value=!1,t?.(!0),t=null,n=null},h=()=>{s.value=!1,n?.(new Error("用户取消操作")),t=null,n=null};return i({open:d}),(f,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=c=>s.value=c),title:l.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",A,[e.createVNode(e.unref(p.ElButton),{onClick:h},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:m},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"]))}}),U=(o,i)=>{const s=o.__vccOpts||o;for(const[l,a]of i)s[l]=a;return s},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(o,i){return e.openBlock(),e.createElementBlock("svg",H,[...i[0]||(i[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 W=U(K,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(o,i){return e.openBlock(),e.createElementBlock("svg",G,[...i[0]||(i[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)])])}const Q=U(q,[["render",X]]),Y={class:"row flex-center table-header-label"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(o){const i=g.isFun,s=e.getCurrentInstance().type;return(l,a)=>{const t=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.key},[o.conf.table.column.show.list.includes(n.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:n.key,label:n.label},{ref_for:!0},n.table),{header:e.withCtx(()=>[e.renderSlot(l.$slots,"table-header-"+n.key,{item:n},()=>[e.createElementVNode("div",Y,[n.table?.tooltip?(e.openBlock(),e.createBlock(t,{key:0,effect:"dark",content:n.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:1},8,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])])]),default:e.withCtx(({row:d})=>[n.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s)),{conf:o.conf,columnList:n.children,option:o.option},e.createSlots({_:2},[e.renderList(l.$slots,(m,h)=>({name:h,fn:e.withCtx(f=>[e.renderSlot(l.$slots,h,e.mergeProps({ref_for:!0},f||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(n.show?.form,o.conf.inlineEdit.form,e.unref(g).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===d&&(n.type==="input"||n.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.select?.data,m=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(l.$slots,"table-"+n.key,{key:1,row:d,item:n},()=>[n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":m=>d[n.key]=m,"before-change":()=>n.options?.switch?.tableBeforeChange?.(n.key,d)},{ref_for:!0},n.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":n.table?.click?.color}),class:e.normalizeClass({"table-text-click":n.table?.click?.callback}),onClick:m=>n.table?.click?.callback?.(d)},e.toDisplayString(n.table?.format?n.table?.format(d):d[n.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),$=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(o){return(i,s)=>{const l=e.resolveComponent("el-radio"),a=e.resolveComponent("el-radio-group");return o.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.input,e.toHandlers(o.item.item.options?.input?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.switch,{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.select,e.toHandlers(o.item.item.options?.select?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="radio"?(e.openBlock(),e.createBlock(a,e.mergeProps({key:3,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.radio,e.toHandlers(o.item.item.options?.radio?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(l,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:4,row:o.conf.update.form,field:o.item.item.key},o.item.item.options?.list,e.toHandlers(o.item.item.options?.list?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:5,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.treeSelect,e.toHandlers(o.item.item.options?.treeSelect?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):o.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:6,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.datetime,e.toHandlers(o.item.item.options?.datetime?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type&&e.unref(C).customComponent[o.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[o.item.item.type]),e.mergeProps({key:7,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[6]||(s[6]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.[o.item.item.type],e.toHandlers(o.item.item.options?.[o.item.item.type]?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}}),v={class:"col relative cc1-form-box"},ee={class:"absolute row fit",style:{overflow:"hidden"}},te={class:"col column fit-width no-wrap"},oe={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ne={class:"flex items-center",style:{gap:"10px"}},ae={key:0},re={key:1},ie={key:2},se={class:"export-btn"},ce={class:"flex items-center",style:{gap:"10px"}},de={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},me={class:"row justify-end mt-10 mb-10"},pe={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ke={class:"row form-item-content",style:{width:"100%"}},ye={class:"col"},ge={class:"dialog-footer"},be={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(o,{expose:i}){const s=g.EDialog,l=o,a=g.isFun,{conf:t,switchConfirmRef:n,ruleFormRef:d}=j(l);return i({conf:t}),(m,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(m.$slots,"box-left"),e.createElementVNode("div",te,[o.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(p.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(t).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-"+r.key,{row:e.unref(t).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.input,e.toHandlers(r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.switch,e.toHandlers(r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.select,e.toHandlers(r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.datetime,e.toHandlers(r.options?.datetime?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(C).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.[r.type],e.toHandlers(r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(m.$slots,"search-"+r.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(m.$slots,"search-center",{row:e.unref(t).search.form}),o.option.tools?.search||o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0},{default:e.withCtx(()=>[o.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.unref(a)(o.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:h[0]||(h[0]=r=>e.unref(t).update.open(e.unref(s).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.table?.selectable&&e.unref(a)(o.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:h[1]||(h[1]=r=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:h[2]||(h[2]=r=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[o.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(p.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(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(p.ElButton),{type:"warning",loading:e.unref(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(m.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(m.$slots,"tools-right"),o.option.tools?.refresh===void 0||o.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...r)=>e.unref(t).table.getList&&e.unref(t).table.getList(...r))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",de,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:e.unref(t).table.data,border:o.option.table?.border===void 0?!0:o.option.table?.border},o.option.table,{onSelectionChange:e.unref(t).table.selection.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change}),{default:e.withCtx(()=>[o.option.table?.selectable||e.unref(a)(o.option.tools?.delete)||o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof o.option.table?.selectable=="function"?o.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(_,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:o.option},e.createSlots({_:2},[e.renderList(m.$slots,(r,c)=>({name:c,fn:e.withCtx(k=>[e.renderSlot(m.$slots,c,e.normalizeProps(e.guardReactiveProps(k||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(o.option.table?.add)||e.unref(a)(o.option.table?.update)||e.unref(a)(o.option.table?.delete)||e.unref(a)(o.option.table?.view)||m.$slots["table-op-left"]||m.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(a)(o.option.table?.add),e.unref(a)(o.option.table?.update),e.unref(a)(o.option.table?.delete),e.unref(a)(o.option.table?.view),m.$slots["table-op-left"],m.$slots["table-op-right"]),align:"center",fixed:"right"},o.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(m.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.renderSlot(m.$slots,"table-op-left",{row:r}),o.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(p.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{link:"",type:"primary",onClick:e.unref(t).inlineEdit.submit,loading:e.unref(t).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(m.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(o.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).Insert,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.view,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).View,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"warning",onClick:c=>e.unref(t).update.open(e.unref(s).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:3,link:"",type:"danger",onClick:c=>e.unref(t).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-op-right",{row:r})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",me,[o.option.page?.show===void 0||o.option.page?.show?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=r=>e.unref(t).page.num=r),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=r=>e.unref(t).page.size=r),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":7,layout:e.unref(t).page.layout,total:e.unref(t).page.total,onSizeChange:e.unref(t).table.getList,onCurrentChange:e.unref(t).table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(m.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=r=>e.unref(t).update.show=r),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},o.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ge,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(s).View?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:d,model:e.unref(t).update.form,rules:e.unref(t).update.rules},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(t).update.formColumn,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(()=>{const c=[],k=w=>{if(w.children)return k(w.children);c.push(...w.map(V=>V.item.show?.form))};return k(r),c},e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:o.option.form?.stripe===void 0?!0:o.option.form?.stripe}])},[e.renderSlot(m.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(c.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[c.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.children,k=>(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof k.item.text?.form?.label=="boolean"?!k.item.text?.form?.label:!1}),label:typeof k.item.text?.form?.label=="string"?k.item.text?.form?.label:k.item.label,prop:k.item.key,"label-width":k.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[e.renderSlot(m.$slots,"form-"+k.item.key+"-start",{row:e.unref(t).update.form,item:k.item}),e.createElementVNode("div",he,[e.renderSlot(m.$slots,"form-"+k.item.key,{row:e.unref(t).update.form,item:k.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+k.item.key+"-right",{row:e.unref(t).update.form,item:k.item})]),e.renderSlot(m.$slots,"form-"+k.item.key+"-end",{row:e.unref(t).update.form,item:k.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof c.item.text?.form?.label=="boolean"?!c.item.text?.form?.label:!1}),label:typeof c.item.text?.form?.label=="string"?c.item.text?.form?.label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ke,[e.renderSlot(m.$slots,"form-"+c.item.key+"-start",{row:e.unref(t).update.form,item:c.item}),e.createElementVNode("div",ye,[e.renderSlot(m.$slots,"form-"+c.item.key,{row:e.unref(t).update.form,item:c.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+c.item.key+"-right",{row:e.unref(t).update.form,item:c.item})]),e.renderSlot(m.$slots,"form-"+c.item.key+"-end",{row:e.unref(t).update.form,item:c.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(m.$slots,"form-end",{row:e.unref(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(p.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=r=>e.unref(t).remove.show=r),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(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",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(R,{ref_key:"switchConfirmRef",ref:n},null,512)])}}});class ue{static async download(i,s="download.png"){const l=document.createElement("a");l.style.display="none",l.href=i,l.setAttribute("download",s),typeof l.download>"u"&&l.setAttribute("target","_blank"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i)}static exportJSONFile=(i,s)=>{const l=new Blob([JSON.stringify(i)],{type:"application/json"}),a=URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async i=>new Promise((s,l)=>{const a=document.createElement("input");a.type="file";const t=i?.accept||".json";a.accept=t,a.style.display="none",a.onchange=n=>{const d=n.target.files[0];if(!d){g.fail("未选择文件"),l("未选择文件");return}const m=new FileReader;m.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},m.onerror=()=>{g.fail("文件读取失败"),l("文件读取失败")},m.readAsText(d),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(o,i)=>{if(o.component("TCurd",O),o.component("TFormList",N),o.component("TColumn",D),i?.customComponent){C.customComponent=i.customComponent;for(const s in i.customComponent)o.component(s,i.customComponent[s])}},we={install:T};u.ArrUtil=B,u.ExcelUtil=F,u.TColumn=D,u.TCurd=O,u.TFile=ue,u.TForm=C,u.TFormConfig=b,u.TFormI18n=y,u.TFormList=N,u.TSys=g,u.default=we,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|