cc1-form 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cc1-form.js +432 -411
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/icon/edit.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/export.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/plus.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/refresh.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/remove.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/search.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/view.vue.d.ts +2 -0
- package/dist/components/TCurd/index.d.ts +7 -0
- package/dist/components/TCurd/index.vue.d.ts +39 -21
- package/package.json +2 -2
package/dist/cc1-form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElMessage as de, ElLoading as ue, ElForm as K, ElFormItem as P, ElInput as H, ElSwitch as G, ElSelect as
|
|
1
|
+
import { defineComponent as B, reactive as X, onMounted as ee, resolveComponent as Z, createElementBlock as w, createCommentVNode as k, openBlock as c, renderSlot as C, createElementVNode as x, createVNode as v, withCtx as h, createTextVNode as V, Fragment as $, renderList as L, createBlock as g, normalizeClass as R, normalizeStyle as se, ref as T, nextTick as ne, unref as u, mergeProps as U, toHandlers as I, resolveDynamicComponent as te, toDisplayString as W, resolveDirective as re, withDirectives as ie } from "vue";
|
|
2
|
+
import { ElMessage as de, ElLoading as ue, ElForm as K, ElFormItem as P, ElInput as H, ElSwitch as G, ElSelect as _, ElOption as N, ElTreeSelect as oe, ElDatePicker as le, ElDialog as q, ElButton as F, ElDropdown as ce, ElDropdownMenu as pe, ElDropdownItem as A, ElTable as fe, ElTableColumn as J, ElPagination as me } from "element-plus";
|
|
3
3
|
class D {
|
|
4
4
|
/**
|
|
5
5
|
* 路由
|
|
@@ -24,7 +24,7 @@ class D {
|
|
|
24
24
|
* @param data 数据
|
|
25
25
|
* @returns 是否显示
|
|
26
26
|
*/
|
|
27
|
-
static isFun = (i, d) => Array.isArray(i) ? i.some((
|
|
27
|
+
static isFun = (i, d) => Array.isArray(i) ? i.some((s) => typeof s == "function" ? s(d) : s) : typeof i == "function" ? i(d) : i;
|
|
28
28
|
/**
|
|
29
29
|
* 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
|
|
30
30
|
*/
|
|
@@ -60,16 +60,16 @@ class D {
|
|
|
60
60
|
* @param type 消息类型
|
|
61
61
|
* @param options 其他选项
|
|
62
62
|
*/
|
|
63
|
-
static showMessage(i, d,
|
|
64
|
-
const
|
|
65
|
-
if (!this.tipMessages[i] ||
|
|
66
|
-
this.tipMessages[i] =
|
|
63
|
+
static showMessage(i, d, s = {}) {
|
|
64
|
+
const f = Date.now();
|
|
65
|
+
if (!this.tipMessages[i] || f - this.tipMessages[i] > this.tipMessagesGap) {
|
|
66
|
+
this.tipMessages[i] = f;
|
|
67
67
|
const m = Object.assign(
|
|
68
68
|
{
|
|
69
69
|
message: i,
|
|
70
70
|
type: d
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
s
|
|
73
73
|
);
|
|
74
74
|
de(m), setTimeout(() => {
|
|
75
75
|
delete this.tipMessages[i];
|
|
@@ -115,11 +115,11 @@ class D {
|
|
|
115
115
|
*/
|
|
116
116
|
static openUrl = (i, 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
|
i,
|
|
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=" +
|
|
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(
|
|
@@ -133,11 +133,11 @@ class D {
|
|
|
133
133
|
* @param param
|
|
134
134
|
* @returns
|
|
135
135
|
*/
|
|
136
|
-
static getImgPic = (i) => new Promise(async (d,
|
|
137
|
-
let
|
|
136
|
+
static getImgPic = (i) => new Promise(async (d, s) => {
|
|
137
|
+
let f = document.getElementById(i.id);
|
|
138
138
|
const m = await D.loadModule("html2canvas");
|
|
139
139
|
try {
|
|
140
|
-
m(
|
|
140
|
+
m(f, {
|
|
141
141
|
logging: !1,
|
|
142
142
|
allowTaint: !0,
|
|
143
143
|
scale: window.devicePixelRatio,
|
|
@@ -152,7 +152,7 @@ class D {
|
|
|
152
152
|
d(e);
|
|
153
153
|
});
|
|
154
154
|
} catch (r) {
|
|
155
|
-
|
|
155
|
+
s(r);
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
}
|
|
@@ -181,9 +181,9 @@ class S {
|
|
|
181
181
|
* @returns
|
|
182
182
|
*/
|
|
183
183
|
static findOptions = (i, d) => {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
return
|
|
184
|
+
const s = i.column.find((m) => m.key === d), f = (m) => m.replace(/-([a-z])/g, (r, e) => e.toUpperCase());
|
|
185
|
+
if (s)
|
|
186
|
+
return s.options[f(s.type)];
|
|
187
187
|
};
|
|
188
188
|
/**
|
|
189
189
|
* 更新组件数据
|
|
@@ -201,9 +201,9 @@ class S {
|
|
|
201
201
|
}))
|
|
202
202
|
)
|
|
203
203
|
*/
|
|
204
|
-
static setOptionsData = (i, d,
|
|
205
|
-
const
|
|
206
|
-
|
|
204
|
+
static setOptionsData = (i, d, s) => {
|
|
205
|
+
const f = S.findOptions(i, d);
|
|
206
|
+
f && (f.data = s);
|
|
207
207
|
};
|
|
208
208
|
static form = {
|
|
209
209
|
openBefore: {
|
|
@@ -214,8 +214,8 @@ class S {
|
|
|
214
214
|
* @param treeData 树形数据
|
|
215
215
|
* @param option 组件配置
|
|
216
216
|
*/
|
|
217
|
-
parentId: (i, d,
|
|
218
|
-
i ? d.type === D.EDialog.Insert ? (d.form.parentId = i._id, d.form.sort = i.children.length + 1) : d.form.parentId = i.parentId.substring(i.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort =
|
|
217
|
+
parentId: (i, d, s, f) => {
|
|
218
|
+
i ? d.type === D.EDialog.Insert ? (d.form.parentId = i._id, d.form.sort = i.children.length + 1) : d.form.parentId = i.parentId.substring(i.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = s.length + 1), S.setOptionsData(f, "parentId", [{ _id: "0", title: "根", children: s }]);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
};
|
|
@@ -230,12 +230,12 @@ class j {
|
|
|
230
230
|
* @param field 字段名
|
|
231
231
|
* @param row 行数据
|
|
232
232
|
*/
|
|
233
|
-
static setId = (i, d,
|
|
234
|
-
d[i] || (d[i] = []), d[i].forEach((
|
|
235
|
-
|
|
233
|
+
static setId = (i, d, s) => {
|
|
234
|
+
d[i] || (d[i] = []), d[i].forEach((f) => {
|
|
235
|
+
s.forEach((m) => {
|
|
236
236
|
let r = m.default ?? "";
|
|
237
|
-
m.type === "number" && (r = m.default ?? 0), m.type === "boolean" && (r = m.default ?? !1), m.type === "time" && (r = m.default ?? /* @__PURE__ */ new Date()),
|
|
238
|
-
}),
|
|
237
|
+
m.type === "number" && (r = m.default ?? 0), m.type === "boolean" && (r = m.default ?? !1), m.type === "time" && (r = m.default ?? /* @__PURE__ */ new Date()), f[m.value] === void 0 && (f[m.value] = r);
|
|
238
|
+
}), f._id || (f._id = j.getIdFun());
|
|
239
239
|
});
|
|
240
240
|
};
|
|
241
241
|
/**
|
|
@@ -245,17 +245,17 @@ class j {
|
|
|
245
245
|
* @param itemFields 元素字段-如:[{label:'',value:''}]
|
|
246
246
|
* @param callback 回调函数
|
|
247
247
|
*/
|
|
248
|
-
static add = (i, d,
|
|
249
|
-
const m = JSONUtil.cp(
|
|
250
|
-
j.setId(i, d,
|
|
248
|
+
static add = (i, d, s, f) => {
|
|
249
|
+
const m = JSONUtil.cp(s);
|
|
250
|
+
j.setId(i, d, s), d[i].push(
|
|
251
251
|
m.reduce(
|
|
252
252
|
(r, e) => {
|
|
253
|
-
let
|
|
254
|
-
return e.type === "number" && (
|
|
253
|
+
let n = e.default ?? "";
|
|
254
|
+
return e.type === "number" && (n = e.default ?? 0), e.type === "boolean" && (n = e.default ?? !1), e.type === "time" && (n = e.default ?? /* @__PURE__ */ new Date()), r[e.value] = n, r;
|
|
255
255
|
},
|
|
256
256
|
{ _id: j.getIdFun() }
|
|
257
257
|
)
|
|
258
|
-
),
|
|
258
|
+
), f?.(d);
|
|
259
259
|
};
|
|
260
260
|
/**
|
|
261
261
|
* 删除数组元素
|
|
@@ -264,8 +264,8 @@ class j {
|
|
|
264
264
|
* @param item 元素-如:{_id:''}
|
|
265
265
|
* @param callback 回调函数
|
|
266
266
|
*/
|
|
267
|
-
static remove = (i, d,
|
|
268
|
-
d[i] = d[i].filter((m) => m._id !==
|
|
267
|
+
static remove = (i, d, s, f) => {
|
|
268
|
+
d[i] = d[i].filter((m) => m._id !== s._id), f?.(d);
|
|
269
269
|
};
|
|
270
270
|
/**
|
|
271
271
|
* 获取没有id的数据
|
|
@@ -274,10 +274,10 @@ class j {
|
|
|
274
274
|
* @returns 没有id的数据
|
|
275
275
|
*/
|
|
276
276
|
static getNoIdData = (i, d) => {
|
|
277
|
-
const
|
|
278
|
-
return
|
|
279
|
-
|
|
280
|
-
}),
|
|
277
|
+
const s = JSONUtil.cp(i);
|
|
278
|
+
return s.forEach((f) => {
|
|
279
|
+
f._id && delete f._id, d && f[d] && j.getNoIdData(f[d], d);
|
|
280
|
+
}), s;
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
const he = {
|
|
@@ -287,7 +287,7 @@ const he = {
|
|
|
287
287
|
}, be = {
|
|
288
288
|
class: "row items-center",
|
|
289
289
|
style: { gap: "10px", width: "100%" }
|
|
290
|
-
}, Q = /* @__PURE__ */
|
|
290
|
+
}, Q = /* @__PURE__ */ B({
|
|
291
291
|
__name: "list",
|
|
292
292
|
props: {
|
|
293
293
|
row: {
|
|
@@ -322,33 +322,33 @@ const he = {
|
|
|
322
322
|
}
|
|
323
323
|
},
|
|
324
324
|
emits: ["change"],
|
|
325
|
-
setup(
|
|
326
|
-
const d =
|
|
325
|
+
setup(p, { emit: i }) {
|
|
326
|
+
const d = p, s = X({
|
|
327
327
|
show: !1,
|
|
328
328
|
add: (m, r, e) => {
|
|
329
329
|
j.add(m, r, e, () => {
|
|
330
|
-
|
|
330
|
+
f("change");
|
|
331
331
|
});
|
|
332
332
|
},
|
|
333
333
|
remove: (m, r, e) => {
|
|
334
334
|
j.remove(m, r, e, () => {
|
|
335
|
-
|
|
335
|
+
f("change");
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
ee(() => {
|
|
340
|
-
j.setId(d.field, d.row, d.itemFields),
|
|
340
|
+
j.setId(d.field, d.row, d.itemFields), s.show = !0;
|
|
341
341
|
});
|
|
342
|
-
const
|
|
342
|
+
const f = i;
|
|
343
343
|
return (m, r) => {
|
|
344
|
-
const e = Z("el-button"),
|
|
345
|
-
return
|
|
346
|
-
|
|
344
|
+
const e = Z("el-button"), n = Z("el-input");
|
|
345
|
+
return s.show ? (c(), w("div", he, [
|
|
346
|
+
C(m.$slots, "list-start", { row: p.row }),
|
|
347
347
|
x("div", null, [
|
|
348
|
-
|
|
348
|
+
v(e, {
|
|
349
349
|
link: "",
|
|
350
350
|
type: "primary",
|
|
351
|
-
onClick: r[0] || (r[0] = (
|
|
351
|
+
onClick: r[0] || (r[0] = (l) => s.add(p.field, p.row, p.itemFields))
|
|
352
352
|
}, {
|
|
353
353
|
default: h(() => [...r[2] || (r[2] = [
|
|
354
354
|
V("添加", -1)
|
|
@@ -356,27 +356,27 @@ const he = {
|
|
|
356
356
|
_: 1
|
|
357
357
|
})
|
|
358
358
|
]),
|
|
359
|
-
(c(!0), w($, null, L(
|
|
360
|
-
|
|
361
|
-
item:
|
|
362
|
-
row:
|
|
359
|
+
(c(!0), w($, null, L(p.row[p.field], (l) => (c(), w("div", be, [
|
|
360
|
+
C(m.$slots, "item-start", {
|
|
361
|
+
item: l,
|
|
362
|
+
row: p.row
|
|
363
363
|
}),
|
|
364
|
-
(c(!0), w($, null, L(
|
|
365
|
-
modelValue: o
|
|
366
|
-
"onUpdate:modelValue": (t) => o
|
|
367
|
-
style: se({ width:
|
|
368
|
-
class:
|
|
369
|
-
placeholder:
|
|
370
|
-
onChange: r[1] || (r[1] = (t) =>
|
|
364
|
+
(c(!0), w($, null, L(p.itemFields, (o) => (c(), g(n, {
|
|
365
|
+
modelValue: l[o.value],
|
|
366
|
+
"onUpdate:modelValue": (t) => l[o.value] = t,
|
|
367
|
+
style: se({ width: p.inputWidth }),
|
|
368
|
+
class: R(p.inputClass),
|
|
369
|
+
placeholder: o[p.label] || o[p.value],
|
|
370
|
+
onChange: r[1] || (r[1] = (t) => f("change"))
|
|
371
371
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
|
|
372
|
-
|
|
373
|
-
item:
|
|
374
|
-
row:
|
|
372
|
+
C(m.$slots, "item-end", {
|
|
373
|
+
item: l,
|
|
374
|
+
row: p.row
|
|
375
375
|
}),
|
|
376
|
-
|
|
376
|
+
v(e, {
|
|
377
377
|
link: "",
|
|
378
378
|
type: "danger",
|
|
379
|
-
onClick: (
|
|
379
|
+
onClick: (o) => s.remove(p.field, p.row, l)
|
|
380
380
|
}, {
|
|
381
381
|
default: h(() => [...r[3] || (r[3] = [
|
|
382
382
|
V("删除", -1)
|
|
@@ -384,11 +384,11 @@ const he = {
|
|
|
384
384
|
_: 1
|
|
385
385
|
}, 8, ["onClick"])
|
|
386
386
|
]))), 256)),
|
|
387
|
-
|
|
387
|
+
C(m.$slots, "list-end", { row: p.row })
|
|
388
388
|
])) : k("", !0);
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
|
-
}), ye = { class: "row curd-row" }, ge = /* @__PURE__ */
|
|
391
|
+
}), ye = { class: "row curd-row" }, ge = /* @__PURE__ */ B({
|
|
392
392
|
__name: "column",
|
|
393
393
|
props: {
|
|
394
394
|
/**
|
|
@@ -404,134 +404,134 @@ const he = {
|
|
|
404
404
|
default: ""
|
|
405
405
|
}
|
|
406
406
|
},
|
|
407
|
-
setup(
|
|
408
|
-
const d = D.isFun,
|
|
407
|
+
setup(p, { expose: i }) {
|
|
408
|
+
const d = D.isFun, s = D.EDialog, f = T(), m = p, r = X({
|
|
409
409
|
rules: {},
|
|
410
410
|
show: !0,
|
|
411
411
|
form: {},
|
|
412
412
|
formDefault: {},
|
|
413
413
|
formColumn: [],
|
|
414
|
-
getDisabled: (e) => e.disabled?.[(m.type ||
|
|
414
|
+
getDisabled: (e) => e.disabled?.[(m.type || s.Insert) === s.Insert ? "create" : "update"],
|
|
415
415
|
initColumnForm: async () => {
|
|
416
416
|
const e = m.option;
|
|
417
417
|
r.formColumn = [];
|
|
418
|
-
const
|
|
418
|
+
const n = [], l = m.option.form?.maxSpan || 12, o = m.option.form?.defaultSpan || l;
|
|
419
419
|
let t = [];
|
|
420
420
|
const a = (b) => {
|
|
421
421
|
if (r.formDefault[b.key] = b.value, b.isForm) {
|
|
422
|
-
b.form = b.form || { span:
|
|
423
|
-
let
|
|
422
|
+
b.form = b.form || { span: o }, b.form.span = b.form.span ?? o;
|
|
423
|
+
let O = b.form.span, y = t.reduce((z, M) => z + M.span, O);
|
|
424
424
|
const E = t.length;
|
|
425
|
-
t.push({ item: b, span:
|
|
425
|
+
t.push({ item: b, span: O }), (E === 1 && t[0].span === 0 || y >= l || O === 0 && E > 1) && (n.push(t), t = []), b.rules && (r.rules[b.key] = b.rules);
|
|
426
426
|
}
|
|
427
427
|
};
|
|
428
428
|
e.column.forEach((b) => {
|
|
429
429
|
b.isForm = !0, a(b);
|
|
430
|
-
}), t.length > 0 &&
|
|
430
|
+
}), t.length > 0 && n.push(t), r.formColumn = n, r.form = JSONUtil.cp(r.formDefault);
|
|
431
431
|
},
|
|
432
432
|
init: async () => {
|
|
433
433
|
r.show = !1, await ne(), r.initColumnForm();
|
|
434
434
|
}
|
|
435
435
|
});
|
|
436
436
|
return r.initColumnForm(), i({
|
|
437
|
-
ref:
|
|
437
|
+
ref: f,
|
|
438
438
|
conf: r
|
|
439
|
-
}), (e,
|
|
439
|
+
}), (e, n) => (c(), g(u(K), {
|
|
440
440
|
ref_key: "ruleFormRef",
|
|
441
|
-
ref:
|
|
441
|
+
ref: f,
|
|
442
442
|
model: r.form,
|
|
443
443
|
rules: r.rules
|
|
444
444
|
}, {
|
|
445
445
|
default: h(() => [
|
|
446
|
-
r.show ? (c(!0), w($, { key: 0 }, L(r.formColumn, (
|
|
447
|
-
|
|
446
|
+
r.show ? (c(!0), w($, { key: 0 }, L(r.formColumn, (l) => (c(), w("div", ye, [
|
|
447
|
+
C(e.$slots, "form-start", {
|
|
448
448
|
row: r.form
|
|
449
449
|
}),
|
|
450
|
-
(c(!0), w($, null, L(
|
|
451
|
-
u(d)(
|
|
450
|
+
(c(!0), w($, null, L(l, (o) => (c(), w($, null, [
|
|
451
|
+
u(d)(o.item.show?.form, r.form) ?? !0 ? (c(), w("div", {
|
|
452
452
|
key: 0,
|
|
453
|
-
class:
|
|
453
|
+
class: R(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
|
|
454
454
|
}, [
|
|
455
|
-
|
|
456
|
-
label:
|
|
457
|
-
prop:
|
|
458
|
-
"label-width":
|
|
455
|
+
v(u(P), {
|
|
456
|
+
label: o.item.label,
|
|
457
|
+
prop: o.item.key,
|
|
458
|
+
"label-width": o.item.form?.labelWidth || "100px"
|
|
459
459
|
}, {
|
|
460
460
|
default: h(() => [
|
|
461
|
-
|
|
461
|
+
C(e.$slots, "form-" + o.item.key + "-start", {
|
|
462
462
|
row: r.form,
|
|
463
|
-
item:
|
|
463
|
+
item: o.item
|
|
464
464
|
}),
|
|
465
|
-
|
|
465
|
+
C(e.$slots, "form-" + o.item.key, {
|
|
466
466
|
row: r.form,
|
|
467
|
-
item:
|
|
467
|
+
item: o.item
|
|
468
468
|
}, () => [
|
|
469
|
-
|
|
469
|
+
o.item.type === "input" ? (c(), g(u(H), U({
|
|
470
470
|
key: 0,
|
|
471
|
-
modelValue: r.form[
|
|
472
|
-
"onUpdate:modelValue": (t) => r.form[
|
|
473
|
-
}, { ref_for: !0 },
|
|
474
|
-
disabled: r.getDisabled(
|
|
475
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
471
|
+
modelValue: r.form[o.item.key],
|
|
472
|
+
"onUpdate:modelValue": (t) => r.form[o.item.key] = t
|
|
473
|
+
}, { ref_for: !0 }, o.item.options?.input, I(o.item.options?.input?.on || {}), {
|
|
474
|
+
disabled: r.getDisabled(o.item)
|
|
475
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "switch" ? (c(), g(u(G), U({
|
|
476
476
|
key: 1,
|
|
477
|
-
modelValue: r.form[
|
|
478
|
-
"onUpdate:modelValue": (t) => r.form[
|
|
479
|
-
}, { ref_for: !0 },
|
|
480
|
-
disabled: r.getDisabled(
|
|
481
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
477
|
+
modelValue: r.form[o.item.key],
|
|
478
|
+
"onUpdate:modelValue": (t) => r.form[o.item.key] = t
|
|
479
|
+
}, { ref_for: !0 }, o.item.options?.switch, I(o.item.options?.switch?.on || {}), {
|
|
480
|
+
disabled: r.getDisabled(o.item)
|
|
481
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "select" ? (c(), g(u(_), U({
|
|
482
482
|
key: 2,
|
|
483
|
-
modelValue: r.form[
|
|
484
|
-
"onUpdate:modelValue": (t) => r.form[
|
|
485
|
-
}, { ref_for: !0 },
|
|
486
|
-
disabled: r.getDisabled(
|
|
483
|
+
modelValue: r.form[o.item.key],
|
|
484
|
+
"onUpdate:modelValue": (t) => r.form[o.item.key] = t
|
|
485
|
+
}, { ref_for: !0 }, o.item.options?.select, I(o.item.options?.select?.on || {}), {
|
|
486
|
+
disabled: r.getDisabled(o.item),
|
|
487
487
|
style: { width: "100%" }
|
|
488
488
|
}), {
|
|
489
489
|
default: h(() => [
|
|
490
|
-
(c(!0), w($, null, L(
|
|
490
|
+
(c(!0), w($, null, L(o.item.options?.select?.data, (t) => (c(), g(u(N), {
|
|
491
491
|
key: t.value,
|
|
492
492
|
label: t.label,
|
|
493
493
|
value: t.value
|
|
494
494
|
}, null, 8, ["label", "value"]))), 128))
|
|
495
495
|
]),
|
|
496
496
|
_: 2
|
|
497
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
497
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "list" ? (c(), g(Q, U({
|
|
498
498
|
key: 3,
|
|
499
499
|
row: r.form,
|
|
500
|
-
field:
|
|
501
|
-
}, { ref_for: !0 },
|
|
502
|
-
disabled: r.getDisabled(
|
|
500
|
+
field: o.item.key
|
|
501
|
+
}, { ref_for: !0 }, o.item.options?.list, I(o.item.options?.list?.on || {}), {
|
|
502
|
+
disabled: r.getDisabled(o.item),
|
|
503
503
|
style: { width: "100%" }
|
|
504
|
-
}), null, 16, ["row", "field", "disabled"])) :
|
|
504
|
+
}), null, 16, ["row", "field", "disabled"])) : o.item.type === "tree-select" ? (c(), g(u(oe), U({
|
|
505
505
|
key: 4,
|
|
506
|
-
modelValue: r.form[
|
|
507
|
-
"onUpdate:modelValue": (t) => r.form[
|
|
508
|
-
}, { ref_for: !0 },
|
|
509
|
-
disabled: r.getDisabled(
|
|
506
|
+
modelValue: r.form[o.item.key],
|
|
507
|
+
"onUpdate:modelValue": (t) => r.form[o.item.key] = t
|
|
508
|
+
}, { ref_for: !0 }, o.item.options?.treeSelect, I(o.item.options?.treeSelect?.on || {}), {
|
|
509
|
+
disabled: r.getDisabled(o.item),
|
|
510
510
|
style: { width: "100%" }
|
|
511
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) :
|
|
511
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : o.item.type === "datetime" ? (c(), g(u(le), U({
|
|
512
512
|
key: 5,
|
|
513
|
-
modelValue: r.form[
|
|
514
|
-
"onUpdate:modelValue": (t) => r.form[
|
|
515
|
-
}, { ref_for: !0 },
|
|
516
|
-
disabled: r.getDisabled(
|
|
517
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(S).customComponent[
|
|
513
|
+
modelValue: r.form[o.item.key],
|
|
514
|
+
"onUpdate:modelValue": (t) => r.form[o.item.key] = t
|
|
515
|
+
}, { ref_for: !0 }, o.item.options?.datetime, I(o.item.options?.datetime?.on || {}), {
|
|
516
|
+
disabled: r.getDisabled(o.item)
|
|
517
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : u(S).customComponent[o.item.type] ? (c(), g(te(u(S).customComponent[o.item.type]), U({
|
|
518
518
|
key: 6,
|
|
519
|
-
modelValue: r.form[
|
|
520
|
-
"onUpdate:modelValue": (t) => r.form[
|
|
521
|
-
}, { ref_for: !0 },
|
|
522
|
-
disabled: r.getDisabled(
|
|
519
|
+
modelValue: r.form[o.item.key],
|
|
520
|
+
"onUpdate:modelValue": (t) => r.form[o.item.key] = t
|
|
521
|
+
}, { ref_for: !0 }, o.item.options?.[o.item.type], I(o.item.options?.[o.item.type]?.on || {}), {
|
|
522
|
+
disabled: r.getDisabled(o.item)
|
|
523
523
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : k("", !0)
|
|
524
524
|
]),
|
|
525
|
-
|
|
525
|
+
C(e.$slots, "form-" + o.item.key + "-end", {
|
|
526
526
|
row: r.form,
|
|
527
|
-
item:
|
|
527
|
+
item: o.item
|
|
528
528
|
})
|
|
529
529
|
]),
|
|
530
530
|
_: 2
|
|
531
531
|
}, 1032, ["label", "prop", "label-width"])
|
|
532
532
|
], 2)) : k("", !0)
|
|
533
533
|
], 64))), 256)),
|
|
534
|
-
|
|
534
|
+
C(e.$slots, "form-end", {
|
|
535
535
|
row: r.form
|
|
536
536
|
})
|
|
537
537
|
]))), 256)) : k("", !0)
|
|
@@ -547,48 +547,49 @@ class we {
|
|
|
547
547
|
* @param columns 列
|
|
548
548
|
* @param fileName 文件名
|
|
549
549
|
*/
|
|
550
|
-
static exportToExcel = async (i, d,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
550
|
+
static exportToExcel = async (i, d, s) => {
|
|
551
|
+
if (!i || i.length === 0) return;
|
|
552
|
+
const f = await D.loadModule("xlsx"), m = i.map((n) => {
|
|
553
|
+
const l = {};
|
|
554
|
+
return d.forEach((o) => {
|
|
555
|
+
l[o.label] = n[o.key];
|
|
556
|
+
}), l;
|
|
557
|
+
}), r = f.utils.json_to_sheet(m), e = f.utils.book_new();
|
|
558
|
+
f.utils.book_append_sheet(e, r, "Sheet1"), s ? typeof s == "function" && (s = s()) : s = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, f.writeFile(e, `${s}.xlsx`);
|
|
558
559
|
};
|
|
559
560
|
}
|
|
560
|
-
const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */
|
|
561
|
+
const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ B({
|
|
561
562
|
__name: "switchConfirm",
|
|
562
|
-
setup(
|
|
563
|
-
const d =
|
|
563
|
+
setup(p, { expose: i }) {
|
|
564
|
+
const d = T(!1), s = T("确认修改"), f = T("确认要修改状态吗?");
|
|
564
565
|
let m = null, r = null;
|
|
565
|
-
const e = (
|
|
566
|
+
const e = (o) => (o?.title && (s.value = o.title), o?.content && (f.value = o.content), d.value = !0, new Promise((t, a) => {
|
|
566
567
|
m = t, r = a;
|
|
567
|
-
})),
|
|
568
|
+
})), n = () => {
|
|
568
569
|
d.value = !1, m?.(!0), m = null, r = null;
|
|
569
|
-
},
|
|
570
|
+
}, l = () => {
|
|
570
571
|
d.value = !1, r?.(new Error("用户取消操作")), m = null, r = null;
|
|
571
572
|
};
|
|
572
573
|
return i({
|
|
573
574
|
open: e
|
|
574
|
-
}), (
|
|
575
|
+
}), (o, t) => (c(), g(u(q), {
|
|
575
576
|
modelValue: d.value,
|
|
576
577
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => d.value = a),
|
|
577
|
-
title:
|
|
578
|
+
title: s.value,
|
|
578
579
|
"close-on-click-modal": !1,
|
|
579
580
|
width: "400px"
|
|
580
581
|
}, {
|
|
581
582
|
footer: h(() => [
|
|
582
583
|
x("span", ke, [
|
|
583
|
-
|
|
584
|
+
v(u(F), { onClick: l }, {
|
|
584
585
|
default: h(() => [...t[1] || (t[1] = [
|
|
585
586
|
V("取消", -1)
|
|
586
587
|
])]),
|
|
587
588
|
_: 1
|
|
588
589
|
}),
|
|
589
|
-
|
|
590
|
+
v(u(F), {
|
|
590
591
|
type: "primary",
|
|
591
|
-
onClick:
|
|
592
|
+
onClick: n
|
|
592
593
|
}, {
|
|
593
594
|
default: h(() => [...t[2] || (t[2] = [
|
|
594
595
|
V("确认", -1)
|
|
@@ -598,27 +599,44 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
598
599
|
])
|
|
599
600
|
]),
|
|
600
601
|
default: h(() => [
|
|
601
|
-
x("div", null,
|
|
602
|
+
x("div", null, W(f.value), 1)
|
|
602
603
|
]),
|
|
603
604
|
_: 1
|
|
604
605
|
}, 8, ["modelValue", "title"]));
|
|
605
606
|
}
|
|
606
|
-
}), Ce =
|
|
607
|
+
}), Ce = (p, i) => {
|
|
608
|
+
const d = p.__vccOpts || p;
|
|
609
|
+
for (const [s, f] of i)
|
|
610
|
+
d[s] = f;
|
|
611
|
+
return d;
|
|
612
|
+
}, Ve = {}, xe = {
|
|
613
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
614
|
+
viewBox: "0 0 1024 1024"
|
|
615
|
+
};
|
|
616
|
+
function Ue(p, i) {
|
|
617
|
+
return c(), w("svg", xe, [...i[0] || (i[0] = [
|
|
618
|
+
x("path", {
|
|
619
|
+
fill: "currentColor",
|
|
620
|
+
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"
|
|
621
|
+
}, null, -1)
|
|
622
|
+
])]);
|
|
623
|
+
}
|
|
624
|
+
const De = /* @__PURE__ */ Ce(Ve, [["render", Ue]]), Ee = { class: "col relative cc1-form-box" }, $e = {
|
|
607
625
|
class: "absolute row fit",
|
|
608
626
|
style: { overflow: "hidden" }
|
|
609
|
-
},
|
|
627
|
+
}, Oe = { class: "col column" }, Fe = {
|
|
610
628
|
key: 0,
|
|
611
629
|
class: "relative curd-search"
|
|
612
|
-
},
|
|
630
|
+
}, Se = { class: "mb-10 flex justify-between items-center" }, Ie = {
|
|
613
631
|
class: "flex items-center",
|
|
614
632
|
style: { gap: "10px" }
|
|
615
|
-
},
|
|
633
|
+
}, Le = { key: 0 }, je = { key: 1 }, ze = { key: 2 }, Re = { class: "export-btn" }, Te = {
|
|
616
634
|
class: "flex items-center",
|
|
617
635
|
style: { gap: "10px" }
|
|
618
|
-
},
|
|
636
|
+
}, Me = { class: "col fit-width relative" }, Ne = { class: "absolute column fit" }, Pe = { class: "row justify-end mt-10 mb-10" }, _e = {
|
|
619
637
|
class: "row form-item-content",
|
|
620
638
|
style: { width: "100%" }
|
|
621
|
-
},
|
|
639
|
+
}, Be = { class: "col" }, Ae = { class: "dialog-footer" }, Je = { class: "dialog-footer" }, We = /* @__PURE__ */ B({
|
|
622
640
|
__name: "index",
|
|
623
641
|
props: {
|
|
624
642
|
/**
|
|
@@ -628,39 +646,39 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
628
646
|
default: {}
|
|
629
647
|
}
|
|
630
648
|
},
|
|
631
|
-
setup(
|
|
632
|
-
const d = D.EDialog,
|
|
649
|
+
setup(p, { expose: i }) {
|
|
650
|
+
const d = D.EDialog, s = p, f = T(), m = T(), r = D.isFun, e = X({
|
|
633
651
|
search: {
|
|
634
652
|
column: {
|
|
635
653
|
list: []
|
|
636
654
|
},
|
|
637
655
|
form: {},
|
|
638
656
|
formDefault: {},
|
|
639
|
-
getPlaceholder: (
|
|
657
|
+
getPlaceholder: (n, l = "请输入") => n.text?.search?.placeholder === void 0 ? `${l}${n.label}` : n.text?.search?.placeholder,
|
|
640
658
|
getFormData: () => {
|
|
641
|
-
let
|
|
642
|
-
|
|
643
|
-
(typeof
|
|
659
|
+
let n = {};
|
|
660
|
+
s.option.column.forEach((o) => {
|
|
661
|
+
(typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (n[o.key] = e.search.form[o.key]);
|
|
644
662
|
});
|
|
645
|
-
const
|
|
646
|
-
return
|
|
663
|
+
const l = s.option.search?.before?.(n);
|
|
664
|
+
return l && (n = l), n;
|
|
647
665
|
},
|
|
648
666
|
reset: () => {
|
|
649
|
-
const
|
|
650
|
-
Object.keys(
|
|
651
|
-
|
|
652
|
-
}), e.search.form = JSONUtil.cp(
|
|
667
|
+
const n = e.search.formDefault;
|
|
668
|
+
Object.keys(n).forEach((l) => {
|
|
669
|
+
s.option.search?.resetMode === "default" ? n[l] = e.search.formDefault[l] : n[l] = void 0;
|
|
670
|
+
}), e.search.form = JSONUtil.cp(n), e.page.num = 1, e.table.getList();
|
|
653
671
|
},
|
|
654
672
|
submit: () => {
|
|
655
673
|
e.page.num = 1, e.table.getList();
|
|
656
674
|
}
|
|
657
675
|
},
|
|
658
676
|
page: {
|
|
659
|
-
size:
|
|
660
|
-
sizeList:
|
|
677
|
+
size: s.option.page?.size || 10,
|
|
678
|
+
sizeList: s.option.page?.sizeList || [10, 20, 50, 100],
|
|
661
679
|
num: 1,
|
|
662
680
|
total: 0,
|
|
663
|
-
layout:
|
|
681
|
+
layout: s.option.page?.layout || "total, sizes, prev, pager, next, jumper"
|
|
664
682
|
},
|
|
665
683
|
table: {
|
|
666
684
|
loading: !1,
|
|
@@ -668,19 +686,19 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
668
686
|
expand: {
|
|
669
687
|
isExpand: !1,
|
|
670
688
|
rowKeys: [],
|
|
671
|
-
change: (
|
|
689
|
+
change: (n, l) => {
|
|
672
690
|
},
|
|
673
691
|
all: () => {
|
|
674
692
|
if (e.table.expand.isExpand)
|
|
675
693
|
e.table.expand.rowKeys = [];
|
|
676
694
|
else {
|
|
677
|
-
const
|
|
678
|
-
let
|
|
679
|
-
return
|
|
680
|
-
|
|
681
|
-
}),
|
|
695
|
+
const n = (l) => {
|
|
696
|
+
let o = [];
|
|
697
|
+
return l.forEach((t) => {
|
|
698
|
+
o.push(t._id), t.children && t.children.length > 0 && (o = o.concat(n(t.children)));
|
|
699
|
+
}), o;
|
|
682
700
|
};
|
|
683
|
-
e.table.expand.rowKeys =
|
|
701
|
+
e.table.expand.rowKeys = n(e.table.data);
|
|
684
702
|
}
|
|
685
703
|
e.table.expand.isExpand = !e.table.expand.isExpand;
|
|
686
704
|
}
|
|
@@ -706,34 +724,36 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
706
724
|
},
|
|
707
725
|
getList: async () => {
|
|
708
726
|
e.table.loading = !0;
|
|
709
|
-
const
|
|
727
|
+
const n = s.option.api.list;
|
|
710
728
|
try {
|
|
711
|
-
const
|
|
729
|
+
const l = await n({
|
|
712
730
|
[S.pageField.size]: e.page.size,
|
|
713
731
|
[S.pageField.num]: e.page.num,
|
|
714
732
|
...e.search.getFormData()
|
|
715
|
-
}),
|
|
716
|
-
let a = (Array.isArray(t[
|
|
717
|
-
e.table.data =
|
|
718
|
-
} catch (
|
|
719
|
-
console.error(
|
|
733
|
+
}), o = S.resultField, t = l.data || { [o.list]: l };
|
|
734
|
+
let a = (Array.isArray(t[o.list]), t[o.list]);
|
|
735
|
+
e.table.data = s.option.data ? await s.option.data(a) : a, e.page.total = t[o.total] || 0;
|
|
736
|
+
} catch (l) {
|
|
737
|
+
console.error(l);
|
|
720
738
|
} finally {
|
|
721
739
|
e.table.loading = !1;
|
|
722
740
|
}
|
|
723
741
|
},
|
|
724
742
|
selection: {
|
|
725
743
|
list: [],
|
|
726
|
-
change: (
|
|
727
|
-
e.table.selection.list =
|
|
744
|
+
change: (n) => {
|
|
745
|
+
e.table.selection.list = n;
|
|
728
746
|
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
export: {
|
|
750
|
+
run: {
|
|
751
|
+
start: async (n) => {
|
|
752
|
+
let l = await e.export.run[n](), o = s.option.column;
|
|
733
753
|
const t = JSONUtil.cp({
|
|
734
|
-
data:
|
|
735
|
-
columns:
|
|
736
|
-
}), a =
|
|
754
|
+
data: l,
|
|
755
|
+
columns: o
|
|
756
|
+
}), a = s.option.tools?.export || {};
|
|
737
757
|
a.before && a.before(t), we.exportToExcel(t.data, t.columns, a.fileName);
|
|
738
758
|
},
|
|
739
759
|
select: () => {
|
|
@@ -747,23 +767,27 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
747
767
|
return e.table.data;
|
|
748
768
|
},
|
|
749
769
|
all: async () => {
|
|
750
|
-
e.
|
|
751
|
-
const s = n.option.api.list;
|
|
770
|
+
e.export.loading = !0;
|
|
752
771
|
try {
|
|
753
|
-
|
|
772
|
+
if (s.option.export?.all) {
|
|
773
|
+
await s.option.export.all();
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
const n = s.option.api.list, { data: l } = await n({
|
|
754
777
|
[S.pageField.size]: 999999,
|
|
755
778
|
[S.pageField.num]: 1
|
|
756
779
|
});
|
|
757
|
-
return
|
|
758
|
-
} catch (
|
|
759
|
-
console.error(
|
|
780
|
+
return l[S.resultField.list];
|
|
781
|
+
} catch (n) {
|
|
782
|
+
console.error(n);
|
|
760
783
|
} finally {
|
|
761
|
-
e.
|
|
784
|
+
e.export.loading = !1;
|
|
762
785
|
}
|
|
763
786
|
}
|
|
764
787
|
},
|
|
765
|
-
|
|
766
|
-
|
|
788
|
+
loading: !1,
|
|
789
|
+
click: (n) => {
|
|
790
|
+
e.export.loading || e.export.run.start(n);
|
|
767
791
|
}
|
|
768
792
|
},
|
|
769
793
|
update: {
|
|
@@ -776,7 +800,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
776
800
|
form: {},
|
|
777
801
|
formDefault: {},
|
|
778
802
|
formColumn: [],
|
|
779
|
-
getDisabled: (
|
|
803
|
+
getDisabled: (n) => n.disabled?.[e.update.type === d.Insert ? "create" : "update"],
|
|
780
804
|
edit: {
|
|
781
805
|
/**
|
|
782
806
|
* 编辑原数据
|
|
@@ -785,43 +809,43 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
785
809
|
/**
|
|
786
810
|
* 将form填入数据和data比对差异数据返回
|
|
787
811
|
*/
|
|
788
|
-
getApiData: (
|
|
789
|
-
if (
|
|
790
|
-
return
|
|
791
|
-
let
|
|
812
|
+
getApiData: (n) => {
|
|
813
|
+
if (s.option.form?.editAll)
|
|
814
|
+
return n;
|
|
815
|
+
let l = {
|
|
792
816
|
_id: e.update.edit.data._id
|
|
793
817
|
};
|
|
794
|
-
return Object.keys(e.update.edit.data).forEach((
|
|
795
|
-
|
|
796
|
-
}),
|
|
818
|
+
return Object.keys(e.update.edit.data).forEach((o) => {
|
|
819
|
+
n[o] !== e.update.edit.data[o] && (l[o] = n[o]);
|
|
820
|
+
}), l;
|
|
797
821
|
}
|
|
798
822
|
},
|
|
799
|
-
open: (
|
|
823
|
+
open: (n, l) => {
|
|
800
824
|
e.update.showContent || FunUtil.throttle(async () => {
|
|
801
|
-
e.update.type =
|
|
802
|
-
const
|
|
803
|
-
e.update.edit.data =
|
|
825
|
+
e.update.type = n;
|
|
826
|
+
const o = n === d.Insert;
|
|
827
|
+
e.update.edit.data = l, e.update.title = o ? "新增" : "编辑", e.update.form = JSONUtil.cp(o ? e.update.formDefault : l), await s.option.form?.openBefore?.(l, e.update), e.update.show = !0, e.update.showContent = !0, s.option.form?.openAfter?.(l, e.update);
|
|
804
828
|
});
|
|
805
829
|
},
|
|
806
830
|
submit: () => {
|
|
807
831
|
FunUtil.throttle(async () => {
|
|
808
|
-
await m.value?.validate(async (
|
|
809
|
-
|
|
832
|
+
await m.value?.validate(async (o, t) => new Promise((a, b) => {
|
|
833
|
+
o || (D.fail("请检查表单数据"), b(!1)), a();
|
|
810
834
|
})), e.update.loading = !0;
|
|
811
|
-
const
|
|
812
|
-
let
|
|
813
|
-
delete
|
|
814
|
-
if (typeof o
|
|
815
|
-
const t = new Date(o
|
|
816
|
-
!isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (o
|
|
835
|
+
const n = e.update.type === d.Insert ? s.option.api.create : s.option.api.update;
|
|
836
|
+
let l = JSONUtil.cp(e.update.form);
|
|
837
|
+
delete l.children, await s.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
|
|
838
|
+
if (typeof l[o] == "string" && l[o].indexOf("T") > -1) {
|
|
839
|
+
const t = new Date(l[o]).getTime();
|
|
840
|
+
!isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (l[o] = t);
|
|
817
841
|
}
|
|
818
842
|
});
|
|
819
843
|
try {
|
|
820
|
-
await
|
|
821
|
-
...
|
|
822
|
-
}), e.update.close(), await e.table.getList(),
|
|
823
|
-
} catch (
|
|
824
|
-
console.error(
|
|
844
|
+
await n({
|
|
845
|
+
...l
|
|
846
|
+
}), e.update.close(), await e.table.getList(), s.option.form?.submitAfter?.(l, e.update);
|
|
847
|
+
} catch (o) {
|
|
848
|
+
console.error(o);
|
|
825
849
|
} finally {
|
|
826
850
|
e.update.loading = !1;
|
|
827
851
|
}
|
|
@@ -841,24 +865,24 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
841
865
|
close: () => {
|
|
842
866
|
e.remove.show = !1;
|
|
843
867
|
},
|
|
844
|
-
open: (
|
|
845
|
-
if (
|
|
868
|
+
open: (n) => {
|
|
869
|
+
if (n.length === 0) {
|
|
846
870
|
D.fail("请选择要删除的数据");
|
|
847
871
|
return;
|
|
848
872
|
}
|
|
849
|
-
e.remove.items =
|
|
873
|
+
e.remove.items = n, e.remove.show = !0;
|
|
850
874
|
},
|
|
851
875
|
submit: () => {
|
|
852
876
|
FunUtil.throttle(async () => {
|
|
853
877
|
e.remove.loading = !0;
|
|
854
|
-
const
|
|
878
|
+
const n = s.option.api.delete;
|
|
855
879
|
try {
|
|
856
|
-
await
|
|
857
|
-
_id: e.remove.items.map((
|
|
880
|
+
await n({
|
|
881
|
+
_id: e.remove.items.map((l) => l._id),
|
|
858
882
|
items: e.remove.items
|
|
859
883
|
}), D.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
|
|
860
|
-
} catch (
|
|
861
|
-
console.error(
|
|
884
|
+
} catch (l) {
|
|
885
|
+
console.error(l);
|
|
862
886
|
} finally {
|
|
863
887
|
e.remove.loading = !1;
|
|
864
888
|
}
|
|
@@ -869,7 +893,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
869
893
|
e.initCurdConfig(), e.initColumnOptions(), e.initColumnForm();
|
|
870
894
|
},
|
|
871
895
|
initCurdConfig: () => {
|
|
872
|
-
const
|
|
896
|
+
const l = {
|
|
873
897
|
tools: {
|
|
874
898
|
search: !0,
|
|
875
899
|
reset: !0,
|
|
@@ -887,9 +911,9 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
887
911
|
emptyText: "暂无数据",
|
|
888
912
|
highlightCurrentRow: !0
|
|
889
913
|
}
|
|
890
|
-
},
|
|
891
|
-
Object.keys(
|
|
892
|
-
|
|
914
|
+
}, o = s.option;
|
|
915
|
+
Object.keys(l).forEach((t) => {
|
|
916
|
+
o[t] = ObjectUtil.deepMerge(l[t], o[t] || {});
|
|
893
917
|
});
|
|
894
918
|
},
|
|
895
919
|
/**
|
|
@@ -898,7 +922,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
898
922
|
* @returns
|
|
899
923
|
*/
|
|
900
924
|
initColumnOptions: () => {
|
|
901
|
-
const
|
|
925
|
+
const n = s.option, l = (o) => {
|
|
902
926
|
const a = {
|
|
903
927
|
options: {
|
|
904
928
|
switch: {
|
|
@@ -906,17 +930,17 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
906
930
|
activeLabel: "开启",
|
|
907
931
|
inactiveValue: !1,
|
|
908
932
|
inactiveLabel: "关闭",
|
|
909
|
-
tableBeforeChange: async (
|
|
910
|
-
const E =
|
|
933
|
+
tableBeforeChange: async (O, y) => {
|
|
934
|
+
const E = o.options?.switch;
|
|
911
935
|
try {
|
|
912
|
-
await
|
|
936
|
+
await f.value?.open({
|
|
913
937
|
title: "确认修改",
|
|
914
|
-
content: `确认要${y[
|
|
938
|
+
content: `确认要${y[O] === E.activeValue ? E.inactiveLabel : E.activeLabel}吗?`
|
|
915
939
|
}), e.table.loading = !0;
|
|
916
940
|
try {
|
|
917
|
-
return await
|
|
941
|
+
return await s.option.api.update({
|
|
918
942
|
_id: y._id,
|
|
919
|
-
[
|
|
943
|
+
[O]: y[O] === E.activeValue ? E.inactiveValue : E.activeValue,
|
|
920
944
|
final(z, M, Y) {
|
|
921
945
|
e.table.loading = !1;
|
|
922
946
|
}
|
|
@@ -960,38 +984,38 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
960
984
|
table: 0,
|
|
961
985
|
form: 0
|
|
962
986
|
}
|
|
963
|
-
}, b =
|
|
964
|
-
Object.keys(a).forEach((
|
|
965
|
-
b[
|
|
987
|
+
}, b = o;
|
|
988
|
+
Object.keys(a).forEach((O) => {
|
|
989
|
+
b[O] = ObjectUtil.deepMerge(a[O], b[O] || {});
|
|
966
990
|
});
|
|
967
991
|
};
|
|
968
|
-
|
|
992
|
+
n.column.forEach(l), n.table?.column?.forEach(l);
|
|
969
993
|
},
|
|
970
994
|
initColumnForm: () => {
|
|
971
|
-
const
|
|
995
|
+
const n = s.option;
|
|
972
996
|
e.update.formColumn = [], e.table.column.show = {
|
|
973
997
|
list: [],
|
|
974
998
|
listSource: []
|
|
975
999
|
};
|
|
976
|
-
const
|
|
1000
|
+
const l = [], o = s.option.form?.maxSpan || 12, t = s.option.form?.defaultSpan || o / 2;
|
|
977
1001
|
let a = [];
|
|
978
1002
|
const b = (y) => {
|
|
979
1003
|
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) {
|
|
980
1004
|
y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
|
|
981
1005
|
let E = y.form.span, z = a.reduce((Y, ae) => Y + ae.span, E);
|
|
982
1006
|
const M = a.length;
|
|
983
|
-
a.push({ item: y, span: E }), (M === 1 && a[0].span === 0 || z >=
|
|
1007
|
+
a.push({ item: y, span: E }), (M === 1 && a[0].span === 0 || z >= o || E === 0 && M > 1) && (l.push(a), a = []), y.rules && (e.update.rules[y.key] = y.rules);
|
|
984
1008
|
}
|
|
985
1009
|
};
|
|
986
|
-
|
|
1010
|
+
n.column.forEach((y) => {
|
|
987
1011
|
y.isForm = !0, b(y);
|
|
988
|
-
}),
|
|
1012
|
+
}), s.option.table?.column?.forEach((y) => {
|
|
989
1013
|
y.isForm = !1, b(y);
|
|
990
|
-
}), e.search.column.list =
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
e.search.formDefault[y] =
|
|
994
|
-
}),
|
|
1014
|
+
}), 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, E) => y.sort?.search - E.sort?.search), e.table.column.list.sort((y, E) => y.sort?.table - E.sort?.table), a.length > 0 && l.push(a), e.update.formColumn = l;
|
|
1015
|
+
const O = s.option.search?.formDefault;
|
|
1016
|
+
O && Object.keys(O).forEach((y) => {
|
|
1017
|
+
e.search.formDefault[y] = O[y];
|
|
1018
|
+
}), n.column.forEach((y) => {
|
|
995
1019
|
y.show?.search || (e.search.formDefault[y.key] = void 0);
|
|
996
1020
|
}), e.search.form = JSONUtil.cp(e.search.formDefault);
|
|
997
1021
|
}
|
|
@@ -1000,19 +1024,19 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1000
1024
|
e.table.getList();
|
|
1001
1025
|
}), i({
|
|
1002
1026
|
conf: e
|
|
1003
|
-
}), (
|
|
1004
|
-
const
|
|
1005
|
-
return c(), w("div",
|
|
1006
|
-
x("div",
|
|
1007
|
-
|
|
1008
|
-
x("div",
|
|
1009
|
-
|
|
1010
|
-
|
|
1027
|
+
}), (n, l) => {
|
|
1028
|
+
const o = re("loading");
|
|
1029
|
+
return c(), w("div", Ee, [
|
|
1030
|
+
x("div", $e, [
|
|
1031
|
+
C(n.$slots, "box-left"),
|
|
1032
|
+
x("div", Oe, [
|
|
1033
|
+
p.option.search?.show !== !1 ? (c(), w("div", Fe, [
|
|
1034
|
+
v(u(K), {
|
|
1011
1035
|
model: e.search.form,
|
|
1012
1036
|
inline: ""
|
|
1013
1037
|
}, {
|
|
1014
1038
|
default: h(() => [
|
|
1015
|
-
|
|
1039
|
+
C(n.$slots, "search-start", {
|
|
1016
1040
|
row: e.search.form
|
|
1017
1041
|
}),
|
|
1018
1042
|
(c(!0), w($, null, L(e.search.column.list, (t) => (c(), w($, {
|
|
@@ -1021,12 +1045,12 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1021
1045
|
(typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (c(), g(u(P), {
|
|
1022
1046
|
key: 0,
|
|
1023
1047
|
label: typeof t.text?.search?.label == "string" ? t.text?.search?.label : t.label,
|
|
1024
|
-
class:
|
|
1048
|
+
class: R({
|
|
1025
1049
|
"hide-label": typeof t.text?.search?.label == "boolean" ? !t.text?.search?.label : !1
|
|
1026
1050
|
})
|
|
1027
1051
|
}, {
|
|
1028
1052
|
default: h(() => [
|
|
1029
|
-
|
|
1053
|
+
C(n.$slots, "search-" + t.key, {
|
|
1030
1054
|
row: e.search.form
|
|
1031
1055
|
}, () => [
|
|
1032
1056
|
t.type === "input" ? (c(), g(u(H), {
|
|
@@ -1036,7 +1060,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1036
1060
|
placeholder: e.search.getPlaceholder(t),
|
|
1037
1061
|
clearable: "",
|
|
1038
1062
|
disabled: t.disabled?.search
|
|
1039
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (c(), g(u(
|
|
1063
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "switch" ? (c(), g(u(_), {
|
|
1040
1064
|
key: 1,
|
|
1041
1065
|
modelValue: e.search.form[t.key],
|
|
1042
1066
|
"onUpdate:modelValue": (a) => e.search.form[t.key] = a,
|
|
@@ -1057,7 +1081,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1057
1081
|
}, null, 8, ["label", "value"]))
|
|
1058
1082
|
]),
|
|
1059
1083
|
_: 2
|
|
1060
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (c(), g(u(
|
|
1084
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : t.type === "select" ? (c(), g(u(_), {
|
|
1061
1085
|
key: 2,
|
|
1062
1086
|
modelValue: e.search.form[t.key],
|
|
1063
1087
|
"onUpdate:modelValue": (a) => e.search.form[t.key] = a,
|
|
@@ -1079,26 +1103,26 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1079
1103
|
_: 2
|
|
1080
1104
|
}, 1032, ["label", "class"])) : k("", !0)
|
|
1081
1105
|
], 64))), 128)),
|
|
1082
|
-
|
|
1106
|
+
C(n.$slots, "search-center", {
|
|
1083
1107
|
row: e.search.form
|
|
1084
1108
|
}),
|
|
1085
|
-
|
|
1109
|
+
v(u(P), null, {
|
|
1086
1110
|
default: h(() => [
|
|
1087
|
-
|
|
1111
|
+
p.option.tools?.search ? (c(), g(u(F), {
|
|
1088
1112
|
key: 0,
|
|
1089
1113
|
type: "primary",
|
|
1090
1114
|
onClick: e.search.submit
|
|
1091
1115
|
}, {
|
|
1092
|
-
default: h(() => [...
|
|
1116
|
+
default: h(() => [...l[8] || (l[8] = [
|
|
1093
1117
|
V(" 搜索 ", -1)
|
|
1094
1118
|
])]),
|
|
1095
1119
|
_: 1
|
|
1096
1120
|
}, 8, ["onClick"])) : k("", !0),
|
|
1097
|
-
|
|
1121
|
+
p.option.tools?.reset ? (c(), g(u(F), {
|
|
1098
1122
|
key: 1,
|
|
1099
1123
|
onClick: e.search.reset
|
|
1100
1124
|
}, {
|
|
1101
|
-
default: h(() => [...
|
|
1125
|
+
default: h(() => [...l[9] || (l[9] = [
|
|
1102
1126
|
V("重置", -1)
|
|
1103
1127
|
])]),
|
|
1104
1128
|
_: 1
|
|
@@ -1106,69 +1130,72 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1106
1130
|
]),
|
|
1107
1131
|
_: 1
|
|
1108
1132
|
}),
|
|
1109
|
-
|
|
1133
|
+
C(n.$slots, "search-end", {
|
|
1110
1134
|
row: e.search.form
|
|
1111
1135
|
})
|
|
1112
1136
|
]),
|
|
1113
1137
|
_: 3
|
|
1114
1138
|
}, 8, ["model"])
|
|
1115
1139
|
])) : k("", !0),
|
|
1116
|
-
x("div",
|
|
1117
|
-
x("div",
|
|
1118
|
-
u(r)(
|
|
1119
|
-
|
|
1140
|
+
x("div", Se, [
|
|
1141
|
+
x("div", Ie, [
|
|
1142
|
+
u(r)(p.option.tools?.add) ? (c(), w("div", Le, [
|
|
1143
|
+
v(u(F), {
|
|
1120
1144
|
type: "primary",
|
|
1121
|
-
onClick:
|
|
1145
|
+
onClick: l[0] || (l[0] = (t) => e.update.open(u(d).Insert))
|
|
1122
1146
|
}, {
|
|
1123
|
-
default: h(() => [...
|
|
1147
|
+
default: h(() => [...l[10] || (l[10] = [
|
|
1124
1148
|
V("新增", -1)
|
|
1125
1149
|
])]),
|
|
1126
1150
|
_: 1
|
|
1127
1151
|
})
|
|
1128
1152
|
])) : k("", !0),
|
|
1129
|
-
|
|
1130
|
-
|
|
1153
|
+
p.option.table?.selectable && u(r)(p.option.tools?.delete) ? (c(), w("div", je, [
|
|
1154
|
+
v(u(F), {
|
|
1131
1155
|
type: "danger",
|
|
1132
|
-
onClick:
|
|
1156
|
+
onClick: l[1] || (l[1] = (t) => e.remove.open(e.table.selection.list))
|
|
1133
1157
|
}, {
|
|
1134
|
-
default: h(() => [...
|
|
1158
|
+
default: h(() => [...l[11] || (l[11] = [
|
|
1135
1159
|
V(" 删除 ", -1)
|
|
1136
1160
|
])]),
|
|
1137
1161
|
_: 1
|
|
1138
1162
|
})
|
|
1139
1163
|
])) : k("", !0),
|
|
1140
|
-
|
|
1141
|
-
|
|
1164
|
+
p.option.tools?.expand ? (c(), w("div", ze, [
|
|
1165
|
+
v(u(F), {
|
|
1142
1166
|
type: "warning",
|
|
1143
|
-
onClick:
|
|
1167
|
+
onClick: l[2] || (l[2] = (t) => e.table.expand.all())
|
|
1144
1168
|
}, {
|
|
1145
|
-
default: h(() => [...
|
|
1169
|
+
default: h(() => [...l[12] || (l[12] = [
|
|
1146
1170
|
V("展开/收缩", -1)
|
|
1147
1171
|
])]),
|
|
1148
1172
|
_: 1
|
|
1149
1173
|
})
|
|
1150
1174
|
])) : k("", !0),
|
|
1151
|
-
|
|
1175
|
+
p.option.tools?.export?.show ? (c(), g(u(ce), {
|
|
1152
1176
|
key: 3,
|
|
1153
|
-
onCommand: e.
|
|
1177
|
+
onCommand: e.export.click
|
|
1154
1178
|
}, {
|
|
1155
1179
|
dropdown: h(() => [
|
|
1156
|
-
|
|
1180
|
+
v(u(pe), null, {
|
|
1157
1181
|
default: h(() => [
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1182
|
+
p.option.table?.selectable ? (c(), g(u(A), {
|
|
1183
|
+
key: 0,
|
|
1184
|
+
command: "select"
|
|
1185
|
+
}, {
|
|
1186
|
+
default: h(() => [...l[14] || (l[14] = [
|
|
1187
|
+
V(" 导出选中 ", -1)
|
|
1161
1188
|
])]),
|
|
1162
1189
|
_: 1
|
|
1163
|
-
}),
|
|
1164
|
-
|
|
1165
|
-
default: h(() => [...
|
|
1190
|
+
})) : k("", !0),
|
|
1191
|
+
v(u(A), { command: "page" }, {
|
|
1192
|
+
default: h(() => [...l[15] || (l[15] = [
|
|
1166
1193
|
V("导出本页", -1)
|
|
1167
1194
|
])]),
|
|
1168
1195
|
_: 1
|
|
1169
1196
|
}),
|
|
1170
|
-
|
|
1171
|
-
default: h(() => [...
|
|
1197
|
+
v(u(A), { command: "all" }, {
|
|
1198
|
+
default: h(() => [...l[16] || (l[16] = [
|
|
1172
1199
|
V("导出全部", -1)
|
|
1173
1200
|
])]),
|
|
1174
1201
|
_: 1
|
|
@@ -1178,65 +1205,60 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1178
1205
|
})
|
|
1179
1206
|
]),
|
|
1180
1207
|
default: h(() => [
|
|
1181
|
-
x("div",
|
|
1182
|
-
|
|
1183
|
-
|
|
1208
|
+
x("div", Re, [
|
|
1209
|
+
v(u(F), {
|
|
1210
|
+
type: "warning",
|
|
1211
|
+
loading: e.export.loading
|
|
1212
|
+
}, {
|
|
1213
|
+
default: h(() => [...l[13] || (l[13] = [
|
|
1184
1214
|
V("导出", -1)
|
|
1185
1215
|
])]),
|
|
1186
1216
|
_: 1
|
|
1187
|
-
})
|
|
1217
|
+
}, 8, ["loading"])
|
|
1188
1218
|
])
|
|
1189
1219
|
]),
|
|
1190
1220
|
_: 1
|
|
1191
1221
|
}, 8, ["onCommand"])) : k("", !0),
|
|
1192
|
-
|
|
1222
|
+
C(n.$slots, "tools-left")
|
|
1193
1223
|
]),
|
|
1194
|
-
x("div",
|
|
1195
|
-
|
|
1196
|
-
|
|
1224
|
+
x("div", Te, [
|
|
1225
|
+
C(n.$slots, "tools-right"),
|
|
1226
|
+
p.option.tools?.refresh === void 0 || p.option.tools?.refresh ? (c(), w("div", {
|
|
1197
1227
|
key: 0,
|
|
1198
1228
|
class: "refresh-btn",
|
|
1199
|
-
onClick:
|
|
1229
|
+
onClick: l[3] || (l[3] = //@ts-ignore
|
|
1200
1230
|
(...t) => e.table.getList && e.table.getList(...t))
|
|
1201
|
-
}, [
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
viewBox: "0 0 1024 1024"
|
|
1205
|
-
}, [
|
|
1206
|
-
x("path", {
|
|
1207
|
-
fill: "currentColor",
|
|
1208
|
-
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"
|
|
1209
|
-
})
|
|
1210
|
-
], -1)
|
|
1211
|
-
])])) : k("", !0)
|
|
1231
|
+
}, [
|
|
1232
|
+
v(De)
|
|
1233
|
+
])) : k("", !0)
|
|
1212
1234
|
])
|
|
1213
1235
|
]),
|
|
1214
|
-
x("div",
|
|
1215
|
-
x("div",
|
|
1236
|
+
x("div", Me, [
|
|
1237
|
+
x("div", Ne, [
|
|
1216
1238
|
ie((c(), g(u(fe), U({
|
|
1217
1239
|
data: e.table.data
|
|
1218
|
-
},
|
|
1240
|
+
}, p.option.table, {
|
|
1219
1241
|
onSelectionChange: e.table.selection.change,
|
|
1220
1242
|
"expand-row-keys": e.table.expand.rowKeys,
|
|
1221
1243
|
onExpandChange: e.table.expand.change
|
|
1222
1244
|
}), {
|
|
1223
1245
|
default: h(() => [
|
|
1224
|
-
|
|
1246
|
+
p.option.table?.selectable && (u(r)(p.option.tools?.delete) || p.option.tools?.export?.show) ? (c(), g(u(J), {
|
|
1225
1247
|
key: 0,
|
|
1226
1248
|
type: "selection",
|
|
1227
|
-
selectable: typeof
|
|
1249
|
+
selectable: typeof p.option.table?.selectable == "function" ? p.option.table?.selectable : void 0,
|
|
1228
1250
|
width: "55"
|
|
1229
1251
|
}, null, 8, ["selectable"])) : k("", !0),
|
|
1230
1252
|
(c(!0), w($, null, L(e.table.column.list, (t) => (c(), w($, {
|
|
1231
1253
|
key: t.key
|
|
1232
1254
|
}, [
|
|
1233
|
-
e.table.column.show.list.includes(t.key) ? (c(), g(u(
|
|
1255
|
+
e.table.column.show.list.includes(t.key) ? (c(), g(u(J), U({
|
|
1234
1256
|
key: 0,
|
|
1235
1257
|
prop: t.key,
|
|
1236
1258
|
label: t.label
|
|
1237
1259
|
}, { ref_for: !0 }, t.table), {
|
|
1238
1260
|
default: h(({ row: a }) => [
|
|
1239
|
-
|
|
1261
|
+
C(n.$slots, "table-" + t.key, {
|
|
1240
1262
|
row: a,
|
|
1241
1263
|
item: t
|
|
1242
1264
|
}, () => [
|
|
@@ -1246,14 +1268,14 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1246
1268
|
"onUpdate:modelValue": (b) => a[t.key] = b,
|
|
1247
1269
|
"before-change": () => t.options?.switch?.tableBeforeChange?.(t.key, a)
|
|
1248
1270
|
}, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (c(), w($, { key: 1 }, [
|
|
1249
|
-
V(
|
|
1271
|
+
V(W(a[t.key]), 1)
|
|
1250
1272
|
], 64))
|
|
1251
1273
|
])
|
|
1252
1274
|
]),
|
|
1253
1275
|
_: 2
|
|
1254
1276
|
}, 1040, ["prop", "label"])) : k("", !0)
|
|
1255
1277
|
], 64))), 128)),
|
|
1256
|
-
u(r)(
|
|
1278
|
+
u(r)(p.option.tools?.add) || u(r)(p.option.tools?.update) || u(r)(p.option.tools?.delete) || n.$slots["table-op-left"] || n.$slots["table-op-right"] ? (c(), g(u(J), {
|
|
1257
1279
|
key: 1,
|
|
1258
1280
|
label: "操作",
|
|
1259
1281
|
width: "180",
|
|
@@ -1261,58 +1283,57 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1261
1283
|
fixed: "right"
|
|
1262
1284
|
}, {
|
|
1263
1285
|
default: h(({ row: t }) => [
|
|
1264
|
-
|
|
1265
|
-
u(r)(
|
|
1286
|
+
C(n.$slots, "table-op-left", { row: t }),
|
|
1287
|
+
u(r)(p.option.tools?.add, t) ? (c(), g(u(F), {
|
|
1266
1288
|
key: 0,
|
|
1267
1289
|
link: "",
|
|
1268
1290
|
type: "primary",
|
|
1269
1291
|
onClick: (a) => e.update.open(u(d).Insert, t)
|
|
1270
1292
|
}, {
|
|
1271
|
-
default: h(() => [...
|
|
1293
|
+
default: h(() => [...l[17] || (l[17] = [
|
|
1272
1294
|
V(" 新增 ", -1)
|
|
1273
1295
|
])]),
|
|
1274
1296
|
_: 1
|
|
1275
1297
|
}, 8, ["onClick"])) : k("", !0),
|
|
1276
|
-
u(r)(
|
|
1298
|
+
u(r)(p.option.tools?.update, t) ? (c(), g(u(F), {
|
|
1277
1299
|
key: 1,
|
|
1278
1300
|
link: "",
|
|
1279
1301
|
type: "warning",
|
|
1280
1302
|
onClick: (a) => e.update.open(u(d).Update, t)
|
|
1281
1303
|
}, {
|
|
1282
|
-
default: h(() => [...
|
|
1304
|
+
default: h(() => [...l[18] || (l[18] = [
|
|
1283
1305
|
V(" 编辑 ", -1)
|
|
1284
1306
|
])]),
|
|
1285
1307
|
_: 1
|
|
1286
1308
|
}, 8, ["onClick"])) : k("", !0),
|
|
1287
|
-
u(r)(
|
|
1309
|
+
u(r)(p.option.tools?.delete, t) ? (c(), g(u(F), {
|
|
1288
1310
|
key: 2,
|
|
1289
1311
|
link: "",
|
|
1290
1312
|
type: "danger",
|
|
1291
1313
|
onClick: (a) => e.remove.open([t])
|
|
1292
1314
|
}, {
|
|
1293
|
-
default: h(() => [...
|
|
1315
|
+
default: h(() => [...l[19] || (l[19] = [
|
|
1294
1316
|
V(" 删除 ", -1)
|
|
1295
1317
|
])]),
|
|
1296
1318
|
_: 1
|
|
1297
1319
|
}, 8, ["onClick"])) : k("", !0),
|
|
1298
|
-
|
|
1320
|
+
C(n.$slots, "table-op-right", { row: t })
|
|
1299
1321
|
]),
|
|
1300
1322
|
_: 3
|
|
1301
1323
|
})) : k("", !0)
|
|
1302
1324
|
]),
|
|
1303
1325
|
_: 3
|
|
1304
1326
|
}, 16, ["data", "onSelectionChange", "expand-row-keys", "onExpandChange"])), [
|
|
1305
|
-
[
|
|
1327
|
+
[o, e.table.loading]
|
|
1306
1328
|
])
|
|
1307
1329
|
])
|
|
1308
1330
|
]),
|
|
1309
|
-
x("div",
|
|
1310
|
-
|
|
1311
|
-
key: 0,
|
|
1331
|
+
x("div", Pe, [
|
|
1332
|
+
v(u(me), {
|
|
1312
1333
|
"current-page": e.page.num,
|
|
1313
|
-
"onUpdate:currentPage":
|
|
1334
|
+
"onUpdate:currentPage": l[4] || (l[4] = (t) => e.page.num = t),
|
|
1314
1335
|
"page-size": e.page.size,
|
|
1315
|
-
"onUpdate:pageSize":
|
|
1336
|
+
"onUpdate:pageSize": l[5] || (l[5] = (t) => e.page.size = t),
|
|
1316
1337
|
background: "",
|
|
1317
1338
|
"page-sizes": e.page.sizeList,
|
|
1318
1339
|
"pager-count": 7,
|
|
@@ -1320,34 +1341,34 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1320
1341
|
total: e.page.total,
|
|
1321
1342
|
onSizeChange: e.table.getList,
|
|
1322
1343
|
onCurrentChange: e.table.getList
|
|
1323
|
-
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total", "onSizeChange", "onCurrentChange"])
|
|
1344
|
+
}, null, 8, ["current-page", "page-size", "page-sizes", "layout", "total", "onSizeChange", "onCurrentChange"])
|
|
1324
1345
|
])
|
|
1325
1346
|
]),
|
|
1326
|
-
|
|
1347
|
+
C(n.$slots, "box-right")
|
|
1327
1348
|
]),
|
|
1328
|
-
|
|
1349
|
+
v(u(q), U({
|
|
1329
1350
|
modelValue: e.update.show,
|
|
1330
|
-
"onUpdate:modelValue":
|
|
1351
|
+
"onUpdate:modelValue": l[6] || (l[6] = (t) => e.update.show = t),
|
|
1331
1352
|
title: e.update.title,
|
|
1332
1353
|
"close-on-click-modal": !1,
|
|
1333
1354
|
"before-close": e.update.close
|
|
1334
|
-
},
|
|
1355
|
+
}, p.option.dialog), {
|
|
1335
1356
|
footer: h(() => [
|
|
1336
|
-
x("span",
|
|
1337
|
-
|
|
1357
|
+
x("span", Ae, [
|
|
1358
|
+
v(u(F), {
|
|
1338
1359
|
onClick: e.update.close
|
|
1339
1360
|
}, {
|
|
1340
|
-
default: h(() => [...
|
|
1361
|
+
default: h(() => [...l[20] || (l[20] = [
|
|
1341
1362
|
V("关闭", -1)
|
|
1342
1363
|
])]),
|
|
1343
1364
|
_: 1
|
|
1344
1365
|
}, 8, ["onClick"]),
|
|
1345
|
-
|
|
1366
|
+
v(u(F), {
|
|
1346
1367
|
type: "primary",
|
|
1347
1368
|
onClick: e.update.submit,
|
|
1348
1369
|
loading: e.update.loading
|
|
1349
1370
|
}, {
|
|
1350
|
-
default: h(() => [...
|
|
1371
|
+
default: h(() => [...l[21] || (l[21] = [
|
|
1351
1372
|
V(" 提交 ", -1)
|
|
1352
1373
|
])]),
|
|
1353
1374
|
_: 1
|
|
@@ -1355,7 +1376,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1355
1376
|
])
|
|
1356
1377
|
]),
|
|
1357
1378
|
default: h(() => [
|
|
1358
|
-
|
|
1379
|
+
v(u(K), {
|
|
1359
1380
|
ref_key: "ruleFormRef",
|
|
1360
1381
|
ref: m,
|
|
1361
1382
|
model: e.update.form,
|
|
@@ -1368,20 +1389,20 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1368
1389
|
e.update.form
|
|
1369
1390
|
) ? (c(), w("div", {
|
|
1370
1391
|
key: 0,
|
|
1371
|
-
class:
|
|
1372
|
-
stripe:
|
|
1392
|
+
class: R(["row curd-row", {
|
|
1393
|
+
stripe: p.option.form?.stripe === void 0 ? !0 : p.option.form?.stripe
|
|
1373
1394
|
}])
|
|
1374
1395
|
}, [
|
|
1375
|
-
|
|
1396
|
+
C(n.$slots, "form-start", {
|
|
1376
1397
|
row: e.update.form
|
|
1377
1398
|
}),
|
|
1378
1399
|
(c(!0), w($, null, L(t, (a) => (c(), w($, null, [
|
|
1379
1400
|
u(r)(a.item.show?.form, e.update.form) ? (c(), w("div", {
|
|
1380
1401
|
key: 0,
|
|
1381
|
-
class:
|
|
1402
|
+
class: R(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
|
|
1382
1403
|
}, [
|
|
1383
|
-
|
|
1384
|
-
class:
|
|
1404
|
+
v(u(P), {
|
|
1405
|
+
class: R({
|
|
1385
1406
|
"hide-label": typeof a.item.text?.form?.label == "boolean" ? !a.item.text?.form?.label : !1
|
|
1386
1407
|
}),
|
|
1387
1408
|
label: typeof a.item.text?.form?.label == "string" ? a.item.text?.form?.label : a.item.label,
|
|
@@ -1389,13 +1410,13 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1389
1410
|
"label-width": a.item.form?.labelWidth || "100px"
|
|
1390
1411
|
}, {
|
|
1391
1412
|
default: h(() => [
|
|
1392
|
-
x("div",
|
|
1393
|
-
|
|
1413
|
+
x("div", _e, [
|
|
1414
|
+
C(n.$slots, "form-" + a.item.key + "-start", {
|
|
1394
1415
|
row: e.update.form,
|
|
1395
1416
|
item: a.item
|
|
1396
1417
|
}),
|
|
1397
|
-
x("div",
|
|
1398
|
-
|
|
1418
|
+
x("div", Be, [
|
|
1419
|
+
C(n.$slots, "form-" + a.item.key, {
|
|
1399
1420
|
row: e.update.form,
|
|
1400
1421
|
item: a.item
|
|
1401
1422
|
}, () => [
|
|
@@ -1411,7 +1432,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1411
1432
|
"onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
|
|
1412
1433
|
}, { ref_for: !0 }, a.item.options?.switch, {
|
|
1413
1434
|
disabled: e.update.getDisabled(a.item)
|
|
1414
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (c(), g(u(
|
|
1435
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : a.item.type === "select" ? (c(), g(u(_), U({
|
|
1415
1436
|
key: 2,
|
|
1416
1437
|
modelValue: e.update.form[a.item.key],
|
|
1417
1438
|
"onUpdate:modelValue": (b) => e.update.form[a.item.key] = b
|
|
@@ -1456,7 +1477,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1456
1477
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : k("", !0)
|
|
1457
1478
|
])
|
|
1458
1479
|
]),
|
|
1459
|
-
|
|
1480
|
+
C(n.$slots, "form-" + a.item.key + "-end", {
|
|
1460
1481
|
row: e.update.form,
|
|
1461
1482
|
item: a.item
|
|
1462
1483
|
})
|
|
@@ -1466,7 +1487,7 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1466
1487
|
}, 1032, ["class", "label", "prop", "label-width"])
|
|
1467
1488
|
], 2)) : k("", !0)
|
|
1468
1489
|
], 64))), 256)),
|
|
1469
|
-
|
|
1490
|
+
C(n.$slots, "form-end", {
|
|
1470
1491
|
row: e.update.form
|
|
1471
1492
|
})
|
|
1472
1493
|
], 2)) : k("", !0)
|
|
@@ -1477,28 +1498,28 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1477
1498
|
]),
|
|
1478
1499
|
_: 3
|
|
1479
1500
|
}, 16, ["modelValue", "title", "before-close"]),
|
|
1480
|
-
|
|
1501
|
+
v(u(q), {
|
|
1481
1502
|
modelValue: e.remove.show,
|
|
1482
|
-
"onUpdate:modelValue":
|
|
1503
|
+
"onUpdate:modelValue": l[7] || (l[7] = (t) => e.remove.show = t),
|
|
1483
1504
|
title: e.remove.title,
|
|
1484
1505
|
"close-on-click-modal": !1
|
|
1485
1506
|
}, {
|
|
1486
1507
|
footer: h(() => [
|
|
1487
|
-
x("span",
|
|
1488
|
-
|
|
1508
|
+
x("span", Je, [
|
|
1509
|
+
v(u(F), {
|
|
1489
1510
|
onClick: e.remove.close
|
|
1490
1511
|
}, {
|
|
1491
|
-
default: h(() => [...
|
|
1512
|
+
default: h(() => [...l[22] || (l[22] = [
|
|
1492
1513
|
V("关闭", -1)
|
|
1493
1514
|
])]),
|
|
1494
1515
|
_: 1
|
|
1495
1516
|
}, 8, ["onClick"]),
|
|
1496
|
-
|
|
1517
|
+
v(u(F), {
|
|
1497
1518
|
type: "danger",
|
|
1498
1519
|
onClick: e.remove.submit,
|
|
1499
1520
|
loading: e.remove.loading
|
|
1500
1521
|
}, {
|
|
1501
|
-
default: h(() => [...
|
|
1522
|
+
default: h(() => [...l[23] || (l[23] = [
|
|
1502
1523
|
V(" 确认删除 ", -1)
|
|
1503
1524
|
])]),
|
|
1504
1525
|
_: 1
|
|
@@ -1506,25 +1527,25 @@ const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ A({
|
|
|
1506
1527
|
])
|
|
1507
1528
|
]),
|
|
1508
1529
|
default: h(() => [
|
|
1509
|
-
x("div", null, "确认要删除【" +
|
|
1530
|
+
x("div", null, "确认要删除【" + W(e.remove.items.length) + "】条数据吗?", 1)
|
|
1510
1531
|
]),
|
|
1511
1532
|
_: 1
|
|
1512
1533
|
}, 8, ["modelValue", "title"]),
|
|
1513
|
-
|
|
1534
|
+
v(ve, {
|
|
1514
1535
|
ref_key: "switchConfirmRef",
|
|
1515
|
-
ref:
|
|
1536
|
+
ref: f
|
|
1516
1537
|
}, null, 512)
|
|
1517
1538
|
]);
|
|
1518
1539
|
};
|
|
1519
1540
|
}
|
|
1520
1541
|
});
|
|
1521
|
-
class
|
|
1542
|
+
class qe {
|
|
1522
1543
|
/**
|
|
1523
1544
|
* 通过文件远程地址下载文件
|
|
1524
1545
|
*/
|
|
1525
1546
|
static async download(i, d = "download.png") {
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1547
|
+
const s = document.createElement("a");
|
|
1548
|
+
s.style.display = "none", s.href = i, 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(i);
|
|
1528
1549
|
}
|
|
1529
1550
|
/**
|
|
1530
1551
|
* 将json对象或者json数组导出为json文件保存
|
|
@@ -1532,52 +1553,52 @@ class We {
|
|
|
1532
1553
|
* @param name
|
|
1533
1554
|
*/
|
|
1534
1555
|
static exportJSONFile = (i, d) => {
|
|
1535
|
-
const
|
|
1536
|
-
m.href =
|
|
1556
|
+
const s = new Blob([JSON.stringify(i)], { type: "application/json" }), f = URL.createObjectURL(s), m = document.createElement("a");
|
|
1557
|
+
m.href = f, m.download = `${d || "config"}.json`, m.click();
|
|
1537
1558
|
};
|
|
1538
1559
|
/**
|
|
1539
1560
|
* 导入文件内容,默认为json
|
|
1540
1561
|
* @param param
|
|
1541
1562
|
* @returns
|
|
1542
1563
|
*/
|
|
1543
|
-
static importFile = async (i) => new Promise((d,
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1564
|
+
static importFile = async (i) => new Promise((d, s) => {
|
|
1565
|
+
const f = document.createElement("input");
|
|
1566
|
+
f.type = "file";
|
|
1546
1567
|
const m = i?.accept || ".json";
|
|
1547
|
-
|
|
1568
|
+
f.accept = m, f.style.display = "none", f.onchange = (r) => {
|
|
1548
1569
|
const e = r.target.files[0];
|
|
1549
1570
|
if (!e) {
|
|
1550
|
-
D.fail("未选择文件"),
|
|
1571
|
+
D.fail("未选择文件"), s("未选择文件");
|
|
1551
1572
|
return;
|
|
1552
1573
|
}
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1556
|
-
d(
|
|
1557
|
-
},
|
|
1558
|
-
D.fail("文件读取失败"),
|
|
1559
|
-
},
|
|
1560
|
-
}, document.body.appendChild(
|
|
1574
|
+
const n = new FileReader();
|
|
1575
|
+
n.onload = async (l) => {
|
|
1576
|
+
const o = m == ".json" ? JSON.parse(l.target.result) : l.target.result;
|
|
1577
|
+
d(o);
|
|
1578
|
+
}, n.onerror = () => {
|
|
1579
|
+
D.fail("文件读取失败"), s("文件读取失败");
|
|
1580
|
+
}, n.readAsText(e), document.body.removeChild(f);
|
|
1581
|
+
}, document.body.appendChild(f), f.click();
|
|
1561
1582
|
});
|
|
1562
1583
|
}
|
|
1563
|
-
const
|
|
1564
|
-
if (
|
|
1584
|
+
const Ke = (p, i) => {
|
|
1585
|
+
if (p.component("TCurd", We), p.component("TFormList", Q), p.component("TColumn", ge), i?.customComponent) {
|
|
1565
1586
|
S.customComponent = i.customComponent;
|
|
1566
1587
|
for (const d in i.customComponent)
|
|
1567
|
-
|
|
1588
|
+
p.component(d, i.customComponent[d]);
|
|
1568
1589
|
}
|
|
1569
|
-
},
|
|
1570
|
-
install:
|
|
1590
|
+
}, Xe = {
|
|
1591
|
+
install: Ke
|
|
1571
1592
|
};
|
|
1572
1593
|
export {
|
|
1573
1594
|
j as ArrUtil,
|
|
1574
1595
|
we as ExcelUtil,
|
|
1575
1596
|
ge as TColumn,
|
|
1576
|
-
|
|
1577
|
-
|
|
1597
|
+
We as TCurd,
|
|
1598
|
+
qe as TFile,
|
|
1578
1599
|
S as TForm,
|
|
1579
1600
|
Q as TFormList,
|
|
1580
1601
|
D as TSys,
|
|
1581
|
-
|
|
1582
|
-
|
|
1602
|
+
Xe as default,
|
|
1603
|
+
Ke as install
|
|
1583
1604
|
};
|