cc1-form 1.1.8 → 1.1.9

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 CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as B, reactive as Z, onMounted as le, resolveComponent as oe, createElementBlock as k, createCommentVNode as v, openBlock as c, renderSlot as x, createElementVNode as S, createVNode as V, withCtx as h, createTextVNode as D, Fragment as O, renderList as T, createBlock as g, normalizeClass as M, normalizeStyle as ne, ref as z, nextTick as re, unref as a, mergeProps as U, toHandlers as _, resolveDynamicComponent as H, toDisplayString as E, resolveDirective as ie, withDirectives as de } from "vue";
2
- import { ElMessage as ue, ElLoading as ce, ElForm as G, ElFormItem as N, ElInput as q, ElSwitch as X, ElSelect as A, ElOption as K, ElTreeSelect as ae, ElDatePicker as Q, ElDialog as Y, ElButton as F, ElDropdown as pe, ElDropdownMenu as fe, ElDropdownItem as J, ElTable as me, ElTableColumn as W, ElPagination as he } from "element-plus";
1
+ import { defineComponent as B, reactive as Z, onMounted as le, resolveComponent as oe, createElementBlock as k, createCommentVNode as v, openBlock as c, renderSlot as x, createElementVNode as S, createVNode as V, withCtx as h, createTextVNode as D, Fragment as F, renderList as T, createBlock as g, normalizeClass as L, normalizeStyle as ne, ref as M, nextTick as re, unref as a, mergeProps as U, toHandlers as _, resolveDynamicComponent as H, toDisplayString as E, resolveDirective as ie, withDirectives as de } from "vue";
2
+ import { ElMessage as ue, ElLoading as ce, ElForm as G, ElFormItem as N, ElInput as q, ElSwitch as X, ElSelect as A, ElOption as K, ElTreeSelect as ae, ElDatePicker as Q, ElDialog as Y, ElButton as O, ElDropdown as pe, ElDropdownMenu as fe, ElDropdownItem as J, ElTable as me, ElTableColumn as W, ElPagination as he } from "element-plus";
3
3
  class $ {
4
4
  /**
5
5
  * 路由
@@ -358,16 +358,16 @@ const be = {
358
358
  _: 1
359
359
  })
360
360
  ]),
361
- (c(!0), k(O, null, T(p.row[p.field], (i) => (c(), k("div", ye, [
361
+ (c(!0), k(F, null, T(p.row[p.field], (i) => (c(), k("div", ye, [
362
362
  x(m.$slots, "item-start", {
363
363
  item: i,
364
364
  row: p.row
365
365
  }),
366
- (c(!0), k(O, null, T(p.itemFields, (o) => (c(), g(n, {
366
+ (c(!0), k(F, null, T(p.itemFields, (o) => (c(), g(n, {
367
367
  modelValue: i[o.value],
368
368
  "onUpdate:modelValue": (t) => i[o.value] = t,
369
369
  style: ne({ width: p.inputWidth }),
370
- class: M(p.inputClass),
370
+ class: L(p.inputClass),
371
371
  placeholder: o[p.label] || o[p.value],
372
372
  onChange: u[1] || (u[1] = (t) => f("change"))
373
373
  }, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
@@ -407,7 +407,7 @@ const be = {
407
407
  }
408
408
  },
409
409
  setup(p, { expose: r }) {
410
- const d = $.isFun, s = $.EDialog, f = z(), m = p, u = Z({
410
+ const d = $.isFun, s = $.EDialog, f = M(), m = p, u = Z({
411
411
  rules: {},
412
412
  show: !0,
413
413
  form: {},
@@ -422,7 +422,7 @@ const be = {
422
422
  const l = (b) => {
423
423
  if (u.formDefault[b.key] = b.value, b.isForm) {
424
424
  b.form = b.form || { span: o }, b.form.span = b.form.span ?? o;
425
- let I = b.form.span, y = t.reduce((L, P) => L + P.span, I);
425
+ let I = b.form.span, y = t.reduce((z, P) => z + P.span, I);
426
426
  const R = t.length;
427
427
  t.push({ item: b, span: I }), (R === 1 && t[0].span === 0 || y >= i || I === 0 && R > 1) && (n.push(t), t = []), b.rules && (u.rules[b.key] = b.rules);
428
428
  }
@@ -445,14 +445,14 @@ const be = {
445
445
  rules: u.rules
446
446
  }, {
447
447
  default: h(() => [
448
- u.show ? (c(!0), k(O, { key: 0 }, T(u.formColumn, (i) => (c(), k("div", ge, [
448
+ u.show ? (c(!0), k(F, { key: 0 }, T(u.formColumn, (i) => (c(), k("div", ge, [
449
449
  x(e.$slots, "form-start", {
450
450
  row: u.form
451
451
  }),
452
- (c(!0), k(O, null, T(i, (o) => (c(), k(O, null, [
452
+ (c(!0), k(F, null, T(i, (o) => (c(), k(F, null, [
453
453
  a(d)(o.item.show?.form, u.form) ?? !0 ? (c(), k("div", {
454
454
  key: 0,
455
- class: M(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
455
+ class: L(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
456
456
  }, [
457
457
  V(a(N), {
458
458
  label: o.item.label,
@@ -489,7 +489,7 @@ const be = {
489
489
  style: { width: "100%" }
490
490
  }), {
491
491
  default: h(() => [
492
- (c(!0), k(O, null, T(o.item.options?.select?.data, (t) => (c(), g(a(K), {
492
+ (c(!0), k(F, null, T(o.item.options?.select?.data, (t) => (c(), g(a(K), {
493
493
  key: t.value,
494
494
  label: t.label,
495
495
  value: t.value
@@ -605,7 +605,7 @@ class w {
605
605
  const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
606
606
  __name: "switchConfirm",
607
607
  setup(p, { expose: r }) {
608
- const d = z(!1), s = z("确认修改"), f = z("确认要修改状态吗?");
608
+ const d = M(!1), s = M("确认修改"), f = M("确认要修改状态吗?");
609
609
  let m = null, u = null;
610
610
  const e = (o) => (o?.title && (s.value = o.title), o?.content && (f.value = o.content), d.value = !0, new Promise((t, l) => {
611
611
  m = t, u = l;
@@ -625,13 +625,13 @@ const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
625
625
  }, {
626
626
  footer: h(() => [
627
627
  S("span", ve, [
628
- V(a(F), { onClick: i }, {
628
+ V(a(O), { onClick: i }, {
629
629
  default: h(() => [...t[1] || (t[1] = [
630
630
  D("取消", -1)
631
631
  ])]),
632
632
  _: 1
633
633
  }),
634
- V(a(F), {
634
+ V(a(O), {
635
635
  type: "primary",
636
636
  onClick: n
637
637
  }, {
@@ -665,16 +665,16 @@ function Ee(p, r) {
665
665
  }, null, -1)
666
666
  ])]);
667
667
  }
668
- const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative cc1-form-box" }, Oe = {
668
+ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative cc1-form-box" }, Fe = {
669
669
  class: "absolute row fit",
670
670
  style: { overflow: "hidden" }
671
- }, Fe = { class: "col column" }, _e = {
671
+ }, Oe = { class: "col column" }, _e = {
672
672
  key: 0,
673
673
  class: "relative curd-search"
674
674
  }, Ie = { class: "mb-10 flex justify-between items-center" }, Re = {
675
675
  class: "flex items-center",
676
676
  style: { gap: "10px" }
677
- }, Te = { key: 0 }, je = { key: 1 }, Le = { key: 2 }, Me = { class: "export-btn" }, ze = {
677
+ }, Te = { key: 0 }, je = { key: 1 }, ze = { key: 2 }, Le = { class: "export-btn" }, Me = {
678
678
  class: "flex items-center",
679
679
  style: { gap: "10px" }
680
680
  }, Pe = { class: "col fit-width relative" }, Ke = { class: "absolute column fit" }, Ne = { class: "row justify-end mt-10 mb-10" }, Ae = {
@@ -691,7 +691,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
691
691
  }
692
692
  },
693
693
  setup(p, { expose: r }) {
694
- const d = $.EDialog, s = p, f = z(), m = z(), u = $.isFun, e = Z({
694
+ const d = $.EDialog, s = p, f = M(), m = M(), u = $.isFun, e = Z({
695
695
  search: {
696
696
  column: {
697
697
  list: []
@@ -814,7 +814,11 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
814
814
  e.export.loading = !0;
815
815
  try {
816
816
  if (s.option.tools?.export?.all) {
817
- await s.option.tools?.export?.all();
817
+ await s.option.tools?.export?.all({
818
+ [C.pageField.size]: e.page.size,
819
+ [C.pageField.num]: e.page.num,
820
+ ...e.search.getFormData()
821
+ });
818
822
  return;
819
823
  }
820
824
  const n = s.option.api.list, i = await n({
@@ -987,12 +991,12 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
987
991
  return s.option.api.update ? (await s.option.api.update({
988
992
  [C.tableRowKey]: y[C.tableRowKey],
989
993
  [I]: y[I] === R.activeValue ? R.inactiveValue : R.activeValue,
990
- final(L, P, te) {
994
+ final(z, P, te) {
991
995
  e.table.loading = !1;
992
996
  }
993
997
  }), e.table.loading = !1, $.success(w.tCurd("operationSuccess")), e.table.getList(), !0) : void 0;
994
- } catch (L) {
995
- return console.error(L), !1;
998
+ } catch (z) {
999
+ return console.error(z), !1;
996
1000
  } finally {
997
1001
  e.table.loading = !1;
998
1002
  }
@@ -1048,9 +1052,9 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1048
1052
  const b = (y) => {
1049
1053
  if (e.update.formDefault[y.key] = y.value, y.table.table && (y.show.table && e.table.column.show.list.push(y.key), y.table.table && e.table.column.show.listSource.push(y.key)), y.isForm) {
1050
1054
  y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
1051
- let R = y.form.span, L = l.reduce((te, se) => te + se.span, R);
1055
+ let R = y.form.span, z = l.reduce((te, se) => te + se.span, R);
1052
1056
  const P = l.length;
1053
- l.push({ item: y, span: R }), (P === 1 && l[0].span === 0 || L >= o || R === 0 && P > 1) && (i.push(l), l = []), y.rules && (e.update.rules[y.key] = y.rules);
1057
+ l.push({ item: y, span: R }), (P === 1 && l[0].span === 0 || z >= o || R === 0 && P > 1) && (i.push(l), l = []), y.rules && (e.update.rules[y.key] = y.rules);
1054
1058
  }
1055
1059
  };
1056
1060
  n.column.forEach((y) => {
@@ -1073,9 +1077,9 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1073
1077
  }), (n, i) => {
1074
1078
  const o = ie("loading");
1075
1079
  return c(), k("div", $e, [
1076
- S("div", Oe, [
1080
+ S("div", Fe, [
1077
1081
  x(n.$slots, "box-left"),
1078
- S("div", Fe, [
1082
+ S("div", Oe, [
1079
1083
  p.option.search?.show !== !1 ? (c(), k("div", _e, [
1080
1084
  V(a(G), {
1081
1085
  model: e.search.form,
@@ -1085,13 +1089,13 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1085
1089
  x(n.$slots, "search-start", {
1086
1090
  row: e.search.form
1087
1091
  }),
1088
- (c(!0), k(O, null, T(e.search.column.list, (t) => (c(), k(O, {
1092
+ (c(!0), k(F, null, T(e.search.column.list, (t) => (c(), k(F, {
1089
1093
  key: t.key
1090
1094
  }, [
1091
1095
  (typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (c(), g(a(N), {
1092
1096
  key: 0,
1093
1097
  label: typeof t.text?.search?.label == "string" ? t.text?.search?.label : t.label,
1094
- class: M({
1098
+ class: L({
1095
1099
  "hide-label": typeof t.text?.search?.label == "boolean" ? !t.text?.search?.label : !1
1096
1100
  })
1097
1101
  }, {
@@ -1136,7 +1140,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1136
1140
  disabled: t.disabled?.search
1137
1141
  }, {
1138
1142
  default: h(() => [
1139
- (c(!0), k(O, null, T(t.options?.select?.data, (l) => (c(), g(a(K), {
1143
+ (c(!0), k(F, null, T(t.options?.select?.data, (l) => (c(), g(a(K), {
1140
1144
  key: l.value,
1141
1145
  label: l.label,
1142
1146
  value: l.value
@@ -1166,7 +1170,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1166
1170
  }),
1167
1171
  V(a(N), null, {
1168
1172
  default: h(() => [
1169
- p.option.tools?.search ? (c(), g(a(F), {
1173
+ p.option.tools?.search ? (c(), g(a(O), {
1170
1174
  key: 0,
1171
1175
  type: "primary",
1172
1176
  onClick: e.search.submit
@@ -1176,7 +1180,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1176
1180
  ]),
1177
1181
  _: 1
1178
1182
  }, 8, ["onClick"])) : v("", !0),
1179
- p.option.tools?.reset ? (c(), g(a(F), {
1183
+ p.option.tools?.reset ? (c(), g(a(O), {
1180
1184
  key: 1,
1181
1185
  onClick: e.search.reset
1182
1186
  }, {
@@ -1198,7 +1202,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1198
1202
  S("div", Ie, [
1199
1203
  S("div", Re, [
1200
1204
  a(u)(p.option.tools?.add) ? (c(), k("div", Te, [
1201
- V(a(F), {
1205
+ V(a(O), {
1202
1206
  type: "primary",
1203
1207
  onClick: i[0] || (i[0] = (t) => e.update.open(a(d).Insert))
1204
1208
  }, {
@@ -1209,7 +1213,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1209
1213
  })
1210
1214
  ])) : v("", !0),
1211
1215
  p.option.table?.selectable && a(u)(p.option.tools?.delete) ? (c(), k("div", je, [
1212
- V(a(F), {
1216
+ V(a(O), {
1213
1217
  type: "danger",
1214
1218
  onClick: i[1] || (i[1] = (t) => e.remove.open(e.table.selection.list))
1215
1219
  }, {
@@ -1219,8 +1223,8 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1219
1223
  _: 1
1220
1224
  })
1221
1225
  ])) : v("", !0),
1222
- p.option.tools?.expand ? (c(), k("div", Le, [
1223
- V(a(F), {
1226
+ p.option.tools?.expand ? (c(), k("div", ze, [
1227
+ V(a(O), {
1224
1228
  type: "warning",
1225
1229
  onClick: i[2] || (i[2] = (t) => e.table.expand.all())
1226
1230
  }, {
@@ -1263,8 +1267,8 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1263
1267
  })
1264
1268
  ]),
1265
1269
  default: h(() => [
1266
- S("div", Me, [
1267
- V(a(F), {
1270
+ S("div", Le, [
1271
+ V(a(O), {
1268
1272
  type: "warning",
1269
1273
  loading: e.export.loading
1270
1274
  }, {
@@ -1279,7 +1283,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1279
1283
  }, 8, ["onCommand"])) : v("", !0),
1280
1284
  x(n.$slots, "tools-left")
1281
1285
  ]),
1282
- S("div", ze, [
1286
+ S("div", Me, [
1283
1287
  x(n.$slots, "tools-right"),
1284
1288
  p.option.tools?.refresh === void 0 || p.option.tools?.refresh ? (c(), k("div", {
1285
1289
  key: 0,
@@ -1307,7 +1311,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1307
1311
  selectable: typeof p.option.table?.selectable == "function" ? p.option.table?.selectable : void 0,
1308
1312
  width: "55"
1309
1313
  }, null, 8, ["selectable"])) : v("", !0),
1310
- (c(!0), k(O, null, T(e.table.column.list, (t) => (c(), k(O, {
1314
+ (c(!0), k(F, null, T(e.table.column.list, (t) => (c(), k(F, {
1311
1315
  key: t.key
1312
1316
  }, [
1313
1317
  e.table.column.show.list.includes(t.key) ? (c(), g(a(W), U({
@@ -1325,7 +1329,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1325
1329
  modelValue: l[t.key],
1326
1330
  "onUpdate:modelValue": (b) => l[t.key] = b,
1327
1331
  "before-change": () => t.options?.switch?.tableBeforeChange?.(t.key, l)
1328
- }, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (c(), k(O, { key: 1 }, [
1332
+ }, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (c(), k(F, { key: 1 }, [
1329
1333
  D(E(l[t.key]), 1)
1330
1334
  ], 64))
1331
1335
  ])
@@ -1342,7 +1346,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1342
1346
  }, {
1343
1347
  default: h(({ row: t }) => [
1344
1348
  x(n.$slots, "table-op-left", { row: t }),
1345
- a(u)(p.option.tools?.add, t) ? (c(), g(a(F), {
1349
+ a(u)(p.option.tools?.add, t) ? (c(), g(a(O), {
1346
1350
  key: 0,
1347
1351
  link: "",
1348
1352
  type: "primary",
@@ -1353,7 +1357,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1353
1357
  ]),
1354
1358
  _: 1
1355
1359
  }, 8, ["onClick"])) : v("", !0),
1356
- a(u)(p.option.tools?.update, t) ? (c(), g(a(F), {
1360
+ a(u)(p.option.tools?.update, t) ? (c(), g(a(O), {
1357
1361
  key: 1,
1358
1362
  link: "",
1359
1363
  type: "warning",
@@ -1364,7 +1368,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1364
1368
  ]),
1365
1369
  _: 1
1366
1370
  }, 8, ["onClick"])) : v("", !0),
1367
- a(u)(p.option.tools?.delete, t) ? (c(), g(a(F), {
1371
+ a(u)(p.option.tools?.delete, t) ? (c(), g(a(O), {
1368
1372
  key: 2,
1369
1373
  link: "",
1370
1374
  type: "danger",
@@ -1413,7 +1417,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1413
1417
  }, p.option.dialog), {
1414
1418
  footer: h(() => [
1415
1419
  S("span", Je, [
1416
- V(a(F), {
1420
+ V(a(O), {
1417
1421
  onClick: e.update.close
1418
1422
  }, {
1419
1423
  default: h(() => [
@@ -1421,7 +1425,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1421
1425
  ]),
1422
1426
  _: 1
1423
1427
  }, 8, ["onClick"]),
1424
- V(a(F), {
1428
+ V(a(O), {
1425
1429
  type: "primary",
1426
1430
  onClick: e.update.submit,
1427
1431
  loading: e.update.loading
@@ -1441,26 +1445,26 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1441
1445
  rules: e.update.rules
1442
1446
  }, {
1443
1447
  default: h(() => [
1444
- e.update.showContent ? (c(!0), k(O, { key: 0 }, T(e.update.formColumn, (t) => (c(), k(O, null, [
1448
+ e.update.showContent ? (c(!0), k(F, { key: 0 }, T(e.update.formColumn, (t) => (c(), k(F, null, [
1445
1449
  a(u)(
1446
1450
  t.map((l) => l.item.show?.form),
1447
1451
  e.update.form
1448
1452
  ) ? (c(), k("div", {
1449
1453
  key: 0,
1450
- class: M(["row curd-row", {
1454
+ class: L(["row curd-row", {
1451
1455
  stripe: p.option.form?.stripe === void 0 ? !0 : p.option.form?.stripe
1452
1456
  }])
1453
1457
  }, [
1454
1458
  x(n.$slots, "form-start", {
1455
1459
  row: e.update.form
1456
1460
  }),
1457
- (c(!0), k(O, null, T(t, (l) => (c(), k(O, null, [
1461
+ (c(!0), k(F, null, T(t, (l) => (c(), k(F, null, [
1458
1462
  a(u)(l.item.show?.form, e.update.form) ? (c(), k("div", {
1459
1463
  key: 0,
1460
- class: M(l.item.form.span > 0 ? `col-${l.item.form.span}` : "col")
1464
+ class: L(l.item.form.span > 0 ? `col-${l.item.form.span}` : "col")
1461
1465
  }, [
1462
1466
  V(a(N), {
1463
- class: M({
1467
+ class: L({
1464
1468
  "hide-label": typeof l.item.text?.form?.label == "boolean" ? !l.item.text?.form?.label : !1
1465
1469
  }),
1466
1470
  label: typeof l.item.text?.form?.label == "string" ? l.item.text?.form?.label : l.item.label,
@@ -1499,7 +1503,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1499
1503
  style: { width: "100%" }
1500
1504
  }), {
1501
1505
  default: h(() => [
1502
- (c(!0), k(O, null, T(l.item.options?.select?.data, (b) => (c(), g(a(K), {
1506
+ (c(!0), k(F, null, T(l.item.options?.select?.data, (b) => (c(), g(a(K), {
1503
1507
  key: b.value,
1504
1508
  label: b.label,
1505
1509
  value: b.value
@@ -1564,7 +1568,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1564
1568
  }, {
1565
1569
  footer: h(() => [
1566
1570
  S("span", We, [
1567
- V(a(F), {
1571
+ V(a(O), {
1568
1572
  onClick: e.remove.close
1569
1573
  }, {
1570
1574
  default: h(() => [
@@ -1572,7 +1576,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative
1572
1576
  ]),
1573
1577
  _: 1
1574
1578
  }, 8, ["onClick"]),
1575
- V(a(F), {
1579
+ V(a(O), {
1576
1580
  type: "danger",
1577
1581
  onClick: e.remove.submit,
1578
1582
  loading: e.remove.loading
@@ -1 +1 @@
1
- (function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.cc1Form={},w.Vue,w.ElementPlus))})(this,(function(w,e,m){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,d)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(d):r):typeof s=="function"?s(d):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const d=await b.moduleObj[s]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(s,d,r={}){const f=Date.now();if(!this.tipMessages[s]||f-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=f;const h=Object.assign({message:s,type:d},r);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,d={})=>{this.showMessage(s,"error",d)};static success=(s,d={})=>{this.showMessage(s,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,d=!0)=>{if(d){let r=screen.width/2-500,f=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+r)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(d,r)=>{let f=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(c){let t=c.toDataURL("image/png");d(t)})}catch(c){r(c)}})}class g{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static tableRowKey="_id";static customComponent={};static findOptions=(s,d)=>{const r=s.column.find(h=>h.key===d),f=h=>h.replace(/-([a-z])/g,(c,t)=>t.toUpperCase());if(r)return r.options[f(r.type)]};static setOptionsData=(s,d,r)=>{const f=g.findOptions(s,d);f&&(f.data=r)};static form={openBefore:{parentId:(s,d,r,f)=>{s?d.type===b.EDialog.Insert?(d.form.parentId=s._id,d.form.sort=s.children.length+1):d.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=r.length+1),g.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,d,r)=>{d[s]||(d[s]=[]),d[s].forEach(f=>{r.forEach(h=>{let c=h.default??"";h.type==="number"&&(c=h.default??0),h.type==="boolean"&&(c=h.default??!1),h.type==="time"&&(c=h.default??new Date),f[h.value]===void 0&&(f[h.value]=c)}),f._id||(f._id=B.getIdFun())})};static add=(s,d,r,f)=>{const h=JSONUtil.cp(r);B.setId(s,d,r),d[s].push(h.reduce((c,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),c[t.value]=n,c},{_id:B.getIdFun()})),f?.(d)};static remove=(s,d,r,f)=>{d[s]=d[s].filter(h=>h._id!==r._id),f?.(d)};static getNoIdData=(s,d)=>{const r=JSONUtil.cp(s);return r.forEach(f=>{f._id&&delete f._id,d&&f[d]&&B.getNoIdData(f[d],d)}),r}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},S=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(p,{emit:s}){const d=p,r=e.reactive({show:!1,add:(h,c,t)=>{B.add(h,c,t,()=>{f("change")})},remove:(h,c,t)=>{B.remove(h,c,t,()=>{f("change")})}});e.onMounted(()=>{B.setId(d.field,d.row,d.itemFields),r.show=!0});const f=s;return(h,c)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:c[0]||(c[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...c[2]||(c[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(n,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:c[1]||(c[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>r.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...c[3]||(c[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const d=b.isFun,r=b.EDialog,f=e.ref(),h=p,c=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||r.Insert)===r.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;c.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(c.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,y=o.reduce((E,x)=>E+x.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||y>=i||C===0&&V>1)&&(n.push(o),o=[]),u.rules&&(c.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),c.formColumn=n,c.form=JSONUtil.cp(c.formDefault)},init:async()=>{c.show=!1,await e.nextTick(),c.initColumnForm()}});return c.initColumnForm(),s({ref:f,conf:c}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:f,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.formColumn,i=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"form-start",{row:c.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,c.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:c.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:c.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:c.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(g).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(g).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:c.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:c.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class N{static exportToExcel=async(s,d,r)=>{if(!s||s.length===0)return;const f=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return d.forEach(l=>{i[l.label]=n[l.key]}),i}),c=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,c,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${r}.xlsx`)}}function ce(p){return p}const _={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",submit:"提交",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...d){return typeof s=="function"?s(...d):(s=String(s),s.replace(/{([^}]+)}/g,(r,f,h)=>typeof d[h]<"u"?d[h]:`{${f}}`))}static tCurd(s,...d){return this.t(this.curd[s],...d)}static curd=_}const L={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const d=e.ref(!1),r=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,c=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,a)=>{h=o,c=a})),n=()=>{d.value=!1,h?.(!0),h=null,c=null},i=()=>{d.value=!1,c?.(new Error("用户取消操作")),h=null,c=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=a=>d.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(m.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),z=(p,s)=>{const d=p.__vccOpts||p;for(const[r,f]of s)d[r]=f;return d},j={},M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function H(p,s){return e.openBlock(),e.createElementBlock("svg",M,[...s[0]||(s[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const K=z(j,[["render",H]]),A={class:"col relative cc1-form-box"},J={class:"absolute row fit",style:{overflow:"hidden"}},W={class:"col column"},q={key:0,class:"relative curd-search"},G={class:"mb-10 flex justify-between items-center"},X={class:"flex items-center",style:{gap:"10px"}},Q={key:0},Y={key:1},Z={key:2},P={class:"export-btn"},v={class:"flex items-center",style:{gap:"10px"}},ee={class:"col fit-width relative"},te={class:"absolute column fit"},oe={class:"row justify-end mt-10 mb-10"},le={class:"row form-item-content",style:{width:"100%"}},ae={class:"col"},re={class:"dialog-footer"},ne={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const d=b.EDialog,r=p,f=e.ref(),h=e.ref(),c=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=k.tCurd("placeholderInput"))=>n.text?.search?.placeholder===void 0?`${i}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(n[l.key]=t.search.form[l.key])});const i=r.option.search?.before?.(n);return i&&(n=i),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(i=>{r.option.search?.resetMode==="none"?n[i]=void 0:n[i]=t.search.formDefault[i]}),t.search.form=JSONUtil.cp(n),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:r.option.page?.size||10,sizeList:r.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:r.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=i=>{let l=[];return i.forEach(o=>{l.push(o[g.tableRowKey]),o.children&&o.children.length>0&&(l=l.concat(n(o.children)))}),l};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=r.option.api.list;try{const i=await n({[g.pageField.size]:t.page.size,[g.pageField.num]:t.page.num,...t.search.getFormData()}),l=g.resultField,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=r.option.data?await r.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}}},export:{run:{start:async n=>{let i=await t.export.run[n](),l=r.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=r.option.tools?.export||{};a.before&&a.before(o),N.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all();return}const n=r.option.api.list,i=await n({[g.pageField.size]:999999,[g.pageField.num]:1});return(i.data||{[g.resultField.list]:i})[g.resultField.list]}catch(n){console.error(n)}finally{t.export.loading=!1}}},loading:!1,click:n=>{t.export.loading||t.export.run.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[g.tableRowKey]:t.update.edit.data[g.tableRowKey]};return Object.keys(t.update.edit.data).forEach(l=>{n[l]!==t.update.edit.data[l]&&(i[l]=n[l])}),i}},open:(n,i)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=n;const l=n===d.Insert;t.update.edit.data=i,t.update.title=l?k.tCurd("add"):k.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await r.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(b.fail(k.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===d.Insert?r.option.api.create:r.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await r.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!n)return;await n({...i}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail(k.tCurd("selectDataToDelete"));return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=r.option.api.delete;try{if(!n)return;await n({[g.tableRowKey]:t.remove.items.map(i=>i[g.tableRowKey]),items:t.remove.items}),b.success(k.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:g.tableRowKey,emptyText:k.tCurd("noData"),highlightCurrentRow:!0}},l=r.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const n=r.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:k.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:k.tCurd("switchOff"),tableBeforeChange:async(C,y)=>{const V=l.options?.switch;try{await f.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[g.tableRowKey]:y[g.tableRowKey],[C]:y[C]===V.activeValue?V.inactiveValue:V.activeValue,final(E,x,T){t.table.loading=!1}}),t.table.loading=!1,b.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(E){return console.error(E),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:g.tableRowKey,nodeKey:g.tableRowKey,multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};n.column.forEach(i),n.table?.column?.forEach(i)},initColumnForm:()=>{const n=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=r.option.form?.maxSpan||12,o=r.option.form?.defaultSpan||l/2;let a=[];const u=y=>{if(t.update.formDefault[y.key]=y.value,y.table.table&&(y.show.table&&t.table.column.show.list.push(y.key),y.table.table&&t.table.column.show.listSource.push(y.key)),y.isForm){y.form=y.form||{span:o},y.form.span=y.form.span??o;let V=y.form.span,E=a.reduce((T,de)=>T+de.span,V);const x=a.length;a.push({item:y,span:V}),(x===1&&a[0].span===0||E>=l||V===0&&x>1)&&(i.push(a),a=[]),y.rules&&(t.update.rules[y.key]=y.rules)}};n.column.forEach(y=>{y.isForm=!0,u(y)}),r.option.table?.column?.forEach(y=>{y.isForm=!1,u(y)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(y=>y.table?.table),t.search.column.list.sort((y,V)=>y.sort?.search-V.sort?.search),t.table.column.list.sort((y,V)=>y.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=r.option.search?.formDefault;C&&Object.keys(C).forEach(y=>{t.search.formDefault[y]=C[y]}),n.column.forEach(y=>{y.show?.search||(t.search.formDefault[y.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",J,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",W,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",q,[e.createVNode(e.unref(m.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.datetime,e.toHandlers(o.options?.datetime?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(g).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(g).customComponent[o.type]),e.mergeProps({key:4,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.[o.type],e.toHandlers(o.options?.[o.type]?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(m.ElFormItem),null,{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.unref(c)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(c)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",v,[e.renderSlot(n.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(K)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:t.table.data},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(c)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(c)(p.option.tools?.add)||e.unref(c)(p.option.tools?.update)||e.unref(c)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:1,label:e.unref(k).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(c)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:a=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",oe,[e.createVNode(e.unref(m.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",re,[e.createVNode(e.unref(m.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",ae,[e.renderSlot(n.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(g).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(g).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ne,[e.createVNode(e.unref(m.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(R,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class se{static async download(s,d="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",d),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,d)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),f=URL.createObjectURL(r),h=document.createElement("a");h.href=f,h.download=`${d||"config"}.json`,h.click()};static importFile=async s=>new Promise((d,r)=>{const f=document.createElement("input");f.type="file";const h=s?.accept||".json";f.accept=h,f.style.display="none",f.onchange=c=>{const t=c.target.files[0];if(!t){b.fail("未选择文件"),r("未选择文件");return}const n=new FileReader;n.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;d(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const U=(p,s)=>{if(p.component("TCurd",F),p.component("TFormList",S),p.component("TColumn",D),s?.customComponent){g.customComponent=s.customComponent;for(const d in s.customComponent)p.component(d,s.customComponent[d])}},ie={install:U};w.ArrUtil=B,w.ExcelUtil=N,w.TColumn=D,w.TCurd=F,w.TFile=se,w.TForm=g,w.TFormList=S,w.TSys=b,w.default=ie,w.install=U,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.cc1Form={},w.Vue,w.ElementPlus))})(this,(function(w,e,m){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,d)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(d):r):typeof s=="function"?s(d):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const d=await b.moduleObj[s]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(s,d,r={}){const f=Date.now();if(!this.tipMessages[s]||f-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=f;const h=Object.assign({message:s,type:d},r);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,d={})=>{this.showMessage(s,"error",d)};static success=(s,d={})=>{this.showMessage(s,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,d=!0)=>{if(d){let r=screen.width/2-500,f=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+r)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(d,r)=>{let f=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(c){let t=c.toDataURL("image/png");d(t)})}catch(c){r(c)}})}class k{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static tableRowKey="_id";static customComponent={};static findOptions=(s,d)=>{const r=s.column.find(h=>h.key===d),f=h=>h.replace(/-([a-z])/g,(c,t)=>t.toUpperCase());if(r)return r.options[f(r.type)]};static setOptionsData=(s,d,r)=>{const f=k.findOptions(s,d);f&&(f.data=r)};static form={openBefore:{parentId:(s,d,r,f)=>{s?d.type===b.EDialog.Insert?(d.form.parentId=s._id,d.form.sort=s.children.length+1):d.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=r.length+1),k.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,d,r)=>{d[s]||(d[s]=[]),d[s].forEach(f=>{r.forEach(h=>{let c=h.default??"";h.type==="number"&&(c=h.default??0),h.type==="boolean"&&(c=h.default??!1),h.type==="time"&&(c=h.default??new Date),f[h.value]===void 0&&(f[h.value]=c)}),f._id||(f._id=B.getIdFun())})};static add=(s,d,r,f)=>{const h=JSONUtil.cp(r);B.setId(s,d,r),d[s].push(h.reduce((c,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),c[t.value]=n,c},{_id:B.getIdFun()})),f?.(d)};static remove=(s,d,r,f)=>{d[s]=d[s].filter(h=>h._id!==r._id),f?.(d)};static getNoIdData=(s,d)=>{const r=JSONUtil.cp(s);return r.forEach(f=>{f._id&&delete f._id,d&&f[d]&&B.getNoIdData(f[d],d)}),r}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},S=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(p,{emit:s}){const d=p,r=e.reactive({show:!1,add:(h,c,t)=>{B.add(h,c,t,()=>{f("change")})},remove:(h,c,t)=>{B.remove(h,c,t,()=>{f("change")})}});e.onMounted(()=>{B.setId(d.field,d.row,d.itemFields),r.show=!0});const f=s;return(h,c)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:c[0]||(c[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...c[2]||(c[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(n,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:c[1]||(c[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>r.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...c[3]||(c[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const d=b.isFun,r=b.EDialog,f=e.ref(),h=p,c=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||r.Insert)===r.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;c.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(c.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,g=o.reduce((E,x)=>E+x.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||g>=i||C===0&&V>1)&&(n.push(o),o=[]),u.rules&&(c.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),c.formColumn=n,c.form=JSONUtil.cp(c.formDefault)},init:async()=>{c.show=!1,await e.nextTick(),c.initColumnForm()}});return c.initColumnForm(),s({ref:f,conf:c}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:f,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.formColumn,i=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"form-start",{row:c.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,c.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:c.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:c.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:c.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(k).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:c.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:c.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class N{static exportToExcel=async(s,d,r)=>{if(!s||s.length===0)return;const f=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return d.forEach(l=>{i[l.label]=n[l.key]}),i}),c=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,c,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${r}.xlsx`)}}function ce(p){return p}const _={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",submit:"提交",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class y{static t(s,...d){return typeof s=="function"?s(...d):(s=String(s),s.replace(/{([^}]+)}/g,(r,f,h)=>typeof d[h]<"u"?d[h]:`{${f}}`))}static tCurd(s,...d){return this.t(this.curd[s],...d)}static curd=_}const L={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const d=e.ref(!1),r=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,c=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,a)=>{h=o,c=a})),n=()=>{d.value=!1,h?.(!0),h=null,c=null},i=()=>{d.value=!1,c?.(new Error("用户取消操作")),h=null,c=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=a=>d.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(m.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),z=(p,s)=>{const d=p.__vccOpts||p;for(const[r,f]of s)d[r]=f;return d},j={},M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function H(p,s){return e.openBlock(),e.createElementBlock("svg",M,[...s[0]||(s[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const K=z(j,[["render",H]]),A={class:"col relative cc1-form-box"},J={class:"absolute row fit",style:{overflow:"hidden"}},W={class:"col column"},q={key:0,class:"relative curd-search"},G={class:"mb-10 flex justify-between items-center"},X={class:"flex items-center",style:{gap:"10px"}},Q={key:0},Y={key:1},Z={key:2},P={class:"export-btn"},v={class:"flex items-center",style:{gap:"10px"}},ee={class:"col fit-width relative"},te={class:"absolute column fit"},oe={class:"row justify-end mt-10 mb-10"},le={class:"row form-item-content",style:{width:"100%"}},ae={class:"col"},re={class:"dialog-footer"},ne={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const d=b.EDialog,r=p,f=e.ref(),h=e.ref(),c=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=y.tCurd("placeholderInput"))=>n.text?.search?.placeholder===void 0?`${i}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(n[l.key]=t.search.form[l.key])});const i=r.option.search?.before?.(n);return i&&(n=i),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(i=>{r.option.search?.resetMode==="none"?n[i]=void 0:n[i]=t.search.formDefault[i]}),t.search.form=JSONUtil.cp(n),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:r.option.page?.size||10,sizeList:r.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:r.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=i=>{let l=[];return i.forEach(o=>{l.push(o[k.tableRowKey]),o.children&&o.children.length>0&&(l=l.concat(n(o.children)))}),l};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=r.option.api.list;try{const i=await n({[k.pageField.size]:t.page.size,[k.pageField.num]:t.page.num,...t.search.getFormData()}),l=k.resultField,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=r.option.data?await r.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}}},export:{run:{start:async n=>{let i=await t.export.run[n](),l=r.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=r.option.tools?.export||{};a.before&&a.before(o),N.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(y.tCurd("noData")),new Error(y.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[k.pageField.size]:t.page.size,[k.pageField.num]:t.page.num,...t.search.getFormData()});return}const n=r.option.api.list,i=await n({[k.pageField.size]:999999,[k.pageField.num]:1});return(i.data||{[k.resultField.list]:i})[k.resultField.list]}catch(n){console.error(n)}finally{t.export.loading=!1}}},loading:!1,click:n=>{t.export.loading||t.export.run.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[k.tableRowKey]:t.update.edit.data[k.tableRowKey]};return Object.keys(t.update.edit.data).forEach(l=>{n[l]!==t.update.edit.data[l]&&(i[l]=n[l])}),i}},open:(n,i)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=n;const l=n===d.Insert;t.update.edit.data=i,t.update.title=l?y.tCurd("add"):y.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await r.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(b.fail(y.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===d.Insert?r.option.api.create:r.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await r.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!n)return;await n({...i}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail(y.tCurd("selectDataToDelete"));return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=r.option.api.delete;try{if(!n)return;await n({[k.tableRowKey]:t.remove.items.map(i=>i[k.tableRowKey]),items:t.remove.items}),b.success(y.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:k.tableRowKey,emptyText:y.tCurd("noData"),highlightCurrentRow:!0}},l=r.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const n=r.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:y.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:y.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await f.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[k.tableRowKey]:g[k.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(E,x,T){t.table.loading=!1}}),t.table.loading=!1,b.success(y.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(E){return console.error(E),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:k.tableRowKey,nodeKey:k.tableRowKey,multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};n.column.forEach(i),n.table?.column?.forEach(i)},initColumnForm:()=>{const n=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=r.option.form?.maxSpan||12,o=r.option.form?.defaultSpan||l/2;let a=[];const u=g=>{if(t.update.formDefault[g.key]=g.value,g.table.table&&(g.show.table&&t.table.column.show.list.push(g.key),g.table.table&&t.table.column.show.listSource.push(g.key)),g.isForm){g.form=g.form||{span:o},g.form.span=g.form.span??o;let V=g.form.span,E=a.reduce((T,de)=>T+de.span,V);const x=a.length;a.push({item:g,span:V}),(x===1&&a[0].span===0||E>=l||V===0&&x>1)&&(i.push(a),a=[]),g.rules&&(t.update.rules[g.key]=g.rules)}};n.column.forEach(g=>{g.isForm=!0,u(g)}),r.option.table?.column?.forEach(g=>{g.isForm=!1,u(g)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(g=>g.table?.table),t.search.column.list.sort((g,V)=>g.sort?.search-V.sort?.search),t.table.column.list.sort((g,V)=>g.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=r.option.search?.formDefault;C&&Object.keys(C).forEach(g=>{t.search.formDefault[g]=C[g]}),n.column.forEach(g=>{g.show?.search||(t.search.formDefault[g.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",J,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",W,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",q,[e.createVNode(e.unref(m.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.datetime,e.toHandlers(o.options?.datetime?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(k).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k).customComponent[o.type]),e.mergeProps({key:4,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.[o.type],e.toHandlers(o.options?.[o.type]?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(m.ElFormItem),null,{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.unref(c)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(c)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",v,[e.renderSlot(n.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(K)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:t.table.data},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(c)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(c)(p.option.tools?.add)||e.unref(c)(p.option.tools?.update)||e.unref(c)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:1,label:e.unref(y).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(c)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:a=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",oe,[e.createVNode(e.unref(m.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",re,[e.createVNode(e.unref(m.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",ae,[e.renderSlot(n.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(k).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ne,[e.createVNode(e.unref(m.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(y).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(R,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class se{static async download(s,d="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",d),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,d)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),f=URL.createObjectURL(r),h=document.createElement("a");h.href=f,h.download=`${d||"config"}.json`,h.click()};static importFile=async s=>new Promise((d,r)=>{const f=document.createElement("input");f.type="file";const h=s?.accept||".json";f.accept=h,f.style.display="none",f.onchange=c=>{const t=c.target.files[0];if(!t){b.fail("未选择文件"),r("未选择文件");return}const n=new FileReader;n.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;d(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const U=(p,s)=>{if(p.component("TCurd",F),p.component("TFormList",S),p.component("TColumn",D),s?.customComponent){k.customComponent=s.customComponent;for(const d in s.customComponent)p.component(d,s.customComponent[d])}},ie={install:U};w.ArrUtil=B,w.ExcelUtil=N,w.TColumn=D,w.TCurd=F,w.TFile=se,w.TForm=k,w.TFormList=S,w.TSys=b,w.default=ie,w.install=U,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -143,7 +143,7 @@ export interface CurdConfig<T = any> {
143
143
  /**
144
144
  * 导出所有数据钩子
145
145
  */
146
- all: () => any;
146
+ all: (param?: T & Record<string, any>) => any;
147
147
  }>;
148
148
  }>;
149
149
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",