cc1-form 1.0.5 → 1.0.6

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,6 +1,6 @@
1
- import { defineComponent as P, reactive as q, onMounted as ee, resolveComponent as Z, createElementBlock as w, createCommentVNode as C, openBlock as p, renderSlot as k, createElementVNode as x, createVNode as v, withCtx as b, createTextVNode as V, Fragment as O, renderList as I, createBlock as g, normalizeClass as X, normalizeStyle as se, ref as T, nextTick as ne, unref as u, mergeProps as E, toHandlers as F, resolveDynamicComponent as te, toDisplayString as W, resolveDirective as ie, withDirectives as re } from "vue";
1
+ import { defineComponent as P, reactive as q, onMounted as ee, resolveComponent as Z, createElementBlock as w, createCommentVNode as C, openBlock as p, renderSlot as k, createElementVNode as x, createVNode as v, withCtx as b, createTextVNode as V, Fragment as O, renderList as I, createBlock as g, normalizeClass as X, normalizeStyle as se, ref as T, nextTick as ne, unref as u, mergeProps as U, toHandlers as F, resolveDynamicComponent as te, toDisplayString as W, resolveDirective as ie, withDirectives as re } from "vue";
2
2
  import { ElMessage as de, ElLoading as ue, ElForm as A, ElFormItem as _, ElInput as K, ElSwitch as H, ElSelect as N, ElOption as M, ElTreeSelect as oe, ElDatePicker as le, ElDialog as G, ElButton as S, ElDropdown as pe, ElDropdownMenu as ce, ElDropdownItem as B, ElTable as fe, ElTableColumn as J, ElPagination as me } from "element-plus";
3
- class U {
3
+ class D {
4
4
  /**
5
5
  * 路由
6
6
  */
@@ -41,9 +41,9 @@ class U {
41
41
  * @param module
42
42
  */
43
43
  static loadModule = async (d) => {
44
- if (!U.moduleObj[d])
44
+ if (!D.moduleObj[d])
45
45
  throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);
46
- const r = await U.moduleObj[d]();
46
+ const r = await D.moduleObj[d]();
47
47
  return r.default ?? r;
48
48
  };
49
49
  /**
@@ -60,7 +60,7 @@ class U {
60
60
  * @param type 消息类型
61
61
  * @param options 其他选项
62
62
  */
63
- static showMessage(d, r, n = {}) {
63
+ static showMessage(d, r, i = {}) {
64
64
  const c = Date.now();
65
65
  if (!this.tipMessages[d] || c - this.tipMessages[d] > this.tipMessagesGap) {
66
66
  this.tipMessages[d] = c;
@@ -69,7 +69,7 @@ class U {
69
69
  message: d,
70
70
  type: r
71
71
  },
72
- n
72
+ i
73
73
  );
74
74
  de(f), setTimeout(() => {
75
75
  delete this.tipMessages[d];
@@ -115,11 +115,11 @@ class U {
115
115
  */
116
116
  static openUrl = (d, r = !0) => {
117
117
  if (r) {
118
- let n = screen.width / 2 - 500, c = screen.height / 2 - 800 / 2 - 30;
118
+ let i = screen.width / 2 - 500, c = screen.height / 2 - 800 / 2 - 30;
119
119
  window.open(
120
120
  d,
121
121
  "_blank",
122
- "toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + c + ", left=" + n
122
+ "toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + c + ", left=" + i
123
123
  );
124
124
  } else
125
125
  window.open(
@@ -133,9 +133,9 @@ class U {
133
133
  * @param param
134
134
  * @returns
135
135
  */
136
- static getImgPic = (d) => new Promise(async (r, n) => {
136
+ static getImgPic = (d) => new Promise(async (r, i) => {
137
137
  let c = document.getElementById(d.id);
138
- const f = await U.loadModule("html2canvas");
138
+ const f = await D.loadModule("html2canvas");
139
139
  try {
140
140
  f(c, {
141
141
  logging: !1,
@@ -147,12 +147,12 @@ class U {
147
147
  windowHeight: d.windowHeight,
148
148
  useCORS: !0,
149
149
  backgroundColor: "#ffffff00"
150
- }).then(function(i) {
151
- let e = i.toDataURL("image/png");
150
+ }).then(function(n) {
151
+ let e = n.toDataURL("image/png");
152
152
  r(e);
153
153
  });
154
- } catch (i) {
155
- n(i);
154
+ } catch (n) {
155
+ i(n);
156
156
  }
157
157
  });
158
158
  }
@@ -168,9 +168,9 @@ class L {
168
168
  * @returns
169
169
  */
170
170
  static findOptions = (d, r) => {
171
- const n = d.column.find((f) => f.key === r), c = (f) => f.replace(/-([a-z])/g, (i, e) => e.toUpperCase());
172
- if (n)
173
- return n.options[c(n.type)];
171
+ const i = d.column.find((f) => f.key === r), c = (f) => f.replace(/-([a-z])/g, (n, e) => e.toUpperCase());
172
+ if (i)
173
+ return i.options[c(i.type)];
174
174
  };
175
175
  /**
176
176
  * 更新组件数据
@@ -188,9 +188,9 @@ class L {
188
188
  }))
189
189
  )
190
190
  */
191
- static setOptionsData = (d, r, n) => {
191
+ static setOptionsData = (d, r, i) => {
192
192
  const c = L.findOptions(d, r);
193
- c && (c.data = n);
193
+ c && (c.data = i);
194
194
  };
195
195
  static form = {
196
196
  openBefore: {
@@ -201,8 +201,8 @@ class L {
201
201
  * @param treeData 树形数据
202
202
  * @param option 组件配置
203
203
  */
204
- parentId: (d, r, n, c) => {
205
- d ? r.type === U.EDialog.Insert ? (r.form.parentId = d._id, r.form.sort = d.children.length + 1) : r.form.parentId = d.parentId.substring(d.parentId.lastIndexOf(",") + 1) : (r.form.parentId = "0", r.form.sort = n.length + 1), L.setOptionsData(c, "parentId", [{ _id: "0", title: "根", children: n }]);
204
+ parentId: (d, r, i, c) => {
205
+ d ? r.type === D.EDialog.Insert ? (r.form.parentId = d._id, r.form.sort = d.children.length + 1) : r.form.parentId = d.parentId.substring(d.parentId.lastIndexOf(",") + 1) : (r.form.parentId = "0", r.form.sort = i.length + 1), L.setOptionsData(c, "parentId", [{ _id: "0", title: "根", children: i }]);
206
206
  }
207
207
  }
208
208
  };
@@ -217,11 +217,11 @@ class j {
217
217
  * @param field 字段名
218
218
  * @param row 行数据
219
219
  */
220
- static setId = (d, r, n) => {
220
+ static setId = (d, r, i) => {
221
221
  r[d] || (r[d] = []), r[d].forEach((c) => {
222
- n.forEach((f) => {
223
- let i = f.default ?? "";
224
- f.type === "number" && (i = f.default ?? 0), f.type === "boolean" && (i = f.default ?? !1), f.type === "time" && (i = f.default ?? /* @__PURE__ */ new Date()), c[f.value] === void 0 && (c[f.value] = i);
222
+ i.forEach((f) => {
223
+ let n = f.default ?? "";
224
+ f.type === "number" && (n = f.default ?? 0), f.type === "boolean" && (n = f.default ?? !1), f.type === "time" && (n = f.default ?? /* @__PURE__ */ new Date()), c[f.value] === void 0 && (c[f.value] = n);
225
225
  }), c._id || (c._id = j.getIdFun());
226
226
  });
227
227
  };
@@ -232,13 +232,13 @@ class j {
232
232
  * @param itemFields 元素字段-如:[{label:'',value:''}]
233
233
  * @param callback 回调函数
234
234
  */
235
- static add = (d, r, n, c) => {
236
- const f = JSONUtil.cp(n);
237
- j.setId(d, r, n), r[d].push(
235
+ static add = (d, r, i, c) => {
236
+ const f = JSONUtil.cp(i);
237
+ j.setId(d, r, i), r[d].push(
238
238
  f.reduce(
239
- (i, e) => {
239
+ (n, e) => {
240
240
  let s = e.default ?? "";
241
- return e.type === "number" && (s = e.default ?? 0), e.type === "boolean" && (s = e.default ?? !1), e.type === "time" && (s = e.default ?? /* @__PURE__ */ new Date()), i[e.value] = s, i;
241
+ return e.type === "number" && (s = e.default ?? 0), e.type === "boolean" && (s = e.default ?? !1), e.type === "time" && (s = e.default ?? /* @__PURE__ */ new Date()), n[e.value] = s, n;
242
242
  },
243
243
  { _id: j.getIdFun() }
244
244
  )
@@ -251,8 +251,8 @@ class j {
251
251
  * @param item 元素-如:{_id:''}
252
252
  * @param callback 回调函数
253
253
  */
254
- static remove = (d, r, n, c) => {
255
- r[d] = r[d].filter((f) => f._id !== n._id), c?.(r);
254
+ static remove = (d, r, i, c) => {
255
+ r[d] = r[d].filter((f) => f._id !== i._id), c?.(r);
256
256
  };
257
257
  /**
258
258
  * 获取没有id的数据
@@ -261,10 +261,10 @@ class j {
261
261
  * @returns 没有id的数据
262
262
  */
263
263
  static getNoIdData = (d, r) => {
264
- const n = JSONUtil.cp(d);
265
- return n.forEach((c) => {
264
+ const i = JSONUtil.cp(d);
265
+ return i.forEach((c) => {
266
266
  c._id && delete c._id, r && c[r] && j.getNoIdData(c[r], r);
267
- }), n;
267
+ }), i;
268
268
  };
269
269
  }
270
270
  const be = {
@@ -310,34 +310,34 @@ const be = {
310
310
  },
311
311
  emits: ["change"],
312
312
  setup(m, { emit: d }) {
313
- const r = m, n = q({
313
+ const r = m, i = q({
314
314
  show: !1,
315
- add: (f, i, e) => {
316
- j.add(f, i, e, () => {
315
+ add: (f, n, e) => {
316
+ j.add(f, n, e, () => {
317
317
  c("change");
318
318
  });
319
319
  },
320
- remove: (f, i, e) => {
321
- j.remove(f, i, e, () => {
320
+ remove: (f, n, e) => {
321
+ j.remove(f, n, e, () => {
322
322
  c("change");
323
323
  });
324
324
  }
325
325
  });
326
326
  ee(() => {
327
- j.setId(r.field, r.row, r.itemFields), n.show = !0;
327
+ j.setId(r.field, r.row, r.itemFields), i.show = !0;
328
328
  });
329
329
  const c = d;
330
- return (f, i) => {
330
+ return (f, n) => {
331
331
  const e = Z("el-button"), s = Z("el-input");
332
- return n.show ? (p(), w("div", be, [
332
+ return i.show ? (p(), w("div", be, [
333
333
  k(f.$slots, "list-start", { row: m.row }),
334
334
  x("div", null, [
335
335
  v(e, {
336
336
  link: "",
337
337
  type: "primary",
338
- onClick: i[0] || (i[0] = (l) => n.add(m.field, m.row, m.itemFields))
338
+ onClick: n[0] || (n[0] = (l) => i.add(m.field, m.row, m.itemFields))
339
339
  }, {
340
- default: b(() => [...i[2] || (i[2] = [
340
+ default: b(() => [...n[2] || (n[2] = [
341
341
  V("添加", -1)
342
342
  ])]),
343
343
  _: 1
@@ -354,7 +354,7 @@ const be = {
354
354
  style: se({ width: m.inputWidth }),
355
355
  class: X(m.inputClass),
356
356
  placeholder: o[m.label] || o[m.value],
357
- onChange: i[1] || (i[1] = (t) => c("change"))
357
+ onChange: n[1] || (n[1] = (t) => c("change"))
358
358
  }, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
359
359
  k(f.$slots, "item-end", {
360
360
  item: l,
@@ -363,9 +363,9 @@ const be = {
363
363
  v(e, {
364
364
  link: "",
365
365
  type: "danger",
366
- onClick: (o) => n.remove(m.field, m.row, l)
366
+ onClick: (o) => i.remove(m.field, m.row, l)
367
367
  }, {
368
- default: b(() => [...i[3] || (i[3] = [
368
+ default: b(() => [...n[3] || (n[3] = [
369
369
  V("删除", -1)
370
370
  ])]),
371
371
  _: 1
@@ -392,50 +392,50 @@ const be = {
392
392
  }
393
393
  },
394
394
  setup(m, { expose: d }) {
395
- const r = U.isFun, n = U.EDialog, c = T(), f = m, i = q({
395
+ const r = D.isFun, i = D.EDialog, c = T(), f = m, n = q({
396
396
  rules: {},
397
397
  show: !0,
398
398
  form: {},
399
399
  formDefault: {},
400
400
  formColumn: [],
401
- getDisabled: (e) => e.disabled?.[(f.type || n.Insert) === n.Insert ? "create" : "update"],
402
- initColumnForm: () => {
401
+ getDisabled: (e) => e.disabled?.[(f.type || i.Insert) === i.Insert ? "create" : "update"],
402
+ initColumnForm: async () => {
403
403
  const e = f.option;
404
- i.formColumn = [];
404
+ n.formColumn = [];
405
405
  const s = [], l = f.option.form?.maxSpan || 12, o = f.option.form?.defaultSpan || l;
406
406
  let t = [];
407
407
  const a = (h) => {
408
- if (i.formDefault[h.key] = h.value, h.isForm) {
408
+ if (n.formDefault[h.key] = h.value, h.isForm) {
409
409
  h.form = h.form || { span: o }, h.form.span = h.form.span ?? o;
410
410
  let $ = h.form.span, y = t.reduce((R, z) => R + z.span, $);
411
- const D = t.length;
412
- t.push({ item: h, span: $ }), (D === 1 && t[0].span === 0 || y >= l || $ === 0 && D > 1) && (s.push(t), t = []), h.rules && (i.rules[h.key] = h.rules);
411
+ const E = t.length;
412
+ t.push({ item: h, span: $ }), (E === 1 && t[0].span === 0 || y >= l || $ === 0 && E > 1) && (s.push(t), t = []), h.rules && (n.rules[h.key] = h.rules);
413
413
  }
414
414
  };
415
415
  e.column.forEach((h) => {
416
416
  h.isForm = !0, a(h);
417
- }), t.length > 0 && s.push(t), i.formColumn = s;
417
+ }), t.length > 0 && s.push(t), n.formColumn = s, n.form = JSONUtil.cp(n.formDefault);
418
418
  },
419
419
  init: async () => {
420
- i.show = !1, await ne(), i.initColumnForm(), i.show = !0;
420
+ n.show = !1, await ne(), n.initColumnForm();
421
421
  }
422
422
  });
423
- return i.initColumnForm(), d({
423
+ return n.initColumnForm(), d({
424
424
  ref: c,
425
- conf: i
425
+ conf: n
426
426
  }), (e, s) => (p(), g(u(A), {
427
427
  ref_key: "ruleFormRef",
428
428
  ref: c,
429
- model: i.form,
430
- rules: i.rules
429
+ model: n.form,
430
+ rules: n.rules
431
431
  }, {
432
432
  default: b(() => [
433
- i.show ? (p(!0), w(O, { key: 0 }, I(i.formColumn, (l) => (p(), w("div", ye, [
433
+ n.show ? (p(!0), w(O, { key: 0 }, I(n.formColumn, (l) => (p(), w("div", ye, [
434
434
  k(e.$slots, "form-start", {
435
- row: i.form
435
+ row: n.form
436
436
  }),
437
437
  (p(!0), w(O, null, I(l, (o) => (p(), w(O, null, [
438
- u(r)(o.item.show?.form, i.form) ?? !0 ? (p(), w("div", {
438
+ u(r)(o.item.show?.form, n.form) ?? !0 ? (p(), w("div", {
439
439
  key: 0,
440
440
  class: X(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
441
441
  }, [
@@ -446,31 +446,31 @@ const be = {
446
446
  }, {
447
447
  default: b(() => [
448
448
  k(e.$slots, "form-" + o.item.key + "-start", {
449
- row: i.form,
449
+ row: n.form,
450
450
  item: o.item
451
451
  }),
452
452
  k(e.$slots, "form-" + o.item.key, {
453
- row: i.form,
453
+ row: n.form,
454
454
  item: o.item
455
455
  }, () => [
456
- o.item.type === "input" ? (p(), g(u(K), E({
456
+ o.item.type === "input" ? (p(), g(u(K), U({
457
457
  key: 0,
458
- modelValue: i.form[o.item.key],
459
- "onUpdate:modelValue": (t) => i.form[o.item.key] = t
458
+ modelValue: n.form[o.item.key],
459
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
460
460
  }, { ref_for: !0 }, o.item.options?.input, F(o.item.options?.input?.on || {}), {
461
- disabled: i.getDisabled(o.item)
462
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (p(), g(u(H), E({
461
+ disabled: n.getDisabled(o.item)
462
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (p(), g(u(H), U({
463
463
  key: 1,
464
- modelValue: i.form[o.item.key],
465
- "onUpdate:modelValue": (t) => i.form[o.item.key] = t
464
+ modelValue: n.form[o.item.key],
465
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
466
466
  }, { ref_for: !0 }, o.item.options?.switch, F(o.item.options?.switch?.on || {}), {
467
- disabled: i.getDisabled(o.item)
468
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (p(), g(u(N), E({
467
+ disabled: n.getDisabled(o.item)
468
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (p(), g(u(N), U({
469
469
  key: 2,
470
- modelValue: i.form[o.item.key],
471
- "onUpdate:modelValue": (t) => i.form[o.item.key] = t
470
+ modelValue: n.form[o.item.key],
471
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
472
472
  }, { ref_for: !0 }, o.item.options?.select, F(o.item.options?.select?.on || {}), {
473
- disabled: i.getDisabled(o.item),
473
+ disabled: n.getDisabled(o.item),
474
474
  style: { width: "100%" }
475
475
  }), {
476
476
  default: b(() => [
@@ -481,36 +481,36 @@ const be = {
481
481
  }, null, 8, ["label", "value"]))), 128))
482
482
  ]),
483
483
  _: 2
484
- }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (p(), g(Q, E({
484
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (p(), g(Q, U({
485
485
  key: 3,
486
- row: i.form,
486
+ row: n.form,
487
487
  field: o.item.key
488
488
  }, { ref_for: !0 }, o.item.options?.list, F(o.item.options?.list?.on || {}), {
489
- disabled: i.getDisabled(o.item),
489
+ disabled: n.getDisabled(o.item),
490
490
  style: { width: "100%" }
491
- }), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (p(), g(u(oe), E({
491
+ }), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (p(), g(u(oe), U({
492
492
  key: 4,
493
- modelValue: i.form[o.item.key],
494
- "onUpdate:modelValue": (t) => i.form[o.item.key] = t
493
+ modelValue: n.form[o.item.key],
494
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
495
495
  }, { ref_for: !0 }, o.item.options?.treeSelect, F(o.item.options?.treeSelect?.on || {}), {
496
- disabled: i.getDisabled(o.item),
496
+ disabled: n.getDisabled(o.item),
497
497
  style: { width: "100%" }
498
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (p(), g(u(le), E({
498
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (p(), g(u(le), U({
499
499
  key: 5,
500
- modelValue: i.form[o.item.key],
501
- "onUpdate:modelValue": (t) => i.form[o.item.key] = t
500
+ modelValue: n.form[o.item.key],
501
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
502
502
  }, { ref_for: !0 }, o.item.options?.datetime, F(o.item.options?.datetime?.on || {}), {
503
- disabled: i.getDisabled(o.item)
504
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(L).customComponent[o.item.type] ? (p(), g(te(u(L).customComponent[o.item.type]), E({
503
+ disabled: n.getDisabled(o.item)
504
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(L).customComponent[o.item.type] ? (p(), g(te(u(L).customComponent[o.item.type]), U({
505
505
  key: 6,
506
- modelValue: i.form[o.item.key],
507
- "onUpdate:modelValue": (t) => i.form[o.item.key] = t
506
+ modelValue: n.form[o.item.key],
507
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
508
508
  }, { ref_for: !0 }, o.item.options?.[o.item.type], F(o.item.options?.[o.item.type]?.on || {}), {
509
- disabled: i.getDisabled(o.item)
509
+ disabled: n.getDisabled(o.item)
510
510
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
511
511
  ]),
512
512
  k(e.$slots, "form-" + o.item.key + "-end", {
513
- row: i.form,
513
+ row: n.form,
514
514
  item: o.item
515
515
  })
516
516
  ]),
@@ -519,7 +519,7 @@ const be = {
519
519
  ], 2)) : C("", !0)
520
520
  ], 64))), 256)),
521
521
  k(e.$slots, "form-end", {
522
- row: i.form
522
+ row: n.form
523
523
  })
524
524
  ]))), 256)) : C("", !0)
525
525
  ]),
@@ -534,34 +534,34 @@ class we {
534
534
  * @param columns 列
535
535
  * @param fileName 文件名
536
536
  */
537
- static exportToExcel = async (d, r, n) => {
538
- const c = await U.loadModule("xlsx"), f = d.map((s) => {
537
+ static exportToExcel = async (d, r, i) => {
538
+ const c = await D.loadModule("xlsx"), f = d.map((s) => {
539
539
  const l = {};
540
540
  return r.forEach((o) => {
541
541
  l[o.label] = s[o.key];
542
542
  }), l;
543
- }), i = c.utils.json_to_sheet(f), e = c.utils.book_new();
544
- c.utils.book_append_sheet(e, i, "Sheet1"), n ? typeof n == "function" && (n = n()) : n = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, c.writeFile(e, `${n}.xlsx`);
543
+ }), n = c.utils.json_to_sheet(f), e = c.utils.book_new();
544
+ c.utils.book_append_sheet(e, n, "Sheet1"), i ? typeof i == "function" && (i = i()) : i = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, c.writeFile(e, `${i}.xlsx`);
545
545
  };
546
546
  }
547
547
  const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
548
548
  __name: "switchConfirm",
549
549
  setup(m, { expose: d }) {
550
- const r = T(!1), n = T("确认修改"), c = T("确认要修改状态吗?");
551
- let f = null, i = null;
552
- const e = (o) => (o?.title && (n.value = o.title), o?.content && (c.value = o.content), r.value = !0, new Promise((t, a) => {
553
- f = t, i = a;
550
+ const r = T(!1), i = T("确认修改"), c = T("确认要修改状态吗?");
551
+ let f = null, n = null;
552
+ const e = (o) => (o?.title && (i.value = o.title), o?.content && (c.value = o.content), r.value = !0, new Promise((t, a) => {
553
+ f = t, n = a;
554
554
  })), s = () => {
555
- r.value = !1, f?.(!0), f = null, i = null;
555
+ r.value = !1, f?.(!0), f = null, n = null;
556
556
  }, l = () => {
557
- r.value = !1, i?.(new Error("用户取消操作")), f = null, i = null;
557
+ r.value = !1, n?.(new Error("用户取消操作")), f = null, n = null;
558
558
  };
559
559
  return d({
560
560
  open: e
561
561
  }), (o, t) => (p(), g(u(G), {
562
562
  modelValue: r.value,
563
563
  "onUpdate:modelValue": t[0] || (t[0] = (a) => r.value = a),
564
- title: n.value,
564
+ title: i.value,
565
565
  "close-on-click-modal": !1,
566
566
  width: "400px"
567
567
  }, {
@@ -593,10 +593,10 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
593
593
  }), Ce = { class: "col relative cc1-form-box" }, Ve = {
594
594
  class: "absolute row fit",
595
595
  style: { overflow: "hidden" }
596
- }, Ee = { class: "col column" }, Ue = {
596
+ }, Ue = { class: "col column" }, De = {
597
597
  key: 0,
598
598
  class: "relative curd-search"
599
- }, De = { class: "mb-20 flex justify-between items-center" }, xe = {
599
+ }, Ee = { class: "mb-20 flex justify-between items-center" }, xe = {
600
600
  class: "flex items-center",
601
601
  style: { gap: "10px" }
602
602
  }, $e = { key: 0 }, Oe = { key: 1 }, Se = { key: 2 }, Fe = { class: "export-btn" }, Ie = {
@@ -616,7 +616,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
616
616
  }
617
617
  },
618
618
  setup(m, { expose: d }) {
619
- const r = U.EDialog, n = m, c = T(), f = T(), i = U.isFun, e = q({
619
+ const r = D.EDialog, i = m, c = T(), f = T(), n = D.isFun, e = q({
620
620
  search: {
621
621
  column: {
622
622
  list: []
@@ -625,16 +625,16 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
625
625
  formDefault: {},
626
626
  getFormData: () => {
627
627
  let s = {};
628
- n.option.column.forEach((o) => {
628
+ i.option.column.forEach((o) => {
629
629
  (typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (s[o.key] = e.search.form[o.key]);
630
630
  });
631
- const l = n.option.search?.before?.(s);
631
+ const l = i.option.search?.before?.(s);
632
632
  return l && (s = l), s;
633
633
  },
634
634
  reset: () => {
635
635
  const s = e.search.formDefault;
636
636
  Object.keys(s).forEach((l) => {
637
- n.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
637
+ i.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
638
638
  }), e.search.form = JSONUtil.cp(s), e.page.num = 1, e.table.getList();
639
639
  },
640
640
  submit: () => {
@@ -642,11 +642,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
642
642
  }
643
643
  },
644
644
  page: {
645
- size: n.option.page?.size || 10,
646
- sizeList: n.option.page?.sizeList || [10, 20, 50, 100],
645
+ size: i.option.page?.size || 10,
646
+ sizeList: i.option.page?.sizeList || [10, 20, 50, 100],
647
647
  num: 1,
648
648
  total: 0,
649
- layout: n.option.page?.layout || "total, sizes, prev, pager, next, jumper"
649
+ layout: i.option.page?.layout || "total, sizes, prev, pager, next, jumper"
650
650
  },
651
651
  table: {
652
652
  loading: !1,
@@ -692,7 +692,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
692
692
  },
693
693
  getList: async () => {
694
694
  e.table.loading = !0;
695
- const s = n.option.api.list, l = await s({
695
+ const s = i.option.api.list, l = await s({
696
696
  size: e.page.size,
697
697
  num: e.page.num,
698
698
  ...e.search.getFormData(),
@@ -701,7 +701,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
701
701
  }
702
702
  }), o = l.data || { list: l };
703
703
  let t = Array.isArray(o.list) ? o.list : o;
704
- e.table.data = n.option.data ? await n.option.data(t) : t, e.page.total = o.total || 0;
704
+ e.table.data = i.option.data ? await i.option.data(t) : t, e.page.total = o.total || 0;
705
705
  },
706
706
  selection: {
707
707
  list: [],
@@ -711,26 +711,26 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
711
711
  },
712
712
  exportFun: {
713
713
  start: async (s) => {
714
- let l = await e.table.exportFun[s](), o = n.option.column;
714
+ let l = await e.table.exportFun[s](), o = i.option.column;
715
715
  const t = JSONUtil.cp({
716
716
  data: l,
717
717
  columns: o
718
- }), a = n.option.tools?.export || {};
718
+ }), a = i.option.tools?.export || {};
719
719
  a.before && a.before(t), we.exportToExcel(t.data, t.columns, a.fileName);
720
720
  },
721
721
  select: () => {
722
722
  if (e.table.selection.list.length === 0)
723
- throw U.fail("请选择要导出的数据"), new Error("请选择要导出的数据");
723
+ throw D.fail("请选择要导出的数据"), new Error("请选择要导出的数据");
724
724
  return e.table.selection.list;
725
725
  },
726
726
  page: () => {
727
727
  if (e.table.data.length === 0)
728
- throw U.fail("暂无数据"), new Error("暂无数据");
728
+ throw D.fail("暂无数据"), new Error("暂无数据");
729
729
  return e.table.data;
730
730
  },
731
731
  all: async () => {
732
732
  e.table.loading = !0;
733
- const s = n.option.api.list, { data: l } = await s({
733
+ const s = i.option.api.list, { data: l } = await s({
734
734
  size: 999999,
735
735
  num: 1,
736
736
  final(o, t, a) {
@@ -764,7 +764,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
764
764
  * 将form填入数据和data比对差异数据返回
765
765
  */
766
766
  getApiData: (s) => {
767
- if (n.option.form?.editAll)
767
+ if (i.option.form?.editAll)
768
768
  return s;
769
769
  let l = {
770
770
  _id: e.update.edit.data._id
@@ -778,17 +778,17 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
778
778
  e.update.showContent || FunUtil.throttle(async () => {
779
779
  e.update.type = s;
780
780
  const o = s === r.Insert;
781
- e.update.edit.data = l, e.update.title = o ? "新增" : "编辑", e.update.form = JSONUtil.cp(o ? e.update.formDefault : l), await n.option.form?.openBefore?.(l, e.update), e.update.show = !0, e.update.showContent = !0, n.option.form?.openAfter?.(l, e.update);
781
+ e.update.edit.data = l, e.update.title = o ? "新增" : "编辑", e.update.form = JSONUtil.cp(o ? e.update.formDefault : l), await i.option.form?.openBefore?.(l, e.update), e.update.show = !0, e.update.showContent = !0, i.option.form?.openAfter?.(l, e.update);
782
782
  });
783
783
  },
784
784
  submit: () => {
785
785
  FunUtil.throttle(async () => {
786
786
  await f.value?.validate(async (o, t) => new Promise((a, h) => {
787
- o || (U.fail("请检查表单数据"), h(!1)), a();
787
+ o || (D.fail("请检查表单数据"), h(!1)), a();
788
788
  })), e.update.loading = !0;
789
- const s = e.update.type === r.Insert ? n.option.api.create : n.option.api.update;
789
+ const s = e.update.type === r.Insert ? i.option.api.create : i.option.api.update;
790
790
  let l = JSONUtil.cp(e.update.form);
791
- delete l.children, await n.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
791
+ delete l.children, await i.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
792
792
  if (typeof l[o] == "string" && l[o].indexOf("T") > -1) {
793
793
  const t = new Date(l[o]).getTime();
794
794
  !isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (l[o] = t);
@@ -798,7 +798,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
798
798
  final(o, t, a) {
799
799
  e.update.loading = !1;
800
800
  }
801
- }), e.update.close(), await e.table.getList(), n.option.form?.submitAfter?.(l, e.update);
801
+ }), e.update.close(), await e.table.getList(), i.option.form?.submitAfter?.(l, e.update);
802
802
  });
803
803
  },
804
804
  close: () => {
@@ -817,7 +817,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
817
817
  },
818
818
  open: (s) => {
819
819
  if (s.length === 0) {
820
- U.fail("请选择要删除的数据");
820
+ D.fail("请选择要删除的数据");
821
821
  return;
822
822
  }
823
823
  e.remove.items = s, e.remove.show = !0;
@@ -825,13 +825,13 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
825
825
  submit: () => {
826
826
  FunUtil.throttle(async () => {
827
827
  e.table.loading = !0;
828
- const s = n.option.api.delete;
828
+ const s = i.option.api.delete;
829
829
  await s({
830
830
  _id: e.remove.items.map((l) => l._id),
831
831
  final(l, o, t) {
832
832
  e.table.loading = !1;
833
833
  }
834
- }), U.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
834
+ }), D.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
835
835
  });
836
836
  }
837
837
  },
@@ -857,7 +857,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
857
857
  emptyText: "暂无数据",
858
858
  highlightCurrentRow: !0
859
859
  }
860
- }, o = n.option;
860
+ }, o = i.option;
861
861
  Object.keys(l).forEach((t) => {
862
862
  o[t] = ObjectUtil.deepMerge(l[t], o[t] || {});
863
863
  });
@@ -868,7 +868,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
868
868
  * @returns
869
869
  */
870
870
  initColumnOptions: () => {
871
- const s = n.option, l = (o) => {
871
+ const s = i.option, l = (o) => {
872
872
  const a = {
873
873
  options: {
874
874
  switch: {
@@ -877,18 +877,18 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
877
877
  inactiveValue: !1,
878
878
  inactiveLabel: "关闭",
879
879
  tableBeforeChange: async ($, y) => {
880
- const D = o.options?.switch;
880
+ const E = o.options?.switch;
881
881
  try {
882
882
  return await c.value?.open({
883
883
  title: "确认修改",
884
- content: `确认要${y[$] === D.activeValue ? D.inactiveLabel : D.activeLabel}吗?`
885
- }), e.table.loading = !0, await n.option.api.update({
884
+ content: `确认要${y[$] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
885
+ }), e.table.loading = !0, await i.option.api.update({
886
886
  _id: y._id,
887
- [$]: y[$] === D.activeValue ? D.inactiveValue : D.activeValue,
887
+ [$]: y[$] === E.activeValue ? E.inactiveValue : E.activeValue,
888
888
  final(R, z, Y) {
889
889
  e.table.loading = !1;
890
890
  }
891
- }), U.success("操作成功"), e.table.getList(), !0;
891
+ }), D.success("操作成功"), e.table.getList(), !0;
892
892
  } catch {
893
893
  return !1;
894
894
  }
@@ -931,27 +931,27 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
931
931
  s.column.forEach(l), s.table?.column?.forEach(l);
932
932
  },
933
933
  initColumnForm: () => {
934
- const s = n.option;
934
+ const s = i.option;
935
935
  e.update.formColumn = [], e.table.column.show = {
936
936
  list: [],
937
937
  listSource: []
938
938
  };
939
- const l = [], o = n.option.form?.maxSpan || 12, t = n.option.form?.defaultSpan || o / 2;
939
+ const l = [], o = i.option.form?.maxSpan || 12, t = i.option.form?.defaultSpan || o / 2;
940
940
  let a = [];
941
941
  const h = (y) => {
942
942
  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) {
943
943
  y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
944
- let D = y.form.span, R = a.reduce((Y, ae) => Y + ae.span, D);
944
+ let E = y.form.span, R = a.reduce((Y, ae) => Y + ae.span, E);
945
945
  const z = a.length;
946
- a.push({ item: y, span: D }), (z === 1 && a[0].span === 0 || R >= o || D === 0 && z > 1) && (l.push(a), a = []), y.rules && (e.update.rules[y.key] = y.rules);
946
+ a.push({ item: y, span: E }), (z === 1 && a[0].span === 0 || R >= o || E === 0 && z > 1) && (l.push(a), a = []), y.rules && (e.update.rules[y.key] = y.rules);
947
947
  }
948
948
  };
949
949
  s.column.forEach((y) => {
950
950
  y.isForm = !0, h(y);
951
- }), n.option.table?.column?.forEach((y) => {
951
+ }), i.option.table?.column?.forEach((y) => {
952
952
  y.isForm = !1, h(y);
953
- }), e.search.column.list = s.column.concat(s.table?.column || []), e.table.column.list = e.search.column.list.filter((y) => y.table?.table), e.search.column.list.sort((y, D) => y.sort?.search - D.sort?.search), e.table.column.list.sort((y, D) => y.sort?.table - D.sort?.table), a.length > 0 && l.push(a), e.update.formColumn = l;
954
- const $ = n.option.search?.formDefault;
953
+ }), e.search.column.list = s.column.concat(s.table?.column || []), e.table.column.list = e.search.column.list.filter((y) => y.table?.table), e.search.column.list.sort((y, E) => y.sort?.search - E.sort?.search), e.table.column.list.sort((y, E) => y.sort?.table - E.sort?.table), a.length > 0 && l.push(a), e.update.formColumn = l;
954
+ const $ = i.option.search?.formDefault;
955
955
  $ && Object.keys($).forEach((y) => {
956
956
  e.search.formDefault[y] = $[y];
957
957
  }), s.column.forEach((y) => {
@@ -968,8 +968,8 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
968
968
  return p(), w("div", Ce, [
969
969
  x("div", Ve, [
970
970
  k(s.$slots, "box-left"),
971
- x("div", Ee, [
972
- m.option.search?.show !== !1 ? (p(), w("div", Ue, [
971
+ x("div", Ue, [
972
+ m.option.search?.show !== !1 ? (p(), w("div", De, [
973
973
  v(u(A), {
974
974
  model: e.search.form,
975
975
  inline: ""
@@ -1073,9 +1073,9 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1073
1073
  _: 3
1074
1074
  }, 8, ["model"])
1075
1075
  ])) : C("", !0),
1076
- x("div", De, [
1076
+ x("div", Ee, [
1077
1077
  x("div", xe, [
1078
- u(i)(m.option.tools?.add) ? (p(), w("div", $e, [
1078
+ u(n)(m.option.tools?.add) ? (p(), w("div", $e, [
1079
1079
  v(u(S), {
1080
1080
  type: "primary",
1081
1081
  onClick: l[0] || (l[0] = (t) => e.update.open(u(r).Insert))
@@ -1086,7 +1086,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1086
1086
  _: 1
1087
1087
  })
1088
1088
  ])) : C("", !0),
1089
- m.option.table?.selectable && u(i)(m.option.tools?.delete) ? (p(), w("div", Oe, [
1089
+ m.option.table?.selectable && u(n)(m.option.tools?.delete) ? (p(), w("div", Oe, [
1090
1090
  v(u(S), {
1091
1091
  type: "danger",
1092
1092
  onClick: l[1] || (l[1] = (t) => e.remove.open(e.table.selection.list))
@@ -1157,7 +1157,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1157
1157
  ]),
1158
1158
  x("div", je, [
1159
1159
  x("div", Le, [
1160
- re((p(), g(u(fe), E({
1160
+ re((p(), g(u(fe), U({
1161
1161
  data: e.table.data
1162
1162
  }, m.option.table, {
1163
1163
  onSelectionChange: e.table.selection.change,
@@ -1165,7 +1165,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1165
1165
  onExpandChange: e.table.expand.change
1166
1166
  }), {
1167
1167
  default: b(() => [
1168
- m.option.table?.selectable && u(i)(m.option.tools?.delete) ? (p(), g(u(J), {
1168
+ m.option.table?.selectable && u(n)(m.option.tools?.delete) ? (p(), g(u(J), {
1169
1169
  key: 0,
1170
1170
  type: "selection",
1171
1171
  selectable: typeof m.option.table?.selectable == "function" ? m.option.table?.selectable : void 0,
@@ -1174,7 +1174,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1174
1174
  (p(!0), w(O, null, I(e.table.column.list, (t) => (p(), w(O, {
1175
1175
  key: t.key
1176
1176
  }, [
1177
- e.table.column.show.list.includes(t.key) ? (p(), g(u(J), E({
1177
+ e.table.column.show.list.includes(t.key) ? (p(), g(u(J), U({
1178
1178
  key: 0,
1179
1179
  prop: t.key,
1180
1180
  label: t.label
@@ -1184,7 +1184,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1184
1184
  row: a,
1185
1185
  item: t
1186
1186
  }, () => [
1187
- t.type === "switch" ? (p(), g(u(H), E({
1187
+ t.type === "switch" ? (p(), g(u(H), U({
1188
1188
  key: 0,
1189
1189
  modelValue: a[t.key],
1190
1190
  "onUpdate:modelValue": (h) => a[t.key] = h,
@@ -1197,7 +1197,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1197
1197
  _: 2
1198
1198
  }, 1040, ["prop", "label"])) : C("", !0)
1199
1199
  ], 64))), 128)),
1200
- u(i)(m.option.tools?.add) || u(i)(m.option.tools?.update) || u(i)(m.option.tools?.delete) || s.$slots["table-op-left"] || s.$slots["table-op-right"] ? (p(), g(u(J), {
1200
+ u(n)(m.option.tools?.add) || u(n)(m.option.tools?.update) || u(n)(m.option.tools?.delete) || s.$slots["table-op-left"] || s.$slots["table-op-right"] ? (p(), g(u(J), {
1201
1201
  key: 1,
1202
1202
  label: "操作",
1203
1203
  width: "180",
@@ -1206,7 +1206,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1206
1206
  }, {
1207
1207
  default: b(({ row: t }) => [
1208
1208
  k(s.$slots, "table-op-left", { row: t }),
1209
- u(i)(m.option.tools?.add, t) ? (p(), g(u(S), {
1209
+ u(n)(m.option.tools?.add, t) ? (p(), g(u(S), {
1210
1210
  key: 0,
1211
1211
  link: "",
1212
1212
  type: "primary",
@@ -1217,7 +1217,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1217
1217
  ])]),
1218
1218
  _: 1
1219
1219
  }, 8, ["onClick"])) : C("", !0),
1220
- u(i)(m.option.tools?.update, t) ? (p(), g(u(S), {
1220
+ u(n)(m.option.tools?.update, t) ? (p(), g(u(S), {
1221
1221
  key: 1,
1222
1222
  link: "",
1223
1223
  type: "warning",
@@ -1228,7 +1228,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1228
1228
  ])]),
1229
1229
  _: 1
1230
1230
  }, 8, ["onClick"])) : C("", !0),
1231
- u(i)(m.option.tools?.delete, t) ? (p(), g(u(S), {
1231
+ u(n)(m.option.tools?.delete, t) ? (p(), g(u(S), {
1232
1232
  key: 2,
1233
1233
  link: "",
1234
1234
  type: "danger",
@@ -1269,7 +1269,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1269
1269
  ]),
1270
1270
  k(s.$slots, "box-right")
1271
1271
  ]),
1272
- v(u(G), E({
1272
+ v(u(G), U({
1273
1273
  modelValue: e.update.show,
1274
1274
  "onUpdate:modelValue": l[5] || (l[5] = (t) => e.update.show = t),
1275
1275
  title: e.update.title,
@@ -1311,7 +1311,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1311
1311
  row: e.update.form
1312
1312
  }),
1313
1313
  (p(!0), w(O, null, I(t, (a) => (p(), w(O, null, [
1314
- u(i)(a.item.show?.form, e.update.form) ? (p(), w("div", {
1314
+ u(n)(a.item.show?.form, e.update.form) ? (p(), w("div", {
1315
1315
  key: 0,
1316
1316
  class: X(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
1317
1317
  }, [
@@ -1331,19 +1331,19 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1331
1331
  row: e.update.form,
1332
1332
  item: a.item
1333
1333
  }, () => [
1334
- a.item.type === "input" ? (p(), g(u(K), E({
1334
+ a.item.type === "input" ? (p(), g(u(K), U({
1335
1335
  key: 0,
1336
1336
  modelValue: e.update.form[a.item.key],
1337
1337
  "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1338
1338
  }, { ref_for: !0 }, a.item.options?.input, F(a.item.options?.input?.on || {}), {
1339
1339
  disabled: e.update.getDisabled(a.item)
1340
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "switch" ? (p(), g(u(H), E({
1340
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "switch" ? (p(), g(u(H), U({
1341
1341
  key: 1,
1342
1342
  modelValue: e.update.form[a.item.key],
1343
1343
  "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1344
1344
  }, { ref_for: !0 }, a.item.options?.switch, {
1345
1345
  disabled: e.update.getDisabled(a.item)
1346
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (p(), g(u(N), E({
1346
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (p(), g(u(N), U({
1347
1347
  key: 2,
1348
1348
  modelValue: e.update.form[a.item.key],
1349
1349
  "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
@@ -1359,27 +1359,27 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1359
1359
  }, null, 8, ["label", "value"]))), 128))
1360
1360
  ]),
1361
1361
  _: 2
1362
- }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "list" ? (p(), g(Q, E({
1362
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "list" ? (p(), g(Q, U({
1363
1363
  key: 3,
1364
1364
  row: e.update.form,
1365
1365
  field: a.item.key
1366
1366
  }, { ref_for: !0 }, a.item.options?.list, F(a.item.options?.list?.on || {}), {
1367
1367
  disabled: e.update.getDisabled(a.item),
1368
1368
  style: { width: "100%" }
1369
- }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (p(), g(u(oe), E({
1369
+ }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (p(), g(u(oe), U({
1370
1370
  key: 4,
1371
1371
  modelValue: e.update.form[a.item.key],
1372
1372
  "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1373
1373
  }, { ref_for: !0 }, a.item.options?.treeSelect, F(a.item.options?.treeSelect?.on || {}), {
1374
1374
  disabled: e.update.getDisabled(a.item),
1375
1375
  style: { width: "100%" }
1376
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (p(), g(u(le), E({
1376
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (p(), g(u(le), U({
1377
1377
  key: 5,
1378
1378
  modelValue: e.update.form[a.item.key],
1379
1379
  "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1380
1380
  }, { ref_for: !0 }, a.item.options?.datetime, F(a.item.options?.datetime?.on || {}), {
1381
1381
  disabled: e.update.getDisabled(a.item)
1382
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(L).customComponent[a.item.type] ? (p(), g(te(u(L).customComponent[a.item.type]), E({
1382
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(L).customComponent[a.item.type] ? (p(), g(te(u(L).customComponent[a.item.type]), U({
1383
1383
  key: 6,
1384
1384
  modelValue: e.update.form[a.item.key],
1385
1385
  "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
@@ -1454,8 +1454,8 @@ class We {
1454
1454
  * 通过文件远程地址下载文件
1455
1455
  */
1456
1456
  static async download(d, r = "download.png") {
1457
- const n = document.createElement("a");
1458
- n.style.display = "none", n.href = d, n.setAttribute("download", r), typeof n.download > "u" && n.setAttribute("target", "_blank"), document.body.appendChild(n), n.click(), document.body.removeChild(n), window.URL.revokeObjectURL(d);
1457
+ const i = document.createElement("a");
1458
+ i.style.display = "none", i.href = d, i.setAttribute("download", r), typeof i.download > "u" && i.setAttribute("target", "_blank"), document.body.appendChild(i), i.click(), document.body.removeChild(i), window.URL.revokeObjectURL(d);
1459
1459
  }
1460
1460
  /**
1461
1461
  * 将json对象或者json数组导出为json文件保存
@@ -1463,7 +1463,7 @@ class We {
1463
1463
  * @param name
1464
1464
  */
1465
1465
  static exportJSONFile = (d, r) => {
1466
- const n = new Blob([JSON.stringify(d)], { type: "application/json" }), c = URL.createObjectURL(n), f = document.createElement("a");
1466
+ const i = new Blob([JSON.stringify(d)], { type: "application/json" }), c = URL.createObjectURL(i), f = document.createElement("a");
1467
1467
  f.href = c, f.download = `${r || "config"}.json`, f.click();
1468
1468
  };
1469
1469
  /**
@@ -1471,14 +1471,14 @@ class We {
1471
1471
  * @param param
1472
1472
  * @returns
1473
1473
  */
1474
- static importFile = async (d) => new Promise((r, n) => {
1474
+ static importFile = async (d) => new Promise((r, i) => {
1475
1475
  const c = document.createElement("input");
1476
1476
  c.type = "file";
1477
1477
  const f = d?.accept || ".json";
1478
- c.accept = f, c.style.display = "none", c.onchange = (i) => {
1479
- const e = i.target.files[0];
1478
+ c.accept = f, c.style.display = "none", c.onchange = (n) => {
1479
+ const e = n.target.files[0];
1480
1480
  if (!e) {
1481
- U.fail("未选择文件"), n("未选择文件");
1481
+ D.fail("未选择文件"), i("未选择文件");
1482
1482
  return;
1483
1483
  }
1484
1484
  const s = new FileReader();
@@ -1486,7 +1486,7 @@ class We {
1486
1486
  const o = f == ".json" ? JSON.parse(l.target.result) : l.target.result;
1487
1487
  r(o);
1488
1488
  }, s.onerror = () => {
1489
- U.fail("文件读取失败"), n("文件读取失败");
1489
+ D.fail("文件读取失败"), i("文件读取失败");
1490
1490
  }, s.readAsText(e), document.body.removeChild(c);
1491
1491
  }, document.body.appendChild(c), c.click();
1492
1492
  });
@@ -1506,6 +1506,6 @@ export {
1506
1506
  We as TFile,
1507
1507
  L as TForm,
1508
1508
  Q as TFormList,
1509
- U as TSys,
1509
+ D as TSys,
1510
1510
  Ae as install
1511
1511
  };
@@ -1 +1 @@
1
- (function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y.cc1Form={},y.Vue,y.ElementPlus))})(this,(function(y,e,p){"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=(c,d)=>typeof c=="function"?c(d):c;static getRouterParams=()=>{const c=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(c).length?c:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async c=>{if(!b.moduleObj[c])throw new Error(`模块${c}未加载,请赋值如:TSys.moduleObj = { ${c}: ()=>import('${c}') }`);const d=await b.moduleObj[c]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(c,d,s={}){const f=Date.now();if(!this.tipMessages[c]||f-this.tipMessages[c]>this.tipMessagesGap){this.tipMessages[c]=f;const m=Object.assign({message:c,type:d},s);p.ElMessage(m),setTimeout(()=>{delete this.tipMessages[c]},this.tipMessagesGap)}}static fail=(c,d={})=>{this.showMessage(c,"error",d)};static success=(c,d={})=>{this.showMessage(c,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(c=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{c?this.loadingObj=p.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(c,d=!0)=>{if(d){let s=screen.width/2-500,f=screen.height/2-800/2-30;window.open(c,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+s)}else window.open(c,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=c=>new Promise(async(d,s)=>{let f=document.getElementById(c.id);const m=await b.loadModule("html2canvas");try{m(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:c.windowWidth,height:c.windowHeight,windowWidth:c.windowWidth,windowHeight:c.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(i){let t=i.toDataURL("image/png");d(t)})}catch(i){s(i)}})}class V{static customComponent={};static findOptions=(c,d)=>{const s=c.column.find(m=>m.key===d),f=m=>m.replace(/-([a-z])/g,(i,t)=>t.toUpperCase());if(s)return s.options[f(s.type)]};static setOptionsData=(c,d,s)=>{const f=V.findOptions(c,d);f&&(f.data=s)};static form={openBefore:{parentId:(c,d,s,f)=>{c?d.type===b.EDialog.Insert?(d.form.parentId=c._id,d.form.sort=c.children.length+1):d.form.parentId=c.parentId.substring(c.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=s.length+1),V.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:s}])}}}}class C{static getIdFun=()=>StrUtil.uuid();static setId=(c,d,s)=>{d[c]||(d[c]=[]),d[c].forEach(f=>{s.forEach(m=>{let i=m.default??"";m.type==="number"&&(i=m.default??0),m.type==="boolean"&&(i=m.default??!1),m.type==="time"&&(i=m.default??new Date),f[m.value]===void 0&&(f[m.value]=i)}),f._id||(f._id=C.getIdFun())})};static add=(c,d,s,f)=>{const m=JSONUtil.cp(s);C.setId(c,d,s),d[c].push(m.reduce((i,t)=>{let r=t.default??"";return t.type==="number"&&(r=t.default??0),t.type==="boolean"&&(r=t.default??!1),t.type==="time"&&(r=t.default??new Date),i[t.value]=r,i},{_id:C.getIdFun()})),f?.(d)};static remove=(c,d,s,f)=>{d[c]=d[c].filter(m=>m._id!==s._id),f?.(d)};static getNoIdData=(c,d)=>{const s=JSONUtil.cp(c);return s.forEach(f=>{f._id&&delete f._id,d&&f[d]&&C.getNoIdData(f[d],d)}),s}}const U={key:0,class:"column",style:{width:"100%",gap:"10px"}},T={class:"row items-center",style:{gap:"10px",width:"100%"}},x=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(u,{emit:c}){const d=u,s=e.reactive({show:!1,add:(m,i,t)=>{C.add(m,i,t,()=>{f("change")})},remove:(m,i,t)=>{C.remove(m,i,t,()=>{f("change")})}});e.onMounted(()=>{C.setId(d.field,d.row,d.itemFields),s.show=!0});const f=c;return(m,i)=>{const t=e.resolveComponent("el-button"),r=e.resolveComponent("el-input");return s.show?(e.openBlock(),e.createElementBlock("div",U,[e.renderSlot(m.$slots,"list-start",{row:u.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:i[0]||(i[0]=a=>s.add(u.field,u.row,u.itemFields))},{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.row[u.field],a=>(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(m.$slots,"item-start",{item:a,row:u.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.itemFields,l=>(e.openBlock(),e.createBlock(r,{modelValue:a[l.value],"onUpdate:modelValue":o=>a[l.value]=o,style:e.normalizeStyle({width:u.inputWidth}),class:e.normalizeClass(u.inputClass),placeholder:l[u.label]||l[u.value],onChange:i[1]||(i[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(m.$slots,"item-end",{item:a,row:u.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>s.remove(u.field,u.row,a)},{default:e.withCtx(()=>[...i[3]||(i[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(m.$slots,"list-end",{row:u.row})])):e.createCommentVNode("",!0)}}}),$={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(u,{expose:c}){const d=b.isFun,s=b.EDialog,f=e.ref(),m=u,i=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(m.type||s.Insert)===s.Insert?"create":"update"],initColumnForm:()=>{const t=m.option;i.formColumn=[];const r=[],a=m.option.form?.maxSpan||12,l=m.option.form?.defaultSpan||a;let o=[];const n=h=>{if(i.formDefault[h.key]=h.value,h.isForm){h.form=h.form||{span:l},h.form.span=h.form.span??l;let w=h.form.span,k=o.reduce((B,E)=>B+E.span,w);const g=o.length;o.push({item:h,span:w}),(g===1&&o[0].span===0||k>=a||w===0&&g>1)&&(r.push(o),o=[]),h.rules&&(i.rules[h.key]=h.rules)}};t.column.forEach(h=>{h.isForm=!0,n(h)}),o.length>0&&r.push(o),i.formColumn=r},init:async()=>{i.show=!1,await e.nextTick(),i.initColumnForm(),i.show=!0}});return i.initColumnForm(),c({ref:f,conf:i}),(t,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:f,model:i.form,rules:i.rules},{default:e.withCtx(()=>[i.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(i.formColumn,a=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(t.$slots,"form-start",{row:i.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,i.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(p.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:i.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:i.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:i.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(p.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(x,e.mergeProps({key:3,row:i.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:i.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:i.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:i.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:i.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(c,d,s)=>{const f=await b.loadModule("xlsx"),m=c.map(r=>{const a={};return d.forEach(l=>{a[l.label]=r[l.key]}),a}),i=f.utils.json_to_sheet(m),t=f.utils.book_new();f.utils.book_append_sheet(t,i,"Sheet1"),s?typeof s=="function"&&(s=s()):s=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${s}.xlsx`)}}const O={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(u,{expose:c}){const d=e.ref(!1),s=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let m=null,i=null;const t=l=>(l?.title&&(s.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,n)=>{m=o,i=n})),r=()=>{d.value=!1,m?.(!0),m=null,i=null},a=()=>{d.value=!1,i?.(new Error("用户取消操作")),m=null,i=null};return c({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=n=>d.value=n),title:s.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",O,[e.createVNode(e.unref(p.ElButton),{onClick:a},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:r},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),L={class:"col relative cc1-form-box"},j={class:"absolute row fit",style:{overflow:"hidden"}},z={class:"col column"},R={key:0,class:"relative curd-search"},M={class:"mb-20 flex justify-between items-center"},_={class:"flex items-center",style:{gap:"10px"}},H={key:0},J={key:1},A={key:2},W={class:"export-btn"},K={class:"flex items-center",style:{gap:"10px"}},q={class:"col fit-width relative"},G={class:"absolute column fit"},X={class:"row justify-end mt-20 mb-20"},Q={class:"row curd-row"},Y={class:"row form-item-content",style:{width:"100%"}},Z={class:"col"},P={class:"dialog-footer"},v={class:"dialog-footer"},D=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(u,{expose:c}){const d=b.EDialog,s=u,f=e.ref(),m=e.ref(),i=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getFormData:()=>{let r={};s.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(r[l.key]=t.search.form[l.key])});const a=s.option.search?.before?.(r);return a&&(r=a),r},reset:()=>{const r=t.search.formDefault;Object.keys(r).forEach(a=>{s.option.search?.resetMode==="default"?r[a]=t.search.formDefault[a]:r[a]=void 0}),t.search.form=JSONUtil.cp(r),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:s.option.page?.size||10,sizeList:s.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:s.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,a)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const r=a=>{let l=[];return a.forEach(o=>{l.push(o._id),o.children&&o.children.length>0&&(l=l.concat(r(o.children)))}),l};t.table.expand.rowKeys=r(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const r=s.option.api.list,a=await r({size:t.page.size,num:t.page.num,...t.search.getFormData(),final(n,h,w){t.table.loading=!1}}),l=a.data||{list:a};let o=Array.isArray(l.list)?l.list:l;t.table.data=s.option.data?await s.option.data(o):o,t.page.total=l.total||0},selection:{list:[],change:r=>{t.table.selection.list=r}},exportFun:{start:async r=>{let a=await t.table.exportFun[r](),l=s.option.column;const o=JSONUtil.cp({data:a,columns:l}),n=s.option.tools?.export||{};n.before&&n.before(o),S.exportToExcel(o.data,o.columns,n.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail("请选择要导出的数据"),new Error("请选择要导出的数据");return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail("暂无数据"),new Error("暂无数据");return t.table.data},all:async()=>{t.table.loading=!0;const r=s.option.api.list,{data:a}=await r({size:999999,num:1,final(l,o,n){t.table.loading=!1}});return a.list}},export:r=>{t.table.exportFun.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:r=>r.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:r=>{if(s.option.form?.editAll)return r;let a={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(l=>{r[l]!==t.update.edit.data[l]&&(a[l]=r[l])}),a}},open:(r,a)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=r;const l=r===d.Insert;t.update.edit.data=a,t.update.title=l?"新增":"编辑",t.update.form=JSONUtil.cp(l?t.update.formDefault:a),await s.option.form?.openBefore?.(a,t.update),t.update.show=!0,t.update.showContent=!0,s.option.form?.openAfter?.(a,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await m.value?.validate(async(l,o)=>new Promise((n,h)=>{l||(b.fail("请检查表单数据"),h(!1)),n()})),t.update.loading=!0;const r=t.update.type===d.Insert?s.option.api.create:s.option.api.update;let a=JSONUtil.cp(t.update.form);delete a.children,await s.option.form?.submitBefore?.(a,t.update),Object.keys(a).forEach(l=>{if(typeof a[l]=="string"&&a[l].indexOf("T")>-1){const o=new Date(a[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(a[l]=o)}}),await r({...a,final(l,o,n){t.update.loading=!1}}),t.update.close(),await t.table.getList(),s.option.form?.submitAfter?.(a,t.update)})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:r=>{if(r.length===0){b.fail("请选择要删除的数据");return}t.remove.items=r,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.table.loading=!0;const r=s.option.api.delete;await r({_id:t.remove.items.map(a=>a._id),final(a,l,o){t.table.loading=!1}}),b.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const a={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:"暂无数据",highlightCurrentRow:!0}},l=s.option;Object.keys(a).forEach(o=>{l[o]=ObjectUtil.deepMerge(a[o],l[o]||{})})},initColumnOptions:()=>{const r=s.option,a=l=>{const n={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(w,k)=>{const g=l.options?.switch;try{return await f.value?.open({title:"确认修改",content:`确认要${k[w]===g.activeValue?g.inactiveLabel:g.activeLabel}吗?`}),t.table.loading=!0,await s.option.api.update({_id:k._id,[w]:k[w]===g.activeValue?g.inactiveValue:g.activeValue,final(B,E,F){t.table.loading=!1}}),b.success("操作成功"),t.table.getList(),!0}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",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}},h=l;Object.keys(n).forEach(w=>{h[w]=ObjectUtil.deepMerge(n[w],h[w]||{})})};r.column.forEach(a),r.table?.column?.forEach(a)},initColumnForm:()=>{const r=s.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const a=[],l=s.option.form?.maxSpan||12,o=s.option.form?.defaultSpan||l/2;let n=[];const h=k=>{if(t.update.formDefault[k.key]=k.value,k.table.table&&(k.show.table&&t.table.column.show.list.push(k.key),k.table.table&&t.table.column.show.listSource.push(k.key)),k.isForm){k.form=k.form||{span:o},k.form.span=k.form.span??o;let g=k.form.span,B=n.reduce((F,oe)=>F+oe.span,g);const E=n.length;n.push({item:k,span:g}),(E===1&&n[0].span===0||B>=l||g===0&&E>1)&&(a.push(n),n=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};r.column.forEach(k=>{k.isForm=!0,h(k)}),s.option.table?.column?.forEach(k=>{k.isForm=!1,h(k)}),t.search.column.list=r.column.concat(r.table?.column||[]),t.table.column.list=t.search.column.list.filter(k=>k.table?.table),t.search.column.list.sort((k,g)=>k.sort?.search-g.sort?.search),t.table.column.list.sort((k,g)=>k.sort?.table-g.sort?.table),n.length>0&&a.push(n),t.update.formColumn=a;const w=s.option.search?.formDefault;w&&Object.keys(w).forEach(k=>{t.search.formDefault[k]=w[k]}),r.column.forEach(k=>{k.show?.search||(t.search.formDefault[k.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),c({conf:t}),(r,a)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.renderSlot(r.$slots,"box-left"),e.createElementVNode("div",z,[u.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(e.unref(p.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:o.label},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":n=>t.search.form[o.key]=n,placeholder:`请输入${o.label}`,clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.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(p.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(p.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,n=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(r.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(p.ElFormItem),null,{default:e.withCtx(()=>[u.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),u.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(r.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",M,[e.createElementVNode("div",_,[e.unref(i)(u.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:a[0]||(a[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.table?.selectable&&e.unref(i)(u.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:a[1]||(a[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:a[2]||(a[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:t.table.export},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownItem),{command:"select"},{default:e.withCtx(()=>[...a[13]||(a[13]=[e.createTextVNode("导出选中",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(p.ElButton),{type:"warning"},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"tools-left")]),e.createElementVNode("div",K,[e.renderSlot(r.$slots,"tools-right")])]),e.createElementVNode("div",q,[e.createElementVNode("div",G,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:t.table.data},u.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[u.option.table?.selectable&&e.unref(i)(u.option.tools?.delete)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof u.option.table?.selectable=="function"?u.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(p.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:n})=>[e.renderSlot(r.$slots,"table-"+o.key,{row:n,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:n[o.key],"onUpdate:modelValue":h=>n[o.key]=h,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,n)},{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(n[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(i)(u.option.tools?.add)||e.unref(i)(u.option.tools?.update)||e.unref(i)(u.option.tools?.delete)||r.$slots["table-op-left"]||r.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:1,label:"操作",width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(r.$slots,"table-op-left",{row:o}),e.unref(i)(u.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:n=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(u.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:n=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[...a[17]||(a[17]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(u.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:n=>t.remove.open([o])},{default:e.withCtx(()=>[...a[18]||(a[18]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"table-op-right",{row:o})]),_:3})):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",X,[t.page.total>t.page.size?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":t.page.num,"onUpdate:currentPage":a[3]||(a[3]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":a[4]||(a[4]=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.createCommentVNode("",!0)])]),e.renderSlot(r.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":a[5]||(a[5]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},u.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",P,[e.createVNode(e.unref(p.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...a[19]||(a[19]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[...a[20]||(a[20]=[e.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:m,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("div",Q,[e.renderSlot(r.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,n=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(n.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(n.item.form.span>0?`col-${n.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:n.item.label,prop:n.item.key,"label-width":n.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.renderSlot(r.$slots,"form-"+n.item.key+"-start",{row:t.update.form,item:n.item}),e.createElementVNode("div",Z,[e.renderSlot(r.$slots,"form-"+n.item.key,{row:t.update.form,item:n.item},()=>[n.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.input,e.toHandlers(n.item.options?.input?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.switch,{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.select,e.toHandlers(n.item.options?.select?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.options?.select?.data,h=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:n.item.key},{ref_for:!0},n.item.options?.list,e.toHandlers(n.item.options?.list?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.treeSelect,e.toHandlers(n.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.datetime,e.toHandlers(n.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[n.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[n.item.type]),e.mergeProps({key:6,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.[n.item.type],e.toHandlers(n.item.options?.[n.item.type]?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(r.$slots,"form-"+n.item.key+"-end",{row:t.update.form,item:n.item})])]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(r.$slots,"form-end",{row:t.update.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(p.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":a[6]||(a[6]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",v,[e.createVNode(e.unref(p.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[...a[21]||(a[21]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[...a[22]||(a[22]=[e.createTextVNode(" 确认删除 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,"确认要删除【"+e.toDisplayString(t.remove.items.length)+"】条数据吗?",1)]),_:1},8,["modelValue","title"]),e.createVNode(I,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class ee{static async download(c,d="download.png"){const s=document.createElement("a");s.style.display="none",s.href=c,s.setAttribute("download",d),typeof s.download>"u"&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(c)}static exportJSONFile=(c,d)=>{const s=new Blob([JSON.stringify(c)],{type:"application/json"}),f=URL.createObjectURL(s),m=document.createElement("a");m.href=f,m.download=`${d||"config"}.json`,m.click()};static importFile=async c=>new Promise((d,s)=>{const f=document.createElement("input");f.type="file";const m=c?.accept||".json";f.accept=m,f.style.display="none",f.onchange=i=>{const t=i.target.files[0];if(!t){b.fail("未选择文件"),s("未选择文件");return}const r=new FileReader;r.onload=async a=>{const l=m==".json"?JSON.parse(a.target.result):a.target.result;d(l)},r.onerror=()=>{b.fail("文件读取失败"),s("文件读取失败")},r.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const te=(u,c)=>{if(u.component("TCurd",D),u.component("TFormList",x),u.component("TColumn",N),c?.customComponent){V.customComponent=c.customComponent;for(const d in c.customComponent)u.component(d,c.customComponent[d])}};y.ArrUtil=C,y.ExcelUtil=S,y.TColumn=N,y.TCurd=D,y.TFile=ee,y.TForm=V,y.TFormList=x,y.TSys=b,y.install=te,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y.cc1Form={},y.Vue,y.ElementPlus))})(this,(function(y,e,p){"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=(c,d)=>typeof c=="function"?c(d):c;static getRouterParams=()=>{const c=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(c).length?c:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async c=>{if(!b.moduleObj[c])throw new Error(`模块${c}未加载,请赋值如:TSys.moduleObj = { ${c}: ()=>import('${c}') }`);const d=await b.moduleObj[c]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(c,d,i={}){const f=Date.now();if(!this.tipMessages[c]||f-this.tipMessages[c]>this.tipMessagesGap){this.tipMessages[c]=f;const m=Object.assign({message:c,type:d},i);p.ElMessage(m),setTimeout(()=>{delete this.tipMessages[c]},this.tipMessagesGap)}}static fail=(c,d={})=>{this.showMessage(c,"error",d)};static success=(c,d={})=>{this.showMessage(c,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(c=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{c?this.loadingObj=p.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(c,d=!0)=>{if(d){let i=screen.width/2-500,f=screen.height/2-800/2-30;window.open(c,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+i)}else window.open(c,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=c=>new Promise(async(d,i)=>{let f=document.getElementById(c.id);const m=await b.loadModule("html2canvas");try{m(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:c.windowWidth,height:c.windowHeight,windowWidth:c.windowWidth,windowHeight:c.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(s){let t=s.toDataURL("image/png");d(t)})}catch(s){i(s)}})}class V{static customComponent={};static findOptions=(c,d)=>{const i=c.column.find(m=>m.key===d),f=m=>m.replace(/-([a-z])/g,(s,t)=>t.toUpperCase());if(i)return i.options[f(i.type)]};static setOptionsData=(c,d,i)=>{const f=V.findOptions(c,d);f&&(f.data=i)};static form={openBefore:{parentId:(c,d,i,f)=>{c?d.type===b.EDialog.Insert?(d.form.parentId=c._id,d.form.sort=c.children.length+1):d.form.parentId=c.parentId.substring(c.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=i.length+1),V.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:i}])}}}}class C{static getIdFun=()=>StrUtil.uuid();static setId=(c,d,i)=>{d[c]||(d[c]=[]),d[c].forEach(f=>{i.forEach(m=>{let s=m.default??"";m.type==="number"&&(s=m.default??0),m.type==="boolean"&&(s=m.default??!1),m.type==="time"&&(s=m.default??new Date),f[m.value]===void 0&&(f[m.value]=s)}),f._id||(f._id=C.getIdFun())})};static add=(c,d,i,f)=>{const m=JSONUtil.cp(i);C.setId(c,d,i),d[c].push(m.reduce((s,t)=>{let r=t.default??"";return t.type==="number"&&(r=t.default??0),t.type==="boolean"&&(r=t.default??!1),t.type==="time"&&(r=t.default??new Date),s[t.value]=r,s},{_id:C.getIdFun()})),f?.(d)};static remove=(c,d,i,f)=>{d[c]=d[c].filter(m=>m._id!==i._id),f?.(d)};static getNoIdData=(c,d)=>{const i=JSONUtil.cp(c);return i.forEach(f=>{f._id&&delete f._id,d&&f[d]&&C.getNoIdData(f[d],d)}),i}}const F={key:0,class:"column",style:{width:"100%",gap:"10px"}},T={class:"row items-center",style:{gap:"10px",width:"100%"}},x=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(u,{emit:c}){const d=u,i=e.reactive({show:!1,add:(m,s,t)=>{C.add(m,s,t,()=>{f("change")})},remove:(m,s,t)=>{C.remove(m,s,t,()=>{f("change")})}});e.onMounted(()=>{C.setId(d.field,d.row,d.itemFields),i.show=!0});const f=c;return(m,s)=>{const t=e.resolveComponent("el-button"),r=e.resolveComponent("el-input");return i.show?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(m.$slots,"list-start",{row:u.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:s[0]||(s[0]=a=>i.add(u.field,u.row,u.itemFields))},{default:e.withCtx(()=>[...s[2]||(s[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.row[u.field],a=>(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(m.$slots,"item-start",{item:a,row:u.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.itemFields,l=>(e.openBlock(),e.createBlock(r,{modelValue:a[l.value],"onUpdate:modelValue":o=>a[l.value]=o,style:e.normalizeStyle({width:u.inputWidth}),class:e.normalizeClass(u.inputClass),placeholder:l[u.label]||l[u.value],onChange:s[1]||(s[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(m.$slots,"item-end",{item:a,row:u.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>i.remove(u.field,u.row,a)},{default:e.withCtx(()=>[...s[3]||(s[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(m.$slots,"list-end",{row:u.row})])):e.createCommentVNode("",!0)}}}),$={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(u,{expose:c}){const d=b.isFun,i=b.EDialog,f=e.ref(),m=u,s=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(m.type||i.Insert)===i.Insert?"create":"update"],initColumnForm:async()=>{const t=m.option;s.formColumn=[];const r=[],a=m.option.form?.maxSpan||12,l=m.option.form?.defaultSpan||a;let o=[];const n=h=>{if(s.formDefault[h.key]=h.value,h.isForm){h.form=h.form||{span:l},h.form.span=h.form.span??l;let w=h.form.span,k=o.reduce((B,E)=>B+E.span,w);const g=o.length;o.push({item:h,span:w}),(g===1&&o[0].span===0||k>=a||w===0&&g>1)&&(r.push(o),o=[]),h.rules&&(s.rules[h.key]=h.rules)}};t.column.forEach(h=>{h.isForm=!0,n(h)}),o.length>0&&r.push(o),s.formColumn=r,s.form=JSONUtil.cp(s.formDefault)},init:async()=>{s.show=!1,await e.nextTick(),s.initColumnForm()}});return s.initColumnForm(),c({ref:f,conf:s}),(t,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:f,model:s.form,rules:s.rules},{default:e.withCtx(()=>[s.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.formColumn,a=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(t.$slots,"form-start",{row:s.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,s.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(p.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:s.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:s.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:s.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(p.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(x,e.mergeProps({key:3,row:s.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:s.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:s.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:s.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:s.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(c,d,i)=>{const f=await b.loadModule("xlsx"),m=c.map(r=>{const a={};return d.forEach(l=>{a[l.label]=r[l.key]}),a}),s=f.utils.json_to_sheet(m),t=f.utils.book_new();f.utils.book_append_sheet(t,s,"Sheet1"),i?typeof i=="function"&&(i=i()):i=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${i}.xlsx`)}}const O={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(u,{expose:c}){const d=e.ref(!1),i=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let m=null,s=null;const t=l=>(l?.title&&(i.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,n)=>{m=o,s=n})),r=()=>{d.value=!1,m?.(!0),m=null,s=null},a=()=>{d.value=!1,s?.(new Error("用户取消操作")),m=null,s=null};return c({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=n=>d.value=n),title:i.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",O,[e.createVNode(e.unref(p.ElButton),{onClick:a},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:r},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),L={class:"col relative cc1-form-box"},j={class:"absolute row fit",style:{overflow:"hidden"}},z={class:"col column"},R={key:0,class:"relative curd-search"},M={class:"mb-20 flex justify-between items-center"},_={class:"flex items-center",style:{gap:"10px"}},H={key:0},J={key:1},A={key:2},W={class:"export-btn"},K={class:"flex items-center",style:{gap:"10px"}},q={class:"col fit-width relative"},G={class:"absolute column fit"},X={class:"row justify-end mt-20 mb-20"},Q={class:"row curd-row"},Y={class:"row form-item-content",style:{width:"100%"}},Z={class:"col"},P={class:"dialog-footer"},v={class:"dialog-footer"},D=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(u,{expose:c}){const d=b.EDialog,i=u,f=e.ref(),m=e.ref(),s=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getFormData:()=>{let r={};i.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(r[l.key]=t.search.form[l.key])});const a=i.option.search?.before?.(r);return a&&(r=a),r},reset:()=>{const r=t.search.formDefault;Object.keys(r).forEach(a=>{i.option.search?.resetMode==="default"?r[a]=t.search.formDefault[a]:r[a]=void 0}),t.search.form=JSONUtil.cp(r),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:i.option.page?.size||10,sizeList:i.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:i.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,a)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const r=a=>{let l=[];return a.forEach(o=>{l.push(o._id),o.children&&o.children.length>0&&(l=l.concat(r(o.children)))}),l};t.table.expand.rowKeys=r(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const r=i.option.api.list,a=await r({size:t.page.size,num:t.page.num,...t.search.getFormData(),final(n,h,w){t.table.loading=!1}}),l=a.data||{list:a};let o=Array.isArray(l.list)?l.list:l;t.table.data=i.option.data?await i.option.data(o):o,t.page.total=l.total||0},selection:{list:[],change:r=>{t.table.selection.list=r}},exportFun:{start:async r=>{let a=await t.table.exportFun[r](),l=i.option.column;const o=JSONUtil.cp({data:a,columns:l}),n=i.option.tools?.export||{};n.before&&n.before(o),S.exportToExcel(o.data,o.columns,n.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail("请选择要导出的数据"),new Error("请选择要导出的数据");return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail("暂无数据"),new Error("暂无数据");return t.table.data},all:async()=>{t.table.loading=!0;const r=i.option.api.list,{data:a}=await r({size:999999,num:1,final(l,o,n){t.table.loading=!1}});return a.list}},export:r=>{t.table.exportFun.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:r=>r.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:r=>{if(i.option.form?.editAll)return r;let a={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(l=>{r[l]!==t.update.edit.data[l]&&(a[l]=r[l])}),a}},open:(r,a)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=r;const l=r===d.Insert;t.update.edit.data=a,t.update.title=l?"新增":"编辑",t.update.form=JSONUtil.cp(l?t.update.formDefault:a),await i.option.form?.openBefore?.(a,t.update),t.update.show=!0,t.update.showContent=!0,i.option.form?.openAfter?.(a,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await m.value?.validate(async(l,o)=>new Promise((n,h)=>{l||(b.fail("请检查表单数据"),h(!1)),n()})),t.update.loading=!0;const r=t.update.type===d.Insert?i.option.api.create:i.option.api.update;let a=JSONUtil.cp(t.update.form);delete a.children,await i.option.form?.submitBefore?.(a,t.update),Object.keys(a).forEach(l=>{if(typeof a[l]=="string"&&a[l].indexOf("T")>-1){const o=new Date(a[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(a[l]=o)}}),await r({...a,final(l,o,n){t.update.loading=!1}}),t.update.close(),await t.table.getList(),i.option.form?.submitAfter?.(a,t.update)})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:r=>{if(r.length===0){b.fail("请选择要删除的数据");return}t.remove.items=r,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.table.loading=!0;const r=i.option.api.delete;await r({_id:t.remove.items.map(a=>a._id),final(a,l,o){t.table.loading=!1}}),b.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const a={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:"暂无数据",highlightCurrentRow:!0}},l=i.option;Object.keys(a).forEach(o=>{l[o]=ObjectUtil.deepMerge(a[o],l[o]||{})})},initColumnOptions:()=>{const r=i.option,a=l=>{const n={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(w,k)=>{const g=l.options?.switch;try{return await f.value?.open({title:"确认修改",content:`确认要${k[w]===g.activeValue?g.inactiveLabel:g.activeLabel}吗?`}),t.table.loading=!0,await i.option.api.update({_id:k._id,[w]:k[w]===g.activeValue?g.inactiveValue:g.activeValue,final(B,E,U){t.table.loading=!1}}),b.success("操作成功"),t.table.getList(),!0}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",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}},h=l;Object.keys(n).forEach(w=>{h[w]=ObjectUtil.deepMerge(n[w],h[w]||{})})};r.column.forEach(a),r.table?.column?.forEach(a)},initColumnForm:()=>{const r=i.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const a=[],l=i.option.form?.maxSpan||12,o=i.option.form?.defaultSpan||l/2;let n=[];const h=k=>{if(t.update.formDefault[k.key]=k.value,k.table.table&&(k.show.table&&t.table.column.show.list.push(k.key),k.table.table&&t.table.column.show.listSource.push(k.key)),k.isForm){k.form=k.form||{span:o},k.form.span=k.form.span??o;let g=k.form.span,B=n.reduce((U,oe)=>U+oe.span,g);const E=n.length;n.push({item:k,span:g}),(E===1&&n[0].span===0||B>=l||g===0&&E>1)&&(a.push(n),n=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};r.column.forEach(k=>{k.isForm=!0,h(k)}),i.option.table?.column?.forEach(k=>{k.isForm=!1,h(k)}),t.search.column.list=r.column.concat(r.table?.column||[]),t.table.column.list=t.search.column.list.filter(k=>k.table?.table),t.search.column.list.sort((k,g)=>k.sort?.search-g.sort?.search),t.table.column.list.sort((k,g)=>k.sort?.table-g.sort?.table),n.length>0&&a.push(n),t.update.formColumn=a;const w=i.option.search?.formDefault;w&&Object.keys(w).forEach(k=>{t.search.formDefault[k]=w[k]}),r.column.forEach(k=>{k.show?.search||(t.search.formDefault[k.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),c({conf:t}),(r,a)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.renderSlot(r.$slots,"box-left"),e.createElementVNode("div",z,[u.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(e.unref(p.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:o.label},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":n=>t.search.form[o.key]=n,placeholder:`请输入${o.label}`,clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.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(p.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(p.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,n=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(r.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(p.ElFormItem),null,{default:e.withCtx(()=>[u.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),u.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(r.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",M,[e.createElementVNode("div",_,[e.unref(s)(u.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:a[0]||(a[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.table?.selectable&&e.unref(s)(u.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:a[1]||(a[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:a[2]||(a[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:t.table.export},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownItem),{command:"select"},{default:e.withCtx(()=>[...a[13]||(a[13]=[e.createTextVNode("导出选中",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(p.ElButton),{type:"warning"},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"tools-left")]),e.createElementVNode("div",K,[e.renderSlot(r.$slots,"tools-right")])]),e.createElementVNode("div",q,[e.createElementVNode("div",G,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:t.table.data},u.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[u.option.table?.selectable&&e.unref(s)(u.option.tools?.delete)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof u.option.table?.selectable=="function"?u.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(p.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:n})=>[e.renderSlot(r.$slots,"table-"+o.key,{row:n,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:n[o.key],"onUpdate:modelValue":h=>n[o.key]=h,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,n)},{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(n[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(s)(u.option.tools?.add)||e.unref(s)(u.option.tools?.update)||e.unref(s)(u.option.tools?.delete)||r.$slots["table-op-left"]||r.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:1,label:"操作",width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(r.$slots,"table-op-left",{row:o}),e.unref(s)(u.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:n=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(s)(u.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:n=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[...a[17]||(a[17]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(s)(u.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:n=>t.remove.open([o])},{default:e.withCtx(()=>[...a[18]||(a[18]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"table-op-right",{row:o})]),_:3})):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",X,[t.page.total>t.page.size?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":t.page.num,"onUpdate:currentPage":a[3]||(a[3]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":a[4]||(a[4]=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.createCommentVNode("",!0)])]),e.renderSlot(r.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":a[5]||(a[5]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},u.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",P,[e.createVNode(e.unref(p.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...a[19]||(a[19]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[...a[20]||(a[20]=[e.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:m,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("div",Q,[e.renderSlot(r.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,n=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(n.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(n.item.form.span>0?`col-${n.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:n.item.label,prop:n.item.key,"label-width":n.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.renderSlot(r.$slots,"form-"+n.item.key+"-start",{row:t.update.form,item:n.item}),e.createElementVNode("div",Z,[e.renderSlot(r.$slots,"form-"+n.item.key,{row:t.update.form,item:n.item},()=>[n.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.input,e.toHandlers(n.item.options?.input?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.switch,{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.select,e.toHandlers(n.item.options?.select?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.options?.select?.data,h=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:n.item.key},{ref_for:!0},n.item.options?.list,e.toHandlers(n.item.options?.list?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.treeSelect,e.toHandlers(n.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.datetime,e.toHandlers(n.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[n.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[n.item.type]),e.mergeProps({key:6,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.[n.item.type],e.toHandlers(n.item.options?.[n.item.type]?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(r.$slots,"form-"+n.item.key+"-end",{row:t.update.form,item:n.item})])]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(r.$slots,"form-end",{row:t.update.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(p.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":a[6]||(a[6]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",v,[e.createVNode(e.unref(p.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[...a[21]||(a[21]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[...a[22]||(a[22]=[e.createTextVNode(" 确认删除 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,"确认要删除【"+e.toDisplayString(t.remove.items.length)+"】条数据吗?",1)]),_:1},8,["modelValue","title"]),e.createVNode(I,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class ee{static async download(c,d="download.png"){const i=document.createElement("a");i.style.display="none",i.href=c,i.setAttribute("download",d),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(c)}static exportJSONFile=(c,d)=>{const i=new Blob([JSON.stringify(c)],{type:"application/json"}),f=URL.createObjectURL(i),m=document.createElement("a");m.href=f,m.download=`${d||"config"}.json`,m.click()};static importFile=async c=>new Promise((d,i)=>{const f=document.createElement("input");f.type="file";const m=c?.accept||".json";f.accept=m,f.style.display="none",f.onchange=s=>{const t=s.target.files[0];if(!t){b.fail("未选择文件"),i("未选择文件");return}const r=new FileReader;r.onload=async a=>{const l=m==".json"?JSON.parse(a.target.result):a.target.result;d(l)},r.onerror=()=>{b.fail("文件读取失败"),i("文件读取失败")},r.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const te=(u,c)=>{if(u.component("TCurd",D),u.component("TFormList",x),u.component("TColumn",N),c?.customComponent){V.customComponent=c.customComponent;for(const d in c.customComponent)u.component(d,c.customComponent[d])}};y.ArrUtil=C,y.ExcelUtil=S,y.TColumn=N,y.TCurd=D,y.TFile=ee,y.TForm=V,y.TFormList=x,y.TSys=b,y.install=te,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
@@ -86,7 +86,7 @@ declare const conf: {
86
86
  span: number;
87
87
  }[][];
88
88
  getDisabled: (item: CurdConfigColumn) => boolean | undefined;
89
- initColumnForm: () => void;
89
+ initColumnForm: () => Promise<void>;
90
90
  init: () => Promise<void>;
91
91
  };
92
92
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
@@ -340,6 +340,8 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
340
340
  form?: {
341
341
  maxSpan?: number;
342
342
  defaultSpan?: number;
343
+ openBefore?: (item: any, conf: any) => any;
344
+ openAfter?: (item: any, conf: any) => any;
343
345
  };
344
346
  column: CurdConfigColumn[];
345
347
  };
@@ -373,6 +375,8 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
373
375
  form?: {
374
376
  maxSpan?: number;
375
377
  defaultSpan?: number;
378
+ openBefore?: (item: any, conf: any) => any;
379
+ openAfter?: (item: any, conf: any) => any;
376
380
  };
377
381
  column: CurdConfigColumn[];
378
382
  };
@@ -389,6 +393,8 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
389
393
  form?: {
390
394
  maxSpan?: number;
391
395
  defaultSpan?: number;
396
+ openBefore?: (item: any, conf: any) => any;
397
+ openAfter?: (item: any, conf: any) => any;
392
398
  };
393
399
  column: CurdConfigColumn[];
394
400
  };
@@ -402,6 +408,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
402
408
  form?: {
403
409
  maxSpan?: number;
404
410
  defaultSpan?: number;
411
+ openBefore?: (item: any, conf: any) => any;
412
+ openAfter?: (item: any, conf: any) => any;
405
413
  };
406
414
  column: CurdConfigColumn[];
407
415
  };
@@ -496,7 +504,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
496
504
  span: number;
497
505
  }[][];
498
506
  getDisabled: (item: CurdConfigColumn) => boolean | undefined;
499
- initColumnForm: () => void;
507
+ initColumnForm: () => Promise<void>;
500
508
  init: () => Promise<void>;
501
509
  };
502
510
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -508,6 +516,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
508
516
  form?: {
509
517
  maxSpan?: number;
510
518
  defaultSpan?: number;
519
+ openBefore?: (item: any, conf: any) => any;
520
+ openAfter?: (item: any, conf: any) => any;
511
521
  };
512
522
  column: CurdConfigColumn[];
513
523
  };
@@ -524,6 +534,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
524
534
  form?: {
525
535
  maxSpan?: number;
526
536
  defaultSpan?: number;
537
+ openBefore?: (item: any, conf: any) => any;
538
+ openAfter?: (item: any, conf: any) => any;
527
539
  };
528
540
  column: CurdConfigColumn[];
529
541
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",