cc1-form 1.3.3 → 1.3.5
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 +1148 -1130
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/field.vue.d.ts +14 -10
- package/dist/components/TCurd/index.d.ts +2798 -1
- package/dist/components/TCurd/index.vue.d.ts +8272 -13
- package/package.json +1 -1
package/dist/cc1-form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElMessage as et, ElLoading as tt, ElFormItem as be, ElInput as
|
|
1
|
+
import { ElMessage as et, ElLoading as tt, ElFormItem as be, ElInput as ue, ElInputNumber as ot, ElSwitch as he, ElSelect as ce, ElOption as ne, ElRadioGroup as Ue, ElRadioButton as at, ElRadio as Ae, ElCheckboxGroup as nt, ElCheckboxButton as lt, ElCheckbox as it, ElColorPicker as rt, ElSlider as st, ElTreeSelect as dt, ElDatePicker as Be, ElForm as oe, ElDialog as Ee, ElButton as N, ElTableColumn as ye, ElDropdown as ut, ElDropdownMenu as ct, ElDropdownItem as Se, ElPagination as Oe, ElTable as ft } from "element-plus";
|
|
2
2
|
import "vue-router";
|
|
3
|
-
import { defineComponent as q, reactive as
|
|
3
|
+
import { defineComponent as q, reactive as re, onMounted as Te, resolveComponent as fe, openBlock as g, createElementBlock as v, renderSlot as S, createVNode as F, withCtx as p, createTextVNode as M, createCommentVNode as V, Fragment as B, renderList as G, createBlock as b, normalizeClass as J, normalizeStyle as pe, ref as X, unref as l, createElementVNode as R, mergeProps as x, toHandlers as E, createSlots as Y, toDisplayString as U, resolveDynamicComponent as ee, nextTick as mt, computed as ae, onUnmounted as Le, watch as gt, normalizeProps as $e, guardReactiveProps as ze, getCurrentInstance as je, withModifiers as ht, resolveDirective as yt, withDirectives as bt } from "vue";
|
|
4
4
|
import { Scope as Me } from "cc1-vue3";
|
|
5
5
|
class $ {
|
|
6
6
|
/**
|
|
@@ -27,13 +27,13 @@ class $ {
|
|
|
27
27
|
* @param data 数据
|
|
28
28
|
* @returns 是否显示
|
|
29
29
|
*/
|
|
30
|
-
static isFun = (
|
|
30
|
+
static isFun = (t, ...n) => Array.isArray(t) ? t.some((o) => typeof o == "function" ? o(...n) : o) : typeof t == "function" ? t(...n) : t;
|
|
31
31
|
/**
|
|
32
32
|
* 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
|
|
33
33
|
*/
|
|
34
34
|
static getRouterParams = () => {
|
|
35
|
-
const
|
|
36
|
-
return Object.keys(
|
|
35
|
+
const t = this.router.currentRoute.value.query || {}, n = this.router.currentRoute.value.params || {};
|
|
36
|
+
return Object.keys(t).length ? t : Object.keys(n).length ? n : {};
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* 模块赋值
|
|
@@ -43,11 +43,11 @@ class $ {
|
|
|
43
43
|
* 加载模块
|
|
44
44
|
* @param module
|
|
45
45
|
*/
|
|
46
|
-
static loadModule = async (
|
|
47
|
-
if (!$.moduleObj[
|
|
48
|
-
throw new Error(`模块${
|
|
49
|
-
const
|
|
50
|
-
return
|
|
46
|
+
static loadModule = async (t) => {
|
|
47
|
+
if (!$.moduleObj[t])
|
|
48
|
+
throw new Error(`模块${t}未加载,请赋值如:TSys.moduleObj = { ${t}: ()=>import('${t}') }`);
|
|
49
|
+
const n = await $.moduleObj[t]();
|
|
50
|
+
return n.default ?? n;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* 提示信息对象管理
|
|
@@ -63,19 +63,19 @@ class $ {
|
|
|
63
63
|
* @param type 消息类型
|
|
64
64
|
* @param options 其他选项
|
|
65
65
|
*/
|
|
66
|
-
static showMessage(
|
|
66
|
+
static showMessage(t, n, o = {}) {
|
|
67
67
|
const r = Date.now();
|
|
68
|
-
if (!this.tipMessages[
|
|
69
|
-
this.tipMessages[
|
|
70
|
-
const
|
|
68
|
+
if (!this.tipMessages[t] || r - this.tipMessages[t] > this.tipMessagesGap) {
|
|
69
|
+
this.tipMessages[t] = r;
|
|
70
|
+
const a = Object.assign(
|
|
71
71
|
{
|
|
72
|
-
message:
|
|
73
|
-
type:
|
|
72
|
+
message: t,
|
|
73
|
+
type: n
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
o
|
|
76
76
|
);
|
|
77
|
-
et(
|
|
78
|
-
delete this.tipMessages[
|
|
77
|
+
et(a), setTimeout(() => {
|
|
78
|
+
delete this.tipMessages[t];
|
|
79
79
|
}, this.tipMessagesGap);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -84,16 +84,16 @@ class $ {
|
|
|
84
84
|
* @param content
|
|
85
85
|
* @param options
|
|
86
86
|
*/
|
|
87
|
-
static fail = (
|
|
88
|
-
this.showMessage(
|
|
87
|
+
static fail = (t, n = {}) => {
|
|
88
|
+
this.showMessage(t, "error", n);
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
91
91
|
* 成功提示
|
|
92
92
|
* @param content
|
|
93
93
|
* @param options
|
|
94
94
|
*/
|
|
95
|
-
static success = (
|
|
96
|
-
this.showMessage(
|
|
95
|
+
static success = (t, n = {}) => {
|
|
96
|
+
this.showMessage(t, "success", n);
|
|
97
97
|
};
|
|
98
98
|
static loadingObj = null;
|
|
99
99
|
static loadingTimer = null;
|
|
@@ -102,11 +102,11 @@ class $ {
|
|
|
102
102
|
* @param show
|
|
103
103
|
* @param text
|
|
104
104
|
*/
|
|
105
|
-
static loading = (
|
|
105
|
+
static loading = (t = !0, n = "Loading...") => {
|
|
106
106
|
Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
|
|
107
|
-
|
|
107
|
+
t ? this.loadingObj = tt.service({
|
|
108
108
|
lock: !0,
|
|
109
|
-
text:
|
|
109
|
+
text: n,
|
|
110
110
|
background: "rgba(0, 0, 0, 0.3)"
|
|
111
111
|
}) : this.loadingObj && (this.loadingObj.close(), this.loadingObj = null);
|
|
112
112
|
}, 50);
|
|
@@ -116,46 +116,46 @@ class $ {
|
|
|
116
116
|
* @param url 地址
|
|
117
117
|
* @param isCenter 是否居中
|
|
118
118
|
*/
|
|
119
|
-
static openUrl = (
|
|
120
|
-
if (
|
|
121
|
-
let
|
|
119
|
+
static openUrl = (t, n = !0) => {
|
|
120
|
+
if (n) {
|
|
121
|
+
let o = screen.width / 2 - 500, r = screen.height / 2 - 800 / 2 - 30;
|
|
122
122
|
window.open(
|
|
123
|
-
|
|
123
|
+
t,
|
|
124
124
|
"_blank",
|
|
125
|
-
"toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + r + ", left=" +
|
|
125
|
+
"toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + r + ", left=" + o
|
|
126
126
|
);
|
|
127
127
|
} else
|
|
128
|
-
window.open(
|
|
128
|
+
window.open(t, "DescriptiveWindowName" + StrUtil.getId(), "resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0");
|
|
129
129
|
};
|
|
130
130
|
/**
|
|
131
131
|
* 根据dom id截图并返回图片数据
|
|
132
132
|
* @param param
|
|
133
133
|
* @returns
|
|
134
134
|
*/
|
|
135
|
-
static getImgPic = (
|
|
136
|
-
let r = document.getElementById(
|
|
137
|
-
const
|
|
135
|
+
static getImgPic = (t) => new Promise(async (n, o) => {
|
|
136
|
+
let r = document.getElementById(t.id);
|
|
137
|
+
const a = await $.loadModule("html2canvas");
|
|
138
138
|
try {
|
|
139
|
-
|
|
139
|
+
a(r, {
|
|
140
140
|
logging: !1,
|
|
141
141
|
allowTaint: !0,
|
|
142
142
|
scale: window.devicePixelRatio,
|
|
143
|
-
width:
|
|
144
|
-
height:
|
|
145
|
-
windowWidth:
|
|
146
|
-
windowHeight:
|
|
143
|
+
width: t.windowWidth,
|
|
144
|
+
height: t.windowHeight,
|
|
145
|
+
windowWidth: t.windowWidth,
|
|
146
|
+
windowHeight: t.windowHeight,
|
|
147
147
|
useCORS: !0,
|
|
148
148
|
backgroundColor: "#ffffff00"
|
|
149
|
-
}).then(function(
|
|
150
|
-
let
|
|
151
|
-
|
|
149
|
+
}).then(function(i) {
|
|
150
|
+
let u = i.toDataURL("image/png");
|
|
151
|
+
n(u);
|
|
152
152
|
});
|
|
153
|
-
} catch (
|
|
154
|
-
|
|
153
|
+
} catch (i) {
|
|
154
|
+
o(i);
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
class
|
|
158
|
+
class L {
|
|
159
159
|
/**
|
|
160
160
|
* 全局配置对象
|
|
161
161
|
*/
|
|
@@ -516,8 +516,8 @@ class T {
|
|
|
516
516
|
*
|
|
517
517
|
* @param config - 需要覆盖的配置项(深度 Partial)
|
|
518
518
|
*/
|
|
519
|
-
static setConfig = (
|
|
520
|
-
|
|
519
|
+
static setConfig = (t) => {
|
|
520
|
+
L.config = ObjectUtil.deepMerge(L.config, t);
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
523
|
class W {
|
|
@@ -542,10 +542,10 @@ class W {
|
|
|
542
542
|
* @param field - 字段的 key 值
|
|
543
543
|
* @returns 该字段对应类型的 options 配置,如 select 类型返回 `options.select`
|
|
544
544
|
*/
|
|
545
|
-
static findOptions = (
|
|
546
|
-
const
|
|
547
|
-
if (
|
|
548
|
-
return
|
|
545
|
+
static findOptions = (t, n) => {
|
|
546
|
+
const o = t.column.find((a) => a.key === n), r = (a) => a.replace(/-([a-z])/g, (i, u) => u.toUpperCase());
|
|
547
|
+
if (o)
|
|
548
|
+
return o.options[r(o.type)];
|
|
549
549
|
};
|
|
550
550
|
/**
|
|
551
551
|
* 更新组件数据
|
|
@@ -563,9 +563,9 @@ class W {
|
|
|
563
563
|
}))
|
|
564
564
|
)
|
|
565
565
|
*/
|
|
566
|
-
static setOptionsData = (
|
|
567
|
-
const r = W.findOptions(
|
|
568
|
-
r && (r.data =
|
|
566
|
+
static setOptionsData = (t, n, o) => {
|
|
567
|
+
const r = W.findOptions(t, n);
|
|
568
|
+
r && (r.data = o);
|
|
569
569
|
};
|
|
570
570
|
static form = {
|
|
571
571
|
openBefore: {
|
|
@@ -576,9 +576,9 @@ class W {
|
|
|
576
576
|
* @param treeData 树形数据
|
|
577
577
|
* @param option 组件配置
|
|
578
578
|
*/
|
|
579
|
-
parentId: (
|
|
580
|
-
const
|
|
581
|
-
|
|
579
|
+
parentId: (t, n, o, r) => {
|
|
580
|
+
const a = L.config.table.rowKey;
|
|
581
|
+
t ? n.type === $.EDialog.Add ? (n.form.parentId = t[a], n.form.sort = t.children.length + 1) : n.form.parentId = t.parentId.substring(t.parentId.lastIndexOf(",") + 1) : (n.form.parentId = "0", n.form.sort = o.length + 1), W.setOptionsData(r, "parentId", [{ [a]: "0", title: "根", children: o }]);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
};
|
|
@@ -593,14 +593,14 @@ class Q {
|
|
|
593
593
|
* @param field 字段名
|
|
594
594
|
* @param row 行数据
|
|
595
595
|
*/
|
|
596
|
-
static setId = (
|
|
597
|
-
|
|
598
|
-
const r =
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
let
|
|
602
|
-
|
|
603
|
-
}),
|
|
596
|
+
static setId = (t, n, o) => {
|
|
597
|
+
n[t] || (n[t] = []);
|
|
598
|
+
const r = L.config.table.rowKey;
|
|
599
|
+
n[t].forEach((a) => {
|
|
600
|
+
o.forEach((i) => {
|
|
601
|
+
let u = i.default ?? "";
|
|
602
|
+
i.type === "number" && (u = i.default ?? 0), i.type === "boolean" && (u = i.default ?? !1), i.type === "time" && (u = i.default ?? /* @__PURE__ */ new Date()), a[i.value] === void 0 && (a[i.value] = u);
|
|
603
|
+
}), a[r] || (a[r] = Q.getIdFun());
|
|
604
604
|
});
|
|
605
605
|
};
|
|
606
606
|
/**
|
|
@@ -610,19 +610,19 @@ class Q {
|
|
|
610
610
|
* @param itemFields 元素字段-如:[{label:'',value:''}]
|
|
611
611
|
* @param callback 回调函数
|
|
612
612
|
*/
|
|
613
|
-
static add = (
|
|
614
|
-
const
|
|
615
|
-
Q.setId(
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
(
|
|
620
|
-
let
|
|
621
|
-
return c.type === "number" && (
|
|
613
|
+
static add = (t, n, o, r) => {
|
|
614
|
+
const a = JSONUtil.cp(o);
|
|
615
|
+
Q.setId(t, n, o);
|
|
616
|
+
const i = L.config.table.rowKey;
|
|
617
|
+
n[t].push(
|
|
618
|
+
a.reduce(
|
|
619
|
+
(u, c) => {
|
|
620
|
+
let d = c.default ?? "";
|
|
621
|
+
return c.type === "number" && (d = c.default ?? 0), c.type === "boolean" && (d = c.default ?? !1), c.type === "time" && (d = c.default ?? /* @__PURE__ */ new Date()), u[c.value] = d, u;
|
|
622
622
|
},
|
|
623
|
-
{ [
|
|
623
|
+
{ [i]: Q.getIdFun() }
|
|
624
624
|
)
|
|
625
|
-
), r?.(
|
|
625
|
+
), r?.(n);
|
|
626
626
|
};
|
|
627
627
|
/**
|
|
628
628
|
* 删除数组元素
|
|
@@ -631,9 +631,9 @@ class Q {
|
|
|
631
631
|
* @param item 元素-如:{_id:''}
|
|
632
632
|
* @param callback 回调函数
|
|
633
633
|
*/
|
|
634
|
-
static remove = (
|
|
635
|
-
const
|
|
636
|
-
|
|
634
|
+
static remove = (t, n, o, r) => {
|
|
635
|
+
const a = L.config.table.rowKey;
|
|
636
|
+
n[t] = n[t].filter((i) => i[a] !== o[a]), r?.(n);
|
|
637
637
|
};
|
|
638
638
|
/**
|
|
639
639
|
* 获取没有id的数据
|
|
@@ -641,21 +641,21 @@ class Q {
|
|
|
641
641
|
* @param childernField 子级字段-如:list、children
|
|
642
642
|
* @returns 没有id的数据
|
|
643
643
|
*/
|
|
644
|
-
static getNoIdData = (
|
|
645
|
-
const
|
|
646
|
-
return
|
|
647
|
-
|
|
648
|
-
}),
|
|
644
|
+
static getNoIdData = (t, n) => {
|
|
645
|
+
const o = JSONUtil.cp(t), r = L.config.table.rowKey;
|
|
646
|
+
return o.forEach((a) => {
|
|
647
|
+
a[r] && delete a[r], n && a[n] && Q.getNoIdData(a[n], n);
|
|
648
|
+
}), o;
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
|
-
const
|
|
651
|
+
const pt = {
|
|
652
652
|
key: 0,
|
|
653
653
|
class: "column curd-form-com-list",
|
|
654
654
|
style: { width: "100%", gap: "10px" }
|
|
655
|
-
},
|
|
655
|
+
}, wt = { key: 0 }, kt = {
|
|
656
656
|
class: "row items-center",
|
|
657
657
|
style: { gap: "10px", width: "100%" }
|
|
658
|
-
},
|
|
658
|
+
}, vt = { key: 1 }, Ke = /* @__PURE__ */ q({
|
|
659
659
|
__name: "list",
|
|
660
660
|
props: {
|
|
661
661
|
row: {
|
|
@@ -693,88 +693,88 @@ const bt = {
|
|
|
693
693
|
}
|
|
694
694
|
},
|
|
695
695
|
emits: ["change"],
|
|
696
|
-
setup(e, { emit:
|
|
697
|
-
const
|
|
696
|
+
setup(e, { emit: t }) {
|
|
697
|
+
const n = e, o = re({
|
|
698
698
|
show: !1,
|
|
699
|
-
add: (
|
|
700
|
-
Q.add(
|
|
699
|
+
add: (a, i, u) => {
|
|
700
|
+
Q.add(a, i, u, () => {
|
|
701
701
|
r("change");
|
|
702
702
|
});
|
|
703
703
|
},
|
|
704
|
-
remove: (
|
|
705
|
-
Q.remove(
|
|
704
|
+
remove: (a, i, u) => {
|
|
705
|
+
Q.remove(a, i, u, () => {
|
|
706
706
|
r("change");
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
709
|
});
|
|
710
|
-
|
|
711
|
-
Q.setId(
|
|
710
|
+
Te(() => {
|
|
711
|
+
Q.setId(n.field, n.row, n.itemFields), o.show = !0;
|
|
712
712
|
});
|
|
713
|
-
const r =
|
|
714
|
-
return (
|
|
715
|
-
const
|
|
716
|
-
return
|
|
717
|
-
S(
|
|
718
|
-
e.addBottom ? V("", !0) : (g(), v("div",
|
|
719
|
-
F(
|
|
713
|
+
const r = t;
|
|
714
|
+
return (a, i) => {
|
|
715
|
+
const u = fe("el-button"), c = fe("el-input");
|
|
716
|
+
return o.show ? (g(), v("div", pt, [
|
|
717
|
+
S(a.$slots, "list-start", { row: e.row }),
|
|
718
|
+
e.addBottom ? V("", !0) : (g(), v("div", wt, [
|
|
719
|
+
F(u, {
|
|
720
720
|
link: "",
|
|
721
721
|
type: "primary",
|
|
722
|
-
onClick:
|
|
722
|
+
onClick: i[0] || (i[0] = (d) => o.add(e.field, e.row, e.itemFields))
|
|
723
723
|
}, {
|
|
724
|
-
default: p(() => [...
|
|
724
|
+
default: p(() => [...i[3] || (i[3] = [
|
|
725
725
|
M("添加", -1)
|
|
726
726
|
])]),
|
|
727
727
|
_: 1
|
|
728
728
|
})
|
|
729
729
|
])),
|
|
730
|
-
(g(!0), v(B, null, G(e.row[e.field], (
|
|
731
|
-
S(
|
|
732
|
-
item:
|
|
730
|
+
(g(!0), v(B, null, G(e.row[e.field], (d) => (g(), v("div", kt, [
|
|
731
|
+
S(a.$slots, "item-start", {
|
|
732
|
+
item: d,
|
|
733
733
|
row: e.row
|
|
734
734
|
}),
|
|
735
|
-
(g(!0), v(B, null, G(e.itemFields, (
|
|
736
|
-
modelValue:
|
|
737
|
-
"onUpdate:modelValue": (h) =>
|
|
735
|
+
(g(!0), v(B, null, G(e.itemFields, (s) => (g(), b(c, {
|
|
736
|
+
modelValue: d[s.value],
|
|
737
|
+
"onUpdate:modelValue": (h) => d[s.value] = h,
|
|
738
738
|
style: pe({ width: e.inputWidth }),
|
|
739
739
|
class: J(e.inputClass),
|
|
740
|
-
placeholder:
|
|
741
|
-
onChange:
|
|
740
|
+
placeholder: s[e.label] || s[e.value],
|
|
741
|
+
onChange: i[1] || (i[1] = (h) => r("change"))
|
|
742
742
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
|
|
743
|
-
S(
|
|
744
|
-
item:
|
|
743
|
+
S(a.$slots, "item-end", {
|
|
744
|
+
item: d,
|
|
745
745
|
row: e.row
|
|
746
746
|
}),
|
|
747
|
-
F(
|
|
747
|
+
F(u, {
|
|
748
748
|
link: "",
|
|
749
749
|
type: "danger",
|
|
750
|
-
onClick: (
|
|
750
|
+
onClick: (s) => o.remove(e.field, e.row, d)
|
|
751
751
|
}, {
|
|
752
|
-
default: p(() => [...
|
|
752
|
+
default: p(() => [...i[4] || (i[4] = [
|
|
753
753
|
M("删除", -1)
|
|
754
754
|
])]),
|
|
755
755
|
_: 1
|
|
756
756
|
}, 8, ["onClick"])
|
|
757
757
|
]))), 256)),
|
|
758
|
-
e.addBottom ? (g(), v("div",
|
|
759
|
-
F(
|
|
758
|
+
e.addBottom ? (g(), v("div", vt, [
|
|
759
|
+
F(u, {
|
|
760
760
|
link: "",
|
|
761
761
|
type: "primary",
|
|
762
|
-
onClick:
|
|
762
|
+
onClick: i[2] || (i[2] = (d) => o.add(e.field, e.row, e.itemFields))
|
|
763
763
|
}, {
|
|
764
|
-
default: p(() => [...
|
|
764
|
+
default: p(() => [...i[5] || (i[5] = [
|
|
765
765
|
M("添加", -1)
|
|
766
766
|
])]),
|
|
767
767
|
_: 1
|
|
768
768
|
})
|
|
769
769
|
])) : V("", !0),
|
|
770
|
-
S(
|
|
770
|
+
S(a.$slots, "list-end", { row: e.row })
|
|
771
771
|
])) : V("", !0);
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
|
-
}),
|
|
774
|
+
}), Ct = {
|
|
775
775
|
class: "row form-item-content",
|
|
776
776
|
style: { width: "100%" }
|
|
777
|
-
},
|
|
777
|
+
}, xt = { class: "col column form-item-content-item" }, Vt = { class: "col" }, St = ["innerHTML"], Et = /* @__PURE__ */ q({
|
|
778
778
|
__name: "field",
|
|
779
779
|
props: {
|
|
780
780
|
item: {},
|
|
@@ -786,30 +786,49 @@ const bt = {
|
|
|
786
786
|
getDisabled: { type: Function }
|
|
787
787
|
},
|
|
788
788
|
setup(e) {
|
|
789
|
-
|
|
789
|
+
const t = e, n = X(), o = () => {
|
|
790
|
+
const u = n.value?.validateState;
|
|
791
|
+
return u && typeof u == "object" && "value" in u ? u.value : u;
|
|
792
|
+
}, r = async (u) => {
|
|
793
|
+
u && (await mt(), await n.value?.validate?.("").catch(() => {
|
|
794
|
+
}));
|
|
795
|
+
}, a = (u, c) => Array.isArray(u) ? Promise.all(u.map((d) => typeof d == "function" ? d(...c) : d)) : typeof u == "function" ? u(...c) : void 0, i = (u) => {
|
|
796
|
+
const c = t.getOn(u);
|
|
797
|
+
return {
|
|
798
|
+
...c,
|
|
799
|
+
change: (...d) => {
|
|
800
|
+
const s = o() === "error", h = a(c.change, d);
|
|
801
|
+
return Promise.resolve(h).then(() => r(s), () => r(s)).catch(() => {
|
|
802
|
+
}), h;
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
return (u, c) => (g(), b(l(be), {
|
|
807
|
+
ref_key: "formItemRef",
|
|
808
|
+
ref: n,
|
|
790
809
|
label: e.item.text?.form?.label ?? e.item.label,
|
|
791
810
|
prop: e.item.key,
|
|
792
811
|
"label-width": e.item.text?.form?.label == "" ? 0 : e.item.form?.labelWidth || e.labelWidth
|
|
793
812
|
}, {
|
|
794
813
|
default: p(() => [
|
|
795
|
-
R("div",
|
|
796
|
-
S(
|
|
814
|
+
R("div", Ct, [
|
|
815
|
+
S(u.$slots, "form-" + e.item.key + "-start", {
|
|
797
816
|
row: e.form,
|
|
798
817
|
item: e.item
|
|
799
818
|
}),
|
|
800
|
-
R("div",
|
|
801
|
-
R("div",
|
|
802
|
-
S(
|
|
819
|
+
R("div", xt, [
|
|
820
|
+
R("div", Vt, [
|
|
821
|
+
S(u.$slots, "form-" + e.item.key, {
|
|
803
822
|
row: e.form,
|
|
804
823
|
item: e.item
|
|
805
824
|
}, () => [
|
|
806
|
-
e.item.type === "input" ? (g(), b(l(
|
|
825
|
+
e.item.type === "input" ? (g(), b(l(ue), x({
|
|
807
826
|
key: 0,
|
|
808
827
|
modelValue: e.form[e.item.key],
|
|
809
|
-
"onUpdate:modelValue":
|
|
828
|
+
"onUpdate:modelValue": c[0] || (c[0] = (d) => e.form[e.item.key] = d)
|
|
810
829
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
811
830
|
disabled: e.getDisabled(e.item)
|
|
812
|
-
}),
|
|
831
|
+
}), Y({ _: 2 }, [
|
|
813
832
|
e.getBind(e.item).prepend ? {
|
|
814
833
|
name: "prepend",
|
|
815
834
|
fn: p(() => [
|
|
@@ -820,78 +839,78 @@ const bt = {
|
|
|
820
839
|
]), 1040, ["modelValue", "disabled"])) : e.item.type === "number" ? (g(), b(l(ot), x({
|
|
821
840
|
key: 1,
|
|
822
841
|
modelValue: e.form[e.item.key],
|
|
823
|
-
"onUpdate:modelValue":
|
|
842
|
+
"onUpdate:modelValue": c[1] || (c[1] = (d) => e.form[e.item.key] = d)
|
|
824
843
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
825
844
|
disabled: e.getDisabled(e.item)
|
|
826
|
-
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "textarea" ? (g(), b(l(
|
|
845
|
+
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "textarea" ? (g(), b(l(ue), x({
|
|
827
846
|
key: 2,
|
|
828
847
|
type: "textarea",
|
|
829
848
|
modelValue: e.form[e.item.key],
|
|
830
|
-
"onUpdate:modelValue":
|
|
849
|
+
"onUpdate:modelValue": c[2] || (c[2] = (d) => e.form[e.item.key] = d)
|
|
831
850
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
832
851
|
disabled: e.getDisabled(e.item)
|
|
833
852
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "switch" ? (g(), b(l(he), x({
|
|
834
853
|
key: 3,
|
|
835
854
|
modelValue: e.form[e.item.key],
|
|
836
|
-
"onUpdate:modelValue":
|
|
855
|
+
"onUpdate:modelValue": c[3] || (c[3] = (d) => e.form[e.item.key] = d)
|
|
837
856
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
838
857
|
disabled: e.getDisabled(e.item)
|
|
839
|
-
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "select" ? (g(), b(l(
|
|
858
|
+
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "select" ? (g(), b(l(ce), x({
|
|
840
859
|
key: 4,
|
|
841
860
|
modelValue: e.form[e.item.key],
|
|
842
|
-
"onUpdate:modelValue":
|
|
843
|
-
}, e.getBind(e.item), E(
|
|
861
|
+
"onUpdate:modelValue": c[4] || (c[4] = (d) => e.form[e.item.key] = d)
|
|
862
|
+
}, e.getBind(e.item), E(i(e.item)), {
|
|
844
863
|
disabled: e.getDisabled(e.item),
|
|
845
864
|
style: { width: "100%" }
|
|
846
865
|
}), {
|
|
847
866
|
default: p(() => [
|
|
848
|
-
(g(!0), v(B, null, G(e.getBind(e.item).data || [], (
|
|
849
|
-
key:
|
|
850
|
-
}, { ref_for: !0 },
|
|
867
|
+
(g(!0), v(B, null, G(e.getBind(e.item).data || [], (d) => (g(), b(l(ne), x({
|
|
868
|
+
key: d.value
|
|
869
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128))
|
|
851
870
|
]),
|
|
852
871
|
_: 1
|
|
853
872
|
}, 16, ["modelValue", "disabled"])) : e.item.type === "radio" ? (g(), b(l(Ue), x({
|
|
854
873
|
key: 5,
|
|
855
874
|
modelValue: e.form[e.item.key],
|
|
856
|
-
"onUpdate:modelValue":
|
|
875
|
+
"onUpdate:modelValue": c[5] || (c[5] = (d) => e.form[e.item.key] = d)
|
|
857
876
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
858
877
|
disabled: e.getDisabled(e.item),
|
|
859
878
|
style: { width: "100%" }
|
|
860
879
|
}), {
|
|
861
880
|
default: p(() => [
|
|
862
|
-
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (
|
|
863
|
-
key:
|
|
864
|
-
}, { ref_for: !0 },
|
|
865
|
-
key:
|
|
866
|
-
}, { ref_for: !0 },
|
|
881
|
+
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(at), x({
|
|
882
|
+
key: d.value
|
|
883
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128)) : (g(!0), v(B, { key: 1 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(Ae), x({
|
|
884
|
+
key: d.value
|
|
885
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128))
|
|
867
886
|
]),
|
|
868
887
|
_: 1
|
|
869
888
|
}, 16, ["modelValue", "disabled"])) : e.item.type === "checkbox" ? (g(), b(l(nt), x({
|
|
870
889
|
key: 6,
|
|
871
890
|
modelValue: e.form[e.item.key],
|
|
872
|
-
"onUpdate:modelValue":
|
|
873
|
-
}, e.getBind(e.item), E(
|
|
891
|
+
"onUpdate:modelValue": c[6] || (c[6] = (d) => e.form[e.item.key] = d)
|
|
892
|
+
}, e.getBind(e.item), E(i(e.item)), {
|
|
874
893
|
disabled: e.getDisabled(e.item),
|
|
875
894
|
style: { width: "100%" }
|
|
876
895
|
}), {
|
|
877
896
|
default: p(() => [
|
|
878
|
-
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (
|
|
879
|
-
key:
|
|
880
|
-
}, { ref_for: !0 },
|
|
881
|
-
key:
|
|
882
|
-
}, { ref_for: !0 },
|
|
897
|
+
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(lt), x({
|
|
898
|
+
key: d.value
|
|
899
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128)) : (g(!0), v(B, { key: 1 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(it), x({
|
|
900
|
+
key: d.value
|
|
901
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128))
|
|
883
902
|
]),
|
|
884
903
|
_: 1
|
|
885
904
|
}, 16, ["modelValue", "disabled"])) : e.item.type === "color" ? (g(), b(l(rt), x({
|
|
886
905
|
key: 7,
|
|
887
906
|
modelValue: e.form[e.item.key],
|
|
888
|
-
"onUpdate:modelValue":
|
|
907
|
+
"onUpdate:modelValue": c[7] || (c[7] = (d) => e.form[e.item.key] = d)
|
|
889
908
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
890
909
|
disabled: e.getDisabled(e.item)
|
|
891
910
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "slider" ? (g(), b(l(st), x({
|
|
892
911
|
key: 8,
|
|
893
912
|
modelValue: e.form[e.item.key],
|
|
894
|
-
"onUpdate:modelValue":
|
|
913
|
+
"onUpdate:modelValue": c[8] || (c[8] = (d) => e.form[e.item.key] = d)
|
|
895
914
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
896
915
|
disabled: e.getDisabled(e.item)
|
|
897
916
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "list" ? (g(), b(Ke, x({
|
|
@@ -904,36 +923,36 @@ const bt = {
|
|
|
904
923
|
}), null, 16, ["row", "field", "disabled"])) : e.item.type === "treeSelect" ? (g(), b(l(dt), x({
|
|
905
924
|
key: 10,
|
|
906
925
|
modelValue: e.form[e.item.key],
|
|
907
|
-
"onUpdate:modelValue":
|
|
926
|
+
"onUpdate:modelValue": c[9] || (c[9] = (d) => e.form[e.item.key] = d)
|
|
908
927
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
909
928
|
disabled: e.getDisabled(e.item),
|
|
910
929
|
style: { width: "100%" }
|
|
911
930
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "datetime" ? (g(), b(l(Be), x({
|
|
912
931
|
key: 11,
|
|
913
932
|
modelValue: e.form[e.item.key],
|
|
914
|
-
"onUpdate:modelValue":
|
|
915
|
-
}, e.getBind(e.item), E(
|
|
933
|
+
"onUpdate:modelValue": c[10] || (c[10] = (d) => e.form[e.item.key] = d)
|
|
934
|
+
}, e.getBind(e.item), E(i(e.item)), {
|
|
916
935
|
disabled: e.getDisabled(e.item)
|
|
917
936
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type && typeof e.item.type == "object" ? (g(), b(ee(e.item.type), x({
|
|
918
937
|
key: 12,
|
|
919
938
|
modelValue: e.form[e.item.key],
|
|
920
|
-
"onUpdate:modelValue":
|
|
939
|
+
"onUpdate:modelValue": c[11] || (c[11] = (d) => e.form[e.item.key] = d)
|
|
921
940
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
922
941
|
disabled: e.getDisabled(e.item)
|
|
923
942
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type && (l(W).customComponent[e.item.type] || l(W).customComponent[e.item.type]?.form) ? (g(), b(ee(l(W).customComponent[e.item.type]?.form || l(W).customComponent[e.item.type]), x({
|
|
924
943
|
key: 13,
|
|
925
944
|
modelValue: e.form[e.item.key],
|
|
926
|
-
"onUpdate:modelValue":
|
|
945
|
+
"onUpdate:modelValue": c[12] || (c[12] = (d) => e.form[e.item.key] = d)
|
|
927
946
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
928
947
|
disabled: e.getDisabled(e.item)
|
|
929
948
|
}), null, 16, ["modelValue", "disabled"])) : V("", !0)
|
|
930
949
|
]),
|
|
931
|
-
S(
|
|
950
|
+
S(u.$slots, "form-" + e.item.key + "-right", {
|
|
932
951
|
row: e.form,
|
|
933
952
|
item: e.item
|
|
934
953
|
})
|
|
935
954
|
]),
|
|
936
|
-
S(
|
|
955
|
+
S(u.$slots, "form-" + e.item.key + "-tip", {
|
|
937
956
|
row: e.form,
|
|
938
957
|
item: e.item
|
|
939
958
|
}, () => [
|
|
@@ -941,10 +960,10 @@ const bt = {
|
|
|
941
960
|
key: 0,
|
|
942
961
|
class: "form-tip-text",
|
|
943
962
|
innerHTML: typeof e.item.form?.tipText == "function" ? e.item.form?.tipText(e.form, e.type) : e.item.form?.tipText
|
|
944
|
-
}, null, 8,
|
|
963
|
+
}, null, 8, St)) : V("", !0)
|
|
945
964
|
])
|
|
946
965
|
]),
|
|
947
|
-
S(
|
|
966
|
+
S(u.$slots, "form-" + e.item.key + "-end", {
|
|
948
967
|
row: e.form,
|
|
949
968
|
item: e.item
|
|
950
969
|
})
|
|
@@ -954,7 +973,7 @@ const bt = {
|
|
|
954
973
|
}, 8, ["label", "prop", "label-width"]));
|
|
955
974
|
}
|
|
956
975
|
});
|
|
957
|
-
const
|
|
976
|
+
const $t = {
|
|
958
977
|
search: "搜索",
|
|
959
978
|
add: "新增",
|
|
960
979
|
edit: "编辑",
|
|
@@ -992,32 +1011,32 @@ const Et = {
|
|
|
992
1011
|
};
|
|
993
1012
|
class C {
|
|
994
1013
|
/** 解析国际化值:函数则执行并返回字符串,字符串则替换 `{key}` 占位符 */
|
|
995
|
-
static t(
|
|
996
|
-
if (typeof
|
|
997
|
-
return
|
|
998
|
-
|
|
999
|
-
let
|
|
1000
|
-
return
|
|
1014
|
+
static t(t, ...n) {
|
|
1015
|
+
if (typeof t == "function")
|
|
1016
|
+
return t(...n);
|
|
1017
|
+
t = String(t);
|
|
1018
|
+
let o = 0;
|
|
1019
|
+
return t.replace(/{([^}]+)}/g, (r, a) => o < n.length ? String(n[o++]) : `{${a}}`);
|
|
1001
1020
|
}
|
|
1002
|
-
static setI18n = (
|
|
1003
|
-
C.curd = ObjectUtil.deepMerge(C.curd,
|
|
1021
|
+
static setI18n = (t) => {
|
|
1022
|
+
C.curd = ObjectUtil.deepMerge(C.curd, t);
|
|
1004
1023
|
};
|
|
1005
1024
|
/** 解析curd国际化值 */
|
|
1006
|
-
static tCurd(
|
|
1007
|
-
return this.t(this.curd[
|
|
1025
|
+
static tCurd(t, ...n) {
|
|
1026
|
+
return this.t(this.curd[t], ...n);
|
|
1008
1027
|
}
|
|
1009
1028
|
/** curd表单 */
|
|
1010
|
-
static curd =
|
|
1029
|
+
static curd = $t;
|
|
1011
1030
|
}
|
|
1012
|
-
class
|
|
1031
|
+
class Z {
|
|
1013
1032
|
/**
|
|
1014
1033
|
* 删除对象所有属性
|
|
1015
1034
|
* @param obj 对象
|
|
1016
1035
|
* @returns
|
|
1017
1036
|
*/
|
|
1018
|
-
static delAllKey = (
|
|
1019
|
-
Object.keys(
|
|
1020
|
-
delete
|
|
1037
|
+
static delAllKey = (t) => {
|
|
1038
|
+
Object.keys(t).forEach((n) => {
|
|
1039
|
+
delete t[n];
|
|
1021
1040
|
});
|
|
1022
1041
|
};
|
|
1023
1042
|
/**
|
|
@@ -1027,51 +1046,51 @@ class Y {
|
|
|
1027
1046
|
* @param delAll 是否删除目标对象所有属性
|
|
1028
1047
|
* @returns
|
|
1029
1048
|
*/
|
|
1030
|
-
static setValue = (
|
|
1031
|
-
|
|
1032
|
-
|
|
1049
|
+
static setValue = (t, n, o = !1) => {
|
|
1050
|
+
o && Z.delAllKey(t), Object.keys(n).forEach((r) => {
|
|
1051
|
+
t[r] !== n[r] && (t[r] = n[r]);
|
|
1033
1052
|
});
|
|
1034
1053
|
};
|
|
1035
1054
|
}
|
|
1036
1055
|
const we = (e) => {
|
|
1037
|
-
const
|
|
1038
|
-
const r =
|
|
1039
|
-
return r ??
|
|
1056
|
+
const t = re({}), n = () => typeof e == "function" ? e() : e, o = () => {
|
|
1057
|
+
const r = n();
|
|
1058
|
+
return r ?? t;
|
|
1040
1059
|
};
|
|
1041
1060
|
return {
|
|
1042
|
-
internal:
|
|
1043
|
-
isExternal: () =>
|
|
1061
|
+
internal: t,
|
|
1062
|
+
isExternal: () => n() != null,
|
|
1044
1063
|
get() {
|
|
1045
|
-
return
|
|
1064
|
+
return o();
|
|
1046
1065
|
},
|
|
1047
1066
|
set(r) {
|
|
1048
|
-
|
|
1067
|
+
Z.setValue(o(), r, !0);
|
|
1049
1068
|
},
|
|
1050
1069
|
merge(r) {
|
|
1051
|
-
|
|
1070
|
+
Z.setValue(o(), r, !1);
|
|
1052
1071
|
},
|
|
1053
1072
|
clear() {
|
|
1054
|
-
|
|
1073
|
+
Z.delAllKey(o());
|
|
1055
1074
|
}
|
|
1056
1075
|
};
|
|
1057
|
-
},
|
|
1058
|
-
e.forEach((
|
|
1076
|
+
}, me = (e) => {
|
|
1077
|
+
e.forEach((t) => {
|
|
1059
1078
|
console.error({
|
|
1060
|
-
field:
|
|
1061
|
-
error:
|
|
1079
|
+
field: t.field || "",
|
|
1080
|
+
error: t.error || ""
|
|
1062
1081
|
});
|
|
1063
1082
|
});
|
|
1064
|
-
},
|
|
1065
|
-
field:
|
|
1066
|
-
error:
|
|
1067
|
-
}))), ge = $.EDialog,
|
|
1068
|
-
const
|
|
1069
|
-
const
|
|
1070
|
-
if (!
|
|
1071
|
-
const c = r(
|
|
1072
|
-
if (
|
|
1073
|
-
if (!await
|
|
1074
|
-
h ||
|
|
1083
|
+
}, zt = (e) => e ? typeof e == "string" ? e : e instanceof Error ? e.message : e.message || String(e) : "", ke = (e) => !e || typeof e != "object" ? [] : Object.keys(e).flatMap((t) => (Array.isArray(e[t]) ? e[t] : [e[t]]).map((o) => ({
|
|
1084
|
+
field: o?.field || t,
|
|
1085
|
+
error: zt(o)
|
|
1086
|
+
}))), ge = $.EDialog, le = (e) => typeof e.type == "object" ? "component" : e.type || "input", Mt = (e, t, n) => {
|
|
1087
|
+
const o = we(() => t.form), r = (i) => De(i.update.formGrid || [], i.update.form, i.update.type, i.update.formMaxSpan).map((c) => c.item.key).filter(Boolean), a = async (i) => {
|
|
1088
|
+
const u = n.ruleFormRef.value;
|
|
1089
|
+
if (!u) return !0;
|
|
1090
|
+
const c = r(i), d = Object.keys(i.update.rules || {}).filter((h) => !c.includes(h));
|
|
1091
|
+
if (d.length && u.clearValidate(d), !c.length) return !0;
|
|
1092
|
+
if (!await u.validateField(c, async (h, f) => {
|
|
1093
|
+
h || me(ke(f));
|
|
1075
1094
|
})) throw !1;
|
|
1076
1095
|
return !0;
|
|
1077
1096
|
};
|
|
@@ -1084,35 +1103,35 @@ const we = (e) => {
|
|
|
1084
1103
|
loading: !1,
|
|
1085
1104
|
type: ge.Update,
|
|
1086
1105
|
get form() {
|
|
1087
|
-
return
|
|
1106
|
+
return o.get();
|
|
1088
1107
|
},
|
|
1089
|
-
set form(
|
|
1090
|
-
|
|
1108
|
+
set form(i) {
|
|
1109
|
+
o.set(i);
|
|
1091
1110
|
},
|
|
1092
1111
|
formDefault: {},
|
|
1093
1112
|
formColumn: [],
|
|
1094
1113
|
formGrid: [],
|
|
1095
1114
|
formMaxSpan: 12,
|
|
1096
|
-
getDisabled: (
|
|
1115
|
+
getDisabled: (i, u = !1) => {
|
|
1097
1116
|
const c = e();
|
|
1098
|
-
return
|
|
1117
|
+
return t.option.table?.editMode && u ? i.disabled?.table === void 0 ? !1 : $.isFun(i.disabled?.table, c.update.form) : Ie(i, c.update.type, c.update.form);
|
|
1099
1118
|
},
|
|
1100
|
-
getBind: (
|
|
1101
|
-
const
|
|
1102
|
-
return Ne(
|
|
1119
|
+
getBind: (i) => {
|
|
1120
|
+
const u = e();
|
|
1121
|
+
return Ne(i, u.update.type);
|
|
1103
1122
|
},
|
|
1104
|
-
getOn: (
|
|
1123
|
+
getOn: (i, u) => {
|
|
1105
1124
|
const c = e();
|
|
1106
|
-
return Ge(
|
|
1125
|
+
return Ge(i, c.update.type, [u || c.update.form, i]);
|
|
1107
1126
|
},
|
|
1108
|
-
getOptions: (
|
|
1109
|
-
const
|
|
1127
|
+
getOptions: (i) => {
|
|
1128
|
+
const u = e();
|
|
1110
1129
|
try {
|
|
1111
|
-
const
|
|
1112
|
-
return
|
|
1113
|
-
options:
|
|
1130
|
+
const d = qe(u.update.formGrid?.length ? u.update.formGrid : u.update.formColumn).find((s) => s.item.key === i)?.item;
|
|
1131
|
+
return d ? {
|
|
1132
|
+
options: d.options,
|
|
1114
1133
|
//@ts-ignore
|
|
1115
|
-
bind:
|
|
1134
|
+
bind: u.update.getBind(d)
|
|
1116
1135
|
} : { options: {}, bind: {} };
|
|
1117
1136
|
} catch {
|
|
1118
1137
|
return { options: {}, bind: {} };
|
|
@@ -1120,165 +1139,165 @@ const we = (e) => {
|
|
|
1120
1139
|
},
|
|
1121
1140
|
edit: {
|
|
1122
1141
|
data: {},
|
|
1123
|
-
getApiData: (
|
|
1124
|
-
const
|
|
1125
|
-
if (
|
|
1142
|
+
getApiData: (i) => {
|
|
1143
|
+
const u = e();
|
|
1144
|
+
if (t.option.form?.editAll) return i;
|
|
1126
1145
|
const c = {
|
|
1127
|
-
[
|
|
1146
|
+
[t.option.table?.rowKey]: u.update.edit.data[t.option.table?.rowKey]
|
|
1128
1147
|
};
|
|
1129
|
-
return Object.keys(
|
|
1130
|
-
|
|
1148
|
+
return Object.keys(u.update.edit.data).forEach((d) => {
|
|
1149
|
+
i[d] !== u.update.edit.data[d] && (c[d] = i[d]);
|
|
1131
1150
|
}), c;
|
|
1132
1151
|
}
|
|
1133
1152
|
},
|
|
1134
1153
|
view: {},
|
|
1135
1154
|
openLoading: !1,
|
|
1136
|
-
open: async (
|
|
1155
|
+
open: async (i, u) => {
|
|
1137
1156
|
const c = e();
|
|
1138
1157
|
if (!(c.update.showContent || c.update.openLoading)) {
|
|
1139
1158
|
$.loading(!0), c.update.openLoading = !0;
|
|
1140
1159
|
try {
|
|
1141
|
-
c.update.type =
|
|
1142
|
-
const
|
|
1143
|
-
c.update.edit.data =
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
} catch (
|
|
1147
|
-
console.error(
|
|
1160
|
+
c.update.type = i;
|
|
1161
|
+
const d = i === ge.Add;
|
|
1162
|
+
c.update.edit.data = d ? void 0 : JSONUtil.cp(u), c.update.title = C.tCurd(d ? "add" : i === ge.View ? "view" : "edit");
|
|
1163
|
+
const s = d ? ObjectUtil.deepMerge(JSONUtil.cp(c.update.formDefault), u ? JSONUtil.cp(u) : {}) : JSONUtil.cp(u);
|
|
1164
|
+
Z.setValue(c.update.form, s, !0), await c.initApiData("update"), await t.option.form?.openBefore?.(c.update.form, c.update), (!t.option.table?.inlineEdit || d) && (c.update.show = !0, c.update.showContent = !0), t.option.form?.openAfter?.(c.update.form, c.update);
|
|
1165
|
+
} catch (d) {
|
|
1166
|
+
console.error(d);
|
|
1148
1167
|
} finally {
|
|
1149
1168
|
$.loading(!1), c.update.openLoading = !1;
|
|
1150
1169
|
}
|
|
1151
1170
|
}
|
|
1152
1171
|
},
|
|
1153
|
-
validate: async (
|
|
1154
|
-
const
|
|
1172
|
+
validate: async (i = !0) => {
|
|
1173
|
+
const u = e();
|
|
1155
1174
|
try {
|
|
1156
|
-
const c =
|
|
1175
|
+
const c = t.option.table?.editMode ? u.tableEditValidate.validate() : a(u);
|
|
1157
1176
|
return await Promise.all([
|
|
1158
1177
|
c,
|
|
1159
|
-
|
|
1178
|
+
u.formRef.validate()
|
|
1160
1179
|
]), !0;
|
|
1161
1180
|
} catch {
|
|
1162
|
-
return
|
|
1181
|
+
return i && $.fail(C.tCurd("checkFormData")), !1;
|
|
1163
1182
|
}
|
|
1164
1183
|
},
|
|
1165
1184
|
submit: async () => {
|
|
1166
|
-
const
|
|
1167
|
-
if (!await
|
|
1168
|
-
|
|
1169
|
-
const c =
|
|
1185
|
+
const i = e();
|
|
1186
|
+
if (!await i.update.validate() || i.update.loading) return;
|
|
1187
|
+
i.update.loading = !0;
|
|
1188
|
+
const c = i.update.type === ge.Add ? t.option.api.create : t.option.api.update;
|
|
1170
1189
|
try {
|
|
1171
|
-
await
|
|
1190
|
+
await t.option.form?.submitBefore?.(i.update.form, i.update);
|
|
1172
1191
|
} catch {
|
|
1173
|
-
|
|
1192
|
+
i.update.loading = !1;
|
|
1174
1193
|
return;
|
|
1175
1194
|
}
|
|
1176
|
-
let
|
|
1177
|
-
delete
|
|
1178
|
-
const
|
|
1179
|
-
Object.keys(
|
|
1180
|
-
if (
|
|
1181
|
-
const f = new Date(
|
|
1182
|
-
isNaN(f) || (
|
|
1195
|
+
let d = ObjectUtil.deepMerge(i.update.form, {});
|
|
1196
|
+
delete d.children;
|
|
1197
|
+
const s = new Set(t.option.column.filter((h) => h.type === "datetime").map((h) => h.key));
|
|
1198
|
+
Object.keys(d).forEach((h) => {
|
|
1199
|
+
if (s.has(h) && d[h] != null) {
|
|
1200
|
+
const f = new Date(d[h]).getTime();
|
|
1201
|
+
isNaN(f) || (d[h] = f);
|
|
1183
1202
|
}
|
|
1184
1203
|
});
|
|
1185
1204
|
try {
|
|
1186
1205
|
if (!c) return;
|
|
1187
|
-
await c({ ...
|
|
1206
|
+
await c({ ...d }), i.update.close(), await i.table.getList(), t.option.form?.submitAfter?.(d, i.update);
|
|
1188
1207
|
} catch (h) {
|
|
1189
1208
|
console.error(h);
|
|
1190
1209
|
} finally {
|
|
1191
|
-
|
|
1210
|
+
i.update.loading = !1;
|
|
1192
1211
|
}
|
|
1193
1212
|
},
|
|
1194
1213
|
close: () => {
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1214
|
+
const i = e();
|
|
1215
|
+
i.update.show = !1, i.update.edit.data = void 0, setTimeout(() => {
|
|
1216
|
+
i.update.showContent = !1, n.ruleFormRef.value?.resetFields?.(), o.clear();
|
|
1198
1217
|
}, 350);
|
|
1199
1218
|
}
|
|
1200
1219
|
}
|
|
1201
1220
|
};
|
|
1202
|
-
}, H = 12, ve = (e,
|
|
1203
|
-
e.isForm =
|
|
1204
|
-
},
|
|
1205
|
-
const
|
|
1206
|
-
return
|
|
1207
|
-
},
|
|
1208
|
-
if (
|
|
1209
|
-
return e.disabled?.view === void 0 ? !0 : $.isFun(e.disabled?.view,
|
|
1210
|
-
const
|
|
1211
|
-
return $.isFun(
|
|
1212
|
-
}, Ne = (e,
|
|
1213
|
-
const
|
|
1214
|
-
return e.options?.[
|
|
1215
|
-
}, Ge = (e,
|
|
1216
|
-
const
|
|
1217
|
-
return Object.keys(
|
|
1218
|
-
const c =
|
|
1219
|
-
typeof c == "function" ?
|
|
1220
|
-
return c.apply(this, [...
|
|
1221
|
-
} :
|
|
1222
|
-
}),
|
|
1223
|
-
}, He = (e,
|
|
1224
|
-
const
|
|
1221
|
+
}, H = 12, ve = (e, t) => {
|
|
1222
|
+
e.isForm = t, Array.isArray(e.children) && e.children.forEach((n) => ve(n, t));
|
|
1223
|
+
}, Ft = (e) => e.isForm === !1 ? !1 : typeof e.show?.form == "boolean" ? e.show.form : !0, Dt = (e, t, n) => (e.form = e.form || { span: t }, n === "column" ? e.form.span = e.form.span ?? 12 : e.form.span = e.form.span ?? t, e.form.span), Pe = (e) => {
|
|
1224
|
+
const t = e.form;
|
|
1225
|
+
return t?.row != null && t.row > 0 ? t.row : H;
|
|
1226
|
+
}, ie = (e) => Math.floor((e.gridRow - 1) / H), Ie = (e, t, n) => {
|
|
1227
|
+
if (t === $.EDialog.View)
|
|
1228
|
+
return e.disabled?.view === void 0 ? !0 : $.isFun(e.disabled?.view, n);
|
|
1229
|
+
const o = e.disabled?.[t === $.EDialog.Add ? "create" : "update"];
|
|
1230
|
+
return $.isFun(o, n);
|
|
1231
|
+
}, Ne = (e, t) => {
|
|
1232
|
+
const n = le(e);
|
|
1233
|
+
return e.options?.[t === $.EDialog.Add ? "formAdd" : "formUpdate"]?.[n] || e.options?.[n] || {};
|
|
1234
|
+
}, Ge = (e, t, n = []) => {
|
|
1235
|
+
const o = le(e), a = e.options?.[t === $.EDialog.Add ? "formAdd" : "formUpdate"]?.[o]?.on || e.options?.[o]?.on || {}, i = {};
|
|
1236
|
+
return Object.keys(a).forEach((u) => {
|
|
1237
|
+
const c = a[u];
|
|
1238
|
+
typeof c == "function" ? i[u] = function(...d) {
|
|
1239
|
+
return c.apply(this, [...d, ...n]);
|
|
1240
|
+
} : i[u] = c;
|
|
1241
|
+
}), i;
|
|
1242
|
+
}, He = (e, t, n, o, r) => {
|
|
1243
|
+
const a = e, i = a.colSpan ?? e.span;
|
|
1225
1244
|
if (!e.item.form?.spanCol)
|
|
1226
|
-
return
|
|
1227
|
-
const
|
|
1228
|
-
return
|
|
1229
|
-
},
|
|
1230
|
-
const
|
|
1231
|
-
const
|
|
1232
|
-
return
|
|
1245
|
+
return i;
|
|
1246
|
+
const u = r?.maxSpan || 12, c = r?.defaultSpan || u / 2, d = a.gridBand, h = t.filter((f) => d != null ? f.gridBand === d && !$.isFun(f.item.show?.form, n, o) : f.gridRow === a.gridRow && !$.isFun(f.item.show?.form, n, o)).reduce((f, m) => f + (m.colSpan ?? m.span ?? c), 0);
|
|
1247
|
+
return i + h;
|
|
1248
|
+
}, Ot = (e, t) => {
|
|
1249
|
+
const n = (o, r) => {
|
|
1250
|
+
const a = o.gridRow, i = o.gridRow + o.rowSpan - 1, u = r.gridRow, c = r.gridRow + r.rowSpan - 1;
|
|
1251
|
+
return a <= c && u <= i;
|
|
1233
1252
|
};
|
|
1234
|
-
return e.map((
|
|
1235
|
-
...
|
|
1236
|
-
span:
|
|
1237
|
-
colSpan:
|
|
1253
|
+
return e.map((o) => e.filter((a) => n(o, a)).length !== 1 || o.colSpan >= t ? o : {
|
|
1254
|
+
...o,
|
|
1255
|
+
span: t,
|
|
1256
|
+
colSpan: t,
|
|
1238
1257
|
gridColumn: 1
|
|
1239
1258
|
});
|
|
1240
|
-
}, We = (e,
|
|
1241
|
-
const
|
|
1242
|
-
let
|
|
1243
|
-
const
|
|
1244
|
-
if (w + D >
|
|
1245
|
-
for (let O = 0; O <
|
|
1259
|
+
}, We = (e, t, n = {}) => {
|
|
1260
|
+
const o = /* @__PURE__ */ new Set(), r = [];
|
|
1261
|
+
let a = 0, i = 0;
|
|
1262
|
+
const u = (m) => Math.floor(m / H) * H, c = (m, w) => `${m},${w}`, d = (m, w, D, T) => {
|
|
1263
|
+
if (w + D > t) return !1;
|
|
1264
|
+
for (let O = 0; O < T; O++)
|
|
1246
1265
|
for (let A = 0; A < D; A++)
|
|
1247
|
-
if (
|
|
1266
|
+
if (o.has(c(m + O, w + A))) return !1;
|
|
1248
1267
|
return !0;
|
|
1249
|
-
},
|
|
1250
|
-
for (let O = 0; O <
|
|
1268
|
+
}, s = (m, w, D, T) => {
|
|
1269
|
+
for (let O = 0; O < T; O++)
|
|
1251
1270
|
for (let A = 0; A < D; A++)
|
|
1252
|
-
|
|
1253
|
-
}, h = (m, w, D,
|
|
1254
|
-
for (let A =
|
|
1255
|
-
const
|
|
1256
|
-
for (let
|
|
1257
|
-
const xe =
|
|
1258
|
-
for (let te = xe; te <=
|
|
1259
|
-
if (
|
|
1271
|
+
o.add(c(m + O, w + A));
|
|
1272
|
+
}, h = (m, w, D, T) => {
|
|
1273
|
+
for (let A = u(m); A < 500 * H; A += H) {
|
|
1274
|
+
const de = A + H, Ce = A === u(m) ? Math.max(A, m) : A;
|
|
1275
|
+
for (let _ = Ce; _ < de; _++) {
|
|
1276
|
+
const xe = _ === m ? w : 0;
|
|
1277
|
+
for (let te = xe; te <= t - D; te++)
|
|
1278
|
+
if (d(_, te, D, T)) return { tr: _, tc: te };
|
|
1260
1279
|
}
|
|
1261
1280
|
}
|
|
1262
1281
|
return { tr: m, tc: w };
|
|
1263
|
-
}, f = (m, w, D,
|
|
1264
|
-
const O =
|
|
1265
|
-
if (
|
|
1266
|
-
|
|
1282
|
+
}, f = (m, w, D, T) => {
|
|
1283
|
+
const O = u(m);
|
|
1284
|
+
if (T < H && m + T < O + H) {
|
|
1285
|
+
a = m + T, i = w;
|
|
1267
1286
|
return;
|
|
1268
1287
|
}
|
|
1269
1288
|
const A = w + D;
|
|
1270
|
-
if (A <
|
|
1271
|
-
|
|
1289
|
+
if (A < t) {
|
|
1290
|
+
i = A, a = O;
|
|
1272
1291
|
return;
|
|
1273
1292
|
}
|
|
1274
|
-
|
|
1293
|
+
i = 0, a = O + H;
|
|
1275
1294
|
};
|
|
1276
1295
|
return e.forEach((m) => {
|
|
1277
|
-
const w = m.colSpan ?? (m.span === 0 ?
|
|
1278
|
-
m.item.form?.rowBreak && r.length && (
|
|
1279
|
-
let { tr:
|
|
1280
|
-
|
|
1281
|
-
const A =
|
|
1296
|
+
const w = m.colSpan ?? (m.span === 0 ? t : m.span), D = m.rowSpan ?? Pe(m.item);
|
|
1297
|
+
m.item.form?.rowBreak && r.length && (i = 0, a = u(a) + H);
|
|
1298
|
+
let { tr: T, tc: O } = d(a, i, w, D) ? { tr: a, tc: i } : h(a, i, w, D);
|
|
1299
|
+
d(T, O, w, D) || ({ tr: T, tc: O } = h(0, 0, w, D)), s(T, O, w, D);
|
|
1300
|
+
const A = T + 1;
|
|
1282
1301
|
r.push({
|
|
1283
1302
|
...m,
|
|
1284
1303
|
span: w,
|
|
@@ -1286,130 +1305,130 @@ const we = (e) => {
|
|
|
1286
1305
|
rowSpan: D,
|
|
1287
1306
|
gridRow: A,
|
|
1288
1307
|
gridColumn: O + 1,
|
|
1289
|
-
gridBand:
|
|
1290
|
-
}), f(
|
|
1291
|
-
}),
|
|
1292
|
-
}, De = (e,
|
|
1293
|
-
const r = e.filter((
|
|
1294
|
-
e.forEach((
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1308
|
+
gridBand: ie({ gridRow: A })
|
|
1309
|
+
}), f(T, O, w, D);
|
|
1310
|
+
}), n.fillSingleRows ? Ot(r, t) : r;
|
|
1311
|
+
}, De = (e, t, n, o = H) => {
|
|
1312
|
+
const r = e.filter((u) => $.isFun(u.item.show?.form, t, n)), a = /* @__PURE__ */ new Map();
|
|
1313
|
+
e.forEach((u) => {
|
|
1314
|
+
const d = `${u.gridBand ?? ie(u)}:${u.gridColumn}:${u.colSpan}`;
|
|
1315
|
+
a.has(d) || a.set(d, []), a.get(d).push(u);
|
|
1297
1316
|
});
|
|
1298
|
-
const
|
|
1299
|
-
return
|
|
1300
|
-
const c =
|
|
1301
|
-
if (!(
|
|
1302
|
-
const
|
|
1303
|
-
if (
|
|
1304
|
-
const h =
|
|
1305
|
-
|
|
1317
|
+
const i = /* @__PURE__ */ new Map();
|
|
1318
|
+
return a.forEach((u) => {
|
|
1319
|
+
const c = u.reduce((f, m) => f + m.rowSpan, 0);
|
|
1320
|
+
if (!(u.length > 1 && c === H && u.every((f) => f.rowSpan < H))) return;
|
|
1321
|
+
const s = u.filter((f) => $.isFun(f.item.show?.form, t, n));
|
|
1322
|
+
if (s.length !== 1) return;
|
|
1323
|
+
const h = s[0];
|
|
1324
|
+
i.set(h.item.key, {
|
|
1306
1325
|
...h,
|
|
1307
1326
|
rowSpan: H
|
|
1308
1327
|
});
|
|
1309
|
-
}), We(r.map((
|
|
1328
|
+
}), We(r.map((u) => i.get(u.item.key) || u), o, {
|
|
1310
1329
|
fillSingleRows: !0
|
|
1311
1330
|
});
|
|
1312
1331
|
}, Je = (e) => {
|
|
1313
|
-
const
|
|
1314
|
-
return e.forEach((
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
}), Array.from(
|
|
1318
|
-
}, qe = (e) => e?.length ? Array.isArray(e[0]) ? e.flat() : e : [],
|
|
1319
|
-
if (!
|
|
1320
|
-
const
|
|
1321
|
-
return { item: e, span:
|
|
1322
|
-
},
|
|
1323
|
-
const
|
|
1332
|
+
const t = /* @__PURE__ */ new Map();
|
|
1333
|
+
return e.forEach((n) => {
|
|
1334
|
+
const o = n.gridBand ?? ie(n);
|
|
1335
|
+
t.has(o) || t.set(o, []), t.get(o).push(n);
|
|
1336
|
+
}), Array.from(t.keys()).sort((n, o) => n - o).map((n) => t.get(n));
|
|
1337
|
+
}, qe = (e) => e?.length ? Array.isArray(e[0]) ? e.flat() : e : [], Rt = (e, t) => {
|
|
1338
|
+
if (!Ft(e) || !e.key) return null;
|
|
1339
|
+
const n = t.defaultSpan ?? (t.maxSpan || 12) / 2, o = Dt(e, n, t.layout);
|
|
1340
|
+
return { item: e, span: o };
|
|
1341
|
+
}, Ut = (e, t = {}) => {
|
|
1342
|
+
const n = [], o = (r) => {
|
|
1324
1343
|
if (r.children?.length) {
|
|
1325
|
-
r.children.forEach((
|
|
1344
|
+
r.children.forEach((i) => o(i));
|
|
1326
1345
|
return;
|
|
1327
1346
|
}
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1347
|
+
const a = Rt(r, t);
|
|
1348
|
+
a && n.push(a);
|
|
1330
1349
|
};
|
|
1331
|
-
return e.forEach((r) =>
|
|
1332
|
-
}, Qe = (e,
|
|
1333
|
-
const
|
|
1350
|
+
return e.forEach((r) => o(r)), n;
|
|
1351
|
+
}, Qe = (e, t = {}) => {
|
|
1352
|
+
const n = t.maxSpan ?? 12, o = t.defaultSpan ?? n / 2, r = t.layout ?? "row", i = Ut(e, { maxSpan: n, defaultSpan: o, layout: r });
|
|
1334
1353
|
if (r === "column") {
|
|
1335
|
-
const
|
|
1354
|
+
const u = [];
|
|
1336
1355
|
let c = 1;
|
|
1337
|
-
return
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
...
|
|
1356
|
+
return i.forEach((d) => {
|
|
1357
|
+
const s = Pe(d.item), h = n;
|
|
1358
|
+
u.push({
|
|
1359
|
+
...d,
|
|
1341
1360
|
span: h,
|
|
1342
1361
|
colSpan: h,
|
|
1343
|
-
rowSpan:
|
|
1362
|
+
rowSpan: s,
|
|
1344
1363
|
gridRow: c,
|
|
1345
1364
|
gridColumn: 1,
|
|
1346
|
-
gridBand:
|
|
1347
|
-
}), c +=
|
|
1348
|
-
}), { cells:
|
|
1365
|
+
gridBand: ie({ gridRow: c })
|
|
1366
|
+
}), c += s;
|
|
1367
|
+
}), { cells: u, maxSpan: n };
|
|
1349
1368
|
}
|
|
1350
|
-
return { cells: We(
|
|
1351
|
-
},
|
|
1369
|
+
return { cells: We(i, n), maxSpan: n };
|
|
1370
|
+
}, At = (e) => e.map((t) => t.item?.show?.form), Bt = (e, t, n) => {
|
|
1352
1371
|
if (!e.rules) return;
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
] : e.rules;
|
|
1360
|
-
return
|
|
1361
|
-
}, Xe = (e) => (
|
|
1362
|
-
const r = (
|
|
1363
|
-
if (!
|
|
1364
|
-
const
|
|
1365
|
-
return
|
|
1366
|
-
},
|
|
1367
|
-
const
|
|
1368
|
-
return typeof
|
|
1372
|
+
const o = {
|
|
1373
|
+
required: !0,
|
|
1374
|
+
message: t(e),
|
|
1375
|
+
trigger: "blur"
|
|
1376
|
+
}, r = le(e), a = e.options?.datetime?.type, i = r === "datetime" && typeof a == "string" && a.includes("range"), u = r === "select" && !!e.options?.select?.multiple;
|
|
1377
|
+
(i || r === "checkbox" || u) && (o.type = "array", o.min = i ? 2 : 1);
|
|
1378
|
+
const c = typeof e.rules == "boolean" ? [o] : e.rules;
|
|
1379
|
+
return n ? c.map((d) => n(d)) : c;
|
|
1380
|
+
}, Xe = (e) => (t, n) => Bt(t, e, (o) => {
|
|
1381
|
+
const r = (i) => {
|
|
1382
|
+
if (!n || !Object.prototype.hasOwnProperty.call(n, t.key)) return i;
|
|
1383
|
+
const u = n[t.key];
|
|
1384
|
+
return u === void 0 ? i : u;
|
|
1385
|
+
}, a = (i) => {
|
|
1386
|
+
const u = r(i);
|
|
1387
|
+
return typeof o.transform == "function" ? o.transform(u) : u;
|
|
1369
1388
|
};
|
|
1370
|
-
if (
|
|
1371
|
-
const
|
|
1389
|
+
if (o.validator) {
|
|
1390
|
+
const i = o.validator;
|
|
1372
1391
|
return {
|
|
1373
|
-
...
|
|
1374
|
-
transform:
|
|
1375
|
-
validator: (
|
|
1392
|
+
...o,
|
|
1393
|
+
transform: a,
|
|
1394
|
+
validator: (u, c, d) => i(u, c, d, n)
|
|
1376
1395
|
};
|
|
1377
1396
|
}
|
|
1378
1397
|
return {
|
|
1379
|
-
...
|
|
1380
|
-
transform:
|
|
1398
|
+
...o,
|
|
1399
|
+
transform: a
|
|
1381
1400
|
};
|
|
1382
|
-
}), Ye = (e,
|
|
1383
|
-
const
|
|
1401
|
+
}), Ye = (e, t) => {
|
|
1402
|
+
const n = {
|
|
1384
1403
|
input: C.tCurd("placeholderInput"),
|
|
1385
1404
|
select: C.tCurd("placeholderSelect")
|
|
1386
|
-
},
|
|
1387
|
-
return (
|
|
1388
|
-
}, Ze = (e) => Xe((
|
|
1389
|
-
const
|
|
1390
|
-
e.forEach((
|
|
1391
|
-
const { cells: c, maxSpan:
|
|
1392
|
-
maxSpan:
|
|
1393
|
-
defaultSpan:
|
|
1394
|
-
layout:
|
|
1405
|
+
}, o = (n[le(e) || "input"] || n.input) + e.label;
|
|
1406
|
+
return (t || W.error.callback)?.(e.key, e) || o;
|
|
1407
|
+
}, Ze = (e) => Xe((t) => Ye(t, e?.error)), Tt = (e, t, n) => {
|
|
1408
|
+
const o = {}, r = {}, a = t?.maxSpan || 12, i = t?.defaultSpan || a / 2, u = Ze(t);
|
|
1409
|
+
e.forEach((s) => ve(s, !0)), Fe(e, o, r, (s) => u(s, n));
|
|
1410
|
+
const { cells: c, maxSpan: d } = Qe(e, {
|
|
1411
|
+
maxSpan: a,
|
|
1412
|
+
defaultSpan: i,
|
|
1413
|
+
layout: t?.layout
|
|
1395
1414
|
});
|
|
1396
1415
|
return {
|
|
1397
|
-
formDefault:
|
|
1416
|
+
formDefault: o,
|
|
1398
1417
|
rules: r,
|
|
1399
1418
|
formGrid: c,
|
|
1400
|
-
formMaxSpan:
|
|
1419
|
+
formMaxSpan: d,
|
|
1401
1420
|
formColumn: Je(c)
|
|
1402
1421
|
};
|
|
1403
|
-
}, Fe = (e,
|
|
1404
|
-
const r = (
|
|
1405
|
-
if (
|
|
1406
|
-
|
|
1422
|
+
}, Fe = (e, t, n, o) => {
|
|
1423
|
+
const r = (a) => {
|
|
1424
|
+
if (a.children?.length) {
|
|
1425
|
+
a.children.forEach((i) => r(i));
|
|
1407
1426
|
return;
|
|
1408
1427
|
}
|
|
1409
|
-
if (
|
|
1410
|
-
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1428
|
+
if (a.key) {
|
|
1429
|
+
t[a.key] = a.value;
|
|
1430
|
+
const i = o(a);
|
|
1431
|
+
i && (n[a.key] = i);
|
|
1413
1432
|
}
|
|
1414
1433
|
};
|
|
1415
1434
|
e.forEach(r);
|
|
@@ -1428,53 +1447,53 @@ const we = (e) => {
|
|
|
1428
1447
|
getDisabled: { type: Function }
|
|
1429
1448
|
},
|
|
1430
1449
|
setup(e) {
|
|
1431
|
-
const
|
|
1450
|
+
const t = $.isFun, n = e, o = ae(() => De(n.formGrid, n.form, n.type, n.maxSpan)), r = ae(() => {
|
|
1432
1451
|
const f = Array.from(
|
|
1433
1452
|
new Set(
|
|
1434
|
-
|
|
1453
|
+
o.value.map((m) => m.gridBand ?? ie(m))
|
|
1435
1454
|
)
|
|
1436
1455
|
).sort((m, w) => m - w);
|
|
1437
1456
|
return new Map(f.map((m, w) => [m, w]));
|
|
1438
|
-
}),
|
|
1439
|
-
gridTemplateColumns: `repeat(${
|
|
1440
|
-
})),
|
|
1457
|
+
}), a = ae(() => ({
|
|
1458
|
+
gridTemplateColumns: `repeat(${n.maxSpan}, minmax(0, 1fr))`
|
|
1459
|
+
})), i = ae(() => {
|
|
1441
1460
|
let f = 0;
|
|
1442
|
-
return
|
|
1461
|
+
return o.value.forEach((m) => {
|
|
1443
1462
|
const w = m.gridRow + m.rowSpan - 1;
|
|
1444
1463
|
w > f && (f = w);
|
|
1445
1464
|
}), f;
|
|
1446
|
-
}),
|
|
1447
|
-
const m = f.gridBand ??
|
|
1465
|
+
}), u = (f) => f.gridRow + f.rowSpan - 1 >= i.value, c = (f) => f.rowSpan >= H, d = (f) => {
|
|
1466
|
+
const m = f.gridBand ?? ie(f);
|
|
1448
1467
|
return r.value.get(m) ?? m;
|
|
1449
|
-
},
|
|
1450
|
-
maxSpan:
|
|
1451
|
-
defaultSpan:
|
|
1468
|
+
}, s = (f) => He(f, o.value, n.form, n.type, {
|
|
1469
|
+
maxSpan: n.maxSpan,
|
|
1470
|
+
defaultSpan: n.formOption?.defaultSpan
|
|
1452
1471
|
}), h = (f) => {
|
|
1453
|
-
const m =
|
|
1472
|
+
const m = s(f) || f.colSpan;
|
|
1454
1473
|
return {
|
|
1455
1474
|
gridRow: `${f.gridRow} / span ${f.rowSpan}`,
|
|
1456
1475
|
gridColumn: `${f.gridColumn} / span ${m}`
|
|
1457
1476
|
};
|
|
1458
1477
|
};
|
|
1459
|
-
return (f, m) => l(
|
|
1478
|
+
return (f, m) => l(t)(l(At)(e.formGrid), e.form, e.type) ? (g(), v(B, { key: 0 }, [
|
|
1460
1479
|
S(f.$slots, "form-start", { row: e.form }),
|
|
1461
1480
|
R("div", {
|
|
1462
1481
|
class: J(["curd-form-grid", { stripe: e.stripe !== !1 }]),
|
|
1463
|
-
style: pe(
|
|
1482
|
+
style: pe(a.value)
|
|
1464
1483
|
}, [
|
|
1465
|
-
(g(!0), v(B, null, G(
|
|
1484
|
+
(g(!0), v(B, null, G(o.value, (w) => (g(), v("div", {
|
|
1466
1485
|
key: w.item.key,
|
|
1467
1486
|
class: J(["curd-form-grid-cell", [
|
|
1468
|
-
e.stripe !== !1 &&
|
|
1487
|
+
e.stripe !== !1 && d(w) % 2 === 0 ? "stripe-band-odd" : "",
|
|
1469
1488
|
w.gridColumn > 1 ? "has-col-border" : "",
|
|
1470
|
-
e.stripe !== !1 &&
|
|
1489
|
+
e.stripe !== !1 && u(w) ? "is-last-row" : "",
|
|
1471
1490
|
c(w) ? "is-row-span" : "",
|
|
1472
1491
|
`form-item-col-${w.item.key}`
|
|
1473
1492
|
]]),
|
|
1474
1493
|
style: pe(h(w))
|
|
1475
1494
|
}, [
|
|
1476
1495
|
R("div", Lt, [
|
|
1477
|
-
l(
|
|
1496
|
+
l(t)(w.item.show?.form, e.form, e.type) ? (g(), b(Et, {
|
|
1478
1497
|
key: 0,
|
|
1479
1498
|
class: J({ "is-row-span-field": c(w) }),
|
|
1480
1499
|
item: w.item,
|
|
@@ -1484,11 +1503,11 @@ const we = (e) => {
|
|
|
1484
1503
|
"get-bind": e.getBind,
|
|
1485
1504
|
"get-on": e.getOn,
|
|
1486
1505
|
"get-disabled": e.getDisabled
|
|
1487
|
-
},
|
|
1488
|
-
G(f.$slots, (D,
|
|
1489
|
-
name:
|
|
1506
|
+
}, Y({ _: 2 }, [
|
|
1507
|
+
G(f.$slots, (D, T) => ({
|
|
1508
|
+
name: T,
|
|
1490
1509
|
fn: p((O) => [
|
|
1491
|
-
S(f.$slots,
|
|
1510
|
+
S(f.$slots, T, x({ ref_for: !0 }, O || {}))
|
|
1492
1511
|
])
|
|
1493
1512
|
}))
|
|
1494
1513
|
]), 1032, ["class", "item", "form", "type", "label-width", "get-bind", "get-on", "get-disabled"])) : V("", !0)
|
|
@@ -1498,7 +1517,7 @@ const we = (e) => {
|
|
|
1498
1517
|
S(f.$slots, "form-end", { row: e.form })
|
|
1499
1518
|
], 64)) : V("", !0);
|
|
1500
1519
|
}
|
|
1501
|
-
}),
|
|
1520
|
+
}), jt = /* @__PURE__ */ q({
|
|
1502
1521
|
__name: "column",
|
|
1503
1522
|
props: {
|
|
1504
1523
|
option: {
|
|
@@ -1514,57 +1533,57 @@ const we = (e) => {
|
|
|
1514
1533
|
default: void 0
|
|
1515
1534
|
}
|
|
1516
1535
|
},
|
|
1517
|
-
setup(e, { expose:
|
|
1518
|
-
const
|
|
1519
|
-
let
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1522
|
-
|
|
1536
|
+
setup(e, { expose: t }) {
|
|
1537
|
+
const n = $.EDialog, o = X(), r = e;
|
|
1538
|
+
let a = we(r.form);
|
|
1539
|
+
const i = Me.getConf("curdConf"), u = "formRef-" + StrUtil.getId();
|
|
1540
|
+
Le(() => {
|
|
1541
|
+
i?.formRef?.remove(u);
|
|
1523
1542
|
});
|
|
1524
|
-
const c =
|
|
1543
|
+
const c = re({
|
|
1525
1544
|
rules: {},
|
|
1526
1545
|
show: !0,
|
|
1527
1546
|
formDefault: {},
|
|
1528
|
-
type: r.type ||
|
|
1547
|
+
type: r.type || i?.update?.type || n.Add,
|
|
1529
1548
|
formColumn: [],
|
|
1530
1549
|
formGrid: [],
|
|
1531
1550
|
formMaxSpan: 12,
|
|
1532
1551
|
get form() {
|
|
1533
|
-
return
|
|
1552
|
+
return a.get();
|
|
1534
1553
|
},
|
|
1535
|
-
set form(
|
|
1536
|
-
|
|
1554
|
+
set form(d) {
|
|
1555
|
+
a.set(d);
|
|
1537
1556
|
},
|
|
1538
|
-
getDisabled: (
|
|
1539
|
-
getBind: (
|
|
1540
|
-
getOn: (
|
|
1557
|
+
getDisabled: (d) => Ie(d, c.type, c.form),
|
|
1558
|
+
getBind: (d) => Ne(d, c.type),
|
|
1559
|
+
getOn: (d) => Ge(d, c.type, [c.form, d]),
|
|
1541
1560
|
initColumnForm: () => {
|
|
1542
|
-
const
|
|
1543
|
-
c.formDefault =
|
|
1561
|
+
const d = a, s = Tt(r.option.column, r.option.form, d.get());
|
|
1562
|
+
c.formDefault = s.formDefault, c.rules = s.rules, c.formGrid = s.formGrid, c.formMaxSpan = s.formMaxSpan, c.formColumn = s.formColumn, c.type === n.Add ? d.isExternal() ? d.merge(JSONUtil.cp(c.formDefault)) : d.set(JSONUtil.cp(c.formDefault)) : !d.isExternal() && r.form && d.set(JSONUtil.cp(r.form));
|
|
1544
1563
|
}
|
|
1545
1564
|
});
|
|
1546
|
-
return
|
|
1547
|
-
validate: async (
|
|
1548
|
-
const
|
|
1549
|
-
if (!
|
|
1550
|
-
return
|
|
1565
|
+
return i?.formRef?.set(u, {
|
|
1566
|
+
validate: async (d) => {
|
|
1567
|
+
const s = o.value;
|
|
1568
|
+
if (!s)
|
|
1569
|
+
return d?.(!0), !0;
|
|
1551
1570
|
const h = De(c.formGrid || [], c.form, c.type, c.formMaxSpan).map((w) => w.item.key).filter(Boolean), f = Object.keys(c.rules || {}).filter((w) => !h.includes(w));
|
|
1552
|
-
if (f.length &&
|
|
1553
|
-
return
|
|
1554
|
-
const m = await
|
|
1555
|
-
w ||
|
|
1571
|
+
if (f.length && s.clearValidate(f), !h.length)
|
|
1572
|
+
return d?.(!0), !0;
|
|
1573
|
+
const m = await s.validateField(h, async (w, D) => {
|
|
1574
|
+
w || me(ke(D));
|
|
1556
1575
|
});
|
|
1557
|
-
if (
|
|
1576
|
+
if (d?.(!!m), !m) throw !1;
|
|
1558
1577
|
return !0;
|
|
1559
1578
|
}
|
|
1560
|
-
}), r.option.form?.initStart?.(c), c.initColumnForm(), r.option.form?.initEnd?.(c),
|
|
1579
|
+
}), r.option.form?.initStart?.(c), c.initColumnForm(), r.option.form?.initEnd?.(c), gt(
|
|
1561
1580
|
() => r.form,
|
|
1562
|
-
(
|
|
1563
|
-
|
|
1581
|
+
(d) => {
|
|
1582
|
+
a = we(d), c.initColumnForm();
|
|
1564
1583
|
}
|
|
1565
|
-
),
|
|
1584
|
+
), t({ ref: o, conf: c }), (d, s) => (g(), b(l(oe), {
|
|
1566
1585
|
ref_key: "ruleFormRef",
|
|
1567
|
-
ref:
|
|
1586
|
+
ref: o,
|
|
1568
1587
|
model: c.form,
|
|
1569
1588
|
rules: c.rules
|
|
1570
1589
|
}, {
|
|
@@ -1581,11 +1600,11 @@ const we = (e) => {
|
|
|
1581
1600
|
"get-bind": c.getBind,
|
|
1582
1601
|
"get-on": c.getOn,
|
|
1583
1602
|
"get-disabled": c.getDisabled
|
|
1584
|
-
},
|
|
1585
|
-
G(
|
|
1603
|
+
}, Y({ _: 2 }, [
|
|
1604
|
+
G(d.$slots, (h, f) => ({
|
|
1586
1605
|
name: f,
|
|
1587
1606
|
fn: p((m) => [
|
|
1588
|
-
S(
|
|
1607
|
+
S(d.$slots, f, $e(ze(m || {})))
|
|
1589
1608
|
])
|
|
1590
1609
|
}))
|
|
1591
1610
|
]), 1032, ["form-grid", "max-span", "form", "type", "stripe", "label-width", "form-option", "get-bind", "get-on", "get-disabled"])) : V("", !0)
|
|
@@ -1593,35 +1612,35 @@ const we = (e) => {
|
|
|
1593
1612
|
_: 3
|
|
1594
1613
|
}, 8, ["model", "rules"]));
|
|
1595
1614
|
}
|
|
1596
|
-
}),
|
|
1597
|
-
const
|
|
1598
|
-
return
|
|
1615
|
+
}), Kt = (e) => e?.value || e, Pt = (e) => {
|
|
1616
|
+
const t = Kt(e);
|
|
1617
|
+
return t?.validate ? new Promise((n, o) => {
|
|
1599
1618
|
let r = !1;
|
|
1600
|
-
const
|
|
1601
|
-
r || (r = !0,
|
|
1619
|
+
const a = (i, u) => {
|
|
1620
|
+
r || (r = !0, i === !1 ? (me(ke(u)), o(!1)) : n(!0));
|
|
1602
1621
|
};
|
|
1603
1622
|
try {
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
}) : (
|
|
1608
|
-
} catch (
|
|
1609
|
-
|
|
1623
|
+
const i = t.validate(a);
|
|
1624
|
+
i && typeof i.then == "function" ? i.then((u) => a(u)).catch((u) => {
|
|
1625
|
+
me(ke(u?.fields || u)), o(u);
|
|
1626
|
+
}) : (i !== void 0 || t.validate.length === 0) && a(i);
|
|
1627
|
+
} catch (i) {
|
|
1628
|
+
o(i);
|
|
1610
1629
|
}
|
|
1611
1630
|
}) : Promise.resolve(!0);
|
|
1612
|
-
},
|
|
1613
|
-
const e =
|
|
1631
|
+
}, It = () => {
|
|
1632
|
+
const e = re({
|
|
1614
1633
|
formRef: {
|
|
1615
1634
|
map: {},
|
|
1616
|
-
set(
|
|
1617
|
-
e.formRef.map[
|
|
1635
|
+
set(t, n) {
|
|
1636
|
+
e.formRef.map[t] = n;
|
|
1618
1637
|
},
|
|
1619
|
-
remove(
|
|
1620
|
-
delete e.formRef.map[
|
|
1638
|
+
remove(t) {
|
|
1639
|
+
delete e.formRef.map[t];
|
|
1621
1640
|
},
|
|
1622
1641
|
validate() {
|
|
1623
|
-
const
|
|
1624
|
-
return Promise.all(
|
|
1642
|
+
const t = Object.keys(e.formRef.map).map((n) => e.formRef.map[n]);
|
|
1643
|
+
return Promise.all(t.map((n) => Pt(n))).then(() => !0);
|
|
1625
1644
|
}
|
|
1626
1645
|
},
|
|
1627
1646
|
/**
|
|
@@ -1640,101 +1659,101 @@ const we = (e) => {
|
|
|
1640
1659
|
* } }, 'formRef-1')
|
|
1641
1660
|
* @returns
|
|
1642
1661
|
*/
|
|
1643
|
-
regFormRef(
|
|
1644
|
-
|
|
1662
|
+
regFormRef(t, n, o) {
|
|
1663
|
+
t ? o ? e.formRef.set(n, {
|
|
1645
1664
|
validate: async (r) => {
|
|
1646
1665
|
try {
|
|
1647
|
-
r(await
|
|
1666
|
+
r(await o());
|
|
1648
1667
|
} catch {
|
|
1649
1668
|
r(!1);
|
|
1650
1669
|
}
|
|
1651
1670
|
}
|
|
1652
|
-
}) : e.formRef.set(
|
|
1671
|
+
}) : e.formRef.set(n, t) : e.formRef.remove(n);
|
|
1653
1672
|
}
|
|
1654
1673
|
});
|
|
1655
1674
|
return e;
|
|
1656
|
-
},
|
|
1657
|
-
const
|
|
1675
|
+
}, Nt = (e, t) => {
|
|
1676
|
+
const n = we(() => t.searchForm);
|
|
1658
1677
|
return {
|
|
1659
1678
|
search: {
|
|
1660
1679
|
column: {
|
|
1661
1680
|
list: []
|
|
1662
1681
|
},
|
|
1663
1682
|
get form() {
|
|
1664
|
-
return
|
|
1683
|
+
return n.get();
|
|
1665
1684
|
},
|
|
1666
|
-
set form(
|
|
1667
|
-
|
|
1685
|
+
set form(o) {
|
|
1686
|
+
n.set(o);
|
|
1668
1687
|
},
|
|
1669
1688
|
formDefault: {},
|
|
1670
|
-
getPlaceholder: (
|
|
1689
|
+
getPlaceholder: (o, r = C.tCurd("placeholderInput")) => o.text?.search?.placeholder === void 0 ? `${r}${o.label}` : o.text?.search?.placeholder,
|
|
1671
1690
|
getFormData: () => {
|
|
1672
|
-
const
|
|
1691
|
+
const o = e();
|
|
1673
1692
|
let r = {};
|
|
1674
|
-
|
|
1675
|
-
(typeof
|
|
1693
|
+
t.option.column.forEach((i) => {
|
|
1694
|
+
(typeof i.show?.search == "function" ? i.show?.search(o.search.form) : i.show?.search) && (r[i.key] = o.search.form[i.key]);
|
|
1676
1695
|
});
|
|
1677
|
-
const
|
|
1678
|
-
return
|
|
1696
|
+
const a = t.option.search?.before?.(r);
|
|
1697
|
+
return a && (r = a), r;
|
|
1679
1698
|
},
|
|
1680
1699
|
reset: () => {
|
|
1681
|
-
const
|
|
1682
|
-
Object.keys(r).forEach((
|
|
1683
|
-
|
|
1700
|
+
const o = e(), r = o.search.formDefault;
|
|
1701
|
+
Object.keys(r).forEach((i) => {
|
|
1702
|
+
t.option.search?.resetMode === "none" ? r[i] = void 0 : r[i] = o.search.formDefault[i];
|
|
1684
1703
|
});
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1704
|
+
const a = ObjectUtil.deepMerge(r, {});
|
|
1705
|
+
Z.setValue(o.search.form, a, !0), o.page.num = 1, t.option.init !== !1 && o.table.getList();
|
|
1687
1706
|
},
|
|
1688
1707
|
submit: () => {
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1708
|
+
const o = e();
|
|
1709
|
+
o.page.num = 1, o.table.getList();
|
|
1691
1710
|
}
|
|
1692
1711
|
}
|
|
1693
1712
|
};
|
|
1694
|
-
},
|
|
1713
|
+
}, Gt = (e, t) => ({
|
|
1695
1714
|
page: {
|
|
1696
1715
|
num: 1,
|
|
1697
1716
|
total: 0,
|
|
1698
|
-
layout:
|
|
1699
|
-
showTools:
|
|
1700
|
-
size:
|
|
1701
|
-
sizeList:
|
|
1702
|
-
pagerCount:
|
|
1703
|
-
getQuery: (
|
|
1704
|
-
const
|
|
1717
|
+
layout: t.option.page?.layout || L.config.pagination.layout,
|
|
1718
|
+
showTools: t.option.page?.showTools || L.config.pagination.showTools,
|
|
1719
|
+
size: t.option.page?.size || L.config.pagination.size,
|
|
1720
|
+
sizeList: t.option.page?.sizeList || L.config.pagination.pageSizes,
|
|
1721
|
+
pagerCount: t.option.page?.pagerCount || L.config.pagination.pagerCount,
|
|
1722
|
+
getQuery: (n = {}) => {
|
|
1723
|
+
const o = e();
|
|
1705
1724
|
return {
|
|
1706
|
-
[
|
|
1707
|
-
[
|
|
1708
|
-
...
|
|
1725
|
+
[L.config.field.page.size]: n.size || o.page.size,
|
|
1726
|
+
[L.config.field.page.num]: n.num || o.page.num,
|
|
1727
|
+
...o.search.getFormData()
|
|
1709
1728
|
};
|
|
1710
1729
|
}
|
|
1711
1730
|
}
|
|
1712
|
-
}),
|
|
1731
|
+
}), Ht = (e, t, n) => ({
|
|
1713
1732
|
table: {
|
|
1714
1733
|
op: {
|
|
1715
|
-
width: (...
|
|
1734
|
+
width: (...o) => o.filter((a) => a).length * 30 + 60
|
|
1716
1735
|
},
|
|
1717
1736
|
loading: !1,
|
|
1718
1737
|
data: [],
|
|
1719
1738
|
expand: {
|
|
1720
1739
|
isExpand: !1,
|
|
1721
1740
|
rowKeys: [],
|
|
1722
|
-
change: (
|
|
1741
|
+
change: (o, r) => {
|
|
1723
1742
|
},
|
|
1724
1743
|
all: () => {
|
|
1725
|
-
const
|
|
1726
|
-
if (
|
|
1727
|
-
|
|
1744
|
+
const o = e();
|
|
1745
|
+
if (o.table.expand.isExpand)
|
|
1746
|
+
o.table.expand.rowKeys = [];
|
|
1728
1747
|
else {
|
|
1729
|
-
const r = (
|
|
1730
|
-
let
|
|
1731
|
-
return
|
|
1732
|
-
|
|
1733
|
-
}),
|
|
1748
|
+
const r = (a) => {
|
|
1749
|
+
let i = [];
|
|
1750
|
+
return a.forEach((u) => {
|
|
1751
|
+
i.push(u[t.option.table.rowKey]), u.children?.length && (i = i.concat(r(u.children)));
|
|
1752
|
+
}), i;
|
|
1734
1753
|
};
|
|
1735
|
-
|
|
1754
|
+
o.table.expand.rowKeys = r(o.table.data);
|
|
1736
1755
|
}
|
|
1737
|
-
|
|
1756
|
+
o.table.expand.isExpand = !o.table.expand.isExpand;
|
|
1738
1757
|
}
|
|
1739
1758
|
},
|
|
1740
1759
|
column: {
|
|
@@ -1748,117 +1767,117 @@ const we = (e) => {
|
|
|
1748
1767
|
group: {
|
|
1749
1768
|
expand: !1,
|
|
1750
1769
|
toggleExpandAll: () => {
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1755
|
-
|
|
1770
|
+
const o = e(), r = !o.table.header.group.expand;
|
|
1771
|
+
o.table.header.group.expand = r;
|
|
1772
|
+
const a = (i) => {
|
|
1773
|
+
i.forEach((u) => {
|
|
1774
|
+
u.table?.header?.group !== void 0 && (u.table.header.group = !r), u.table?.header?.groupKey !== void 0 && (u.table.header.show = r), Array.isArray(u.children) && u.children.length && a(u.children);
|
|
1756
1775
|
});
|
|
1757
1776
|
};
|
|
1758
|
-
|
|
1777
|
+
a(o.table.column.list);
|
|
1759
1778
|
}
|
|
1760
1779
|
}
|
|
1761
1780
|
},
|
|
1762
1781
|
getList: async () => {
|
|
1763
|
-
const
|
|
1764
|
-
|
|
1765
|
-
const r =
|
|
1782
|
+
const o = e();
|
|
1783
|
+
o.table.loading = !0;
|
|
1784
|
+
const r = t.option.api.list, a = JSONUtil.cp(o.table.selection.list);
|
|
1766
1785
|
try {
|
|
1767
|
-
await
|
|
1768
|
-
let
|
|
1769
|
-
if (
|
|
1770
|
-
const { props: w, order: D } =
|
|
1771
|
-
|
|
1772
|
-
[w.field]:
|
|
1773
|
-
[D.field]:
|
|
1786
|
+
await o.initApiData("init");
|
|
1787
|
+
let i = {};
|
|
1788
|
+
if (o.table.sort.prop) {
|
|
1789
|
+
const { props: w, order: D } = L.config.table.sort;
|
|
1790
|
+
i = {
|
|
1791
|
+
[w.field]: o.table.sort.prop,
|
|
1792
|
+
[D.field]: o.table.sort.order
|
|
1774
1793
|
};
|
|
1775
1794
|
}
|
|
1776
|
-
const
|
|
1777
|
-
...
|
|
1778
|
-
...
|
|
1779
|
-
}), c =
|
|
1780
|
-
const O = h.find((A) => A.item.key ===
|
|
1781
|
-
O && ["select", "radio"].includes(O.item.type) && (O.item.table.format || (O.item.table.format = (A) => O.item.options[O.item.type].data?.find((
|
|
1795
|
+
const u = await r({
|
|
1796
|
+
...o.page.getQuery(),
|
|
1797
|
+
...i
|
|
1798
|
+
}), c = L.config.field.result, d = u.data || { [c.list]: u }, s = (Array.isArray(d[c.list]), d[c.list]), h = qe(o.update.formGrid?.length ? o.update.formGrid : o.update.formColumn), m = ObjectUtil.deepMerge({ data: s }, {}).data.map((w) => (Object.keys(w).forEach((T) => {
|
|
1799
|
+
const O = h.find((A) => A.item.key === T);
|
|
1800
|
+
O && ["select", "radio"].includes(O.item.type) && (O.item.table.format || (O.item.table.format = (A) => O.item.options[O.item.type].data?.find((de) => de.value == A[T])?.label || A[T]));
|
|
1782
1801
|
}), w));
|
|
1783
|
-
|
|
1784
|
-
|
|
1802
|
+
o.table.data = t.option.data ? await t.option.data(m, s) : m, o.tableEditValidate?.clear?.(), o.page.total = d[c.total] || 0, setTimeout(() => {
|
|
1803
|
+
o.table.selection.setList(a);
|
|
1785
1804
|
}, 20);
|
|
1786
|
-
} catch (
|
|
1787
|
-
console.error(
|
|
1805
|
+
} catch (i) {
|
|
1806
|
+
console.error(i);
|
|
1788
1807
|
} finally {
|
|
1789
|
-
|
|
1808
|
+
o.table.loading = !1;
|
|
1790
1809
|
}
|
|
1791
1810
|
},
|
|
1792
1811
|
selection: {
|
|
1793
1812
|
list: [],
|
|
1794
|
-
change: (
|
|
1795
|
-
e().table.selection.list =
|
|
1813
|
+
change: (o) => {
|
|
1814
|
+
e().table.selection.list = o;
|
|
1796
1815
|
},
|
|
1797
|
-
setList: (
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1800
|
-
const
|
|
1801
|
-
if (
|
|
1802
|
-
const
|
|
1803
|
-
const
|
|
1816
|
+
setList: (o, r) => {
|
|
1817
|
+
const a = e();
|
|
1818
|
+
a.table.selection.list = [];
|
|
1819
|
+
const i = n.tableRef.value;
|
|
1820
|
+
if (i?.clearSelection(), !i || !o?.length) return;
|
|
1821
|
+
const u = t.option.table?.rowKey, c = (d) => {
|
|
1822
|
+
const s = (h) => {
|
|
1804
1823
|
for (const f of h) {
|
|
1805
|
-
if (
|
|
1806
|
-
if (f[
|
|
1807
|
-
} else if (f ===
|
|
1824
|
+
if (u != null && u !== "") {
|
|
1825
|
+
if (f[u] === d[u]) return f;
|
|
1826
|
+
} else if (f === d)
|
|
1808
1827
|
return f;
|
|
1809
1828
|
if (Array.isArray(f.children) && f.children.length) {
|
|
1810
|
-
const m =
|
|
1829
|
+
const m = s(f.children);
|
|
1811
1830
|
if (m !== void 0) return m;
|
|
1812
1831
|
}
|
|
1813
1832
|
}
|
|
1814
1833
|
};
|
|
1815
|
-
return
|
|
1834
|
+
return s(a.table.data);
|
|
1816
1835
|
};
|
|
1817
|
-
|
|
1818
|
-
const
|
|
1819
|
-
if (
|
|
1836
|
+
o.forEach((d) => {
|
|
1837
|
+
const s = c(d);
|
|
1838
|
+
if (s)
|
|
1820
1839
|
if (r) {
|
|
1821
|
-
const h = () =>
|
|
1822
|
-
r(
|
|
1840
|
+
const h = () => i.toggleRowSelection(s, !0, !1);
|
|
1841
|
+
r(d) !== !1 && h();
|
|
1823
1842
|
} else
|
|
1824
|
-
|
|
1843
|
+
i.toggleRowSelection(s, !0, !1);
|
|
1825
1844
|
});
|
|
1826
1845
|
}
|
|
1827
1846
|
},
|
|
1828
1847
|
sort: {
|
|
1829
1848
|
prop: "",
|
|
1830
1849
|
order: "",
|
|
1831
|
-
change: (
|
|
1850
|
+
change: (o) => {
|
|
1832
1851
|
const r = e();
|
|
1833
|
-
|
|
1834
|
-
const
|
|
1835
|
-
if (
|
|
1836
|
-
|
|
1852
|
+
L.config.table.sort.resetPage && (r.page.num = 1);
|
|
1853
|
+
const a = L.config.table.sort;
|
|
1854
|
+
if (a.change) {
|
|
1855
|
+
a.change(o, r);
|
|
1837
1856
|
return;
|
|
1838
1857
|
}
|
|
1839
|
-
r.table.sort.prop =
|
|
1858
|
+
r.table.sort.prop = o.prop, o.order === null ? (r.table.sort.order = "", r.table.sort.prop = "") : r.table.sort.order = o.order === "ascending" ? a.order.asc : a.order.desc, r.table.getList();
|
|
1840
1859
|
}
|
|
1841
1860
|
}
|
|
1842
1861
|
}
|
|
1843
|
-
}),
|
|
1844
|
-
const
|
|
1862
|
+
}), Wt = (e, t) => {
|
|
1863
|
+
const n = re({}), o = /* @__PURE__ */ new WeakMap();
|
|
1845
1864
|
let r = 0;
|
|
1846
|
-
const
|
|
1847
|
-
let k =
|
|
1848
|
-
return k || (r += 1, k = `fallback-${r}`,
|
|
1849
|
-
},
|
|
1850
|
-
const k =
|
|
1851
|
-
return z != null && z !== "" ? String(z) :
|
|
1852
|
-
},
|
|
1853
|
-
Object.keys(
|
|
1854
|
-
delete
|
|
1865
|
+
const a = (y) => {
|
|
1866
|
+
let k = o.get(y);
|
|
1867
|
+
return k || (r += 1, k = `fallback-${r}`, o.set(y, k)), k;
|
|
1868
|
+
}, i = (y) => {
|
|
1869
|
+
const k = t.option.table?.rowKey, z = k ? y[k] : void 0;
|
|
1870
|
+
return z != null && z !== "" ? String(z) : a(y);
|
|
1871
|
+
}, u = (y, k) => `${i(y)}-${k.key}`, c = (y) => Ye(y, t.option.form?.error), d = Xe(c), s = () => {
|
|
1872
|
+
Object.keys(n).forEach((y) => {
|
|
1873
|
+
delete n[y];
|
|
1855
1874
|
});
|
|
1856
1875
|
}, h = (y, k) => {
|
|
1857
|
-
delete
|
|
1858
|
-
}, f = (y, k) =>
|
|
1876
|
+
delete n[u(y, k)];
|
|
1877
|
+
}, f = (y, k) => n[u(y, k)] || "", m = (y, k) => y.message || c(k), w = (y) => y == null || y === "" || Array.isArray(y) && y.length === 0, D = (y) => {
|
|
1859
1878
|
if (typeof y == "number") return y;
|
|
1860
1879
|
if (typeof y == "string" || Array.isArray(y)) return y.length;
|
|
1861
|
-
},
|
|
1880
|
+
}, T = (y, k) => {
|
|
1862
1881
|
if (y === "array") return Array.isArray(k);
|
|
1863
1882
|
if (y === "integer") return typeof k == "number" && Number.isInteger(k);
|
|
1864
1883
|
if (y === "float") return typeof k == "number" && !Number.isInteger(k);
|
|
@@ -1904,16 +1923,16 @@ const we = (e) => {
|
|
|
1904
1923
|
const K = typeof y.transform == "function" ? y.transform(k) : k, P = w(K);
|
|
1905
1924
|
if (y.required && P) return m(y, z);
|
|
1906
1925
|
if (P && !y.required) return !0;
|
|
1907
|
-
if (y.whitespace && typeof K == "string" && K.trim() === "" || y.type && !
|
|
1926
|
+
if (y.whitespace && typeof K == "string" && K.trim() === "" || y.type && !T(y.type, K) || Array.isArray(y.enum) && !y.enum.includes(K) || y.pattern && !new RegExp(y.pattern).test(String(K))) return m(y, z);
|
|
1908
1927
|
const j = D(K);
|
|
1909
1928
|
return y.len !== void 0 && j !== void 0 && j !== y.len || y.min !== void 0 && j !== void 0 && j < y.min || y.max !== void 0 && j !== void 0 && j > y.max ? m(y, z) : O(y, K, z);
|
|
1910
|
-
},
|
|
1929
|
+
}, de = (y) => {
|
|
1911
1930
|
const k = e();
|
|
1912
1931
|
return !y.key || !k.table.column.show.list.includes(y.key) || y.table?.header?.groupKey !== void 0 && !y.table.header.show ? !1 : y.show?.table !== void 0 ? $.isFun(y.show?.table, k.table.data) : !0;
|
|
1913
|
-
}, Ce = (y, k) => y.show?.form !== void 0 ? $.isFun(y.show.form, k, $.EDialog.Update) : !0,
|
|
1932
|
+
}, Ce = (y, k) => y.show?.form !== void 0 ? $.isFun(y.show.form, k, $.EDialog.Update) : !0, _ = () => {
|
|
1914
1933
|
const y = e(), k = [], z = (K) => {
|
|
1915
1934
|
K.forEach((P) => {
|
|
1916
|
-
if (
|
|
1935
|
+
if (de(P)) {
|
|
1917
1936
|
if (P.children?.length) {
|
|
1918
1937
|
z(P.children);
|
|
1919
1938
|
return;
|
|
@@ -1926,14 +1945,14 @@ const we = (e) => {
|
|
|
1926
1945
|
}, xe = async (y, k) => {
|
|
1927
1946
|
if (!Ce(k, y))
|
|
1928
1947
|
return h(y, k), !0;
|
|
1929
|
-
const z =
|
|
1948
|
+
const z = d(k, y);
|
|
1930
1949
|
if (!z) return !0;
|
|
1931
1950
|
h(y, k);
|
|
1932
1951
|
const K = Array.isArray(z) ? z : [z];
|
|
1933
1952
|
for (const P of K) {
|
|
1934
1953
|
const j = await A(P, y[k.key], k);
|
|
1935
1954
|
if (j !== !0)
|
|
1936
|
-
return
|
|
1955
|
+
return n[u(y, k)] = j, {
|
|
1937
1956
|
field: k.key,
|
|
1938
1957
|
error: j
|
|
1939
1958
|
};
|
|
@@ -1949,21 +1968,21 @@ const we = (e) => {
|
|
|
1949
1968
|
};
|
|
1950
1969
|
return {
|
|
1951
1970
|
tableEditValidate: {
|
|
1952
|
-
errors:
|
|
1953
|
-
clear:
|
|
1971
|
+
errors: n,
|
|
1972
|
+
clear: s,
|
|
1954
1973
|
clearField: h,
|
|
1955
1974
|
getFieldError: f,
|
|
1956
1975
|
validate: async () => {
|
|
1957
|
-
if (
|
|
1958
|
-
const y = e(), k =
|
|
1976
|
+
if (s(), !t.option.table?.editMode) return !0;
|
|
1977
|
+
const y = e(), k = _(), z = te(y.table.data || []), P = (await Promise.all(z.flatMap((j) => k.map((I) => xe(j, I))))).filter((j) => j !== !0);
|
|
1959
1978
|
if (P.length)
|
|
1960
|
-
throw
|
|
1979
|
+
throw me(P), !1;
|
|
1961
1980
|
return !0;
|
|
1962
1981
|
}
|
|
1963
1982
|
}
|
|
1964
1983
|
};
|
|
1965
1984
|
};
|
|
1966
|
-
class
|
|
1985
|
+
class Jt {
|
|
1967
1986
|
/**
|
|
1968
1987
|
* 导出数据为 Excel 文件(.xlsx),自动触发浏览器下载
|
|
1969
1988
|
*
|
|
@@ -1971,92 +1990,92 @@ class Wt {
|
|
|
1971
1990
|
* @param columns - 列配置数组,需包含 `key`(数据字段)和 `label`(Excel 表头)
|
|
1972
1991
|
* @param fileName - 文件名(不含扩展名),支持字符串或返回字符串的函数;默认生成「导出数据_日期_时间戳」
|
|
1973
1992
|
*/
|
|
1974
|
-
static exportToExcel = async (
|
|
1975
|
-
if (!
|
|
1976
|
-
const r = await $.loadModule("xlsx"),
|
|
1977
|
-
const
|
|
1978
|
-
return
|
|
1979
|
-
|
|
1980
|
-
}),
|
|
1981
|
-
}),
|
|
1982
|
-
r.utils.book_append_sheet(
|
|
1993
|
+
static exportToExcel = async (t, n, o) => {
|
|
1994
|
+
if (!t || t.length === 0) return;
|
|
1995
|
+
const r = await $.loadModule("xlsx"), a = t.map((c) => {
|
|
1996
|
+
const d = {};
|
|
1997
|
+
return n.forEach((s) => {
|
|
1998
|
+
d[s.label] = c[s.key];
|
|
1999
|
+
}), d;
|
|
2000
|
+
}), i = r.utils.json_to_sheet(a), u = r.utils.book_new();
|
|
2001
|
+
r.utils.book_append_sheet(u, i, "Sheet1"), o ? typeof o == "function" && (o = o()) : o = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, r.writeFile(u, `${o}.xlsx`);
|
|
1983
2002
|
};
|
|
1984
2003
|
}
|
|
1985
|
-
const
|
|
2004
|
+
const qt = (e, t) => ({
|
|
1986
2005
|
export: {
|
|
1987
2006
|
run: {
|
|
1988
|
-
start: async (
|
|
1989
|
-
let r = await e().export.run[
|
|
1990
|
-
const
|
|
1991
|
-
|
|
2007
|
+
start: async (n) => {
|
|
2008
|
+
let r = await e().export.run[n]();
|
|
2009
|
+
const a = t.option.column, i = ObjectUtil.deepMerge({ data: r, columns: a }, {}), u = t.option.tools?.export || {};
|
|
2010
|
+
u.before?.(i), Jt.exportToExcel(i.data, i.columns, u.fileName);
|
|
1992
2011
|
},
|
|
1993
2012
|
select: async () => {
|
|
1994
|
-
const
|
|
1995
|
-
|
|
2013
|
+
const n = e();
|
|
2014
|
+
n.export.loading = !0;
|
|
1996
2015
|
try {
|
|
1997
|
-
if (
|
|
1998
|
-
await
|
|
1999
|
-
...
|
|
2000
|
-
items:
|
|
2016
|
+
if (t.option.tools?.export?.select) {
|
|
2017
|
+
await t.option.tools.export.select({
|
|
2018
|
+
...n.page.getQuery(),
|
|
2019
|
+
items: n.table.selection.list
|
|
2001
2020
|
});
|
|
2002
2021
|
return;
|
|
2003
2022
|
}
|
|
2004
|
-
if (
|
|
2023
|
+
if (n.table.selection.list.length === 0)
|
|
2005
2024
|
throw $.fail(C.tCurd("selectDataToExport")), new Error(C.tCurd("selectDataToExport"));
|
|
2006
|
-
return
|
|
2007
|
-
} catch (
|
|
2008
|
-
console.error(
|
|
2025
|
+
return n.table.selection.list;
|
|
2026
|
+
} catch (o) {
|
|
2027
|
+
console.error(o);
|
|
2009
2028
|
} finally {
|
|
2010
|
-
|
|
2029
|
+
n.export.loading = !1;
|
|
2011
2030
|
}
|
|
2012
2031
|
},
|
|
2013
2032
|
page: async () => {
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2033
|
+
const n = e();
|
|
2034
|
+
n.export.loading = !0;
|
|
2016
2035
|
try {
|
|
2017
|
-
if (
|
|
2018
|
-
await
|
|
2019
|
-
...
|
|
2036
|
+
if (t.option.tools?.export?.page) {
|
|
2037
|
+
await t.option.tools.export.page({
|
|
2038
|
+
...n.page.getQuery()
|
|
2020
2039
|
});
|
|
2021
2040
|
return;
|
|
2022
2041
|
}
|
|
2023
|
-
if (
|
|
2042
|
+
if (n.table.data.length === 0)
|
|
2024
2043
|
throw $.fail(C.tCurd("noData")), new Error(C.tCurd("noData"));
|
|
2025
|
-
return
|
|
2026
|
-
} catch (
|
|
2027
|
-
console.error(
|
|
2044
|
+
return n.table.data;
|
|
2045
|
+
} catch (o) {
|
|
2046
|
+
console.error(o);
|
|
2028
2047
|
} finally {
|
|
2029
|
-
|
|
2048
|
+
n.export.loading = !1;
|
|
2030
2049
|
}
|
|
2031
2050
|
},
|
|
2032
2051
|
all: async () => {
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2052
|
+
const n = e();
|
|
2053
|
+
n.export.loading = !0;
|
|
2035
2054
|
try {
|
|
2036
|
-
if (
|
|
2037
|
-
await
|
|
2038
|
-
...
|
|
2055
|
+
if (t.option.tools?.export?.all) {
|
|
2056
|
+
await t.option.tools.export.all({
|
|
2057
|
+
...n.page.getQuery()
|
|
2039
2058
|
});
|
|
2040
2059
|
return;
|
|
2041
2060
|
}
|
|
2042
|
-
const
|
|
2043
|
-
...
|
|
2061
|
+
const o = t.option.api.list, r = await o({
|
|
2062
|
+
...n.page.getQuery({ size: 999999, num: 1 })
|
|
2044
2063
|
});
|
|
2045
|
-
return (r.data || { [
|
|
2046
|
-
} catch (
|
|
2047
|
-
console.error(
|
|
2064
|
+
return (r.data || { [L.config.field.result.list]: r })[L.config.field.result.list];
|
|
2065
|
+
} catch (o) {
|
|
2066
|
+
console.error(o);
|
|
2048
2067
|
} finally {
|
|
2049
|
-
|
|
2068
|
+
n.export.loading = !1;
|
|
2050
2069
|
}
|
|
2051
2070
|
}
|
|
2052
2071
|
},
|
|
2053
2072
|
loading: !1,
|
|
2054
|
-
click: (
|
|
2055
|
-
const
|
|
2056
|
-
|
|
2073
|
+
click: (n) => {
|
|
2074
|
+
const o = e();
|
|
2075
|
+
o.export.loading || o.export.run.start(n);
|
|
2057
2076
|
}
|
|
2058
2077
|
}
|
|
2059
|
-
}),
|
|
2078
|
+
}), Qt = (e, t) => ({
|
|
2060
2079
|
remove: {
|
|
2061
2080
|
title: C.tCurd("deleteTitle"),
|
|
2062
2081
|
show: !1,
|
|
@@ -2065,81 +2084,81 @@ const Jt = (e, o) => ({
|
|
|
2065
2084
|
close: () => {
|
|
2066
2085
|
e().remove.show = !1;
|
|
2067
2086
|
},
|
|
2068
|
-
open: (
|
|
2069
|
-
if (
|
|
2087
|
+
open: (n) => {
|
|
2088
|
+
if (n.length === 0) {
|
|
2070
2089
|
$.fail(C.tCurd("selectDataToDelete"));
|
|
2071
2090
|
return;
|
|
2072
2091
|
}
|
|
2073
|
-
const
|
|
2074
|
-
|
|
2092
|
+
const o = e();
|
|
2093
|
+
o.remove.items = n, o.remove.show = !0;
|
|
2075
2094
|
},
|
|
2076
2095
|
submit: () => {
|
|
2077
2096
|
FunUtil.throttle(async () => {
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2080
|
-
const
|
|
2097
|
+
const n = e();
|
|
2098
|
+
n.remove.loading = !0;
|
|
2099
|
+
const o = t.option.api.delete;
|
|
2081
2100
|
try {
|
|
2082
|
-
if (!
|
|
2083
|
-
await
|
|
2084
|
-
[
|
|
2085
|
-
items:
|
|
2086
|
-
}), $.success(C.tCurd("operationSuccess")),
|
|
2101
|
+
if (!o) return;
|
|
2102
|
+
await o({
|
|
2103
|
+
[t.option.table?.rowKey]: n.remove.items.map((r) => r[t.option.table?.rowKey]),
|
|
2104
|
+
items: n.remove.items
|
|
2105
|
+
}), $.success(C.tCurd("operationSuccess")), n.table.data.length <= 1 && n.page.num > 1 && (n.page.num -= 1), n.remove.close(), await n.table.getList();
|
|
2087
2106
|
} catch (r) {
|
|
2088
2107
|
console.error(r);
|
|
2089
2108
|
} finally {
|
|
2090
|
-
|
|
2109
|
+
n.remove.loading = !1;
|
|
2091
2110
|
}
|
|
2092
2111
|
});
|
|
2093
2112
|
}
|
|
2094
2113
|
}
|
|
2095
|
-
}),
|
|
2114
|
+
}), Xt = (e, t, n) => ({
|
|
2096
2115
|
apiDataMap: {},
|
|
2097
|
-
getColumnSpan: (
|
|
2098
|
-
const
|
|
2099
|
-
return He(
|
|
2100
|
-
maxSpan:
|
|
2101
|
-
defaultSpan:
|
|
2116
|
+
getColumnSpan: (o, r) => {
|
|
2117
|
+
const a = e(), i = a.update.formGrid?.length ? a.update.formGrid : r || [];
|
|
2118
|
+
return He(o, i, a.update.form, a.update.type, {
|
|
2119
|
+
maxSpan: a.update.formMaxSpan || t.option.form?.maxSpan,
|
|
2120
|
+
defaultSpan: t.option.form?.defaultSpan || L.config.form.defaultSpan
|
|
2102
2121
|
});
|
|
2103
2122
|
},
|
|
2104
2123
|
init: () => {
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2124
|
+
const o = e();
|
|
2125
|
+
o.initCurdConfig(), o.initColumnOptions(), o.initColumnForm();
|
|
2107
2126
|
},
|
|
2108
|
-
initApiData: async (
|
|
2109
|
-
const r = e(),
|
|
2110
|
-
if (
|
|
2111
|
-
|
|
2127
|
+
initApiData: async (o) => {
|
|
2128
|
+
const r = e(), a = [], i = (u) => {
|
|
2129
|
+
if (u.children?.length) {
|
|
2130
|
+
u.children.forEach((d) => i(d));
|
|
2112
2131
|
return;
|
|
2113
2132
|
}
|
|
2114
|
-
const c =
|
|
2115
|
-
if (
|
|
2116
|
-
if (r.apiDataMap[
|
|
2117
|
-
const
|
|
2133
|
+
const c = le(u);
|
|
2134
|
+
if (u.options?.[c]?.dataApi && u.options?.[c]?.dataApiConfig?.[o]) {
|
|
2135
|
+
if (r.apiDataMap[u.key] && u.options?.[c]?.dataApiConfig?.once) return;
|
|
2136
|
+
const d = (async () => {
|
|
2118
2137
|
try {
|
|
2119
|
-
let
|
|
2120
|
-
if (
|
|
2121
|
-
const h =
|
|
2122
|
-
!Array.isArray(
|
|
2138
|
+
let s = await u.options?.[c]?.dataApi?.(r.update.form, r.update.type);
|
|
2139
|
+
if (s) {
|
|
2140
|
+
const h = u.options?.[c]?.dataPath;
|
|
2141
|
+
!Array.isArray(s) && h && (s = ObjectUtil.getPathValue(s, h)), u.options[c].data = s, u.options.search[c].data = s, u.options.search[u.options.search.type ?? c] || (u.options.search[u.options.search.type ?? c] = {}), u.options.search[u.options.search.type ?? c].data = s, u.options.formAdd[c].data = s, u.options.formUpdate[c].data = s, r.apiDataMap[u.key] = s;
|
|
2123
2142
|
}
|
|
2124
2143
|
} catch {
|
|
2125
2144
|
}
|
|
2126
2145
|
})();
|
|
2127
|
-
|
|
2146
|
+
a.push(d);
|
|
2128
2147
|
}
|
|
2129
2148
|
};
|
|
2130
|
-
return
|
|
2149
|
+
return t.option.column.forEach((u) => i(u)), await Promise.all(a), !0;
|
|
2131
2150
|
},
|
|
2132
2151
|
initCurdConfig: () => {
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
const r = ObjectUtil.deepMerge(
|
|
2136
|
-
Object.keys(r).forEach((
|
|
2137
|
-
|
|
2152
|
+
const o = ObjectUtil.deepMerge(L.config, {});
|
|
2153
|
+
o.table.emptyText = C.tCurd("noData"), t.option.size = t.option.size || {}, o.table.size = t.option.size.table || o.size.table, o.form.size = t.option.size.form || o.size.form, o.size.search = t.option.size.search || o.size.search;
|
|
2154
|
+
const r = ObjectUtil.deepMerge(o, t.option || {});
|
|
2155
|
+
Object.keys(r).forEach((a) => {
|
|
2156
|
+
t.option[a] = r[a];
|
|
2138
2157
|
});
|
|
2139
2158
|
},
|
|
2140
2159
|
initColumnOptions: () => {
|
|
2141
|
-
const
|
|
2142
|
-
let r = JSONUtil.cp(
|
|
2160
|
+
const o = e();
|
|
2161
|
+
let r = JSONUtil.cp(L.config.columnConfig);
|
|
2143
2162
|
r.options = ObjectUtil.deepMerge(
|
|
2144
2163
|
{
|
|
2145
2164
|
switch: {
|
|
@@ -2149,150 +2168,149 @@ const Jt = (e, o) => ({
|
|
|
2149
2168
|
},
|
|
2150
2169
|
r.options
|
|
2151
2170
|
);
|
|
2152
|
-
const
|
|
2153
|
-
const
|
|
2154
|
-
for (const
|
|
2155
|
-
if (
|
|
2156
|
-
if (
|
|
2157
|
-
|
|
2171
|
+
const a = (i) => {
|
|
2172
|
+
const u = le(i);
|
|
2173
|
+
for (const d in r) {
|
|
2174
|
+
if (d === "table") {
|
|
2175
|
+
if (i.table = ObjectUtil.deepMerge(r.table, i.table || {}), i.children) {
|
|
2176
|
+
i.children.forEach((s) => a(s));
|
|
2158
2177
|
return;
|
|
2159
2178
|
}
|
|
2160
|
-
} else
|
|
2161
|
-
|
|
2179
|
+
} else d === "type" ? i.type = i.type || r.type : i[d] = ObjectUtil.deepMerge(r[d], i[d] || {});
|
|
2180
|
+
i.options = i.options || {}, i.options[u] = i.options[u] || {}, i.options[u].size = t.option.size.form;
|
|
2162
2181
|
}
|
|
2163
|
-
["search", "formAdd", "formUpdate"].forEach((
|
|
2164
|
-
|
|
2165
|
-
}),
|
|
2166
|
-
const h =
|
|
2182
|
+
["search", "formAdd", "formUpdate"].forEach((d) => {
|
|
2183
|
+
i.options[d] = ObjectUtil.deepMerge(i.options, i.options[d] || {}), d === "search" ? t.option.size.search && (i.options[d][u].size = t.option.size.search) : t.option.size.form && (i.options[d][u].size = t.option.size.form);
|
|
2184
|
+
}), i.table = ObjectUtil.deepMerge(i.table, i.options[u].table || {}), u === "switch" && (i.options.switch.tableBeforeChange = async (d, s) => {
|
|
2185
|
+
const h = i.options?.switch;
|
|
2167
2186
|
try {
|
|
2168
|
-
h.tableConfig?.confirm && await
|
|
2187
|
+
h.tableConfig?.confirm && await n.switchConfirmRef.value?.open({
|
|
2169
2188
|
title: C.tCurd("confirmModify"),
|
|
2170
2189
|
content: C.tCurd("confirmSwitchMessage")
|
|
2171
2190
|
});
|
|
2172
2191
|
try {
|
|
2173
|
-
if (!
|
|
2174
|
-
const f =
|
|
2192
|
+
if (!t.option.api.update && !h.tableConfig?.api) return;
|
|
2193
|
+
const f = s[t.option.table?.rowKey];
|
|
2175
2194
|
h.loadingMap || (h.loadingMap = {}), h.loadingMap[f] || (h.loadingMap[f] = { loading: !1 }), h.loadingMap[f].loading = !0;
|
|
2176
|
-
const m =
|
|
2195
|
+
const m = s[d] === h.activeValue ? h.inactiveValue : h.activeValue, w = h.tableConfig?.api ? h.tableConfig.api : t.option.api.update;
|
|
2177
2196
|
if (!w) return;
|
|
2178
2197
|
try {
|
|
2179
|
-
await w({ ...
|
|
2198
|
+
await w({ ...s, [d]: m }, "switch");
|
|
2180
2199
|
} catch {
|
|
2181
2200
|
return !1;
|
|
2182
2201
|
} finally {
|
|
2183
2202
|
h.loadingMap[f].loading = !1;
|
|
2184
2203
|
}
|
|
2185
|
-
return $.success(C.tCurd("operationSuccess")), h.tableConfig?.loadList && (
|
|
2204
|
+
return $.success(C.tCurd("operationSuccess")), h.tableConfig?.loadList && (o.table.loading = !0, o.table.getList(), o.table.loading = !1), !0;
|
|
2186
2205
|
} catch (f) {
|
|
2187
2206
|
return console.error(f), !1;
|
|
2188
2207
|
} finally {
|
|
2189
|
-
|
|
2208
|
+
o.table.loading = !1;
|
|
2190
2209
|
}
|
|
2191
2210
|
} catch {
|
|
2192
2211
|
return !1;
|
|
2193
2212
|
}
|
|
2194
|
-
}),
|
|
2213
|
+
}), u === "treeSelect" && (i.options.treeSelect.rowKey = t.option.table?.rowKey, i.options.treeSelect.nodeKey = t.option.table?.rowKey);
|
|
2195
2214
|
};
|
|
2196
|
-
|
|
2215
|
+
t.option.column.forEach(a), t.option.table?.column?.forEach(a);
|
|
2197
2216
|
},
|
|
2198
2217
|
initColumnForm: () => {
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2201
|
-
const
|
|
2218
|
+
const o = e(), r = t.option;
|
|
2219
|
+
o.update.formColumn = [], o.update.formGrid = [], o.update.formMaxSpan = 12, o.table.column.show = { list: [], listSource: [] };
|
|
2220
|
+
const a = t.option.form?.maxSpan || 12, i = t.option.form?.defaultSpan || a / 2, u = Ze(t.option.form), c = (f) => {
|
|
2202
2221
|
if (f.children) {
|
|
2203
|
-
|
|
2222
|
+
o.table.column.show.list.push(f.key), f.children.forEach((m) => c(m));
|
|
2204
2223
|
return;
|
|
2205
2224
|
}
|
|
2206
|
-
|
|
2225
|
+
o.update.formDefault[f.key] = f.value, f.table?.table && (f.show?.table && o.table.column.show.list.push(f.key), o.table.column.show.listSource.push(f.key));
|
|
2207
2226
|
};
|
|
2208
2227
|
r.column.forEach((f) => {
|
|
2209
2228
|
ve(f, !0), c(f);
|
|
2210
|
-
}),
|
|
2229
|
+
}), t.option.table?.column?.forEach((f) => {
|
|
2211
2230
|
ve(f, !1), c(f);
|
|
2212
|
-
}),
|
|
2213
|
-
const
|
|
2214
|
-
maxSpan:
|
|
2215
|
-
defaultSpan:
|
|
2216
|
-
layout:
|
|
2231
|
+
}), o.search.column.list = r.column.concat(r.table?.column || []), o.table.column.list = o.search.column.list.filter((f) => f.table?.table), o.search.column.list.sort((f, m) => f.sort?.search - m.sort?.search), o.table.column.list.sort((f, m) => f.sort?.table - m.sort?.table), o.update.rules = {}, Fe(r.column, o.update.formDefault, o.update.rules, (f) => u(f, o.update.form)), r.table?.editMode && Fe(r.table?.column || [], o.update.formDefault, o.update.rules, (f) => u(f, o.update.form));
|
|
2232
|
+
const d = Qe(r.column, {
|
|
2233
|
+
maxSpan: a,
|
|
2234
|
+
defaultSpan: i,
|
|
2235
|
+
layout: t.option.form?.layout
|
|
2217
2236
|
});
|
|
2218
|
-
|
|
2219
|
-
const
|
|
2220
|
-
|
|
2221
|
-
|
|
2237
|
+
o.update.formGrid = d.cells, o.update.formMaxSpan = d.maxSpan, o.update.formColumn = Je(d.cells);
|
|
2238
|
+
const s = t.option.search?.formDefault;
|
|
2239
|
+
s && Object.keys(s).forEach((f) => {
|
|
2240
|
+
o.search.formDefault[f] = s[f];
|
|
2222
2241
|
}), r.column.forEach((f) => {
|
|
2223
|
-
f.show?.search || (
|
|
2242
|
+
f.show?.search || (o.search.formDefault[f.key] = void 0);
|
|
2224
2243
|
});
|
|
2225
|
-
const h = ObjectUtil.deepMerge(
|
|
2226
|
-
|
|
2244
|
+
const h = ObjectUtil.deepMerge(o.search.formDefault, {});
|
|
2245
|
+
Z.setValue(o.search.form, h, !0);
|
|
2227
2246
|
}
|
|
2228
|
-
}),
|
|
2229
|
-
const
|
|
2230
|
-
let d;
|
|
2231
|
-
const c = (h) => {
|
|
2247
|
+
}), Yt = (e) => {
|
|
2248
|
+
const t = X(), n = X(), o = X(), r = { switchConfirmRef: t, ruleFormRef: n, tableRef: o }, a = je(), i = Me.getConf("curdConf"), u = (h) => {
|
|
2232
2249
|
h = h || d;
|
|
2233
2250
|
let f = h, m = h;
|
|
2234
2251
|
for (; f?.parentCurdConf; )
|
|
2235
2252
|
m = f.parentCurdConf, f = f.parentCurdConf;
|
|
2236
2253
|
return m;
|
|
2237
|
-
},
|
|
2238
|
-
d =
|
|
2239
|
-
parentCurdConf:
|
|
2240
|
-
getCurdConf:
|
|
2241
|
-
getRootCurdConf:
|
|
2242
|
-
...
|
|
2254
|
+
}, c = () => d;
|
|
2255
|
+
let d = re({
|
|
2256
|
+
parentCurdConf: i,
|
|
2257
|
+
getCurdConf: u,
|
|
2258
|
+
getRootCurdConf: u,
|
|
2259
|
+
...It(),
|
|
2243
2260
|
option: e.option,
|
|
2244
|
-
...
|
|
2245
|
-
...
|
|
2246
|
-
...
|
|
2247
|
-
...
|
|
2248
|
-
...
|
|
2249
|
-
...
|
|
2250
|
-
...
|
|
2251
|
-
...
|
|
2252
|
-
})
|
|
2253
|
-
|
|
2254
|
-
|
|
2261
|
+
...Nt(c, e),
|
|
2262
|
+
...Gt(c, e),
|
|
2263
|
+
...Ht(c, e, r),
|
|
2264
|
+
...Wt(c, e),
|
|
2265
|
+
...qt(c, e),
|
|
2266
|
+
...Mt(c, e, r),
|
|
2267
|
+
...Qt(c, e),
|
|
2268
|
+
...Xt(c, e, r)
|
|
2269
|
+
});
|
|
2270
|
+
d.init();
|
|
2271
|
+
const s = a ? `curdRef-${a.uid}` : "";
|
|
2272
|
+
return i?.formRef && s && (i.formRef.set(s, {
|
|
2255
2273
|
validate: async (h) => {
|
|
2256
2274
|
const f = await d.update.validate(!1);
|
|
2257
2275
|
if (h?.(!!f), !f) throw !1;
|
|
2258
2276
|
return !0;
|
|
2259
2277
|
}
|
|
2260
|
-
}),
|
|
2261
|
-
|
|
2262
|
-
})),
|
|
2278
|
+
}), Le(() => {
|
|
2279
|
+
i.formRef.remove(s);
|
|
2280
|
+
})), Te(() => {
|
|
2263
2281
|
e.option.init !== !1 && d.table.getList();
|
|
2264
|
-
}), Me.setConf("curdConf", d), { conf: d, switchConfirmRef:
|
|
2265
|
-
},
|
|
2282
|
+
}), Me.setConf("curdConf", d), { conf: d, switchConfirmRef: t, ruleFormRef: n, tableRef: o };
|
|
2283
|
+
}, Zt = { class: "dialog-footer" }, _t = /* @__PURE__ */ q({
|
|
2266
2284
|
__name: "switchConfirm",
|
|
2267
2285
|
props: {
|
|
2268
2286
|
size: {}
|
|
2269
2287
|
},
|
|
2270
|
-
setup(e, { expose:
|
|
2271
|
-
const
|
|
2272
|
-
let
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2288
|
+
setup(e, { expose: t }) {
|
|
2289
|
+
const n = X(!1), o = X("确认修改"), r = X("确认要修改状态吗?");
|
|
2290
|
+
let a = null, i = null;
|
|
2291
|
+
const u = (s) => (s?.title && (o.value = s.title), s?.content && (r.value = s.content), n.value = !0, new Promise((h, f) => {
|
|
2292
|
+
a = h, i = f;
|
|
2275
2293
|
})), c = () => {
|
|
2276
|
-
|
|
2277
|
-
},
|
|
2278
|
-
|
|
2294
|
+
n.value = !1, a?.(!0), a = null, i = null;
|
|
2295
|
+
}, d = () => {
|
|
2296
|
+
n.value = !1, i?.(new Error("用户取消操作")), a = null, i = null;
|
|
2279
2297
|
};
|
|
2280
|
-
return
|
|
2281
|
-
open:
|
|
2282
|
-
}), (
|
|
2283
|
-
const f =
|
|
2298
|
+
return t({
|
|
2299
|
+
open: u
|
|
2300
|
+
}), (s, h) => {
|
|
2301
|
+
const f = fe("el-form");
|
|
2284
2302
|
return g(), b(l(Ee), {
|
|
2285
|
-
modelValue:
|
|
2286
|
-
"onUpdate:modelValue": h[0] || (h[0] = (m) =>
|
|
2287
|
-
title:
|
|
2303
|
+
modelValue: n.value,
|
|
2304
|
+
"onUpdate:modelValue": h[0] || (h[0] = (m) => n.value = m),
|
|
2305
|
+
title: o.value,
|
|
2288
2306
|
"close-on-click-modal": !1,
|
|
2289
2307
|
width: "400px"
|
|
2290
2308
|
}, {
|
|
2291
2309
|
footer: p(() => [
|
|
2292
2310
|
F(f, { size: e.size }, {
|
|
2293
2311
|
default: p(() => [
|
|
2294
|
-
R("span",
|
|
2295
|
-
F(l(N), { onClick:
|
|
2312
|
+
R("span", Zt, [
|
|
2313
|
+
F(l(N), { onClick: d }, {
|
|
2296
2314
|
default: p(() => [...h[1] || (h[1] = [
|
|
2297
2315
|
M("取消", -1)
|
|
2298
2316
|
])]),
|
|
@@ -2319,18 +2337,18 @@ const Jt = (e, o) => ({
|
|
|
2319
2337
|
}, 8, ["modelValue", "title"]);
|
|
2320
2338
|
};
|
|
2321
2339
|
}
|
|
2322
|
-
}),
|
|
2340
|
+
}), eo = ["innerHTML"], to = /* @__PURE__ */ q({
|
|
2323
2341
|
__name: "text",
|
|
2324
2342
|
props: {
|
|
2325
2343
|
content: {},
|
|
2326
2344
|
value: {}
|
|
2327
2345
|
},
|
|
2328
2346
|
setup(e) {
|
|
2329
|
-
const
|
|
2330
|
-
return (
|
|
2347
|
+
const t = e, n = ae(() => typeof t.content == "function" ? t.content(t.value) : t.content);
|
|
2348
|
+
return (o, r) => typeof n.value == "object" ? (g(), b(ee(n.value), { key: 0 })) : (g(), v("div", {
|
|
2331
2349
|
key: 1,
|
|
2332
|
-
innerHTML:
|
|
2333
|
-
}, null, 8,
|
|
2350
|
+
innerHTML: n.value
|
|
2351
|
+
}, null, 8, eo));
|
|
2334
2352
|
}
|
|
2335
2353
|
}), Re = /* @__PURE__ */ q({
|
|
2336
2354
|
__name: "searchField",
|
|
@@ -2340,27 +2358,27 @@ const Jt = (e, o) => ({
|
|
|
2340
2358
|
type: {}
|
|
2341
2359
|
},
|
|
2342
2360
|
setup(e) {
|
|
2343
|
-
const
|
|
2344
|
-
get: () =>
|
|
2345
|
-
set: (
|
|
2346
|
-
|
|
2361
|
+
const t = e, n = ae({
|
|
2362
|
+
get: () => t.conf.search.form?.[t.item?.key],
|
|
2363
|
+
set: (o) => {
|
|
2364
|
+
t.item?.key !== void 0 && (t.conf.search.form[t.item.key] = o);
|
|
2347
2365
|
}
|
|
2348
2366
|
});
|
|
2349
|
-
return (
|
|
2367
|
+
return (o, r) => l(W).customComponent[e.type ?? ""]?.search ? (g(), b(ee(l(W).customComponent[e.type ?? ""]?.search), x({
|
|
2350
2368
|
key: 0,
|
|
2351
|
-
modelValue:
|
|
2352
|
-
"onUpdate:modelValue": r[0] || (r[0] = (
|
|
2353
|
-
}, e.item.options?.search?.[e.type ?? ""], E(e.item.options?.search?.[e.type ?? ""]?.on || {})), null, 16, ["modelValue"])) : e.type === "input" ? (g(), b(l(
|
|
2369
|
+
modelValue: n.value,
|
|
2370
|
+
"onUpdate:modelValue": r[0] || (r[0] = (a) => n.value = a)
|
|
2371
|
+
}, e.item.options?.search?.[e.type ?? ""], E(e.item.options?.search?.[e.type ?? ""]?.on || {})), null, 16, ["modelValue"])) : e.type === "input" ? (g(), b(l(ue), x({
|
|
2354
2372
|
key: 1,
|
|
2355
|
-
modelValue:
|
|
2356
|
-
"onUpdate:modelValue": r[1] || (r[1] = (
|
|
2373
|
+
modelValue: n.value,
|
|
2374
|
+
"onUpdate:modelValue": r[1] || (r[1] = (a) => n.value = a),
|
|
2357
2375
|
placeholder: e.conf.search.getPlaceholder(e.item),
|
|
2358
2376
|
clearable: "",
|
|
2359
2377
|
disabled: e.item.disabled?.search
|
|
2360
|
-
}, e.item.options?.search?.input || e.item.options?.input, E(e.item.options?.search?.input?.on || e.item.options?.input?.on || {})), null, 16, ["modelValue", "placeholder", "disabled"])) : e.type === "switch" ? (g(), b(l(
|
|
2378
|
+
}, e.item.options?.search?.input || e.item.options?.input, E(e.item.options?.search?.input?.on || e.item.options?.input?.on || {})), null, 16, ["modelValue", "placeholder", "disabled"])) : e.type === "switch" ? (g(), b(l(ce), x({
|
|
2361
2379
|
key: 2,
|
|
2362
|
-
modelValue:
|
|
2363
|
-
"onUpdate:modelValue": r[2] || (r[2] = (
|
|
2380
|
+
modelValue: n.value,
|
|
2381
|
+
"onUpdate:modelValue": r[2] || (r[2] = (a) => n.value = a),
|
|
2364
2382
|
placeholder: e.conf.search.getPlaceholder(e.item, l(C).tCurd("placeholderSelect")),
|
|
2365
2383
|
clearable: "",
|
|
2366
2384
|
disabled: e.item.disabled?.search
|
|
@@ -2378,136 +2396,136 @@ const Jt = (e, o) => ({
|
|
|
2378
2396
|
}, null, 8, ["label", "value"]))
|
|
2379
2397
|
]),
|
|
2380
2398
|
_: 1
|
|
2381
|
-
}, 16, ["modelValue", "placeholder", "disabled"])) : e.type === "select" ? (g(), b(l(
|
|
2399
|
+
}, 16, ["modelValue", "placeholder", "disabled"])) : e.type === "select" ? (g(), b(l(ce), x({
|
|
2382
2400
|
key: 3,
|
|
2383
|
-
modelValue:
|
|
2384
|
-
"onUpdate:modelValue": r[3] || (r[3] = (
|
|
2401
|
+
modelValue: n.value,
|
|
2402
|
+
"onUpdate:modelValue": r[3] || (r[3] = (a) => n.value = a),
|
|
2385
2403
|
placeholder: e.conf.search.getPlaceholder(e.item, l(C).tCurd("placeholderSelect")),
|
|
2386
2404
|
clearable: "",
|
|
2387
2405
|
disabled: e.item.disabled?.search
|
|
2388
2406
|
}, e.item.options?.search?.select || e.item.options?.select, E(e.item.options?.search?.select?.on || e.item.options?.select?.on || {})), {
|
|
2389
2407
|
default: p(() => [
|
|
2390
|
-
(g(!0), v(B, null, G(e.item.options?.search?.select?.data || e.item.options?.select?.data || [], (
|
|
2391
|
-
key:
|
|
2392
|
-
label:
|
|
2393
|
-
value:
|
|
2408
|
+
(g(!0), v(B, null, G(e.item.options?.search?.select?.data || e.item.options?.select?.data || [], (a) => (g(), b(l(ne), {
|
|
2409
|
+
key: a.value,
|
|
2410
|
+
label: a.label,
|
|
2411
|
+
value: a.value
|
|
2394
2412
|
}, null, 8, ["label", "value"]))), 128))
|
|
2395
2413
|
]),
|
|
2396
2414
|
_: 1
|
|
2397
2415
|
}, 16, ["modelValue", "placeholder", "disabled"])) : e.type === "radio" ? (g(), b(l(Ue), x({
|
|
2398
2416
|
key: 4,
|
|
2399
|
-
modelValue:
|
|
2400
|
-
"onUpdate:modelValue": r[4] || (r[4] = (
|
|
2417
|
+
modelValue: n.value,
|
|
2418
|
+
"onUpdate:modelValue": r[4] || (r[4] = (a) => n.value = a),
|
|
2401
2419
|
disabled: e.item.disabled?.search
|
|
2402
2420
|
}, e.item.options?.search?.radio || e.item.options?.radio, E(e.item.options?.search?.radio?.on || e.item.options?.radio?.on || {})), {
|
|
2403
2421
|
default: p(() => [
|
|
2404
|
-
(g(!0), v(B, null, G(e.item.options?.radio?.data, (
|
|
2405
|
-
key:
|
|
2406
|
-
label:
|
|
2407
|
-
value:
|
|
2422
|
+
(g(!0), v(B, null, G(e.item.options?.radio?.data, (a) => (g(), b(l(Ae), {
|
|
2423
|
+
key: a.value,
|
|
2424
|
+
label: a.label,
|
|
2425
|
+
value: a.value
|
|
2408
2426
|
}, null, 8, ["label", "value"]))), 128))
|
|
2409
2427
|
]),
|
|
2410
2428
|
_: 1
|
|
2411
2429
|
}, 16, ["modelValue", "disabled"])) : e.type === "datetime" ? (g(), b(l(Be), x({
|
|
2412
2430
|
key: 5,
|
|
2413
|
-
modelValue:
|
|
2414
|
-
"onUpdate:modelValue": r[5] || (r[5] = (
|
|
2431
|
+
modelValue: n.value,
|
|
2432
|
+
"onUpdate:modelValue": r[5] || (r[5] = (a) => n.value = a),
|
|
2415
2433
|
disabled: e.item.disabled?.search
|
|
2416
2434
|
}, e.item.options?.search?.datetime || e.item.options?.datetime, E(e.item.options?.search?.datetime?.on || e.item.options?.datetime?.on || {})), null, 16, ["modelValue", "disabled"])) : e.type && l(W).customComponent[e.type] ? (g(), b(ee(l(W).customComponent[e.type]), x({
|
|
2417
2435
|
key: 6,
|
|
2418
|
-
modelValue:
|
|
2419
|
-
"onUpdate:modelValue": r[6] || (r[6] = (
|
|
2436
|
+
modelValue: n.value,
|
|
2437
|
+
"onUpdate:modelValue": r[6] || (r[6] = (a) => n.value = a)
|
|
2420
2438
|
}, e.item.options?.search?.[e.type] || e.item.options?.[e.type], E(e.item.options?.search?.[e.type]?.on || e.item.options?.[e.type]?.on || {}), {
|
|
2421
2439
|
disabled: e.item.disabled?.search
|
|
2422
2440
|
}), null, 16, ["modelValue", "disabled"])) : V("", !0);
|
|
2423
2441
|
}
|
|
2424
|
-
}),
|
|
2425
|
-
const
|
|
2426
|
-
for (const [
|
|
2427
|
-
|
|
2428
|
-
return
|
|
2429
|
-
},
|
|
2442
|
+
}), se = (e, t) => {
|
|
2443
|
+
const n = e.__vccOpts || e;
|
|
2444
|
+
for (const [o, r] of t)
|
|
2445
|
+
n[o] = r;
|
|
2446
|
+
return n;
|
|
2447
|
+
}, oo = {}, ao = {
|
|
2430
2448
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2431
2449
|
viewBox: "64 64 896 896"
|
|
2432
2450
|
};
|
|
2433
|
-
function
|
|
2434
|
-
return g(), v("svg",
|
|
2451
|
+
function no(e, t) {
|
|
2452
|
+
return g(), v("svg", ao, [...t[0] || (t[0] = [
|
|
2435
2453
|
R("path", {
|
|
2436
2454
|
fill: "currentColor",
|
|
2437
2455
|
d: "M482.2 508.4L331.3 389c-3-2.4-7.3-.2-7.3 3.6V478H184V184h204v128c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V144c0-15.5-12.5-28-28-28H144c-15.5 0-28 12.5-28 28v736c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v128H184V546h140v85.4c0 3.8 4.4 6 7.3 3.6l150.9-119.4a4.5 4.5 0 000-7.2zM880 116H596c-15.5 0-28 12.5-28 28v168c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V184h204v294H700v-85.4c0-3.8-4.3-6-7.3-3.6l-151 119.4a4.52 4.52 0 000 7.1l151 119.5c2.9 2.3 7.3.2 7.3-3.6V546h140v294H636V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v168c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V144c0-15.5-12.5-28-28-28z"
|
|
2438
2456
|
}, null, -1)
|
|
2439
2457
|
])]);
|
|
2440
2458
|
}
|
|
2441
|
-
const
|
|
2459
|
+
const lo = /* @__PURE__ */ se(oo, [["render", no]]), io = {}, ro = {
|
|
2442
2460
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2443
2461
|
viewBox: "64 64 896 896"
|
|
2444
2462
|
};
|
|
2445
|
-
function
|
|
2446
|
-
return g(), v("svg",
|
|
2463
|
+
function so(e, t) {
|
|
2464
|
+
return g(), v("svg", ro, [...t[0] || (t[0] = [
|
|
2447
2465
|
R("path", {
|
|
2448
2466
|
fill: "currentColor",
|
|
2449
2467
|
d: "M180 176h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zm724 0h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zM785.3 504.3L657.7 403.6a7.23 7.23 0 00-11.7 5.7V476H378v-62.8c0-6-7-9.4-11.7-5.7L238.7 508.3a7.14 7.14 0 000 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h268v62.8c0 6 7 9.4 11.7 5.7l127.5-100.8c3.8-2.9 3.8-8.5.2-11.4z"
|
|
2450
2468
|
}, null, -1)
|
|
2451
2469
|
])]);
|
|
2452
2470
|
}
|
|
2453
|
-
const
|
|
2471
|
+
const uo = /* @__PURE__ */ se(io, [["render", so]]), co = {}, fo = {
|
|
2454
2472
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2455
2473
|
viewBox: "0 0 1024 1024"
|
|
2456
2474
|
};
|
|
2457
|
-
function
|
|
2458
|
-
return g(), v("svg",
|
|
2475
|
+
function mo(e, t) {
|
|
2476
|
+
return g(), v("svg", fo, [...t[0] || (t[0] = [
|
|
2459
2477
|
R("path", {
|
|
2460
2478
|
fill: "currentColor",
|
|
2461
2479
|
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"
|
|
2462
2480
|
}, null, -1)
|
|
2463
2481
|
])]);
|
|
2464
2482
|
}
|
|
2465
|
-
const
|
|
2483
|
+
const go = /* @__PURE__ */ se(co, [["render", mo]]), ho = {}, yo = {
|
|
2466
2484
|
"data-v-58697b5c": "",
|
|
2467
2485
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2468
2486
|
viewBox: "0 0 1024 1024"
|
|
2469
2487
|
};
|
|
2470
|
-
function
|
|
2471
|
-
return g(), v("svg",
|
|
2488
|
+
function bo(e, t) {
|
|
2489
|
+
return g(), v("svg", yo, [...t[0] || (t[0] = [
|
|
2472
2490
|
R("path", {
|
|
2473
2491
|
fill: "currentColor",
|
|
2474
2492
|
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"
|
|
2475
2493
|
}, null, -1)
|
|
2476
2494
|
])]);
|
|
2477
2495
|
}
|
|
2478
|
-
const
|
|
2496
|
+
const po = /* @__PURE__ */ se(ho, [["render", bo]]), wo = {}, ko = {
|
|
2479
2497
|
"data-v-58697b5c": "",
|
|
2480
2498
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2481
2499
|
viewBox: "0 0 1024 1024"
|
|
2482
2500
|
};
|
|
2483
|
-
function
|
|
2484
|
-
return g(), v("svg",
|
|
2501
|
+
function vo(e, t) {
|
|
2502
|
+
return g(), v("svg", ko, [...t[0] || (t[0] = [
|
|
2485
2503
|
R("path", {
|
|
2486
2504
|
fill: "currentColor",
|
|
2487
2505
|
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0z"
|
|
2488
2506
|
}, null, -1)
|
|
2489
2507
|
])]);
|
|
2490
2508
|
}
|
|
2491
|
-
const
|
|
2509
|
+
const Co = /* @__PURE__ */ se(wo, [["render", vo]]), xo = {}, Vo = {
|
|
2492
2510
|
"data-v-58697b5c": "",
|
|
2493
2511
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2494
2512
|
viewBox: "0 0 1024 1024"
|
|
2495
2513
|
};
|
|
2496
|
-
function
|
|
2497
|
-
return g(), v("svg",
|
|
2514
|
+
function So(e, t) {
|
|
2515
|
+
return g(), v("svg", Vo, [...t[0] || (t[0] = [
|
|
2498
2516
|
R("path", {
|
|
2499
2517
|
fill: "currentColor",
|
|
2500
2518
|
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896M288 512a38.4 38.4 0 0 0 38.4 38.4h371.2a38.4 38.4 0 0 0 0-76.8H326.4A38.4 38.4 0 0 0 288 512"
|
|
2501
2519
|
}, null, -1)
|
|
2502
2520
|
])]);
|
|
2503
2521
|
}
|
|
2504
|
-
const
|
|
2522
|
+
const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-center table-header-label inline" }, zo = { class: "table-header-tooltip" }, Mo = ["innerHTML"], Fo = {
|
|
2505
2523
|
key: 1,
|
|
2506
2524
|
class: "table-header-required"
|
|
2507
|
-
},
|
|
2525
|
+
}, Do = ["onClick"], Oo = {
|
|
2508
2526
|
key: 0,
|
|
2509
2527
|
class: "table-edit-form"
|
|
2510
|
-
},
|
|
2528
|
+
}, Ro = { key: 1 }, Uo = ["onClick", "innerHTML"], Ao = /* @__PURE__ */ q({
|
|
2511
2529
|
__name: "tableColumn",
|
|
2512
2530
|
props: {
|
|
2513
2531
|
conf: {},
|
|
@@ -2515,200 +2533,200 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2515
2533
|
option: {}
|
|
2516
2534
|
},
|
|
2517
2535
|
setup(e) {
|
|
2518
|
-
const
|
|
2519
|
-
return (
|
|
2520
|
-
const
|
|
2521
|
-
return g(!0), v(B, null, G(e.columnList, (
|
|
2522
|
-
key:
|
|
2536
|
+
const t = $.isFun, n = e, r = je().type, a = (u) => u === !0 ? !0 : (Array.isArray(u) ? u : u ? [u] : []).some((d) => d?.required === !0), i = (u) => n.option.table?.editMode ? a(u.rules) || a(n.conf.update.rules?.[u.key]) : !1;
|
|
2537
|
+
return (u, c) => {
|
|
2538
|
+
const d = fe("el-tooltip");
|
|
2539
|
+
return g(!0), v(B, null, G(e.columnList, (s) => (g(), v(B, {
|
|
2540
|
+
key: s.key
|
|
2523
2541
|
}, [
|
|
2524
|
-
e.conf.table.column.show.list.includes(
|
|
2525
|
-
|
|
2542
|
+
e.conf.table.column.show.list.includes(s.key) && (s.show?.table === void 0 || l(t)(s.show?.table, e.conf.table.data)) ? (g(), v(B, { key: 0 }, [
|
|
2543
|
+
s.table?.header?.groupKey === void 0 || s.table.header.show ? (g(), b(l(ye), x({
|
|
2526
2544
|
key: 0,
|
|
2527
|
-
prop:
|
|
2528
|
-
label:
|
|
2529
|
-
}, { ref_for: !0 },
|
|
2545
|
+
prop: s.key,
|
|
2546
|
+
label: s.label
|
|
2547
|
+
}, { ref_for: !0 }, s.table), {
|
|
2530
2548
|
header: p(() => [
|
|
2531
|
-
S(
|
|
2532
|
-
R("div",
|
|
2533
|
-
|
|
2549
|
+
S(u.$slots, "table-header-" + s.key, { item: s }, () => [
|
|
2550
|
+
R("div", $o, [
|
|
2551
|
+
s.table?.header?.tooltip ? (g(), b(d, {
|
|
2534
2552
|
key: 0,
|
|
2535
2553
|
effect: "dark",
|
|
2536
2554
|
placement: "top"
|
|
2537
2555
|
}, {
|
|
2538
2556
|
content: p(() => [
|
|
2539
2557
|
R("div", {
|
|
2540
|
-
innerHTML:
|
|
2541
|
-
}, null, 8,
|
|
2558
|
+
innerHTML: s.table?.header?.tooltip
|
|
2559
|
+
}, null, 8, Mo)
|
|
2542
2560
|
]),
|
|
2543
2561
|
default: p(() => [
|
|
2544
|
-
R("span",
|
|
2545
|
-
F(
|
|
2562
|
+
R("span", zo, [
|
|
2563
|
+
F(po)
|
|
2546
2564
|
])
|
|
2547
2565
|
]),
|
|
2548
2566
|
_: 2
|
|
2549
2567
|
}, 1024)) : V("", !0),
|
|
2550
|
-
s
|
|
2551
|
-
M(" " + U(
|
|
2552
|
-
|
|
2568
|
+
i(s) ? (g(), v("span", Fo, "*")) : V("", !0),
|
|
2569
|
+
M(" " + U(s.label) + " ", 1),
|
|
2570
|
+
s.table?.header?.group !== void 0 ? (g(), v("span", {
|
|
2553
2571
|
key: 2,
|
|
2554
2572
|
class: "table-header-plus",
|
|
2555
|
-
onClick:
|
|
2573
|
+
onClick: ht(
|
|
2556
2574
|
() => {
|
|
2557
|
-
|
|
2558
|
-
h.table?.header?.groupKey ===
|
|
2575
|
+
s.table.header.group = !s.table.header.group, e.columnList.forEach((h) => {
|
|
2576
|
+
h.table?.header?.groupKey === s.key && (h.table.header.show = !s.table.header.group);
|
|
2559
2577
|
});
|
|
2560
2578
|
},
|
|
2561
2579
|
["stop"]
|
|
2562
2580
|
)
|
|
2563
2581
|
}, [
|
|
2564
|
-
|
|
2565
|
-
], 8,
|
|
2582
|
+
s.table.header.group ? (g(), b(Co, { key: 0 })) : (g(), b(Eo, { key: 1 }))
|
|
2583
|
+
], 8, Do)) : V("", !0)
|
|
2566
2584
|
])
|
|
2567
2585
|
])
|
|
2568
2586
|
]),
|
|
2569
2587
|
default: p(({ row: h }) => [
|
|
2570
|
-
|
|
2588
|
+
s.children ? (g(), v(B, { key: 0 }, [
|
|
2571
2589
|
c[0] || (c[0] = M(" ", -1)),
|
|
2572
2590
|
(g(), b(ee(l(r)), {
|
|
2573
2591
|
conf: e.conf,
|
|
2574
|
-
columnList:
|
|
2592
|
+
columnList: s.children,
|
|
2575
2593
|
option: e.option
|
|
2576
|
-
},
|
|
2577
|
-
G(
|
|
2594
|
+
}, Y({ _: 2 }, [
|
|
2595
|
+
G(u.$slots, (f, m) => ({
|
|
2578
2596
|
name: m,
|
|
2579
2597
|
fn: p((w) => [
|
|
2580
|
-
S(
|
|
2598
|
+
S(u.$slots, m, x({ ref_for: !0 }, w || {}))
|
|
2581
2599
|
])
|
|
2582
2600
|
}))
|
|
2583
2601
|
]), 1032, ["conf", "columnList", "option"]))
|
|
2584
2602
|
], 64)) : (g(), v(B, { key: 1 }, [
|
|
2585
|
-
e.option.table?.editMode ? (g(), v("div",
|
|
2603
|
+
e.option.table?.editMode ? (g(), v("div", Oo, [
|
|
2586
2604
|
F(l(be), {
|
|
2587
2605
|
size: e.option.size?.table,
|
|
2588
|
-
error: e.conf.tableEditValidate.getFieldError(h,
|
|
2606
|
+
error: e.conf.tableEditValidate.getFieldError(h, s),
|
|
2589
2607
|
class: "table-edit-form-item"
|
|
2590
2608
|
}, {
|
|
2591
2609
|
default: p(() => [
|
|
2592
2610
|
R("div", {
|
|
2593
|
-
class: J(["row", ["table-edit-" +
|
|
2611
|
+
class: J(["row", ["table-edit-" + s.key]]),
|
|
2594
2612
|
style: { width: "100%" }
|
|
2595
2613
|
}, [
|
|
2596
|
-
S(
|
|
2614
|
+
S(u.$slots, "table-edit-left-" + s.key, {
|
|
2597
2615
|
row: h,
|
|
2598
|
-
item:
|
|
2616
|
+
item: s
|
|
2599
2617
|
}),
|
|
2600
|
-
|
|
2618
|
+
s.type === "input" ? (g(), b(l(ue), x({
|
|
2601
2619
|
key: 0,
|
|
2602
|
-
modelValue: h[
|
|
2603
|
-
"onUpdate:modelValue": (f) => h[
|
|
2604
|
-
disabled: e.conf.update.getDisabled(
|
|
2620
|
+
modelValue: h[s.key],
|
|
2621
|
+
"onUpdate:modelValue": (f) => h[s.key] = f,
|
|
2622
|
+
disabled: e.conf.update.getDisabled(s, !0),
|
|
2605
2623
|
class: "col"
|
|
2606
|
-
}, { ref_for: !0 }, e.conf.update.getBind(
|
|
2607
|
-
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h,
|
|
2608
|
-
}),
|
|
2609
|
-
|
|
2624
|
+
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), {
|
|
2625
|
+
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h, s)
|
|
2626
|
+
}), Y({ _: 2 }, [
|
|
2627
|
+
s.options?.input?.prepend ? {
|
|
2610
2628
|
name: "prepend",
|
|
2611
2629
|
fn: p(() => [
|
|
2612
|
-
M(U(typeof
|
|
2630
|
+
M(U(typeof s.options?.input?.prepend == "function" ? s.options?.input?.prepend(h) : s.options?.input?.prepend), 1)
|
|
2613
2631
|
]),
|
|
2614
2632
|
key: "0"
|
|
2615
2633
|
} : void 0
|
|
2616
|
-
]), 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
2634
|
+
]), 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : s.type === "select" ? (g(), b(l(ce), x({
|
|
2617
2635
|
key: 1,
|
|
2618
|
-
modelValue: h[
|
|
2619
|
-
"onUpdate:modelValue": (f) => h[
|
|
2620
|
-
disabled: e.conf.update.getDisabled(
|
|
2636
|
+
modelValue: h[s.key],
|
|
2637
|
+
"onUpdate:modelValue": (f) => h[s.key] = f,
|
|
2638
|
+
disabled: e.conf.update.getDisabled(s, !0),
|
|
2621
2639
|
class: "col"
|
|
2622
|
-
}, { ref_for: !0 }, e.conf.update.getBind(
|
|
2623
|
-
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h,
|
|
2640
|
+
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), {
|
|
2641
|
+
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h, s)
|
|
2624
2642
|
}), {
|
|
2625
2643
|
default: p(() => [
|
|
2626
|
-
(g(!0), v(B, null, G(
|
|
2644
|
+
(g(!0), v(B, null, G(s.options?.search?.select?.data || s.options?.select?.data, (f) => (g(), b(l(ne), {
|
|
2627
2645
|
key: f.value,
|
|
2628
2646
|
label: f.label,
|
|
2629
2647
|
value: f.value
|
|
2630
2648
|
}, null, 8, ["label", "value"]))), 128))
|
|
2631
2649
|
]),
|
|
2632
2650
|
_: 2
|
|
2633
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
2651
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : s.type === "switch" ? (g(), b(l(he), x({
|
|
2634
2652
|
key: 2,
|
|
2635
|
-
modelValue: h[
|
|
2636
|
-
"onUpdate:modelValue": (f) => h[
|
|
2637
|
-
disabled: e.conf.update.getDisabled(
|
|
2653
|
+
modelValue: h[s.key],
|
|
2654
|
+
"onUpdate:modelValue": (f) => h[s.key] = f,
|
|
2655
|
+
disabled: e.conf.update.getDisabled(s, !0),
|
|
2638
2656
|
class: "col"
|
|
2639
|
-
}, { ref_for: !0 }, e.conf.update.getBind(
|
|
2640
|
-
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h,
|
|
2657
|
+
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), {
|
|
2658
|
+
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h, s)
|
|
2641
2659
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : V("", !0),
|
|
2642
|
-
S(
|
|
2660
|
+
S(u.$slots, "table-edit-right-" + s.key, {
|
|
2643
2661
|
row: h,
|
|
2644
|
-
item:
|
|
2662
|
+
item: s
|
|
2645
2663
|
})
|
|
2646
2664
|
], 2)
|
|
2647
2665
|
]),
|
|
2648
2666
|
_: 2
|
|
2649
2667
|
}, 1032, ["size", "error"])
|
|
2650
2668
|
])) : (g(), v(B, { key: 1 }, [
|
|
2651
|
-
e.conf.update.type === l($).EDialog.Update && l(
|
|
2652
|
-
|
|
2669
|
+
e.conf.update.type === l($).EDialog.Update && l(t)(s.show?.form, e.conf.update.form, l($).EDialog.Update) && e.option.table?.inlineEdit && e.conf.update.form[e.option.table?.rowKey] === h[e.option.table?.rowKey] && (s.type === "input" || s.type === "select") ? (g(), v(B, { key: 0 }, [
|
|
2670
|
+
s.type === "input" ? (g(), b(l(ue), x({
|
|
2653
2671
|
key: 0,
|
|
2654
|
-
modelValue: e.conf.update.form[
|
|
2655
|
-
"onUpdate:modelValue": (f) => e.conf.update.form[
|
|
2656
|
-
disabled: e.conf.update.getDisabled(
|
|
2657
|
-
}, { ref_for: !0 }, e.conf.update.getBind(
|
|
2658
|
-
|
|
2672
|
+
modelValue: e.conf.update.form[s.key],
|
|
2673
|
+
"onUpdate:modelValue": (f) => e.conf.update.form[s.key] = f,
|
|
2674
|
+
disabled: e.conf.update.getDisabled(s, !0)
|
|
2675
|
+
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), { style: { width: "100%" } }), Y({ _: 2 }, [
|
|
2676
|
+
s.options?.input?.prepend ? {
|
|
2659
2677
|
name: "prepend",
|
|
2660
2678
|
fn: p(() => [
|
|
2661
|
-
M(U(typeof
|
|
2679
|
+
M(U(typeof s.options?.input?.prepend == "function" ? s.options?.input?.prepend(h) : s.options?.input?.prepend), 1)
|
|
2662
2680
|
]),
|
|
2663
2681
|
key: "0"
|
|
2664
2682
|
} : void 0
|
|
2665
|
-
]), 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
2683
|
+
]), 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : s.type === "select" ? (g(), b(l(ce), x({
|
|
2666
2684
|
key: 1,
|
|
2667
|
-
modelValue: e.conf.update.form[
|
|
2668
|
-
"onUpdate:modelValue": (f) => e.conf.update.form[
|
|
2669
|
-
disabled: e.conf.update.getDisabled(
|
|
2670
|
-
}, { ref_for: !0 }, e.conf.update.getBind(
|
|
2685
|
+
modelValue: e.conf.update.form[s.key],
|
|
2686
|
+
"onUpdate:modelValue": (f) => e.conf.update.form[s.key] = f,
|
|
2687
|
+
disabled: e.conf.update.getDisabled(s, !0)
|
|
2688
|
+
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), { style: { width: "100%" } }), {
|
|
2671
2689
|
default: p(() => [
|
|
2672
|
-
(g(!0), v(B, null, G(
|
|
2690
|
+
(g(!0), v(B, null, G(s.options?.search?.select?.data || s.options?.select?.data, (f) => (g(), b(l(ne), {
|
|
2673
2691
|
key: f.value,
|
|
2674
2692
|
label: f.label,
|
|
2675
2693
|
value: f.value
|
|
2676
2694
|
}, null, 8, ["label", "value"]))), 128))
|
|
2677
2695
|
]),
|
|
2678
2696
|
_: 2
|
|
2679
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
2697
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : s.type === "switch" ? (g(), b(l(he), x({
|
|
2680
2698
|
key: 2,
|
|
2681
|
-
modelValue: e.conf.update.form[
|
|
2682
|
-
"onUpdate:modelValue": (f) => e.conf.update.form[
|
|
2683
|
-
}, { ref_for: !0 }, e.conf.update.getBind(
|
|
2684
|
-
disabled: e.conf.update.getDisabled(
|
|
2699
|
+
modelValue: e.conf.update.form[s.key],
|
|
2700
|
+
"onUpdate:modelValue": (f) => e.conf.update.form[s.key] = f
|
|
2701
|
+
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), {
|
|
2702
|
+
disabled: e.conf.update.getDisabled(s, !0)
|
|
2685
2703
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : V("", !0)
|
|
2686
|
-
], 64)) : S(
|
|
2704
|
+
], 64)) : S(u.$slots, "table-" + s.key, {
|
|
2687
2705
|
key: 1,
|
|
2688
2706
|
row: h,
|
|
2689
|
-
item:
|
|
2707
|
+
item: s
|
|
2690
2708
|
}, () => [
|
|
2691
|
-
l(W).customComponent[
|
|
2709
|
+
l(W).customComponent[s.type ?? ""]?.table ? (g(), b(ee(l(W).customComponent[s.type ?? ""]?.table), x({
|
|
2692
2710
|
key: 0,
|
|
2693
|
-
modelValue: h[
|
|
2694
|
-
"onUpdate:modelValue": (f) => h[
|
|
2695
|
-
}, { ref_for: !0 },
|
|
2696
|
-
|
|
2711
|
+
modelValue: h[s.key],
|
|
2712
|
+
"onUpdate:modelValue": (f) => h[s.key] = f
|
|
2713
|
+
}, { ref_for: !0 }, s.options?.[s.type ?? ""], E(s.options?.[s.type ?? ""]?.on || {})), null, 16, ["modelValue", "onUpdate:modelValue"])) : s.type === "switch" ? (g(), v(B, { key: 1 }, [
|
|
2714
|
+
s.options?.switch?.tableConfig?.change ? (g(), b(l(he), x({
|
|
2697
2715
|
key: 0,
|
|
2698
|
-
modelValue: h[
|
|
2699
|
-
"onUpdate:modelValue": (f) => h[
|
|
2700
|
-
loading:
|
|
2701
|
-
"before-change": () =>
|
|
2702
|
-
}, { ref_for: !0 },
|
|
2716
|
+
modelValue: h[s.key],
|
|
2717
|
+
"onUpdate:modelValue": (f) => h[s.key] = f,
|
|
2718
|
+
loading: s.options?.switch?.loadingMap?.[h[e.option.table?.rowKey]]?.loading,
|
|
2719
|
+
"before-change": () => s.options?.switch?.tableBeforeChange?.(s.key, h)
|
|
2720
|
+
}, { ref_for: !0 }, s.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "loading", "before-change"])) : (g(), v("span", Ro, U(h[s.key] === s.options?.switch?.activeValue ? s.options?.switch?.activeText : s.options?.switch?.inactiveText), 1))
|
|
2703
2721
|
], 64)) : (g(), v("span", {
|
|
2704
2722
|
key: 2,
|
|
2705
2723
|
style: pe({
|
|
2706
|
-
"--table-text-click-color":
|
|
2724
|
+
"--table-text-click-color": s.table?.click?.color
|
|
2707
2725
|
}),
|
|
2708
|
-
class: J({ "table-text-click":
|
|
2709
|
-
onClick: (f) =>
|
|
2710
|
-
innerHTML:
|
|
2711
|
-
}, null, 14,
|
|
2726
|
+
class: J({ "table-text-click": s.table?.click?.callback }),
|
|
2727
|
+
onClick: (f) => s.table?.click?.callback?.(h),
|
|
2728
|
+
innerHTML: s.table?.format ? s.table?.format(h) : h[s.key]
|
|
2729
|
+
}, null, 14, Uo))
|
|
2712
2730
|
])
|
|
2713
2731
|
], 64))
|
|
2714
2732
|
], 64))
|
|
@@ -2719,19 +2737,19 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2719
2737
|
], 64))), 128);
|
|
2720
2738
|
};
|
|
2721
2739
|
}
|
|
2722
|
-
}),
|
|
2740
|
+
}), Bo = {
|
|
2723
2741
|
key: 0,
|
|
2724
2742
|
class: "relative curd-search fit-width"
|
|
2725
|
-
},
|
|
2743
|
+
}, To = { class: "mb-10 flex justify-between items-center fit-width" }, Lo = {
|
|
2726
2744
|
class: "flex items-center",
|
|
2727
2745
|
style: { gap: "10px" }
|
|
2728
|
-
},
|
|
2746
|
+
}, jo = { key: 0 }, Ko = { key: 1 }, Po = { key: 2 }, Io = { class: "export-btn" }, No = {
|
|
2729
2747
|
key: 1,
|
|
2730
2748
|
class: "export-btn"
|
|
2731
|
-
},
|
|
2749
|
+
}, Go = {
|
|
2732
2750
|
class: "flex items-center table-tools-right",
|
|
2733
2751
|
style: { gap: "10px" }
|
|
2734
|
-
},
|
|
2752
|
+
}, Ho = { class: "row justify-end mt-10 mb-10 table-bottom-pagination" }, Wo = { class: "dialog-footer" }, Jo = { key: 0 }, qo = { key: 1 }, Qo = { class: "dialog-footer" }, Xo = /* @__PURE__ */ q({
|
|
2735
2753
|
__name: "index",
|
|
2736
2754
|
props: {
|
|
2737
2755
|
/**
|
|
@@ -2753,12 +2771,12 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2753
2771
|
default: void 0
|
|
2754
2772
|
}
|
|
2755
2773
|
},
|
|
2756
|
-
setup(e, { expose:
|
|
2757
|
-
const
|
|
2758
|
-
return
|
|
2759
|
-
conf:
|
|
2760
|
-
}), (
|
|
2761
|
-
const h =
|
|
2774
|
+
setup(e, { expose: t }) {
|
|
2775
|
+
const n = $.EDialog, o = e, r = $.isFun, { conf: a, switchConfirmRef: i, ruleFormRef: u, tableRef: c } = Yt(o);
|
|
2776
|
+
return t({
|
|
2777
|
+
conf: a
|
|
2778
|
+
}), (d, s) => {
|
|
2779
|
+
const h = fe("el-tooltip"), f = yt("loading");
|
|
2762
2780
|
return g(), v("div", {
|
|
2763
2781
|
class: J(["relative cc1-form-box", [e.option.table?.fitHeight ? "col" : "no-min-height"]])
|
|
2764
2782
|
}, [
|
|
@@ -2766,68 +2784,68 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2766
2784
|
class: J(["row", [e.option.table?.fitHeight ? "absolute fit" : ""]]),
|
|
2767
2785
|
style: { overflow: "hidden" }
|
|
2768
2786
|
}, [
|
|
2769
|
-
S(
|
|
2787
|
+
S(d.$slots, "box-left"),
|
|
2770
2788
|
R("div", {
|
|
2771
2789
|
class: J(["column fit-width no-wrap", [e.option.table?.fitHeight ? "col" : ""]])
|
|
2772
2790
|
}, [
|
|
2773
|
-
e.option.search?.show !== !1 ? (g(), v("div",
|
|
2791
|
+
e.option.search?.show !== !1 ? (g(), v("div", Bo, [
|
|
2774
2792
|
F(l(oe), {
|
|
2775
|
-
model: l(
|
|
2793
|
+
model: l(a).search.form,
|
|
2776
2794
|
inline: "",
|
|
2777
2795
|
size: e.option.size?.search
|
|
2778
2796
|
}, {
|
|
2779
2797
|
default: p(() => [
|
|
2780
|
-
S(
|
|
2781
|
-
row: l(
|
|
2798
|
+
S(d.$slots, "search-start", {
|
|
2799
|
+
row: l(a).search.form
|
|
2782
2800
|
}),
|
|
2783
|
-
(g(!0), v(B, null, G(l(
|
|
2801
|
+
(g(!0), v(B, null, G(l(a).search.column.list, (m) => (g(), v(B, {
|
|
2784
2802
|
key: m.key
|
|
2785
2803
|
}, [
|
|
2786
|
-
S(
|
|
2787
|
-
row: l(
|
|
2804
|
+
S(d.$slots, "search-" + m.key + "-start", {
|
|
2805
|
+
row: l(a).search.form
|
|
2788
2806
|
}),
|
|
2789
|
-
(typeof m.show?.search == "function" ? m.show?.search(l(
|
|
2807
|
+
(typeof m.show?.search == "function" ? m.show?.search(l(a).search.form) : m.show?.search) ? (g(), b(l(be), {
|
|
2790
2808
|
key: 0,
|
|
2791
2809
|
label: m.text?.search?.label ?? m.label
|
|
2792
2810
|
}, {
|
|
2793
2811
|
default: p(() => [
|
|
2794
|
-
S(
|
|
2795
|
-
row: l(
|
|
2812
|
+
S(d.$slots, "search-" + m.key + "-left", {
|
|
2813
|
+
row: l(a).search.form
|
|
2796
2814
|
}),
|
|
2797
|
-
S(
|
|
2798
|
-
row: l(
|
|
2815
|
+
S(d.$slots, "search-" + m.key, {
|
|
2816
|
+
row: l(a).search.form
|
|
2799
2817
|
}, () => [
|
|
2800
2818
|
m.options?.search?.type ? (g(), b(Re, {
|
|
2801
2819
|
key: 0,
|
|
2802
2820
|
item: m,
|
|
2803
|
-
conf: l(
|
|
2821
|
+
conf: l(a),
|
|
2804
2822
|
type: m.options.search.type
|
|
2805
2823
|
}, null, 8, ["item", "conf", "type"])) : (g(), b(Re, {
|
|
2806
2824
|
key: 1,
|
|
2807
2825
|
item: m,
|
|
2808
|
-
conf: l(
|
|
2826
|
+
conf: l(a),
|
|
2809
2827
|
type: m.type
|
|
2810
2828
|
}, null, 8, ["item", "conf", "type"]))
|
|
2811
2829
|
]),
|
|
2812
|
-
S(
|
|
2813
|
-
row: l(
|
|
2830
|
+
S(d.$slots, "search-" + m.key + "-right", {
|
|
2831
|
+
row: l(a).search.form
|
|
2814
2832
|
})
|
|
2815
2833
|
]),
|
|
2816
2834
|
_: 2
|
|
2817
2835
|
}, 1032, ["label"])) : V("", !0),
|
|
2818
|
-
S(
|
|
2819
|
-
row: l(
|
|
2836
|
+
S(d.$slots, "search-" + m.key + "-end", {
|
|
2837
|
+
row: l(a).search.form
|
|
2820
2838
|
})
|
|
2821
2839
|
], 64))), 128)),
|
|
2822
|
-
S(
|
|
2823
|
-
row: l(
|
|
2840
|
+
S(d.$slots, "search-center", {
|
|
2841
|
+
row: l(a).search.form
|
|
2824
2842
|
}),
|
|
2825
2843
|
e.option.tools?.search || e.option.tools?.reset ? (g(), b(l(be), { key: 0 }, {
|
|
2826
2844
|
default: p(() => [
|
|
2827
2845
|
e.option.tools?.search ? (g(), b(l(N), {
|
|
2828
2846
|
key: 0,
|
|
2829
2847
|
type: "primary",
|
|
2830
|
-
onClick: l(
|
|
2848
|
+
onClick: l(a).search.submit
|
|
2831
2849
|
}, {
|
|
2832
2850
|
default: p(() => [
|
|
2833
2851
|
M(U(l(C).tCurd("search")), 1)
|
|
@@ -2836,7 +2854,7 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2836
2854
|
}, 8, ["onClick"])) : V("", !0),
|
|
2837
2855
|
e.option.tools?.reset ? (g(), b(l(N), {
|
|
2838
2856
|
key: 1,
|
|
2839
|
-
onClick: l(
|
|
2857
|
+
onClick: l(a).search.reset
|
|
2840
2858
|
}, {
|
|
2841
2859
|
default: p(() => [
|
|
2842
2860
|
M(U(l(C).tCurd("reset")), 1)
|
|
@@ -2846,19 +2864,19 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2846
2864
|
]),
|
|
2847
2865
|
_: 1
|
|
2848
2866
|
})) : V("", !0),
|
|
2849
|
-
S(
|
|
2850
|
-
row: l(
|
|
2867
|
+
S(d.$slots, "search-end", {
|
|
2868
|
+
row: l(a).search.form
|
|
2851
2869
|
})
|
|
2852
2870
|
]),
|
|
2853
2871
|
_: 3
|
|
2854
2872
|
}, 8, ["model", "size"])
|
|
2855
2873
|
])) : V("", !0),
|
|
2856
|
-
R("div",
|
|
2874
|
+
R("div", To, [
|
|
2857
2875
|
R("div", Lo, [
|
|
2858
|
-
l(r)(e.option.tools?.add) ? (g(), v("div",
|
|
2876
|
+
l(r)(e.option.tools?.add) ? (g(), v("div", jo, [
|
|
2859
2877
|
F(l(N), {
|
|
2860
2878
|
type: "primary",
|
|
2861
|
-
onClick:
|
|
2879
|
+
onClick: s[0] || (s[0] = (m) => l(a).update.open(l(n).Add)),
|
|
2862
2880
|
size: e.option.size?.search
|
|
2863
2881
|
}, {
|
|
2864
2882
|
default: p(() => [
|
|
@@ -2867,10 +2885,10 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2867
2885
|
_: 1
|
|
2868
2886
|
}, 8, ["size"])
|
|
2869
2887
|
])) : V("", !0),
|
|
2870
|
-
e.option.table?.selectable && l(r)(e.option.tools?.delete) ? (g(), v("div",
|
|
2888
|
+
e.option.table?.selectable && l(r)(e.option.tools?.delete) ? (g(), v("div", Ko, [
|
|
2871
2889
|
F(l(N), {
|
|
2872
2890
|
type: "danger",
|
|
2873
|
-
onClick:
|
|
2891
|
+
onClick: s[1] || (s[1] = (m) => l(a).remove.open(l(a).table.selection.list)),
|
|
2874
2892
|
size: e.option.size?.search
|
|
2875
2893
|
}, {
|
|
2876
2894
|
default: p(() => [
|
|
@@ -2879,10 +2897,10 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2879
2897
|
_: 1
|
|
2880
2898
|
}, 8, ["size"])
|
|
2881
2899
|
])) : V("", !0),
|
|
2882
|
-
e.option.tools?.expand ? (g(), v("div",
|
|
2900
|
+
e.option.tools?.expand ? (g(), v("div", Po, [
|
|
2883
2901
|
F(l(N), {
|
|
2884
2902
|
type: "warning",
|
|
2885
|
-
onClick:
|
|
2903
|
+
onClick: s[2] || (s[2] = (m) => l(a).table.expand.all()),
|
|
2886
2904
|
size: e.option.size?.search
|
|
2887
2905
|
}, {
|
|
2888
2906
|
default: p(() => [
|
|
@@ -2894,7 +2912,7 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2894
2912
|
e.option.tools?.export?.show ? (g(), v(B, { key: 3 }, [
|
|
2895
2913
|
e.option.tools?.export?.dropdown?.show ? (g(), b(l(ut), {
|
|
2896
2914
|
key: 0,
|
|
2897
|
-
onCommand: l(
|
|
2915
|
+
onCommand: l(a).export.click
|
|
2898
2916
|
}, {
|
|
2899
2917
|
dropdown: p(() => [
|
|
2900
2918
|
F(l(ct), {
|
|
@@ -2933,10 +2951,10 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2933
2951
|
}, 8, ["size"])
|
|
2934
2952
|
]),
|
|
2935
2953
|
default: p(() => [
|
|
2936
|
-
R("div",
|
|
2954
|
+
R("div", Io, [
|
|
2937
2955
|
F(l(N), {
|
|
2938
2956
|
type: "warning",
|
|
2939
|
-
loading: l(
|
|
2957
|
+
loading: l(a).export.loading,
|
|
2940
2958
|
size: e.option.size?.search
|
|
2941
2959
|
}, {
|
|
2942
2960
|
default: p(() => [
|
|
@@ -2947,12 +2965,12 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2947
2965
|
])
|
|
2948
2966
|
]),
|
|
2949
2967
|
_: 1
|
|
2950
|
-
}, 8, ["onCommand"])) : (g(), v("div",
|
|
2968
|
+
}, 8, ["onCommand"])) : (g(), v("div", No, [
|
|
2951
2969
|
F(l(N), {
|
|
2952
2970
|
type: "warning",
|
|
2953
|
-
loading: l(
|
|
2971
|
+
loading: l(a).export.loading,
|
|
2954
2972
|
size: e.option.size?.search,
|
|
2955
|
-
onClick:
|
|
2973
|
+
onClick: s[3] || (s[3] = (m) => l(a).export.run.start("all"))
|
|
2956
2974
|
}, {
|
|
2957
2975
|
default: p(() => [
|
|
2958
2976
|
M(U(l(C).tCurd("export")), 1)
|
|
@@ -2961,38 +2979,38 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
2961
2979
|
}, 8, ["loading", "size"])
|
|
2962
2980
|
]))
|
|
2963
2981
|
], 64)) : V("", !0),
|
|
2964
|
-
S(
|
|
2982
|
+
S(d.$slots, "tools-left")
|
|
2965
2983
|
]),
|
|
2966
|
-
R("div",
|
|
2967
|
-
S(
|
|
2968
|
-
l(
|
|
2984
|
+
R("div", Go, [
|
|
2985
|
+
S(d.$slots, "tools-right"),
|
|
2986
|
+
l(a).page.showTools ? (g(), b(l(Oe), x({
|
|
2969
2987
|
key: 0,
|
|
2970
|
-
"current-page": l(
|
|
2971
|
-
"onUpdate:currentPage":
|
|
2972
|
-
"page-size": l(
|
|
2973
|
-
"onUpdate:pageSize":
|
|
2988
|
+
"current-page": l(a).page.num,
|
|
2989
|
+
"onUpdate:currentPage": s[4] || (s[4] = (m) => l(a).page.num = m),
|
|
2990
|
+
"page-size": l(a).page.size,
|
|
2991
|
+
"onUpdate:pageSize": s[5] || (s[5] = (m) => l(a).page.size = m),
|
|
2974
2992
|
background: "",
|
|
2975
|
-
"page-sizes": l(
|
|
2976
|
-
"pager-count": l(
|
|
2977
|
-
layout: l(
|
|
2978
|
-
total: l(
|
|
2993
|
+
"page-sizes": l(a).page.sizeList,
|
|
2994
|
+
"pager-count": l(a).page.pagerCount,
|
|
2995
|
+
layout: l(a).page.layout,
|
|
2996
|
+
total: l(a).page.total,
|
|
2979
2997
|
size: e.option.size?.table,
|
|
2980
|
-
onSizeChange: l(
|
|
2981
|
-
onCurrentChange: l(
|
|
2998
|
+
onSizeChange: l(a).table.getList,
|
|
2999
|
+
onCurrentChange: l(a).table.getList
|
|
2982
3000
|
}, e.option.page?.pagination || {}, E(e.option.page?.pagination?.on || {})), null, 16, ["current-page", "page-size", "page-sizes", "pager-count", "layout", "total", "size", "onSizeChange", "onCurrentChange"])) : V("", !0),
|
|
2983
3001
|
e.option.tools?.expandColumn === void 0 || e.option.tools?.expandColumn ? (g(), b(h, {
|
|
2984
3002
|
key: 1,
|
|
2985
3003
|
effect: "dark",
|
|
2986
|
-
content: l(
|
|
3004
|
+
content: l(a).table.header.group.expand ? l(C).tCurd("mergeColumn") : l(C).tCurd("expandColumn"),
|
|
2987
3005
|
placement: "top"
|
|
2988
3006
|
}, {
|
|
2989
3007
|
default: p(() => [
|
|
2990
3008
|
R("div", {
|
|
2991
3009
|
class: J(["refresh-btn", [e.option.size?.search]]),
|
|
2992
|
-
onClick:
|
|
2993
|
-
(...m) => l(
|
|
3010
|
+
onClick: s[6] || (s[6] = //@ts-ignore
|
|
3011
|
+
(...m) => l(a).table.header.group.toggleExpandAll && l(a).table.header.group.toggleExpandAll(...m))
|
|
2994
3012
|
}, [
|
|
2995
|
-
l(
|
|
3013
|
+
l(a).table.header.group.expand ? (g(), b(lo, { key: 0 })) : (g(), b(uo, { key: 1 }))
|
|
2996
3014
|
], 2)
|
|
2997
3015
|
]),
|
|
2998
3016
|
_: 1
|
|
@@ -3000,10 +3018,10 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3000
3018
|
e.option.tools?.refresh === void 0 || e.option.tools?.refresh ? (g(), v("div", {
|
|
3001
3019
|
key: 2,
|
|
3002
3020
|
class: J(["refresh-btn", [e.option.size?.search]]),
|
|
3003
|
-
onClick:
|
|
3004
|
-
(...m) => l(
|
|
3021
|
+
onClick: s[7] || (s[7] = //@ts-ignore
|
|
3022
|
+
(...m) => l(a).table.getList && l(a).table.getList(...m))
|
|
3005
3023
|
}, [
|
|
3006
|
-
F(
|
|
3024
|
+
F(go)
|
|
3007
3025
|
], 2)) : V("", !0)
|
|
3008
3026
|
])
|
|
3009
3027
|
]),
|
|
@@ -3013,15 +3031,15 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3013
3031
|
R("div", {
|
|
3014
3032
|
class: J(["column form-box-content", [e.option.table?.fitHeight ? "absolute fit" : ""]])
|
|
3015
3033
|
}, [
|
|
3016
|
-
|
|
3034
|
+
bt((g(), b(l(ft), x({
|
|
3017
3035
|
ref_key: "tableRef",
|
|
3018
3036
|
ref: c,
|
|
3019
|
-
data: l(
|
|
3037
|
+
data: l(a).table.data,
|
|
3020
3038
|
border: e.option.table?.border === void 0 ? !0 : e.option.table?.border,
|
|
3021
|
-
onSelectionChange: l(
|
|
3022
|
-
onSortChange: l(
|
|
3023
|
-
"expand-row-keys": l(
|
|
3024
|
-
onExpandChange: l(
|
|
3039
|
+
onSelectionChange: l(a).table.selection.change,
|
|
3040
|
+
onSortChange: l(a).table.sort.change,
|
|
3041
|
+
"expand-row-keys": l(a).table.expand.rowKeys,
|
|
3042
|
+
onExpandChange: l(a).table.expand.change
|
|
3025
3043
|
}, e.option.table, E(e.option.table?.on || {})), {
|
|
3026
3044
|
default: p(() => [
|
|
3027
3045
|
(typeof e.option.table?.selectable == "object" ? e.option.table?.selectable?.show : e.option.table?.selectable) || l(r)(e.option.tools?.delete) || e.option.tools?.export?.show && e.option.tools?.export?.select ? (g(), b(l(ye), x({
|
|
@@ -3043,19 +3061,19 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3043
3061
|
"show-overflow-tooltip": !1,
|
|
3044
3062
|
className: "cc1-form-index-column"
|
|
3045
3063
|
}, typeof e.option.table?.index == "object" ? e.option.table?.index : {}, E(typeof e.option.table?.index == "object" ? e.option.table?.index?.on || {} : {})), null, 16)) : V("", !0),
|
|
3046
|
-
F(
|
|
3047
|
-
conf: l(
|
|
3048
|
-
columnList: l(
|
|
3064
|
+
F(Ao, {
|
|
3065
|
+
conf: l(a),
|
|
3066
|
+
columnList: l(a).table.column.list,
|
|
3049
3067
|
option: e.option
|
|
3050
|
-
},
|
|
3051
|
-
G(
|
|
3068
|
+
}, Y({ _: 2 }, [
|
|
3069
|
+
G(d.$slots, (m, w) => ({
|
|
3052
3070
|
name: w,
|
|
3053
3071
|
fn: p((D) => [
|
|
3054
|
-
S(
|
|
3072
|
+
S(d.$slots, w, $e(ze(D || {})))
|
|
3055
3073
|
])
|
|
3056
3074
|
}))
|
|
3057
3075
|
]), 1032, ["conf", "columnList", "option"]),
|
|
3058
|
-
l(r)(e.option.table?.add) || l(r)(e.option.table?.update) || l(r)(e.option.table?.delete) || l(r)(e.option.table?.view) ||
|
|
3076
|
+
l(r)(e.option.table?.add) || l(r)(e.option.table?.update) || l(r)(e.option.table?.delete) || l(r)(e.option.table?.view) || d.$slots["table-op-left"] || d.$slots["table-op-right"] ? (g(), b(l(ye), x({
|
|
3059
3077
|
key: 2,
|
|
3060
3078
|
align: "center",
|
|
3061
3079
|
fixed: "right"
|
|
@@ -3064,7 +3082,7 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3064
3082
|
"show-overflow-tooltip": !1
|
|
3065
3083
|
}), {
|
|
3066
3084
|
header: p(() => [
|
|
3067
|
-
S(
|
|
3085
|
+
S(d.$slots, "table-header-op", {}, () => [
|
|
3068
3086
|
M(U(l(C).tCurd("operation")), 1)
|
|
3069
3087
|
])
|
|
3070
3088
|
]),
|
|
@@ -3073,12 +3091,12 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3073
3091
|
size: e.option.size?.table
|
|
3074
3092
|
}, {
|
|
3075
3093
|
default: p(() => [
|
|
3076
|
-
S(
|
|
3077
|
-
l(
|
|
3094
|
+
S(d.$slots, "table-op-left", { row: m }),
|
|
3095
|
+
l(a).update.type === l(n).Update && e.option.table?.inlineEdit && l(a).update.form[o.option.table?.rowKey] === m[o.option.table?.rowKey] ? (g(), v(B, { key: 0 }, [
|
|
3078
3096
|
F(l(N), {
|
|
3079
3097
|
link: "",
|
|
3080
3098
|
type: "info",
|
|
3081
|
-
onClick: l(
|
|
3099
|
+
onClick: l(a).update.close
|
|
3082
3100
|
}, {
|
|
3083
3101
|
default: p(() => [
|
|
3084
3102
|
M(U(l(C).tCurd("cancel")), 1)
|
|
@@ -3088,21 +3106,21 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3088
3106
|
F(l(N), {
|
|
3089
3107
|
link: "",
|
|
3090
3108
|
type: "primary",
|
|
3091
|
-
onClick: l(
|
|
3092
|
-
loading: l(
|
|
3109
|
+
onClick: l(a).update.submit,
|
|
3110
|
+
loading: l(a).update.loading
|
|
3093
3111
|
}, {
|
|
3094
3112
|
default: p(() => [
|
|
3095
3113
|
M(U(l(C).tCurd("confirm")), 1)
|
|
3096
3114
|
]),
|
|
3097
3115
|
_: 1
|
|
3098
3116
|
}, 8, ["onClick", "loading"]),
|
|
3099
|
-
S(
|
|
3117
|
+
S(d.$slots, "table-op-edit-right", { row: m })
|
|
3100
3118
|
], 64)) : (g(), v(B, { key: 1 }, [
|
|
3101
3119
|
l(r)(e.option.table?.add, m) ? (g(), b(l(N), {
|
|
3102
3120
|
key: 0,
|
|
3103
3121
|
link: "",
|
|
3104
3122
|
type: "primary",
|
|
3105
|
-
onClick: (w) => l(
|
|
3123
|
+
onClick: (w) => l(a).update.open(l(n).Add, m)
|
|
3106
3124
|
}, {
|
|
3107
3125
|
default: p(() => [
|
|
3108
3126
|
M(U(l(C).tCurd("add")), 1)
|
|
@@ -3113,7 +3131,7 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3113
3131
|
key: 1,
|
|
3114
3132
|
link: "",
|
|
3115
3133
|
type: "primary",
|
|
3116
|
-
onClick: (w) => l(
|
|
3134
|
+
onClick: (w) => l(a).update.open(l(n).View, m)
|
|
3117
3135
|
}, {
|
|
3118
3136
|
default: p(() => [
|
|
3119
3137
|
M(U(l(C).tCurd("view")), 1)
|
|
@@ -3124,7 +3142,7 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3124
3142
|
key: 2,
|
|
3125
3143
|
link: "",
|
|
3126
3144
|
type: "warning",
|
|
3127
|
-
onClick: (w) => l(
|
|
3145
|
+
onClick: (w) => l(a).update.open(l(n).Update, m)
|
|
3128
3146
|
}, {
|
|
3129
3147
|
default: p(() => [
|
|
3130
3148
|
M(U(l(C).tCurd("edit")), 1)
|
|
@@ -3135,14 +3153,14 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3135
3153
|
key: 3,
|
|
3136
3154
|
link: "",
|
|
3137
3155
|
type: "danger",
|
|
3138
|
-
onClick: (w) => l(
|
|
3156
|
+
onClick: (w) => l(a).remove.open([m])
|
|
3139
3157
|
}, {
|
|
3140
3158
|
default: p(() => [
|
|
3141
3159
|
M(U(l(C).tCurd("delete")), 1)
|
|
3142
3160
|
]),
|
|
3143
3161
|
_: 1
|
|
3144
3162
|
}, 8, ["onClick"])) : V("", !0),
|
|
3145
|
-
S(
|
|
3163
|
+
S(d.$slots, "table-op-right", { row: m })
|
|
3146
3164
|
], 64))
|
|
3147
3165
|
]),
|
|
3148
3166
|
_: 2
|
|
@@ -3153,58 +3171,58 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3153
3171
|
]),
|
|
3154
3172
|
_: 3
|
|
3155
3173
|
}, 16, ["data", "border", "onSelectionChange", "onSortChange", "expand-row-keys", "onExpandChange"])), [
|
|
3156
|
-
[f, l(
|
|
3174
|
+
[f, l(a).table.loading]
|
|
3157
3175
|
])
|
|
3158
3176
|
], 2)
|
|
3159
3177
|
], 2),
|
|
3160
|
-
R("div",
|
|
3161
|
-
(e.option.page?.show === void 0 || e.option.page?.show) && !l(
|
|
3178
|
+
R("div", Ho, [
|
|
3179
|
+
(e.option.page?.show === void 0 || e.option.page?.show) && !l(a).page.showTools ? (g(), b(l(Oe), x({
|
|
3162
3180
|
key: 0,
|
|
3163
|
-
"current-page": l(
|
|
3164
|
-
"onUpdate:currentPage":
|
|
3165
|
-
"page-size": l(
|
|
3166
|
-
"onUpdate:pageSize":
|
|
3181
|
+
"current-page": l(a).page.num,
|
|
3182
|
+
"onUpdate:currentPage": s[8] || (s[8] = (m) => l(a).page.num = m),
|
|
3183
|
+
"page-size": l(a).page.size,
|
|
3184
|
+
"onUpdate:pageSize": s[9] || (s[9] = (m) => l(a).page.size = m),
|
|
3167
3185
|
background: "",
|
|
3168
|
-
"page-sizes": l(
|
|
3169
|
-
"pager-count": l(
|
|
3170
|
-
layout: l(
|
|
3171
|
-
total: l(
|
|
3186
|
+
"page-sizes": l(a).page.sizeList,
|
|
3187
|
+
"pager-count": l(a).page.pagerCount,
|
|
3188
|
+
layout: l(a).page.layout,
|
|
3189
|
+
total: l(a).page.total,
|
|
3172
3190
|
size: e.option.size?.table,
|
|
3173
|
-
onSizeChange: l(
|
|
3174
|
-
onCurrentChange: l(
|
|
3191
|
+
onSizeChange: l(a).table.getList,
|
|
3192
|
+
onCurrentChange: l(a).table.getList
|
|
3175
3193
|
}, e.option.page?.pagination || {}, E(e.option.page?.pagination?.on || {})), null, 16, ["current-page", "page-size", "page-sizes", "pager-count", "layout", "total", "size", "onSizeChange", "onCurrentChange"])) : V("", !0)
|
|
3176
3194
|
])
|
|
3177
3195
|
], 2),
|
|
3178
|
-
S(
|
|
3196
|
+
S(d.$slots, "box-right")
|
|
3179
3197
|
], 2),
|
|
3180
3198
|
F(l(Ee), x({
|
|
3181
|
-
modelValue: l(
|
|
3182
|
-
"onUpdate:modelValue":
|
|
3183
|
-
title: l(
|
|
3184
|
-
"before-close": l(
|
|
3199
|
+
modelValue: l(a).update.show,
|
|
3200
|
+
"onUpdate:modelValue": s[10] || (s[10] = (m) => l(a).update.show = m),
|
|
3201
|
+
title: l(a).update.title,
|
|
3202
|
+
"before-close": l(a).update.close
|
|
3185
3203
|
}, e.option.dialog), {
|
|
3186
3204
|
footer: p(() => [
|
|
3187
|
-
R("span",
|
|
3205
|
+
R("span", Wo, [
|
|
3188
3206
|
F(l(oe), {
|
|
3189
3207
|
size: e.option.size?.form
|
|
3190
3208
|
}, {
|
|
3191
3209
|
default: p(() => [
|
|
3192
|
-
S(
|
|
3193
|
-
row: l(
|
|
3210
|
+
S(d.$slots, "dialog-footer", {
|
|
3211
|
+
row: l(a).update
|
|
3194
3212
|
}, () => [
|
|
3195
3213
|
F(l(N), {
|
|
3196
|
-
onClick: l(
|
|
3214
|
+
onClick: l(a).update.close
|
|
3197
3215
|
}, {
|
|
3198
3216
|
default: p(() => [
|
|
3199
3217
|
M(U(l(C).tCurd("close")), 1)
|
|
3200
3218
|
]),
|
|
3201
3219
|
_: 1
|
|
3202
3220
|
}, 8, ["onClick"]),
|
|
3203
|
-
l(
|
|
3221
|
+
l(a).update.type !== l(n).View ? (g(), b(l(N), {
|
|
3204
3222
|
key: 0,
|
|
3205
3223
|
type: "primary",
|
|
3206
|
-
onClick: l(
|
|
3207
|
-
loading: l(
|
|
3224
|
+
onClick: l(a).update.submit,
|
|
3225
|
+
loading: l(a).update.loading
|
|
3208
3226
|
}, {
|
|
3209
3227
|
default: p(() => [
|
|
3210
3228
|
M(U(l(C).tCurd("submit")), 1)
|
|
@@ -3218,61 +3236,61 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3218
3236
|
])
|
|
3219
3237
|
]),
|
|
3220
3238
|
default: p(() => [
|
|
3221
|
-
S(
|
|
3222
|
-
row: l(
|
|
3239
|
+
S(d.$slots, "dialog-start", {
|
|
3240
|
+
row: l(a).update
|
|
3223
3241
|
}),
|
|
3224
3242
|
F(l(oe), {
|
|
3225
3243
|
ref_key: "ruleFormRef",
|
|
3226
|
-
ref:
|
|
3227
|
-
model: l(
|
|
3228
|
-
rules: l(
|
|
3244
|
+
ref: u,
|
|
3245
|
+
model: l(a).update.form,
|
|
3246
|
+
rules: l(a).update.rules,
|
|
3229
3247
|
size: e.option.size?.form,
|
|
3230
3248
|
class: "update-dialog-form"
|
|
3231
3249
|
}, {
|
|
3232
3250
|
default: p(() => [
|
|
3233
|
-
l(
|
|
3251
|
+
l(a).update.showContent ? (g(), b(_e, {
|
|
3234
3252
|
key: 0,
|
|
3235
|
-
"form-grid": l(
|
|
3236
|
-
"max-span": l(
|
|
3237
|
-
form: l(
|
|
3238
|
-
type: l(
|
|
3253
|
+
"form-grid": l(a).update.formGrid,
|
|
3254
|
+
"max-span": l(a).update.formMaxSpan,
|
|
3255
|
+
form: l(a).update.form,
|
|
3256
|
+
type: l(a).update.type,
|
|
3239
3257
|
stripe: e.option.form?.stripe,
|
|
3240
3258
|
"label-width": e.option.form?.labelWidth,
|
|
3241
3259
|
"form-option": e.option.form,
|
|
3242
|
-
"get-bind": l(
|
|
3243
|
-
"get-on": l(
|
|
3244
|
-
"get-disabled": l(
|
|
3245
|
-
},
|
|
3246
|
-
G(
|
|
3260
|
+
"get-bind": l(a).update.getBind,
|
|
3261
|
+
"get-on": l(a).update.getOn,
|
|
3262
|
+
"get-disabled": l(a).update.getDisabled
|
|
3263
|
+
}, Y({ _: 2 }, [
|
|
3264
|
+
G(d.$slots, (m, w) => ({
|
|
3247
3265
|
name: w,
|
|
3248
3266
|
fn: p((D) => [
|
|
3249
|
-
S(
|
|
3267
|
+
S(d.$slots, w, $e(ze(D || {})))
|
|
3250
3268
|
])
|
|
3251
3269
|
}))
|
|
3252
3270
|
]), 1032, ["form-grid", "max-span", "form", "type", "stripe", "label-width", "form-option", "get-bind", "get-on", "get-disabled"])) : V("", !0)
|
|
3253
3271
|
]),
|
|
3254
3272
|
_: 3
|
|
3255
3273
|
}, 8, ["model", "rules", "size"]),
|
|
3256
|
-
S(
|
|
3257
|
-
row: l(
|
|
3274
|
+
S(d.$slots, "dialog-end", {
|
|
3275
|
+
row: l(a).update
|
|
3258
3276
|
})
|
|
3259
3277
|
]),
|
|
3260
3278
|
_: 3
|
|
3261
3279
|
}, 16, ["modelValue", "title", "before-close"]),
|
|
3262
3280
|
F(l(Ee), {
|
|
3263
|
-
modelValue: l(
|
|
3264
|
-
"onUpdate:modelValue":
|
|
3265
|
-
title: l(
|
|
3281
|
+
modelValue: l(a).remove.show,
|
|
3282
|
+
"onUpdate:modelValue": s[11] || (s[11] = (m) => l(a).remove.show = m),
|
|
3283
|
+
title: l(a).remove.title,
|
|
3266
3284
|
"close-on-click-modal": !1
|
|
3267
3285
|
}, {
|
|
3268
3286
|
footer: p(() => [
|
|
3269
|
-
R("span",
|
|
3287
|
+
R("span", Qo, [
|
|
3270
3288
|
F(l(oe), {
|
|
3271
3289
|
size: e.option.size?.form
|
|
3272
3290
|
}, {
|
|
3273
3291
|
default: p(() => [
|
|
3274
3292
|
F(l(N), {
|
|
3275
|
-
onClick: l(
|
|
3293
|
+
onClick: l(a).remove.close
|
|
3276
3294
|
}, {
|
|
3277
3295
|
default: p(() => [
|
|
3278
3296
|
M(U(l(C).tCurd("close")), 1)
|
|
@@ -3281,8 +3299,8 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3281
3299
|
}, 8, ["onClick"]),
|
|
3282
3300
|
F(l(N), {
|
|
3283
3301
|
type: "danger",
|
|
3284
|
-
onClick: l(
|
|
3285
|
-
loading: l(
|
|
3302
|
+
onClick: l(a).remove.submit,
|
|
3303
|
+
loading: l(a).remove.loading
|
|
3286
3304
|
}, {
|
|
3287
3305
|
default: p(() => [
|
|
3288
3306
|
M(U(l(C).tCurd("confirmDelete")), 1)
|
|
@@ -3295,89 +3313,89 @@ const So = /* @__PURE__ */ re(Co, [["render", Vo]]), Eo = { class: "row flex-cen
|
|
|
3295
3313
|
])
|
|
3296
3314
|
]),
|
|
3297
3315
|
default: p(() => [
|
|
3298
|
-
e.option.dialog?.delete?.content ? (g(), v("div",
|
|
3299
|
-
F(
|
|
3316
|
+
e.option.dialog?.delete?.content ? (g(), v("div", Jo, [
|
|
3317
|
+
F(to, {
|
|
3300
3318
|
content: e.option.dialog?.delete?.content,
|
|
3301
|
-
value: l(
|
|
3319
|
+
value: l(a).remove.items
|
|
3302
3320
|
}, null, 8, ["content", "value"])
|
|
3303
|
-
])) : (g(), v("div",
|
|
3321
|
+
])) : (g(), v("div", qo, U(l(C).tCurd("confirmDeleteMessage", l(a).remove.items.length)), 1))
|
|
3304
3322
|
]),
|
|
3305
3323
|
_: 1
|
|
3306
3324
|
}, 8, ["modelValue", "title"]),
|
|
3307
|
-
F(
|
|
3325
|
+
F(_t, {
|
|
3308
3326
|
ref_key: "switchConfirmRef",
|
|
3309
|
-
ref:
|
|
3327
|
+
ref: i,
|
|
3310
3328
|
size: e.option.size?.form
|
|
3311
3329
|
}, null, 8, ["size"])
|
|
3312
3330
|
], 2);
|
|
3313
3331
|
};
|
|
3314
3332
|
}
|
|
3315
3333
|
});
|
|
3316
|
-
class
|
|
3334
|
+
class oa {
|
|
3317
3335
|
/**
|
|
3318
3336
|
* 通过远程 URL 下载文件,自动创建临时 `<a>` 标签触发浏览器下载
|
|
3319
3337
|
*
|
|
3320
3338
|
* @param href - 文件的远程地址
|
|
3321
3339
|
* @param name - 下载后的文件名,默认 `'download.png'`
|
|
3322
3340
|
*/
|
|
3323
|
-
static async download(
|
|
3324
|
-
const
|
|
3325
|
-
|
|
3341
|
+
static async download(t, n = "download.png") {
|
|
3342
|
+
const o = document.createElement("a");
|
|
3343
|
+
o.style.display = "none", o.href = t, o.setAttribute("download", n), typeof o.download > "u" && o.setAttribute("target", "_blank"), document.body.appendChild(o), o.click(), document.body.removeChild(o), window.URL.revokeObjectURL(t);
|
|
3326
3344
|
}
|
|
3327
3345
|
/**
|
|
3328
3346
|
* 将json对象或者json数组导出为json文件保存
|
|
3329
3347
|
* @param data
|
|
3330
3348
|
* @param name
|
|
3331
3349
|
*/
|
|
3332
|
-
static exportJSONFile = (
|
|
3333
|
-
const
|
|
3334
|
-
|
|
3350
|
+
static exportJSONFile = (t, n) => {
|
|
3351
|
+
const o = new Blob([JSON.stringify(t)], { type: "application/json" }), r = URL.createObjectURL(o), a = document.createElement("a");
|
|
3352
|
+
a.href = r, a.download = `${n || "config"}.json`, a.click();
|
|
3335
3353
|
};
|
|
3336
3354
|
/**
|
|
3337
3355
|
* 导入文件内容,默认为json
|
|
3338
3356
|
* @param param
|
|
3339
3357
|
* @returns
|
|
3340
3358
|
*/
|
|
3341
|
-
static importFile = async (
|
|
3359
|
+
static importFile = async (t) => new Promise((n, o) => {
|
|
3342
3360
|
const r = document.createElement("input");
|
|
3343
3361
|
r.type = "file";
|
|
3344
|
-
const
|
|
3345
|
-
r.accept =
|
|
3346
|
-
const
|
|
3347
|
-
if (!
|
|
3348
|
-
$.fail("未选择文件"),
|
|
3362
|
+
const a = t?.accept || ".json";
|
|
3363
|
+
r.accept = a, r.style.display = "none", r.onchange = (i) => {
|
|
3364
|
+
const u = i.target.files[0];
|
|
3365
|
+
if (!u) {
|
|
3366
|
+
$.fail("未选择文件"), o("未选择文件");
|
|
3349
3367
|
return;
|
|
3350
3368
|
}
|
|
3351
3369
|
const c = new FileReader();
|
|
3352
|
-
c.onload = async (
|
|
3353
|
-
const
|
|
3354
|
-
|
|
3370
|
+
c.onload = async (d) => {
|
|
3371
|
+
const s = a == ".json" ? JSON.parse(d.target.result) : d.target.result;
|
|
3372
|
+
n(s);
|
|
3355
3373
|
}, c.onerror = () => {
|
|
3356
|
-
$.fail("文件读取失败"),
|
|
3357
|
-
}, c.readAsText(
|
|
3374
|
+
$.fail("文件读取失败"), o("文件读取失败");
|
|
3375
|
+
}, c.readAsText(u), document.body.removeChild(r);
|
|
3358
3376
|
}, document.body.appendChild(r), r.click();
|
|
3359
3377
|
});
|
|
3360
3378
|
}
|
|
3361
|
-
const
|
|
3362
|
-
if (e.component("TCurd",
|
|
3363
|
-
W.customComponent =
|
|
3364
|
-
for (const
|
|
3365
|
-
e.component(
|
|
3379
|
+
const Yo = (e, t) => {
|
|
3380
|
+
if (e.component("TCurd", Xo), e.component("TFormList", Ke), e.component("TColumn", jt), t?.customComponent) {
|
|
3381
|
+
W.customComponent = t.customComponent;
|
|
3382
|
+
for (const n in t.customComponent)
|
|
3383
|
+
e.component(n, t.customComponent[n]);
|
|
3366
3384
|
}
|
|
3367
|
-
},
|
|
3368
|
-
install:
|
|
3385
|
+
}, aa = {
|
|
3386
|
+
install: Yo
|
|
3369
3387
|
};
|
|
3370
3388
|
export {
|
|
3371
3389
|
Q as ArrUtil,
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3390
|
+
Jt as ExcelUtil,
|
|
3391
|
+
jt as TColumn,
|
|
3392
|
+
Xo as TCurd,
|
|
3393
|
+
oa as TFile,
|
|
3376
3394
|
W as TForm,
|
|
3377
|
-
|
|
3395
|
+
L as TFormConfig,
|
|
3378
3396
|
C as TFormI18n,
|
|
3379
3397
|
Ke as TFormList,
|
|
3380
3398
|
$ as TSys,
|
|
3381
|
-
|
|
3382
|
-
|
|
3399
|
+
aa as default,
|
|
3400
|
+
Yo as install
|
|
3383
3401
|
};
|