cc1-form 1.0.0

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