cc1-form 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cc1-form.js CHANGED
@@ -1,6 +1,6 @@
1
- import { defineComponent as N, ref as j, reactive as q, resolveComponent as W, createBlock as g, openBlock as f, unref as d, withCtx as b, createElementBlock as w, createCommentVNode as C, Fragment as x, renderList as F, renderSlot as k, normalizeClass as X, createVNode as v, mergeProps as D, toHandlers as Y, resolveDynamicComponent as Z, onMounted as ee, createElementVNode as S, createTextVNode as V, normalizeStyle as se, toDisplayString as A, resolveDirective as ne, withDirectives as re } from "vue";
2
- import { ElMessage as ie, ElLoading as de, ElForm as J, ElFormItem as M, ElInput as K, ElSwitch as H, ElSelect as _, ElOption as R, ElTreeSelect as te, ElDatePicker as le, ElDialog as G, ElButton as O, ElDropdown as ue, ElDropdownMenu as fe, ElDropdownItem as P, ElTable as pe, ElTableColumn as B, ElPagination as ce } from "element-plus";
3
- class $ {
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 U, createVNode as v, withCtx as h, createTextVNode as V, Fragment as $, renderList as I, createBlock as g, normalizeClass as X, normalizeStyle as se, ref as z, unref as u, mergeProps as D, toHandlers as F, resolveDynamicComponent as te, toDisplayString as A, resolveDirective as ne, withDirectives as re } from "vue";
2
+ import { ElMessage as ie, ElLoading as de, ElForm as J, 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 ue, ElDropdownMenu as pe, ElDropdownItem as B, ElTable as fe, ElTableColumn as W, ElPagination as ce } from "element-plus";
3
+ class O {
4
4
  /**
5
5
  * 路由
6
6
  */
@@ -24,13 +24,13 @@ class $ {
24
24
  * @param data 数据
25
25
  * @returns 是否显示
26
26
  */
27
- static isFun = (i, r) => typeof i == "function" ? i(r) : i;
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 i = this.router.currentRoute.value.query || {}, r = this.router.currentRoute.value.params || {};
33
- return Object.keys(i).length ? i : 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
  * 模块赋值
@@ -40,11 +40,11 @@ class $ {
40
40
  * 加载模块
41
41
  * @param module
42
42
  */
43
- static loadModule = async (i) => {
44
- if (!$.moduleObj[i])
45
- throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);
46
- const r = await $.moduleObj[i]();
47
- return r.default ?? r;
43
+ static loadModule = async (d) => {
44
+ if (!O.moduleObj[d])
45
+ throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);
46
+ const i = await O.moduleObj[d]();
47
+ return i.default ?? i;
48
48
  };
49
49
  /**
50
50
  * 提示信息对象管理
@@ -60,19 +60,19 @@ class $ {
60
60
  * @param type 消息类型
61
61
  * @param options 其他选项
62
62
  */
63
- static showMessage(i, r, n = {}) {
63
+ static showMessage(d, i, r = {}) {
64
64
  const c = Date.now();
65
- if (!this.tipMessages[i] || c - this.tipMessages[i] > this.tipMessagesGap) {
66
- this.tipMessages[i] = c;
65
+ if (!this.tipMessages[d] || c - this.tipMessages[d] > this.tipMessagesGap) {
66
+ this.tipMessages[d] = c;
67
67
  const m = Object.assign(
68
68
  {
69
- message: i,
70
- type: r
69
+ message: d,
70
+ type: i
71
71
  },
72
- n
72
+ r
73
73
  );
74
74
  ie(m), setTimeout(() => {
75
- delete this.tipMessages[i];
75
+ delete this.tipMessages[d];
76
76
  }, this.tipMessagesGap);
77
77
  }
78
78
  }
@@ -81,16 +81,16 @@ class $ {
81
81
  * @param content
82
82
  * @param options
83
83
  */
84
- static fail = (i, r = {}) => {
85
- this.showMessage(i, "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 = (i, r = {}) => {
93
- this.showMessage(i, "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 $ {
99
99
  * @param show
100
100
  * @param text
101
101
  */
102
- static loading = (i = !0, r = "加载中") => {
102
+ static loading = (d = !0, i = "加载中") => {
103
103
  Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
104
- i ? this.loadingObj = de.service({
104
+ d ? this.loadingObj = de.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,17 +113,17 @@ class $ {
113
113
  * @param url 地址
114
114
  * @param isCenter 是否居中
115
115
  */
116
- static openUrl = (i, r = !0) => {
117
- if (r) {
118
- let n = 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, c = screen.height / 2 - 800 / 2 - 30;
119
119
  window.open(
120
- i,
120
+ d,
121
121
  "_blank",
122
- "toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + c + ", left=" + n
122
+ "toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + c + ", left=" + r
123
123
  );
124
124
  } else
125
125
  window.open(
126
- i,
126
+ d,
127
127
  "DescriptiveWindowName" + StrUtil.getId(),
128
128
  "resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0"
129
129
  );
@@ -133,37 +133,37 @@ class $ {
133
133
  * @param param
134
134
  * @returns
135
135
  */
136
- static getImgPic = (i) => new Promise(async (r, n) => {
137
- let c = document.getElementById(i.id);
138
- const m = await $.loadModule("html2canvas");
136
+ static getImgPic = (d) => new Promise(async (i, r) => {
137
+ let c = document.getElementById(d.id);
138
+ const m = await O.loadModule("html2canvas");
139
139
  try {
140
140
  m(c, {
141
141
  logging: !1,
142
142
  allowTaint: !0,
143
143
  scale: window.devicePixelRatio,
144
- width: i.windowWidth,
145
- height: i.windowHeight,
146
- windowWidth: i.windowWidth,
147
- windowHeight: i.windowHeight,
144
+ width: d.windowWidth,
145
+ height: d.windowHeight,
146
+ windowWidth: d.windowWidth,
147
+ windowHeight: d.windowHeight,
148
148
  useCORS: !0,
149
149
  backgroundColor: "#ffffff00"
150
- }).then(function(s) {
151
- let e = s.toDataURL("image/png");
152
- r(e);
150
+ }).then(function(n) {
151
+ let e = n.toDataURL("image/png");
152
+ i(e);
153
153
  });
154
- } catch (s) {
155
- n(s);
154
+ } catch (n) {
155
+ r(n);
156
156
  }
157
157
  });
158
158
  /**
159
159
  * 下载文件
160
160
  */
161
- static async download(i, r = "download.png") {
162
- const n = document.createElement("a");
163
- n.style.display = "none", n.href = i, n.setAttribute("download", r), typeof n.download > "u" && n.setAttribute("target", "_blank"), document.body.appendChild(n), n.click(), document.body.removeChild(n), window.URL.revokeObjectURL(i);
161
+ static async download(d, i = "download.png") {
162
+ const r = document.createElement("a");
163
+ 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);
164
164
  }
165
165
  }
166
- class L {
166
+ class j {
167
167
  /**
168
168
  * 自定义组件
169
169
  */
@@ -174,10 +174,10 @@ class L {
174
174
  * @param field
175
175
  * @returns
176
176
  */
177
- static findOptions = (i, r) => {
178
- const n = i.column.find((m) => m.key === r), c = (m) => m.replace(/-([a-z])/g, (s, e) => e.toUpperCase());
179
- if (n)
180
- return n.options[c(n.type)];
177
+ static findOptions = (d, i) => {
178
+ const r = d.column.find((m) => m.key === i), c = (m) => m.replace(/-([a-z])/g, (n, e) => e.toUpperCase());
179
+ if (r)
180
+ return r.options[c(r.type)];
181
181
  };
182
182
  /**
183
183
  * 更新组件数据
@@ -195,9 +195,9 @@ class L {
195
195
  }))
196
196
  )
197
197
  */
198
- static setOptionsData = (i, r, n) => {
199
- const c = L.findOptions(i, r);
200
- c && (c.data = n);
198
+ static setOptionsData = (d, i, r) => {
199
+ const c = j.findOptions(d, i);
200
+ c && (c.data = r);
201
201
  };
202
202
  static form = {
203
203
  openBefore: {
@@ -208,162 +208,13 @@ class L {
208
208
  * @param treeData 树形数据
209
209
  * @param option 组件配置
210
210
  */
211
- parentId: (i, r, n, c) => {
212
- i ? r.type === $.EDialog.Insert ? (r.form.parentId = i._id, r.form.sort = i.children.length + 1) : r.form.parentId = i.parentId.substring(i.parentId.lastIndexOf(",") + 1) : (r.form.parentId = "0", r.form.sort = n.length + 1), L.setOptionsData(c, "parentId", [{ _id: "0", title: "根", children: n }]);
211
+ parentId: (d, i, r, c) => {
212
+ d ? i.type === O.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), j.setOptionsData(c, "parentId", [{ _id: "0", title: "根", children: r }]);
213
213
  }
214
214
  }
215
215
  };
216
216
  }
217
- const me = { class: "row curd-row" }, be = /* @__PURE__ */ N({
218
- __name: "column",
219
- props: {
220
- /**
221
- * 配置
222
- */
223
- option: {
224
- default: {}
225
- }
226
- },
227
- setup(p, { expose: i }) {
228
- const r = $.isFun, n = $.EDialog, c = j(), m = p, s = q({
229
- rules: {},
230
- show: !1,
231
- showContent: !1,
232
- loading: !1,
233
- type: n.Insert,
234
- form: {},
235
- formDefault: {},
236
- formColumn: [],
237
- getDisabled: (e) => e.disabled?.[s.type === n.Insert ? "create" : "update"],
238
- initColumnForm: () => {
239
- const e = m.option;
240
- s.formColumn = [];
241
- const a = [], o = m.option.form?.maxSpan || 12, u = m.option.form?.defaultSpan || o;
242
- let t = [];
243
- const l = (h) => {
244
- if (s.formDefault[h.key] = h.value, h.isForm) {
245
- h.form = h.form || { span: u }, h.form.span = h.form.span ?? u;
246
- let U = h.form.span, y = t.reduce((z, T) => z + T.span, U);
247
- const E = t.length;
248
- t.push({ item: h, span: U }), (E === 1 && t[0].span === 0 || y >= o || U === 0 && E > 1) && (a.push(t), t = []), h.rules && (s.rules[h.key] = h.rules);
249
- }
250
- };
251
- e.column.forEach((h) => {
252
- h.isForm = !0, l(h);
253
- }), t.length > 0 && a.push(t), s.formColumn = a;
254
- }
255
- });
256
- return s.initColumnForm(), i({
257
- ref: c,
258
- conf: s
259
- }), (e, a) => {
260
- const o = W("FormList");
261
- return f(), g(d(J), {
262
- ref_key: "ruleFormRef",
263
- ref: c,
264
- model: s.form,
265
- rules: s.rules
266
- }, {
267
- default: b(() => [
268
- s.showContent ? (f(!0), w(x, { key: 0 }, F(s.formColumn, (u) => (f(), w("div", me, [
269
- k(e.$slots, "form-start", {
270
- row: s.form
271
- }),
272
- (f(!0), w(x, null, F(u, (t) => (f(), w(x, null, [
273
- d(r)(t.item.show?.form, s.form) ? (f(), w("div", {
274
- key: 0,
275
- class: X(t.item.form.span > 0 ? `col-${t.item.form.span}` : "col")
276
- }, [
277
- v(d(M), {
278
- label: t.item.label,
279
- prop: t.item.key,
280
- "label-width": t.item.form?.labelWidth || "100px"
281
- }, {
282
- default: b(() => [
283
- k(e.$slots, "form-" + t.item.key + "-start", {
284
- row: s.form,
285
- item: t.item
286
- }),
287
- k(e.$slots, "form-" + t.item.key, {
288
- row: s.form,
289
- item: t.item
290
- }, () => [
291
- t.item.type === "input" ? (f(), g(d(K), D({
292
- key: 0,
293
- modelValue: s.form[t.item.key],
294
- "onUpdate:modelValue": (l) => s.form[t.item.key] = l
295
- }, { ref_for: !0 }, t.item.options?.input, Y(t.item.options?.input?.on), {
296
- disabled: s.getDisabled(t.item)
297
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : t.item.type === "switch" ? (f(), g(d(H), D({
298
- key: 1,
299
- modelValue: s.form[t.item.key],
300
- "onUpdate:modelValue": (l) => s.form[t.item.key] = l
301
- }, { ref_for: !0 }, t.item.options?.switch, {
302
- disabled: s.getDisabled(t.item)
303
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : t.item.type === "select" ? (f(), g(d(_), D({
304
- key: 2,
305
- modelValue: s.form[t.item.key],
306
- "onUpdate:modelValue": (l) => s.form[t.item.key] = l
307
- }, { ref_for: !0 }, t.item.options?.select, {
308
- disabled: s.getDisabled(t.item),
309
- style: { width: "100%" }
310
- }), {
311
- default: b(() => [
312
- (f(!0), w(x, null, F(t.item.options?.select?.data, (l) => (f(), g(d(R), {
313
- key: l.value,
314
- label: l.label,
315
- value: l.value
316
- }, null, 8, ["label", "value"]))), 128))
317
- ]),
318
- _: 2
319
- }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : t.item.type === "list" ? (f(), g(o, D({
320
- key: 3,
321
- row: s.form,
322
- field: t.item.key
323
- }, { ref_for: !0 }, t.item.options?.list, {
324
- disabled: s.getDisabled(t.item),
325
- style: { width: "100%" }
326
- }), null, 16, ["row", "field", "disabled"])) : t.item.type === "tree-select" ? (f(), g(d(te), D({
327
- key: 4,
328
- modelValue: s.form[t.item.key],
329
- "onUpdate:modelValue": (l) => s.form[t.item.key] = l
330
- }, { ref_for: !0 }, t.item.options?.treeSelect, {
331
- disabled: s.getDisabled(t.item),
332
- style: { width: "100%" }
333
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : t.item.type === "datetime" ? (f(), g(d(le), D({
334
- key: 5,
335
- modelValue: s.form[t.item.key],
336
- "onUpdate:modelValue": (l) => s.form[t.item.key] = l
337
- }, { ref_for: !0 }, t.item.options?.datetime, {
338
- disabled: s.getDisabled(t.item)
339
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : d(L).customComponent[t.item.type] ? (f(), g(Z(d(L).customComponent[t.item.type]), D({
340
- key: 6,
341
- modelValue: s.form[t.item.key],
342
- "onUpdate:modelValue": (l) => s.form[t.item.key] = l
343
- }, { ref_for: !0 }, t.item.options?.[t.item.type], {
344
- disabled: s.getDisabled(t.item)
345
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
346
- ]),
347
- k(e.$slots, "form-" + t.item.key + "-end", {
348
- row: s.form,
349
- item: t.item
350
- })
351
- ]),
352
- _: 2
353
- }, 1032, ["label", "prop", "label-width"])
354
- ], 2)) : C("", !0)
355
- ], 64))), 256)),
356
- k(e.$slots, "form-end", {
357
- row: s.form
358
- })
359
- ]))), 256)) : C("", !0)
360
- ]),
361
- _: 3
362
- }, 8, ["model", "rules"]);
363
- };
364
- }
365
- });
366
- class I {
217
+ class L {
367
218
  /**
368
219
  * 获取id函数-可以直接覆盖
369
220
  */
@@ -373,12 +224,12 @@ class I {
373
224
  * @param field 字段名
374
225
  * @param row 行数据
375
226
  */
376
- static setId = (i, r, n) => {
377
- r[i] || (r[i] = []), r[i].forEach((c) => {
378
- n.forEach((m) => {
379
- let s = m.default ?? "";
380
- m.type === "number" && (s = m.default ?? 0), m.type === "boolean" && (s = m.default ?? !1), m.type === "time" && (s = m.default ?? /* @__PURE__ */ new Date()), c[m.value] === void 0 && (c[m.value] = s);
381
- }), c._id || (c._id = I.getIdFun());
227
+ static setId = (d, i, r) => {
228
+ i[d] || (i[d] = []), i[d].forEach((c) => {
229
+ r.forEach((m) => {
230
+ let n = m.default ?? "";
231
+ m.type === "number" && (n = m.default ?? 0), m.type === "boolean" && (n = m.default ?? !1), m.type === "time" && (n = m.default ?? /* @__PURE__ */ new Date()), c[m.value] === void 0 && (c[m.value] = n);
232
+ }), c._id || (c._id = L.getIdFun());
382
233
  });
383
234
  };
384
235
  /**
@@ -388,17 +239,17 @@ class I {
388
239
  * @param itemFields 元素字段-如:[{label:'',value:''}]
389
240
  * @param callback 回调函数
390
241
  */
391
- static add = (i, r, n, c) => {
392
- const m = JSONUtil.cp(n);
393
- I.setId(i, r, n), r[i].push(
242
+ static add = (d, i, r, c) => {
243
+ const m = JSONUtil.cp(r);
244
+ L.setId(d, i, r), i[d].push(
394
245
  m.reduce(
395
- (s, e) => {
396
- let a = e.default ?? "";
397
- return e.type === "number" && (a = e.default ?? 0), e.type === "boolean" && (a = e.default ?? !1), e.type === "time" && (a = e.default ?? /* @__PURE__ */ new Date()), s[e.value] = a, s;
246
+ (n, e) => {
247
+ let s = e.default ?? "";
248
+ 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;
398
249
  },
399
- { _id: I.getIdFun() }
250
+ { _id: L.getIdFun() }
400
251
  )
401
- ), c?.(r);
252
+ ), c?.(i);
402
253
  };
403
254
  /**
404
255
  * 删除数组元素
@@ -407,8 +258,8 @@ class I {
407
258
  * @param item 元素-如:{_id:''}
408
259
  * @param callback 回调函数
409
260
  */
410
- static remove = (i, r, n, c) => {
411
- r[i] = r[i].filter((m) => m._id !== n._id), c?.(r);
261
+ static remove = (d, i, r, c) => {
262
+ i[d] = i[d].filter((m) => m._id !== r._id), c?.(i);
412
263
  };
413
264
  /**
414
265
  * 获取没有id的数据
@@ -416,21 +267,21 @@ class I {
416
267
  * @param childernField 子级字段-如:list、children
417
268
  * @returns 没有id的数据
418
269
  */
419
- static getNoIdData = (i, r) => {
420
- const n = JSONUtil.cp(i);
421
- return n.forEach((c) => {
422
- c._id && delete c._id, r && c[r] && I.getNoIdData(c[r], r);
423
- }), n;
270
+ static getNoIdData = (d, i) => {
271
+ const r = JSONUtil.cp(d);
272
+ return r.forEach((c) => {
273
+ c._id && delete c._id, i && c[i] && L.getNoIdData(c[i], i);
274
+ }), r;
424
275
  };
425
276
  }
426
- const he = {
277
+ const me = {
427
278
  key: 0,
428
279
  class: "column",
429
280
  style: { width: "100%", gap: "10px" }
430
- }, ye = {
281
+ }, he = {
431
282
  class: "row items-center",
432
283
  style: { gap: "10px", width: "100%" }
433
- }, oe = /* @__PURE__ */ N({
284
+ }, Q = /* @__PURE__ */ P({
434
285
  __name: "list",
435
286
  props: {
436
287
  row: {
@@ -465,72 +316,217 @@ const he = {
465
316
  }
466
317
  },
467
318
  emits: ["change"],
468
- setup(p, { emit: i }) {
469
- const r = p, n = q({
319
+ setup(f, { emit: d }) {
320
+ const i = f, r = q({
470
321
  show: !1,
471
- add: (m, s, e) => {
472
- I.add(m, s, e, () => {
322
+ add: (m, n, e) => {
323
+ L.add(m, n, e, () => {
473
324
  c("change");
474
325
  });
475
326
  },
476
- remove: (m, s, e) => {
477
- I.remove(m, s, e, () => {
327
+ remove: (m, n, e) => {
328
+ L.remove(m, n, e, () => {
478
329
  c("change");
479
330
  });
480
331
  }
481
332
  });
482
333
  ee(() => {
483
- I.setId(r.field, r.row, r.itemFields), n.show = !0;
334
+ L.setId(i.field, i.row, i.itemFields), r.show = !0;
484
335
  });
485
- const c = i;
486
- return (m, s) => {
487
- const e = W("el-button"), a = W("el-input");
488
- return n.show ? (f(), w("div", he, [
489
- k(m.$slots, "list-start", { row: p.row }),
490
- S("div", null, [
336
+ const c = d;
337
+ return (m, n) => {
338
+ const e = Z("el-button"), s = Z("el-input");
339
+ return r.show ? (p(), w("div", me, [
340
+ k(m.$slots, "list-start", { row: f.row }),
341
+ U("div", null, [
491
342
  v(e, {
492
343
  link: "",
493
344
  type: "primary",
494
- onClick: s[0] || (s[0] = (o) => n.add(p.field, p.row, p.itemFields))
345
+ onClick: n[0] || (n[0] = (l) => r.add(f.field, f.row, f.itemFields))
495
346
  }, {
496
- default: b(() => [...s[2] || (s[2] = [
347
+ default: h(() => [...n[2] || (n[2] = [
497
348
  V("添加", -1)
498
349
  ])]),
499
350
  _: 1
500
351
  })
501
352
  ]),
502
- (f(!0), w(x, null, F(p.row[p.field], (o) => (f(), w("div", ye, [
353
+ (p(!0), w($, null, I(f.row[f.field], (l) => (p(), w("div", he, [
503
354
  k(m.$slots, "item-start", {
504
- item: o,
505
- row: p.row
355
+ item: l,
356
+ row: f.row
506
357
  }),
507
- (f(!0), w(x, null, F(p.itemFields, (u) => (f(), g(a, {
508
- modelValue: o[u.value],
509
- "onUpdate:modelValue": (t) => o[u.value] = t,
510
- style: se({ width: p.inputWidth }),
511
- class: X(p.inputClass),
512
- placeholder: u[p.label] || u[p.value],
513
- onChange: s[1] || (s[1] = (t) => c("change"))
358
+ (p(!0), w($, null, I(f.itemFields, (o) => (p(), g(s, {
359
+ modelValue: l[o.value],
360
+ "onUpdate:modelValue": (t) => l[o.value] = t,
361
+ style: se({ width: f.inputWidth }),
362
+ class: X(f.inputClass),
363
+ placeholder: o[f.label] || o[f.value],
364
+ onChange: n[1] || (n[1] = (t) => c("change"))
514
365
  }, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
515
366
  k(m.$slots, "item-end", {
516
- item: o,
517
- row: p.row
367
+ item: l,
368
+ row: f.row
518
369
  }),
519
370
  v(e, {
520
371
  link: "",
521
372
  type: "danger",
522
- onClick: (u) => n.remove(p.field, p.row, o)
373
+ onClick: (o) => r.remove(f.field, f.row, l)
523
374
  }, {
524
- default: b(() => [...s[3] || (s[3] = [
375
+ default: h(() => [...n[3] || (n[3] = [
525
376
  V("删除", -1)
526
377
  ])]),
527
378
  _: 1
528
379
  }, 8, ["onClick"])
529
380
  ]))), 256)),
530
- k(m.$slots, "list-end", { row: p.row })
381
+ k(m.$slots, "list-end", { row: f.row })
531
382
  ])) : C("", !0);
532
383
  };
533
384
  }
385
+ }), be = { class: "row curd-row" }, ye = /* @__PURE__ */ P({
386
+ __name: "column",
387
+ props: {
388
+ /**
389
+ * 配置
390
+ */
391
+ option: {
392
+ default: {}
393
+ }
394
+ },
395
+ setup(f, { expose: d }) {
396
+ const i = O.isFun, r = O.EDialog, c = z(), m = f, n = q({
397
+ rules: {},
398
+ show: !1,
399
+ showContent: !1,
400
+ loading: !1,
401
+ type: r.Insert,
402
+ form: {},
403
+ formDefault: {},
404
+ formColumn: [],
405
+ getDisabled: (e) => e.disabled?.[n.type === r.Insert ? "create" : "update"],
406
+ initColumnForm: () => {
407
+ const e = m.option;
408
+ n.formColumn = [];
409
+ const s = [], l = m.option.form?.maxSpan || 12, o = m.option.form?.defaultSpan || l;
410
+ let t = [];
411
+ const a = (b) => {
412
+ if (n.formDefault[b.key] = b.value, b.isForm) {
413
+ b.form = b.form || { span: o }, b.form.span = b.form.span ?? o;
414
+ let x = b.form.span, y = t.reduce((T, R) => T + R.span, x);
415
+ const E = t.length;
416
+ t.push({ item: b, span: x }), (E === 1 && t[0].span === 0 || y >= l || x === 0 && E > 1) && (s.push(t), t = []), b.rules && (n.rules[b.key] = b.rules);
417
+ }
418
+ };
419
+ e.column.forEach((b) => {
420
+ b.isForm = !0, a(b);
421
+ }), t.length > 0 && s.push(t), n.formColumn = s;
422
+ }
423
+ });
424
+ return n.initColumnForm(), d({
425
+ ref: c,
426
+ conf: n
427
+ }), (e, s) => (p(), g(u(J), {
428
+ ref_key: "ruleFormRef",
429
+ ref: c,
430
+ model: n.form,
431
+ rules: n.rules
432
+ }, {
433
+ default: h(() => [
434
+ n.showContent ? (p(!0), w($, { key: 0 }, I(n.formColumn, (l) => (p(), w("div", be, [
435
+ k(e.$slots, "form-start", {
436
+ row: n.form
437
+ }),
438
+ (p(!0), w($, null, I(l, (o) => (p(), w($, null, [
439
+ u(i)(o.item.show?.form, n.form) ? (p(), w("div", {
440
+ key: 0,
441
+ class: X(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
442
+ }, [
443
+ v(u(_), {
444
+ label: o.item.label,
445
+ prop: o.item.key,
446
+ "label-width": o.item.form?.labelWidth || "100px"
447
+ }, {
448
+ default: h(() => [
449
+ k(e.$slots, "form-" + o.item.key + "-start", {
450
+ row: n.form,
451
+ item: o.item
452
+ }),
453
+ k(e.$slots, "form-" + o.item.key, {
454
+ row: n.form,
455
+ item: o.item
456
+ }, () => [
457
+ o.item.type === "input" ? (p(), g(u(K), D({
458
+ key: 0,
459
+ modelValue: n.form[o.item.key],
460
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
461
+ }, { ref_for: !0 }, o.item.options?.input, F(o.item.options?.input?.on), {
462
+ disabled: n.getDisabled(o.item)
463
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (p(), g(u(H), D({
464
+ key: 1,
465
+ modelValue: n.form[o.item.key],
466
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
467
+ }, { ref_for: !0 }, o.item.options?.switch, F(o.item.options?.switch?.on || {}), {
468
+ disabled: n.getDisabled(o.item)
469
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (p(), g(u(N), D({
470
+ key: 2,
471
+ modelValue: n.form[o.item.key],
472
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
473
+ }, { ref_for: !0 }, o.item.options?.select, F(o.item.options?.select?.on || {}), {
474
+ disabled: n.getDisabled(o.item),
475
+ style: { width: "100%" }
476
+ }), {
477
+ default: h(() => [
478
+ (p(!0), w($, null, I(o.item.options?.select?.data, (t) => (p(), g(u(M), {
479
+ key: t.value,
480
+ label: t.label,
481
+ value: t.value
482
+ }, null, 8, ["label", "value"]))), 128))
483
+ ]),
484
+ _: 2
485
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (p(), g(Q, D({
486
+ key: 3,
487
+ row: n.form,
488
+ field: o.item.key
489
+ }, { ref_for: !0 }, o.item.options?.list, F(o.item.options?.list?.on || {}), {
490
+ disabled: n.getDisabled(o.item),
491
+ style: { width: "100%" }
492
+ }), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (p(), g(u(oe), D({
493
+ key: 4,
494
+ modelValue: n.form[o.item.key],
495
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
496
+ }, { ref_for: !0 }, o.item.options?.treeSelect, F(o.item.options?.treeSelect?.on || {}), {
497
+ disabled: n.getDisabled(o.item),
498
+ style: { width: "100%" }
499
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (p(), g(u(le), D({
500
+ key: 5,
501
+ modelValue: n.form[o.item.key],
502
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
503
+ }, { ref_for: !0 }, o.item.options?.datetime, F(o.item.options?.datetime?.on || {}), {
504
+ disabled: n.getDisabled(o.item)
505
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(j).customComponent[o.item.type] ? (p(), g(te(u(j).customComponent[o.item.type]), D({
506
+ key: 6,
507
+ modelValue: n.form[o.item.key],
508
+ "onUpdate:modelValue": (t) => n.form[o.item.key] = t
509
+ }, { ref_for: !0 }, o.item.options?.[o.item.type], F(o.item.options?.[o.item.type]?.on || {}), {
510
+ disabled: n.getDisabled(o.item)
511
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
512
+ ]),
513
+ k(e.$slots, "form-" + o.item.key + "-end", {
514
+ row: n.form,
515
+ item: o.item
516
+ })
517
+ ]),
518
+ _: 2
519
+ }, 1032, ["label", "prop", "label-width"])
520
+ ], 2)) : C("", !0)
521
+ ], 64))), 256)),
522
+ k(e.$slots, "form-end", {
523
+ row: n.form
524
+ })
525
+ ]))), 256)) : C("", !0)
526
+ ]),
527
+ _: 3
528
+ }, 8, ["model", "rules"]));
529
+ }
534
530
  });
535
531
  class ge {
536
532
  /**
@@ -539,58 +535,58 @@ class ge {
539
535
  * @param columns 列
540
536
  * @param fileName 文件名
541
537
  */
542
- static exportToExcel = async (i, r, n) => {
543
- const c = await $.loadModule("xlsx"), m = i.map((a) => {
544
- const o = {};
545
- return r.forEach((u) => {
546
- o[u.label] = a[u.key];
547
- }), o;
548
- }), s = c.utils.json_to_sheet(m), e = c.utils.book_new();
549
- c.utils.book_append_sheet(e, s, "Sheet1"), n ? typeof n == "function" && (n = n()) : n = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, c.writeFile(e, `${n}.xlsx`);
538
+ static exportToExcel = async (d, i, r) => {
539
+ const c = await O.loadModule("xlsx"), m = d.map((s) => {
540
+ const l = {};
541
+ return i.forEach((o) => {
542
+ l[o.label] = s[o.key];
543
+ }), l;
544
+ }), n = c.utils.json_to_sheet(m), e = c.utils.book_new();
545
+ c.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()}`, c.writeFile(e, `${r}.xlsx`);
550
546
  };
551
547
  }
552
- const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
548
+ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
553
549
  __name: "switchConfirm",
554
- setup(p, { expose: i }) {
555
- const r = j(!1), n = j("确认修改"), c = j("确认要修改状态吗?");
556
- let m = null, s = null;
557
- const e = (u) => (u?.title && (n.value = u.title), u?.content && (c.value = u.content), r.value = !0, new Promise((t, l) => {
558
- m = t, s = l;
559
- })), a = () => {
560
- r.value = !1, m?.(!0), m = null, s = null;
561
- }, o = () => {
562
- r.value = !1, s?.(new Error("用户取消操作")), m = null, s = null;
550
+ setup(f, { expose: d }) {
551
+ const i = z(!1), r = z("确认修改"), c = z("确认要修改状态吗?");
552
+ let m = null, n = null;
553
+ const e = (o) => (o?.title && (r.value = o.title), o?.content && (c.value = o.content), i.value = !0, new Promise((t, a) => {
554
+ m = t, n = a;
555
+ })), s = () => {
556
+ i.value = !1, m?.(!0), m = null, n = null;
557
+ }, l = () => {
558
+ i.value = !1, n?.(new Error("用户取消操作")), m = null, n = null;
563
559
  };
564
- return i({
560
+ return d({
565
561
  open: e
566
- }), (u, t) => (f(), g(d(G), {
567
- modelValue: r.value,
568
- "onUpdate:modelValue": t[0] || (t[0] = (l) => r.value = l),
569
- title: n.value,
562
+ }), (o, t) => (p(), g(u(G), {
563
+ modelValue: i.value,
564
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => i.value = a),
565
+ title: r.value,
570
566
  "close-on-click-modal": !1,
571
567
  width: "400px"
572
568
  }, {
573
- footer: b(() => [
574
- S("span", we, [
575
- v(d(O), { onClick: o }, {
576
- default: b(() => [...t[1] || (t[1] = [
569
+ footer: h(() => [
570
+ U("span", we, [
571
+ v(u(S), { onClick: l }, {
572
+ default: h(() => [...t[1] || (t[1] = [
577
573
  V("取消", -1)
578
574
  ])]),
579
575
  _: 1
580
576
  }),
581
- v(d(O), {
577
+ v(u(S), {
582
578
  type: "primary",
583
- onClick: a
579
+ onClick: s
584
580
  }, {
585
- default: b(() => [...t[2] || (t[2] = [
581
+ default: h(() => [...t[2] || (t[2] = [
586
582
  V("确认", -1)
587
583
  ])]),
588
584
  _: 1
589
585
  })
590
586
  ])
591
587
  ]),
592
- default: b(() => [
593
- S("div", null, A(c.value), 1)
588
+ default: h(() => [
589
+ U("div", null, A(c.value), 1)
594
590
  ]),
595
591
  _: 1
596
592
  }, 8, ["modelValue", "title"]));
@@ -607,7 +603,10 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
607
603
  }, xe = { key: 0 }, $e = { key: 1 }, Oe = { key: 2 }, Se = { class: "export-btn" }, Fe = {
608
604
  class: "flex items-center",
609
605
  style: { gap: "10px" }
610
- }, Ie = { class: "col fit-width relative" }, Le = { class: "absolute column fit" }, je = { class: "row justify-end mt-20 mb-20" }, ze = { class: "row curd-row" }, Te = { class: "dialog-footer" }, Re = { class: "dialog-footer" }, Me = /* @__PURE__ */ N({
606
+ }, Ie = { class: "col fit-width relative" }, Le = { class: "absolute column fit" }, je = { class: "row justify-end mt-20 mb-20" }, ze = { class: "row curd-row" }, Te = {
607
+ class: "row form-item-content",
608
+ style: { width: "100%" }
609
+ }, Re = { class: "col" }, Me = { class: "dialog-footer" }, _e = { class: "dialog-footer" }, Ne = /* @__PURE__ */ P({
611
610
  __name: "index",
612
611
  props: {
613
612
  /**
@@ -617,8 +616,8 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
617
616
  default: {}
618
617
  }
619
618
  },
620
- setup(p, { expose: i }) {
621
- const r = $.EDialog, n = p, c = j(), m = j(), s = $.isFun, e = q({
619
+ setup(f, { expose: d }) {
620
+ const i = O.EDialog, r = f, c = z(), m = z(), n = O.isFun, e = q({
622
621
  search: {
623
622
  column: {
624
623
  list: []
@@ -626,29 +625,29 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
626
625
  form: {},
627
626
  formDefault: {},
628
627
  getFormData: () => {
629
- let a = {};
630
- n.option.column.forEach((u) => {
631
- (typeof u.show?.search == "function" ? u.show?.search(e.search.form) : u.show?.search) && (a[u.key] = e.search.form[u.key]);
628
+ let s = {};
629
+ r.option.column.forEach((o) => {
630
+ (typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (s[o.key] = e.search.form[o.key]);
632
631
  });
633
- const o = n.option.search?.before?.(a);
634
- return o && (a = o), a;
632
+ const l = r.option.search?.before?.(s);
633
+ return l && (s = l), s;
635
634
  },
636
635
  reset: () => {
637
- const a = e.search.formDefault;
638
- Object.keys(a).forEach((o) => {
639
- n.option.search?.resetMode === "default" ? a[o] = e.search.formDefault[o] : a[o] = void 0;
640
- }), e.search.form = JSONUtil.cp(a), e.page.num = 1, e.table.getList();
636
+ const s = e.search.formDefault;
637
+ Object.keys(s).forEach((l) => {
638
+ r.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
639
+ }), e.search.form = JSONUtil.cp(s), e.page.num = 1, e.table.getList();
641
640
  },
642
641
  submit: () => {
643
642
  e.page.num = 1, e.table.getList();
644
643
  }
645
644
  },
646
645
  page: {
647
- size: n.option.page?.size || 10,
648
- sizeList: n.option.page?.sizeList || [10, 20, 50, 100],
646
+ size: r.option.page?.size || 10,
647
+ sizeList: r.option.page?.sizeList || [10, 20, 50, 100],
649
648
  num: 1,
650
649
  total: 0,
651
- layout: n.option.page?.layout || "total, sizes, prev, pager, next, jumper"
650
+ layout: r.option.page?.layout || "total, sizes, prev, pager, next, jumper"
652
651
  },
653
652
  table: {
654
653
  loading: !1,
@@ -656,19 +655,19 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
656
655
  expand: {
657
656
  isExpand: !1,
658
657
  rowKeys: [],
659
- change: (a, o) => {
658
+ change: (s, l) => {
660
659
  },
661
660
  all: () => {
662
661
  if (e.table.expand.isExpand)
663
662
  e.table.expand.rowKeys = [];
664
663
  else {
665
- const a = (o) => {
666
- let u = [];
667
- return o.forEach((t) => {
668
- u.push(t._id), t.children && t.children.length > 0 && (u = u.concat(a(t.children)));
669
- }), u;
664
+ const s = (l) => {
665
+ let o = [];
666
+ return l.forEach((t) => {
667
+ o.push(t._id), t.children && t.children.length > 0 && (o = o.concat(s(t.children)));
668
+ }), o;
670
669
  };
671
- e.table.expand.rowKeys = a(e.table.data);
670
+ e.table.expand.rowKeys = s(e.table.data);
672
671
  }
673
672
  e.table.expand.isExpand = !e.table.expand.isExpand;
674
673
  }
@@ -694,56 +693,56 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
694
693
  },
695
694
  getList: async () => {
696
695
  e.table.loading = !0;
697
- const a = n.option.api.list, o = await a({
696
+ const s = r.option.api.list, l = await s({
698
697
  size: e.page.size,
699
698
  num: e.page.num,
700
699
  ...e.search.getFormData(),
701
- final(l, h, U) {
700
+ final(a, b, x) {
702
701
  e.table.loading = !1;
703
702
  }
704
- }), u = o.data || { list: o };
705
- let t = Array.isArray(u.list) ? u.list : u;
706
- e.table.data = n.option.data ? await n.option.data(t) : t, e.page.total = u.total || 0;
703
+ }), o = l.data || { list: l };
704
+ let t = Array.isArray(o.list) ? o.list : o;
705
+ e.table.data = r.option.data ? await r.option.data(t) : t, e.page.total = o.total || 0;
707
706
  },
708
707
  selection: {
709
708
  list: [],
710
- change: (a) => {
711
- e.table.selection.list = a;
709
+ change: (s) => {
710
+ e.table.selection.list = s;
712
711
  }
713
712
  },
714
713
  exportFun: {
715
- start: async (a) => {
716
- let o = await e.table.exportFun[a](), u = n.option.column;
714
+ start: async (s) => {
715
+ let l = await e.table.exportFun[s](), o = r.option.column;
717
716
  const t = JSONUtil.cp({
718
- data: o,
719
- columns: u
720
- }), l = n.option.tools?.export || {};
721
- l.before && l.before(t), ge.exportToExcel(t.data, t.columns, l.fileName);
717
+ data: l,
718
+ columns: o
719
+ }), a = r.option.tools?.export || {};
720
+ a.before && a.before(t), ge.exportToExcel(t.data, t.columns, a.fileName);
722
721
  },
723
722
  select: () => {
724
723
  if (e.table.selection.list.length === 0)
725
- throw $.fail("请选择要导出的数据"), new Error("请选择要导出的数据");
724
+ throw O.fail("请选择要导出的数据"), new Error("请选择要导出的数据");
726
725
  return e.table.selection.list;
727
726
  },
728
727
  page: () => {
729
728
  if (e.table.data.length === 0)
730
- throw $.fail("暂无数据"), new Error("暂无数据");
729
+ throw O.fail("暂无数据"), new Error("暂无数据");
731
730
  return e.table.data;
732
731
  },
733
732
  all: async () => {
734
733
  e.table.loading = !0;
735
- const a = n.option.api.list, { data: o } = await a({
734
+ const s = r.option.api.list, { data: l } = await s({
736
735
  size: 999999,
737
736
  num: 1,
738
- final(u, t, l) {
737
+ final(o, t, a) {
739
738
  e.table.loading = !1;
740
739
  }
741
740
  });
742
- return o.list;
741
+ return l.list;
743
742
  }
744
743
  },
745
- export: (a) => {
746
- e.table.exportFun.start(a);
744
+ export: (s) => {
745
+ e.table.exportFun.start(s);
747
746
  }
748
747
  },
749
748
  update: {
@@ -752,11 +751,11 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
752
751
  show: !1,
753
752
  showContent: !1,
754
753
  loading: !1,
755
- type: r.Insert,
754
+ type: i.Insert,
756
755
  form: {},
757
756
  formDefault: {},
758
757
  formColumn: [],
759
- getDisabled: (a) => a.disabled?.[e.update.type === r.Insert ? "create" : "update"],
758
+ getDisabled: (s) => s.disabled?.[e.update.type === i.Insert ? "create" : "update"],
760
759
  edit: {
761
760
  /**
762
761
  * 编辑原数据
@@ -765,42 +764,42 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
765
764
  /**
766
765
  * 将form填入数据和data比对差异数据返回
767
766
  */
768
- getApiData: (a) => {
769
- if (n.option.form?.editAll)
770
- return a;
771
- let o = {
767
+ getApiData: (s) => {
768
+ if (r.option.form?.editAll)
769
+ return s;
770
+ let l = {
772
771
  _id: e.update.edit.data._id
773
772
  };
774
- return Object.keys(e.update.edit.data).forEach((u) => {
775
- a[u] !== e.update.edit.data[u] && (o[u] = a[u]);
776
- }), o;
773
+ return Object.keys(e.update.edit.data).forEach((o) => {
774
+ s[o] !== e.update.edit.data[o] && (l[o] = s[o]);
775
+ }), l;
777
776
  }
778
777
  },
779
- open: (a, o) => {
778
+ open: (s, l) => {
780
779
  e.update.showContent || FunUtil.throttle(async () => {
781
- e.update.type = a;
782
- const u = a === r.Insert;
783
- e.update.edit.data = o, e.update.title = u ? "新增" : "编辑", e.update.form = JSONUtil.cp(u ? 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);
780
+ e.update.type = s;
781
+ const o = s === i.Insert;
782
+ 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);
784
783
  });
785
784
  },
786
785
  submit: () => {
787
786
  FunUtil.throttle(async () => {
788
- await m.value?.validate(async (u, t) => new Promise((l, h) => {
789
- u || ($.fail("请检查表单数据"), h(!1)), l();
787
+ await m.value?.validate(async (o, t) => new Promise((a, b) => {
788
+ o || (O.fail("请检查表单数据"), b(!1)), a();
790
789
  })), e.update.loading = !0;
791
- const a = e.update.type === r.Insert ? n.option.api.create : n.option.api.update;
792
- let o = JSONUtil.cp(e.update.form);
793
- delete o.children, await n.option.form?.submitBefore?.(o, e.update), Object.keys(o).forEach((u) => {
794
- if (typeof o[u] == "string" && o[u].indexOf("T") > -1) {
795
- const t = new Date(o[u]).getTime();
796
- !isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (o[u] = t);
790
+ const s = e.update.type === i.Insert ? r.option.api.create : r.option.api.update;
791
+ let l = JSONUtil.cp(e.update.form);
792
+ delete l.children, await r.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
793
+ if (typeof l[o] == "string" && l[o].indexOf("T") > -1) {
794
+ const t = new Date(l[o]).getTime();
795
+ !isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (l[o] = t);
797
796
  }
798
- }), await a({
799
- ...o,
800
- final(u, t, l) {
797
+ }), await s({
798
+ ...l,
799
+ final(o, t, a) {
801
800
  e.update.loading = !1;
802
801
  }
803
- }), e.update.close(), await e.table.getList(), n.option.form?.submitAfter?.(o, e.update);
802
+ }), e.update.close(), await e.table.getList(), r.option.form?.submitAfter?.(l, e.update);
804
803
  });
805
804
  },
806
805
  close: () => {
@@ -817,23 +816,23 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
817
816
  close: () => {
818
817
  e.remove.show = !1;
819
818
  },
820
- open: (a) => {
821
- if (a.length === 0) {
822
- $.fail("请选择要删除的数据");
819
+ open: (s) => {
820
+ if (s.length === 0) {
821
+ O.fail("请选择要删除的数据");
823
822
  return;
824
823
  }
825
- e.remove.items = a, e.remove.show = !0;
824
+ e.remove.items = s, e.remove.show = !0;
826
825
  },
827
826
  submit: () => {
828
827
  FunUtil.throttle(async () => {
829
828
  e.table.loading = !0;
830
- const a = n.option.api.delete;
831
- await a({
832
- _id: e.remove.items.map((o) => o._id),
833
- final(o, u, t) {
829
+ const s = r.option.api.delete;
830
+ await s({
831
+ _id: e.remove.items.map((l) => l._id),
832
+ final(l, o, t) {
834
833
  e.table.loading = !1;
835
834
  }
836
- }), $.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
835
+ }), O.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
837
836
  });
838
837
  }
839
838
  },
@@ -841,7 +840,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
841
840
  e.initCurdConfig(), e.initColumnOptions(), e.initColumnForm();
842
841
  },
843
842
  initCurdConfig: () => {
844
- const o = {
843
+ const l = {
845
844
  tools: {
846
845
  search: !0,
847
846
  reset: !0,
@@ -859,9 +858,9 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
859
858
  emptyText: "暂无数据",
860
859
  highlightCurrentRow: !0
861
860
  }
862
- }, u = n.option;
863
- Object.keys(o).forEach((t) => {
864
- u[t] = ObjectUtil.deepMerge(o[t], u[t] || {});
861
+ }, o = r.option;
862
+ Object.keys(l).forEach((t) => {
863
+ o[t] = ObjectUtil.deepMerge(l[t], o[t] || {});
865
864
  });
866
865
  },
867
866
  /**
@@ -870,27 +869,27 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
870
869
  * @returns
871
870
  */
872
871
  initColumnOptions: () => {
873
- const a = n.option, o = (u) => {
874
- const l = {
872
+ const s = r.option, l = (o) => {
873
+ const a = {
875
874
  options: {
876
875
  switch: {
877
876
  activeValue: !0,
878
877
  activeLabel: "开启",
879
878
  inactiveValue: !1,
880
879
  inactiveLabel: "关闭",
881
- tableBeforeChange: async (U, y) => {
882
- const E = u.options?.switch;
880
+ tableBeforeChange: async (x, y) => {
881
+ const E = o.options?.switch;
883
882
  try {
884
883
  return await c.value?.open({
885
884
  title: "确认修改",
886
- content: `确认要${y[U] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
887
- }), e.table.loading = !0, await n.option.api.update({
885
+ content: `确认要${y[x] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
886
+ }), e.table.loading = !0, await r.option.api.update({
888
887
  _id: y._id,
889
- [U]: y[U] === E.activeValue ? E.inactiveValue : E.activeValue,
890
- final(z, T, Q) {
888
+ [x]: y[x] === E.activeValue ? E.inactiveValue : E.activeValue,
889
+ final(T, R, Y) {
891
890
  e.table.loading = !1;
892
891
  }
893
- }), $.success("操作成功"), e.table.getList(), !0;
892
+ }), O.success("操作成功"), e.table.getList(), !0;
894
893
  } catch {
895
894
  return !1;
896
895
  }
@@ -925,113 +924,113 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
925
924
  table: 0,
926
925
  form: 0
927
926
  }
928
- }, h = u;
929
- Object.keys(l).forEach((U) => {
930
- h[U] = ObjectUtil.deepMerge(l[U], h[U] || {});
927
+ }, b = o;
928
+ Object.keys(a).forEach((x) => {
929
+ b[x] = ObjectUtil.deepMerge(a[x], b[x] || {});
931
930
  });
932
931
  };
933
- a.column.forEach(o), a.table?.column?.forEach(o);
932
+ s.column.forEach(l), s.table?.column?.forEach(l);
934
933
  },
935
934
  initColumnForm: () => {
936
- const a = n.option;
935
+ const s = r.option;
937
936
  e.update.formColumn = [], e.table.column.show = {
938
937
  list: [],
939
938
  listSource: []
940
939
  };
941
- const o = [], u = n.option.form?.maxSpan || 12, t = n.option.form?.defaultSpan || u / 2;
942
- let l = [];
943
- const h = (y) => {
940
+ const l = [], o = r.option.form?.maxSpan || 12, t = r.option.form?.defaultSpan || o / 2;
941
+ let a = [];
942
+ const b = (y) => {
944
943
  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) {
945
944
  y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
946
- let E = y.form.span, z = l.reduce((Q, ae) => Q + ae.span, E);
947
- const T = l.length;
948
- l.push({ item: y, span: E }), (T === 1 && l[0].span === 0 || z >= u || E === 0 && T > 1) && (o.push(l), l = []), y.rules && (e.update.rules[y.key] = y.rules);
945
+ let E = y.form.span, T = a.reduce((Y, ae) => Y + ae.span, E);
946
+ const R = a.length;
947
+ a.push({ item: y, span: E }), (R === 1 && a[0].span === 0 || T >= o || E === 0 && R > 1) && (l.push(a), a = []), y.rules && (e.update.rules[y.key] = y.rules);
949
948
  }
950
949
  };
951
- a.column.forEach((y) => {
952
- y.isForm = !0, h(y);
953
- }), n.option.table?.column?.forEach((y) => {
954
- y.isForm = !1, h(y);
955
- }), e.search.column.list = a.column.concat(a.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), l.length > 0 && o.push(l), e.update.formColumn = o;
956
- const U = n.option.search?.formDefault;
957
- U && Object.keys(U).forEach((y) => {
958
- e.search.formDefault[y] = U[y];
959
- }), a.column.forEach((y) => {
950
+ s.column.forEach((y) => {
951
+ y.isForm = !0, b(y);
952
+ }), r.option.table?.column?.forEach((y) => {
953
+ y.isForm = !1, b(y);
954
+ }), 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;
955
+ const x = r.option.search?.formDefault;
956
+ x && Object.keys(x).forEach((y) => {
957
+ e.search.formDefault[y] = x[y];
958
+ }), s.column.forEach((y) => {
960
959
  y.show?.search || (e.search.formDefault[y.key] = void 0);
961
960
  }), e.search.form = JSONUtil.cp(e.search.formDefault);
962
961
  }
963
962
  });
964
963
  return e.init(), ee(() => {
965
964
  e.table.getList();
966
- }), i({
965
+ }), d({
967
966
  conf: e
968
- }), (a, o) => {
969
- const u = ne("loading");
970
- return f(), w("div", ve, [
971
- S("div", Ce, [
972
- k(a.$slots, "box-left"),
973
- S("div", Ve, [
974
- p.option.search?.show !== !1 ? (f(), w("div", De, [
975
- v(d(J), {
967
+ }), (s, l) => {
968
+ const o = ne("loading");
969
+ return p(), w("div", ve, [
970
+ U("div", Ce, [
971
+ k(s.$slots, "box-left"),
972
+ U("div", Ve, [
973
+ f.option.search?.show !== !1 ? (p(), w("div", De, [
974
+ v(u(J), {
976
975
  model: e.search.form,
977
976
  inline: ""
978
977
  }, {
979
- default: b(() => [
980
- k(a.$slots, "search-start", {
978
+ default: h(() => [
979
+ k(s.$slots, "search-start", {
981
980
  row: e.search.form
982
981
  }),
983
- (f(!0), w(x, null, F(e.search.column.list, (t) => (f(), w(x, {
982
+ (p(!0), w($, null, I(e.search.column.list, (t) => (p(), w($, {
984
983
  key: t.key
985
984
  }, [
986
- (typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (f(), g(d(M), {
985
+ (typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (p(), g(u(_), {
987
986
  key: 0,
988
987
  label: t.label
989
988
  }, {
990
- default: b(() => [
991
- k(a.$slots, "search-" + t.key, {
989
+ default: h(() => [
990
+ k(s.$slots, "search-" + t.key, {
992
991
  row: e.search.form
993
992
  }, () => [
994
- t.type === "input" ? (f(), g(d(K), {
993
+ t.type === "input" ? (p(), g(u(K), {
995
994
  key: 0,
996
995
  modelValue: e.search.form[t.key],
997
- "onUpdate:modelValue": (l) => e.search.form[t.key] = l,
996
+ "onUpdate:modelValue": (a) => e.search.form[t.key] = a,
998
997
  placeholder: `请输入${t.label}`,
999
998
  clearable: "",
1000
999
  disabled: t.disabled?.search
1001
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (f(), g(d(_), {
1000
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (p(), g(u(N), {
1002
1001
  key: 1,
1003
1002
  modelValue: e.search.form[t.key],
1004
- "onUpdate:modelValue": (l) => e.search.form[t.key] = l,
1003
+ "onUpdate:modelValue": (a) => e.search.form[t.key] = a,
1005
1004
  placeholder: `请选择${t.label}`,
1006
1005
  clearable: "",
1007
1006
  disabled: t.disabled?.search
1008
1007
  }, {
1009
- default: b(() => [
1010
- (f(), g(d(R), {
1008
+ default: h(() => [
1009
+ (p(), g(u(M), {
1011
1010
  key: t.options?.switch?.activeValue,
1012
1011
  label: t.options?.switch?.activeLabel,
1013
1012
  value: t.options?.switch?.activeValue
1014
1013
  }, null, 8, ["label", "value"])),
1015
- (f(), g(d(R), {
1014
+ (p(), g(u(M), {
1016
1015
  key: t.options?.switch?.inactiveValue,
1017
1016
  label: t.options?.switch?.inactiveLabel,
1018
1017
  value: t.options?.switch?.inactiveValue
1019
1018
  }, null, 8, ["label", "value"]))
1020
1019
  ]),
1021
1020
  _: 2
1022
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (f(), g(d(_), {
1021
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (p(), g(u(N), {
1023
1022
  key: 2,
1024
1023
  modelValue: e.search.form[t.key],
1025
- "onUpdate:modelValue": (l) => e.search.form[t.key] = l,
1024
+ "onUpdate:modelValue": (a) => e.search.form[t.key] = a,
1026
1025
  placeholder: `请选择${t.label}`,
1027
1026
  clearable: "",
1028
1027
  disabled: t.disabled?.search
1029
1028
  }, {
1030
- default: b(() => [
1031
- (f(!0), w(x, null, F(t.options?.select?.data, (l) => (f(), g(d(R), {
1032
- key: l.value,
1033
- label: l.label,
1034
- value: l.value
1029
+ default: h(() => [
1030
+ (p(!0), w($, null, I(t.options?.select?.data, (a) => (p(), g(u(M), {
1031
+ key: a.value,
1032
+ label: a.label,
1033
+ value: a.value
1035
1034
  }, null, 8, ["label", "value"]))), 128))
1036
1035
  ]),
1037
1036
  _: 2
@@ -1041,26 +1040,26 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1041
1040
  _: 2
1042
1041
  }, 1032, ["label"])) : C("", !0)
1043
1042
  ], 64))), 128)),
1044
- k(a.$slots, "search-center", {
1043
+ k(s.$slots, "search-center", {
1045
1044
  row: e.search.form
1046
1045
  }),
1047
- v(d(M), null, {
1048
- default: b(() => [
1049
- p.option.tools?.search ? (f(), g(d(O), {
1046
+ v(u(_), null, {
1047
+ default: h(() => [
1048
+ f.option.tools?.search ? (p(), g(u(S), {
1050
1049
  key: 0,
1051
1050
  type: "primary",
1052
1051
  onClick: e.search.submit
1053
1052
  }, {
1054
- default: b(() => [...o[7] || (o[7] = [
1053
+ default: h(() => [...l[7] || (l[7] = [
1055
1054
  V(" 搜索 ", -1)
1056
1055
  ])]),
1057
1056
  _: 1
1058
1057
  }, 8, ["onClick"])) : C("", !0),
1059
- p.option.tools?.reset ? (f(), g(d(O), {
1058
+ f.option.tools?.reset ? (p(), g(u(S), {
1060
1059
  key: 1,
1061
1060
  onClick: e.search.reset
1062
1061
  }, {
1063
- default: b(() => [...o[8] || (o[8] = [
1062
+ default: h(() => [...l[8] || (l[8] = [
1064
1063
  V("重置", -1)
1065
1064
  ])]),
1066
1065
  _: 1
@@ -1068,69 +1067,69 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1068
1067
  ]),
1069
1068
  _: 1
1070
1069
  }),
1071
- k(a.$slots, "search-end", {
1070
+ k(s.$slots, "search-end", {
1072
1071
  row: e.search.form
1073
1072
  })
1074
1073
  ]),
1075
1074
  _: 3
1076
1075
  }, 8, ["model"])
1077
1076
  ])) : C("", !0),
1078
- S("div", Ee, [
1079
- S("div", Ue, [
1080
- d(s)(p.option.tools?.add) ? (f(), w("div", xe, [
1081
- v(d(O), {
1077
+ U("div", Ee, [
1078
+ U("div", Ue, [
1079
+ u(n)(f.option.tools?.add) ? (p(), w("div", xe, [
1080
+ v(u(S), {
1082
1081
  type: "primary",
1083
- onClick: o[0] || (o[0] = (t) => e.update.open(d(r).Insert))
1082
+ onClick: l[0] || (l[0] = (t) => e.update.open(u(i).Insert))
1084
1083
  }, {
1085
- default: b(() => [...o[9] || (o[9] = [
1084
+ default: h(() => [...l[9] || (l[9] = [
1086
1085
  V("新增", -1)
1087
1086
  ])]),
1088
1087
  _: 1
1089
1088
  })
1090
1089
  ])) : C("", !0),
1091
- p.option.table?.selectable && d(s)(p.option.tools?.delete) ? (f(), w("div", $e, [
1092
- v(d(O), {
1090
+ f.option.table?.selectable && u(n)(f.option.tools?.delete) ? (p(), w("div", $e, [
1091
+ v(u(S), {
1093
1092
  type: "danger",
1094
- onClick: o[1] || (o[1] = (t) => e.remove.open(e.table.selection.list))
1093
+ onClick: l[1] || (l[1] = (t) => e.remove.open(e.table.selection.list))
1095
1094
  }, {
1096
- default: b(() => [...o[10] || (o[10] = [
1095
+ default: h(() => [...l[10] || (l[10] = [
1097
1096
  V(" 删除 ", -1)
1098
1097
  ])]),
1099
1098
  _: 1
1100
1099
  })
1101
1100
  ])) : C("", !0),
1102
- p.option.tools?.expand ? (f(), w("div", Oe, [
1103
- v(d(O), {
1101
+ f.option.tools?.expand ? (p(), w("div", Oe, [
1102
+ v(u(S), {
1104
1103
  type: "warning",
1105
- onClick: o[2] || (o[2] = (t) => e.table.expand.all())
1104
+ onClick: l[2] || (l[2] = (t) => e.table.expand.all())
1106
1105
  }, {
1107
- default: b(() => [...o[11] || (o[11] = [
1106
+ default: h(() => [...l[11] || (l[11] = [
1108
1107
  V("展开/收缩", -1)
1109
1108
  ])]),
1110
1109
  _: 1
1111
1110
  })
1112
1111
  ])) : C("", !0),
1113
- p.option.tools?.export?.show ? (f(), g(d(ue), {
1112
+ f.option.tools?.export?.show ? (p(), g(u(ue), {
1114
1113
  key: 3,
1115
1114
  onCommand: e.table.export
1116
1115
  }, {
1117
- dropdown: b(() => [
1118
- v(d(fe), null, {
1119
- default: b(() => [
1120
- v(d(P), { command: "select" }, {
1121
- default: b(() => [...o[13] || (o[13] = [
1116
+ dropdown: h(() => [
1117
+ v(u(pe), null, {
1118
+ default: h(() => [
1119
+ v(u(B), { command: "select" }, {
1120
+ default: h(() => [...l[13] || (l[13] = [
1122
1121
  V("导出选中", -1)
1123
1122
  ])]),
1124
1123
  _: 1
1125
1124
  }),
1126
- v(d(P), { command: "page" }, {
1127
- default: b(() => [...o[14] || (o[14] = [
1125
+ v(u(B), { command: "page" }, {
1126
+ default: h(() => [...l[14] || (l[14] = [
1128
1127
  V("导出本页", -1)
1129
1128
  ])]),
1130
1129
  _: 1
1131
1130
  }),
1132
- v(d(P), { command: "all" }, {
1133
- default: b(() => [...o[15] || (o[15] = [
1131
+ v(u(B), { command: "all" }, {
1132
+ default: h(() => [...l[15] || (l[15] = [
1134
1133
  V("导出全部", -1)
1135
1134
  ])]),
1136
1135
  _: 1
@@ -1139,10 +1138,10 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1139
1138
  _: 1
1140
1139
  })
1141
1140
  ]),
1142
- default: b(() => [
1143
- S("div", Se, [
1144
- v(d(O), { type: "warning" }, {
1145
- default: b(() => [...o[12] || (o[12] = [
1141
+ default: h(() => [
1142
+ U("div", Se, [
1143
+ v(u(S), { type: "warning" }, {
1144
+ default: h(() => [...l[12] || (l[12] = [
1146
1145
  V("导出", -1)
1147
1146
  ])]),
1148
1147
  _: 1
@@ -1151,114 +1150,114 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1151
1150
  ]),
1152
1151
  _: 1
1153
1152
  }, 8, ["onCommand"])) : C("", !0),
1154
- k(a.$slots, "tools-left")
1153
+ k(s.$slots, "tools-left")
1155
1154
  ]),
1156
- S("div", Fe, [
1157
- k(a.$slots, "tools-right")
1155
+ U("div", Fe, [
1156
+ k(s.$slots, "tools-right")
1158
1157
  ])
1159
1158
  ]),
1160
- S("div", Ie, [
1161
- S("div", Le, [
1162
- re((f(), g(d(pe), D({
1159
+ U("div", Ie, [
1160
+ U("div", Le, [
1161
+ re((p(), g(u(fe), D({
1163
1162
  data: e.table.data
1164
- }, p.option.table, {
1163
+ }, f.option.table, {
1165
1164
  onSelectionChange: e.table.selection.change,
1166
1165
  "expand-row-keys": e.table.expand.rowKeys,
1167
1166
  onExpandChange: e.table.expand.change
1168
1167
  }), {
1169
- default: b(() => [
1170
- p.option.table?.selectable && d(s)(p.option.tools?.delete) ? (f(), g(d(B), {
1168
+ default: h(() => [
1169
+ f.option.table?.selectable && u(n)(f.option.tools?.delete) ? (p(), g(u(W), {
1171
1170
  key: 0,
1172
1171
  type: "selection",
1173
- selectable: typeof p.option.table?.selectable == "function" ? p.option.table?.selectable : void 0,
1172
+ selectable: typeof f.option.table?.selectable == "function" ? f.option.table?.selectable : void 0,
1174
1173
  width: "55"
1175
1174
  }, null, 8, ["selectable"])) : C("", !0),
1176
- (f(!0), w(x, null, F(e.table.column.list, (t) => (f(), w(x, {
1175
+ (p(!0), w($, null, I(e.table.column.list, (t) => (p(), w($, {
1177
1176
  key: t.key
1178
1177
  }, [
1179
- e.table.column.show.list.includes(t.key) ? (f(), g(d(B), D({
1178
+ e.table.column.show.list.includes(t.key) ? (p(), g(u(W), D({
1180
1179
  key: 0,
1181
1180
  prop: t.key,
1182
1181
  label: t.label
1183
1182
  }, { ref_for: !0 }, t.table), {
1184
- default: b(({ row: l }) => [
1185
- k(a.$slots, "table-" + t.key, {
1186
- row: l,
1183
+ default: h(({ row: a }) => [
1184
+ k(s.$slots, "table-" + t.key, {
1185
+ row: a,
1187
1186
  item: t
1188
1187
  }, () => [
1189
- t.type === "switch" ? (f(), g(d(H), D({
1188
+ t.type === "switch" ? (p(), g(u(H), D({
1190
1189
  key: 0,
1191
- modelValue: l[t.key],
1192
- "onUpdate:modelValue": (h) => l[t.key] = h,
1193
- "before-change": () => t.options?.switch?.tableBeforeChange?.(t.key, l)
1194
- }, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (f(), w(x, { key: 1 }, [
1195
- V(A(l[t.key]), 1)
1190
+ modelValue: a[t.key],
1191
+ "onUpdate:modelValue": (b) => a[t.key] = b,
1192
+ "before-change": () => t.options?.switch?.tableBeforeChange?.(t.key, a)
1193
+ }, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (p(), w($, { key: 1 }, [
1194
+ V(A(a[t.key]), 1)
1196
1195
  ], 64))
1197
1196
  ])
1198
1197
  ]),
1199
1198
  _: 2
1200
1199
  }, 1040, ["prop", "label"])) : C("", !0)
1201
1200
  ], 64))), 128)),
1202
- d(s)(p.option.tools?.add) || d(s)(p.option.tools?.update) || d(s)(p.option.tools?.delete) || a.$slots["table-op-left"] || a.$slots["table-op-right"] ? (f(), g(d(B), {
1201
+ 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"] ? (p(), g(u(W), {
1203
1202
  key: 1,
1204
1203
  label: "操作",
1205
1204
  width: "180",
1206
1205
  align: "center",
1207
1206
  fixed: "right"
1208
1207
  }, {
1209
- default: b(({ row: t }) => [
1210
- k(a.$slots, "table-op-left", { row: t }),
1211
- d(s)(p.option.tools?.add, t) ? (f(), g(d(O), {
1208
+ default: h(({ row: t }) => [
1209
+ k(s.$slots, "table-op-left", { row: t }),
1210
+ u(n)(f.option.tools?.add, t) ? (p(), g(u(S), {
1212
1211
  key: 0,
1213
1212
  link: "",
1214
1213
  type: "primary",
1215
- onClick: (l) => e.update.open(d(r).Insert, t)
1214
+ onClick: (a) => e.update.open(u(i).Insert, t)
1216
1215
  }, {
1217
- default: b(() => [...o[16] || (o[16] = [
1216
+ default: h(() => [...l[16] || (l[16] = [
1218
1217
  V(" 新增 ", -1)
1219
1218
  ])]),
1220
1219
  _: 1
1221
1220
  }, 8, ["onClick"])) : C("", !0),
1222
- d(s)(p.option.tools?.update, t) ? (f(), g(d(O), {
1221
+ u(n)(f.option.tools?.update, t) ? (p(), g(u(S), {
1223
1222
  key: 1,
1224
1223
  link: "",
1225
1224
  type: "warning",
1226
- onClick: (l) => e.update.open(d(r).Update, t)
1225
+ onClick: (a) => e.update.open(u(i).Update, t)
1227
1226
  }, {
1228
- default: b(() => [...o[17] || (o[17] = [
1227
+ default: h(() => [...l[17] || (l[17] = [
1229
1228
  V(" 编辑 ", -1)
1230
1229
  ])]),
1231
1230
  _: 1
1232
1231
  }, 8, ["onClick"])) : C("", !0),
1233
- d(s)(p.option.tools?.delete, t) ? (f(), g(d(O), {
1232
+ u(n)(f.option.tools?.delete, t) ? (p(), g(u(S), {
1234
1233
  key: 2,
1235
1234
  link: "",
1236
1235
  type: "danger",
1237
- onClick: (l) => e.remove.open([t])
1236
+ onClick: (a) => e.remove.open([t])
1238
1237
  }, {
1239
- default: b(() => [...o[18] || (o[18] = [
1238
+ default: h(() => [...l[18] || (l[18] = [
1240
1239
  V(" 删除 ", -1)
1241
1240
  ])]),
1242
1241
  _: 1
1243
1242
  }, 8, ["onClick"])) : C("", !0),
1244
- k(a.$slots, "table-op-right", { row: t })
1243
+ k(s.$slots, "table-op-right", { row: t })
1245
1244
  ]),
1246
1245
  _: 3
1247
1246
  })) : C("", !0)
1248
1247
  ]),
1249
1248
  _: 3
1250
1249
  }, 16, ["data", "onSelectionChange", "expand-row-keys", "onExpandChange"])), [
1251
- [u, e.table.loading]
1250
+ [o, e.table.loading]
1252
1251
  ])
1253
1252
  ])
1254
1253
  ]),
1255
- S("div", je, [
1256
- e.page.total > e.page.size ? (f(), g(d(ce), {
1254
+ U("div", je, [
1255
+ e.page.total > e.page.size ? (p(), g(u(ce), {
1257
1256
  key: 0,
1258
1257
  "current-page": e.page.num,
1259
- "onUpdate:currentPage": o[3] || (o[3] = (t) => e.page.num = t),
1258
+ "onUpdate:currentPage": l[3] || (l[3] = (t) => e.page.num = t),
1260
1259
  "page-size": e.page.size,
1261
- "onUpdate:pageSize": o[4] || (o[4] = (t) => e.page.size = t),
1260
+ "onUpdate:pageSize": l[4] || (l[4] = (t) => e.page.size = t),
1262
1261
  background: "",
1263
1262
  "page-sizes": e.page.sizeList,
1264
1263
  "pager-count": 7,
@@ -1269,134 +1268,138 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1269
1268
  }, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total", "onSizeChange", "onCurrentChange"])) : C("", !0)
1270
1269
  ])
1271
1270
  ]),
1272
- k(a.$slots, "box-right")
1271
+ k(s.$slots, "box-right")
1273
1272
  ]),
1274
- v(d(G), D({
1273
+ v(u(G), D({
1275
1274
  modelValue: e.update.show,
1276
- "onUpdate:modelValue": o[5] || (o[5] = (t) => e.update.show = t),
1275
+ "onUpdate:modelValue": l[5] || (l[5] = (t) => e.update.show = t),
1277
1276
  title: e.update.title,
1278
1277
  "close-on-click-modal": !1,
1279
1278
  "before-close": e.update.close
1280
- }, p.option.dialog), {
1281
- footer: b(() => [
1282
- S("span", Te, [
1283
- v(d(O), {
1279
+ }, f.option.dialog), {
1280
+ footer: h(() => [
1281
+ U("span", Me, [
1282
+ v(u(S), {
1284
1283
  onClick: e.update.close
1285
1284
  }, {
1286
- default: b(() => [...o[19] || (o[19] = [
1285
+ default: h(() => [...l[19] || (l[19] = [
1287
1286
  V("关闭", -1)
1288
1287
  ])]),
1289
1288
  _: 1
1290
1289
  }, 8, ["onClick"]),
1291
- v(d(O), {
1290
+ v(u(S), {
1292
1291
  type: "primary",
1293
1292
  onClick: e.update.submit,
1294
1293
  loading: e.update.loading
1295
1294
  }, {
1296
- default: b(() => [...o[20] || (o[20] = [
1295
+ default: h(() => [...l[20] || (l[20] = [
1297
1296
  V(" 提交 ", -1)
1298
1297
  ])]),
1299
1298
  _: 1
1300
1299
  }, 8, ["onClick", "loading"])
1301
1300
  ])
1302
1301
  ]),
1303
- default: b(() => [
1304
- v(d(J), {
1302
+ default: h(() => [
1303
+ v(u(J), {
1305
1304
  ref_key: "ruleFormRef",
1306
1305
  ref: m,
1307
1306
  model: e.update.form,
1308
1307
  rules: e.update.rules
1309
1308
  }, {
1310
- default: b(() => [
1311
- e.update.showContent ? (f(!0), w(x, { key: 0 }, F(e.update.formColumn, (t) => (f(), w("div", ze, [
1312
- k(a.$slots, "form-start", {
1309
+ default: h(() => [
1310
+ e.update.showContent ? (p(!0), w($, { key: 0 }, I(e.update.formColumn, (t) => (p(), w("div", ze, [
1311
+ k(s.$slots, "form-start", {
1313
1312
  row: e.update.form
1314
1313
  }),
1315
- (f(!0), w(x, null, F(t, (l) => (f(), w(x, null, [
1316
- d(s)(l.item.show?.form, e.update.form) ? (f(), w("div", {
1314
+ (p(!0), w($, null, I(t, (a) => (p(), w($, null, [
1315
+ u(n)(a.item.show?.form, e.update.form) ? (p(), w("div", {
1317
1316
  key: 0,
1318
- class: X(l.item.form.span > 0 ? `col-${l.item.form.span}` : "col")
1317
+ class: X(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
1319
1318
  }, [
1320
- v(d(M), {
1321
- label: l.item.label,
1322
- prop: l.item.key,
1323
- "label-width": l.item.form?.labelWidth || "100px"
1319
+ v(u(_), {
1320
+ label: a.item.label,
1321
+ prop: a.item.key,
1322
+ "label-width": a.item.form?.labelWidth || "100px"
1324
1323
  }, {
1325
- default: b(() => [
1326
- k(a.$slots, "form-" + l.item.key + "-start", {
1327
- row: e.update.form,
1328
- item: l.item
1329
- }),
1330
- k(a.$slots, "form-" + l.item.key, {
1331
- row: e.update.form,
1332
- item: l.item
1333
- }, () => [
1334
- l.item.type === "input" ? (f(), g(d(K), D({
1335
- key: 0,
1336
- modelValue: e.update.form[l.item.key],
1337
- "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1338
- }, { ref_for: !0 }, l.item.options?.input, Y(l.item.options?.input?.on), {
1339
- disabled: e.update.getDisabled(l.item)
1340
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (f(), g(d(H), D({
1341
- key: 1,
1342
- modelValue: e.update.form[l.item.key],
1343
- "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1344
- }, { ref_for: !0 }, l.item.options?.switch, {
1345
- disabled: e.update.getDisabled(l.item)
1346
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (f(), g(d(_), D({
1347
- key: 2,
1348
- modelValue: e.update.form[l.item.key],
1349
- "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1350
- }, { ref_for: !0 }, l.item.options?.select, {
1351
- disabled: e.update.getDisabled(l.item),
1352
- style: { width: "100%" }
1353
- }), {
1354
- default: b(() => [
1355
- (f(!0), w(x, null, F(l.item.options?.select?.data, (h) => (f(), g(d(R), {
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"])) : l.item.type === "list" ? (f(), g(oe, D({
1363
- key: 3,
1324
+ default: h(() => [
1325
+ U("div", Te, [
1326
+ k(s.$slots, "form-" + a.item.key + "-start", {
1364
1327
  row: e.update.form,
1365
- field: l.item.key
1366
- }, { ref_for: !0 }, l.item.options?.list, {
1367
- disabled: e.update.getDisabled(l.item),
1368
- style: { width: "100%" }
1369
- }), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (f(), g(d(te), D({
1370
- key: 4,
1371
- modelValue: e.update.form[l.item.key],
1372
- "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1373
- }, { ref_for: !0 }, l.item.options?.treeSelect, {
1374
- disabled: e.update.getDisabled(l.item),
1375
- style: { width: "100%" }
1376
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (f(), g(d(le), D({
1377
- key: 5,
1378
- modelValue: e.update.form[l.item.key],
1379
- "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1380
- }, { ref_for: !0 }, l.item.options?.datetime, {
1381
- disabled: e.update.getDisabled(l.item)
1382
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : d(L).customComponent[l.item.type] ? (f(), g(Z(d(L).customComponent[l.item.type]), D({
1383
- key: 6,
1384
- modelValue: e.update.form[l.item.key],
1385
- "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1386
- }, { ref_for: !0 }, l.item.options?.[l.item.type], {
1387
- disabled: e.update.getDisabled(l.item)
1388
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
1389
- ]),
1390
- k(a.$slots, "form-" + l.item.key + "-end", {
1391
- row: e.update.form,
1392
- item: l.item
1393
- })
1328
+ item: a.item
1329
+ }),
1330
+ U("div", Re, [
1331
+ k(s.$slots, "form-" + a.item.key, {
1332
+ row: e.update.form,
1333
+ item: a.item
1334
+ }, () => [
1335
+ a.item.type === "input" ? (p(), g(u(K), D({
1336
+ key: 0,
1337
+ modelValue: e.update.form[a.item.key],
1338
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1339
+ }, { ref_for: !0 }, a.item.options?.input, F(a.item.options?.input?.on || {}), {
1340
+ disabled: e.update.getDisabled(a.item)
1341
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "switch" ? (p(), g(u(H), D({
1342
+ key: 1,
1343
+ modelValue: e.update.form[a.item.key],
1344
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1345
+ }, { ref_for: !0 }, a.item.options?.switch, {
1346
+ disabled: e.update.getDisabled(a.item)
1347
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (p(), g(u(N), D({
1348
+ key: 2,
1349
+ modelValue: e.update.form[a.item.key],
1350
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1351
+ }, { ref_for: !0 }, a.item.options?.select, F(a.item.options?.select?.on || {}), {
1352
+ disabled: e.update.getDisabled(a.item),
1353
+ style: { width: "100%" }
1354
+ }), {
1355
+ default: h(() => [
1356
+ (p(!0), w($, null, I(a.item.options?.select?.data, (b) => (p(), g(u(M), {
1357
+ key: b.value,
1358
+ label: b.label,
1359
+ value: b.value
1360
+ }, null, 8, ["label", "value"]))), 128))
1361
+ ]),
1362
+ _: 2
1363
+ }, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "list" ? (p(), g(Q, D({
1364
+ key: 3,
1365
+ row: e.update.form,
1366
+ field: a.item.key
1367
+ }, { ref_for: !0 }, a.item.options?.list, F(a.item.options?.list?.on || {}), {
1368
+ disabled: e.update.getDisabled(a.item),
1369
+ style: { width: "100%" }
1370
+ }), null, 16, ["row", "field", "disabled"])) : a.item.type === "tree-select" ? (p(), g(u(oe), D({
1371
+ key: 4,
1372
+ modelValue: e.update.form[a.item.key],
1373
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1374
+ }, { ref_for: !0 }, a.item.options?.treeSelect, F(a.item.options?.treeSelect?.on || {}), {
1375
+ disabled: e.update.getDisabled(a.item),
1376
+ style: { width: "100%" }
1377
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "datetime" ? (p(), g(u(le), D({
1378
+ key: 5,
1379
+ modelValue: e.update.form[a.item.key],
1380
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1381
+ }, { ref_for: !0 }, a.item.options?.datetime, F(a.item.options?.datetime?.on || {}), {
1382
+ disabled: e.update.getDisabled(a.item)
1383
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(j).customComponent[a.item.type] ? (p(), g(te(u(j).customComponent[a.item.type]), D({
1384
+ key: 6,
1385
+ modelValue: e.update.form[a.item.key],
1386
+ "onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
1387
+ }, { ref_for: !0 }, a.item.options?.[a.item.type], F(a.item.options?.[a.item.type]?.on || {}), {
1388
+ disabled: e.update.getDisabled(a.item)
1389
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
1390
+ ])
1391
+ ]),
1392
+ k(s.$slots, "form-" + a.item.key + "-end", {
1393
+ row: e.update.form,
1394
+ item: a.item
1395
+ })
1396
+ ])
1394
1397
  ]),
1395
1398
  _: 2
1396
1399
  }, 1032, ["label", "prop", "label-width"])
1397
1400
  ], 2)) : C("", !0)
1398
1401
  ], 64))), 256)),
1399
- k(a.$slots, "form-end", {
1402
+ k(s.$slots, "form-end", {
1400
1403
  row: e.update.form
1401
1404
  })
1402
1405
  ]))), 256)) : C("", !0)
@@ -1406,36 +1409,36 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1406
1409
  ]),
1407
1410
  _: 3
1408
1411
  }, 16, ["modelValue", "title", "before-close"]),
1409
- v(d(G), {
1412
+ v(u(G), {
1410
1413
  modelValue: e.remove.show,
1411
- "onUpdate:modelValue": o[6] || (o[6] = (t) => e.remove.show = t),
1414
+ "onUpdate:modelValue": l[6] || (l[6] = (t) => e.remove.show = t),
1412
1415
  title: e.remove.title,
1413
1416
  "close-on-click-modal": !1
1414
1417
  }, {
1415
- footer: b(() => [
1416
- S("span", Re, [
1417
- v(d(O), {
1418
+ footer: h(() => [
1419
+ U("span", _e, [
1420
+ v(u(S), {
1418
1421
  onClick: e.remove.close
1419
1422
  }, {
1420
- default: b(() => [...o[21] || (o[21] = [
1423
+ default: h(() => [...l[21] || (l[21] = [
1421
1424
  V("关闭", -1)
1422
1425
  ])]),
1423
1426
  _: 1
1424
1427
  }, 8, ["onClick"]),
1425
- v(d(O), {
1428
+ v(u(S), {
1426
1429
  type: "danger",
1427
1430
  onClick: e.remove.submit,
1428
1431
  loading: e.remove.loading
1429
1432
  }, {
1430
- default: b(() => [...o[22] || (o[22] = [
1433
+ default: h(() => [...l[22] || (l[22] = [
1431
1434
  V(" 确认删除 ", -1)
1432
1435
  ])]),
1433
1436
  _: 1
1434
1437
  }, 8, ["onClick", "loading"])
1435
1438
  ])
1436
1439
  ]),
1437
- default: b(() => [
1438
- S("div", null, "确认要删除【" + A(e.remove.items.length) + "】条数据吗?", 1)
1440
+ default: h(() => [
1441
+ U("div", null, "确认要删除【" + A(e.remove.items.length) + "】条数据吗?", 1)
1439
1442
  ]),
1440
1443
  _: 1
1441
1444
  }, 8, ["modelValue", "title"]),
@@ -1446,20 +1449,20 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ N({
1446
1449
  ]);
1447
1450
  };
1448
1451
  }
1449
- }), Pe = (p, i) => {
1450
- if (p.component("TCurd", Me), p.component("TFormList", oe), p.component("TColumn", be), i?.customComponent) {
1451
- L.customComponent = i.customComponent;
1452
- for (const r in i.customComponent)
1453
- p.component(r, i.customComponent[r]);
1452
+ }), We = (f, d) => {
1453
+ if (f.component("TCurd", Ne), f.component("TFormList", Q), f.component("TColumn", ye), d?.customComponent) {
1454
+ j.customComponent = d.customComponent;
1455
+ for (const i in d.customComponent)
1456
+ f.component(i, d.customComponent[i]);
1454
1457
  }
1455
1458
  };
1456
1459
  export {
1457
- I as ArrUtil,
1460
+ L as ArrUtil,
1458
1461
  ge as ExcelUtil,
1459
- be as TColumn,
1460
- Me as TCurd,
1461
- L as TForm,
1462
- oe as TFormList,
1463
- $ as TSys,
1464
- Pe as install
1462
+ ye as TColumn,
1463
+ Ne as TCurd,
1464
+ j as TForm,
1465
+ Q as TFormList,
1466
+ O as TSys,
1467
+ We as install
1465
1468
  };