cc1-form 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cc1-form.js CHANGED
@@ -1,5 +1,5 @@
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
- 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";
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";
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, r) => typeof d == "function" ? d(r) : d;
27
+ static isFun = (d, i) => typeof d == "function" ? d(i) : d;
28
28
  /**
29
29
  * 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
30
30
  */
31
31
  static getRouterParams = () => {
32
- const d = this.router.currentRoute.value.query || {}, r = this.router.currentRoute.value.params || {};
33
- return Object.keys(d).length ? d : Object.keys(r).length ? r : {};
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 : {};
34
34
  };
35
35
  /**
36
36
  * 模块赋值
@@ -43,8 +43,8 @@ class D {
43
43
  static loadModule = async (d) => {
44
44
  if (!D.moduleObj[d])
45
45
  throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);
46
- const r = await D.moduleObj[d]();
47
- return r.default ?? r;
46
+ const i = await D.moduleObj[d]();
47
+ return i.default ?? i;
48
48
  };
49
49
  /**
50
50
  * 提示信息对象管理
@@ -60,18 +60,18 @@ class D {
60
60
  * @param type 消息类型
61
61
  * @param options 其他选项
62
62
  */
63
- static showMessage(d, r, i = {}) {
64
- const c = Date.now();
65
- if (!this.tipMessages[d] || c - this.tipMessages[d] > this.tipMessagesGap) {
66
- this.tipMessages[d] = c;
67
- const f = Object.assign(
63
+ static showMessage(d, i, r = {}) {
64
+ const p = Date.now();
65
+ if (!this.tipMessages[d] || p - this.tipMessages[d] > this.tipMessagesGap) {
66
+ this.tipMessages[d] = p;
67
+ const m = Object.assign(
68
68
  {
69
69
  message: d,
70
- type: r
70
+ type: i
71
71
  },
72
- i
72
+ r
73
73
  );
74
- de(f), setTimeout(() => {
74
+ de(m), setTimeout(() => {
75
75
  delete this.tipMessages[d];
76
76
  }, this.tipMessagesGap);
77
77
  }
@@ -81,16 +81,16 @@ class D {
81
81
  * @param content
82
82
  * @param options
83
83
  */
84
- static fail = (d, r = {}) => {
85
- this.showMessage(d, "error", r);
84
+ static fail = (d, i = {}) => {
85
+ this.showMessage(d, "error", i);
86
86
  };
87
87
  /**
88
88
  * 成功提示
89
89
  * @param content
90
90
  * @param options
91
91
  */
92
- static success = (d, r = {}) => {
93
- this.showMessage(d, "success", r);
92
+ static success = (d, i = {}) => {
93
+ this.showMessage(d, "success", i);
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, r = "加载中") => {
102
+ static loading = (d = !0, i = "加载中") => {
103
103
  Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
104
104
  d ? this.loadingObj = ue.service({
105
105
  lock: !0,
106
- text: r,
106
+ text: i,
107
107
  background: "rgba(0, 0, 0, 0.3)"
108
108
  }) : this.loadingObj && (this.loadingObj.close(), this.loadingObj = null);
109
109
  }, 50);
@@ -113,13 +113,13 @@ class D {
113
113
  * @param url 地址
114
114
  * @param isCenter 是否居中
115
115
  */
116
- static openUrl = (d, r = !0) => {
117
- if (r) {
118
- let i = screen.width / 2 - 500, c = screen.height / 2 - 800 / 2 - 30;
116
+ static openUrl = (d, i = !0) => {
117
+ if (i) {
118
+ let r = screen.width / 2 - 500, p = 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=" + i
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
123
123
  );
124
124
  } else
125
125
  window.open(
@@ -133,11 +133,11 @@ class D {
133
133
  * @param param
134
134
  * @returns
135
135
  */
136
- static getImgPic = (d) => new Promise(async (r, i) => {
137
- let c = document.getElementById(d.id);
138
- const f = await D.loadModule("html2canvas");
136
+ static getImgPic = (d) => new Promise(async (i, r) => {
137
+ let p = document.getElementById(d.id);
138
+ const m = await D.loadModule("html2canvas");
139
139
  try {
140
- f(c, {
140
+ m(p, {
141
141
  logging: !1,
142
142
  allowTaint: !0,
143
143
  scale: window.devicePixelRatio,
@@ -149,14 +149,27 @@ class D {
149
149
  backgroundColor: "#ffffff00"
150
150
  }).then(function(n) {
151
151
  let e = n.toDataURL("image/png");
152
- r(e);
152
+ i(e);
153
153
  });
154
154
  } catch (n) {
155
- i(n);
155
+ r(n);
156
156
  }
157
157
  });
158
158
  }
159
- class L {
159
+ class S {
160
+ /** 全局分页字段 */
161
+ static pageField = {
162
+ num: "current",
163
+ size: "size"
164
+ };
165
+ /** 全局请求结果字段 */
166
+ static resultField = {
167
+ list: "records",
168
+ pages: "pages",
169
+ num: "current",
170
+ size: "size",
171
+ total: "total"
172
+ };
160
173
  /**
161
174
  * 自定义组件
162
175
  */
@@ -167,10 +180,10 @@ class L {
167
180
  * @param field
168
181
  * @returns
169
182
  */
170
- static findOptions = (d, r) => {
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)];
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)];
174
187
  };
175
188
  /**
176
189
  * 更新组件数据
@@ -188,9 +201,9 @@ class L {
188
201
  }))
189
202
  )
190
203
  */
191
- static setOptionsData = (d, r, i) => {
192
- const c = L.findOptions(d, r);
193
- c && (c.data = i);
204
+ static setOptionsData = (d, i, r) => {
205
+ const p = S.findOptions(d, i);
206
+ p && (p.data = r);
194
207
  };
195
208
  static form = {
196
209
  openBefore: {
@@ -201,8 +214,8 @@ class L {
201
214
  * @param treeData 树形数据
202
215
  * @param option 组件配置
203
216
  */
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 }]);
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 }]);
206
219
  }
207
220
  }
208
221
  };
@@ -217,12 +230,12 @@ class j {
217
230
  * @param field 字段名
218
231
  * @param row 行数据
219
232
  */
220
- static setId = (d, r, i) => {
221
- r[d] || (r[d] = []), r[d].forEach((c) => {
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
- }), c._id || (c._id = j.getIdFun());
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);
238
+ }), p._id || (p._id = j.getIdFun());
226
239
  });
227
240
  };
228
241
  /**
@@ -232,17 +245,17 @@ class j {
232
245
  * @param itemFields 元素字段-如:[{label:'',value:''}]
233
246
  * @param callback 回调函数
234
247
  */
235
- static add = (d, r, i, c) => {
236
- const f = JSONUtil.cp(i);
237
- j.setId(d, r, i), r[d].push(
238
- f.reduce(
248
+ static add = (d, i, r, p) => {
249
+ const m = JSONUtil.cp(r);
250
+ j.setId(d, i, r), i[d].push(
251
+ m.reduce(
239
252
  (n, e) => {
240
253
  let s = e.default ?? "";
241
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;
242
255
  },
243
256
  { _id: j.getIdFun() }
244
257
  )
245
- ), c?.(r);
258
+ ), p?.(i);
246
259
  };
247
260
  /**
248
261
  * 删除数组元素
@@ -251,8 +264,8 @@ class j {
251
264
  * @param item 元素-如:{_id:''}
252
265
  * @param callback 回调函数
253
266
  */
254
- static remove = (d, r, i, c) => {
255
- r[d] = r[d].filter((f) => f._id !== i._id), c?.(r);
267
+ static remove = (d, i, r, p) => {
268
+ i[d] = i[d].filter((m) => m._id !== r._id), p?.(i);
256
269
  };
257
270
  /**
258
271
  * 获取没有id的数据
@@ -260,21 +273,21 @@ class j {
260
273
  * @param childernField 子级字段-如:list、children
261
274
  * @returns 没有id的数据
262
275
  */
263
- static getNoIdData = (d, r) => {
264
- const i = JSONUtil.cp(d);
265
- return i.forEach((c) => {
266
- c._id && delete c._id, r && c[r] && j.getNoIdData(c[r], r);
267
- }), i;
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;
268
281
  };
269
282
  }
270
- const be = {
283
+ const he = {
271
284
  key: 0,
272
285
  class: "column",
273
286
  style: { width: "100%", gap: "10px" }
274
- }, he = {
287
+ }, be = {
275
288
  class: "row items-center",
276
289
  style: { gap: "10px", width: "100%" }
277
- }, Q = /* @__PURE__ */ P({
290
+ }, Q = /* @__PURE__ */ J({
278
291
  __name: "list",
279
292
  props: {
280
293
  row: {
@@ -309,73 +322,73 @@ const be = {
309
322
  }
310
323
  },
311
324
  emits: ["change"],
312
- setup(m, { emit: d }) {
313
- const r = m, i = q({
325
+ setup(f, { emit: d }) {
326
+ const i = f, r = X({
314
327
  show: !1,
315
- add: (f, n, e) => {
316
- j.add(f, n, e, () => {
317
- c("change");
328
+ add: (m, n, e) => {
329
+ j.add(m, n, e, () => {
330
+ p("change");
318
331
  });
319
332
  },
320
- remove: (f, n, e) => {
321
- j.remove(f, n, e, () => {
322
- c("change");
333
+ remove: (m, n, e) => {
334
+ j.remove(m, n, e, () => {
335
+ p("change");
323
336
  });
324
337
  }
325
338
  });
326
339
  ee(() => {
327
- j.setId(r.field, r.row, r.itemFields), i.show = !0;
340
+ j.setId(i.field, i.row, i.itemFields), r.show = !0;
328
341
  });
329
- const c = d;
330
- return (f, n) => {
342
+ const p = d;
343
+ return (m, n) => {
331
344
  const e = Z("el-button"), s = Z("el-input");
332
- return i.show ? (p(), w("div", be, [
333
- k(f.$slots, "list-start", { row: m.row }),
345
+ return r.show ? (c(), w("div", he, [
346
+ v(m.$slots, "list-start", { row: f.row }),
334
347
  x("div", null, [
335
- v(e, {
348
+ C(e, {
336
349
  link: "",
337
350
  type: "primary",
338
- onClick: n[0] || (n[0] = (l) => i.add(m.field, m.row, m.itemFields))
351
+ onClick: n[0] || (n[0] = (l) => r.add(f.field, f.row, f.itemFields))
339
352
  }, {
340
- default: b(() => [...n[2] || (n[2] = [
353
+ default: h(() => [...n[2] || (n[2] = [
341
354
  V("添加", -1)
342
355
  ])]),
343
356
  _: 1
344
357
  })
345
358
  ]),
346
- (p(!0), w(O, null, I(m.row[m.field], (l) => (p(), w("div", he, [
347
- k(f.$slots, "item-start", {
359
+ (c(!0), w($, null, L(f.row[f.field], (l) => (c(), w("div", be, [
360
+ v(m.$slots, "item-start", {
348
361
  item: l,
349
- row: m.row
362
+ row: f.row
350
363
  }),
351
- (p(!0), w(O, null, I(m.itemFields, (o) => (p(), g(s, {
364
+ (c(!0), w($, null, L(f.itemFields, (o) => (c(), g(s, {
352
365
  modelValue: l[o.value],
353
366
  "onUpdate:modelValue": (t) => l[o.value] = t,
354
- style: se({ width: m.inputWidth }),
355
- class: X(m.inputClass),
356
- placeholder: o[m.label] || o[m.value],
357
- onChange: n[1] || (n[1] = (t) => c("change"))
367
+ style: se({ width: f.inputWidth }),
368
+ class: T(f.inputClass),
369
+ placeholder: o[f.label] || o[f.value],
370
+ onChange: n[1] || (n[1] = (t) => p("change"))
358
371
  }, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
359
- k(f.$slots, "item-end", {
372
+ v(m.$slots, "item-end", {
360
373
  item: l,
361
- row: m.row
374
+ row: f.row
362
375
  }),
363
- v(e, {
376
+ C(e, {
364
377
  link: "",
365
378
  type: "danger",
366
- onClick: (o) => i.remove(m.field, m.row, l)
379
+ onClick: (o) => r.remove(f.field, f.row, l)
367
380
  }, {
368
- default: b(() => [...n[3] || (n[3] = [
381
+ default: h(() => [...n[3] || (n[3] = [
369
382
  V("删除", -1)
370
383
  ])]),
371
384
  _: 1
372
385
  }, 8, ["onClick"])
373
386
  ]))), 256)),
374
- k(f.$slots, "list-end", { row: m.row })
375
- ])) : C("", !0);
387
+ v(m.$slots, "list-end", { row: f.row })
388
+ ])) : k("", !0);
376
389
  };
377
390
  }
378
- }), ye = { class: "row curd-row" }, ge = /* @__PURE__ */ P({
391
+ }), ye = { class: "row curd-row" }, ge = /* @__PURE__ */ J({
379
392
  __name: "column",
380
393
  props: {
381
394
  /**
@@ -391,29 +404,29 @@ const be = {
391
404
  default: ""
392
405
  }
393
406
  },
394
- setup(m, { expose: d }) {
395
- const r = D.isFun, i = D.EDialog, c = T(), f = m, n = q({
407
+ setup(f, { expose: d }) {
408
+ const i = D.isFun, r = D.EDialog, p = R(), m = f, n = X({
396
409
  rules: {},
397
410
  show: !0,
398
411
  form: {},
399
412
  formDefault: {},
400
413
  formColumn: [],
401
- getDisabled: (e) => e.disabled?.[(f.type || i.Insert) === i.Insert ? "create" : "update"],
414
+ getDisabled: (e) => e.disabled?.[(m.type || r.Insert) === r.Insert ? "create" : "update"],
402
415
  initColumnForm: async () => {
403
- const e = f.option;
416
+ const e = m.option;
404
417
  n.formColumn = [];
405
- const s = [], l = f.option.form?.maxSpan || 12, o = f.option.form?.defaultSpan || l;
418
+ const s = [], l = m.option.form?.maxSpan || 12, o = m.option.form?.defaultSpan || l;
406
419
  let t = [];
407
- const a = (h) => {
408
- if (n.formDefault[h.key] = h.value, h.isForm) {
409
- h.form = h.form || { span: o }, h.form.span = h.form.span ?? o;
410
- let $ = h.form.span, y = t.reduce((R, z) => R + z.span, $);
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;
423
+ let F = b.form.span, y = t.reduce((z, M) => z + M.span, F);
411
424
  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);
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);
413
426
  }
414
427
  };
415
- e.column.forEach((h) => {
416
- h.isForm = !0, a(h);
428
+ e.column.forEach((b) => {
429
+ b.isForm = !0, a(b);
417
430
  }), t.length > 0 && s.push(t), n.formColumn = s, n.form = JSONUtil.cp(n.formDefault);
418
431
  },
419
432
  init: async () => {
@@ -421,107 +434,107 @@ const be = {
421
434
  }
422
435
  });
423
436
  return n.initColumnForm(), d({
424
- ref: c,
437
+ ref: p,
425
438
  conf: n
426
- }), (e, s) => (p(), g(u(A), {
439
+ }), (e, s) => (c(), g(u(K), {
427
440
  ref_key: "ruleFormRef",
428
- ref: c,
441
+ ref: p,
429
442
  model: n.form,
430
443
  rules: n.rules
431
444
  }, {
432
- default: b(() => [
433
- n.show ? (p(!0), w(O, { key: 0 }, I(n.formColumn, (l) => (p(), w("div", ye, [
434
- k(e.$slots, "form-start", {
445
+ default: h(() => [
446
+ n.show ? (c(!0), w($, { key: 0 }, L(n.formColumn, (l) => (c(), w("div", ye, [
447
+ v(e.$slots, "form-start", {
435
448
  row: n.form
436
449
  }),
437
- (p(!0), w(O, null, I(l, (o) => (p(), w(O, null, [
438
- u(r)(o.item.show?.form, n.form) ?? !0 ? (p(), w("div", {
450
+ (c(!0), w($, null, L(l, (o) => (c(), w($, null, [
451
+ u(i)(o.item.show?.form, n.form) ?? !0 ? (c(), w("div", {
439
452
  key: 0,
440
- class: X(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
453
+ class: T(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
441
454
  }, [
442
- v(u(_), {
455
+ C(u(P), {
443
456
  label: o.item.label,
444
457
  prop: o.item.key,
445
458
  "label-width": o.item.form?.labelWidth || "100px"
446
459
  }, {
447
- default: b(() => [
448
- k(e.$slots, "form-" + o.item.key + "-start", {
460
+ default: h(() => [
461
+ v(e.$slots, "form-" + o.item.key + "-start", {
449
462
  row: n.form,
450
463
  item: o.item
451
464
  }),
452
- k(e.$slots, "form-" + o.item.key, {
465
+ v(e.$slots, "form-" + o.item.key, {
453
466
  row: n.form,
454
467
  item: o.item
455
468
  }, () => [
456
- o.item.type === "input" ? (p(), g(u(K), U({
469
+ o.item.type === "input" ? (c(), g(u(H), U({
457
470
  key: 0,
458
471
  modelValue: n.form[o.item.key],
459
472
  "onUpdate:modelValue": (t) => n.form[o.item.key] = t
460
- }, { ref_for: !0 }, o.item.options?.input, F(o.item.options?.input?.on || {}), {
473
+ }, { ref_for: !0 }, o.item.options?.input, I(o.item.options?.input?.on || {}), {
461
474
  disabled: n.getDisabled(o.item)
462
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (p(), g(u(H), U({
475
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(u(G), U({
463
476
  key: 1,
464
477
  modelValue: n.form[o.item.key],
465
478
  "onUpdate:modelValue": (t) => n.form[o.item.key] = t
466
- }, { ref_for: !0 }, o.item.options?.switch, F(o.item.options?.switch?.on || {}), {
479
+ }, { ref_for: !0 }, o.item.options?.switch, I(o.item.options?.switch?.on || {}), {
467
480
  disabled: n.getDisabled(o.item)
468
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (p(), g(u(N), U({
481
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(u(B), U({
469
482
  key: 2,
470
483
  modelValue: n.form[o.item.key],
471
484
  "onUpdate:modelValue": (t) => n.form[o.item.key] = t
472
- }, { ref_for: !0 }, o.item.options?.select, F(o.item.options?.select?.on || {}), {
485
+ }, { ref_for: !0 }, o.item.options?.select, I(o.item.options?.select?.on || {}), {
473
486
  disabled: n.getDisabled(o.item),
474
487
  style: { width: "100%" }
475
488
  }), {
476
- default: b(() => [
477
- (p(!0), w(O, null, I(o.item.options?.select?.data, (t) => (p(), g(u(M), {
489
+ default: h(() => [
490
+ (c(!0), w($, null, L(o.item.options?.select?.data, (t) => (c(), g(u(N), {
478
491
  key: t.value,
479
492
  label: t.label,
480
493
  value: t.value
481
494
  }, null, 8, ["label", "value"]))), 128))
482
495
  ]),
483
496
  _: 2
484
- }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (p(), g(Q, U({
497
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(Q, U({
485
498
  key: 3,
486
499
  row: n.form,
487
500
  field: o.item.key
488
- }, { ref_for: !0 }, o.item.options?.list, F(o.item.options?.list?.on || {}), {
501
+ }, { ref_for: !0 }, o.item.options?.list, I(o.item.options?.list?.on || {}), {
489
502
  disabled: n.getDisabled(o.item),
490
503
  style: { width: "100%" }
491
- }), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (p(), g(u(oe), U({
504
+ }), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(u(le), U({
492
505
  key: 4,
493
506
  modelValue: n.form[o.item.key],
494
507
  "onUpdate:modelValue": (t) => n.form[o.item.key] = t
495
- }, { ref_for: !0 }, o.item.options?.treeSelect, F(o.item.options?.treeSelect?.on || {}), {
508
+ }, { ref_for: !0 }, o.item.options?.treeSelect, I(o.item.options?.treeSelect?.on || {}), {
496
509
  disabled: n.getDisabled(o.item),
497
510
  style: { width: "100%" }
498
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (p(), g(u(le), U({
511
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(u(oe), U({
499
512
  key: 5,
500
513
  modelValue: n.form[o.item.key],
501
514
  "onUpdate:modelValue": (t) => n.form[o.item.key] = t
502
- }, { ref_for: !0 }, o.item.options?.datetime, F(o.item.options?.datetime?.on || {}), {
515
+ }, { ref_for: !0 }, o.item.options?.datetime, I(o.item.options?.datetime?.on || {}), {
503
516
  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({
517
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(S).customComponent[o.item.type] ? (c(), g(te(u(S).customComponent[o.item.type]), U({
505
518
  key: 6,
506
519
  modelValue: n.form[o.item.key],
507
520
  "onUpdate:modelValue": (t) => n.form[o.item.key] = t
508
- }, { ref_for: !0 }, o.item.options?.[o.item.type], F(o.item.options?.[o.item.type]?.on || {}), {
521
+ }, { ref_for: !0 }, o.item.options?.[o.item.type], I(o.item.options?.[o.item.type]?.on || {}), {
509
522
  disabled: n.getDisabled(o.item)
510
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
523
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : k("", !0)
511
524
  ]),
512
- k(e.$slots, "form-" + o.item.key + "-end", {
525
+ v(e.$slots, "form-" + o.item.key + "-end", {
513
526
  row: n.form,
514
527
  item: o.item
515
528
  })
516
529
  ]),
517
530
  _: 2
518
531
  }, 1032, ["label", "prop", "label-width"])
519
- ], 2)) : C("", !0)
532
+ ], 2)) : k("", !0)
520
533
  ], 64))), 256)),
521
- k(e.$slots, "form-end", {
534
+ v(e.$slots, "form-end", {
522
535
  row: n.form
523
536
  })
524
- ]))), 256)) : C("", !0)
537
+ ]))), 256)) : k("", !0)
525
538
  ]),
526
539
  _: 3
527
540
  }, 8, ["model", "rules"]));
@@ -534,58 +547,58 @@ class we {
534
547
  * @param columns 列
535
548
  * @param fileName 文件名
536
549
  */
537
- static exportToExcel = async (d, r, i) => {
538
- const c = await D.loadModule("xlsx"), f = d.map((s) => {
550
+ static exportToExcel = async (d, i, r) => {
551
+ const p = await D.loadModule("xlsx"), m = d.map((s) => {
539
552
  const l = {};
540
- return r.forEach((o) => {
553
+ return i.forEach((o) => {
541
554
  l[o.label] = s[o.key];
542
555
  }), l;
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`);
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`);
545
558
  };
546
559
  }
547
- const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
560
+ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ J({
548
561
  __name: "switchConfirm",
549
- setup(m, { expose: d }) {
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;
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;
554
567
  })), s = () => {
555
- r.value = !1, f?.(!0), f = null, n = null;
568
+ i.value = !1, m?.(!0), m = null, n = null;
556
569
  }, l = () => {
557
- r.value = !1, n?.(new Error("用户取消操作")), f = null, n = null;
570
+ i.value = !1, n?.(new Error("用户取消操作")), m = null, n = null;
558
571
  };
559
572
  return d({
560
573
  open: e
561
- }), (o, t) => (p(), g(u(G), {
562
- modelValue: r.value,
563
- "onUpdate:modelValue": t[0] || (t[0] = (a) => r.value = a),
564
- title: i.value,
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,
565
578
  "close-on-click-modal": !1,
566
579
  width: "400px"
567
580
  }, {
568
- footer: b(() => [
581
+ footer: h(() => [
569
582
  x("span", ke, [
570
- v(u(S), { onClick: l }, {
571
- default: b(() => [...t[1] || (t[1] = [
583
+ C(u(O), { onClick: l }, {
584
+ default: h(() => [...t[1] || (t[1] = [
572
585
  V("取消", -1)
573
586
  ])]),
574
587
  _: 1
575
588
  }),
576
- v(u(S), {
589
+ C(u(O), {
577
590
  type: "primary",
578
591
  onClick: s
579
592
  }, {
580
- default: b(() => [...t[2] || (t[2] = [
593
+ default: h(() => [...t[2] || (t[2] = [
581
594
  V("确认", -1)
582
595
  ])]),
583
596
  _: 1
584
597
  })
585
598
  ])
586
599
  ]),
587
- default: b(() => [
588
- x("div", null, W(c.value), 1)
600
+ default: h(() => [
601
+ x("div", null, _(p.value), 1)
589
602
  ]),
590
603
  _: 1
591
604
  }, 8, ["modelValue", "title"]));
@@ -593,19 +606,19 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
593
606
  }), Ce = { class: "col relative cc1-form-box" }, Ve = {
594
607
  class: "absolute row fit",
595
608
  style: { overflow: "hidden" }
596
- }, Ue = { class: "col column" }, De = {
609
+ }, xe = { class: "col column" }, Ue = {
597
610
  key: 0,
598
611
  class: "relative curd-search"
599
- }, Ee = { class: "mb-20 flex justify-between items-center" }, xe = {
612
+ }, De = { class: "mb-10 flex justify-between items-center" }, Ee = {
600
613
  class: "flex items-center",
601
614
  style: { gap: "10px" }
602
- }, $e = { key: 0 }, Oe = { key: 1 }, Se = { key: 2 }, Fe = { class: "export-btn" }, Ie = {
615
+ }, $e = { key: 0 }, Fe = { key: 1 }, Oe = { key: 2 }, Se = { class: "export-btn" }, Ie = {
603
616
  class: "flex items-center",
604
617
  style: { gap: "10px" }
605
- }, je = { class: "col fit-width relative" }, Le = { class: "absolute column fit" }, Te = { class: "row justify-end mt-20 mb-20" }, Re = { class: "row curd-row" }, ze = {
618
+ }, Le = { class: "col fit-width relative" }, je = { class: "absolute column fit" }, ze = { class: "row justify-end mt-10 mb-10" }, Te = {
606
619
  class: "row form-item-content",
607
620
  style: { width: "100%" }
608
- }, Me = { class: "col" }, _e = { class: "dialog-footer" }, Ne = { class: "dialog-footer" }, Pe = /* @__PURE__ */ P({
621
+ }, Re = { class: "col" }, Me = { class: "dialog-footer" }, Ne = { class: "dialog-footer" }, Pe = /* @__PURE__ */ J({
609
622
  __name: "index",
610
623
  props: {
611
624
  /**
@@ -615,26 +628,27 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
615
628
  default: {}
616
629
  }
617
630
  },
618
- setup(m, { expose: d }) {
619
- const r = D.EDialog, i = m, c = T(), f = T(), n = D.isFun, e = q({
631
+ setup(f, { expose: d }) {
632
+ const i = D.EDialog, r = f, p = R(), m = R(), n = D.isFun, e = X({
620
633
  search: {
621
634
  column: {
622
635
  list: []
623
636
  },
624
637
  form: {},
625
638
  formDefault: {},
639
+ getPlaceholder: (s, l = "请输入") => s.text?.search?.placeholder === void 0 ? `${l}${s.label}` : s.text?.search?.placeholder,
626
640
  getFormData: () => {
627
641
  let s = {};
628
- i.option.column.forEach((o) => {
642
+ r.option.column.forEach((o) => {
629
643
  (typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (s[o.key] = e.search.form[o.key]);
630
644
  });
631
- const l = i.option.search?.before?.(s);
645
+ const l = r.option.search?.before?.(s);
632
646
  return l && (s = l), s;
633
647
  },
634
648
  reset: () => {
635
649
  const s = e.search.formDefault;
636
650
  Object.keys(s).forEach((l) => {
637
- i.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
651
+ r.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
638
652
  }), e.search.form = JSONUtil.cp(s), e.page.num = 1, e.table.getList();
639
653
  },
640
654
  submit: () => {
@@ -642,11 +656,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
642
656
  }
643
657
  },
644
658
  page: {
645
- size: i.option.page?.size || 10,
646
- sizeList: i.option.page?.sizeList || [10, 20, 50, 100],
659
+ size: r.option.page?.size || 10,
660
+ sizeList: r.option.page?.sizeList || [10, 20, 50, 100],
647
661
  num: 1,
648
662
  total: 0,
649
- layout: i.option.page?.layout || "total, sizes, prev, pager, next, jumper"
663
+ layout: r.option.page?.layout || "total, sizes, prev, pager, next, jumper"
650
664
  },
651
665
  table: {
652
666
  loading: !1,
@@ -692,16 +706,20 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
692
706
  },
693
707
  getList: async () => {
694
708
  e.table.loading = !0;
695
- const s = i.option.api.list, l = await s({
696
- size: e.page.size,
697
- num: e.page.num,
698
- ...e.search.getFormData(),
699
- final(a, h, $) {
700
- e.table.loading = !1;
701
- }
702
- }), o = l.data || { list: l };
703
- let t = Array.isArray(o.list) ? o.list : o;
704
- e.table.data = i.option.data ? await i.option.data(t) : t, e.page.total = o.total || 0;
709
+ const s = r.option.api.list;
710
+ try {
711
+ const l = await s({
712
+ [S.pageField.size]: e.page.size,
713
+ [S.pageField.num]: e.page.num,
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);
720
+ } finally {
721
+ e.table.loading = !1;
722
+ }
705
723
  },
706
724
  selection: {
707
725
  list: [],
@@ -711,11 +729,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
711
729
  },
712
730
  exportFun: {
713
731
  start: async (s) => {
714
- let l = await e.table.exportFun[s](), o = i.option.column;
732
+ let l = await e.table.exportFun[s](), o = r.option.column;
715
733
  const t = JSONUtil.cp({
716
734
  data: l,
717
735
  columns: o
718
- }), a = i.option.tools?.export || {};
736
+ }), a = r.option.tools?.export || {};
719
737
  a.before && a.before(t), we.exportToExcel(t.data, t.columns, a.fileName);
720
738
  },
721
739
  select: () => {
@@ -730,14 +748,18 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
730
748
  },
731
749
  all: async () => {
732
750
  e.table.loading = !0;
733
- const s = i.option.api.list, { data: l } = await s({
734
- size: 999999,
735
- num: 1,
736
- final(o, t, a) {
737
- e.table.loading = !1;
738
- }
739
- });
740
- return l.list;
751
+ const s = r.option.api.list;
752
+ try {
753
+ const { data: l } = await s({
754
+ [S.pageField.size]: 999999,
755
+ [S.pageField.num]: 1
756
+ });
757
+ return l[S.resultField.list];
758
+ } catch (l) {
759
+ console.error(l);
760
+ } finally {
761
+ e.table.loading = !1;
762
+ }
741
763
  }
742
764
  },
743
765
  export: (s) => {
@@ -750,11 +772,11 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
750
772
  show: !1,
751
773
  showContent: !1,
752
774
  loading: !1,
753
- type: r.Insert,
775
+ type: i.Insert,
754
776
  form: {},
755
777
  formDefault: {},
756
778
  formColumn: [],
757
- getDisabled: (s) => s.disabled?.[e.update.type === r.Insert ? "create" : "update"],
779
+ getDisabled: (s) => s.disabled?.[e.update.type === i.Insert ? "create" : "update"],
758
780
  edit: {
759
781
  /**
760
782
  * 编辑原数据
@@ -764,7 +786,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
764
786
  * 将form填入数据和data比对差异数据返回
765
787
  */
766
788
  getApiData: (s) => {
767
- if (i.option.form?.editAll)
789
+ if (r.option.form?.editAll)
768
790
  return s;
769
791
  let l = {
770
792
  _id: e.update.edit.data._id
@@ -777,28 +799,32 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
777
799
  open: (s, l) => {
778
800
  e.update.showContent || FunUtil.throttle(async () => {
779
801
  e.update.type = s;
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 i.option.form?.openBefore?.(l, e.update), e.update.show = !0, e.update.showContent = !0, i.option.form?.openAfter?.(l, e.update);
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);
782
804
  });
783
805
  },
784
806
  submit: () => {
785
807
  FunUtil.throttle(async () => {
786
- await f.value?.validate(async (o, t) => new Promise((a, h) => {
787
- o || (D.fail("请检查表单数据"), h(!1)), a();
808
+ await m.value?.validate(async (o, t) => new Promise((a, b) => {
809
+ o || (D.fail("请检查表单数据"), b(!1)), a();
788
810
  })), e.update.loading = !0;
789
- const s = e.update.type === r.Insert ? i.option.api.create : i.option.api.update;
811
+ const s = e.update.type === i.Insert ? r.option.api.create : r.option.api.update;
790
812
  let l = JSONUtil.cp(e.update.form);
791
- delete l.children, await i.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
813
+ delete l.children, await r.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
792
814
  if (typeof l[o] == "string" && l[o].indexOf("T") > -1) {
793
815
  const t = new Date(l[o]).getTime();
794
816
  !isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (l[o] = t);
795
817
  }
796
- }), await s({
797
- ...l,
798
- final(o, t, a) {
799
- e.update.loading = !1;
800
- }
801
- }), e.update.close(), await e.table.getList(), i.option.form?.submitAfter?.(l, e.update);
818
+ });
819
+ try {
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);
825
+ } finally {
826
+ e.update.loading = !1;
827
+ }
802
828
  });
803
829
  },
804
830
  close: () => {
@@ -824,14 +850,18 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
824
850
  },
825
851
  submit: () => {
826
852
  FunUtil.throttle(async () => {
827
- e.table.loading = !0;
828
- const s = i.option.api.delete;
829
- await s({
830
- _id: e.remove.items.map((l) => l._id),
831
- final(l, o, t) {
832
- e.table.loading = !1;
833
- }
834
- }), D.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
853
+ e.remove.loading = !0;
854
+ const s = r.option.api.delete;
855
+ try {
856
+ await s({
857
+ _id: e.remove.items.map((l) => l._id),
858
+ items: e.remove.items
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);
862
+ } finally {
863
+ e.remove.loading = !1;
864
+ }
835
865
  });
836
866
  }
837
867
  },
@@ -857,7 +887,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
857
887
  emptyText: "暂无数据",
858
888
  highlightCurrentRow: !0
859
889
  }
860
- }, o = i.option;
890
+ }, o = r.option;
861
891
  Object.keys(l).forEach((t) => {
862
892
  o[t] = ObjectUtil.deepMerge(l[t], o[t] || {});
863
893
  });
@@ -868,7 +898,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
868
898
  * @returns
869
899
  */
870
900
  initColumnOptions: () => {
871
- const s = i.option, l = (o) => {
901
+ const s = r.option, l = (o) => {
872
902
  const a = {
873
903
  options: {
874
904
  switch: {
@@ -876,19 +906,26 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
876
906
  activeLabel: "开启",
877
907
  inactiveValue: !1,
878
908
  inactiveLabel: "关闭",
879
- tableBeforeChange: async ($, y) => {
909
+ tableBeforeChange: async (F, y) => {
880
910
  const E = o.options?.switch;
881
911
  try {
882
- return await c.value?.open({
912
+ await p.value?.open({
883
913
  title: "确认修改",
884
- content: `确认要${y[$] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
885
- }), e.table.loading = !0, await i.option.api.update({
886
- _id: y._id,
887
- [$]: y[$] === E.activeValue ? E.inactiveValue : E.activeValue,
888
- final(R, z, Y) {
889
- e.table.loading = !1;
890
- }
891
- }), D.success("操作成功"), e.table.getList(), !0;
914
+ content: `确认要${y[F] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
915
+ }), e.table.loading = !0;
916
+ try {
917
+ return await r.option.api.update({
918
+ _id: y._id,
919
+ [F]: y[F] === E.activeValue ? E.inactiveValue : E.activeValue,
920
+ final(z, M, Y) {
921
+ e.table.loading = !1;
922
+ }
923
+ }), e.table.loading = !1, D.success("操作成功"), e.table.getList(), !0;
924
+ } catch (z) {
925
+ return console.error(z), !1;
926
+ } finally {
927
+ e.table.loading = !1;
928
+ }
892
929
  } catch {
893
930
  return !1;
894
931
  }
@@ -923,37 +960,37 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
923
960
  table: 0,
924
961
  form: 0
925
962
  }
926
- }, h = o;
927
- Object.keys(a).forEach(($) => {
928
- h[$] = ObjectUtil.deepMerge(a[$], h[$] || {});
963
+ }, b = o;
964
+ Object.keys(a).forEach((F) => {
965
+ b[F] = ObjectUtil.deepMerge(a[F], b[F] || {});
929
966
  });
930
967
  };
931
968
  s.column.forEach(l), s.table?.column?.forEach(l);
932
969
  },
933
970
  initColumnForm: () => {
934
- const s = i.option;
971
+ const s = r.option;
935
972
  e.update.formColumn = [], e.table.column.show = {
936
973
  list: [],
937
974
  listSource: []
938
975
  };
939
- const l = [], o = i.option.form?.maxSpan || 12, t = i.option.form?.defaultSpan || o / 2;
976
+ const l = [], o = r.option.form?.maxSpan || 12, t = r.option.form?.defaultSpan || o / 2;
940
977
  let a = [];
941
- const h = (y) => {
978
+ const b = (y) => {
942
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) {
943
980
  y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
944
- let E = y.form.span, R = a.reduce((Y, ae) => Y + ae.span, E);
945
- const z = a.length;
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);
981
+ let E = y.form.span, z = a.reduce((Y, ae) => Y + ae.span, E);
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);
947
984
  }
948
985
  };
949
986
  s.column.forEach((y) => {
950
- y.isForm = !0, h(y);
951
- }), i.option.table?.column?.forEach((y) => {
952
- y.isForm = !1, h(y);
987
+ y.isForm = !0, b(y);
988
+ }), r.option.table?.column?.forEach((y) => {
989
+ y.isForm = !1, b(y);
953
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;
954
- const $ = i.option.search?.formDefault;
955
- $ && Object.keys($).forEach((y) => {
956
- e.search.formDefault[y] = $[y];
991
+ const F = r.option.search?.formDefault;
992
+ F && Object.keys(F).forEach((y) => {
993
+ e.search.formDefault[y] = F[y];
957
994
  }), s.column.forEach((y) => {
958
995
  y.show?.search || (e.search.formDefault[y.key] = void 0);
959
996
  }), e.search.form = JSONUtil.cp(e.search.formDefault);
@@ -964,171 +1001,174 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
964
1001
  }), d({
965
1002
  conf: e
966
1003
  }), (s, l) => {
967
- const o = ie("loading");
968
- return p(), w("div", Ce, [
1004
+ const o = re("loading");
1005
+ return c(), w("div", Ce, [
969
1006
  x("div", Ve, [
970
- k(s.$slots, "box-left"),
971
- x("div", Ue, [
972
- m.option.search?.show !== !1 ? (p(), w("div", De, [
973
- v(u(A), {
1007
+ v(s.$slots, "box-left"),
1008
+ x("div", xe, [
1009
+ f.option.search?.show !== !1 ? (c(), w("div", Ue, [
1010
+ C(u(K), {
974
1011
  model: e.search.form,
975
1012
  inline: ""
976
1013
  }, {
977
- default: b(() => [
978
- k(s.$slots, "search-start", {
1014
+ default: h(() => [
1015
+ v(s.$slots, "search-start", {
979
1016
  row: e.search.form
980
1017
  }),
981
- (p(!0), w(O, null, I(e.search.column.list, (t) => (p(), w(O, {
1018
+ (c(!0), w($, null, L(e.search.column.list, (t) => (c(), w($, {
982
1019
  key: t.key
983
1020
  }, [
984
- (typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (p(), g(u(_), {
1021
+ (typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (c(), g(u(P), {
985
1022
  key: 0,
986
- label: t.label
1023
+ label: typeof t.text?.search?.label == "string" ? t.text?.search?.label : t.label,
1024
+ class: T({
1025
+ "hide-label": typeof t.text?.search?.label == "boolean" ? !t.text?.search?.label : !1
1026
+ })
987
1027
  }, {
988
- default: b(() => [
989
- k(s.$slots, "search-" + t.key, {
1028
+ default: h(() => [
1029
+ v(s.$slots, "search-" + t.key, {
990
1030
  row: e.search.form
991
1031
  }, () => [
992
- t.type === "input" ? (p(), g(u(K), {
1032
+ t.type === "input" ? (c(), g(u(H), {
993
1033
  key: 0,
994
1034
  modelValue: e.search.form[t.key],
995
1035
  "onUpdate:modelValue": (a) => e.search.form[t.key] = a,
996
- placeholder: `请输入${t.label}`,
1036
+ placeholder: e.search.getPlaceholder(t),
997
1037
  clearable: "",
998
1038
  disabled: t.disabled?.search
999
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (p(), g(u(N), {
1039
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (c(), g(u(B), {
1000
1040
  key: 1,
1001
1041
  modelValue: e.search.form[t.key],
1002
1042
  "onUpdate:modelValue": (a) => e.search.form[t.key] = a,
1003
- placeholder: `请选择${t.label}`,
1043
+ placeholder: e.search.getPlaceholder(t, "请选择"),
1004
1044
  clearable: "",
1005
1045
  disabled: t.disabled?.search
1006
1046
  }, {
1007
- default: b(() => [
1008
- (p(), g(u(M), {
1047
+ default: h(() => [
1048
+ (c(), g(u(N), {
1009
1049
  key: t.options?.switch?.activeValue,
1010
1050
  label: t.options?.switch?.activeLabel,
1011
1051
  value: t.options?.switch?.activeValue
1012
1052
  }, null, 8, ["label", "value"])),
1013
- (p(), g(u(M), {
1053
+ (c(), g(u(N), {
1014
1054
  key: t.options?.switch?.inactiveValue,
1015
1055
  label: t.options?.switch?.inactiveLabel,
1016
1056
  value: t.options?.switch?.inactiveValue
1017
1057
  }, null, 8, ["label", "value"]))
1018
1058
  ]),
1019
1059
  _: 2
1020
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (p(), g(u(N), {
1060
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (c(), g(u(B), {
1021
1061
  key: 2,
1022
1062
  modelValue: e.search.form[t.key],
1023
1063
  "onUpdate:modelValue": (a) => e.search.form[t.key] = a,
1024
- placeholder: `请选择${t.label}`,
1064
+ placeholder: e.search.getPlaceholder(t, "请选择"),
1025
1065
  clearable: "",
1026
1066
  disabled: t.disabled?.search
1027
1067
  }, {
1028
- default: b(() => [
1029
- (p(!0), w(O, null, I(t.options?.select?.data, (a) => (p(), g(u(M), {
1068
+ default: h(() => [
1069
+ (c(!0), w($, null, L(t.options?.select?.data, (a) => (c(), g(u(N), {
1030
1070
  key: a.value,
1031
1071
  label: a.label,
1032
1072
  value: a.value
1033
1073
  }, null, 8, ["label", "value"]))), 128))
1034
1074
  ]),
1035
1075
  _: 2
1036
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : C("", !0)
1076
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : k("", !0)
1037
1077
  ])
1038
1078
  ]),
1039
1079
  _: 2
1040
- }, 1032, ["label"])) : C("", !0)
1080
+ }, 1032, ["label", "class"])) : k("", !0)
1041
1081
  ], 64))), 128)),
1042
- k(s.$slots, "search-center", {
1082
+ v(s.$slots, "search-center", {
1043
1083
  row: e.search.form
1044
1084
  }),
1045
- v(u(_), null, {
1046
- default: b(() => [
1047
- m.option.tools?.search ? (p(), g(u(S), {
1085
+ C(u(P), null, {
1086
+ default: h(() => [
1087
+ f.option.tools?.search ? (c(), g(u(O), {
1048
1088
  key: 0,
1049
1089
  type: "primary",
1050
1090
  onClick: e.search.submit
1051
1091
  }, {
1052
- default: b(() => [...l[7] || (l[7] = [
1092
+ default: h(() => [...l[8] || (l[8] = [
1053
1093
  V(" 搜索 ", -1)
1054
1094
  ])]),
1055
1095
  _: 1
1056
- }, 8, ["onClick"])) : C("", !0),
1057
- m.option.tools?.reset ? (p(), g(u(S), {
1096
+ }, 8, ["onClick"])) : k("", !0),
1097
+ f.option.tools?.reset ? (c(), g(u(O), {
1058
1098
  key: 1,
1059
1099
  onClick: e.search.reset
1060
1100
  }, {
1061
- default: b(() => [...l[8] || (l[8] = [
1101
+ default: h(() => [...l[9] || (l[9] = [
1062
1102
  V("重置", -1)
1063
1103
  ])]),
1064
1104
  _: 1
1065
- }, 8, ["onClick"])) : C("", !0)
1105
+ }, 8, ["onClick"])) : k("", !0)
1066
1106
  ]),
1067
1107
  _: 1
1068
1108
  }),
1069
- k(s.$slots, "search-end", {
1109
+ v(s.$slots, "search-end", {
1070
1110
  row: e.search.form
1071
1111
  })
1072
1112
  ]),
1073
1113
  _: 3
1074
1114
  }, 8, ["model"])
1075
- ])) : C("", !0),
1076
- x("div", Ee, [
1077
- x("div", xe, [
1078
- u(n)(m.option.tools?.add) ? (p(), w("div", $e, [
1079
- v(u(S), {
1115
+ ])) : k("", !0),
1116
+ x("div", De, [
1117
+ x("div", Ee, [
1118
+ u(n)(f.option.tools?.add) ? (c(), w("div", $e, [
1119
+ C(u(O), {
1080
1120
  type: "primary",
1081
- onClick: l[0] || (l[0] = (t) => e.update.open(u(r).Insert))
1121
+ onClick: l[0] || (l[0] = (t) => e.update.open(u(i).Insert))
1082
1122
  }, {
1083
- default: b(() => [...l[9] || (l[9] = [
1123
+ default: h(() => [...l[10] || (l[10] = [
1084
1124
  V("新增", -1)
1085
1125
  ])]),
1086
1126
  _: 1
1087
1127
  })
1088
- ])) : C("", !0),
1089
- m.option.table?.selectable && u(n)(m.option.tools?.delete) ? (p(), w("div", Oe, [
1090
- v(u(S), {
1128
+ ])) : k("", !0),
1129
+ f.option.table?.selectable && u(n)(f.option.tools?.delete) ? (c(), w("div", Fe, [
1130
+ C(u(O), {
1091
1131
  type: "danger",
1092
1132
  onClick: l[1] || (l[1] = (t) => e.remove.open(e.table.selection.list))
1093
1133
  }, {
1094
- default: b(() => [...l[10] || (l[10] = [
1134
+ default: h(() => [...l[11] || (l[11] = [
1095
1135
  V(" 删除 ", -1)
1096
1136
  ])]),
1097
1137
  _: 1
1098
1138
  })
1099
- ])) : C("", !0),
1100
- m.option.tools?.expand ? (p(), w("div", Se, [
1101
- v(u(S), {
1139
+ ])) : k("", !0),
1140
+ f.option.tools?.expand ? (c(), w("div", Oe, [
1141
+ C(u(O), {
1102
1142
  type: "warning",
1103
1143
  onClick: l[2] || (l[2] = (t) => e.table.expand.all())
1104
1144
  }, {
1105
- default: b(() => [...l[11] || (l[11] = [
1145
+ default: h(() => [...l[12] || (l[12] = [
1106
1146
  V("展开/收缩", -1)
1107
1147
  ])]),
1108
1148
  _: 1
1109
1149
  })
1110
- ])) : C("", !0),
1111
- m.option.tools?.export?.show ? (p(), g(u(pe), {
1150
+ ])) : k("", !0),
1151
+ f.option.tools?.export?.show ? (c(), g(u(ce), {
1112
1152
  key: 3,
1113
1153
  onCommand: e.table.export
1114
1154
  }, {
1115
- dropdown: b(() => [
1116
- v(u(ce), null, {
1117
- default: b(() => [
1118
- v(u(B), { command: "select" }, {
1119
- default: b(() => [...l[13] || (l[13] = [
1155
+ dropdown: h(() => [
1156
+ C(u(pe), null, {
1157
+ default: h(() => [
1158
+ C(u(A), { command: "select" }, {
1159
+ default: h(() => [...l[14] || (l[14] = [
1120
1160
  V("导出选中", -1)
1121
1161
  ])]),
1122
1162
  _: 1
1123
1163
  }),
1124
- v(u(B), { command: "page" }, {
1125
- default: b(() => [...l[14] || (l[14] = [
1164
+ C(u(A), { command: "page" }, {
1165
+ default: h(() => [...l[15] || (l[15] = [
1126
1166
  V("导出本页", -1)
1127
1167
  ])]),
1128
1168
  _: 1
1129
1169
  }),
1130
- v(u(B), { command: "all" }, {
1131
- default: b(() => [...l[15] || (l[15] = [
1170
+ C(u(A), { command: "all" }, {
1171
+ default: h(() => [...l[16] || (l[16] = [
1132
1172
  V("导出全部", -1)
1133
1173
  ])]),
1134
1174
  _: 1
@@ -1137,10 +1177,10 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1137
1177
  _: 1
1138
1178
  })
1139
1179
  ]),
1140
- default: b(() => [
1141
- x("div", Fe, [
1142
- v(u(S), { type: "warning" }, {
1143
- default: b(() => [...l[12] || (l[12] = [
1180
+ default: h(() => [
1181
+ x("div", Se, [
1182
+ C(u(O), { type: "warning" }, {
1183
+ default: h(() => [...l[13] || (l[13] = [
1144
1184
  V("导出", -1)
1145
1185
  ])]),
1146
1186
  _: 1
@@ -1148,101 +1188,117 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1148
1188
  ])
1149
1189
  ]),
1150
1190
  _: 1
1151
- }, 8, ["onCommand"])) : C("", !0),
1152
- k(s.$slots, "tools-left")
1191
+ }, 8, ["onCommand"])) : k("", !0),
1192
+ v(s.$slots, "tools-left")
1153
1193
  ]),
1154
1194
  x("div", Ie, [
1155
- k(s.$slots, "tools-right")
1195
+ v(s.$slots, "tools-right"),
1196
+ f.option.tools?.refresh === void 0 || f.option.tools?.refresh ? (c(), w("div", {
1197
+ key: 0,
1198
+ class: "refresh-btn",
1199
+ onClick: l[3] || (l[3] = //@ts-ignore
1200
+ (...t) => e.table.getList && e.table.getList(...t))
1201
+ }, [...l[17] || (l[17] = [
1202
+ x("svg", {
1203
+ xmlns: "http://www.w3.org/2000/svg",
1204
+ viewBox: "0 0 1024 1024"
1205
+ }, [
1206
+ x("path", {
1207
+ fill: "currentColor",
1208
+ d: "M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"
1209
+ })
1210
+ ], -1)
1211
+ ])])) : k("", !0)
1156
1212
  ])
1157
1213
  ]),
1158
- x("div", je, [
1159
- x("div", Le, [
1160
- re((p(), g(u(fe), U({
1214
+ x("div", Le, [
1215
+ x("div", je, [
1216
+ ie((c(), g(u(fe), U({
1161
1217
  data: e.table.data
1162
- }, m.option.table, {
1218
+ }, f.option.table, {
1163
1219
  onSelectionChange: e.table.selection.change,
1164
1220
  "expand-row-keys": e.table.expand.rowKeys,
1165
1221
  onExpandChange: e.table.expand.change
1166
1222
  }), {
1167
- default: b(() => [
1168
- m.option.table?.selectable && u(n)(m.option.tools?.delete) ? (p(), g(u(J), {
1223
+ default: h(() => [
1224
+ f.option.table?.selectable && u(n)(f.option.tools?.delete) ? (c(), g(u(W), {
1169
1225
  key: 0,
1170
1226
  type: "selection",
1171
- selectable: typeof m.option.table?.selectable == "function" ? m.option.table?.selectable : void 0,
1227
+ selectable: typeof f.option.table?.selectable == "function" ? f.option.table?.selectable : void 0,
1172
1228
  width: "55"
1173
- }, null, 8, ["selectable"])) : C("", !0),
1174
- (p(!0), w(O, null, I(e.table.column.list, (t) => (p(), w(O, {
1229
+ }, null, 8, ["selectable"])) : k("", !0),
1230
+ (c(!0), w($, null, L(e.table.column.list, (t) => (c(), w($, {
1175
1231
  key: t.key
1176
1232
  }, [
1177
- e.table.column.show.list.includes(t.key) ? (p(), g(u(J), U({
1233
+ e.table.column.show.list.includes(t.key) ? (c(), g(u(W), U({
1178
1234
  key: 0,
1179
1235
  prop: t.key,
1180
1236
  label: t.label
1181
1237
  }, { ref_for: !0 }, t.table), {
1182
- default: b(({ row: a }) => [
1183
- k(s.$slots, "table-" + t.key, {
1238
+ default: h(({ row: a }) => [
1239
+ v(s.$slots, "table-" + t.key, {
1184
1240
  row: a,
1185
1241
  item: t
1186
1242
  }, () => [
1187
- t.type === "switch" ? (p(), g(u(H), U({
1243
+ t.type === "switch" ? (c(), g(u(G), U({
1188
1244
  key: 0,
1189
1245
  modelValue: a[t.key],
1190
- "onUpdate:modelValue": (h) => a[t.key] = h,
1246
+ "onUpdate:modelValue": (b) => a[t.key] = b,
1191
1247
  "before-change": () => t.options?.switch?.tableBeforeChange?.(t.key, a)
1192
- }, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (p(), w(O, { key: 1 }, [
1193
- V(W(a[t.key]), 1)
1248
+ }, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (c(), w($, { key: 1 }, [
1249
+ V(_(a[t.key]), 1)
1194
1250
  ], 64))
1195
1251
  ])
1196
1252
  ]),
1197
1253
  _: 2
1198
- }, 1040, ["prop", "label"])) : C("", !0)
1254
+ }, 1040, ["prop", "label"])) : k("", !0)
1199
1255
  ], 64))), 128)),
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), {
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), {
1201
1257
  key: 1,
1202
1258
  label: "操作",
1203
1259
  width: "180",
1204
1260
  align: "center",
1205
1261
  fixed: "right"
1206
1262
  }, {
1207
- default: b(({ row: t }) => [
1208
- k(s.$slots, "table-op-left", { row: t }),
1209
- u(n)(m.option.tools?.add, t) ? (p(), g(u(S), {
1263
+ default: h(({ row: t }) => [
1264
+ v(s.$slots, "table-op-left", { row: t }),
1265
+ u(n)(f.option.tools?.add, t) ? (c(), g(u(O), {
1210
1266
  key: 0,
1211
1267
  link: "",
1212
1268
  type: "primary",
1213
- onClick: (a) => e.update.open(u(r).Insert, t)
1269
+ onClick: (a) => e.update.open(u(i).Insert, t)
1214
1270
  }, {
1215
- default: b(() => [...l[16] || (l[16] = [
1271
+ default: h(() => [...l[18] || (l[18] = [
1216
1272
  V(" 新增 ", -1)
1217
1273
  ])]),
1218
1274
  _: 1
1219
- }, 8, ["onClick"])) : C("", !0),
1220
- u(n)(m.option.tools?.update, t) ? (p(), g(u(S), {
1275
+ }, 8, ["onClick"])) : k("", !0),
1276
+ u(n)(f.option.tools?.update, t) ? (c(), g(u(O), {
1221
1277
  key: 1,
1222
1278
  link: "",
1223
1279
  type: "warning",
1224
- onClick: (a) => e.update.open(u(r).Update, t)
1280
+ onClick: (a) => e.update.open(u(i).Update, t)
1225
1281
  }, {
1226
- default: b(() => [...l[17] || (l[17] = [
1282
+ default: h(() => [...l[19] || (l[19] = [
1227
1283
  V(" 编辑 ", -1)
1228
1284
  ])]),
1229
1285
  _: 1
1230
- }, 8, ["onClick"])) : C("", !0),
1231
- u(n)(m.option.tools?.delete, t) ? (p(), g(u(S), {
1286
+ }, 8, ["onClick"])) : k("", !0),
1287
+ u(n)(f.option.tools?.delete, t) ? (c(), g(u(O), {
1232
1288
  key: 2,
1233
1289
  link: "",
1234
1290
  type: "danger",
1235
1291
  onClick: (a) => e.remove.open([t])
1236
1292
  }, {
1237
- default: b(() => [...l[18] || (l[18] = [
1293
+ default: h(() => [...l[20] || (l[20] = [
1238
1294
  V(" 删除 ", -1)
1239
1295
  ])]),
1240
1296
  _: 1
1241
- }, 8, ["onClick"])) : C("", !0),
1242
- k(s.$slots, "table-op-right", { row: t })
1297
+ }, 8, ["onClick"])) : k("", !0),
1298
+ v(s.$slots, "table-op-right", { row: t })
1243
1299
  ]),
1244
1300
  _: 3
1245
- })) : C("", !0)
1301
+ })) : k("", !0)
1246
1302
  ]),
1247
1303
  _: 3
1248
1304
  }, 16, ["data", "onSelectionChange", "expand-row-keys", "onExpandChange"])), [
@@ -1250,13 +1306,13 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1250
1306
  ])
1251
1307
  ])
1252
1308
  ]),
1253
- x("div", Te, [
1254
- e.page.total > e.page.size ? (p(), g(u(me), {
1309
+ x("div", ze, [
1310
+ e.page.total > e.page.size ? (c(), g(u(me), {
1255
1311
  key: 0,
1256
1312
  "current-page": e.page.num,
1257
- "onUpdate:currentPage": l[3] || (l[3] = (t) => e.page.num = t),
1313
+ "onUpdate:currentPage": l[4] || (l[4] = (t) => e.page.num = t),
1258
1314
  "page-size": e.page.size,
1259
- "onUpdate:pageSize": l[4] || (l[4] = (t) => e.page.size = t),
1315
+ "onUpdate:pageSize": l[5] || (l[5] = (t) => e.page.size = t),
1260
1316
  background: "",
1261
1317
  "page-sizes": e.page.sizeList,
1262
1318
  "pager-count": 7,
@@ -1264,186 +1320,199 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
1264
1320
  total: e.page.total,
1265
1321
  onSizeChange: e.table.getList,
1266
1322
  onCurrentChange: e.table.getList
1267
- }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total", "onSizeChange", "onCurrentChange"])) : C("", !0)
1323
+ }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total", "onSizeChange", "onCurrentChange"])) : k("", !0)
1268
1324
  ])
1269
1325
  ]),
1270
- k(s.$slots, "box-right")
1326
+ v(s.$slots, "box-right")
1271
1327
  ]),
1272
- v(u(G), U({
1328
+ C(u(q), U({
1273
1329
  modelValue: e.update.show,
1274
- "onUpdate:modelValue": l[5] || (l[5] = (t) => e.update.show = t),
1330
+ "onUpdate:modelValue": l[6] || (l[6] = (t) => e.update.show = t),
1275
1331
  title: e.update.title,
1276
1332
  "close-on-click-modal": !1,
1277
1333
  "before-close": e.update.close
1278
- }, m.option.dialog), {
1279
- footer: b(() => [
1280
- x("span", _e, [
1281
- v(u(S), {
1334
+ }, f.option.dialog), {
1335
+ footer: h(() => [
1336
+ x("span", Me, [
1337
+ C(u(O), {
1282
1338
  onClick: e.update.close
1283
1339
  }, {
1284
- default: b(() => [...l[19] || (l[19] = [
1340
+ default: h(() => [...l[21] || (l[21] = [
1285
1341
  V("关闭", -1)
1286
1342
  ])]),
1287
1343
  _: 1
1288
1344
  }, 8, ["onClick"]),
1289
- v(u(S), {
1345
+ C(u(O), {
1290
1346
  type: "primary",
1291
1347
  onClick: e.update.submit,
1292
1348
  loading: e.update.loading
1293
1349
  }, {
1294
- default: b(() => [...l[20] || (l[20] = [
1350
+ default: h(() => [...l[22] || (l[22] = [
1295
1351
  V(" 提交 ", -1)
1296
1352
  ])]),
1297
1353
  _: 1
1298
1354
  }, 8, ["onClick", "loading"])
1299
1355
  ])
1300
1356
  ]),
1301
- default: b(() => [
1302
- v(u(A), {
1357
+ default: h(() => [
1358
+ C(u(K), {
1303
1359
  ref_key: "ruleFormRef",
1304
- ref: f,
1360
+ ref: m,
1305
1361
  model: e.update.form,
1306
1362
  rules: e.update.rules
1307
1363
  }, {
1308
- default: b(() => [
1309
- e.update.showContent ? (p(!0), w(O, { key: 0 }, I(e.update.formColumn, (t) => (p(), w("div", Re, [
1310
- k(s.$slots, "form-start", {
1311
- row: e.update.form
1312
- }),
1313
- (p(!0), w(O, null, I(t, (a) => (p(), w(O, null, [
1314
- u(n)(a.item.show?.form, e.update.form) ? (p(), w("div", {
1315
- key: 0,
1316
- class: X(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
1317
- }, [
1318
- v(u(_), {
1319
- label: a.item.label,
1320
- prop: a.item.key,
1321
- "label-width": a.item.form?.labelWidth || "100px"
1322
- }, {
1323
- default: b(() => [
1324
- x("div", ze, [
1325
- k(s.$slots, "form-" + a.item.key + "-start", {
1326
- row: e.update.form,
1327
- item: a.item
1328
- }),
1329
- x("div", Me, [
1330
- k(s.$slots, "form-" + a.item.key, {
1364
+ default: h(() => [
1365
+ e.update.showContent ? (c(!0), w($, { key: 0 }, L(e.update.formColumn, (t) => (c(), w($, null, [
1366
+ u(n)(
1367
+ t.map((a) => a.item.show?.form),
1368
+ e.update.form
1369
+ ) ? (c(), w("div", {
1370
+ key: 0,
1371
+ class: T(["row curd-row", {
1372
+ stripe: f.option.form?.stripe === void 0 ? !0 : f.option.form?.stripe
1373
+ }])
1374
+ }, [
1375
+ v(s.$slots, "form-start", {
1376
+ row: e.update.form
1377
+ }),
1378
+ (c(!0), w($, null, L(t, (a) => (c(), w($, null, [
1379
+ u(n)(a.item.show?.form, e.update.form) ? (c(), w("div", {
1380
+ key: 0,
1381
+ class: T(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
1382
+ }, [
1383
+ C(u(P), {
1384
+ class: T({
1385
+ "hide-label": typeof a.item.text?.form?.label == "boolean" ? !a.item.text?.form?.label : !1
1386
+ }),
1387
+ label: typeof a.item.text?.form?.label == "string" ? a.item.text?.form?.label : a.item.label,
1388
+ prop: a.item.key,
1389
+ "label-width": a.item.form?.labelWidth || "100px"
1390
+ }, {
1391
+ default: h(() => [
1392
+ x("div", Te, [
1393
+ v(s.$slots, "form-" + a.item.key + "-start", {
1331
1394
  row: e.update.form,
1332
1395
  item: a.item
1333
- }, () => [
1334
- a.item.type === "input" ? (p(), g(u(K), U({
1335
- key: 0,
1336
- modelValue: e.update.form[a.item.key],
1337
- "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1338
- }, { ref_for: !0 }, a.item.options?.input, F(a.item.options?.input?.on || {}), {
1339
- disabled: e.update.getDisabled(a.item)
1340
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "switch" ? (p(), g(u(H), U({
1341
- key: 1,
1342
- modelValue: e.update.form[a.item.key],
1343
- "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1344
- }, { ref_for: !0 }, a.item.options?.switch, {
1345
- disabled: e.update.getDisabled(a.item)
1346
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (p(), g(u(N), U({
1347
- key: 2,
1348
- modelValue: e.update.form[a.item.key],
1349
- "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1350
- }, { ref_for: !0 }, a.item.options?.select, F(a.item.options?.select?.on || {}), {
1351
- disabled: e.update.getDisabled(a.item),
1352
- style: { width: "100%" }
1353
- }), {
1354
- default: b(() => [
1355
- (p(!0), w(O, null, I(a.item.options?.select?.data, (h) => (p(), g(u(M), {
1356
- key: h.value,
1357
- label: h.label,
1358
- value: h.value
1359
- }, null, 8, ["label", "value"]))), 128))
1360
- ]),
1361
- _: 2
1362
- }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "list" ? (p(), g(Q, U({
1363
- key: 3,
1396
+ }),
1397
+ x("div", Re, [
1398
+ v(s.$slots, "form-" + a.item.key, {
1364
1399
  row: e.update.form,
1365
- field: a.item.key
1366
- }, { ref_for: !0 }, a.item.options?.list, F(a.item.options?.list?.on || {}), {
1367
- disabled: e.update.getDisabled(a.item),
1368
- style: { width: "100%" }
1369
- }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (p(), g(u(oe), U({
1370
- key: 4,
1371
- modelValue: e.update.form[a.item.key],
1372
- "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1373
- }, { ref_for: !0 }, a.item.options?.treeSelect, F(a.item.options?.treeSelect?.on || {}), {
1374
- disabled: e.update.getDisabled(a.item),
1375
- style: { width: "100%" }
1376
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (p(), g(u(le), U({
1377
- key: 5,
1378
- modelValue: e.update.form[a.item.key],
1379
- "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1380
- }, { ref_for: !0 }, a.item.options?.datetime, F(a.item.options?.datetime?.on || {}), {
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]), U({
1383
- key: 6,
1384
- modelValue: e.update.form[a.item.key],
1385
- "onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
1386
- }, { ref_for: !0 }, a.item.options?.[a.item.type], F(a.item.options?.[a.item.type]?.on || {}), {
1387
- disabled: e.update.getDisabled(a.item)
1388
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
1389
- ])
1390
- ]),
1391
- k(s.$slots, "form-" + a.item.key + "-end", {
1392
- row: e.update.form,
1393
- item: a.item
1394
- })
1395
- ])
1396
- ]),
1397
- _: 2
1398
- }, 1032, ["label", "prop", "label-width"])
1399
- ], 2)) : C("", !0)
1400
- ], 64))), 256)),
1401
- k(s.$slots, "form-end", {
1402
- row: e.update.form
1403
- })
1404
- ]))), 256)) : C("", !0)
1400
+ item: a.item
1401
+ }, () => [
1402
+ a.item.type === "input" ? (c(), g(u(H), U({
1403
+ key: 0,
1404
+ modelValue: e.update.form[a.item.key],
1405
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1406
+ }, { ref_for: !0 }, a.item.options?.input, I(a.item.options?.input?.on || {}), {
1407
+ disabled: e.update.getDisabled(a.item)
1408
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "switch" ? (c(), g(u(G), U({
1409
+ key: 1,
1410
+ modelValue: e.update.form[a.item.key],
1411
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1412
+ }, { ref_for: !0 }, a.item.options?.switch, {
1413
+ disabled: e.update.getDisabled(a.item)
1414
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (c(), g(u(B), U({
1415
+ key: 2,
1416
+ modelValue: e.update.form[a.item.key],
1417
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1418
+ }, { ref_for: !0 }, a.item.options?.select, I(a.item.options?.select?.on || {}), {
1419
+ disabled: e.update.getDisabled(a.item),
1420
+ style: { width: "100%" }
1421
+ }), {
1422
+ default: h(() => [
1423
+ (c(!0), w($, null, L(a.item.options?.select?.data, (b) => (c(), g(u(N), {
1424
+ key: b.value,
1425
+ label: b.label,
1426
+ value: b.value
1427
+ }, null, 8, ["label", "value"]))), 128))
1428
+ ]),
1429
+ _: 2
1430
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "list" ? (c(), g(Q, U({
1431
+ key: 3,
1432
+ row: e.update.form,
1433
+ field: a.item.key
1434
+ }, { ref_for: !0 }, a.item.options?.list, I(a.item.options?.list?.on || {}), {
1435
+ disabled: e.update.getDisabled(a.item),
1436
+ style: { width: "100%" }
1437
+ }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (c(), g(u(le), U({
1438
+ key: 4,
1439
+ modelValue: e.update.form[a.item.key],
1440
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1441
+ }, { ref_for: !0 }, a.item.options?.treeSelect, I(a.item.options?.treeSelect?.on || {}), {
1442
+ disabled: e.update.getDisabled(a.item),
1443
+ style: { width: "100%" }
1444
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (c(), g(u(oe), U({
1445
+ key: 5,
1446
+ modelValue: e.update.form[a.item.key],
1447
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1448
+ }, { ref_for: !0 }, a.item.options?.datetime, I(a.item.options?.datetime?.on || {}), {
1449
+ disabled: e.update.getDisabled(a.item)
1450
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(S).customComponent[a.item.type] ? (c(), g(te(u(S).customComponent[a.item.type]), U({
1451
+ key: 6,
1452
+ modelValue: e.update.form[a.item.key],
1453
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1454
+ }, { ref_for: !0 }, a.item.options?.[a.item.type], I(a.item.options?.[a.item.type]?.on || {}), {
1455
+ disabled: e.update.getDisabled(a.item)
1456
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : k("", !0)
1457
+ ])
1458
+ ]),
1459
+ v(s.$slots, "form-" + a.item.key + "-end", {
1460
+ row: e.update.form,
1461
+ item: a.item
1462
+ })
1463
+ ])
1464
+ ]),
1465
+ _: 2
1466
+ }, 1032, ["class", "label", "prop", "label-width"])
1467
+ ], 2)) : k("", !0)
1468
+ ], 64))), 256)),
1469
+ v(s.$slots, "form-end", {
1470
+ row: e.update.form
1471
+ })
1472
+ ], 2)) : k("", !0)
1473
+ ], 64))), 256)) : k("", !0)
1405
1474
  ]),
1406
1475
  _: 3
1407
1476
  }, 8, ["model", "rules"])
1408
1477
  ]),
1409
1478
  _: 3
1410
1479
  }, 16, ["modelValue", "title", "before-close"]),
1411
- v(u(G), {
1480
+ C(u(q), {
1412
1481
  modelValue: e.remove.show,
1413
- "onUpdate:modelValue": l[6] || (l[6] = (t) => e.remove.show = t),
1482
+ "onUpdate:modelValue": l[7] || (l[7] = (t) => e.remove.show = t),
1414
1483
  title: e.remove.title,
1415
1484
  "close-on-click-modal": !1
1416
1485
  }, {
1417
- footer: b(() => [
1486
+ footer: h(() => [
1418
1487
  x("span", Ne, [
1419
- v(u(S), {
1488
+ C(u(O), {
1420
1489
  onClick: e.remove.close
1421
1490
  }, {
1422
- default: b(() => [...l[21] || (l[21] = [
1491
+ default: h(() => [...l[23] || (l[23] = [
1423
1492
  V("关闭", -1)
1424
1493
  ])]),
1425
1494
  _: 1
1426
1495
  }, 8, ["onClick"]),
1427
- v(u(S), {
1496
+ C(u(O), {
1428
1497
  type: "danger",
1429
1498
  onClick: e.remove.submit,
1430
1499
  loading: e.remove.loading
1431
1500
  }, {
1432
- default: b(() => [...l[22] || (l[22] = [
1501
+ default: h(() => [...l[24] || (l[24] = [
1433
1502
  V(" 确认删除 ", -1)
1434
1503
  ])]),
1435
1504
  _: 1
1436
1505
  }, 8, ["onClick", "loading"])
1437
1506
  ])
1438
1507
  ]),
1439
- default: b(() => [
1440
- x("div", null, "确认要删除【" + W(e.remove.items.length) + "】条数据吗?", 1)
1508
+ default: h(() => [
1509
+ x("div", null, "确认要删除【" + _(e.remove.items.length) + "】条数据吗?", 1)
1441
1510
  ]),
1442
1511
  _: 1
1443
1512
  }, 8, ["modelValue", "title"]),
1444
- v(ve, {
1513
+ C(ve, {
1445
1514
  ref_key: "switchConfirmRef",
1446
- ref: c
1515
+ ref: p
1447
1516
  }, null, 512)
1448
1517
  ]);
1449
1518
  };
@@ -1453,50 +1522,52 @@ class We {
1453
1522
  /**
1454
1523
  * 通过文件远程地址下载文件
1455
1524
  */
1456
- static async download(d, r = "download.png") {
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);
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);
1459
1528
  }
1460
1529
  /**
1461
1530
  * 将json对象或者json数组导出为json文件保存
1462
1531
  * @param data
1463
1532
  * @param name
1464
1533
  */
1465
- static exportJSONFile = (d, r) => {
1466
- const i = new Blob([JSON.stringify(d)], { type: "application/json" }), c = URL.createObjectURL(i), f = document.createElement("a");
1467
- f.href = c, f.download = `${r || "config"}.json`, f.click();
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();
1468
1537
  };
1469
1538
  /**
1470
1539
  * 导入文件内容,默认为json
1471
1540
  * @param param
1472
1541
  * @returns
1473
1542
  */
1474
- static importFile = async (d) => new Promise((r, i) => {
1475
- const c = document.createElement("input");
1476
- c.type = "file";
1477
- const f = d?.accept || ".json";
1478
- c.accept = f, c.style.display = "none", c.onchange = (n) => {
1543
+ static importFile = async (d) => new Promise((i, r) => {
1544
+ const p = document.createElement("input");
1545
+ p.type = "file";
1546
+ const m = d?.accept || ".json";
1547
+ p.accept = m, p.style.display = "none", p.onchange = (n) => {
1479
1548
  const e = n.target.files[0];
1480
1549
  if (!e) {
1481
- D.fail("未选择文件"), i("未选择文件");
1550
+ D.fail("未选择文件"), r("未选择文件");
1482
1551
  return;
1483
1552
  }
1484
1553
  const s = new FileReader();
1485
1554
  s.onload = async (l) => {
1486
- const o = f == ".json" ? JSON.parse(l.target.result) : l.target.result;
1487
- r(o);
1555
+ const o = m == ".json" ? JSON.parse(l.target.result) : l.target.result;
1556
+ i(o);
1488
1557
  }, s.onerror = () => {
1489
- D.fail("文件读取失败"), i("文件读取失败");
1490
- }, s.readAsText(e), document.body.removeChild(c);
1491
- }, document.body.appendChild(c), c.click();
1558
+ D.fail("文件读取失败"), r("文件读取失败");
1559
+ }, s.readAsText(e), document.body.removeChild(p);
1560
+ }, document.body.appendChild(p), p.click();
1492
1561
  });
1493
1562
  }
1494
- const Ae = (m, d) => {
1495
- if (m.component("TCurd", Pe), m.component("TFormList", Q), m.component("TColumn", ge), d?.customComponent) {
1496
- L.customComponent = d.customComponent;
1497
- for (const r in d.customComponent)
1498
- m.component(r, d.customComponent[r]);
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]);
1499
1568
  }
1569
+ }, _e = {
1570
+ install: Be
1500
1571
  };
1501
1572
  export {
1502
1573
  j as ArrUtil,
@@ -1504,8 +1575,9 @@ export {
1504
1575
  ge as TColumn,
1505
1576
  Pe as TCurd,
1506
1577
  We as TFile,
1507
- L as TForm,
1578
+ S as TForm,
1508
1579
  Q as TFormList,
1509
1580
  D as TSys,
1510
- Ae as install
1581
+ _e as default,
1582
+ Be as install
1511
1583
  };