cc1-form 1.1.7 → 1.1.8
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 +360 -354
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/index.d.ts +4 -2
- package/dist/components/TCurd/index.vue.d.ts +23 -23
- package/package.json +1 -1
package/dist/cc1-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as B, reactive as
|
|
2
|
-
import { ElMessage as ue, ElLoading as ce, ElForm as
|
|
1
|
+
import { defineComponent as B, reactive as Z, onMounted as le, resolveComponent as oe, createElementBlock as k, createCommentVNode as v, openBlock as c, renderSlot as x, createElementVNode as S, createVNode as V, withCtx as h, createTextVNode as D, Fragment as O, renderList as T, createBlock as g, normalizeClass as M, normalizeStyle as ne, ref as z, nextTick as re, unref as a, mergeProps as U, toHandlers as _, resolveDynamicComponent as H, toDisplayString as E, resolveDirective as ie, withDirectives as de } from "vue";
|
|
2
|
+
import { ElMessage as ue, ElLoading as ce, ElForm as G, ElFormItem as N, ElInput as q, ElSwitch as X, ElSelect as A, ElOption as K, ElTreeSelect as ae, ElDatePicker as Q, ElDialog as Y, ElButton as F, ElDropdown as pe, ElDropdownMenu as fe, ElDropdownItem as J, ElTable as me, ElTableColumn as W, ElPagination as he } from "element-plus";
|
|
3
3
|
class $ {
|
|
4
4
|
/**
|
|
5
5
|
* 路由
|
|
@@ -24,13 +24,13 @@ class $ {
|
|
|
24
24
|
* @param data 数据
|
|
25
25
|
* @returns 是否显示
|
|
26
26
|
*/
|
|
27
|
-
static isFun = (
|
|
27
|
+
static isFun = (r, d) => Array.isArray(r) ? r.some((s) => typeof s == "function" ? s(d) : s) : typeof r == "function" ? r(d) : r;
|
|
28
28
|
/**
|
|
29
29
|
* 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
|
|
30
30
|
*/
|
|
31
31
|
static getRouterParams = () => {
|
|
32
|
-
const
|
|
33
|
-
return Object.keys(
|
|
32
|
+
const r = this.router.currentRoute.value.query || {}, d = this.router.currentRoute.value.params || {};
|
|
33
|
+
return Object.keys(r).length ? r : Object.keys(d).length ? d : {};
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* 模块赋值
|
|
@@ -40,10 +40,10 @@ class $ {
|
|
|
40
40
|
* 加载模块
|
|
41
41
|
* @param module
|
|
42
42
|
*/
|
|
43
|
-
static loadModule = async (
|
|
44
|
-
if (!$.moduleObj[
|
|
45
|
-
throw new Error(`模块${
|
|
46
|
-
const d = await $.moduleObj[
|
|
43
|
+
static loadModule = async (r) => {
|
|
44
|
+
if (!$.moduleObj[r])
|
|
45
|
+
throw new Error(`模块${r}未加载,请赋值如:TSys.moduleObj = { ${r}: ()=>import('${r}') }`);
|
|
46
|
+
const d = await $.moduleObj[r]();
|
|
47
47
|
return d.default ?? d;
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
@@ -60,19 +60,19 @@ class $ {
|
|
|
60
60
|
* @param type 消息类型
|
|
61
61
|
* @param options 其他选项
|
|
62
62
|
*/
|
|
63
|
-
static showMessage(
|
|
63
|
+
static showMessage(r, d, s = {}) {
|
|
64
64
|
const f = Date.now();
|
|
65
|
-
if (!this.tipMessages[
|
|
66
|
-
this.tipMessages[
|
|
65
|
+
if (!this.tipMessages[r] || f - this.tipMessages[r] > this.tipMessagesGap) {
|
|
66
|
+
this.tipMessages[r] = f;
|
|
67
67
|
const m = Object.assign(
|
|
68
68
|
{
|
|
69
|
-
message:
|
|
69
|
+
message: r,
|
|
70
70
|
type: d
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
s
|
|
73
73
|
);
|
|
74
74
|
ue(m), setTimeout(() => {
|
|
75
|
-
delete this.tipMessages[
|
|
75
|
+
delete this.tipMessages[r];
|
|
76
76
|
}, this.tipMessagesGap);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -81,16 +81,16 @@ class $ {
|
|
|
81
81
|
* @param content
|
|
82
82
|
* @param options
|
|
83
83
|
*/
|
|
84
|
-
static fail = (
|
|
85
|
-
this.showMessage(
|
|
84
|
+
static fail = (r, d = {}) => {
|
|
85
|
+
this.showMessage(r, "error", d);
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
88
|
* 成功提示
|
|
89
89
|
* @param content
|
|
90
90
|
* @param options
|
|
91
91
|
*/
|
|
92
|
-
static success = (
|
|
93
|
-
this.showMessage(
|
|
92
|
+
static success = (r, d = {}) => {
|
|
93
|
+
this.showMessage(r, "success", d);
|
|
94
94
|
};
|
|
95
95
|
static loadingObj = null;
|
|
96
96
|
static loadingTimer = null;
|
|
@@ -99,9 +99,9 @@ class $ {
|
|
|
99
99
|
* @param show
|
|
100
100
|
* @param text
|
|
101
101
|
*/
|
|
102
|
-
static loading = (
|
|
102
|
+
static loading = (r = !0, d = "加载中") => {
|
|
103
103
|
Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
|
|
104
|
-
|
|
104
|
+
r ? this.loadingObj = ce.service({
|
|
105
105
|
lock: !0,
|
|
106
106
|
text: d,
|
|
107
107
|
background: "rgba(0, 0, 0, 0.3)"
|
|
@@ -113,17 +113,17 @@ class $ {
|
|
|
113
113
|
* @param url 地址
|
|
114
114
|
* @param isCenter 是否居中
|
|
115
115
|
*/
|
|
116
|
-
static openUrl = (
|
|
116
|
+
static openUrl = (r, d = !0) => {
|
|
117
117
|
if (d) {
|
|
118
|
-
let
|
|
118
|
+
let s = screen.width / 2 - 500, f = screen.height / 2 - 800 / 2 - 30;
|
|
119
119
|
window.open(
|
|
120
|
-
|
|
120
|
+
r,
|
|
121
121
|
"_blank",
|
|
122
|
-
"toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + f + ", left=" +
|
|
122
|
+
"toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top=" + f + ", left=" + s
|
|
123
123
|
);
|
|
124
124
|
} else
|
|
125
125
|
window.open(
|
|
126
|
-
|
|
126
|
+
r,
|
|
127
127
|
"DescriptiveWindowName" + StrUtil.getId(),
|
|
128
128
|
"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0"
|
|
129
129
|
);
|
|
@@ -133,18 +133,18 @@ class $ {
|
|
|
133
133
|
* @param param
|
|
134
134
|
* @returns
|
|
135
135
|
*/
|
|
136
|
-
static getImgPic = (
|
|
137
|
-
let f = document.getElementById(
|
|
136
|
+
static getImgPic = (r) => new Promise(async (d, s) => {
|
|
137
|
+
let f = document.getElementById(r.id);
|
|
138
138
|
const m = await $.loadModule("html2canvas");
|
|
139
139
|
try {
|
|
140
140
|
m(f, {
|
|
141
141
|
logging: !1,
|
|
142
142
|
allowTaint: !0,
|
|
143
143
|
scale: window.devicePixelRatio,
|
|
144
|
-
width:
|
|
145
|
-
height:
|
|
146
|
-
windowWidth:
|
|
147
|
-
windowHeight:
|
|
144
|
+
width: r.windowWidth,
|
|
145
|
+
height: r.windowHeight,
|
|
146
|
+
windowWidth: r.windowWidth,
|
|
147
|
+
windowHeight: r.windowHeight,
|
|
148
148
|
useCORS: !0,
|
|
149
149
|
backgroundColor: "#ffffff00"
|
|
150
150
|
}).then(function(u) {
|
|
@@ -152,11 +152,11 @@ class $ {
|
|
|
152
152
|
d(e);
|
|
153
153
|
});
|
|
154
154
|
} catch (u) {
|
|
155
|
-
|
|
155
|
+
s(u);
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
class
|
|
159
|
+
class C {
|
|
160
160
|
/** 全局分页字段 */
|
|
161
161
|
static pageField = {
|
|
162
162
|
num: "num",
|
|
@@ -182,10 +182,10 @@ class V {
|
|
|
182
182
|
* @param field
|
|
183
183
|
* @returns
|
|
184
184
|
*/
|
|
185
|
-
static findOptions = (
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
185
|
+
static findOptions = (r, d) => {
|
|
186
|
+
const s = r.column.find((m) => m.key === d), f = (m) => m.replace(/-([a-z])/g, (u, e) => e.toUpperCase());
|
|
187
|
+
if (s)
|
|
188
|
+
return s.options[f(s.type)];
|
|
189
189
|
};
|
|
190
190
|
/**
|
|
191
191
|
* 更新组件数据
|
|
@@ -203,9 +203,9 @@ class V {
|
|
|
203
203
|
}))
|
|
204
204
|
)
|
|
205
205
|
*/
|
|
206
|
-
static setOptionsData = (
|
|
207
|
-
const f =
|
|
208
|
-
f && (f.data =
|
|
206
|
+
static setOptionsData = (r, d, s) => {
|
|
207
|
+
const f = C.findOptions(r, d);
|
|
208
|
+
f && (f.data = s);
|
|
209
209
|
};
|
|
210
210
|
static form = {
|
|
211
211
|
openBefore: {
|
|
@@ -216,8 +216,8 @@ class V {
|
|
|
216
216
|
* @param treeData 树形数据
|
|
217
217
|
* @param option 组件配置
|
|
218
218
|
*/
|
|
219
|
-
parentId: (
|
|
220
|
-
|
|
219
|
+
parentId: (r, d, s, f) => {
|
|
220
|
+
r ? d.type === $.EDialog.Insert ? (d.form.parentId = r._id, d.form.sort = r.children.length + 1) : d.form.parentId = r.parentId.substring(r.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = s.length + 1), C.setOptionsData(f, "parentId", [{ _id: "0", title: "根", children: s }]);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
};
|
|
@@ -232,9 +232,9 @@ class j {
|
|
|
232
232
|
* @param field 字段名
|
|
233
233
|
* @param row 行数据
|
|
234
234
|
*/
|
|
235
|
-
static setId = (
|
|
236
|
-
d[
|
|
237
|
-
|
|
235
|
+
static setId = (r, d, s) => {
|
|
236
|
+
d[r] || (d[r] = []), d[r].forEach((f) => {
|
|
237
|
+
s.forEach((m) => {
|
|
238
238
|
let u = m.default ?? "";
|
|
239
239
|
m.type === "number" && (u = m.default ?? 0), m.type === "boolean" && (u = m.default ?? !1), m.type === "time" && (u = m.default ?? /* @__PURE__ */ new Date()), f[m.value] === void 0 && (f[m.value] = u);
|
|
240
240
|
}), f._id || (f._id = j.getIdFun());
|
|
@@ -247,13 +247,13 @@ class j {
|
|
|
247
247
|
* @param itemFields 元素字段-如:[{label:'',value:''}]
|
|
248
248
|
* @param callback 回调函数
|
|
249
249
|
*/
|
|
250
|
-
static add = (
|
|
251
|
-
const m = JSONUtil.cp(
|
|
252
|
-
j.setId(
|
|
250
|
+
static add = (r, d, s, f) => {
|
|
251
|
+
const m = JSONUtil.cp(s);
|
|
252
|
+
j.setId(r, d, s), d[r].push(
|
|
253
253
|
m.reduce(
|
|
254
254
|
(u, e) => {
|
|
255
|
-
let
|
|
256
|
-
return e.type === "number" && (
|
|
255
|
+
let n = e.default ?? "";
|
|
256
|
+
return e.type === "number" && (n = e.default ?? 0), e.type === "boolean" && (n = e.default ?? !1), e.type === "time" && (n = e.default ?? /* @__PURE__ */ new Date()), u[e.value] = n, u;
|
|
257
257
|
},
|
|
258
258
|
{ _id: j.getIdFun() }
|
|
259
259
|
)
|
|
@@ -266,8 +266,8 @@ class j {
|
|
|
266
266
|
* @param item 元素-如:{_id:''}
|
|
267
267
|
* @param callback 回调函数
|
|
268
268
|
*/
|
|
269
|
-
static remove = (
|
|
270
|
-
d[
|
|
269
|
+
static remove = (r, d, s, f) => {
|
|
270
|
+
d[r] = d[r].filter((m) => m._id !== s._id), f?.(d);
|
|
271
271
|
};
|
|
272
272
|
/**
|
|
273
273
|
* 获取没有id的数据
|
|
@@ -275,11 +275,11 @@ class j {
|
|
|
275
275
|
* @param childernField 子级字段-如:list、children
|
|
276
276
|
* @returns 没有id的数据
|
|
277
277
|
*/
|
|
278
|
-
static getNoIdData = (
|
|
279
|
-
const
|
|
280
|
-
return
|
|
278
|
+
static getNoIdData = (r, d) => {
|
|
279
|
+
const s = JSONUtil.cp(r);
|
|
280
|
+
return s.forEach((f) => {
|
|
281
281
|
f._id && delete f._id, d && f[d] && j.getNoIdData(f[d], d);
|
|
282
|
-
}),
|
|
282
|
+
}), s;
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
const be = {
|
|
@@ -289,7 +289,7 @@ const be = {
|
|
|
289
289
|
}, ye = {
|
|
290
290
|
class: "row items-center",
|
|
291
291
|
style: { gap: "10px", width: "100%" }
|
|
292
|
-
},
|
|
292
|
+
}, ee = /* @__PURE__ */ B({
|
|
293
293
|
__name: "list",
|
|
294
294
|
props: {
|
|
295
295
|
row: {
|
|
@@ -324,8 +324,8 @@ const be = {
|
|
|
324
324
|
}
|
|
325
325
|
},
|
|
326
326
|
emits: ["change"],
|
|
327
|
-
setup(p, { emit:
|
|
328
|
-
const d = p,
|
|
327
|
+
setup(p, { emit: r }) {
|
|
328
|
+
const d = p, s = Z({
|
|
329
329
|
show: !1,
|
|
330
330
|
add: (m, u, e) => {
|
|
331
331
|
j.add(m, u, e, () => {
|
|
@@ -338,19 +338,19 @@ const be = {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
|
-
|
|
342
|
-
j.setId(d.field, d.row, d.itemFields),
|
|
341
|
+
le(() => {
|
|
342
|
+
j.setId(d.field, d.row, d.itemFields), s.show = !0;
|
|
343
343
|
});
|
|
344
|
-
const f =
|
|
344
|
+
const f = r;
|
|
345
345
|
return (m, u) => {
|
|
346
|
-
const e =
|
|
347
|
-
return
|
|
346
|
+
const e = oe("el-button"), n = oe("el-input");
|
|
347
|
+
return s.show ? (c(), k("div", be, [
|
|
348
348
|
x(m.$slots, "list-start", { row: p.row }),
|
|
349
349
|
S("div", null, [
|
|
350
|
-
|
|
350
|
+
V(e, {
|
|
351
351
|
link: "",
|
|
352
352
|
type: "primary",
|
|
353
|
-
onClick: u[0] || (u[0] = (i) =>
|
|
353
|
+
onClick: u[0] || (u[0] = (i) => s.add(p.field, p.row, p.itemFields))
|
|
354
354
|
}, {
|
|
355
355
|
default: h(() => [...u[2] || (u[2] = [
|
|
356
356
|
D("添加", -1)
|
|
@@ -363,7 +363,7 @@ const be = {
|
|
|
363
363
|
item: i,
|
|
364
364
|
row: p.row
|
|
365
365
|
}),
|
|
366
|
-
(c(!0), k(O, null, T(p.itemFields, (o) => (c(), g(
|
|
366
|
+
(c(!0), k(O, null, T(p.itemFields, (o) => (c(), g(n, {
|
|
367
367
|
modelValue: i[o.value],
|
|
368
368
|
"onUpdate:modelValue": (t) => i[o.value] = t,
|
|
369
369
|
style: ne({ width: p.inputWidth }),
|
|
@@ -375,10 +375,10 @@ const be = {
|
|
|
375
375
|
item: i,
|
|
376
376
|
row: p.row
|
|
377
377
|
}),
|
|
378
|
-
|
|
378
|
+
V(e, {
|
|
379
379
|
link: "",
|
|
380
380
|
type: "danger",
|
|
381
|
-
onClick: (o) =>
|
|
381
|
+
onClick: (o) => s.remove(p.field, p.row, i)
|
|
382
382
|
}, {
|
|
383
383
|
default: h(() => [...u[3] || (u[3] = [
|
|
384
384
|
D("删除", -1)
|
|
@@ -387,7 +387,7 @@ const be = {
|
|
|
387
387
|
}, 8, ["onClick"])
|
|
388
388
|
]))), 256)),
|
|
389
389
|
x(m.$slots, "list-end", { row: p.row })
|
|
390
|
-
])) :
|
|
390
|
+
])) : v("", !0);
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
}), ge = { class: "row curd-row" }, we = /* @__PURE__ */ B({
|
|
@@ -406,39 +406,39 @@ const be = {
|
|
|
406
406
|
default: ""
|
|
407
407
|
}
|
|
408
408
|
},
|
|
409
|
-
setup(p, { expose:
|
|
410
|
-
const d = $.isFun,
|
|
409
|
+
setup(p, { expose: r }) {
|
|
410
|
+
const d = $.isFun, s = $.EDialog, f = z(), m = p, u = Z({
|
|
411
411
|
rules: {},
|
|
412
412
|
show: !0,
|
|
413
413
|
form: {},
|
|
414
414
|
formDefault: {},
|
|
415
415
|
formColumn: [],
|
|
416
|
-
getDisabled: (e) => e.disabled?.[(m.type ||
|
|
416
|
+
getDisabled: (e) => e.disabled?.[(m.type || s.Insert) === s.Insert ? "create" : "update"],
|
|
417
417
|
initColumnForm: async () => {
|
|
418
418
|
const e = m.option;
|
|
419
419
|
u.formColumn = [];
|
|
420
|
-
const
|
|
420
|
+
const n = [], i = m.option.form?.maxSpan || 12, o = m.option.form?.defaultSpan || i;
|
|
421
421
|
let t = [];
|
|
422
422
|
const l = (b) => {
|
|
423
423
|
if (u.formDefault[b.key] = b.value, b.isForm) {
|
|
424
424
|
b.form = b.form || { span: o }, b.form.span = b.form.span ?? o;
|
|
425
425
|
let I = b.form.span, y = t.reduce((L, P) => L + P.span, I);
|
|
426
|
-
const
|
|
427
|
-
t.push({ item: b, span: I }), (
|
|
426
|
+
const R = t.length;
|
|
427
|
+
t.push({ item: b, span: I }), (R === 1 && t[0].span === 0 || y >= i || I === 0 && R > 1) && (n.push(t), t = []), b.rules && (u.rules[b.key] = b.rules);
|
|
428
428
|
}
|
|
429
429
|
};
|
|
430
430
|
e.column.forEach((b) => {
|
|
431
431
|
b.isForm = !0, l(b);
|
|
432
|
-
}), t.length > 0 &&
|
|
432
|
+
}), t.length > 0 && n.push(t), u.formColumn = n, u.form = JSONUtil.cp(u.formDefault);
|
|
433
433
|
},
|
|
434
434
|
init: async () => {
|
|
435
435
|
u.show = !1, await re(), u.initColumnForm();
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
|
-
return u.initColumnForm(),
|
|
438
|
+
return u.initColumnForm(), r({
|
|
439
439
|
ref: f,
|
|
440
440
|
conf: u
|
|
441
|
-
}), (e,
|
|
441
|
+
}), (e, n) => (c(), g(a(G), {
|
|
442
442
|
ref_key: "ruleFormRef",
|
|
443
443
|
ref: f,
|
|
444
444
|
model: u.form,
|
|
@@ -450,11 +450,11 @@ const be = {
|
|
|
450
450
|
row: u.form
|
|
451
451
|
}),
|
|
452
452
|
(c(!0), k(O, null, T(i, (o) => (c(), k(O, null, [
|
|
453
|
-
|
|
453
|
+
a(d)(o.item.show?.form, u.form) ?? !0 ? (c(), k("div", {
|
|
454
454
|
key: 0,
|
|
455
455
|
class: M(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
|
|
456
456
|
}, [
|
|
457
|
-
|
|
457
|
+
V(a(N), {
|
|
458
458
|
label: o.item.label,
|
|
459
459
|
prop: o.item.key,
|
|
460
460
|
"label-width": o.item.form?.labelWidth || "100px"
|
|
@@ -468,61 +468,61 @@ const be = {
|
|
|
468
468
|
row: u.form,
|
|
469
469
|
item: o.item
|
|
470
470
|
}, () => [
|
|
471
|
-
o.item.type === "input" ? (c(), g(
|
|
471
|
+
o.item.type === "input" ? (c(), g(a(q), U({
|
|
472
472
|
key: 0,
|
|
473
473
|
modelValue: u.form[o.item.key],
|
|
474
474
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
475
|
-
}, { ref_for: !0 }, o.item.options?.input,
|
|
475
|
+
}, { ref_for: !0 }, o.item.options?.input, _(o.item.options?.input?.on || {}), {
|
|
476
476
|
disabled: u.getDisabled(o.item)
|
|
477
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(
|
|
477
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(a(X), U({
|
|
478
478
|
key: 1,
|
|
479
479
|
modelValue: u.form[o.item.key],
|
|
480
480
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
481
|
-
}, { ref_for: !0 }, o.item.options?.switch,
|
|
481
|
+
}, { ref_for: !0 }, o.item.options?.switch, _(o.item.options?.switch?.on || {}), {
|
|
482
482
|
disabled: u.getDisabled(o.item)
|
|
483
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(
|
|
483
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(a(A), U({
|
|
484
484
|
key: 2,
|
|
485
485
|
modelValue: u.form[o.item.key],
|
|
486
486
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
487
|
-
}, { ref_for: !0 }, o.item.options?.select,
|
|
487
|
+
}, { ref_for: !0 }, o.item.options?.select, _(o.item.options?.select?.on || {}), {
|
|
488
488
|
disabled: u.getDisabled(o.item),
|
|
489
489
|
style: { width: "100%" }
|
|
490
490
|
}), {
|
|
491
491
|
default: h(() => [
|
|
492
|
-
(c(!0), k(O, null, T(o.item.options?.select?.data, (t) => (c(), g(
|
|
492
|
+
(c(!0), k(O, null, T(o.item.options?.select?.data, (t) => (c(), g(a(K), {
|
|
493
493
|
key: t.value,
|
|
494
494
|
label: t.label,
|
|
495
495
|
value: t.value
|
|
496
496
|
}, null, 8, ["label", "value"]))), 128))
|
|
497
497
|
]),
|
|
498
498
|
_: 2
|
|
499
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(
|
|
499
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(ee, U({
|
|
500
500
|
key: 3,
|
|
501
501
|
row: u.form,
|
|
502
502
|
field: o.item.key
|
|
503
|
-
}, { ref_for: !0 }, o.item.options?.list,
|
|
503
|
+
}, { ref_for: !0 }, o.item.options?.list, _(o.item.options?.list?.on || {}), {
|
|
504
504
|
disabled: u.getDisabled(o.item),
|
|
505
505
|
style: { width: "100%" }
|
|
506
|
-
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(
|
|
506
|
+
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(a(ae), U({
|
|
507
507
|
key: 4,
|
|
508
508
|
modelValue: u.form[o.item.key],
|
|
509
509
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
510
|
-
}, { ref_for: !0 }, o.item.options?.treeSelect,
|
|
510
|
+
}, { ref_for: !0 }, o.item.options?.treeSelect, _(o.item.options?.treeSelect?.on || {}), {
|
|
511
511
|
disabled: u.getDisabled(o.item),
|
|
512
512
|
style: { width: "100%" }
|
|
513
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(
|
|
513
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(a(Q), U({
|
|
514
514
|
key: 5,
|
|
515
515
|
modelValue: u.form[o.item.key],
|
|
516
516
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
517
|
-
}, { ref_for: !0 }, o.item.options?.datetime,
|
|
517
|
+
}, { ref_for: !0 }, o.item.options?.datetime, _(o.item.options?.datetime?.on || {}), {
|
|
518
518
|
disabled: u.getDisabled(o.item)
|
|
519
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
519
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a(C).customComponent[o.item.type] ? (c(), g(H(a(C).customComponent[o.item.type]), U({
|
|
520
520
|
key: 6,
|
|
521
521
|
modelValue: u.form[o.item.key],
|
|
522
522
|
"onUpdate:modelValue": (t) => u.form[o.item.key] = t
|
|
523
|
-
}, { ref_for: !0 }, o.item.options?.[o.item.type],
|
|
523
|
+
}, { ref_for: !0 }, o.item.options?.[o.item.type], _(o.item.options?.[o.item.type]?.on || {}), {
|
|
524
524
|
disabled: u.getDisabled(o.item)
|
|
525
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
525
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : v("", !0)
|
|
526
526
|
]),
|
|
527
527
|
x(e.$slots, "form-" + o.item.key + "-end", {
|
|
528
528
|
row: u.form,
|
|
@@ -531,12 +531,12 @@ const be = {
|
|
|
531
531
|
]),
|
|
532
532
|
_: 2
|
|
533
533
|
}, 1032, ["label", "prop", "label-width"])
|
|
534
|
-
], 2)) :
|
|
534
|
+
], 2)) : v("", !0)
|
|
535
535
|
], 64))), 256)),
|
|
536
536
|
x(e.$slots, "form-end", {
|
|
537
537
|
row: u.form
|
|
538
538
|
})
|
|
539
|
-
]))), 256)) :
|
|
539
|
+
]))), 256)) : v("", !0)
|
|
540
540
|
]),
|
|
541
541
|
_: 3
|
|
542
542
|
}, 8, ["model", "rules"]));
|
|
@@ -549,15 +549,15 @@ class ke {
|
|
|
549
549
|
* @param columns 列
|
|
550
550
|
* @param fileName 文件名
|
|
551
551
|
*/
|
|
552
|
-
static exportToExcel = async (
|
|
553
|
-
if (!
|
|
554
|
-
const f = await $.loadModule("xlsx"), m =
|
|
552
|
+
static exportToExcel = async (r, d, s) => {
|
|
553
|
+
if (!r || r.length === 0) return;
|
|
554
|
+
const f = await $.loadModule("xlsx"), m = r.map((n) => {
|
|
555
555
|
const i = {};
|
|
556
556
|
return d.forEach((o) => {
|
|
557
|
-
i[o.label] =
|
|
557
|
+
i[o.label] = n[o.key];
|
|
558
558
|
}), i;
|
|
559
559
|
}), u = f.utils.json_to_sheet(m), e = f.utils.book_new();
|
|
560
|
-
f.utils.book_append_sheet(e, u, "Sheet1"),
|
|
560
|
+
f.utils.book_append_sheet(e, u, "Sheet1"), s ? typeof s == "function" && (s = s()) : s = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, f.writeFile(e, `${s}.xlsx`);
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
563
|
const Ce = {
|
|
@@ -592,48 +592,48 @@ const Ce = {
|
|
|
592
592
|
};
|
|
593
593
|
class w {
|
|
594
594
|
/** 解析国际化值:函数则执行返回字符串,否则 */
|
|
595
|
-
static t(
|
|
596
|
-
return typeof
|
|
595
|
+
static t(r, ...d) {
|
|
596
|
+
return typeof r == "function" ? r(...d) : (r = String(r), r.replace(/{([^}]+)}/g, (s, f, m) => typeof d[m] < "u" ? d[m] : `{${f}}`));
|
|
597
597
|
}
|
|
598
598
|
/** 解析curd国际化值 */
|
|
599
|
-
static tCurd(
|
|
600
|
-
return this.t(this.curd[
|
|
599
|
+
static tCurd(r, ...d) {
|
|
600
|
+
return this.t(this.curd[r], ...d);
|
|
601
601
|
}
|
|
602
602
|
/** curd表单 */
|
|
603
603
|
static curd = Ce;
|
|
604
604
|
}
|
|
605
605
|
const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
|
|
606
606
|
__name: "switchConfirm",
|
|
607
|
-
setup(p, { expose:
|
|
608
|
-
const d = z(!1),
|
|
607
|
+
setup(p, { expose: r }) {
|
|
608
|
+
const d = z(!1), s = z("确认修改"), f = z("确认要修改状态吗?");
|
|
609
609
|
let m = null, u = null;
|
|
610
|
-
const e = (o) => (o?.title && (
|
|
610
|
+
const e = (o) => (o?.title && (s.value = o.title), o?.content && (f.value = o.content), d.value = !0, new Promise((t, l) => {
|
|
611
611
|
m = t, u = l;
|
|
612
|
-
})),
|
|
612
|
+
})), n = () => {
|
|
613
613
|
d.value = !1, m?.(!0), m = null, u = null;
|
|
614
614
|
}, i = () => {
|
|
615
615
|
d.value = !1, u?.(new Error("用户取消操作")), m = null, u = null;
|
|
616
616
|
};
|
|
617
|
-
return
|
|
617
|
+
return r({
|
|
618
618
|
open: e
|
|
619
|
-
}), (o, t) => (c(), g(
|
|
619
|
+
}), (o, t) => (c(), g(a(Y), {
|
|
620
620
|
modelValue: d.value,
|
|
621
621
|
"onUpdate:modelValue": t[0] || (t[0] = (l) => d.value = l),
|
|
622
|
-
title:
|
|
622
|
+
title: s.value,
|
|
623
623
|
"close-on-click-modal": !1,
|
|
624
624
|
width: "400px"
|
|
625
625
|
}, {
|
|
626
626
|
footer: h(() => [
|
|
627
627
|
S("span", ve, [
|
|
628
|
-
|
|
628
|
+
V(a(F), { onClick: i }, {
|
|
629
629
|
default: h(() => [...t[1] || (t[1] = [
|
|
630
630
|
D("取消", -1)
|
|
631
631
|
])]),
|
|
632
632
|
_: 1
|
|
633
633
|
}),
|
|
634
|
-
|
|
634
|
+
V(a(F), {
|
|
635
635
|
type: "primary",
|
|
636
|
-
onClick:
|
|
636
|
+
onClick: n
|
|
637
637
|
}, {
|
|
638
638
|
default: h(() => [...t[2] || (t[2] = [
|
|
639
639
|
D("确认", -1)
|
|
@@ -648,30 +648,30 @@ const ve = { class: "dialog-footer" }, Ve = /* @__PURE__ */ B({
|
|
|
648
648
|
_: 1
|
|
649
649
|
}, 8, ["modelValue", "title"]));
|
|
650
650
|
}
|
|
651
|
-
}), xe = (p,
|
|
651
|
+
}), xe = (p, r) => {
|
|
652
652
|
const d = p.__vccOpts || p;
|
|
653
|
-
for (const [
|
|
654
|
-
d[
|
|
653
|
+
for (const [s, f] of r)
|
|
654
|
+
d[s] = f;
|
|
655
655
|
return d;
|
|
656
|
-
}, De = {},
|
|
656
|
+
}, De = {}, Ue = {
|
|
657
657
|
xmlns: "http://www.w3.org/2000/svg",
|
|
658
658
|
viewBox: "0 0 1024 1024"
|
|
659
659
|
};
|
|
660
|
-
function
|
|
661
|
-
return c(), k("svg",
|
|
660
|
+
function Ee(p, r) {
|
|
661
|
+
return c(), k("svg", Ue, [...r[0] || (r[0] = [
|
|
662
662
|
S("path", {
|
|
663
663
|
fill: "currentColor",
|
|
664
664
|
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"
|
|
665
665
|
}, null, -1)
|
|
666
666
|
])]);
|
|
667
667
|
}
|
|
668
|
-
const Se = /* @__PURE__ */ xe(De, [["render",
|
|
668
|
+
const Se = /* @__PURE__ */ xe(De, [["render", Ee]]), $e = { class: "col relative cc1-form-box" }, Oe = {
|
|
669
669
|
class: "absolute row fit",
|
|
670
670
|
style: { overflow: "hidden" }
|
|
671
|
-
}, Fe = { class: "col column" },
|
|
671
|
+
}, Fe = { class: "col column" }, _e = {
|
|
672
672
|
key: 0,
|
|
673
673
|
class: "relative curd-search"
|
|
674
|
-
},
|
|
674
|
+
}, Ie = { class: "mb-10 flex justify-between items-center" }, Re = {
|
|
675
675
|
class: "flex items-center",
|
|
676
676
|
style: { gap: "10px" }
|
|
677
677
|
}, Te = { key: 0 }, je = { key: 1 }, Le = { key: 2 }, Me = { class: "export-btn" }, ze = {
|
|
@@ -690,39 +690,39 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
690
690
|
default: {}
|
|
691
691
|
}
|
|
692
692
|
},
|
|
693
|
-
setup(p, { expose:
|
|
694
|
-
const d = $.EDialog,
|
|
693
|
+
setup(p, { expose: r }) {
|
|
694
|
+
const d = $.EDialog, s = p, f = z(), m = z(), u = $.isFun, e = Z({
|
|
695
695
|
search: {
|
|
696
696
|
column: {
|
|
697
697
|
list: []
|
|
698
698
|
},
|
|
699
699
|
form: {},
|
|
700
700
|
formDefault: {},
|
|
701
|
-
getPlaceholder: (
|
|
701
|
+
getPlaceholder: (n, i = w.tCurd("placeholderInput")) => n.text?.search?.placeholder === void 0 ? `${i}${n.label}` : n.text?.search?.placeholder,
|
|
702
702
|
getFormData: () => {
|
|
703
|
-
let
|
|
704
|
-
|
|
705
|
-
(typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (
|
|
703
|
+
let n = {};
|
|
704
|
+
s.option.column.forEach((o) => {
|
|
705
|
+
(typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (n[o.key] = e.search.form[o.key]);
|
|
706
706
|
});
|
|
707
|
-
const i =
|
|
708
|
-
return i && (
|
|
707
|
+
const i = s.option.search?.before?.(n);
|
|
708
|
+
return i && (n = i), n;
|
|
709
709
|
},
|
|
710
710
|
reset: () => {
|
|
711
|
-
const
|
|
712
|
-
Object.keys(
|
|
713
|
-
|
|
714
|
-
}), e.search.form = JSONUtil.cp(
|
|
711
|
+
const n = e.search.formDefault;
|
|
712
|
+
Object.keys(n).forEach((i) => {
|
|
713
|
+
s.option.search?.resetMode === "none" ? n[i] = void 0 : n[i] = e.search.formDefault[i];
|
|
714
|
+
}), e.search.form = JSONUtil.cp(n), e.page.num = 1, e.table.getList();
|
|
715
715
|
},
|
|
716
716
|
submit: () => {
|
|
717
717
|
e.page.num = 1, e.table.getList();
|
|
718
718
|
}
|
|
719
719
|
},
|
|
720
720
|
page: {
|
|
721
|
-
size:
|
|
722
|
-
sizeList:
|
|
721
|
+
size: s.option.page?.size || 10,
|
|
722
|
+
sizeList: s.option.page?.sizeList || [10, 20, 50, 100],
|
|
723
723
|
num: 1,
|
|
724
724
|
total: 0,
|
|
725
|
-
layout:
|
|
725
|
+
layout: s.option.page?.layout || "total, sizes, prev, pager, next, jumper"
|
|
726
726
|
},
|
|
727
727
|
table: {
|
|
728
728
|
loading: !1,
|
|
@@ -730,19 +730,19 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
730
730
|
expand: {
|
|
731
731
|
isExpand: !1,
|
|
732
732
|
rowKeys: [],
|
|
733
|
-
change: (
|
|
733
|
+
change: (n, i) => {
|
|
734
734
|
},
|
|
735
735
|
all: () => {
|
|
736
736
|
if (e.table.expand.isExpand)
|
|
737
737
|
e.table.expand.rowKeys = [];
|
|
738
738
|
else {
|
|
739
|
-
const
|
|
739
|
+
const n = (i) => {
|
|
740
740
|
let o = [];
|
|
741
741
|
return i.forEach((t) => {
|
|
742
|
-
o.push(t[
|
|
742
|
+
o.push(t[C.tableRowKey]), t.children && t.children.length > 0 && (o = o.concat(n(t.children)));
|
|
743
743
|
}), o;
|
|
744
744
|
};
|
|
745
|
-
e.table.expand.rowKeys =
|
|
745
|
+
e.table.expand.rowKeys = n(e.table.data);
|
|
746
746
|
}
|
|
747
747
|
e.table.expand.isExpand = !e.table.expand.isExpand;
|
|
748
748
|
}
|
|
@@ -768,15 +768,15 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
768
768
|
},
|
|
769
769
|
getList: async () => {
|
|
770
770
|
e.table.loading = !0;
|
|
771
|
-
const
|
|
771
|
+
const n = s.option.api.list;
|
|
772
772
|
try {
|
|
773
|
-
const i = await
|
|
774
|
-
[
|
|
775
|
-
[
|
|
773
|
+
const i = await n({
|
|
774
|
+
[C.pageField.size]: e.page.size,
|
|
775
|
+
[C.pageField.num]: e.page.num,
|
|
776
776
|
...e.search.getFormData()
|
|
777
|
-
}), o =
|
|
777
|
+
}), o = C.resultField, t = i.data || { [o.list]: i };
|
|
778
778
|
let l = (Array.isArray(t[o.list]), t[o.list]);
|
|
779
|
-
e.table.data =
|
|
779
|
+
e.table.data = s.option.data ? await s.option.data(l) : l, e.page.total = t[o.total] || 0;
|
|
780
780
|
} catch (i) {
|
|
781
781
|
console.error(i);
|
|
782
782
|
} finally {
|
|
@@ -785,19 +785,19 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
785
785
|
},
|
|
786
786
|
selection: {
|
|
787
787
|
list: [],
|
|
788
|
-
change: (
|
|
789
|
-
e.table.selection.list =
|
|
788
|
+
change: (n) => {
|
|
789
|
+
e.table.selection.list = n;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
},
|
|
793
793
|
export: {
|
|
794
794
|
run: {
|
|
795
|
-
start: async (
|
|
796
|
-
let i = await e.export.run[
|
|
795
|
+
start: async (n) => {
|
|
796
|
+
let i = await e.export.run[n](), o = s.option.column;
|
|
797
797
|
const t = JSONUtil.cp({
|
|
798
798
|
data: i,
|
|
799
799
|
columns: o
|
|
800
|
-
}), l =
|
|
800
|
+
}), l = s.option.tools?.export || {};
|
|
801
801
|
l.before && l.before(t), ke.exportToExcel(t.data, t.columns, l.fileName);
|
|
802
802
|
},
|
|
803
803
|
select: () => {
|
|
@@ -813,25 +813,25 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
813
813
|
all: async () => {
|
|
814
814
|
e.export.loading = !0;
|
|
815
815
|
try {
|
|
816
|
-
if (
|
|
817
|
-
await
|
|
816
|
+
if (s.option.tools?.export?.all) {
|
|
817
|
+
await s.option.tools?.export?.all();
|
|
818
818
|
return;
|
|
819
819
|
}
|
|
820
|
-
const
|
|
821
|
-
[
|
|
822
|
-
[
|
|
820
|
+
const n = s.option.api.list, i = await n({
|
|
821
|
+
[C.pageField.size]: 999999,
|
|
822
|
+
[C.pageField.num]: 1
|
|
823
823
|
});
|
|
824
|
-
return (i.data || { [
|
|
825
|
-
} catch (
|
|
826
|
-
console.error(
|
|
824
|
+
return (i.data || { [C.resultField.list]: i })[C.resultField.list];
|
|
825
|
+
} catch (n) {
|
|
826
|
+
console.error(n);
|
|
827
827
|
} finally {
|
|
828
828
|
e.export.loading = !1;
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
831
|
},
|
|
832
832
|
loading: !1,
|
|
833
|
-
click: (
|
|
834
|
-
e.export.loading || e.export.run.start(
|
|
833
|
+
click: (n) => {
|
|
834
|
+
e.export.loading || e.export.run.start(n);
|
|
835
835
|
}
|
|
836
836
|
},
|
|
837
837
|
update: {
|
|
@@ -844,7 +844,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
844
844
|
form: {},
|
|
845
845
|
formDefault: {},
|
|
846
846
|
formColumn: [],
|
|
847
|
-
getDisabled: (
|
|
847
|
+
getDisabled: (n) => n.disabled?.[e.update.type === d.Insert ? "create" : "update"],
|
|
848
848
|
edit: {
|
|
849
849
|
/**
|
|
850
850
|
* 编辑原数据
|
|
@@ -853,22 +853,22 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
853
853
|
/**
|
|
854
854
|
* 将form填入数据和data比对差异数据返回
|
|
855
855
|
*/
|
|
856
|
-
getApiData: (
|
|
857
|
-
if (
|
|
858
|
-
return
|
|
856
|
+
getApiData: (n) => {
|
|
857
|
+
if (s.option.form?.editAll)
|
|
858
|
+
return n;
|
|
859
859
|
let i = {
|
|
860
|
-
[
|
|
860
|
+
[C.tableRowKey]: e.update.edit.data[C.tableRowKey]
|
|
861
861
|
};
|
|
862
862
|
return Object.keys(e.update.edit.data).forEach((o) => {
|
|
863
|
-
|
|
863
|
+
n[o] !== e.update.edit.data[o] && (i[o] = n[o]);
|
|
864
864
|
}), i;
|
|
865
865
|
}
|
|
866
866
|
},
|
|
867
|
-
open: (
|
|
867
|
+
open: (n, i) => {
|
|
868
868
|
e.update.showContent || FunUtil.throttle(async () => {
|
|
869
|
-
e.update.type =
|
|
870
|
-
const o =
|
|
871
|
-
e.update.edit.data = i, e.update.title = o ? w.tCurd("add") : w.tCurd("edit"), e.update.form = JSONUtil.cp(o ? e.update.formDefault : i), await
|
|
869
|
+
e.update.type = n;
|
|
870
|
+
const o = n === d.Insert;
|
|
871
|
+
e.update.edit.data = i, e.update.title = o ? w.tCurd("add") : w.tCurd("edit"), e.update.form = JSONUtil.cp(o ? e.update.formDefault : i), await s.option.form?.openBefore?.(i, e.update), e.update.show = !0, e.update.showContent = !0, s.option.form?.openAfter?.(i, e.update);
|
|
872
872
|
});
|
|
873
873
|
},
|
|
874
874
|
submit: () => {
|
|
@@ -876,19 +876,19 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
876
876
|
await m.value?.validate(async (o, t) => new Promise((l, b) => {
|
|
877
877
|
o || ($.fail(w.tCurd("checkFormData")), b(!1)), l();
|
|
878
878
|
})), e.update.loading = !0;
|
|
879
|
-
const
|
|
879
|
+
const n = e.update.type === d.Insert ? s.option.api.create : s.option.api.update;
|
|
880
880
|
let i = JSONUtil.cp(e.update.form);
|
|
881
|
-
delete i.children, await
|
|
881
|
+
delete i.children, await s.option.form?.submitBefore?.(i, e.update), Object.keys(i).forEach((o) => {
|
|
882
882
|
if (typeof i[o] == "string" && i[o].indexOf("T") > -1) {
|
|
883
883
|
const t = new Date(i[o]).getTime();
|
|
884
884
|
!isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (i[o] = t);
|
|
885
885
|
}
|
|
886
886
|
});
|
|
887
887
|
try {
|
|
888
|
-
if (!
|
|
889
|
-
await
|
|
888
|
+
if (!n) return;
|
|
889
|
+
await n({
|
|
890
890
|
...i
|
|
891
|
-
}), e.update.close(), await e.table.getList(),
|
|
891
|
+
}), e.update.close(), await e.table.getList(), s.option.form?.submitAfter?.(i, e.update);
|
|
892
892
|
} catch (o) {
|
|
893
893
|
console.error(o);
|
|
894
894
|
} finally {
|
|
@@ -910,21 +910,21 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
910
910
|
close: () => {
|
|
911
911
|
e.remove.show = !1;
|
|
912
912
|
},
|
|
913
|
-
open: (
|
|
914
|
-
if (
|
|
913
|
+
open: (n) => {
|
|
914
|
+
if (n.length === 0) {
|
|
915
915
|
$.fail(w.tCurd("selectDataToDelete"));
|
|
916
916
|
return;
|
|
917
917
|
}
|
|
918
|
-
e.remove.items =
|
|
918
|
+
e.remove.items = n, e.remove.show = !0;
|
|
919
919
|
},
|
|
920
920
|
submit: () => {
|
|
921
921
|
FunUtil.throttle(async () => {
|
|
922
922
|
e.remove.loading = !0;
|
|
923
|
-
const
|
|
923
|
+
const n = s.option.api.delete;
|
|
924
924
|
try {
|
|
925
|
-
if (!
|
|
926
|
-
await
|
|
927
|
-
[
|
|
925
|
+
if (!n) return;
|
|
926
|
+
await n({
|
|
927
|
+
[C.tableRowKey]: e.remove.items.map((i) => i[C.tableRowKey]),
|
|
928
928
|
items: e.remove.items
|
|
929
929
|
}), $.success(w.tCurd("operationSuccess")), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
|
|
930
930
|
} catch (i) {
|
|
@@ -953,11 +953,11 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
953
953
|
},
|
|
954
954
|
table: {
|
|
955
955
|
headerCellClassName: "table-header",
|
|
956
|
-
rowKey:
|
|
956
|
+
rowKey: C.tableRowKey,
|
|
957
957
|
emptyText: w.tCurd("noData"),
|
|
958
958
|
highlightCurrentRow: !0
|
|
959
959
|
}
|
|
960
|
-
}, o =
|
|
960
|
+
}, o = s.option;
|
|
961
961
|
Object.keys(i).forEach((t) => {
|
|
962
962
|
o[t] = ObjectUtil.deepMerge(i[t], o[t] || {});
|
|
963
963
|
});
|
|
@@ -968,7 +968,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
968
968
|
* @returns
|
|
969
969
|
*/
|
|
970
970
|
initColumnOptions: () => {
|
|
971
|
-
const
|
|
971
|
+
const n = s.option, i = (o) => {
|
|
972
972
|
const l = {
|
|
973
973
|
options: {
|
|
974
974
|
switch: {
|
|
@@ -977,17 +977,17 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
977
977
|
inactiveValue: !1,
|
|
978
978
|
inactiveLabel: w.tCurd("switchOff"),
|
|
979
979
|
tableBeforeChange: async (I, y) => {
|
|
980
|
-
const
|
|
980
|
+
const R = o.options?.switch;
|
|
981
981
|
try {
|
|
982
982
|
await f.value?.open({
|
|
983
983
|
title: w.tCurd("confirmModify"),
|
|
984
984
|
content: w.tCurd("confirmSwitchMessage")
|
|
985
985
|
}), e.table.loading = !0;
|
|
986
986
|
try {
|
|
987
|
-
return
|
|
988
|
-
[
|
|
989
|
-
[I]: y[I] ===
|
|
990
|
-
final(L, P,
|
|
987
|
+
return s.option.api.update ? (await s.option.api.update({
|
|
988
|
+
[C.tableRowKey]: y[C.tableRowKey],
|
|
989
|
+
[I]: y[I] === R.activeValue ? R.inactiveValue : R.activeValue,
|
|
990
|
+
final(L, P, te) {
|
|
991
991
|
e.table.loading = !1;
|
|
992
992
|
}
|
|
993
993
|
}), e.table.loading = !1, $.success(w.tCurd("operationSuccess")), e.table.getList(), !0) : void 0;
|
|
@@ -1002,8 +1002,8 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1002
1002
|
}
|
|
1003
1003
|
},
|
|
1004
1004
|
treeSelect: {
|
|
1005
|
-
rowKey:
|
|
1006
|
-
nodeKey:
|
|
1005
|
+
rowKey: C.tableRowKey,
|
|
1006
|
+
nodeKey: C.tableRowKey,
|
|
1007
1007
|
multiple: !0,
|
|
1008
1008
|
renderAfterExpand: !1,
|
|
1009
1009
|
showCheckbox: !0,
|
|
@@ -1035,60 +1035,60 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1035
1035
|
b[I] = ObjectUtil.deepMerge(l[I], b[I] || {});
|
|
1036
1036
|
});
|
|
1037
1037
|
};
|
|
1038
|
-
|
|
1038
|
+
n.column.forEach(i), n.table?.column?.forEach(i);
|
|
1039
1039
|
},
|
|
1040
1040
|
initColumnForm: () => {
|
|
1041
|
-
const
|
|
1041
|
+
const n = s.option;
|
|
1042
1042
|
e.update.formColumn = [], e.table.column.show = {
|
|
1043
1043
|
list: [],
|
|
1044
1044
|
listSource: []
|
|
1045
1045
|
};
|
|
1046
|
-
const i = [], o =
|
|
1046
|
+
const i = [], o = s.option.form?.maxSpan || 12, t = s.option.form?.defaultSpan || o / 2;
|
|
1047
1047
|
let l = [];
|
|
1048
1048
|
const b = (y) => {
|
|
1049
1049
|
if (e.update.formDefault[y.key] = y.value, y.table.table && (y.show.table && e.table.column.show.list.push(y.key), y.table.table && e.table.column.show.listSource.push(y.key)), y.isForm) {
|
|
1050
1050
|
y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
|
|
1051
|
-
let
|
|
1051
|
+
let R = y.form.span, L = l.reduce((te, se) => te + se.span, R);
|
|
1052
1052
|
const P = l.length;
|
|
1053
|
-
l.push({ item: y, span:
|
|
1053
|
+
l.push({ item: y, span: R }), (P === 1 && l[0].span === 0 || L >= o || R === 0 && P > 1) && (i.push(l), l = []), y.rules && (e.update.rules[y.key] = y.rules);
|
|
1054
1054
|
}
|
|
1055
1055
|
};
|
|
1056
|
-
|
|
1056
|
+
n.column.forEach((y) => {
|
|
1057
1057
|
y.isForm = !0, b(y);
|
|
1058
|
-
}),
|
|
1058
|
+
}), s.option.table?.column?.forEach((y) => {
|
|
1059
1059
|
y.isForm = !1, b(y);
|
|
1060
|
-
}), e.search.column.list =
|
|
1061
|
-
const I =
|
|
1060
|
+
}), e.search.column.list = n.column.concat(n.table?.column || []), e.table.column.list = e.search.column.list.filter((y) => y.table?.table), e.search.column.list.sort((y, R) => y.sort?.search - R.sort?.search), e.table.column.list.sort((y, R) => y.sort?.table - R.sort?.table), l.length > 0 && i.push(l), e.update.formColumn = i;
|
|
1061
|
+
const I = s.option.search?.formDefault;
|
|
1062
1062
|
I && Object.keys(I).forEach((y) => {
|
|
1063
1063
|
e.search.formDefault[y] = I[y];
|
|
1064
|
-
}),
|
|
1064
|
+
}), n.column.forEach((y) => {
|
|
1065
1065
|
y.show?.search || (e.search.formDefault[y.key] = void 0);
|
|
1066
1066
|
}), e.search.form = JSONUtil.cp(e.search.formDefault);
|
|
1067
1067
|
}
|
|
1068
1068
|
});
|
|
1069
|
-
return e.init(),
|
|
1069
|
+
return e.init(), le(() => {
|
|
1070
1070
|
e.table.getList();
|
|
1071
|
-
}),
|
|
1071
|
+
}), r({
|
|
1072
1072
|
conf: e
|
|
1073
|
-
}), (
|
|
1073
|
+
}), (n, i) => {
|
|
1074
1074
|
const o = ie("loading");
|
|
1075
1075
|
return c(), k("div", $e, [
|
|
1076
1076
|
S("div", Oe, [
|
|
1077
|
-
x(
|
|
1077
|
+
x(n.$slots, "box-left"),
|
|
1078
1078
|
S("div", Fe, [
|
|
1079
|
-
p.option.search?.show !== !1 ? (c(), k("div",
|
|
1080
|
-
|
|
1079
|
+
p.option.search?.show !== !1 ? (c(), k("div", _e, [
|
|
1080
|
+
V(a(G), {
|
|
1081
1081
|
model: e.search.form,
|
|
1082
1082
|
inline: ""
|
|
1083
1083
|
}, {
|
|
1084
1084
|
default: h(() => [
|
|
1085
|
-
x(
|
|
1085
|
+
x(n.$slots, "search-start", {
|
|
1086
1086
|
row: e.search.form
|
|
1087
1087
|
}),
|
|
1088
1088
|
(c(!0), k(O, null, T(e.search.column.list, (t) => (c(), k(O, {
|
|
1089
1089
|
key: t.key
|
|
1090
1090
|
}, [
|
|
1091
|
-
(typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (c(), g(
|
|
1091
|
+
(typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (c(), g(a(N), {
|
|
1092
1092
|
key: 0,
|
|
1093
1093
|
label: typeof t.text?.search?.label == "string" ? t.text?.search?.label : t.label,
|
|
1094
1094
|
class: M({
|
|
@@ -1096,159 +1096,165 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1096
1096
|
})
|
|
1097
1097
|
}, {
|
|
1098
1098
|
default: h(() => [
|
|
1099
|
-
x(
|
|
1099
|
+
x(n.$slots, "search-" + t.key, {
|
|
1100
1100
|
row: e.search.form
|
|
1101
1101
|
}, () => [
|
|
1102
|
-
t.type === "input" ? (c(), g(
|
|
1102
|
+
t.type === "input" ? (c(), g(a(q), {
|
|
1103
1103
|
key: 0,
|
|
1104
1104
|
modelValue: e.search.form[t.key],
|
|
1105
1105
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l,
|
|
1106
1106
|
placeholder: e.search.getPlaceholder(t),
|
|
1107
1107
|
clearable: "",
|
|
1108
1108
|
disabled: t.disabled?.search
|
|
1109
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (c(), g(
|
|
1109
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (c(), g(a(A), {
|
|
1110
1110
|
key: 1,
|
|
1111
1111
|
modelValue: e.search.form[t.key],
|
|
1112
1112
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l,
|
|
1113
|
-
placeholder: e.search.getPlaceholder(t,
|
|
1113
|
+
placeholder: e.search.getPlaceholder(t, a(w).tCurd("placeholderSelect")),
|
|
1114
1114
|
clearable: "",
|
|
1115
1115
|
disabled: t.disabled?.search
|
|
1116
1116
|
}, {
|
|
1117
1117
|
default: h(() => [
|
|
1118
|
-
(c(), g(
|
|
1118
|
+
(c(), g(a(K), {
|
|
1119
1119
|
key: t.options?.switch?.activeValue,
|
|
1120
1120
|
label: t.options?.switch?.activeLabel,
|
|
1121
1121
|
value: t.options?.switch?.activeValue
|
|
1122
1122
|
}, null, 8, ["label", "value"])),
|
|
1123
|
-
(c(), g(
|
|
1123
|
+
(c(), g(a(K), {
|
|
1124
1124
|
key: t.options?.switch?.inactiveValue,
|
|
1125
1125
|
label: t.options?.switch?.inactiveLabel,
|
|
1126
1126
|
value: t.options?.switch?.inactiveValue
|
|
1127
1127
|
}, null, 8, ["label", "value"]))
|
|
1128
1128
|
]),
|
|
1129
1129
|
_: 2
|
|
1130
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (c(), g(
|
|
1130
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (c(), g(a(A), {
|
|
1131
1131
|
key: 2,
|
|
1132
1132
|
modelValue: e.search.form[t.key],
|
|
1133
1133
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l,
|
|
1134
|
-
placeholder: e.search.getPlaceholder(t,
|
|
1134
|
+
placeholder: e.search.getPlaceholder(t, a(w).tCurd("placeholderSelect")),
|
|
1135
1135
|
clearable: "",
|
|
1136
1136
|
disabled: t.disabled?.search
|
|
1137
1137
|
}, {
|
|
1138
1138
|
default: h(() => [
|
|
1139
|
-
(c(!0), k(O, null, T(t.options?.select?.data, (l) => (c(), g(
|
|
1139
|
+
(c(!0), k(O, null, T(t.options?.select?.data, (l) => (c(), g(a(K), {
|
|
1140
1140
|
key: l.value,
|
|
1141
1141
|
label: l.label,
|
|
1142
1142
|
value: l.value
|
|
1143
1143
|
}, null, 8, ["label", "value"]))), 128))
|
|
1144
1144
|
]),
|
|
1145
1145
|
_: 2
|
|
1146
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "datetime" ? (c(), g(
|
|
1146
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "datetime" ? (c(), g(a(Q), U({
|
|
1147
1147
|
key: 3,
|
|
1148
1148
|
modelValue: e.search.form[t.key],
|
|
1149
1149
|
"onUpdate:modelValue": (l) => e.search.form[t.key] = l
|
|
1150
|
-
}, { ref_for: !0 }, t.options?.datetime,
|
|
1150
|
+
}, { ref_for: !0 }, t.options?.datetime, _(t.options?.datetime?.on || {}), {
|
|
1151
1151
|
disabled: t.disabled?.search
|
|
1152
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C(
|
|
1152
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a(C).customComponent[t.type] ? (c(), g(H(a(C).customComponent[t.type]), U({
|
|
1153
|
+
key: 4,
|
|
1154
|
+
modelValue: e.search.form[t.key],
|
|
1155
|
+
"onUpdate:modelValue": (l) => e.search.form[t.key] = l
|
|
1156
|
+
}, { ref_for: !0 }, t.options?.[t.type], _(t.options?.[t.type]?.on || {}), {
|
|
1157
|
+
disabled: t.disabled?.search
|
|
1158
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : v("", !0)
|
|
1153
1159
|
])
|
|
1154
1160
|
]),
|
|
1155
1161
|
_: 2
|
|
1156
|
-
}, 1032, ["label", "class"])) :
|
|
1162
|
+
}, 1032, ["label", "class"])) : v("", !0)
|
|
1157
1163
|
], 64))), 128)),
|
|
1158
|
-
x(
|
|
1164
|
+
x(n.$slots, "search-center", {
|
|
1159
1165
|
row: e.search.form
|
|
1160
1166
|
}),
|
|
1161
|
-
|
|
1167
|
+
V(a(N), null, {
|
|
1162
1168
|
default: h(() => [
|
|
1163
|
-
p.option.tools?.search ? (c(), g(
|
|
1169
|
+
p.option.tools?.search ? (c(), g(a(F), {
|
|
1164
1170
|
key: 0,
|
|
1165
1171
|
type: "primary",
|
|
1166
1172
|
onClick: e.search.submit
|
|
1167
1173
|
}, {
|
|
1168
1174
|
default: h(() => [
|
|
1169
|
-
D(E(
|
|
1175
|
+
D(E(a(w).tCurd("search")), 1)
|
|
1170
1176
|
]),
|
|
1171
1177
|
_: 1
|
|
1172
|
-
}, 8, ["onClick"])) :
|
|
1173
|
-
p.option.tools?.reset ? (c(), g(
|
|
1178
|
+
}, 8, ["onClick"])) : v("", !0),
|
|
1179
|
+
p.option.tools?.reset ? (c(), g(a(F), {
|
|
1174
1180
|
key: 1,
|
|
1175
1181
|
onClick: e.search.reset
|
|
1176
1182
|
}, {
|
|
1177
1183
|
default: h(() => [
|
|
1178
|
-
D(E(
|
|
1184
|
+
D(E(a(w).tCurd("reset")), 1)
|
|
1179
1185
|
]),
|
|
1180
1186
|
_: 1
|
|
1181
|
-
}, 8, ["onClick"])) :
|
|
1187
|
+
}, 8, ["onClick"])) : v("", !0)
|
|
1182
1188
|
]),
|
|
1183
1189
|
_: 1
|
|
1184
1190
|
}),
|
|
1185
|
-
x(
|
|
1191
|
+
x(n.$slots, "search-end", {
|
|
1186
1192
|
row: e.search.form
|
|
1187
1193
|
})
|
|
1188
1194
|
]),
|
|
1189
1195
|
_: 3
|
|
1190
1196
|
}, 8, ["model"])
|
|
1191
|
-
])) :
|
|
1192
|
-
S("div",
|
|
1197
|
+
])) : v("", !0),
|
|
1198
|
+
S("div", Ie, [
|
|
1193
1199
|
S("div", Re, [
|
|
1194
|
-
|
|
1195
|
-
|
|
1200
|
+
a(u)(p.option.tools?.add) ? (c(), k("div", Te, [
|
|
1201
|
+
V(a(F), {
|
|
1196
1202
|
type: "primary",
|
|
1197
|
-
onClick: i[0] || (i[0] = (t) => e.update.open(
|
|
1203
|
+
onClick: i[0] || (i[0] = (t) => e.update.open(a(d).Insert))
|
|
1198
1204
|
}, {
|
|
1199
1205
|
default: h(() => [
|
|
1200
|
-
D(E(
|
|
1206
|
+
D(E(a(w).tCurd("add")), 1)
|
|
1201
1207
|
]),
|
|
1202
1208
|
_: 1
|
|
1203
1209
|
})
|
|
1204
|
-
])) :
|
|
1205
|
-
p.option.table?.selectable &&
|
|
1206
|
-
|
|
1210
|
+
])) : v("", !0),
|
|
1211
|
+
p.option.table?.selectable && a(u)(p.option.tools?.delete) ? (c(), k("div", je, [
|
|
1212
|
+
V(a(F), {
|
|
1207
1213
|
type: "danger",
|
|
1208
1214
|
onClick: i[1] || (i[1] = (t) => e.remove.open(e.table.selection.list))
|
|
1209
1215
|
}, {
|
|
1210
1216
|
default: h(() => [
|
|
1211
|
-
D(E(
|
|
1217
|
+
D(E(a(w).tCurd("delete")), 1)
|
|
1212
1218
|
]),
|
|
1213
1219
|
_: 1
|
|
1214
1220
|
})
|
|
1215
|
-
])) :
|
|
1221
|
+
])) : v("", !0),
|
|
1216
1222
|
p.option.tools?.expand ? (c(), k("div", Le, [
|
|
1217
|
-
|
|
1223
|
+
V(a(F), {
|
|
1218
1224
|
type: "warning",
|
|
1219
1225
|
onClick: i[2] || (i[2] = (t) => e.table.expand.all())
|
|
1220
1226
|
}, {
|
|
1221
1227
|
default: h(() => [
|
|
1222
|
-
D(E(
|
|
1228
|
+
D(E(a(w).tCurd("expandCollapse")), 1)
|
|
1223
1229
|
]),
|
|
1224
1230
|
_: 1
|
|
1225
1231
|
})
|
|
1226
|
-
])) :
|
|
1227
|
-
p.option.tools?.export?.show ? (c(), g(
|
|
1232
|
+
])) : v("", !0),
|
|
1233
|
+
p.option.tools?.export?.show ? (c(), g(a(pe), {
|
|
1228
1234
|
key: 3,
|
|
1229
1235
|
onCommand: e.export.click
|
|
1230
1236
|
}, {
|
|
1231
1237
|
dropdown: h(() => [
|
|
1232
|
-
|
|
1238
|
+
V(a(fe), null, {
|
|
1233
1239
|
default: h(() => [
|
|
1234
|
-
p.option.table?.selectable ? (c(), g(
|
|
1240
|
+
p.option.table?.selectable ? (c(), g(a(J), {
|
|
1235
1241
|
key: 0,
|
|
1236
1242
|
command: "select"
|
|
1237
1243
|
}, {
|
|
1238
1244
|
default: h(() => [
|
|
1239
|
-
D(E(
|
|
1245
|
+
D(E(a(w).tCurd("exportSelect")), 1)
|
|
1240
1246
|
]),
|
|
1241
1247
|
_: 1
|
|
1242
|
-
})) :
|
|
1243
|
-
|
|
1248
|
+
})) : v("", !0),
|
|
1249
|
+
V(a(J), { command: "page" }, {
|
|
1244
1250
|
default: h(() => [
|
|
1245
|
-
D(E(
|
|
1251
|
+
D(E(a(w).tCurd("exportPage")), 1)
|
|
1246
1252
|
]),
|
|
1247
1253
|
_: 1
|
|
1248
1254
|
}),
|
|
1249
|
-
|
|
1255
|
+
V(a(J), { command: "all" }, {
|
|
1250
1256
|
default: h(() => [
|
|
1251
|
-
D(E(
|
|
1257
|
+
D(E(a(w).tCurd("exportAll")), 1)
|
|
1252
1258
|
]),
|
|
1253
1259
|
_: 1
|
|
1254
1260
|
})
|
|
@@ -1258,36 +1264,36 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1258
1264
|
]),
|
|
1259
1265
|
default: h(() => [
|
|
1260
1266
|
S("div", Me, [
|
|
1261
|
-
|
|
1267
|
+
V(a(F), {
|
|
1262
1268
|
type: "warning",
|
|
1263
1269
|
loading: e.export.loading
|
|
1264
1270
|
}, {
|
|
1265
1271
|
default: h(() => [
|
|
1266
|
-
D(E(
|
|
1272
|
+
D(E(a(w).tCurd("export")), 1)
|
|
1267
1273
|
]),
|
|
1268
1274
|
_: 1
|
|
1269
1275
|
}, 8, ["loading"])
|
|
1270
1276
|
])
|
|
1271
1277
|
]),
|
|
1272
1278
|
_: 1
|
|
1273
|
-
}, 8, ["onCommand"])) :
|
|
1274
|
-
x(
|
|
1279
|
+
}, 8, ["onCommand"])) : v("", !0),
|
|
1280
|
+
x(n.$slots, "tools-left")
|
|
1275
1281
|
]),
|
|
1276
1282
|
S("div", ze, [
|
|
1277
|
-
x(
|
|
1283
|
+
x(n.$slots, "tools-right"),
|
|
1278
1284
|
p.option.tools?.refresh === void 0 || p.option.tools?.refresh ? (c(), k("div", {
|
|
1279
1285
|
key: 0,
|
|
1280
1286
|
class: "refresh-btn",
|
|
1281
1287
|
onClick: i[3] || (i[3] = //@ts-ignore
|
|
1282
1288
|
(...t) => e.table.getList && e.table.getList(...t))
|
|
1283
1289
|
}, [
|
|
1284
|
-
|
|
1285
|
-
])) :
|
|
1290
|
+
V(Se)
|
|
1291
|
+
])) : v("", !0)
|
|
1286
1292
|
])
|
|
1287
1293
|
]),
|
|
1288
1294
|
S("div", Pe, [
|
|
1289
1295
|
S("div", Ke, [
|
|
1290
|
-
de((c(), g(
|
|
1296
|
+
de((c(), g(a(me), U({
|
|
1291
1297
|
data: e.table.data
|
|
1292
1298
|
}, p.option.table, {
|
|
1293
1299
|
onSelectionChange: e.table.selection.change,
|
|
@@ -1295,26 +1301,26 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1295
1301
|
onExpandChange: e.table.expand.change
|
|
1296
1302
|
}), {
|
|
1297
1303
|
default: h(() => [
|
|
1298
|
-
p.option.table?.selectable && (
|
|
1304
|
+
p.option.table?.selectable && (a(u)(p.option.tools?.delete) || p.option.tools?.export?.show) ? (c(), g(a(W), {
|
|
1299
1305
|
key: 0,
|
|
1300
1306
|
type: "selection",
|
|
1301
1307
|
selectable: typeof p.option.table?.selectable == "function" ? p.option.table?.selectable : void 0,
|
|
1302
1308
|
width: "55"
|
|
1303
|
-
}, null, 8, ["selectable"])) :
|
|
1309
|
+
}, null, 8, ["selectable"])) : v("", !0),
|
|
1304
1310
|
(c(!0), k(O, null, T(e.table.column.list, (t) => (c(), k(O, {
|
|
1305
1311
|
key: t.key
|
|
1306
1312
|
}, [
|
|
1307
|
-
e.table.column.show.list.includes(t.key) ? (c(), g(
|
|
1313
|
+
e.table.column.show.list.includes(t.key) ? (c(), g(a(W), U({
|
|
1308
1314
|
key: 0,
|
|
1309
1315
|
prop: t.key,
|
|
1310
1316
|
label: t.label
|
|
1311
1317
|
}, { ref_for: !0 }, t.table), {
|
|
1312
1318
|
default: h(({ row: l }) => [
|
|
1313
|
-
x(
|
|
1319
|
+
x(n.$slots, "table-" + t.key, {
|
|
1314
1320
|
row: l,
|
|
1315
1321
|
item: t
|
|
1316
1322
|
}, () => [
|
|
1317
|
-
t.type === "switch" ? (c(), g(
|
|
1323
|
+
t.type === "switch" ? (c(), g(a(X), U({
|
|
1318
1324
|
key: 0,
|
|
1319
1325
|
modelValue: l[t.key],
|
|
1320
1326
|
"onUpdate:modelValue": (b) => l[t.key] = b,
|
|
@@ -1325,54 +1331,54 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1325
1331
|
])
|
|
1326
1332
|
]),
|
|
1327
1333
|
_: 2
|
|
1328
|
-
}, 1040, ["prop", "label"])) :
|
|
1334
|
+
}, 1040, ["prop", "label"])) : v("", !0)
|
|
1329
1335
|
], 64))), 128)),
|
|
1330
|
-
|
|
1336
|
+
a(u)(p.option.tools?.add) || a(u)(p.option.tools?.update) || a(u)(p.option.tools?.delete) || n.$slots["table-op-left"] || n.$slots["table-op-right"] ? (c(), g(a(W), {
|
|
1331
1337
|
key: 1,
|
|
1332
|
-
label:
|
|
1338
|
+
label: a(w).tCurd("operation"),
|
|
1333
1339
|
width: "180",
|
|
1334
1340
|
align: "center",
|
|
1335
1341
|
fixed: "right"
|
|
1336
1342
|
}, {
|
|
1337
1343
|
default: h(({ row: t }) => [
|
|
1338
|
-
x(
|
|
1339
|
-
|
|
1344
|
+
x(n.$slots, "table-op-left", { row: t }),
|
|
1345
|
+
a(u)(p.option.tools?.add, t) ? (c(), g(a(F), {
|
|
1340
1346
|
key: 0,
|
|
1341
1347
|
link: "",
|
|
1342
1348
|
type: "primary",
|
|
1343
|
-
onClick: (l) => e.update.open(
|
|
1349
|
+
onClick: (l) => e.update.open(a(d).Insert, t)
|
|
1344
1350
|
}, {
|
|
1345
1351
|
default: h(() => [
|
|
1346
|
-
D(E(
|
|
1352
|
+
D(E(a(w).tCurd("add")), 1)
|
|
1347
1353
|
]),
|
|
1348
1354
|
_: 1
|
|
1349
|
-
}, 8, ["onClick"])) :
|
|
1350
|
-
|
|
1355
|
+
}, 8, ["onClick"])) : v("", !0),
|
|
1356
|
+
a(u)(p.option.tools?.update, t) ? (c(), g(a(F), {
|
|
1351
1357
|
key: 1,
|
|
1352
1358
|
link: "",
|
|
1353
1359
|
type: "warning",
|
|
1354
|
-
onClick: (l) => e.update.open(
|
|
1360
|
+
onClick: (l) => e.update.open(a(d).Update, t)
|
|
1355
1361
|
}, {
|
|
1356
1362
|
default: h(() => [
|
|
1357
|
-
D(E(
|
|
1363
|
+
D(E(a(w).tCurd("edit")), 1)
|
|
1358
1364
|
]),
|
|
1359
1365
|
_: 1
|
|
1360
|
-
}, 8, ["onClick"])) :
|
|
1361
|
-
|
|
1366
|
+
}, 8, ["onClick"])) : v("", !0),
|
|
1367
|
+
a(u)(p.option.tools?.delete, t) ? (c(), g(a(F), {
|
|
1362
1368
|
key: 2,
|
|
1363
1369
|
link: "",
|
|
1364
1370
|
type: "danger",
|
|
1365
1371
|
onClick: (l) => e.remove.open([t])
|
|
1366
1372
|
}, {
|
|
1367
1373
|
default: h(() => [
|
|
1368
|
-
D(E(
|
|
1374
|
+
D(E(a(w).tCurd("delete")), 1)
|
|
1369
1375
|
]),
|
|
1370
1376
|
_: 1
|
|
1371
|
-
}, 8, ["onClick"])) :
|
|
1372
|
-
x(
|
|
1377
|
+
}, 8, ["onClick"])) : v("", !0),
|
|
1378
|
+
x(n.$slots, "table-op-right", { row: t })
|
|
1373
1379
|
]),
|
|
1374
1380
|
_: 3
|
|
1375
|
-
}, 8, ["label"])) :
|
|
1381
|
+
}, 8, ["label"])) : v("", !0)
|
|
1376
1382
|
]),
|
|
1377
1383
|
_: 3
|
|
1378
1384
|
}, 16, ["data", "onSelectionChange", "expand-row-keys", "onExpandChange"])), [
|
|
@@ -1381,7 +1387,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1381
1387
|
])
|
|
1382
1388
|
]),
|
|
1383
1389
|
S("div", Ne, [
|
|
1384
|
-
|
|
1390
|
+
V(a(he), {
|
|
1385
1391
|
"current-page": e.page.num,
|
|
1386
1392
|
"onUpdate:currentPage": i[4] || (i[4] = (t) => e.page.num = t),
|
|
1387
1393
|
"page-size": e.page.size,
|
|
@@ -1396,9 +1402,9 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1396
1402
|
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total", "onSizeChange", "onCurrentChange"])
|
|
1397
1403
|
])
|
|
1398
1404
|
]),
|
|
1399
|
-
x(
|
|
1405
|
+
x(n.$slots, "box-right")
|
|
1400
1406
|
]),
|
|
1401
|
-
|
|
1407
|
+
V(a(Y), U({
|
|
1402
1408
|
modelValue: e.update.show,
|
|
1403
1409
|
"onUpdate:modelValue": i[6] || (i[6] = (t) => e.update.show = t),
|
|
1404
1410
|
title: e.update.title,
|
|
@@ -1407,28 +1413,28 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1407
1413
|
}, p.option.dialog), {
|
|
1408
1414
|
footer: h(() => [
|
|
1409
1415
|
S("span", Je, [
|
|
1410
|
-
|
|
1416
|
+
V(a(F), {
|
|
1411
1417
|
onClick: e.update.close
|
|
1412
1418
|
}, {
|
|
1413
1419
|
default: h(() => [
|
|
1414
|
-
D(E(
|
|
1420
|
+
D(E(a(w).tCurd("close")), 1)
|
|
1415
1421
|
]),
|
|
1416
1422
|
_: 1
|
|
1417
1423
|
}, 8, ["onClick"]),
|
|
1418
|
-
|
|
1424
|
+
V(a(F), {
|
|
1419
1425
|
type: "primary",
|
|
1420
1426
|
onClick: e.update.submit,
|
|
1421
1427
|
loading: e.update.loading
|
|
1422
1428
|
}, {
|
|
1423
1429
|
default: h(() => [
|
|
1424
|
-
D(E(
|
|
1430
|
+
D(E(a(w).tCurd("submit")), 1)
|
|
1425
1431
|
]),
|
|
1426
1432
|
_: 1
|
|
1427
1433
|
}, 8, ["onClick", "loading"])
|
|
1428
1434
|
])
|
|
1429
1435
|
]),
|
|
1430
1436
|
default: h(() => [
|
|
1431
|
-
|
|
1437
|
+
V(a(G), {
|
|
1432
1438
|
ref_key: "ruleFormRef",
|
|
1433
1439
|
ref: m,
|
|
1434
1440
|
model: e.update.form,
|
|
@@ -1436,7 +1442,7 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1436
1442
|
}, {
|
|
1437
1443
|
default: h(() => [
|
|
1438
1444
|
e.update.showContent ? (c(!0), k(O, { key: 0 }, T(e.update.formColumn, (t) => (c(), k(O, null, [
|
|
1439
|
-
|
|
1445
|
+
a(u)(
|
|
1440
1446
|
t.map((l) => l.item.show?.form),
|
|
1441
1447
|
e.update.form
|
|
1442
1448
|
) ? (c(), k("div", {
|
|
@@ -1445,15 +1451,15 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1445
1451
|
stripe: p.option.form?.stripe === void 0 ? !0 : p.option.form?.stripe
|
|
1446
1452
|
}])
|
|
1447
1453
|
}, [
|
|
1448
|
-
x(
|
|
1454
|
+
x(n.$slots, "form-start", {
|
|
1449
1455
|
row: e.update.form
|
|
1450
1456
|
}),
|
|
1451
1457
|
(c(!0), k(O, null, T(t, (l) => (c(), k(O, null, [
|
|
1452
|
-
|
|
1458
|
+
a(u)(l.item.show?.form, e.update.form) ? (c(), k("div", {
|
|
1453
1459
|
key: 0,
|
|
1454
1460
|
class: M(l.item.form.span > 0 ? `col-${l.item.form.span}` : "col")
|
|
1455
1461
|
}, [
|
|
1456
|
-
|
|
1462
|
+
V(a(N), {
|
|
1457
1463
|
class: M({
|
|
1458
1464
|
"hide-label": typeof l.item.text?.form?.label == "boolean" ? !l.item.text?.form?.label : !1
|
|
1459
1465
|
}),
|
|
@@ -1463,73 +1469,73 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1463
1469
|
}, {
|
|
1464
1470
|
default: h(() => [
|
|
1465
1471
|
S("div", Ae, [
|
|
1466
|
-
x(
|
|
1472
|
+
x(n.$slots, "form-" + l.item.key + "-start", {
|
|
1467
1473
|
row: e.update.form,
|
|
1468
1474
|
item: l.item
|
|
1469
1475
|
}),
|
|
1470
1476
|
S("div", Be, [
|
|
1471
|
-
x(
|
|
1477
|
+
x(n.$slots, "form-" + l.item.key, {
|
|
1472
1478
|
row: e.update.form,
|
|
1473
1479
|
item: l.item
|
|
1474
1480
|
}, () => [
|
|
1475
|
-
l.item.type === "input" ? (c(), g(
|
|
1481
|
+
l.item.type === "input" ? (c(), g(a(q), U({
|
|
1476
1482
|
key: 0,
|
|
1477
1483
|
modelValue: e.update.form[l.item.key],
|
|
1478
1484
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1479
|
-
}, { ref_for: !0 }, l.item.options?.input,
|
|
1485
|
+
}, { ref_for: !0 }, l.item.options?.input, _(l.item.options?.input?.on || {}), {
|
|
1480
1486
|
disabled: e.update.getDisabled(l.item)
|
|
1481
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), g(
|
|
1487
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "switch" ? (c(), g(a(X), U({
|
|
1482
1488
|
key: 1,
|
|
1483
1489
|
modelValue: e.update.form[l.item.key],
|
|
1484
1490
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1485
1491
|
}, { ref_for: !0 }, l.item.options?.switch, {
|
|
1486
1492
|
disabled: e.update.getDisabled(l.item)
|
|
1487
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), g(
|
|
1493
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "select" ? (c(), g(a(A), U({
|
|
1488
1494
|
key: 2,
|
|
1489
1495
|
modelValue: e.update.form[l.item.key],
|
|
1490
1496
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1491
|
-
}, { ref_for: !0 }, l.item.options?.select,
|
|
1497
|
+
}, { ref_for: !0 }, l.item.options?.select, _(l.item.options?.select?.on || {}), {
|
|
1492
1498
|
disabled: e.update.getDisabled(l.item),
|
|
1493
1499
|
style: { width: "100%" }
|
|
1494
1500
|
}), {
|
|
1495
1501
|
default: h(() => [
|
|
1496
|
-
(c(!0), k(O, null, T(l.item.options?.select?.data, (b) => (c(), g(
|
|
1502
|
+
(c(!0), k(O, null, T(l.item.options?.select?.data, (b) => (c(), g(a(K), {
|
|
1497
1503
|
key: b.value,
|
|
1498
1504
|
label: b.label,
|
|
1499
1505
|
value: b.value
|
|
1500
1506
|
}, null, 8, ["label", "value"]))), 128))
|
|
1501
1507
|
]),
|
|
1502
1508
|
_: 2
|
|
1503
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), g(
|
|
1509
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "list" ? (c(), g(ee, U({
|
|
1504
1510
|
key: 3,
|
|
1505
1511
|
row: e.update.form,
|
|
1506
1512
|
field: l.item.key
|
|
1507
|
-
}, { ref_for: !0 }, l.item.options?.list,
|
|
1513
|
+
}, { ref_for: !0 }, l.item.options?.list, _(l.item.options?.list?.on || {}), {
|
|
1508
1514
|
disabled: e.update.getDisabled(l.item),
|
|
1509
1515
|
style: { width: "100%" }
|
|
1510
|
-
}), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), g(
|
|
1516
|
+
}), null, 16, ["row", "field", "disabled"])) : l.item.type === "tree-select" ? (c(), g(a(ae), U({
|
|
1511
1517
|
key: 4,
|
|
1512
1518
|
modelValue: e.update.form[l.item.key],
|
|
1513
1519
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1514
|
-
}, { ref_for: !0 }, l.item.options?.treeSelect,
|
|
1520
|
+
}, { ref_for: !0 }, l.item.options?.treeSelect, _(l.item.options?.treeSelect?.on || {}), {
|
|
1515
1521
|
disabled: e.update.getDisabled(l.item),
|
|
1516
1522
|
style: { width: "100%" }
|
|
1517
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), g(
|
|
1523
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : l.item.type === "datetime" ? (c(), g(a(Q), U({
|
|
1518
1524
|
key: 5,
|
|
1519
1525
|
modelValue: e.update.form[l.item.key],
|
|
1520
1526
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1521
|
-
}, { ref_for: !0 }, l.item.options?.datetime,
|
|
1527
|
+
}, { ref_for: !0 }, l.item.options?.datetime, _(l.item.options?.datetime?.on || {}), {
|
|
1522
1528
|
disabled: e.update.getDisabled(l.item)
|
|
1523
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
1529
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a(C).customComponent[l.item.type] ? (c(), g(H(a(C).customComponent[l.item.type]), U({
|
|
1524
1530
|
key: 6,
|
|
1525
1531
|
modelValue: e.update.form[l.item.key],
|
|
1526
1532
|
"onUpdate:modelValue": (b) => e.update.form[l.item.key] = b
|
|
1527
|
-
}, { ref_for: !0 }, l.item.options?.[l.item.type],
|
|
1533
|
+
}, { ref_for: !0 }, l.item.options?.[l.item.type], _(l.item.options?.[l.item.type]?.on || {}), {
|
|
1528
1534
|
disabled: e.update.getDisabled(l.item)
|
|
1529
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
1535
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : v("", !0)
|
|
1530
1536
|
])
|
|
1531
1537
|
]),
|
|
1532
|
-
x(
|
|
1538
|
+
x(n.$slots, "form-" + l.item.key + "-end", {
|
|
1533
1539
|
row: e.update.form,
|
|
1534
1540
|
item: l.item
|
|
1535
1541
|
})
|
|
@@ -1537,20 +1543,20 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1537
1543
|
]),
|
|
1538
1544
|
_: 2
|
|
1539
1545
|
}, 1032, ["class", "label", "prop", "label-width"])
|
|
1540
|
-
], 2)) :
|
|
1546
|
+
], 2)) : v("", !0)
|
|
1541
1547
|
], 64))), 256)),
|
|
1542
|
-
x(
|
|
1548
|
+
x(n.$slots, "form-end", {
|
|
1543
1549
|
row: e.update.form
|
|
1544
1550
|
})
|
|
1545
|
-
], 2)) :
|
|
1546
|
-
], 64))), 256)) :
|
|
1551
|
+
], 2)) : v("", !0)
|
|
1552
|
+
], 64))), 256)) : v("", !0)
|
|
1547
1553
|
]),
|
|
1548
1554
|
_: 3
|
|
1549
1555
|
}, 8, ["model", "rules"])
|
|
1550
1556
|
]),
|
|
1551
1557
|
_: 3
|
|
1552
1558
|
}, 16, ["modelValue", "title", "before-close"]),
|
|
1553
|
-
|
|
1559
|
+
V(a(Y), {
|
|
1554
1560
|
modelValue: e.remove.show,
|
|
1555
1561
|
"onUpdate:modelValue": i[7] || (i[7] = (t) => e.remove.show = t),
|
|
1556
1562
|
title: e.remove.title,
|
|
@@ -1558,32 +1564,32 @@ const Se = /* @__PURE__ */ xe(De, [["render", Ue]]), $e = { class: "col relative
|
|
|
1558
1564
|
}, {
|
|
1559
1565
|
footer: h(() => [
|
|
1560
1566
|
S("span", We, [
|
|
1561
|
-
|
|
1567
|
+
V(a(F), {
|
|
1562
1568
|
onClick: e.remove.close
|
|
1563
1569
|
}, {
|
|
1564
1570
|
default: h(() => [
|
|
1565
|
-
D(E(
|
|
1571
|
+
D(E(a(w).tCurd("close")), 1)
|
|
1566
1572
|
]),
|
|
1567
1573
|
_: 1
|
|
1568
1574
|
}, 8, ["onClick"]),
|
|
1569
|
-
|
|
1575
|
+
V(a(F), {
|
|
1570
1576
|
type: "danger",
|
|
1571
1577
|
onClick: e.remove.submit,
|
|
1572
1578
|
loading: e.remove.loading
|
|
1573
1579
|
}, {
|
|
1574
1580
|
default: h(() => [
|
|
1575
|
-
D(E(
|
|
1581
|
+
D(E(a(w).tCurd("confirmDelete")), 1)
|
|
1576
1582
|
]),
|
|
1577
1583
|
_: 1
|
|
1578
1584
|
}, 8, ["onClick", "loading"])
|
|
1579
1585
|
])
|
|
1580
1586
|
]),
|
|
1581
1587
|
default: h(() => [
|
|
1582
|
-
S("div", null, E(
|
|
1588
|
+
S("div", null, E(a(w).tCurd("confirmDeleteMessage", e.remove.items.length)), 1)
|
|
1583
1589
|
]),
|
|
1584
1590
|
_: 1
|
|
1585
1591
|
}, 8, ["modelValue", "title"]),
|
|
1586
|
-
|
|
1592
|
+
V(Ve, {
|
|
1587
1593
|
ref_key: "switchConfirmRef",
|
|
1588
1594
|
ref: f
|
|
1589
1595
|
}, null, 512)
|
|
@@ -1595,17 +1601,17 @@ class Qe {
|
|
|
1595
1601
|
/**
|
|
1596
1602
|
* 通过文件远程地址下载文件
|
|
1597
1603
|
*/
|
|
1598
|
-
static async download(
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1604
|
+
static async download(r, d = "download.png") {
|
|
1605
|
+
const s = document.createElement("a");
|
|
1606
|
+
s.style.display = "none", s.href = r, s.setAttribute("download", d), typeof s.download > "u" && s.setAttribute("target", "_blank"), document.body.appendChild(s), s.click(), document.body.removeChild(s), window.URL.revokeObjectURL(r);
|
|
1601
1607
|
}
|
|
1602
1608
|
/**
|
|
1603
1609
|
* 将json对象或者json数组导出为json文件保存
|
|
1604
1610
|
* @param data
|
|
1605
1611
|
* @param name
|
|
1606
1612
|
*/
|
|
1607
|
-
static exportJSONFile = (
|
|
1608
|
-
const
|
|
1613
|
+
static exportJSONFile = (r, d) => {
|
|
1614
|
+
const s = new Blob([JSON.stringify(r)], { type: "application/json" }), f = URL.createObjectURL(s), m = document.createElement("a");
|
|
1609
1615
|
m.href = f, m.download = `${d || "config"}.json`, m.click();
|
|
1610
1616
|
};
|
|
1611
1617
|
/**
|
|
@@ -1613,31 +1619,31 @@ class Qe {
|
|
|
1613
1619
|
* @param param
|
|
1614
1620
|
* @returns
|
|
1615
1621
|
*/
|
|
1616
|
-
static importFile = async (
|
|
1622
|
+
static importFile = async (r) => new Promise((d, s) => {
|
|
1617
1623
|
const f = document.createElement("input");
|
|
1618
1624
|
f.type = "file";
|
|
1619
|
-
const m =
|
|
1625
|
+
const m = r?.accept || ".json";
|
|
1620
1626
|
f.accept = m, f.style.display = "none", f.onchange = (u) => {
|
|
1621
1627
|
const e = u.target.files[0];
|
|
1622
1628
|
if (!e) {
|
|
1623
|
-
$.fail("未选择文件"),
|
|
1629
|
+
$.fail("未选择文件"), s("未选择文件");
|
|
1624
1630
|
return;
|
|
1625
1631
|
}
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1632
|
+
const n = new FileReader();
|
|
1633
|
+
n.onload = async (i) => {
|
|
1628
1634
|
const o = m == ".json" ? JSON.parse(i.target.result) : i.target.result;
|
|
1629
1635
|
d(o);
|
|
1630
|
-
},
|
|
1631
|
-
$.fail("文件读取失败"),
|
|
1632
|
-
},
|
|
1636
|
+
}, n.onerror = () => {
|
|
1637
|
+
$.fail("文件读取失败"), s("文件读取失败");
|
|
1638
|
+
}, n.readAsText(e), document.body.removeChild(f);
|
|
1633
1639
|
}, document.body.appendChild(f), f.click();
|
|
1634
1640
|
});
|
|
1635
1641
|
}
|
|
1636
|
-
const Ge = (p,
|
|
1637
|
-
if (p.component("TCurd", He), p.component("TFormList",
|
|
1638
|
-
|
|
1639
|
-
for (const d in
|
|
1640
|
-
p.component(d,
|
|
1642
|
+
const Ge = (p, r) => {
|
|
1643
|
+
if (p.component("TCurd", He), p.component("TFormList", ee), p.component("TColumn", we), r?.customComponent) {
|
|
1644
|
+
C.customComponent = r.customComponent;
|
|
1645
|
+
for (const d in r.customComponent)
|
|
1646
|
+
p.component(d, r.customComponent[d]);
|
|
1641
1647
|
}
|
|
1642
1648
|
}, Ye = {
|
|
1643
1649
|
install: Ge
|
|
@@ -1648,8 +1654,8 @@ export {
|
|
|
1648
1654
|
we as TColumn,
|
|
1649
1655
|
He as TCurd,
|
|
1650
1656
|
Qe as TFile,
|
|
1651
|
-
|
|
1652
|
-
|
|
1657
|
+
C as TForm,
|
|
1658
|
+
ee as TFormList,
|
|
1653
1659
|
$ as TSys,
|
|
1654
1660
|
Ye as default,
|
|
1655
1661
|
Ge as install
|