cc1-form 1.1.24 → 1.1.26
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 +244 -197
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +5 -10
- package/dist/components/TCurd/index.d.ts +9 -0
- package/dist/components/TCurd/index.vue.d.ts +47 -29
- package/dist/components/TCurd/indexType.d.ts +4 -0
- package/dist/utils/TFormConfig.d.ts +26 -0
- package/package.json +1 -1
package/dist/cc1-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ElMessage as ue, ElLoading as ce, ElForm as Q, ElFormItem as J, ElInput as q, ElSwitch as _, ElSelect as W, ElOption as
|
|
2
|
-
import { defineComponent as
|
|
1
|
+
import { ElMessage as ue, ElLoading as ce, ElForm as Q, ElFormItem as J, ElInput as q, ElSwitch as _, ElSelect as W, ElOption as K, ElTreeSelect as ae, ElDatePicker as ee, ElDialog as Y, ElButton as F, ElTableColumn as Z, ElDropdown as fe, ElDropdownMenu as me, ElDropdownItem as X, ElTable as pe, ElPagination as he } from "element-plus";
|
|
2
|
+
import { defineComponent as B, reactive as te, onMounted as ne, resolveComponent as H, createElementBlock as w, createCommentVNode as v, openBlock as m, renderSlot as k, createElementVNode as $, createVNode as V, withCtx as h, createTextVNode as E, Fragment as D, renderList as I, createBlock as b, normalizeClass as T, normalizeStyle as ie, ref as N, nextTick as be, unref as o, mergeProps as C, toHandlers as O, resolveDynamicComponent as G, toDisplayString as x, getCurrentInstance as ye, createSlots as re, withKeys as ge, resolveDirective as we, withDirectives as ke, normalizeProps as ve, guardReactiveProps as Ce } from "vue";
|
|
3
3
|
class U {
|
|
4
4
|
/**
|
|
5
5
|
* Vue Router 实例,需在应用初始化时赋值
|
|
@@ -25,13 +25,13 @@ class U {
|
|
|
25
25
|
* @param data 数据
|
|
26
26
|
* @returns 是否显示
|
|
27
27
|
*/
|
|
28
|
-
static isFun = (
|
|
28
|
+
static isFun = (r, ...s) => Array.isArray(r) ? r.some((l) => typeof l == "function" ? l(...s) : l) : typeof r == "function" ? r(...s) : r;
|
|
29
29
|
/**
|
|
30
30
|
* 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
|
|
31
31
|
*/
|
|
32
32
|
static getRouterParams = () => {
|
|
33
|
-
const
|
|
34
|
-
return Object.keys(
|
|
33
|
+
const r = this.router.currentRoute.value.query || {}, s = this.router.currentRoute.value.params || {};
|
|
34
|
+
return Object.keys(r).length ? r : Object.keys(s).length ? s : {};
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* 模块赋值
|
|
@@ -41,11 +41,11 @@ class U {
|
|
|
41
41
|
* 加载模块
|
|
42
42
|
* @param module
|
|
43
43
|
*/
|
|
44
|
-
static loadModule = async (
|
|
45
|
-
if (!U.moduleObj[
|
|
46
|
-
throw new Error(`模块${
|
|
47
|
-
const
|
|
48
|
-
return
|
|
44
|
+
static loadModule = async (r) => {
|
|
45
|
+
if (!U.moduleObj[r])
|
|
46
|
+
throw new Error(`模块${r}未加载,请赋值如:TSys.moduleObj = { ${r}: ()=>import('${r}') }`);
|
|
47
|
+
const s = await U.moduleObj[r]();
|
|
48
|
+
return s.default ?? s;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* 提示信息对象管理
|
|
@@ -61,19 +61,19 @@ class U {
|
|
|
61
61
|
* @param type 消息类型
|
|
62
62
|
* @param options 其他选项
|
|
63
63
|
*/
|
|
64
|
-
static showMessage(
|
|
64
|
+
static showMessage(r, s, l = {}) {
|
|
65
65
|
const n = Date.now();
|
|
66
|
-
if (!this.tipMessages[
|
|
67
|
-
this.tipMessages[
|
|
66
|
+
if (!this.tipMessages[r] || n - this.tipMessages[r] > this.tipMessagesGap) {
|
|
67
|
+
this.tipMessages[r] = n;
|
|
68
68
|
const e = Object.assign(
|
|
69
69
|
{
|
|
70
|
-
message:
|
|
71
|
-
type:
|
|
70
|
+
message: r,
|
|
71
|
+
type: s
|
|
72
72
|
},
|
|
73
73
|
l
|
|
74
74
|
);
|
|
75
75
|
ue(e), setTimeout(() => {
|
|
76
|
-
delete this.tipMessages[
|
|
76
|
+
delete this.tipMessages[r];
|
|
77
77
|
}, this.tipMessagesGap);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -82,16 +82,16 @@ class U {
|
|
|
82
82
|
* @param content
|
|
83
83
|
* @param options
|
|
84
84
|
*/
|
|
85
|
-
static fail = (
|
|
86
|
-
this.showMessage(
|
|
85
|
+
static fail = (r, s = {}) => {
|
|
86
|
+
this.showMessage(r, "error", s);
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* 成功提示
|
|
90
90
|
* @param content
|
|
91
91
|
* @param options
|
|
92
92
|
*/
|
|
93
|
-
static success = (
|
|
94
|
-
this.showMessage(
|
|
93
|
+
static success = (r, s = {}) => {
|
|
94
|
+
this.showMessage(r, "success", s);
|
|
95
95
|
};
|
|
96
96
|
static loadingObj = null;
|
|
97
97
|
static loadingTimer = null;
|
|
@@ -100,11 +100,11 @@ class U {
|
|
|
100
100
|
* @param show
|
|
101
101
|
* @param text
|
|
102
102
|
*/
|
|
103
|
-
static loading = (
|
|
103
|
+
static loading = (r = !0, s = "Loading...") => {
|
|
104
104
|
Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
|
|
105
|
-
|
|
105
|
+
r ? this.loadingObj = ce.service({
|
|
106
106
|
lock: !0,
|
|
107
|
-
text:
|
|
107
|
+
text: s,
|
|
108
108
|
background: "rgba(0, 0, 0, 0.3)"
|
|
109
109
|
}) : this.loadingObj && (this.loadingObj.close(), this.loadingObj = null);
|
|
110
110
|
}, 50);
|
|
@@ -114,17 +114,17 @@ class U {
|
|
|
114
114
|
* @param url 地址
|
|
115
115
|
* @param isCenter 是否居中
|
|
116
116
|
*/
|
|
117
|
-
static openUrl = (
|
|
118
|
-
if (
|
|
117
|
+
static openUrl = (r, s = !0) => {
|
|
118
|
+
if (s) {
|
|
119
119
|
let l = screen.width / 2 - 500, n = screen.height / 2 - 800 / 2 - 30;
|
|
120
120
|
window.open(
|
|
121
|
-
|
|
121
|
+
r,
|
|
122
122
|
"_blank",
|
|
123
123
|
"toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + n + ", left=" + l
|
|
124
124
|
);
|
|
125
125
|
} else
|
|
126
126
|
window.open(
|
|
127
|
-
|
|
127
|
+
r,
|
|
128
128
|
"DescriptiveWindowName" + StrUtil.getId(),
|
|
129
129
|
"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0"
|
|
130
130
|
);
|
|
@@ -134,23 +134,23 @@ class U {
|
|
|
134
134
|
* @param param
|
|
135
135
|
* @returns
|
|
136
136
|
*/
|
|
137
|
-
static getImgPic = (
|
|
138
|
-
let n = document.getElementById(
|
|
137
|
+
static getImgPic = (r) => new Promise(async (s, l) => {
|
|
138
|
+
let n = document.getElementById(r.id);
|
|
139
139
|
const e = await U.loadModule("html2canvas");
|
|
140
140
|
try {
|
|
141
141
|
e(n, {
|
|
142
142
|
logging: !1,
|
|
143
143
|
allowTaint: !0,
|
|
144
144
|
scale: window.devicePixelRatio,
|
|
145
|
-
width:
|
|
146
|
-
height:
|
|
147
|
-
windowWidth:
|
|
148
|
-
windowHeight:
|
|
145
|
+
width: r.windowWidth,
|
|
146
|
+
height: r.windowHeight,
|
|
147
|
+
windowWidth: r.windowWidth,
|
|
148
|
+
windowHeight: r.windowHeight,
|
|
149
149
|
useCORS: !0,
|
|
150
150
|
backgroundColor: "#ffffff00"
|
|
151
151
|
}).then(function(a) {
|
|
152
152
|
let u = a.toDataURL("image/png");
|
|
153
|
-
|
|
153
|
+
s(u);
|
|
154
154
|
});
|
|
155
155
|
} catch (a) {
|
|
156
156
|
l(a);
|
|
@@ -316,7 +316,28 @@ class S {
|
|
|
316
316
|
/**
|
|
317
317
|
* 行内操作是否显示删除 - 默认显示
|
|
318
318
|
*/
|
|
319
|
-
delete: !0
|
|
319
|
+
delete: !0,
|
|
320
|
+
/** 表格排序配置 */
|
|
321
|
+
sort: {
|
|
322
|
+
/** 排序属性字段配置 */
|
|
323
|
+
props: {
|
|
324
|
+
/** 排序字段名 - 默认sortField */
|
|
325
|
+
field: "sortField"
|
|
326
|
+
},
|
|
327
|
+
/** 排序 */
|
|
328
|
+
order: {
|
|
329
|
+
/** 排序字段名 - 默认sortOrder */
|
|
330
|
+
field: "sortOrder",
|
|
331
|
+
/** 升序字段值 - 默认asc */
|
|
332
|
+
asc: "asc",
|
|
333
|
+
/** 降序字段值 - 默认desc */
|
|
334
|
+
desc: "desc"
|
|
335
|
+
},
|
|
336
|
+
/** 排序触发时是否重置分页,默认不重置 */
|
|
337
|
+
resetPage: !1,
|
|
338
|
+
/** 排序变更回调 传入(row: { column: any; prop: string; order: 'ascending' | 'descending' | null },conf: curdConfType) => void */
|
|
339
|
+
change: void 0
|
|
340
|
+
}
|
|
320
341
|
},
|
|
321
342
|
columnConfig: {
|
|
322
343
|
type: "input",
|
|
@@ -439,11 +460,11 @@ class S {
|
|
|
439
460
|
*
|
|
440
461
|
* @param config - 需要覆盖的配置项(深度 Partial)
|
|
441
462
|
*/
|
|
442
|
-
static setConfig = (
|
|
443
|
-
S.config = ObjectUtil.deepMerge(S.config,
|
|
463
|
+
static setConfig = (r) => {
|
|
464
|
+
S.config = ObjectUtil.deepMerge(S.config, r);
|
|
444
465
|
};
|
|
445
466
|
}
|
|
446
|
-
class
|
|
467
|
+
class z {
|
|
447
468
|
/**
|
|
448
469
|
* 自定义组件映射表,key 为组件名(同时作为 column.type 值),value 为 Vue 组件定义
|
|
449
470
|
*
|
|
@@ -460,8 +481,8 @@ class L {
|
|
|
460
481
|
* @param field - 字段的 key 值
|
|
461
482
|
* @returns 该字段对应类型的 options 配置,如 select 类型返回 `options.select`
|
|
462
483
|
*/
|
|
463
|
-
static findOptions = (
|
|
464
|
-
const l =
|
|
484
|
+
static findOptions = (r, s) => {
|
|
485
|
+
const l = r.column.find((e) => e.key === s), n = (e) => e.replace(/-([a-z])/g, (a, u) => u.toUpperCase());
|
|
465
486
|
if (l)
|
|
466
487
|
return l.options[n(l.type)];
|
|
467
488
|
};
|
|
@@ -481,8 +502,8 @@ class L {
|
|
|
481
502
|
}))
|
|
482
503
|
)
|
|
483
504
|
*/
|
|
484
|
-
static setOptionsData = (
|
|
485
|
-
const n =
|
|
505
|
+
static setOptionsData = (r, s, l) => {
|
|
506
|
+
const n = z.findOptions(r, s);
|
|
486
507
|
n && (n.data = l);
|
|
487
508
|
};
|
|
488
509
|
static form = {
|
|
@@ -494,14 +515,14 @@ class L {
|
|
|
494
515
|
* @param treeData 树形数据
|
|
495
516
|
* @param option 组件配置
|
|
496
517
|
*/
|
|
497
|
-
parentId: (
|
|
518
|
+
parentId: (r, s, l, n) => {
|
|
498
519
|
const e = S.config.table.rowKey;
|
|
499
|
-
|
|
520
|
+
r ? s.type === U.EDialog.Insert ? (s.form.parentId = r[e], s.form.sort = r.children.length + 1) : s.form.parentId = r.parentId.substring(r.parentId.lastIndexOf(",") + 1) : (s.form.parentId = "0", s.form.sort = l.length + 1), z.setOptionsData(n, "parentId", [{ [e]: "0", title: "根", children: l }]);
|
|
500
521
|
}
|
|
501
522
|
}
|
|
502
523
|
};
|
|
503
524
|
}
|
|
504
|
-
class
|
|
525
|
+
class P {
|
|
505
526
|
/**
|
|
506
527
|
* ID 生成函数,默认使用 `StrUtil.uuid()`,可覆盖为自定义实现
|
|
507
528
|
*/
|
|
@@ -511,14 +532,14 @@ class R {
|
|
|
511
532
|
* @param field 字段名
|
|
512
533
|
* @param row 行数据
|
|
513
534
|
*/
|
|
514
|
-
static setId = (
|
|
515
|
-
r
|
|
535
|
+
static setId = (r, s, l) => {
|
|
536
|
+
s[r] || (s[r] = []);
|
|
516
537
|
const n = S.config.table.rowKey;
|
|
517
|
-
r
|
|
538
|
+
s[r].forEach((e) => {
|
|
518
539
|
l.forEach((a) => {
|
|
519
540
|
let u = a.default ?? "";
|
|
520
541
|
a.type === "number" && (u = a.default ?? 0), a.type === "boolean" && (u = a.default ?? !1), a.type === "time" && (u = a.default ?? /* @__PURE__ */ new Date()), e[a.value] === void 0 && (e[a.value] = u);
|
|
521
|
-
}), e[n] || (e[n] =
|
|
542
|
+
}), e[n] || (e[n] = P.getIdFun());
|
|
522
543
|
});
|
|
523
544
|
};
|
|
524
545
|
/**
|
|
@@ -528,19 +549,19 @@ class R {
|
|
|
528
549
|
* @param itemFields 元素字段-如:[{label:'',value:''}]
|
|
529
550
|
* @param callback 回调函数
|
|
530
551
|
*/
|
|
531
|
-
static add = (
|
|
552
|
+
static add = (r, s, l, n) => {
|
|
532
553
|
const e = JSONUtil.cp(l);
|
|
533
|
-
|
|
554
|
+
P.setId(r, s, l);
|
|
534
555
|
const a = S.config.table.rowKey;
|
|
535
|
-
r
|
|
556
|
+
s[r].push(
|
|
536
557
|
e.reduce(
|
|
537
558
|
(u, f) => {
|
|
538
559
|
let p = f.default ?? "";
|
|
539
560
|
return f.type === "number" && (p = f.default ?? 0), f.type === "boolean" && (p = f.default ?? !1), f.type === "time" && (p = f.default ?? /* @__PURE__ */ new Date()), u[f.value] = p, u;
|
|
540
561
|
},
|
|
541
|
-
{ [a]:
|
|
562
|
+
{ [a]: P.getIdFun() }
|
|
542
563
|
)
|
|
543
|
-
), n?.(
|
|
564
|
+
), n?.(s);
|
|
544
565
|
};
|
|
545
566
|
/**
|
|
546
567
|
* 删除数组元素
|
|
@@ -549,9 +570,9 @@ class R {
|
|
|
549
570
|
* @param item 元素-如:{_id:''}
|
|
550
571
|
* @param callback 回调函数
|
|
551
572
|
*/
|
|
552
|
-
static remove = (
|
|
573
|
+
static remove = (r, s, l, n) => {
|
|
553
574
|
const e = S.config.table.rowKey;
|
|
554
|
-
r
|
|
575
|
+
s[r] = s[r].filter((a) => a[e] !== l[e]), n?.(s);
|
|
555
576
|
};
|
|
556
577
|
/**
|
|
557
578
|
* 获取没有id的数据
|
|
@@ -559,10 +580,10 @@ class R {
|
|
|
559
580
|
* @param childernField 子级字段-如:list、children
|
|
560
581
|
* @returns 没有id的数据
|
|
561
582
|
*/
|
|
562
|
-
static getNoIdData = (
|
|
563
|
-
const l = JSONUtil.cp(
|
|
583
|
+
static getNoIdData = (r, s) => {
|
|
584
|
+
const l = JSONUtil.cp(r), n = S.config.table.rowKey;
|
|
564
585
|
return l.forEach((e) => {
|
|
565
|
-
e[n] && delete e[n],
|
|
586
|
+
e[n] && delete e[n], s && e[s] && P.getNoIdData(e[s], s);
|
|
566
587
|
}), l;
|
|
567
588
|
};
|
|
568
589
|
}
|
|
@@ -573,7 +594,7 @@ const Ve = {
|
|
|
573
594
|
}, Ee = {
|
|
574
595
|
class: "row items-center",
|
|
575
596
|
style: { gap: "10px", width: "100%" }
|
|
576
|
-
}, oe = /* @__PURE__ */
|
|
597
|
+
}, oe = /* @__PURE__ */ B({
|
|
577
598
|
__name: "list",
|
|
578
599
|
props: {
|
|
579
600
|
row: {
|
|
@@ -608,24 +629,24 @@ const Ve = {
|
|
|
608
629
|
}
|
|
609
630
|
},
|
|
610
631
|
emits: ["change"],
|
|
611
|
-
setup(t, { emit:
|
|
612
|
-
const
|
|
632
|
+
setup(t, { emit: r }) {
|
|
633
|
+
const s = t, l = te({
|
|
613
634
|
show: !1,
|
|
614
635
|
add: (e, a, u) => {
|
|
615
|
-
|
|
636
|
+
P.add(e, a, u, () => {
|
|
616
637
|
n("change");
|
|
617
638
|
});
|
|
618
639
|
},
|
|
619
640
|
remove: (e, a, u) => {
|
|
620
|
-
|
|
641
|
+
P.remove(e, a, u, () => {
|
|
621
642
|
n("change");
|
|
622
643
|
});
|
|
623
644
|
}
|
|
624
645
|
});
|
|
625
646
|
ne(() => {
|
|
626
|
-
|
|
647
|
+
P.setId(s.field, s.row, s.itemFields), l.show = !0;
|
|
627
648
|
});
|
|
628
|
-
const n =
|
|
649
|
+
const n = r;
|
|
629
650
|
return (e, a) => {
|
|
630
651
|
const u = H("el-button"), f = H("el-input");
|
|
631
652
|
return l.show ? (m(), w("div", Ve, [
|
|
@@ -642,12 +663,12 @@ const Ve = {
|
|
|
642
663
|
_: 1
|
|
643
664
|
})
|
|
644
665
|
]),
|
|
645
|
-
(m(!0), w(D, null,
|
|
666
|
+
(m(!0), w(D, null, I(t.row[t.field], (p) => (m(), w("div", Ee, [
|
|
646
667
|
k(e.$slots, "item-start", {
|
|
647
668
|
item: p,
|
|
648
669
|
row: t.row
|
|
649
670
|
}),
|
|
650
|
-
(m(!0), w(D, null,
|
|
671
|
+
(m(!0), w(D, null, I(t.itemFields, (c) => (m(), b(f, {
|
|
651
672
|
modelValue: p[c.value],
|
|
652
673
|
"onUpdate:modelValue": (i) => p[c.value] = i,
|
|
653
674
|
style: ie({ width: t.inputWidth }),
|
|
@@ -674,7 +695,7 @@ const Ve = {
|
|
|
674
695
|
])) : v("", !0);
|
|
675
696
|
};
|
|
676
697
|
}
|
|
677
|
-
}), xe = { class: "row curd-row" }, De = /* @__PURE__ */
|
|
698
|
+
}), xe = { class: "row curd-row" }, De = /* @__PURE__ */ B({
|
|
678
699
|
__name: "column",
|
|
679
700
|
props: {
|
|
680
701
|
/**
|
|
@@ -690,8 +711,8 @@ const Ve = {
|
|
|
690
711
|
default: ""
|
|
691
712
|
}
|
|
692
713
|
},
|
|
693
|
-
setup(t, { expose:
|
|
694
|
-
const
|
|
714
|
+
setup(t, { expose: r }) {
|
|
715
|
+
const s = U.isFun, l = U.EDialog, n = N(), e = t, a = te({
|
|
695
716
|
rules: {},
|
|
696
717
|
show: !0,
|
|
697
718
|
form: {},
|
|
@@ -706,9 +727,9 @@ const Ve = {
|
|
|
706
727
|
const d = (y) => {
|
|
707
728
|
if (a.formDefault[y.key] = y.value, y.isForm) {
|
|
708
729
|
y.form = y.form || { span: c }, y.form.span = y.form.span ?? c;
|
|
709
|
-
let
|
|
710
|
-
const
|
|
711
|
-
i.push({ item: y, span:
|
|
730
|
+
let M = y.form.span, j = i.reduce((R, de) => R + de.span, M);
|
|
731
|
+
const L = i.length;
|
|
732
|
+
i.push({ item: y, span: M }), (L === 1 && i[0].span === 0 || j >= p || M === 0 && L > 1) && (f.push(i), i = []), y.rules && (a.rules[y.key] = y.rules);
|
|
712
733
|
}
|
|
713
734
|
};
|
|
714
735
|
u.column.forEach((y) => {
|
|
@@ -719,7 +740,7 @@ const Ve = {
|
|
|
719
740
|
a.show = !1, await be(), a.initColumnForm();
|
|
720
741
|
}
|
|
721
742
|
});
|
|
722
|
-
return a.initColumnForm(),
|
|
743
|
+
return a.initColumnForm(), r({
|
|
723
744
|
ref: n,
|
|
724
745
|
conf: a
|
|
725
746
|
}), (u, f) => (m(), b(o(Q), {
|
|
@@ -729,12 +750,12 @@ const Ve = {
|
|
|
729
750
|
rules: a.rules
|
|
730
751
|
}, {
|
|
731
752
|
default: h(() => [
|
|
732
|
-
a.show ? (m(!0), w(D, { key: 0 },
|
|
753
|
+
a.show ? (m(!0), w(D, { key: 0 }, I(a.formColumn, (p) => (m(), w("div", xe, [
|
|
733
754
|
k(u.$slots, "form-start", {
|
|
734
755
|
row: a.form
|
|
735
756
|
}),
|
|
736
|
-
(m(!0), w(D, null,
|
|
737
|
-
o(
|
|
757
|
+
(m(!0), w(D, null, I(p, (c) => (m(), w(D, null, [
|
|
758
|
+
o(s)(c.item.show?.form, a.form) ?? !0 ? (m(), w("div", {
|
|
738
759
|
key: 0,
|
|
739
760
|
class: T(c.item.form.span > 0 ? `col-${c.item.form.span}` : "col")
|
|
740
761
|
}, [
|
|
@@ -773,7 +794,7 @@ const Ve = {
|
|
|
773
794
|
style: { width: "100%" }
|
|
774
795
|
}), {
|
|
775
796
|
default: h(() => [
|
|
776
|
-
(m(!0), w(D, null,
|
|
797
|
+
(m(!0), w(D, null, I(c.item.options?.select?.data, (i) => (m(), b(o(K), {
|
|
777
798
|
key: i.value,
|
|
778
799
|
label: i.label,
|
|
779
800
|
value: i.value
|
|
@@ -800,7 +821,7 @@ const Ve = {
|
|
|
800
821
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
801
822
|
}, { ref_for: !0 }, c.item.options?.datetime, O(c.item.options?.datetime?.on || {}), {
|
|
802
823
|
disabled: a.getDisabled(c.item)
|
|
803
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type && o(
|
|
824
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : c.item.type && o(z).customComponent[c.item.type] ? (m(), b(G(o(z).customComponent[c.item.type]), C({
|
|
804
825
|
key: 6,
|
|
805
826
|
modelValue: a.form[c.item.key],
|
|
806
827
|
"onUpdate:modelValue": (i) => a.form[c.item.key] = i
|
|
@@ -861,19 +882,19 @@ const Ue = {
|
|
|
861
882
|
};
|
|
862
883
|
class g {
|
|
863
884
|
/** 解析国际化值:函数则执行并返回字符串,字符串则替换 `{key}` 占位符 */
|
|
864
|
-
static t(
|
|
865
|
-
if (typeof
|
|
866
|
-
return
|
|
867
|
-
|
|
885
|
+
static t(r, ...s) {
|
|
886
|
+
if (typeof r == "function")
|
|
887
|
+
return r(...s);
|
|
888
|
+
r = String(r);
|
|
868
889
|
let l = 0;
|
|
869
|
-
return
|
|
890
|
+
return r.replace(/{([^}]+)}/g, (n, e) => l < s.length ? String(s[l++]) : `{${e}}`);
|
|
870
891
|
}
|
|
871
|
-
static setI18n = (
|
|
872
|
-
g.curd = ObjectUtil.deepMerge(g.curd,
|
|
892
|
+
static setI18n = (r) => {
|
|
893
|
+
g.curd = ObjectUtil.deepMerge(g.curd, r);
|
|
873
894
|
};
|
|
874
895
|
/** 解析curd国际化值 */
|
|
875
|
-
static tCurd(
|
|
876
|
-
return this.t(this.curd[
|
|
896
|
+
static tCurd(r, ...s) {
|
|
897
|
+
return this.t(this.curd[r], ...s);
|
|
877
898
|
}
|
|
878
899
|
/** curd表单 */
|
|
879
900
|
static curd = Ue;
|
|
@@ -886,11 +907,11 @@ class $e {
|
|
|
886
907
|
* @param columns - 列配置数组,需包含 `key`(数据字段)和 `label`(Excel 表头)
|
|
887
908
|
* @param fileName - 文件名(不含扩展名),支持字符串或返回字符串的函数;默认生成「导出数据_日期_时间戳」
|
|
888
909
|
*/
|
|
889
|
-
static exportToExcel = async (
|
|
890
|
-
if (!
|
|
891
|
-
const n = await U.loadModule("xlsx"), e =
|
|
910
|
+
static exportToExcel = async (r, s, l) => {
|
|
911
|
+
if (!r || r.length === 0) return;
|
|
912
|
+
const n = await U.loadModule("xlsx"), e = r.map((f) => {
|
|
892
913
|
const p = {};
|
|
893
|
-
return
|
|
914
|
+
return s.forEach((c) => {
|
|
894
915
|
p[c.label] = f[c.key];
|
|
895
916
|
}), p;
|
|
896
917
|
}), a = n.utils.json_to_sheet(e), u = n.utils.book_new();
|
|
@@ -898,7 +919,7 @@ class $e {
|
|
|
898
919
|
};
|
|
899
920
|
}
|
|
900
921
|
const A = U.EDialog, Se = (t) => {
|
|
901
|
-
const
|
|
922
|
+
const r = N(), s = N(), l = te({
|
|
902
923
|
/** 查询区域相关配置对象 */
|
|
903
924
|
search: {
|
|
904
925
|
/** 查询表单列集合 */
|
|
@@ -1000,17 +1021,26 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1000
1021
|
const n = t.option.api.list;
|
|
1001
1022
|
try {
|
|
1002
1023
|
await l.initApiData("init");
|
|
1003
|
-
|
|
1024
|
+
let e = {};
|
|
1025
|
+
if (l.table.sort.prop) {
|
|
1026
|
+
const { props: d, order: y } = S.config.table.sort;
|
|
1027
|
+
e = {
|
|
1028
|
+
[d.field]: l.table.sort.prop,
|
|
1029
|
+
[y.field]: l.table.sort.order
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
const a = await n({
|
|
1004
1033
|
[S.config.page.size]: l.page.size,
|
|
1005
1034
|
[S.config.page.num]: l.page.num,
|
|
1006
|
-
...l.search.getFormData()
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1035
|
+
...l.search.getFormData(),
|
|
1036
|
+
...e
|
|
1037
|
+
}), u = S.config.result, f = a.data || { [u.list]: a };
|
|
1038
|
+
let p = (Array.isArray(f[u.list]), f[u.list]);
|
|
1039
|
+
const c = l.update.formColumn.flat(), i = JSONUtil.cp(p).map((d) => (Object.keys(d).forEach((M) => {
|
|
1040
|
+
const j = c.find((L) => L.item.key === M);
|
|
1041
|
+
j && ["select", "radio"].includes(j.item.type) && (j.item.table.format || (j.item.table.format = (L) => j.item.options[j.item.type].data?.find((R) => R.value == L[M])?.label || L[M]));
|
|
1042
|
+
}), d));
|
|
1043
|
+
l.table.data = t.option.data ? await t.option.data(i, p) : i, l.page.total = f[u.total] || 0;
|
|
1014
1044
|
} catch (e) {
|
|
1015
1045
|
console.error(e);
|
|
1016
1046
|
} finally {
|
|
@@ -1025,6 +1055,23 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1025
1055
|
change: (n) => {
|
|
1026
1056
|
l.table.selection.list = n;
|
|
1027
1057
|
}
|
|
1058
|
+
},
|
|
1059
|
+
/** 表格排序相关配置 */
|
|
1060
|
+
sort: {
|
|
1061
|
+
/** 当前排序属性值 */
|
|
1062
|
+
prop: "",
|
|
1063
|
+
/** 当前排序顺序值 */
|
|
1064
|
+
order: "",
|
|
1065
|
+
/** 排序变更回调 */
|
|
1066
|
+
change: (n) => {
|
|
1067
|
+
S.config.table.sort.resetPage && (l.page.num = 1);
|
|
1068
|
+
const e = S.config.table.sort;
|
|
1069
|
+
if (e.change) {
|
|
1070
|
+
e.change(n, l);
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
l.table.sort.prop = n.prop, n.order === null ? l.table.sort.order = "" : l.table.sort.order = n.order === "ascending" ? e.order.asc : e.order.desc, l.table.getList();
|
|
1074
|
+
}
|
|
1028
1075
|
}
|
|
1029
1076
|
},
|
|
1030
1077
|
/** 导出相关配置与功能 */
|
|
@@ -1144,7 +1191,7 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1144
1191
|
/** 提交增改表单操作 */
|
|
1145
1192
|
submit: () => {
|
|
1146
1193
|
FunUtil.throttle(async () => {
|
|
1147
|
-
await
|
|
1194
|
+
await s.value?.validate(async (u, f) => new Promise((p, c) => {
|
|
1148
1195
|
u || (U.fail(g.tCurd("checkFormData")), c(!1)), p();
|
|
1149
1196
|
})), l.update.loading = !0;
|
|
1150
1197
|
const n = l.update.type === A.Insert ? t.option.api.create : t.option.api.update;
|
|
@@ -1315,7 +1362,7 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1315
1362
|
a.options = ObjectUtil.deepMerge(n.options, a.options || {}), a.form = ObjectUtil.deepMerge(n.form, a.form || {}), a.show = ObjectUtil.deepMerge(n.show, a.show || {}), a.sort = ObjectUtil.deepMerge(n.sort, a.sort || {}), a.type = a.type || n.type, a.type === "switch" && (a.options.switch.tableBeforeChange = async (u, f) => {
|
|
1316
1363
|
const p = a.options?.switch;
|
|
1317
1364
|
try {
|
|
1318
|
-
await
|
|
1365
|
+
await r.value?.open({
|
|
1319
1366
|
title: g.tCurd("confirmModify"),
|
|
1320
1367
|
content: g.tCurd("confirmSwitchMessage")
|
|
1321
1368
|
}), l.table.loading = !0;
|
|
@@ -1357,24 +1404,24 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1357
1404
|
}
|
|
1358
1405
|
if (l.update.formDefault[d.key] = d.value, d.table.table && (d.show.table && l.table.column.show.list.push(d.key), d.table.table && l.table.column.show.listSource.push(d.key)), d.isForm) {
|
|
1359
1406
|
d.form = d.form || { span: u }, d.form.span = d.form.span ?? u;
|
|
1360
|
-
let y = d.form.span,
|
|
1407
|
+
let y = d.form.span, M = f.reduce((L, R) => L + R.span, y);
|
|
1361
1408
|
const j = f.length;
|
|
1362
|
-
if (f.push({ item: d, span: y }), (j === 1 && f[0].span === 0 ||
|
|
1363
|
-
const
|
|
1409
|
+
if (f.push({ item: d, span: y }), (j === 1 && f[0].span === 0 || M >= a || y === 0 && j > 1) && (e.push(f), f = []), d.rules) {
|
|
1410
|
+
const L = {
|
|
1364
1411
|
input: g.tCurd("placeholderInput"),
|
|
1365
1412
|
select: g.tCurd("placeholderSelect")
|
|
1366
|
-
},
|
|
1413
|
+
}, R = (L[d.type] || L.input) + d.label;
|
|
1367
1414
|
l.update.rules[d.key] = typeof d.rules == "boolean" ? [
|
|
1368
1415
|
{
|
|
1369
1416
|
required: !0,
|
|
1370
|
-
message:
|
|
1417
|
+
message: R,
|
|
1371
1418
|
trigger: "blur"
|
|
1372
1419
|
}
|
|
1373
1420
|
] : d.rules;
|
|
1374
1421
|
}
|
|
1375
1422
|
}
|
|
1376
1423
|
}, c = (d, y) => {
|
|
1377
|
-
d.isForm = y, Array.isArray(d.children) && d.children.forEach((
|
|
1424
|
+
d.isForm = y, Array.isArray(d.children) && d.children.forEach((M) => c(M, y));
|
|
1378
1425
|
};
|
|
1379
1426
|
n.column.forEach((d) => {
|
|
1380
1427
|
d.isForm = !0, c(d, !0), p(d);
|
|
@@ -1391,24 +1438,24 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1391
1438
|
});
|
|
1392
1439
|
return l.init(), ne(() => {
|
|
1393
1440
|
t.option.init !== !1 && l.table.getList();
|
|
1394
|
-
}), { conf: l, switchConfirmRef:
|
|
1395
|
-
}, Oe = { class: "dialog-footer" }, Fe = /* @__PURE__ */
|
|
1441
|
+
}), { conf: l, switchConfirmRef: r, ruleFormRef: s };
|
|
1442
|
+
}, Oe = { class: "dialog-footer" }, Fe = /* @__PURE__ */ B({
|
|
1396
1443
|
__name: "switchConfirm",
|
|
1397
|
-
setup(t, { expose:
|
|
1398
|
-
const
|
|
1444
|
+
setup(t, { expose: r }) {
|
|
1445
|
+
const s = N(!1), l = N("确认修改"), n = N("确认要修改状态吗?");
|
|
1399
1446
|
let e = null, a = null;
|
|
1400
|
-
const u = (c) => (c?.title && (l.value = c.title), c?.content && (n.value = c.content),
|
|
1447
|
+
const u = (c) => (c?.title && (l.value = c.title), c?.content && (n.value = c.content), s.value = !0, new Promise((i, d) => {
|
|
1401
1448
|
e = i, a = d;
|
|
1402
1449
|
})), f = () => {
|
|
1403
|
-
|
|
1450
|
+
s.value = !1, e?.(!0), e = null, a = null;
|
|
1404
1451
|
}, p = () => {
|
|
1405
|
-
|
|
1452
|
+
s.value = !1, a?.(new Error("用户取消操作")), e = null, a = null;
|
|
1406
1453
|
};
|
|
1407
|
-
return
|
|
1454
|
+
return r({
|
|
1408
1455
|
open: u
|
|
1409
1456
|
}), (c, i) => (m(), b(o(Y), {
|
|
1410
|
-
modelValue:
|
|
1411
|
-
"onUpdate:modelValue": i[0] || (i[0] = (d) =>
|
|
1457
|
+
modelValue: s.value,
|
|
1458
|
+
"onUpdate:modelValue": i[0] || (i[0] = (d) => s.value = d),
|
|
1412
1459
|
title: l.value,
|
|
1413
1460
|
"close-on-click-modal": !1,
|
|
1414
1461
|
width: "400px"
|
|
@@ -1438,37 +1485,37 @@ const A = U.EDialog, Se = (t) => {
|
|
|
1438
1485
|
_: 1
|
|
1439
1486
|
}, 8, ["modelValue", "title"]));
|
|
1440
1487
|
}
|
|
1441
|
-
}),
|
|
1442
|
-
const
|
|
1443
|
-
for (const [l, n] of
|
|
1444
|
-
|
|
1445
|
-
return
|
|
1488
|
+
}), se = (t, r) => {
|
|
1489
|
+
const s = t.__vccOpts || t;
|
|
1490
|
+
for (const [l, n] of r)
|
|
1491
|
+
s[l] = n;
|
|
1492
|
+
return s;
|
|
1446
1493
|
}, Ie = {}, Me = {
|
|
1447
1494
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1448
1495
|
viewBox: "0 0 1024 1024"
|
|
1449
1496
|
};
|
|
1450
|
-
function je(t,
|
|
1451
|
-
return m(), w("svg", Me, [...
|
|
1497
|
+
function je(t, r) {
|
|
1498
|
+
return m(), w("svg", Me, [...r[0] || (r[0] = [
|
|
1452
1499
|
$("path", {
|
|
1453
1500
|
fill: "currentColor",
|
|
1454
1501
|
d: "M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"
|
|
1455
1502
|
}, null, -1)
|
|
1456
1503
|
])]);
|
|
1457
1504
|
}
|
|
1458
|
-
const Le = /* @__PURE__ */
|
|
1505
|
+
const Le = /* @__PURE__ */ se(Ie, [["render", je]]), ze = {}, Te = {
|
|
1459
1506
|
"data-v-58697b5c": "",
|
|
1460
1507
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1461
1508
|
viewBox: "0 0 1024 1024"
|
|
1462
1509
|
};
|
|
1463
|
-
function
|
|
1464
|
-
return m(), w("svg", Te, [...
|
|
1510
|
+
function Pe(t, r) {
|
|
1511
|
+
return m(), w("svg", Te, [...r[0] || (r[0] = [
|
|
1465
1512
|
$("path", {
|
|
1466
1513
|
fill: "currentColor",
|
|
1467
1514
|
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"
|
|
1468
1515
|
}, null, -1)
|
|
1469
1516
|
])]);
|
|
1470
1517
|
}
|
|
1471
|
-
const
|
|
1518
|
+
const Re = /* @__PURE__ */ se(ze, [["render", Pe]]), Ae = { class: "row flex-center table-header-label inline" }, Ke = { class: "table-header-tooltip" }, Ne = ["onClick"], Be = /* @__PURE__ */ B({
|
|
1472
1519
|
__name: "tableColumn",
|
|
1473
1520
|
props: {
|
|
1474
1521
|
conf: {},
|
|
@@ -1476,10 +1523,10 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1476
1523
|
option: {}
|
|
1477
1524
|
},
|
|
1478
1525
|
setup(t) {
|
|
1479
|
-
const
|
|
1526
|
+
const r = U.isFun, s = ye().type;
|
|
1480
1527
|
return (l, n) => {
|
|
1481
1528
|
const e = H("el-tooltip");
|
|
1482
|
-
return m(!0), w(D, null,
|
|
1529
|
+
return m(!0), w(D, null, I(t.columnList, (a) => (m(), w(D, {
|
|
1483
1530
|
key: a.key
|
|
1484
1531
|
}, [
|
|
1485
1532
|
t.conf.table.column.show.list.includes(a.key) ? (m(), b(o(Z), C({
|
|
@@ -1489,7 +1536,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1489
1536
|
}, { ref_for: !0 }, a.table), {
|
|
1490
1537
|
header: h(() => [
|
|
1491
1538
|
k(l.$slots, "table-header-" + a.key, { item: a }, () => [
|
|
1492
|
-
$("div",
|
|
1539
|
+
$("div", Ae, [
|
|
1493
1540
|
a.table?.tooltip ? (m(), b(e, {
|
|
1494
1541
|
key: 0,
|
|
1495
1542
|
effect: "dark",
|
|
@@ -1498,7 +1545,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1498
1545
|
}, {
|
|
1499
1546
|
default: h(() => [
|
|
1500
1547
|
$("span", Ke, [
|
|
1501
|
-
V(
|
|
1548
|
+
V(Re)
|
|
1502
1549
|
])
|
|
1503
1550
|
]),
|
|
1504
1551
|
_: 1
|
|
@@ -1510,12 +1557,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1510
1557
|
default: h(({ row: u }) => [
|
|
1511
1558
|
a.children ? (m(), w(D, { key: 0 }, [
|
|
1512
1559
|
n[0] || (n[0] = E(" ", -1)),
|
|
1513
|
-
(m(), b(G(o(
|
|
1560
|
+
(m(), b(G(o(s)), {
|
|
1514
1561
|
conf: t.conf,
|
|
1515
1562
|
columnList: a.children,
|
|
1516
1563
|
option: t.option
|
|
1517
|
-
},
|
|
1518
|
-
|
|
1564
|
+
}, re({ _: 2 }, [
|
|
1565
|
+
I(l.$slots, (f, p) => ({
|
|
1519
1566
|
name: p,
|
|
1520
1567
|
fn: h((c) => [
|
|
1521
1568
|
k(l.$slots, p, C({ ref_for: !0 }, c || {}))
|
|
@@ -1523,7 +1570,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1523
1570
|
}))
|
|
1524
1571
|
]), 1032, ["conf", "columnList", "option"]))
|
|
1525
1572
|
], 64)) : (m(), w(D, { key: 1 }, [
|
|
1526
|
-
o(
|
|
1573
|
+
o(r)(a.show?.form, t.conf.inlineEdit.form, o(U).EDialog.Update) && t.option.table?.inlineEdit && t.conf.inlineEdit.row === u && (a.type === "input" || a.type === "select") ? (m(), w(D, { key: 0 }, [
|
|
1527
1574
|
a.type === "input" ? (m(), b(o(q), C({
|
|
1528
1575
|
key: 0,
|
|
1529
1576
|
modelValue: t.conf.inlineEdit.form[a.key],
|
|
@@ -1541,7 +1588,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1541
1588
|
style: { width: "100%" }
|
|
1542
1589
|
}), {
|
|
1543
1590
|
default: h(() => [
|
|
1544
|
-
(m(!0), w(D, null,
|
|
1591
|
+
(m(!0), w(D, null, I(a.options?.select?.data, (f) => (m(), b(o(K), {
|
|
1545
1592
|
key: f.value,
|
|
1546
1593
|
label: f.label,
|
|
1547
1594
|
value: f.value
|
|
@@ -1575,37 +1622,37 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1575
1622
|
], 64))), 128);
|
|
1576
1623
|
};
|
|
1577
1624
|
}
|
|
1578
|
-
}), le = /* @__PURE__ */
|
|
1625
|
+
}), le = /* @__PURE__ */ B({
|
|
1579
1626
|
__name: "formColumn",
|
|
1580
1627
|
props: {
|
|
1581
1628
|
conf: {},
|
|
1582
1629
|
item: {}
|
|
1583
1630
|
},
|
|
1584
1631
|
setup(t) {
|
|
1585
|
-
return (
|
|
1632
|
+
return (r, s) => {
|
|
1586
1633
|
const l = H("el-radio"), n = H("el-radio-group");
|
|
1587
1634
|
return t.item.item.type === "input" ? (m(), b(o(q), C({
|
|
1588
1635
|
key: 0,
|
|
1589
1636
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1590
|
-
"onUpdate:modelValue":
|
|
1637
|
+
"onUpdate:modelValue": s[0] || (s[0] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1591
1638
|
}, t.item.item.options?.input, O(t.item.item.options?.input?.on || {}), {
|
|
1592
1639
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1593
1640
|
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "switch" ? (m(), b(o(_), C({
|
|
1594
1641
|
key: 1,
|
|
1595
1642
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1596
|
-
"onUpdate:modelValue":
|
|
1643
|
+
"onUpdate:modelValue": s[1] || (s[1] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1597
1644
|
}, t.item.item.options?.switch, {
|
|
1598
1645
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1599
1646
|
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "select" ? (m(), b(o(W), C({
|
|
1600
1647
|
key: 2,
|
|
1601
1648
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1602
|
-
"onUpdate:modelValue":
|
|
1649
|
+
"onUpdate:modelValue": s[2] || (s[2] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1603
1650
|
}, t.item.item.options?.select, O(t.item.item.options?.select?.on || {}), {
|
|
1604
1651
|
disabled: t.conf.update.getDisabled(t.item.item),
|
|
1605
1652
|
style: { width: "100%" }
|
|
1606
1653
|
}), {
|
|
1607
1654
|
default: h(() => [
|
|
1608
|
-
(m(!0), w(D, null,
|
|
1655
|
+
(m(!0), w(D, null, I(t.item.item.options?.select?.data, (e) => (m(), b(o(K), {
|
|
1609
1656
|
key: e.value,
|
|
1610
1657
|
label: e.label,
|
|
1611
1658
|
value: e.value
|
|
@@ -1615,13 +1662,13 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1615
1662
|
}, 16, ["modelValue", "disabled"])) : t.item.item.type === "radio" ? (m(), b(n, C({
|
|
1616
1663
|
key: 3,
|
|
1617
1664
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1618
|
-
"onUpdate:modelValue":
|
|
1665
|
+
"onUpdate:modelValue": s[3] || (s[3] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1619
1666
|
}, t.item.item.options?.radio, O(t.item.item.options?.radio?.on || {}), {
|
|
1620
1667
|
disabled: t.conf.update.getDisabled(t.item.item),
|
|
1621
1668
|
style: { width: "100%" }
|
|
1622
1669
|
}), {
|
|
1623
1670
|
default: h(() => [
|
|
1624
|
-
(m(!0), w(D, null,
|
|
1671
|
+
(m(!0), w(D, null, I(t.item.item.options?.radio?.data, (e) => (m(), b(l, {
|
|
1625
1672
|
key: e.value,
|
|
1626
1673
|
label: e.label,
|
|
1627
1674
|
value: e.value
|
|
@@ -1638,20 +1685,20 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1638
1685
|
}), null, 16, ["row", "field", "disabled"])) : t.item.item.type === "tree-select" ? (m(), b(o(ae), C({
|
|
1639
1686
|
key: 5,
|
|
1640
1687
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1641
|
-
"onUpdate:modelValue":
|
|
1688
|
+
"onUpdate:modelValue": s[4] || (s[4] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1642
1689
|
}, t.item.item.options?.treeSelect, O(t.item.item.options?.treeSelect?.on || {}), {
|
|
1643
1690
|
disabled: t.conf.update.getDisabled(t.item.item),
|
|
1644
1691
|
style: { width: "100%" }
|
|
1645
1692
|
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type === "datetime" ? (m(), b(o(ee), C({
|
|
1646
1693
|
key: 6,
|
|
1647
1694
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1648
|
-
"onUpdate:modelValue":
|
|
1695
|
+
"onUpdate:modelValue": s[5] || (s[5] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1649
1696
|
}, t.item.item.options?.datetime, O(t.item.item.options?.datetime?.on || {}), {
|
|
1650
1697
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1651
|
-
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type && o(
|
|
1698
|
+
}), null, 16, ["modelValue", "disabled"])) : t.item.item.type && o(z).customComponent[t.item.item.type] ? (m(), b(G(o(z).customComponent[t.item.item.type]), C({
|
|
1652
1699
|
key: 7,
|
|
1653
1700
|
modelValue: t.conf.update.form[t.item.item.key],
|
|
1654
|
-
"onUpdate:modelValue":
|
|
1701
|
+
"onUpdate:modelValue": s[6] || (s[6] = (e) => t.conf.update.form[t.item.item.key] = e)
|
|
1655
1702
|
}, t.item.item.options?.[t.item.item.type], O(t.item.item.options?.[t.item.item.type]?.on || {}), {
|
|
1656
1703
|
disabled: t.conf.update.getDisabled(t.item.item)
|
|
1657
1704
|
}), null, 16, ["modelValue", "disabled"])) : v("", !0);
|
|
@@ -1675,7 +1722,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1675
1722
|
}, nt = { class: "col" }, it = {
|
|
1676
1723
|
class: "row form-item-content",
|
|
1677
1724
|
style: { width: "100%" }
|
|
1678
|
-
},
|
|
1725
|
+
}, rt = { class: "col" }, st = { class: "dialog-footer" }, dt = { class: "dialog-footer" }, ut = /* @__PURE__ */ B({
|
|
1679
1726
|
__name: "index",
|
|
1680
1727
|
props: {
|
|
1681
1728
|
/**
|
|
@@ -1685,9 +1732,9 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1685
1732
|
default: {}
|
|
1686
1733
|
}
|
|
1687
1734
|
},
|
|
1688
|
-
setup(t, { expose:
|
|
1689
|
-
const
|
|
1690
|
-
return
|
|
1735
|
+
setup(t, { expose: r }) {
|
|
1736
|
+
const s = U.EDialog, l = t, n = U.isFun, { conf: e, switchConfirmRef: a, ruleFormRef: u } = Se(l);
|
|
1737
|
+
return r({
|
|
1691
1738
|
conf: e
|
|
1692
1739
|
}), (f, p) => {
|
|
1693
1740
|
const c = we("loading");
|
|
@@ -1704,7 +1751,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1704
1751
|
k(f.$slots, "search-start", {
|
|
1705
1752
|
row: o(e).search.form
|
|
1706
1753
|
}),
|
|
1707
|
-
(m(!0), w(D, null,
|
|
1754
|
+
(m(!0), w(D, null, I(o(e).search.column.list, (i) => (m(), w(D, {
|
|
1708
1755
|
key: i.key
|
|
1709
1756
|
}, [
|
|
1710
1757
|
(typeof i.show?.search == "function" ? i.show?.search(o(e).search.form) : i.show?.search) ? (m(), b(o(J), {
|
|
@@ -1734,12 +1781,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1734
1781
|
disabled: i.disabled?.search
|
|
1735
1782
|
}, { ref_for: !0 }, i.options?.switch, O(i.options?.switch?.on || {})), {
|
|
1736
1783
|
default: h(() => [
|
|
1737
|
-
(m(), b(o(
|
|
1784
|
+
(m(), b(o(K), {
|
|
1738
1785
|
key: i.options?.switch?.activeValue,
|
|
1739
1786
|
label: i.options?.switch?.activeLabel,
|
|
1740
1787
|
value: i.options?.switch?.activeValue
|
|
1741
1788
|
}, null, 8, ["label", "value"])),
|
|
1742
|
-
(m(), b(o(
|
|
1789
|
+
(m(), b(o(K), {
|
|
1743
1790
|
key: i.options?.switch?.inactiveValue,
|
|
1744
1791
|
label: i.options?.switch?.inactiveLabel,
|
|
1745
1792
|
value: i.options?.switch?.inactiveValue
|
|
@@ -1755,7 +1802,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1755
1802
|
disabled: i.disabled?.search
|
|
1756
1803
|
}, { ref_for: !0 }, i.options?.select, O(i.options?.select?.on || {})), {
|
|
1757
1804
|
default: h(() => [
|
|
1758
|
-
(m(!0), w(D, null,
|
|
1805
|
+
(m(!0), w(D, null, I(i.options?.select?.data, (d) => (m(), b(o(K), {
|
|
1759
1806
|
key: d.value,
|
|
1760
1807
|
label: d.label,
|
|
1761
1808
|
value: d.value
|
|
@@ -1768,7 +1815,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1768
1815
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d
|
|
1769
1816
|
}, { ref_for: !0 }, i.options?.datetime, O(i.options?.datetime?.on || {}), {
|
|
1770
1817
|
disabled: i.disabled?.search
|
|
1771
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : i.type && o(
|
|
1818
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : i.type && o(z).customComponent[i.type] ? (m(), b(G(o(z).customComponent[i.type]), C({
|
|
1772
1819
|
key: 4,
|
|
1773
1820
|
modelValue: o(e).search.form[i.key],
|
|
1774
1821
|
"onUpdate:modelValue": (d) => o(e).search.form[i.key] = d
|
|
@@ -1822,7 +1869,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1822
1869
|
o(n)(t.option.tools?.add) ? (m(), w("div", Qe, [
|
|
1823
1870
|
V(o(F), {
|
|
1824
1871
|
type: "primary",
|
|
1825
|
-
onClick: p[0] || (p[0] = (i) => o(e).update.open(o(
|
|
1872
|
+
onClick: p[0] || (p[0] = (i) => o(e).update.open(o(s).Insert))
|
|
1826
1873
|
}, {
|
|
1827
1874
|
default: h(() => [
|
|
1828
1875
|
E(x(o(g).tCurd("add")), 1)
|
|
@@ -1917,12 +1964,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1917
1964
|
$("div", ot, [
|
|
1918
1965
|
ke((m(), b(o(pe), C({
|
|
1919
1966
|
data: o(e).table.data,
|
|
1920
|
-
border: t.option.table?.border === void 0 ? !0 : t.option.table?.border
|
|
1921
|
-
}, t.option.table, {
|
|
1967
|
+
border: t.option.table?.border === void 0 ? !0 : t.option.table?.border,
|
|
1922
1968
|
onSelectionChange: o(e).table.selection.change,
|
|
1969
|
+
onSortChange: o(e).table.sort.change,
|
|
1923
1970
|
"expand-row-keys": o(e).table.expand.rowKeys,
|
|
1924
1971
|
onExpandChange: o(e).table.expand.change
|
|
1925
|
-
}), {
|
|
1972
|
+
}, t.option.table, O(t.option.table?.on || {})), {
|
|
1926
1973
|
default: h(() => [
|
|
1927
1974
|
t.option.table?.selectable || o(n)(t.option.tools?.delete) || t.option.tools?.export?.show ? (m(), b(o(Z), {
|
|
1928
1975
|
key: 0,
|
|
@@ -1934,8 +1981,8 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1934
1981
|
conf: o(e),
|
|
1935
1982
|
columnList: o(e).table.column.list,
|
|
1936
1983
|
option: t.option
|
|
1937
|
-
},
|
|
1938
|
-
|
|
1984
|
+
}, re({ _: 2 }, [
|
|
1985
|
+
I(f.$slots, (i, d) => ({
|
|
1939
1986
|
name: d,
|
|
1940
1987
|
fn: h((y) => [
|
|
1941
1988
|
k(f.$slots, d, ve(Ce(y || {})))
|
|
@@ -1983,7 +2030,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1983
2030
|
key: 0,
|
|
1984
2031
|
link: "",
|
|
1985
2032
|
type: "primary",
|
|
1986
|
-
onClick: (d) => o(e).update.open(o(
|
|
2033
|
+
onClick: (d) => o(e).update.open(o(s).Insert, i)
|
|
1987
2034
|
}, {
|
|
1988
2035
|
default: h(() => [
|
|
1989
2036
|
E(x(o(g).tCurd("add")), 1)
|
|
@@ -1994,7 +2041,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
1994
2041
|
key: 1,
|
|
1995
2042
|
link: "",
|
|
1996
2043
|
type: "primary",
|
|
1997
|
-
onClick: (d) => o(e).update.open(o(
|
|
2044
|
+
onClick: (d) => o(e).update.open(o(s).View, i)
|
|
1998
2045
|
}, {
|
|
1999
2046
|
default: h(() => [
|
|
2000
2047
|
E(x(o(g).tCurd("view")), 1)
|
|
@@ -2005,7 +2052,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2005
2052
|
key: 2,
|
|
2006
2053
|
link: "",
|
|
2007
2054
|
type: "warning",
|
|
2008
|
-
onClick: (d) => o(e).update.open(o(
|
|
2055
|
+
onClick: (d) => o(e).update.open(o(s).Update, i)
|
|
2009
2056
|
}, {
|
|
2010
2057
|
default: h(() => [
|
|
2011
2058
|
E(x(o(g).tCurd("edit")), 1)
|
|
@@ -2030,7 +2077,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2030
2077
|
}, 16, ["width"])) : v("", !0)
|
|
2031
2078
|
]),
|
|
2032
2079
|
_: 3
|
|
2033
|
-
}, 16, ["data", "border", "onSelectionChange", "expand-row-keys", "onExpandChange"])), [
|
|
2080
|
+
}, 16, ["data", "border", "onSelectionChange", "onSortChange", "expand-row-keys", "onExpandChange"])), [
|
|
2034
2081
|
[c, o(e).table.loading]
|
|
2035
2082
|
])
|
|
2036
2083
|
])
|
|
@@ -2061,7 +2108,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2061
2108
|
"before-close": o(e).update.close
|
|
2062
2109
|
}, t.option.dialog), {
|
|
2063
2110
|
footer: h(() => [
|
|
2064
|
-
$("span",
|
|
2111
|
+
$("span", st, [
|
|
2065
2112
|
V(o(F), {
|
|
2066
2113
|
onClick: o(e).update.close
|
|
2067
2114
|
}, {
|
|
@@ -2070,7 +2117,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2070
2117
|
]),
|
|
2071
2118
|
_: 1
|
|
2072
2119
|
}, 8, ["onClick"]),
|
|
2073
|
-
o(e).update.type !== o(
|
|
2120
|
+
o(e).update.type !== o(s).View ? (m(), b(o(F), {
|
|
2074
2121
|
key: 0,
|
|
2075
2122
|
type: "primary",
|
|
2076
2123
|
onClick: o(e).update.submit,
|
|
@@ -2091,12 +2138,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2091
2138
|
rules: o(e).update.rules
|
|
2092
2139
|
}, {
|
|
2093
2140
|
default: h(() => [
|
|
2094
|
-
o(e).update.showContent ? (m(!0), w(D, { key: 0 },
|
|
2141
|
+
o(e).update.showContent ? (m(!0), w(D, { key: 0 }, I(o(e).update.formColumn, (i) => (m(), w(D, null, [
|
|
2095
2142
|
o(n)(() => {
|
|
2096
|
-
const d = [], y = (
|
|
2097
|
-
if (
|
|
2098
|
-
return y(
|
|
2099
|
-
d.push(...
|
|
2143
|
+
const d = [], y = (M) => {
|
|
2144
|
+
if (M.children)
|
|
2145
|
+
return y(M.children);
|
|
2146
|
+
d.push(...M.map((j) => j.item.show?.form));
|
|
2100
2147
|
};
|
|
2101
2148
|
return y(i), d;
|
|
2102
2149
|
}, o(e).update.form, o(e).update.type) ? (m(), w("div", {
|
|
@@ -2108,12 +2155,12 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2108
2155
|
k(f.$slots, "form-start", {
|
|
2109
2156
|
row: o(e).update.form
|
|
2110
2157
|
}),
|
|
2111
|
-
(m(!0), w(D, null,
|
|
2158
|
+
(m(!0), w(D, null, I(i, (d) => (m(), w(D, null, [
|
|
2112
2159
|
o(n)(d.item.show?.form, o(e).update.form) ? (m(), w("div", {
|
|
2113
2160
|
key: 0,
|
|
2114
2161
|
class: T(d.item.form.span > 0 ? `col-${d.item.form.span}` : "col")
|
|
2115
2162
|
}, [
|
|
2116
|
-
d.item.children ? (m(!0), w(D, { key: 0 },
|
|
2163
|
+
d.item.children ? (m(!0), w(D, { key: 0 }, I(d.children, (y) => (m(), b(o(J), {
|
|
2117
2164
|
class: T({
|
|
2118
2165
|
"hide-label": typeof y.item.text?.form?.label == "boolean" ? !y.item.text?.form?.label : !1
|
|
2119
2166
|
}),
|
|
@@ -2164,7 +2211,7 @@ const Ae = /* @__PURE__ */ re(ze, [["render", Re]]), Pe = { class: "row flex-cen
|
|
|
2164
2211
|
row: o(e).update.form,
|
|
2165
2212
|
item: d.item
|
|
2166
2213
|
}),
|
|
2167
|
-
$("div",
|
|
2214
|
+
$("div", rt, [
|
|
2168
2215
|
k(f.$slots, "form-" + d.item.key, {
|
|
2169
2216
|
row: o(e).update.form,
|
|
2170
2217
|
item: d.item
|
|
@@ -2248,28 +2295,28 @@ class pt {
|
|
|
2248
2295
|
* @param href - 文件的远程地址
|
|
2249
2296
|
* @param name - 下载后的文件名,默认 `'download.png'`
|
|
2250
2297
|
*/
|
|
2251
|
-
static async download(
|
|
2298
|
+
static async download(r, s = "download.png") {
|
|
2252
2299
|
const l = document.createElement("a");
|
|
2253
|
-
l.style.display = "none", l.href =
|
|
2300
|
+
l.style.display = "none", l.href = r, l.setAttribute("download", s), typeof l.download > "u" && l.setAttribute("target", "_blank"), document.body.appendChild(l), l.click(), document.body.removeChild(l), window.URL.revokeObjectURL(r);
|
|
2254
2301
|
}
|
|
2255
2302
|
/**
|
|
2256
2303
|
* 将json对象或者json数组导出为json文件保存
|
|
2257
2304
|
* @param data
|
|
2258
2305
|
* @param name
|
|
2259
2306
|
*/
|
|
2260
|
-
static exportJSONFile = (
|
|
2261
|
-
const l = new Blob([JSON.stringify(
|
|
2262
|
-
e.href = n, e.download = `${
|
|
2307
|
+
static exportJSONFile = (r, s) => {
|
|
2308
|
+
const l = new Blob([JSON.stringify(r)], { type: "application/json" }), n = URL.createObjectURL(l), e = document.createElement("a");
|
|
2309
|
+
e.href = n, e.download = `${s || "config"}.json`, e.click();
|
|
2263
2310
|
};
|
|
2264
2311
|
/**
|
|
2265
2312
|
* 导入文件内容,默认为json
|
|
2266
2313
|
* @param param
|
|
2267
2314
|
* @returns
|
|
2268
2315
|
*/
|
|
2269
|
-
static importFile = async (
|
|
2316
|
+
static importFile = async (r) => new Promise((s, l) => {
|
|
2270
2317
|
const n = document.createElement("input");
|
|
2271
2318
|
n.type = "file";
|
|
2272
|
-
const e =
|
|
2319
|
+
const e = r?.accept || ".json";
|
|
2273
2320
|
n.accept = e, n.style.display = "none", n.onchange = (a) => {
|
|
2274
2321
|
const u = a.target.files[0];
|
|
2275
2322
|
if (!u) {
|
|
@@ -2279,29 +2326,29 @@ class pt {
|
|
|
2279
2326
|
const f = new FileReader();
|
|
2280
2327
|
f.onload = async (p) => {
|
|
2281
2328
|
const c = e == ".json" ? JSON.parse(p.target.result) : p.target.result;
|
|
2282
|
-
|
|
2329
|
+
s(c);
|
|
2283
2330
|
}, f.onerror = () => {
|
|
2284
2331
|
U.fail("文件读取失败"), l("文件读取失败");
|
|
2285
2332
|
}, f.readAsText(u), document.body.removeChild(n);
|
|
2286
2333
|
}, document.body.appendChild(n), n.click();
|
|
2287
2334
|
});
|
|
2288
2335
|
}
|
|
2289
|
-
const ct = (t,
|
|
2290
|
-
if (t.component("TCurd", ut), t.component("TFormList", oe), t.component("TColumn", De),
|
|
2291
|
-
|
|
2292
|
-
for (const
|
|
2293
|
-
t.component(
|
|
2336
|
+
const ct = (t, r) => {
|
|
2337
|
+
if (t.component("TCurd", ut), t.component("TFormList", oe), t.component("TColumn", De), r?.customComponent) {
|
|
2338
|
+
z.customComponent = r.customComponent;
|
|
2339
|
+
for (const s in r.customComponent)
|
|
2340
|
+
t.component(s, r.customComponent[s]);
|
|
2294
2341
|
}
|
|
2295
2342
|
}, ht = {
|
|
2296
2343
|
install: ct
|
|
2297
2344
|
};
|
|
2298
2345
|
export {
|
|
2299
|
-
|
|
2346
|
+
P as ArrUtil,
|
|
2300
2347
|
$e as ExcelUtil,
|
|
2301
2348
|
De as TColumn,
|
|
2302
2349
|
ut as TCurd,
|
|
2303
2350
|
pt as TFile,
|
|
2304
|
-
|
|
2351
|
+
z as TForm,
|
|
2305
2352
|
S as TFormConfig,
|
|
2306
2353
|
g as TFormI18n,
|
|
2307
2354
|
oe as TFormList,
|