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