cc1-form 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cc1-form.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as J, reactive as X, onMounted as ee, resolveComponent as Z, createElementBlock as w, createCommentVNode as k, openBlock as c, renderSlot as v, createElementVNode as x, createVNode as C, withCtx as h, createTextVNode as V, Fragment as $, renderList as L, createBlock as g, normalizeClass as T, normalizeStyle as se, ref as R, nextTick as ne, unref as u, mergeProps as U, toHandlers as I, resolveDynamicComponent as te, toDisplayString as _, resolveDirective as re, withDirectives as ie } from "vue";
2
- import { ElMessage as de, ElLoading as ue, ElForm as K, ElFormItem as P, ElInput as H, ElSwitch as G, ElSelect as B, ElOption as N, ElTreeSelect as le, ElDatePicker as oe, ElDialog as q, ElButton as O, ElDropdown as ce, ElDropdownMenu as pe, ElDropdownItem as A, ElTable as fe, ElTableColumn as W, ElPagination as me } from "element-plus";
1
+ import { defineComponent as A, reactive as X, onMounted as ee, resolveComponent as Z, createElementBlock as w, createCommentVNode as k, openBlock as c, renderSlot as v, createElementVNode as x, createVNode as C, withCtx as h, createTextVNode as V, Fragment as $, renderList as L, createBlock as g, normalizeClass as T, normalizeStyle as se, ref as R, nextTick as ne, unref as u, mergeProps as U, toHandlers as I, resolveDynamicComponent as te, toDisplayString as _, resolveDirective as re, withDirectives as ie } from "vue";
2
+ import { ElMessage as de, ElLoading as ue, ElForm as K, ElFormItem as P, ElInput as H, ElSwitch as G, ElSelect as B, ElOption as N, ElTreeSelect as oe, ElDatePicker as le, ElDialog as q, ElButton as O, ElDropdown as ce, ElDropdownMenu as pe, ElDropdownItem as J, ElTable as fe, ElTableColumn as W, ElPagination as me } from "element-plus";
3
3
  class D {
4
4
  /**
5
5
  * 路由
@@ -24,13 +24,13 @@ class D {
24
24
  * @param data 数据
25
25
  * @returns 是否显示
26
26
  */
27
- static isFun = (d, i) => typeof d == "function" ? d(i) : d;
27
+ static isFun = (i, d) => Array.isArray(i) ? i.some((n) => typeof n == "function" ? n(d) : n) : typeof i == "function" ? i(d) : i;
28
28
  /**
29
29
  * 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
30
30
  */
31
31
  static getRouterParams = () => {
32
- const d = this.router.currentRoute.value.query || {}, i = this.router.currentRoute.value.params || {};
33
- return Object.keys(d).length ? d : Object.keys(i).length ? i : {};
32
+ const i = this.router.currentRoute.value.query || {}, d = this.router.currentRoute.value.params || {};
33
+ return Object.keys(i).length ? i : Object.keys(d).length ? d : {};
34
34
  };
35
35
  /**
36
36
  * 模块赋值
@@ -40,11 +40,11 @@ class D {
40
40
  * 加载模块
41
41
  * @param module
42
42
  */
43
- static loadModule = async (d) => {
44
- if (!D.moduleObj[d])
45
- throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);
46
- const i = await D.moduleObj[d]();
47
- return i.default ?? i;
43
+ static loadModule = async (i) => {
44
+ if (!D.moduleObj[i])
45
+ throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);
46
+ const d = await D.moduleObj[i]();
47
+ return d.default ?? d;
48
48
  };
49
49
  /**
50
50
  * 提示信息对象管理
@@ -60,19 +60,19 @@ class D {
60
60
  * @param type 消息类型
61
61
  * @param options 其他选项
62
62
  */
63
- static showMessage(d, i, r = {}) {
63
+ static showMessage(i, d, n = {}) {
64
64
  const p = Date.now();
65
- if (!this.tipMessages[d] || p - this.tipMessages[d] > this.tipMessagesGap) {
66
- this.tipMessages[d] = p;
65
+ if (!this.tipMessages[i] || p - this.tipMessages[i] > this.tipMessagesGap) {
66
+ this.tipMessages[i] = p;
67
67
  const m = Object.assign(
68
68
  {
69
- message: d,
70
- type: i
69
+ message: i,
70
+ type: d
71
71
  },
72
- r
72
+ n
73
73
  );
74
74
  de(m), setTimeout(() => {
75
- delete this.tipMessages[d];
75
+ delete this.tipMessages[i];
76
76
  }, this.tipMessagesGap);
77
77
  }
78
78
  }
@@ -81,16 +81,16 @@ class D {
81
81
  * @param content
82
82
  * @param options
83
83
  */
84
- static fail = (d, i = {}) => {
85
- this.showMessage(d, "error", i);
84
+ static fail = (i, d = {}) => {
85
+ this.showMessage(i, "error", d);
86
86
  };
87
87
  /**
88
88
  * 成功提示
89
89
  * @param content
90
90
  * @param options
91
91
  */
92
- static success = (d, i = {}) => {
93
- this.showMessage(d, "success", i);
92
+ static success = (i, d = {}) => {
93
+ this.showMessage(i, "success", d);
94
94
  };
95
95
  static loadingObj = null;
96
96
  static loadingTimer = null;
@@ -99,11 +99,11 @@ class D {
99
99
  * @param show
100
100
  * @param text
101
101
  */
102
- static loading = (d = !0, i = "加载中") => {
102
+ static loading = (i = !0, d = "加载中") => {
103
103
  Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
104
- d ? this.loadingObj = ue.service({
104
+ i ? this.loadingObj = ue.service({
105
105
  lock: !0,
106
- text: i,
106
+ text: d,
107
107
  background: "rgba(0, 0, 0, 0.3)"
108
108
  }) : this.loadingObj && (this.loadingObj.close(), this.loadingObj = null);
109
109
  }, 50);
@@ -113,17 +113,17 @@ class D {
113
113
  * @param url 地址
114
114
  * @param isCenter 是否居中
115
115
  */
116
- static openUrl = (d, i = !0) => {
117
- if (i) {
118
- let r = screen.width / 2 - 500, p = screen.height / 2 - 800 / 2 - 30;
116
+ static openUrl = (i, d = !0) => {
117
+ if (d) {
118
+ let n = screen.width / 2 - 500, p = screen.height / 2 - 800 / 2 - 30;
119
119
  window.open(
120
- d,
120
+ i,
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=" + p + ", left=" + r
122
+ "toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + p + ", left=" + n
123
123
  );
124
124
  } else
125
125
  window.open(
126
- d,
126
+ i,
127
127
  "DescriptiveWindowName" + StrUtil.getId(),
128
128
  "resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0"
129
129
  );
@@ -133,40 +133,40 @@ class D {
133
133
  * @param param
134
134
  * @returns
135
135
  */
136
- static getImgPic = (d) => new Promise(async (i, r) => {
137
- let p = document.getElementById(d.id);
136
+ static getImgPic = (i) => new Promise(async (d, n) => {
137
+ let p = document.getElementById(i.id);
138
138
  const m = await D.loadModule("html2canvas");
139
139
  try {
140
140
  m(p, {
141
141
  logging: !1,
142
142
  allowTaint: !0,
143
143
  scale: window.devicePixelRatio,
144
- width: d.windowWidth,
145
- height: d.windowHeight,
146
- windowWidth: d.windowWidth,
147
- windowHeight: d.windowHeight,
144
+ width: i.windowWidth,
145
+ height: i.windowHeight,
146
+ windowWidth: i.windowWidth,
147
+ windowHeight: i.windowHeight,
148
148
  useCORS: !0,
149
149
  backgroundColor: "#ffffff00"
150
- }).then(function(n) {
151
- let e = n.toDataURL("image/png");
152
- i(e);
150
+ }).then(function(r) {
151
+ let e = r.toDataURL("image/png");
152
+ d(e);
153
153
  });
154
- } catch (n) {
155
- r(n);
154
+ } catch (r) {
155
+ n(r);
156
156
  }
157
157
  });
158
158
  }
159
159
  class S {
160
160
  /** 全局分页字段 */
161
161
  static pageField = {
162
- num: "current",
162
+ num: "num",
163
163
  size: "size"
164
164
  };
165
165
  /** 全局请求结果字段 */
166
166
  static resultField = {
167
- list: "records",
167
+ list: "list",
168
168
  pages: "pages",
169
- num: "current",
169
+ num: "num",
170
170
  size: "size",
171
171
  total: "total"
172
172
  };
@@ -180,10 +180,10 @@ class S {
180
180
  * @param field
181
181
  * @returns
182
182
  */
183
- static findOptions = (d, i) => {
184
- const r = d.column.find((m) => m.key === i), p = (m) => m.replace(/-([a-z])/g, (n, e) => e.toUpperCase());
185
- if (r)
186
- return r.options[p(r.type)];
183
+ static findOptions = (i, d) => {
184
+ const n = i.column.find((m) => m.key === d), p = (m) => m.replace(/-([a-z])/g, (r, e) => e.toUpperCase());
185
+ if (n)
186
+ return n.options[p(n.type)];
187
187
  };
188
188
  /**
189
189
  * 更新组件数据
@@ -201,9 +201,9 @@ class S {
201
201
  }))
202
202
  )
203
203
  */
204
- static setOptionsData = (d, i, r) => {
205
- const p = S.findOptions(d, i);
206
- p && (p.data = r);
204
+ static setOptionsData = (i, d, n) => {
205
+ const p = S.findOptions(i, d);
206
+ p && (p.data = n);
207
207
  };
208
208
  static form = {
209
209
  openBefore: {
@@ -214,8 +214,8 @@ class S {
214
214
  * @param treeData 树形数据
215
215
  * @param option 组件配置
216
216
  */
217
- parentId: (d, i, r, p) => {
218
- d ? i.type === D.EDialog.Insert ? (i.form.parentId = d._id, i.form.sort = d.children.length + 1) : i.form.parentId = d.parentId.substring(d.parentId.lastIndexOf(",") + 1) : (i.form.parentId = "0", i.form.sort = r.length + 1), S.setOptionsData(p, "parentId", [{ _id: "0", title: "根", children: r }]);
217
+ parentId: (i, d, n, p) => {
218
+ i ? d.type === D.EDialog.Insert ? (d.form.parentId = i._id, d.form.sort = i.children.length + 1) : d.form.parentId = i.parentId.substring(i.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = n.length + 1), S.setOptionsData(p, "parentId", [{ _id: "0", title: "根", children: n }]);
219
219
  }
220
220
  }
221
221
  };
@@ -230,11 +230,11 @@ class j {
230
230
  * @param field 字段名
231
231
  * @param row 行数据
232
232
  */
233
- static setId = (d, i, r) => {
234
- i[d] || (i[d] = []), i[d].forEach((p) => {
235
- r.forEach((m) => {
236
- let n = m.default ?? "";
237
- m.type === "number" && (n = m.default ?? 0), m.type === "boolean" && (n = m.default ?? !1), m.type === "time" && (n = m.default ?? /* @__PURE__ */ new Date()), p[m.value] === void 0 && (p[m.value] = n);
233
+ static setId = (i, d, n) => {
234
+ d[i] || (d[i] = []), d[i].forEach((p) => {
235
+ n.forEach((m) => {
236
+ let r = m.default ?? "";
237
+ m.type === "number" && (r = m.default ?? 0), m.type === "boolean" && (r = m.default ?? !1), m.type === "time" && (r = m.default ?? /* @__PURE__ */ new Date()), p[m.value] === void 0 && (p[m.value] = r);
238
238
  }), p._id || (p._id = j.getIdFun());
239
239
  });
240
240
  };
@@ -245,17 +245,17 @@ class j {
245
245
  * @param itemFields 元素字段-如:[{label:'',value:''}]
246
246
  * @param callback 回调函数
247
247
  */
248
- static add = (d, i, r, p) => {
249
- const m = JSONUtil.cp(r);
250
- j.setId(d, i, r), i[d].push(
248
+ static add = (i, d, n, p) => {
249
+ const m = JSONUtil.cp(n);
250
+ j.setId(i, d, n), d[i].push(
251
251
  m.reduce(
252
- (n, e) => {
252
+ (r, e) => {
253
253
  let s = e.default ?? "";
254
- 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;
254
+ return e.type === "number" && (s = e.default ?? 0), e.type === "boolean" && (s = e.default ?? !1), e.type === "time" && (s = e.default ?? /* @__PURE__ */ new Date()), r[e.value] = s, r;
255
255
  },
256
256
  { _id: j.getIdFun() }
257
257
  )
258
- ), p?.(i);
258
+ ), p?.(d);
259
259
  };
260
260
  /**
261
261
  * 删除数组元素
@@ -264,8 +264,8 @@ class j {
264
264
  * @param item 元素-如:{_id:''}
265
265
  * @param callback 回调函数
266
266
  */
267
- static remove = (d, i, r, p) => {
268
- i[d] = i[d].filter((m) => m._id !== r._id), p?.(i);
267
+ static remove = (i, d, n, p) => {
268
+ d[i] = d[i].filter((m) => m._id !== n._id), p?.(d);
269
269
  };
270
270
  /**
271
271
  * 获取没有id的数据
@@ -273,11 +273,11 @@ class j {
273
273
  * @param childernField 子级字段-如:list、children
274
274
  * @returns 没有id的数据
275
275
  */
276
- static getNoIdData = (d, i) => {
277
- const r = JSONUtil.cp(d);
278
- return r.forEach((p) => {
279
- p._id && delete p._id, i && p[i] && j.getNoIdData(p[i], i);
280
- }), r;
276
+ static getNoIdData = (i, d) => {
277
+ const n = JSONUtil.cp(i);
278
+ return n.forEach((p) => {
279
+ p._id && delete p._id, d && p[d] && j.getNoIdData(p[d], d);
280
+ }), n;
281
281
  };
282
282
  }
283
283
  const he = {
@@ -287,7 +287,7 @@ const he = {
287
287
  }, be = {
288
288
  class: "row items-center",
289
289
  style: { gap: "10px", width: "100%" }
290
- }, Q = /* @__PURE__ */ J({
290
+ }, Q = /* @__PURE__ */ A({
291
291
  __name: "list",
292
292
  props: {
293
293
  row: {
@@ -322,63 +322,63 @@ const he = {
322
322
  }
323
323
  },
324
324
  emits: ["change"],
325
- setup(f, { emit: d }) {
326
- const i = f, r = X({
325
+ setup(f, { emit: i }) {
326
+ const d = f, n = X({
327
327
  show: !1,
328
- add: (m, n, e) => {
329
- j.add(m, n, e, () => {
328
+ add: (m, r, e) => {
329
+ j.add(m, r, e, () => {
330
330
  p("change");
331
331
  });
332
332
  },
333
- remove: (m, n, e) => {
334
- j.remove(m, n, e, () => {
333
+ remove: (m, r, e) => {
334
+ j.remove(m, r, e, () => {
335
335
  p("change");
336
336
  });
337
337
  }
338
338
  });
339
339
  ee(() => {
340
- j.setId(i.field, i.row, i.itemFields), r.show = !0;
340
+ j.setId(d.field, d.row, d.itemFields), n.show = !0;
341
341
  });
342
- const p = d;
343
- return (m, n) => {
342
+ const p = i;
343
+ return (m, r) => {
344
344
  const e = Z("el-button"), s = Z("el-input");
345
- return r.show ? (c(), w("div", he, [
345
+ return n.show ? (c(), w("div", he, [
346
346
  v(m.$slots, "list-start", { row: f.row }),
347
347
  x("div", null, [
348
348
  C(e, {
349
349
  link: "",
350
350
  type: "primary",
351
- onClick: n[0] || (n[0] = (l) => r.add(f.field, f.row, f.itemFields))
351
+ onClick: r[0] || (r[0] = (o) => n.add(f.field, f.row, f.itemFields))
352
352
  }, {
353
- default: h(() => [...n[2] || (n[2] = [
353
+ default: h(() => [...r[2] || (r[2] = [
354
354
  V("添加", -1)
355
355
  ])]),
356
356
  _: 1
357
357
  })
358
358
  ]),
359
- (c(!0), w($, null, L(f.row[f.field], (l) => (c(), w("div", be, [
359
+ (c(!0), w($, null, L(f.row[f.field], (o) => (c(), w("div", be, [
360
360
  v(m.$slots, "item-start", {
361
- item: l,
361
+ item: o,
362
362
  row: f.row
363
363
  }),
364
- (c(!0), w($, null, L(f.itemFields, (o) => (c(), g(s, {
365
- modelValue: l[o.value],
366
- "onUpdate:modelValue": (t) => l[o.value] = t,
364
+ (c(!0), w($, null, L(f.itemFields, (l) => (c(), g(s, {
365
+ modelValue: o[l.value],
366
+ "onUpdate:modelValue": (t) => o[l.value] = t,
367
367
  style: se({ width: f.inputWidth }),
368
368
  class: T(f.inputClass),
369
- placeholder: o[f.label] || o[f.value],
370
- onChange: n[1] || (n[1] = (t) => p("change"))
369
+ placeholder: l[f.label] || l[f.value],
370
+ onChange: r[1] || (r[1] = (t) => p("change"))
371
371
  }, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
372
372
  v(m.$slots, "item-end", {
373
- item: l,
373
+ item: o,
374
374
  row: f.row
375
375
  }),
376
376
  C(e, {
377
377
  link: "",
378
378
  type: "danger",
379
- onClick: (o) => r.remove(f.field, f.row, l)
379
+ onClick: (l) => n.remove(f.field, f.row, o)
380
380
  }, {
381
- default: h(() => [...n[3] || (n[3] = [
381
+ default: h(() => [...r[3] || (r[3] = [
382
382
  V("删除", -1)
383
383
  ])]),
384
384
  _: 1
@@ -388,7 +388,7 @@ const he = {
388
388
  ])) : k("", !0);
389
389
  };
390
390
  }
391
- }), ye = { class: "row curd-row" }, ge = /* @__PURE__ */ J({
391
+ }), ye = { class: "row curd-row" }, ge = /* @__PURE__ */ A({
392
392
  __name: "column",
393
393
  props: {
394
394
  /**
@@ -404,127 +404,127 @@ const he = {
404
404
  default: ""
405
405
  }
406
406
  },
407
- setup(f, { expose: d }) {
408
- const i = D.isFun, r = D.EDialog, p = R(), m = f, n = X({
407
+ setup(f, { expose: i }) {
408
+ const d = D.isFun, n = D.EDialog, p = R(), m = f, r = X({
409
409
  rules: {},
410
410
  show: !0,
411
411
  form: {},
412
412
  formDefault: {},
413
413
  formColumn: [],
414
- getDisabled: (e) => e.disabled?.[(m.type || r.Insert) === r.Insert ? "create" : "update"],
414
+ getDisabled: (e) => e.disabled?.[(m.type || n.Insert) === n.Insert ? "create" : "update"],
415
415
  initColumnForm: async () => {
416
416
  const e = m.option;
417
- n.formColumn = [];
418
- const s = [], l = m.option.form?.maxSpan || 12, o = m.option.form?.defaultSpan || l;
417
+ r.formColumn = [];
418
+ const s = [], o = m.option.form?.maxSpan || 12, l = m.option.form?.defaultSpan || o;
419
419
  let t = [];
420
420
  const a = (b) => {
421
- if (n.formDefault[b.key] = b.value, b.isForm) {
422
- b.form = b.form || { span: o }, b.form.span = b.form.span ?? o;
421
+ if (r.formDefault[b.key] = b.value, b.isForm) {
422
+ b.form = b.form || { span: l }, b.form.span = b.form.span ?? l;
423
423
  let F = b.form.span, y = t.reduce((z, M) => z + M.span, F);
424
424
  const E = t.length;
425
- t.push({ item: b, span: F }), (E === 1 && t[0].span === 0 || y >= l || F === 0 && E > 1) && (s.push(t), t = []), b.rules && (n.rules[b.key] = b.rules);
425
+ t.push({ item: b, span: F }), (E === 1 && t[0].span === 0 || y >= o || F === 0 && E > 1) && (s.push(t), t = []), b.rules && (r.rules[b.key] = b.rules);
426
426
  }
427
427
  };
428
428
  e.column.forEach((b) => {
429
429
  b.isForm = !0, a(b);
430
- }), t.length > 0 && s.push(t), n.formColumn = s, n.form = JSONUtil.cp(n.formDefault);
430
+ }), t.length > 0 && s.push(t), r.formColumn = s, r.form = JSONUtil.cp(r.formDefault);
431
431
  },
432
432
  init: async () => {
433
- n.show = !1, await ne(), n.initColumnForm();
433
+ r.show = !1, await ne(), r.initColumnForm();
434
434
  }
435
435
  });
436
- return n.initColumnForm(), d({
436
+ return r.initColumnForm(), i({
437
437
  ref: p,
438
- conf: n
438
+ conf: r
439
439
  }), (e, s) => (c(), g(u(K), {
440
440
  ref_key: "ruleFormRef",
441
441
  ref: p,
442
- model: n.form,
443
- rules: n.rules
442
+ model: r.form,
443
+ rules: r.rules
444
444
  }, {
445
445
  default: h(() => [
446
- n.show ? (c(!0), w($, { key: 0 }, L(n.formColumn, (l) => (c(), w("div", ye, [
446
+ r.show ? (c(!0), w($, { key: 0 }, L(r.formColumn, (o) => (c(), w("div", ye, [
447
447
  v(e.$slots, "form-start", {
448
- row: n.form
448
+ row: r.form
449
449
  }),
450
- (c(!0), w($, null, L(l, (o) => (c(), w($, null, [
451
- u(i)(o.item.show?.form, n.form) ?? !0 ? (c(), w("div", {
450
+ (c(!0), w($, null, L(o, (l) => (c(), w($, null, [
451
+ u(d)(l.item.show?.form, r.form) ?? !0 ? (c(), w("div", {
452
452
  key: 0,
453
- class: T(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
453
+ class: T(l.item.form.span > 0 ? `col-${l.item.form.span}` : "col")
454
454
  }, [
455
455
  C(u(P), {
456
- label: o.item.label,
457
- prop: o.item.key,
458
- "label-width": o.item.form?.labelWidth || "100px"
456
+ label: l.item.label,
457
+ prop: l.item.key,
458
+ "label-width": l.item.form?.labelWidth || "100px"
459
459
  }, {
460
460
  default: h(() => [
461
- v(e.$slots, "form-" + o.item.key + "-start", {
462
- row: n.form,
463
- item: o.item
461
+ v(e.$slots, "form-" + l.item.key + "-start", {
462
+ row: r.form,
463
+ item: l.item
464
464
  }),
465
- v(e.$slots, "form-" + o.item.key, {
466
- row: n.form,
467
- item: o.item
465
+ v(e.$slots, "form-" + l.item.key, {
466
+ row: r.form,
467
+ item: l.item
468
468
  }, () => [
469
- o.item.type === "input" ? (c(), g(u(H), U({
469
+ l.item.type === "input" ? (c(), g(u(H), U({
470
470
  key: 0,
471
- modelValue: n.form[o.item.key],
472
- "onUpdate:modelValue": (t) => n.form[o.item.key] = t
473
- }, { ref_for: !0 }, o.item.options?.input, I(o.item.options?.input?.on || {}), {
474
- disabled: n.getDisabled(o.item)
475
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(u(G), U({
471
+ modelValue: r.form[l.item.key],
472
+ "onUpdate:modelValue": (t) => r.form[l.item.key] = t
473
+ }, { ref_for: !0 }, l.item.options?.input, I(l.item.options?.input?.on || {}), {
474
+ disabled: r.getDisabled(l.item)
475
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), g(u(G), U({
476
476
  key: 1,
477
- modelValue: n.form[o.item.key],
478
- "onUpdate:modelValue": (t) => n.form[o.item.key] = t
479
- }, { ref_for: !0 }, o.item.options?.switch, I(o.item.options?.switch?.on || {}), {
480
- disabled: n.getDisabled(o.item)
481
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(u(B), U({
477
+ modelValue: r.form[l.item.key],
478
+ "onUpdate:modelValue": (t) => r.form[l.item.key] = t
479
+ }, { ref_for: !0 }, l.item.options?.switch, I(l.item.options?.switch?.on || {}), {
480
+ disabled: r.getDisabled(l.item)
481
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), g(u(B), U({
482
482
  key: 2,
483
- modelValue: n.form[o.item.key],
484
- "onUpdate:modelValue": (t) => n.form[o.item.key] = t
485
- }, { ref_for: !0 }, o.item.options?.select, I(o.item.options?.select?.on || {}), {
486
- disabled: n.getDisabled(o.item),
483
+ modelValue: r.form[l.item.key],
484
+ "onUpdate:modelValue": (t) => r.form[l.item.key] = t
485
+ }, { ref_for: !0 }, l.item.options?.select, I(l.item.options?.select?.on || {}), {
486
+ disabled: r.getDisabled(l.item),
487
487
  style: { width: "100%" }
488
488
  }), {
489
489
  default: h(() => [
490
- (c(!0), w($, null, L(o.item.options?.select?.data, (t) => (c(), g(u(N), {
490
+ (c(!0), w($, null, L(l.item.options?.select?.data, (t) => (c(), g(u(N), {
491
491
  key: t.value,
492
492
  label: t.label,
493
493
  value: t.value
494
494
  }, null, 8, ["label", "value"]))), 128))
495
495
  ]),
496
496
  _: 2
497
- }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(Q, U({
497
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), g(Q, U({
498
498
  key: 3,
499
- row: n.form,
500
- field: o.item.key
501
- }, { ref_for: !0 }, o.item.options?.list, I(o.item.options?.list?.on || {}), {
502
- disabled: n.getDisabled(o.item),
499
+ row: r.form,
500
+ field: l.item.key
501
+ }, { ref_for: !0 }, l.item.options?.list, I(l.item.options?.list?.on || {}), {
502
+ disabled: r.getDisabled(l.item),
503
503
  style: { width: "100%" }
504
- }), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(u(le), U({
504
+ }), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), g(u(oe), U({
505
505
  key: 4,
506
- modelValue: n.form[o.item.key],
507
- "onUpdate:modelValue": (t) => n.form[o.item.key] = t
508
- }, { ref_for: !0 }, o.item.options?.treeSelect, I(o.item.options?.treeSelect?.on || {}), {
509
- disabled: n.getDisabled(o.item),
506
+ modelValue: r.form[l.item.key],
507
+ "onUpdate:modelValue": (t) => r.form[l.item.key] = t
508
+ }, { ref_for: !0 }, l.item.options?.treeSelect, I(l.item.options?.treeSelect?.on || {}), {
509
+ disabled: r.getDisabled(l.item),
510
510
  style: { width: "100%" }
511
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(u(oe), U({
511
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), g(u(le), U({
512
512
  key: 5,
513
- modelValue: n.form[o.item.key],
514
- "onUpdate:modelValue": (t) => n.form[o.item.key] = t
515
- }, { ref_for: !0 }, o.item.options?.datetime, I(o.item.options?.datetime?.on || {}), {
516
- disabled: n.getDisabled(o.item)
517
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(S).customComponent[o.item.type] ? (c(), g(te(u(S).customComponent[o.item.type]), U({
513
+ modelValue: r.form[l.item.key],
514
+ "onUpdate:modelValue": (t) => r.form[l.item.key] = t
515
+ }, { ref_for: !0 }, l.item.options?.datetime, I(l.item.options?.datetime?.on || {}), {
516
+ disabled: r.getDisabled(l.item)
517
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(S).customComponent[l.item.type] ? (c(), g(te(u(S).customComponent[l.item.type]), U({
518
518
  key: 6,
519
- modelValue: n.form[o.item.key],
520
- "onUpdate:modelValue": (t) => n.form[o.item.key] = t
521
- }, { ref_for: !0 }, o.item.options?.[o.item.type], I(o.item.options?.[o.item.type]?.on || {}), {
522
- disabled: n.getDisabled(o.item)
519
+ modelValue: r.form[l.item.key],
520
+ "onUpdate:modelValue": (t) => r.form[l.item.key] = t
521
+ }, { ref_for: !0 }, l.item.options?.[l.item.type], I(l.item.options?.[l.item.type]?.on || {}), {
522
+ disabled: r.getDisabled(l.item)
523
523
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : k("", !0)
524
524
  ]),
525
- v(e.$slots, "form-" + o.item.key + "-end", {
526
- row: n.form,
527
- item: o.item
525
+ v(e.$slots, "form-" + l.item.key + "-end", {
526
+ row: r.form,
527
+ item: l.item
528
528
  })
529
529
  ]),
530
530
  _: 2
@@ -532,7 +532,7 @@ const he = {
532
532
  ], 2)) : k("", !0)
533
533
  ], 64))), 256)),
534
534
  v(e.$slots, "form-end", {
535
- row: n.form
535
+ row: r.form
536
536
  })
537
537
  ]))), 256)) : k("", !0)
538
538
  ]),
@@ -547,40 +547,40 @@ class we {
547
547
  * @param columns 列
548
548
  * @param fileName 文件名
549
549
  */
550
- static exportToExcel = async (d, i, r) => {
551
- const p = await D.loadModule("xlsx"), m = d.map((s) => {
552
- const l = {};
553
- return i.forEach((o) => {
554
- l[o.label] = s[o.key];
555
- }), l;
556
- }), n = p.utils.json_to_sheet(m), e = p.utils.book_new();
557
- p.utils.book_append_sheet(e, n, "Sheet1"), r ? typeof r == "function" && (r = r()) : r = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, p.writeFile(e, `${r}.xlsx`);
550
+ static exportToExcel = async (i, d, n) => {
551
+ const p = await D.loadModule("xlsx"), m = i.map((s) => {
552
+ const o = {};
553
+ return d.forEach((l) => {
554
+ o[l.label] = s[l.key];
555
+ }), o;
556
+ }), r = p.utils.json_to_sheet(m), e = p.utils.book_new();
557
+ p.utils.book_append_sheet(e, r, "Sheet1"), n ? typeof n == "function" && (n = n()) : n = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, p.writeFile(e, `${n}.xlsx`);
558
558
  };
559
559
  }
560
- const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
560
+ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
561
561
  __name: "switchConfirm",
562
- setup(f, { expose: d }) {
563
- const i = R(!1), r = R("确认修改"), p = R("确认要修改状态吗?");
564
- let m = null, n = null;
565
- const e = (o) => (o?.title && (r.value = o.title), o?.content && (p.value = o.content), i.value = !0, new Promise((t, a) => {
566
- m = t, n = a;
562
+ setup(f, { expose: i }) {
563
+ const d = R(!1), n = R("确认修改"), p = R("确认要修改状态吗?");
564
+ let m = null, r = null;
565
+ const e = (l) => (l?.title && (n.value = l.title), l?.content && (p.value = l.content), d.value = !0, new Promise((t, a) => {
566
+ m = t, r = a;
567
567
  })), s = () => {
568
- i.value = !1, m?.(!0), m = null, n = null;
569
- }, l = () => {
570
- i.value = !1, n?.(new Error("用户取消操作")), m = null, n = null;
568
+ d.value = !1, m?.(!0), m = null, r = null;
569
+ }, o = () => {
570
+ d.value = !1, r?.(new Error("用户取消操作")), m = null, r = null;
571
571
  };
572
- return d({
572
+ return i({
573
573
  open: e
574
- }), (o, t) => (c(), g(u(q), {
575
- modelValue: i.value,
576
- "onUpdate:modelValue": t[0] || (t[0] = (a) => i.value = a),
577
- title: r.value,
574
+ }), (l, t) => (c(), g(u(q), {
575
+ modelValue: d.value,
576
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => d.value = a),
577
+ title: n.value,
578
578
  "close-on-click-modal": !1,
579
579
  width: "400px"
580
580
  }, {
581
581
  footer: h(() => [
582
582
  x("span", ke, [
583
- C(u(O), { onClick: l }, {
583
+ C(u(O), { onClick: o }, {
584
584
  default: h(() => [...t[1] || (t[1] = [
585
585
  V("取消", -1)
586
586
  ])]),
@@ -618,7 +618,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
618
618
  }, Le = { class: "col fit-width relative" }, je = { class: "absolute column fit" }, ze = { class: "row justify-end mt-10 mb-10" }, Te = {
619
619
  class: "row form-item-content",
620
620
  style: { width: "100%" }
621
- }, Re = { class: "col" }, Me = { class: "dialog-footer" }, Ne = { class: "dialog-footer" }, Pe = /* @__PURE__ */ J({
621
+ }, Re = { class: "col" }, Me = { class: "dialog-footer" }, Ne = { class: "dialog-footer" }, Pe = /* @__PURE__ */ A({
622
622
  __name: "index",
623
623
  props: {
624
624
  /**
@@ -628,27 +628,27 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
628
628
  default: {}
629
629
  }
630
630
  },
631
- setup(f, { expose: d }) {
632
- const i = D.EDialog, r = f, p = R(), m = R(), n = D.isFun, e = X({
631
+ setup(f, { expose: i }) {
632
+ const d = D.EDialog, n = f, p = R(), m = R(), r = D.isFun, e = X({
633
633
  search: {
634
634
  column: {
635
635
  list: []
636
636
  },
637
637
  form: {},
638
638
  formDefault: {},
639
- getPlaceholder: (s, l = "请输入") => s.text?.search?.placeholder === void 0 ? `${l}${s.label}` : s.text?.search?.placeholder,
639
+ getPlaceholder: (s, o = "请输入") => s.text?.search?.placeholder === void 0 ? `${o}${s.label}` : s.text?.search?.placeholder,
640
640
  getFormData: () => {
641
641
  let s = {};
642
- r.option.column.forEach((o) => {
643
- (typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (s[o.key] = e.search.form[o.key]);
642
+ n.option.column.forEach((l) => {
643
+ (typeof l.show?.search == "function" ? l.show?.search(e.search.form) : l.show?.search) && (s[l.key] = e.search.form[l.key]);
644
644
  });
645
- const l = r.option.search?.before?.(s);
646
- return l && (s = l), s;
645
+ const o = n.option.search?.before?.(s);
646
+ return o && (s = o), s;
647
647
  },
648
648
  reset: () => {
649
649
  const s = e.search.formDefault;
650
- Object.keys(s).forEach((l) => {
651
- r.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
650
+ Object.keys(s).forEach((o) => {
651
+ n.option.search?.resetMode === "default" ? s[o] = e.search.formDefault[o] : s[o] = void 0;
652
652
  }), e.search.form = JSONUtil.cp(s), e.page.num = 1, e.table.getList();
653
653
  },
654
654
  submit: () => {
@@ -656,11 +656,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
656
656
  }
657
657
  },
658
658
  page: {
659
- size: r.option.page?.size || 10,
660
- sizeList: r.option.page?.sizeList || [10, 20, 50, 100],
659
+ size: n.option.page?.size || 10,
660
+ sizeList: n.option.page?.sizeList || [10, 20, 50, 100],
661
661
  num: 1,
662
662
  total: 0,
663
- layout: r.option.page?.layout || "total, sizes, prev, pager, next, jumper"
663
+ layout: n.option.page?.layout || "total, sizes, prev, pager, next, jumper"
664
664
  },
665
665
  table: {
666
666
  loading: !1,
@@ -668,17 +668,17 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
668
668
  expand: {
669
669
  isExpand: !1,
670
670
  rowKeys: [],
671
- change: (s, l) => {
671
+ change: (s, o) => {
672
672
  },
673
673
  all: () => {
674
674
  if (e.table.expand.isExpand)
675
675
  e.table.expand.rowKeys = [];
676
676
  else {
677
- const s = (l) => {
678
- let o = [];
679
- return l.forEach((t) => {
680
- o.push(t._id), t.children && t.children.length > 0 && (o = o.concat(s(t.children)));
681
- }), o;
677
+ const s = (o) => {
678
+ let l = [];
679
+ return o.forEach((t) => {
680
+ l.push(t._id), t.children && t.children.length > 0 && (l = l.concat(s(t.children)));
681
+ }), l;
682
682
  };
683
683
  e.table.expand.rowKeys = s(e.table.data);
684
684
  }
@@ -706,17 +706,17 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
706
706
  },
707
707
  getList: async () => {
708
708
  e.table.loading = !0;
709
- const s = r.option.api.list;
709
+ const s = n.option.api.list;
710
710
  try {
711
- const l = await s({
711
+ const o = await s({
712
712
  [S.pageField.size]: e.page.size,
713
713
  [S.pageField.num]: e.page.num,
714
714
  ...e.search.getFormData()
715
- }), o = S.resultField, t = l.data || { [o.list]: l };
716
- let a = (Array.isArray(t[o.list]), t[o.list]);
717
- e.table.data = r.option.data ? await r.option.data(a) : a, e.page.total = t[o.total] || 0;
718
- } catch (l) {
719
- console.error(l);
715
+ }), l = S.resultField, t = o.data || { [l.list]: o };
716
+ let a = (Array.isArray(t[l.list]), t[l.list]);
717
+ e.table.data = n.option.data ? await n.option.data(a) : a, e.page.total = t[l.total] || 0;
718
+ } catch (o) {
719
+ console.error(o);
720
720
  } finally {
721
721
  e.table.loading = !1;
722
722
  }
@@ -729,11 +729,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
729
729
  },
730
730
  exportFun: {
731
731
  start: async (s) => {
732
- let l = await e.table.exportFun[s](), o = r.option.column;
732
+ let o = await e.table.exportFun[s](), l = n.option.column;
733
733
  const t = JSONUtil.cp({
734
- data: l,
735
- columns: o
736
- }), a = r.option.tools?.export || {};
734
+ data: o,
735
+ columns: l
736
+ }), a = n.option.tools?.export || {};
737
737
  a.before && a.before(t), we.exportToExcel(t.data, t.columns, a.fileName);
738
738
  },
739
739
  select: () => {
@@ -748,15 +748,15 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
748
748
  },
749
749
  all: async () => {
750
750
  e.table.loading = !0;
751
- const s = r.option.api.list;
751
+ const s = n.option.api.list;
752
752
  try {
753
- const { data: l } = await s({
753
+ const { data: o } = await s({
754
754
  [S.pageField.size]: 999999,
755
755
  [S.pageField.num]: 1
756
756
  });
757
- return l[S.resultField.list];
758
- } catch (l) {
759
- console.error(l);
757
+ return o[S.resultField.list];
758
+ } catch (o) {
759
+ console.error(o);
760
760
  } finally {
761
761
  e.table.loading = !1;
762
762
  }
@@ -772,11 +772,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
772
772
  show: !1,
773
773
  showContent: !1,
774
774
  loading: !1,
775
- type: i.Insert,
775
+ type: d.Insert,
776
776
  form: {},
777
777
  formDefault: {},
778
778
  formColumn: [],
779
- getDisabled: (s) => s.disabled?.[e.update.type === i.Insert ? "create" : "update"],
779
+ getDisabled: (s) => s.disabled?.[e.update.type === d.Insert ? "create" : "update"],
780
780
  edit: {
781
781
  /**
782
782
  * 编辑原数据
@@ -786,42 +786,42 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
786
786
  * 将form填入数据和data比对差异数据返回
787
787
  */
788
788
  getApiData: (s) => {
789
- if (r.option.form?.editAll)
789
+ if (n.option.form?.editAll)
790
790
  return s;
791
- let l = {
791
+ let o = {
792
792
  _id: e.update.edit.data._id
793
793
  };
794
- return Object.keys(e.update.edit.data).forEach((o) => {
795
- s[o] !== e.update.edit.data[o] && (l[o] = s[o]);
796
- }), l;
794
+ return Object.keys(e.update.edit.data).forEach((l) => {
795
+ s[l] !== e.update.edit.data[l] && (o[l] = s[l]);
796
+ }), o;
797
797
  }
798
798
  },
799
- open: (s, l) => {
799
+ open: (s, o) => {
800
800
  e.update.showContent || FunUtil.throttle(async () => {
801
801
  e.update.type = s;
802
- const o = s === i.Insert;
803
- e.update.edit.data = l, e.update.title = o ? "新增" : "编辑", e.update.form = JSONUtil.cp(o ? e.update.formDefault : l), await r.option.form?.openBefore?.(l, e.update), e.update.show = !0, e.update.showContent = !0, r.option.form?.openAfter?.(l, e.update);
802
+ const l = s === d.Insert;
803
+ e.update.edit.data = o, e.update.title = l ? "新增" : "编辑", e.update.form = JSONUtil.cp(l ? e.update.formDefault : o), await n.option.form?.openBefore?.(o, e.update), e.update.show = !0, e.update.showContent = !0, n.option.form?.openAfter?.(o, e.update);
804
804
  });
805
805
  },
806
806
  submit: () => {
807
807
  FunUtil.throttle(async () => {
808
- await m.value?.validate(async (o, t) => new Promise((a, b) => {
809
- o || (D.fail("请检查表单数据"), b(!1)), a();
808
+ await m.value?.validate(async (l, t) => new Promise((a, b) => {
809
+ l || (D.fail("请检查表单数据"), b(!1)), a();
810
810
  })), e.update.loading = !0;
811
- const s = e.update.type === i.Insert ? r.option.api.create : r.option.api.update;
812
- let l = JSONUtil.cp(e.update.form);
813
- delete l.children, await r.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
814
- if (typeof l[o] == "string" && l[o].indexOf("T") > -1) {
815
- const t = new Date(l[o]).getTime();
816
- !isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (l[o] = t);
811
+ const s = e.update.type === d.Insert ? n.option.api.create : n.option.api.update;
812
+ let o = JSONUtil.cp(e.update.form);
813
+ delete o.children, await n.option.form?.submitBefore?.(o, e.update), Object.keys(o).forEach((l) => {
814
+ if (typeof o[l] == "string" && o[l].indexOf("T") > -1) {
815
+ const t = new Date(o[l]).getTime();
816
+ !isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (o[l] = t);
817
817
  }
818
818
  });
819
819
  try {
820
820
  await s({
821
- ...l
822
- }), e.update.close(), await e.table.getList(), r.option.form?.submitAfter?.(l, e.update);
823
- } catch (o) {
824
- console.error(o);
821
+ ...o
822
+ }), e.update.close(), await e.table.getList(), n.option.form?.submitAfter?.(o, e.update);
823
+ } catch (l) {
824
+ console.error(l);
825
825
  } finally {
826
826
  e.update.loading = !1;
827
827
  }
@@ -851,14 +851,14 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
851
851
  submit: () => {
852
852
  FunUtil.throttle(async () => {
853
853
  e.remove.loading = !0;
854
- const s = r.option.api.delete;
854
+ const s = n.option.api.delete;
855
855
  try {
856
856
  await s({
857
- _id: e.remove.items.map((l) => l._id),
857
+ _id: e.remove.items.map((o) => o._id),
858
858
  items: e.remove.items
859
859
  }), D.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
860
- } catch (l) {
861
- console.error(l);
860
+ } catch (o) {
861
+ console.error(o);
862
862
  } finally {
863
863
  e.remove.loading = !1;
864
864
  }
@@ -869,7 +869,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
869
869
  e.initCurdConfig(), e.initColumnOptions(), e.initColumnForm();
870
870
  },
871
871
  initCurdConfig: () => {
872
- const l = {
872
+ const o = {
873
873
  tools: {
874
874
  search: !0,
875
875
  reset: !0,
@@ -887,9 +887,9 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
887
887
  emptyText: "暂无数据",
888
888
  highlightCurrentRow: !0
889
889
  }
890
- }, o = r.option;
891
- Object.keys(l).forEach((t) => {
892
- o[t] = ObjectUtil.deepMerge(l[t], o[t] || {});
890
+ }, l = n.option;
891
+ Object.keys(o).forEach((t) => {
892
+ l[t] = ObjectUtil.deepMerge(o[t], l[t] || {});
893
893
  });
894
894
  },
895
895
  /**
@@ -898,7 +898,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
898
898
  * @returns
899
899
  */
900
900
  initColumnOptions: () => {
901
- const s = r.option, l = (o) => {
901
+ const s = n.option, o = (l) => {
902
902
  const a = {
903
903
  options: {
904
904
  switch: {
@@ -907,14 +907,14 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
907
907
  inactiveValue: !1,
908
908
  inactiveLabel: "关闭",
909
909
  tableBeforeChange: async (F, y) => {
910
- const E = o.options?.switch;
910
+ const E = l.options?.switch;
911
911
  try {
912
912
  await p.value?.open({
913
913
  title: "确认修改",
914
914
  content: `确认要${y[F] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
915
915
  }), e.table.loading = !0;
916
916
  try {
917
- return await r.option.api.update({
917
+ return await n.option.api.update({
918
918
  _id: y._id,
919
919
  [F]: y[F] === E.activeValue ? E.inactiveValue : E.activeValue,
920
920
  final(z, M, Y) {
@@ -960,35 +960,35 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
960
960
  table: 0,
961
961
  form: 0
962
962
  }
963
- }, b = o;
963
+ }, b = l;
964
964
  Object.keys(a).forEach((F) => {
965
965
  b[F] = ObjectUtil.deepMerge(a[F], b[F] || {});
966
966
  });
967
967
  };
968
- s.column.forEach(l), s.table?.column?.forEach(l);
968
+ s.column.forEach(o), s.table?.column?.forEach(o);
969
969
  },
970
970
  initColumnForm: () => {
971
- const s = r.option;
971
+ const s = n.option;
972
972
  e.update.formColumn = [], e.table.column.show = {
973
973
  list: [],
974
974
  listSource: []
975
975
  };
976
- const l = [], o = r.option.form?.maxSpan || 12, t = r.option.form?.defaultSpan || o / 2;
976
+ const o = [], l = n.option.form?.maxSpan || 12, t = n.option.form?.defaultSpan || l / 2;
977
977
  let a = [];
978
978
  const b = (y) => {
979
979
  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) {
980
980
  y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
981
981
  let E = y.form.span, z = a.reduce((Y, ae) => Y + ae.span, E);
982
982
  const M = a.length;
983
- a.push({ item: y, span: E }), (M === 1 && a[0].span === 0 || z >= o || E === 0 && M > 1) && (l.push(a), a = []), y.rules && (e.update.rules[y.key] = y.rules);
983
+ a.push({ item: y, span: E }), (M === 1 && a[0].span === 0 || z >= l || E === 0 && M > 1) && (o.push(a), a = []), y.rules && (e.update.rules[y.key] = y.rules);
984
984
  }
985
985
  };
986
986
  s.column.forEach((y) => {
987
987
  y.isForm = !0, b(y);
988
- }), r.option.table?.column?.forEach((y) => {
988
+ }), n.option.table?.column?.forEach((y) => {
989
989
  y.isForm = !1, b(y);
990
- }), 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;
991
- const F = r.option.search?.formDefault;
990
+ }), 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 && o.push(a), e.update.formColumn = o;
991
+ const F = n.option.search?.formDefault;
992
992
  F && Object.keys(F).forEach((y) => {
993
993
  e.search.formDefault[y] = F[y];
994
994
  }), s.column.forEach((y) => {
@@ -998,10 +998,10 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
998
998
  });
999
999
  return e.init(), ee(() => {
1000
1000
  e.table.getList();
1001
- }), d({
1001
+ }), i({
1002
1002
  conf: e
1003
- }), (s, l) => {
1004
- const o = re("loading");
1003
+ }), (s, o) => {
1004
+ const l = re("loading");
1005
1005
  return c(), w("div", Ce, [
1006
1006
  x("div", Ve, [
1007
1007
  v(s.$slots, "box-left"),
@@ -1089,7 +1089,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1089
1089
  type: "primary",
1090
1090
  onClick: e.search.submit
1091
1091
  }, {
1092
- default: h(() => [...l[8] || (l[8] = [
1092
+ default: h(() => [...o[8] || (o[8] = [
1093
1093
  V(" 搜索 ", -1)
1094
1094
  ])]),
1095
1095
  _: 1
@@ -1098,7 +1098,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1098
1098
  key: 1,
1099
1099
  onClick: e.search.reset
1100
1100
  }, {
1101
- default: h(() => [...l[9] || (l[9] = [
1101
+ default: h(() => [...o[9] || (o[9] = [
1102
1102
  V("重置", -1)
1103
1103
  ])]),
1104
1104
  _: 1
@@ -1115,23 +1115,23 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1115
1115
  ])) : k("", !0),
1116
1116
  x("div", De, [
1117
1117
  x("div", Ee, [
1118
- u(n)(f.option.tools?.add) ? (c(), w("div", $e, [
1118
+ u(r)(f.option.tools?.add) ? (c(), w("div", $e, [
1119
1119
  C(u(O), {
1120
1120
  type: "primary",
1121
- onClick: l[0] || (l[0] = (t) => e.update.open(u(i).Insert))
1121
+ onClick: o[0] || (o[0] = (t) => e.update.open(u(d).Insert))
1122
1122
  }, {
1123
- default: h(() => [...l[10] || (l[10] = [
1123
+ default: h(() => [...o[10] || (o[10] = [
1124
1124
  V("新增", -1)
1125
1125
  ])]),
1126
1126
  _: 1
1127
1127
  })
1128
1128
  ])) : k("", !0),
1129
- f.option.table?.selectable && u(n)(f.option.tools?.delete) ? (c(), w("div", Fe, [
1129
+ f.option.table?.selectable && u(r)(f.option.tools?.delete) ? (c(), w("div", Fe, [
1130
1130
  C(u(O), {
1131
1131
  type: "danger",
1132
- onClick: l[1] || (l[1] = (t) => e.remove.open(e.table.selection.list))
1132
+ onClick: o[1] || (o[1] = (t) => e.remove.open(e.table.selection.list))
1133
1133
  }, {
1134
- default: h(() => [...l[11] || (l[11] = [
1134
+ default: h(() => [...o[11] || (o[11] = [
1135
1135
  V(" 删除 ", -1)
1136
1136
  ])]),
1137
1137
  _: 1
@@ -1140,9 +1140,9 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1140
1140
  f.option.tools?.expand ? (c(), w("div", Oe, [
1141
1141
  C(u(O), {
1142
1142
  type: "warning",
1143
- onClick: l[2] || (l[2] = (t) => e.table.expand.all())
1143
+ onClick: o[2] || (o[2] = (t) => e.table.expand.all())
1144
1144
  }, {
1145
- default: h(() => [...l[12] || (l[12] = [
1145
+ default: h(() => [...o[12] || (o[12] = [
1146
1146
  V("展开/收缩", -1)
1147
1147
  ])]),
1148
1148
  _: 1
@@ -1155,20 +1155,20 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1155
1155
  dropdown: h(() => [
1156
1156
  C(u(pe), null, {
1157
1157
  default: h(() => [
1158
- C(u(A), { command: "select" }, {
1159
- default: h(() => [...l[14] || (l[14] = [
1158
+ C(u(J), { command: "select" }, {
1159
+ default: h(() => [...o[14] || (o[14] = [
1160
1160
  V("导出选中", -1)
1161
1161
  ])]),
1162
1162
  _: 1
1163
1163
  }),
1164
- C(u(A), { command: "page" }, {
1165
- default: h(() => [...l[15] || (l[15] = [
1164
+ C(u(J), { command: "page" }, {
1165
+ default: h(() => [...o[15] || (o[15] = [
1166
1166
  V("导出本页", -1)
1167
1167
  ])]),
1168
1168
  _: 1
1169
1169
  }),
1170
- C(u(A), { command: "all" }, {
1171
- default: h(() => [...l[16] || (l[16] = [
1170
+ C(u(J), { command: "all" }, {
1171
+ default: h(() => [...o[16] || (o[16] = [
1172
1172
  V("导出全部", -1)
1173
1173
  ])]),
1174
1174
  _: 1
@@ -1180,7 +1180,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1180
1180
  default: h(() => [
1181
1181
  x("div", Se, [
1182
1182
  C(u(O), { type: "warning" }, {
1183
- default: h(() => [...l[13] || (l[13] = [
1183
+ default: h(() => [...o[13] || (o[13] = [
1184
1184
  V("导出", -1)
1185
1185
  ])]),
1186
1186
  _: 1
@@ -1196,9 +1196,9 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1196
1196
  f.option.tools?.refresh === void 0 || f.option.tools?.refresh ? (c(), w("div", {
1197
1197
  key: 0,
1198
1198
  class: "refresh-btn",
1199
- onClick: l[3] || (l[3] = //@ts-ignore
1199
+ onClick: o[3] || (o[3] = //@ts-ignore
1200
1200
  (...t) => e.table.getList && e.table.getList(...t))
1201
- }, [...l[17] || (l[17] = [
1201
+ }, [...o[17] || (o[17] = [
1202
1202
  x("svg", {
1203
1203
  xmlns: "http://www.w3.org/2000/svg",
1204
1204
  viewBox: "0 0 1024 1024"
@@ -1221,7 +1221,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1221
1221
  onExpandChange: e.table.expand.change
1222
1222
  }), {
1223
1223
  default: h(() => [
1224
- f.option.table?.selectable && u(n)(f.option.tools?.delete) ? (c(), g(u(W), {
1224
+ f.option.table?.selectable && u(r)(f.option.tools?.delete) ? (c(), g(u(W), {
1225
1225
  key: 0,
1226
1226
  type: "selection",
1227
1227
  selectable: typeof f.option.table?.selectable == "function" ? f.option.table?.selectable : void 0,
@@ -1253,7 +1253,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1253
1253
  _: 2
1254
1254
  }, 1040, ["prop", "label"])) : k("", !0)
1255
1255
  ], 64))), 128)),
1256
- u(n)(f.option.tools?.add) || u(n)(f.option.tools?.update) || u(n)(f.option.tools?.delete) || s.$slots["table-op-left"] || s.$slots["table-op-right"] ? (c(), g(u(W), {
1256
+ u(r)(f.option.tools?.add) || u(r)(f.option.tools?.update) || u(r)(f.option.tools?.delete) || s.$slots["table-op-left"] || s.$slots["table-op-right"] ? (c(), g(u(W), {
1257
1257
  key: 1,
1258
1258
  label: "操作",
1259
1259
  width: "180",
@@ -1262,35 +1262,35 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1262
1262
  }, {
1263
1263
  default: h(({ row: t }) => [
1264
1264
  v(s.$slots, "table-op-left", { row: t }),
1265
- u(n)(f.option.tools?.add, t) ? (c(), g(u(O), {
1265
+ u(r)(f.option.tools?.add, t) ? (c(), g(u(O), {
1266
1266
  key: 0,
1267
1267
  link: "",
1268
1268
  type: "primary",
1269
- onClick: (a) => e.update.open(u(i).Insert, t)
1269
+ onClick: (a) => e.update.open(u(d).Insert, t)
1270
1270
  }, {
1271
- default: h(() => [...l[18] || (l[18] = [
1271
+ default: h(() => [...o[18] || (o[18] = [
1272
1272
  V(" 新增 ", -1)
1273
1273
  ])]),
1274
1274
  _: 1
1275
1275
  }, 8, ["onClick"])) : k("", !0),
1276
- u(n)(f.option.tools?.update, t) ? (c(), g(u(O), {
1276
+ u(r)(f.option.tools?.update, t) ? (c(), g(u(O), {
1277
1277
  key: 1,
1278
1278
  link: "",
1279
1279
  type: "warning",
1280
- onClick: (a) => e.update.open(u(i).Update, t)
1280
+ onClick: (a) => e.update.open(u(d).Update, t)
1281
1281
  }, {
1282
- default: h(() => [...l[19] || (l[19] = [
1282
+ default: h(() => [...o[19] || (o[19] = [
1283
1283
  V(" 编辑 ", -1)
1284
1284
  ])]),
1285
1285
  _: 1
1286
1286
  }, 8, ["onClick"])) : k("", !0),
1287
- u(n)(f.option.tools?.delete, t) ? (c(), g(u(O), {
1287
+ u(r)(f.option.tools?.delete, t) ? (c(), g(u(O), {
1288
1288
  key: 2,
1289
1289
  link: "",
1290
1290
  type: "danger",
1291
1291
  onClick: (a) => e.remove.open([t])
1292
1292
  }, {
1293
- default: h(() => [...l[20] || (l[20] = [
1293
+ default: h(() => [...o[20] || (o[20] = [
1294
1294
  V(" 删除 ", -1)
1295
1295
  ])]),
1296
1296
  _: 1
@@ -1302,7 +1302,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1302
1302
  ]),
1303
1303
  _: 3
1304
1304
  }, 16, ["data", "onSelectionChange", "expand-row-keys", "onExpandChange"])), [
1305
- [o, e.table.loading]
1305
+ [l, e.table.loading]
1306
1306
  ])
1307
1307
  ])
1308
1308
  ]),
@@ -1310,9 +1310,9 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1310
1310
  e.page.total > e.page.size ? (c(), g(u(me), {
1311
1311
  key: 0,
1312
1312
  "current-page": e.page.num,
1313
- "onUpdate:currentPage": l[4] || (l[4] = (t) => e.page.num = t),
1313
+ "onUpdate:currentPage": o[4] || (o[4] = (t) => e.page.num = t),
1314
1314
  "page-size": e.page.size,
1315
- "onUpdate:pageSize": l[5] || (l[5] = (t) => e.page.size = t),
1315
+ "onUpdate:pageSize": o[5] || (o[5] = (t) => e.page.size = t),
1316
1316
  background: "",
1317
1317
  "page-sizes": e.page.sizeList,
1318
1318
  "pager-count": 7,
@@ -1327,7 +1327,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1327
1327
  ]),
1328
1328
  C(u(q), U({
1329
1329
  modelValue: e.update.show,
1330
- "onUpdate:modelValue": l[6] || (l[6] = (t) => e.update.show = t),
1330
+ "onUpdate:modelValue": o[6] || (o[6] = (t) => e.update.show = t),
1331
1331
  title: e.update.title,
1332
1332
  "close-on-click-modal": !1,
1333
1333
  "before-close": e.update.close
@@ -1337,7 +1337,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1337
1337
  C(u(O), {
1338
1338
  onClick: e.update.close
1339
1339
  }, {
1340
- default: h(() => [...l[21] || (l[21] = [
1340
+ default: h(() => [...o[21] || (o[21] = [
1341
1341
  V("关闭", -1)
1342
1342
  ])]),
1343
1343
  _: 1
@@ -1347,7 +1347,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1347
1347
  onClick: e.update.submit,
1348
1348
  loading: e.update.loading
1349
1349
  }, {
1350
- default: h(() => [...l[22] || (l[22] = [
1350
+ default: h(() => [...o[22] || (o[22] = [
1351
1351
  V(" 提交 ", -1)
1352
1352
  ])]),
1353
1353
  _: 1
@@ -1363,7 +1363,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1363
1363
  }, {
1364
1364
  default: h(() => [
1365
1365
  e.update.showContent ? (c(!0), w($, { key: 0 }, L(e.update.formColumn, (t) => (c(), w($, null, [
1366
- u(n)(
1366
+ u(r)(
1367
1367
  t.map((a) => a.item.show?.form),
1368
1368
  e.update.form
1369
1369
  ) ? (c(), w("div", {
@@ -1376,7 +1376,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1376
1376
  row: e.update.form
1377
1377
  }),
1378
1378
  (c(!0), w($, null, L(t, (a) => (c(), w($, null, [
1379
- u(n)(a.item.show?.form, e.update.form) ? (c(), w("div", {
1379
+ u(r)(a.item.show?.form, e.update.form) ? (c(), w("div", {
1380
1380
  key: 0,
1381
1381
  class: T(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
1382
1382
  }, [
@@ -1434,14 +1434,14 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1434
1434
  }, { ref_for: !0 }, a.item.options?.list, I(a.item.options?.list?.on || {}), {
1435
1435
  disabled: e.update.getDisabled(a.item),
1436
1436
  style: { width: "100%" }
1437
- }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (c(), g(u(le), U({
1437
+ }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (c(), g(u(oe), U({
1438
1438
  key: 4,
1439
1439
  modelValue: e.update.form[a.item.key],
1440
1440
  "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1441
1441
  }, { ref_for: !0 }, a.item.options?.treeSelect, I(a.item.options?.treeSelect?.on || {}), {
1442
1442
  disabled: e.update.getDisabled(a.item),
1443
1443
  style: { width: "100%" }
1444
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (c(), g(u(oe), U({
1444
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (c(), g(u(le), U({
1445
1445
  key: 5,
1446
1446
  modelValue: e.update.form[a.item.key],
1447
1447
  "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
@@ -1479,7 +1479,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1479
1479
  }, 16, ["modelValue", "title", "before-close"]),
1480
1480
  C(u(q), {
1481
1481
  modelValue: e.remove.show,
1482
- "onUpdate:modelValue": l[7] || (l[7] = (t) => e.remove.show = t),
1482
+ "onUpdate:modelValue": o[7] || (o[7] = (t) => e.remove.show = t),
1483
1483
  title: e.remove.title,
1484
1484
  "close-on-click-modal": !1
1485
1485
  }, {
@@ -1488,7 +1488,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1488
1488
  C(u(O), {
1489
1489
  onClick: e.remove.close
1490
1490
  }, {
1491
- default: h(() => [...l[23] || (l[23] = [
1491
+ default: h(() => [...o[23] || (o[23] = [
1492
1492
  V("关闭", -1)
1493
1493
  ])]),
1494
1494
  _: 1
@@ -1498,7 +1498,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
1498
1498
  onClick: e.remove.submit,
1499
1499
  loading: e.remove.loading
1500
1500
  }, {
1501
- default: h(() => [...l[24] || (l[24] = [
1501
+ default: h(() => [...o[24] || (o[24] = [
1502
1502
  V(" 确认删除 ", -1)
1503
1503
  ])]),
1504
1504
  _: 1
@@ -1522,49 +1522,49 @@ class We {
1522
1522
  /**
1523
1523
  * 通过文件远程地址下载文件
1524
1524
  */
1525
- static async download(d, i = "download.png") {
1526
- const r = document.createElement("a");
1527
- r.style.display = "none", r.href = d, r.setAttribute("download", i), typeof r.download > "u" && r.setAttribute("target", "_blank"), document.body.appendChild(r), r.click(), document.body.removeChild(r), window.URL.revokeObjectURL(d);
1525
+ static async download(i, d = "download.png") {
1526
+ const n = document.createElement("a");
1527
+ n.style.display = "none", n.href = i, n.setAttribute("download", d), typeof n.download > "u" && n.setAttribute("target", "_blank"), document.body.appendChild(n), n.click(), document.body.removeChild(n), window.URL.revokeObjectURL(i);
1528
1528
  }
1529
1529
  /**
1530
1530
  * 将json对象或者json数组导出为json文件保存
1531
1531
  * @param data
1532
1532
  * @param name
1533
1533
  */
1534
- static exportJSONFile = (d, i) => {
1535
- const r = new Blob([JSON.stringify(d)], { type: "application/json" }), p = URL.createObjectURL(r), m = document.createElement("a");
1536
- m.href = p, m.download = `${i || "config"}.json`, m.click();
1534
+ static exportJSONFile = (i, d) => {
1535
+ const n = new Blob([JSON.stringify(i)], { type: "application/json" }), p = URL.createObjectURL(n), m = document.createElement("a");
1536
+ m.href = p, m.download = `${d || "config"}.json`, m.click();
1537
1537
  };
1538
1538
  /**
1539
1539
  * 导入文件内容,默认为json
1540
1540
  * @param param
1541
1541
  * @returns
1542
1542
  */
1543
- static importFile = async (d) => new Promise((i, r) => {
1543
+ static importFile = async (i) => new Promise((d, n) => {
1544
1544
  const p = document.createElement("input");
1545
1545
  p.type = "file";
1546
- const m = d?.accept || ".json";
1547
- p.accept = m, p.style.display = "none", p.onchange = (n) => {
1548
- const e = n.target.files[0];
1546
+ const m = i?.accept || ".json";
1547
+ p.accept = m, p.style.display = "none", p.onchange = (r) => {
1548
+ const e = r.target.files[0];
1549
1549
  if (!e) {
1550
- D.fail("未选择文件"), r("未选择文件");
1550
+ D.fail("未选择文件"), n("未选择文件");
1551
1551
  return;
1552
1552
  }
1553
1553
  const s = new FileReader();
1554
- s.onload = async (l) => {
1555
- const o = m == ".json" ? JSON.parse(l.target.result) : l.target.result;
1556
- i(o);
1554
+ s.onload = async (o) => {
1555
+ const l = m == ".json" ? JSON.parse(o.target.result) : o.target.result;
1556
+ d(l);
1557
1557
  }, s.onerror = () => {
1558
- D.fail("文件读取失败"), r("文件读取失败");
1558
+ D.fail("文件读取失败"), n("文件读取失败");
1559
1559
  }, s.readAsText(e), document.body.removeChild(p);
1560
1560
  }, document.body.appendChild(p), p.click();
1561
1561
  });
1562
1562
  }
1563
- const Be = (f, d) => {
1564
- if (f.component("TCurd", Pe), f.component("TFormList", Q), f.component("TColumn", ge), d?.customComponent) {
1565
- S.customComponent = d.customComponent;
1566
- for (const i in d.customComponent)
1567
- f.component(i, d.customComponent[i]);
1563
+ const Be = (f, i) => {
1564
+ if (f.component("TCurd", Pe), f.component("TFormList", Q), f.component("TColumn", ge), i?.customComponent) {
1565
+ S.customComponent = i.customComponent;
1566
+ for (const d in i.customComponent)
1567
+ f.component(d, i.customComponent[d]);
1568
1568
  }
1569
1569
  }, _e = {
1570
1570
  install: Be