cc1-form 1.0.3 → 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 -364
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +108 -26
- 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
|
|
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
|
*/
|
|
@@ -24,13 +24,13 @@ class O {
|
|
|
24
24
|
* @param data 数据
|
|
25
25
|
* @returns 是否显示
|
|
26
26
|
*/
|
|
27
|
-
static isFun = (d,
|
|
27
|
+
static isFun = (d, r) => typeof d == "function" ? d(r) : d;
|
|
28
28
|
/**
|
|
29
29
|
* 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
|
|
30
30
|
*/
|
|
31
31
|
static getRouterParams = () => {
|
|
32
|
-
const d = this.router.currentRoute.value.query || {},
|
|
33
|
-
return Object.keys(d).length ? d : Object.keys(
|
|
32
|
+
const d = this.router.currentRoute.value.query || {}, r = this.router.currentRoute.value.params || {};
|
|
33
|
+
return Object.keys(d).length ? d : Object.keys(r).length ? r : {};
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* 模块赋值
|
|
@@ -41,10 +41,10 @@ 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
|
|
47
|
-
return
|
|
46
|
+
const r = await U.moduleObj[d]();
|
|
47
|
+
return r.default ?? r;
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* 提示信息对象管理
|
|
@@ -60,18 +60,18 @@ class O {
|
|
|
60
60
|
* @param type 消息类型
|
|
61
61
|
* @param options 其他选项
|
|
62
62
|
*/
|
|
63
|
-
static showMessage(d,
|
|
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
|
-
type:
|
|
70
|
+
type: r
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
n
|
|
73
73
|
);
|
|
74
|
-
|
|
74
|
+
de(f), setTimeout(() => {
|
|
75
75
|
delete this.tipMessages[d];
|
|
76
76
|
}, this.tipMessagesGap);
|
|
77
77
|
}
|
|
@@ -81,16 +81,16 @@ class O {
|
|
|
81
81
|
* @param content
|
|
82
82
|
* @param options
|
|
83
83
|
*/
|
|
84
|
-
static fail = (d,
|
|
85
|
-
this.showMessage(d, "error",
|
|
84
|
+
static fail = (d, r = {}) => {
|
|
85
|
+
this.showMessage(d, "error", r);
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
88
|
* 成功提示
|
|
89
89
|
* @param content
|
|
90
90
|
* @param options
|
|
91
91
|
*/
|
|
92
|
-
static success = (d,
|
|
93
|
-
this.showMessage(d, "success",
|
|
92
|
+
static success = (d, r = {}) => {
|
|
93
|
+
this.showMessage(d, "success", r);
|
|
94
94
|
};
|
|
95
95
|
static loadingObj = null;
|
|
96
96
|
static loadingTimer = null;
|
|
@@ -99,11 +99,11 @@ class O {
|
|
|
99
99
|
* @param show
|
|
100
100
|
* @param text
|
|
101
101
|
*/
|
|
102
|
-
static loading = (d = !0,
|
|
102
|
+
static loading = (d = !0, r = "加载中") => {
|
|
103
103
|
Timer.un(this.loadingTimer), this.loadingTimer = Timer.once(() => {
|
|
104
|
-
d ? this.loadingObj =
|
|
104
|
+
d ? this.loadingObj = ue.service({
|
|
105
105
|
lock: !0,
|
|
106
|
-
text:
|
|
106
|
+
text: r,
|
|
107
107
|
background: "rgba(0, 0, 0, 0.3)"
|
|
108
108
|
}) : this.loadingObj && (this.loadingObj.close(), this.loadingObj = null);
|
|
109
109
|
}, 50);
|
|
@@ -113,13 +113,13 @@ class O {
|
|
|
113
113
|
* @param url 地址
|
|
114
114
|
* @param isCenter 是否居中
|
|
115
115
|
*/
|
|
116
|
-
static openUrl = (d,
|
|
117
|
-
if (
|
|
118
|
-
let
|
|
116
|
+
static openUrl = (d, r = !0) => {
|
|
117
|
+
if (r) {
|
|
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 (
|
|
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 =
|
|
152
|
-
|
|
150
|
+
}).then(function(i) {
|
|
151
|
+
let e = i.toDataURL("image/png");
|
|
152
|
+
r(e);
|
|
153
153
|
});
|
|
154
|
-
} catch (
|
|
155
|
-
|
|
154
|
+
} catch (i) {
|
|
155
|
+
n(i);
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
/**
|
|
159
|
-
* 下载文件
|
|
160
|
-
*/
|
|
161
|
-
static async download(d, i = "download.png") {
|
|
162
|
-
const r = document.createElement("a");
|
|
163
|
-
r.style.display = "none", r.href = d, r.setAttribute("download", i), typeof r.download > "u" && r.setAttribute("target", "_blank"), document.body.appendChild(r), r.click(), document.body.removeChild(r), window.URL.revokeObjectURL(d);
|
|
164
|
-
}
|
|
165
158
|
}
|
|
166
|
-
class
|
|
159
|
+
class L {
|
|
167
160
|
/**
|
|
168
161
|
* 自定义组件
|
|
169
162
|
*/
|
|
@@ -174,10 +167,10 @@ class j {
|
|
|
174
167
|
* @param field
|
|
175
168
|
* @returns
|
|
176
169
|
*/
|
|
177
|
-
static findOptions = (d,
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
return
|
|
170
|
+
static findOptions = (d, r) => {
|
|
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,
|
|
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,
|
|
212
|
-
d ?
|
|
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,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
let
|
|
231
|
-
|
|
232
|
-
}), c._id || (c._id =
|
|
220
|
+
static setId = (d, r, n) => {
|
|
221
|
+
r[d] || (r[d] = []), r[d].forEach((c) => {
|
|
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,17 +232,17 @@ class L {
|
|
|
239
232
|
* @param itemFields 元素字段-如:[{label:'',value:''}]
|
|
240
233
|
* @param callback 回调函数
|
|
241
234
|
*/
|
|
242
|
-
static add = (d,
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
(
|
|
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) => {
|
|
247
240
|
let s = e.default ?? "";
|
|
248
|
-
return e.type === "number" && (s = e.default ?? 0), e.type === "boolean" && (s = e.default ?? !1), e.type === "time" && (s = e.default ?? /* @__PURE__ */ new Date()),
|
|
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
|
-
), c?.(
|
|
245
|
+
), c?.(r);
|
|
253
246
|
};
|
|
254
247
|
/**
|
|
255
248
|
* 删除数组元素
|
|
@@ -258,8 +251,8 @@ class L {
|
|
|
258
251
|
* @param item 元素-如:{_id:''}
|
|
259
252
|
* @param callback 回调函数
|
|
260
253
|
*/
|
|
261
|
-
static remove = (d,
|
|
262
|
-
|
|
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的数据
|
|
@@ -267,14 +260,14 @@ class L {
|
|
|
267
260
|
* @param childernField 子级字段-如:list、children
|
|
268
261
|
* @returns 没有id的数据
|
|
269
262
|
*/
|
|
270
|
-
static getNoIdData = (d,
|
|
271
|
-
const
|
|
272
|
-
return
|
|
273
|
-
c._id && delete c._id,
|
|
274
|
-
}),
|
|
263
|
+
static getNoIdData = (d, r) => {
|
|
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" }
|
|
@@ -316,73 +309,73 @@ const me = {
|
|
|
316
309
|
}
|
|
317
310
|
},
|
|
318
311
|
emits: ["change"],
|
|
319
|
-
setup(
|
|
320
|
-
const
|
|
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 (
|
|
330
|
+
return (f, i) => {
|
|
338
331
|
const e = Z("el-button"), s = Z("el-input");
|
|
339
|
-
return
|
|
340
|
-
k(
|
|
341
|
-
|
|
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
|
}
|
|
385
|
-
}),
|
|
378
|
+
}), ye = { class: "row curd-row" }, ge = /* @__PURE__ */ P({
|
|
386
379
|
__name: "column",
|
|
387
380
|
props: {
|
|
388
381
|
/**
|
|
@@ -390,53 +383,59 @@ const me = {
|
|
|
390
383
|
*/
|
|
391
384
|
option: {
|
|
392
385
|
default: {}
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* 类型
|
|
389
|
+
*/
|
|
390
|
+
type: {
|
|
391
|
+
default: ""
|
|
393
392
|
}
|
|
394
393
|
},
|
|
395
|
-
setup(
|
|
396
|
-
const
|
|
394
|
+
setup(m, { expose: d }) {
|
|
395
|
+
const r = U.isFun, n = U.EDialog, c = T(), f = m, i = q({
|
|
397
396
|
rules: {},
|
|
398
|
-
show: !
|
|
399
|
-
showContent: !1,
|
|
400
|
-
loading: !1,
|
|
401
|
-
type: r.Insert,
|
|
397
|
+
show: !0,
|
|
402
398
|
form: {},
|
|
403
399
|
formDefault: {},
|
|
404
400
|
formColumn: [],
|
|
405
|
-
getDisabled: (e) => e.disabled?.[
|
|
401
|
+
getDisabled: (e) => e.disabled?.[(f.type || n.Insert) === n.Insert ? "create" : "update"],
|
|
406
402
|
initColumnForm: () => {
|
|
407
|
-
const e =
|
|
408
|
-
|
|
409
|
-
const s = [], l =
|
|
403
|
+
const e = f.option;
|
|
404
|
+
i.formColumn = [];
|
|
405
|
+
const s = [], l = f.option.form?.maxSpan || 12, o = f.option.form?.defaultSpan || l;
|
|
410
406
|
let t = [];
|
|
411
|
-
const a = (
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
let
|
|
415
|
-
const
|
|
416
|
-
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);
|
|
417
413
|
}
|
|
418
414
|
};
|
|
419
|
-
e.column.forEach((
|
|
420
|
-
|
|
421
|
-
}), t.length > 0 && s.push(t),
|
|
415
|
+
e.column.forEach((h) => {
|
|
416
|
+
h.isForm = !0, a(h);
|
|
417
|
+
}), t.length > 0 && s.push(t), i.formColumn = s;
|
|
418
|
+
},
|
|
419
|
+
init: async () => {
|
|
420
|
+
i.show = !1, await ne(), i.initColumnForm(), i.show = !0;
|
|
422
421
|
}
|
|
423
422
|
});
|
|
424
|
-
return
|
|
423
|
+
return i.initColumnForm(), d({
|
|
425
424
|
ref: c,
|
|
426
|
-
conf:
|
|
427
|
-
}), (e, s) => (p(), g(u(
|
|
425
|
+
conf: i
|
|
426
|
+
}), (e, s) => (p(), g(u(A), {
|
|
428
427
|
ref_key: "ruleFormRef",
|
|
429
428
|
ref: c,
|
|
430
|
-
model:
|
|
431
|
-
rules:
|
|
429
|
+
model: i.form,
|
|
430
|
+
rules: i.rules
|
|
432
431
|
}, {
|
|
433
|
-
default:
|
|
434
|
-
|
|
432
|
+
default: b(() => [
|
|
433
|
+
i.show ? (p(!0), w(O, { key: 0 }, I(i.formColumn, (l) => (p(), w("div", ye, [
|
|
435
434
|
k(e.$slots, "form-start", {
|
|
436
|
-
row:
|
|
435
|
+
row: i.form
|
|
437
436
|
}),
|
|
438
|
-
(p(!0), w(
|
|
439
|
-
u(
|
|
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", {
|
|
440
439
|
key: 0,
|
|
441
440
|
class: X(o.item.form.span > 0 ? `col-${o.item.form.span}` : "col")
|
|
442
441
|
}, [
|
|
@@ -445,73 +444,73 @@ const me = {
|
|
|
445
444
|
prop: o.item.key,
|
|
446
445
|
"label-width": o.item.form?.labelWidth || "100px"
|
|
447
446
|
}, {
|
|
448
|
-
default:
|
|
447
|
+
default: b(() => [
|
|
449
448
|
k(e.$slots, "form-" + o.item.key + "-start", {
|
|
450
|
-
row:
|
|
449
|
+
row: i.form,
|
|
451
450
|
item: o.item
|
|
452
451
|
}),
|
|
453
452
|
k(e.$slots, "form-" + o.item.key, {
|
|
454
|
-
row:
|
|
453
|
+
row: i.form,
|
|
455
454
|
item: o.item
|
|
456
455
|
}, () => [
|
|
457
|
-
o.item.type === "input" ? (p(), g(u(K),
|
|
456
|
+
o.item.type === "input" ? (p(), g(u(K), E({
|
|
458
457
|
key: 0,
|
|
459
|
-
modelValue:
|
|
460
|
-
"onUpdate:modelValue": (t) =>
|
|
461
|
-
}, { ref_for: !0 }, o.item.options?.input, F(o.item.options?.input?.on), {
|
|
462
|
-
disabled:
|
|
463
|
-
}), 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({
|
|
464
463
|
key: 1,
|
|
465
|
-
modelValue:
|
|
466
|
-
"onUpdate:modelValue": (t) =>
|
|
464
|
+
modelValue: i.form[o.item.key],
|
|
465
|
+
"onUpdate:modelValue": (t) => i.form[o.item.key] = t
|
|
467
466
|
}, { ref_for: !0 }, o.item.options?.switch, F(o.item.options?.switch?.on || {}), {
|
|
468
|
-
disabled:
|
|
469
|
-
}), 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({
|
|
470
469
|
key: 2,
|
|
471
|
-
modelValue:
|
|
472
|
-
"onUpdate:modelValue": (t) =>
|
|
470
|
+
modelValue: i.form[o.item.key],
|
|
471
|
+
"onUpdate:modelValue": (t) => i.form[o.item.key] = t
|
|
473
472
|
}, { ref_for: !0 }, o.item.options?.select, F(o.item.options?.select?.on || {}), {
|
|
474
|
-
disabled:
|
|
473
|
+
disabled: i.getDisabled(o.item),
|
|
475
474
|
style: { width: "100%" }
|
|
476
475
|
}), {
|
|
477
|
-
default:
|
|
478
|
-
(p(!0), w(
|
|
476
|
+
default: b(() => [
|
|
477
|
+
(p(!0), w(O, null, I(o.item.options?.select?.data, (t) => (p(), g(u(M), {
|
|
479
478
|
key: t.value,
|
|
480
479
|
label: t.label,
|
|
481
480
|
value: t.value
|
|
482
481
|
}, null, 8, ["label", "value"]))), 128))
|
|
483
482
|
]),
|
|
484
483
|
_: 2
|
|
485
|
-
}, 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({
|
|
486
485
|
key: 3,
|
|
487
|
-
row:
|
|
486
|
+
row: i.form,
|
|
488
487
|
field: o.item.key
|
|
489
488
|
}, { ref_for: !0 }, o.item.options?.list, F(o.item.options?.list?.on || {}), {
|
|
490
|
-
disabled:
|
|
489
|
+
disabled: i.getDisabled(o.item),
|
|
491
490
|
style: { width: "100%" }
|
|
492
|
-
}), 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({
|
|
493
492
|
key: 4,
|
|
494
|
-
modelValue:
|
|
495
|
-
"onUpdate:modelValue": (t) =>
|
|
493
|
+
modelValue: i.form[o.item.key],
|
|
494
|
+
"onUpdate:modelValue": (t) => i.form[o.item.key] = t
|
|
496
495
|
}, { ref_for: !0 }, o.item.options?.treeSelect, F(o.item.options?.treeSelect?.on || {}), {
|
|
497
|
-
disabled:
|
|
496
|
+
disabled: i.getDisabled(o.item),
|
|
498
497
|
style: { width: "100%" }
|
|
499
|
-
}), 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({
|
|
500
499
|
key: 5,
|
|
501
|
-
modelValue:
|
|
502
|
-
"onUpdate:modelValue": (t) =>
|
|
500
|
+
modelValue: i.form[o.item.key],
|
|
501
|
+
"onUpdate:modelValue": (t) => i.form[o.item.key] = t
|
|
503
502
|
}, { ref_for: !0 }, o.item.options?.datetime, F(o.item.options?.datetime?.on || {}), {
|
|
504
|
-
disabled:
|
|
505
|
-
}), 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({
|
|
506
505
|
key: 6,
|
|
507
|
-
modelValue:
|
|
508
|
-
"onUpdate:modelValue": (t) =>
|
|
506
|
+
modelValue: i.form[o.item.key],
|
|
507
|
+
"onUpdate:modelValue": (t) => i.form[o.item.key] = t
|
|
509
508
|
}, { ref_for: !0 }, o.item.options?.[o.item.type], F(o.item.options?.[o.item.type]?.on || {}), {
|
|
510
|
-
disabled:
|
|
509
|
+
disabled: i.getDisabled(o.item)
|
|
511
510
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
|
|
512
511
|
]),
|
|
513
512
|
k(e.$slots, "form-" + o.item.key + "-end", {
|
|
514
|
-
row:
|
|
513
|
+
row: i.form,
|
|
515
514
|
item: o.item
|
|
516
515
|
})
|
|
517
516
|
]),
|
|
@@ -520,7 +519,7 @@ const me = {
|
|
|
520
519
|
], 2)) : C("", !0)
|
|
521
520
|
], 64))), 256)),
|
|
522
521
|
k(e.$slots, "form-end", {
|
|
523
|
-
row:
|
|
522
|
+
row: i.form
|
|
524
523
|
})
|
|
525
524
|
]))), 256)) : C("", !0)
|
|
526
525
|
]),
|
|
@@ -528,48 +527,48 @@ const me = {
|
|
|
528
527
|
}, 8, ["model", "rules"]));
|
|
529
528
|
}
|
|
530
529
|
});
|
|
531
|
-
class
|
|
530
|
+
class we {
|
|
532
531
|
/**
|
|
533
532
|
* 导出Excel
|
|
534
533
|
* @param data 数据
|
|
535
534
|
* @param columns 列
|
|
536
535
|
* @param fileName 文件名
|
|
537
536
|
*/
|
|
538
|
-
static exportToExcel = async (d,
|
|
539
|
-
const c = await
|
|
537
|
+
static exportToExcel = async (d, r, n) => {
|
|
538
|
+
const c = await U.loadModule("xlsx"), f = d.map((s) => {
|
|
540
539
|
const l = {};
|
|
541
|
-
return
|
|
540
|
+
return r.forEach((o) => {
|
|
542
541
|
l[o.label] = s[o.key];
|
|
543
542
|
}), l;
|
|
544
|
-
}),
|
|
545
|
-
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`);
|
|
546
545
|
};
|
|
547
546
|
}
|
|
548
|
-
const
|
|
547
|
+
const ke = { class: "dialog-footer" }, ve = /* @__PURE__ */ P({
|
|
549
548
|
__name: "switchConfirm",
|
|
550
|
-
setup(
|
|
551
|
-
const
|
|
552
|
-
let
|
|
553
|
-
const e = (o) => (o?.title && (
|
|
554
|
-
|
|
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;
|
|
555
554
|
})), s = () => {
|
|
556
|
-
|
|
555
|
+
r.value = !1, f?.(!0), f = null, i = null;
|
|
557
556
|
}, l = () => {
|
|
558
|
-
|
|
557
|
+
r.value = !1, i?.(new Error("用户取消操作")), f = null, i = null;
|
|
559
558
|
};
|
|
560
559
|
return d({
|
|
561
560
|
open: e
|
|
562
561
|
}), (o, t) => (p(), g(u(G), {
|
|
563
|
-
modelValue:
|
|
564
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) =>
|
|
565
|
-
title:
|
|
562
|
+
modelValue: r.value,
|
|
563
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => r.value = a),
|
|
564
|
+
title: n.value,
|
|
566
565
|
"close-on-click-modal": !1,
|
|
567
566
|
width: "400px"
|
|
568
567
|
}, {
|
|
569
|
-
footer:
|
|
570
|
-
|
|
568
|
+
footer: b(() => [
|
|
569
|
+
x("span", ke, [
|
|
571
570
|
v(u(S), { onClick: l }, {
|
|
572
|
-
default:
|
|
571
|
+
default: b(() => [...t[1] || (t[1] = [
|
|
573
572
|
V("取消", -1)
|
|
574
573
|
])]),
|
|
575
574
|
_: 1
|
|
@@ -578,35 +577,35 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
578
577
|
type: "primary",
|
|
579
578
|
onClick: s
|
|
580
579
|
}, {
|
|
581
|
-
default:
|
|
580
|
+
default: b(() => [...t[2] || (t[2] = [
|
|
582
581
|
V("确认", -1)
|
|
583
582
|
])]),
|
|
584
583
|
_: 1
|
|
585
584
|
})
|
|
586
585
|
])
|
|
587
586
|
]),
|
|
588
|
-
default:
|
|
589
|
-
|
|
587
|
+
default: b(() => [
|
|
588
|
+
x("div", null, W(c.value), 1)
|
|
590
589
|
]),
|
|
591
590
|
_: 1
|
|
592
591
|
}, 8, ["modelValue", "title"]));
|
|
593
592
|
}
|
|
594
|
-
}),
|
|
593
|
+
}), Ce = { class: "col relative cc1-form-box" }, Ve = {
|
|
595
594
|
class: "absolute row fit",
|
|
596
595
|
style: { overflow: "hidden" }
|
|
597
|
-
},
|
|
596
|
+
}, Ee = { class: "col column" }, Ue = {
|
|
598
597
|
key: 0,
|
|
599
598
|
class: "relative curd-search"
|
|
600
|
-
},
|
|
599
|
+
}, De = { class: "mb-20 flex justify-between items-center" }, xe = {
|
|
601
600
|
class: "flex items-center",
|
|
602
601
|
style: { gap: "10px" }
|
|
603
|
-
},
|
|
602
|
+
}, $e = { key: 0 }, Oe = { key: 1 }, Se = { key: 2 }, Fe = { class: "export-btn" }, Ie = {
|
|
604
603
|
class: "flex items-center",
|
|
605
604
|
style: { gap: "10px" }
|
|
606
|
-
},
|
|
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 = {
|
|
607
606
|
class: "row form-item-content",
|
|
608
607
|
style: { width: "100%" }
|
|
609
|
-
},
|
|
608
|
+
}, Me = { class: "col" }, _e = { class: "dialog-footer" }, Ne = { class: "dialog-footer" }, Pe = /* @__PURE__ */ P({
|
|
610
609
|
__name: "index",
|
|
611
610
|
props: {
|
|
612
611
|
/**
|
|
@@ -616,8 +615,8 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
616
615
|
default: {}
|
|
617
616
|
}
|
|
618
617
|
},
|
|
619
|
-
setup(
|
|
620
|
-
const
|
|
618
|
+
setup(m, { expose: d }) {
|
|
619
|
+
const r = U.EDialog, n = m, c = T(), f = T(), i = U.isFun, e = q({
|
|
621
620
|
search: {
|
|
622
621
|
column: {
|
|
623
622
|
list: []
|
|
@@ -626,16 +625,16 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
626
625
|
formDefault: {},
|
|
627
626
|
getFormData: () => {
|
|
628
627
|
let s = {};
|
|
629
|
-
|
|
628
|
+
n.option.column.forEach((o) => {
|
|
630
629
|
(typeof o.show?.search == "function" ? o.show?.search(e.search.form) : o.show?.search) && (s[o.key] = e.search.form[o.key]);
|
|
631
630
|
});
|
|
632
|
-
const l =
|
|
631
|
+
const l = n.option.search?.before?.(s);
|
|
633
632
|
return l && (s = l), s;
|
|
634
633
|
},
|
|
635
634
|
reset: () => {
|
|
636
635
|
const s = e.search.formDefault;
|
|
637
636
|
Object.keys(s).forEach((l) => {
|
|
638
|
-
|
|
637
|
+
n.option.search?.resetMode === "default" ? s[l] = e.search.formDefault[l] : s[l] = void 0;
|
|
639
638
|
}), e.search.form = JSONUtil.cp(s), e.page.num = 1, e.table.getList();
|
|
640
639
|
},
|
|
641
640
|
submit: () => {
|
|
@@ -643,11 +642,11 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
643
642
|
}
|
|
644
643
|
},
|
|
645
644
|
page: {
|
|
646
|
-
size:
|
|
647
|
-
sizeList:
|
|
645
|
+
size: n.option.page?.size || 10,
|
|
646
|
+
sizeList: n.option.page?.sizeList || [10, 20, 50, 100],
|
|
648
647
|
num: 1,
|
|
649
648
|
total: 0,
|
|
650
|
-
layout:
|
|
649
|
+
layout: n.option.page?.layout || "total, sizes, prev, pager, next, jumper"
|
|
651
650
|
},
|
|
652
651
|
table: {
|
|
653
652
|
loading: !1,
|
|
@@ -693,16 +692,16 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
693
692
|
},
|
|
694
693
|
getList: async () => {
|
|
695
694
|
e.table.loading = !0;
|
|
696
|
-
const s =
|
|
695
|
+
const s = n.option.api.list, l = await s({
|
|
697
696
|
size: e.page.size,
|
|
698
697
|
num: e.page.num,
|
|
699
698
|
...e.search.getFormData(),
|
|
700
|
-
final(a,
|
|
699
|
+
final(a, h, $) {
|
|
701
700
|
e.table.loading = !1;
|
|
702
701
|
}
|
|
703
702
|
}), o = l.data || { list: l };
|
|
704
703
|
let t = Array.isArray(o.list) ? o.list : o;
|
|
705
|
-
e.table.data =
|
|
704
|
+
e.table.data = n.option.data ? await n.option.data(t) : t, e.page.total = o.total || 0;
|
|
706
705
|
},
|
|
707
706
|
selection: {
|
|
708
707
|
list: [],
|
|
@@ -712,26 +711,26 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
712
711
|
},
|
|
713
712
|
exportFun: {
|
|
714
713
|
start: async (s) => {
|
|
715
|
-
let l = await e.table.exportFun[s](), o =
|
|
714
|
+
let l = await e.table.exportFun[s](), o = n.option.column;
|
|
716
715
|
const t = JSONUtil.cp({
|
|
717
716
|
data: l,
|
|
718
717
|
columns: o
|
|
719
|
-
}), a =
|
|
720
|
-
a.before && a.before(t),
|
|
718
|
+
}), a = n.option.tools?.export || {};
|
|
719
|
+
a.before && a.before(t), we.exportToExcel(t.data, t.columns, a.fileName);
|
|
721
720
|
},
|
|
722
721
|
select: () => {
|
|
723
722
|
if (e.table.selection.list.length === 0)
|
|
724
|
-
throw
|
|
723
|
+
throw U.fail("请选择要导出的数据"), new Error("请选择要导出的数据");
|
|
725
724
|
return e.table.selection.list;
|
|
726
725
|
},
|
|
727
726
|
page: () => {
|
|
728
727
|
if (e.table.data.length === 0)
|
|
729
|
-
throw
|
|
728
|
+
throw U.fail("暂无数据"), new Error("暂无数据");
|
|
730
729
|
return e.table.data;
|
|
731
730
|
},
|
|
732
731
|
all: async () => {
|
|
733
732
|
e.table.loading = !0;
|
|
734
|
-
const s =
|
|
733
|
+
const s = n.option.api.list, { data: l } = await s({
|
|
735
734
|
size: 999999,
|
|
736
735
|
num: 1,
|
|
737
736
|
final(o, t, a) {
|
|
@@ -751,11 +750,11 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
751
750
|
show: !1,
|
|
752
751
|
showContent: !1,
|
|
753
752
|
loading: !1,
|
|
754
|
-
type:
|
|
753
|
+
type: r.Insert,
|
|
755
754
|
form: {},
|
|
756
755
|
formDefault: {},
|
|
757
756
|
formColumn: [],
|
|
758
|
-
getDisabled: (s) => s.disabled?.[e.update.type ===
|
|
757
|
+
getDisabled: (s) => s.disabled?.[e.update.type === r.Insert ? "create" : "update"],
|
|
759
758
|
edit: {
|
|
760
759
|
/**
|
|
761
760
|
* 编辑原数据
|
|
@@ -765,7 +764,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
765
764
|
* 将form填入数据和data比对差异数据返回
|
|
766
765
|
*/
|
|
767
766
|
getApiData: (s) => {
|
|
768
|
-
if (
|
|
767
|
+
if (n.option.form?.editAll)
|
|
769
768
|
return s;
|
|
770
769
|
let l = {
|
|
771
770
|
_id: e.update.edit.data._id
|
|
@@ -778,18 +777,18 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
778
777
|
open: (s, l) => {
|
|
779
778
|
e.update.showContent || FunUtil.throttle(async () => {
|
|
780
779
|
e.update.type = s;
|
|
781
|
-
const o = s ===
|
|
782
|
-
e.update.edit.data = l, e.update.title = o ? "新增" : "编辑", e.update.form = JSONUtil.cp(o ? e.update.formDefault : l), await
|
|
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);
|
|
783
782
|
});
|
|
784
783
|
},
|
|
785
784
|
submit: () => {
|
|
786
785
|
FunUtil.throttle(async () => {
|
|
787
|
-
await
|
|
788
|
-
o || (
|
|
786
|
+
await f.value?.validate(async (o, t) => new Promise((a, h) => {
|
|
787
|
+
o || (U.fail("请检查表单数据"), h(!1)), a();
|
|
789
788
|
})), e.update.loading = !0;
|
|
790
|
-
const s = e.update.type ===
|
|
789
|
+
const s = e.update.type === r.Insert ? n.option.api.create : n.option.api.update;
|
|
791
790
|
let l = JSONUtil.cp(e.update.form);
|
|
792
|
-
delete l.children, await
|
|
791
|
+
delete l.children, await n.option.form?.submitBefore?.(l, e.update), Object.keys(l).forEach((o) => {
|
|
793
792
|
if (typeof l[o] == "string" && l[o].indexOf("T") > -1) {
|
|
794
793
|
const t = new Date(l[o]).getTime();
|
|
795
794
|
!isNaN(t) && t > (/* @__PURE__ */ new Date("1971-01-01")).getTime() && (l[o] = t);
|
|
@@ -799,7 +798,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
799
798
|
final(o, t, a) {
|
|
800
799
|
e.update.loading = !1;
|
|
801
800
|
}
|
|
802
|
-
}), e.update.close(), await e.table.getList(),
|
|
801
|
+
}), e.update.close(), await e.table.getList(), n.option.form?.submitAfter?.(l, e.update);
|
|
803
802
|
});
|
|
804
803
|
},
|
|
805
804
|
close: () => {
|
|
@@ -818,7 +817,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
818
817
|
},
|
|
819
818
|
open: (s) => {
|
|
820
819
|
if (s.length === 0) {
|
|
821
|
-
|
|
820
|
+
U.fail("请选择要删除的数据");
|
|
822
821
|
return;
|
|
823
822
|
}
|
|
824
823
|
e.remove.items = s, e.remove.show = !0;
|
|
@@ -826,13 +825,13 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
826
825
|
submit: () => {
|
|
827
826
|
FunUtil.throttle(async () => {
|
|
828
827
|
e.table.loading = !0;
|
|
829
|
-
const s =
|
|
828
|
+
const s = n.option.api.delete;
|
|
830
829
|
await s({
|
|
831
830
|
_id: e.remove.items.map((l) => l._id),
|
|
832
831
|
final(l, o, t) {
|
|
833
832
|
e.table.loading = !1;
|
|
834
833
|
}
|
|
835
|
-
}),
|
|
834
|
+
}), U.success("操作成功"), e.table.data.length <= 1 && e.page.num > 1 && (e.page.num -= 1), e.remove.close(), await e.table.getList();
|
|
836
835
|
});
|
|
837
836
|
}
|
|
838
837
|
},
|
|
@@ -858,7 +857,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
858
857
|
emptyText: "暂无数据",
|
|
859
858
|
highlightCurrentRow: !0
|
|
860
859
|
}
|
|
861
|
-
}, o =
|
|
860
|
+
}, o = n.option;
|
|
862
861
|
Object.keys(l).forEach((t) => {
|
|
863
862
|
o[t] = ObjectUtil.deepMerge(l[t], o[t] || {});
|
|
864
863
|
});
|
|
@@ -869,7 +868,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
869
868
|
* @returns
|
|
870
869
|
*/
|
|
871
870
|
initColumnOptions: () => {
|
|
872
|
-
const s =
|
|
871
|
+
const s = n.option, l = (o) => {
|
|
873
872
|
const a = {
|
|
874
873
|
options: {
|
|
875
874
|
switch: {
|
|
@@ -877,19 +876,19 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
877
876
|
activeLabel: "开启",
|
|
878
877
|
inactiveValue: !1,
|
|
879
878
|
inactiveLabel: "关闭",
|
|
880
|
-
tableBeforeChange: async (
|
|
881
|
-
const
|
|
879
|
+
tableBeforeChange: async ($, y) => {
|
|
880
|
+
const D = o.options?.switch;
|
|
882
881
|
try {
|
|
883
882
|
return await c.value?.open({
|
|
884
883
|
title: "确认修改",
|
|
885
|
-
content: `确认要${y[
|
|
886
|
-
}), e.table.loading = !0, await
|
|
884
|
+
content: `确认要${y[$] === D.activeValue ? D.inactiveLabel : D.activeLabel}吗?`
|
|
885
|
+
}), e.table.loading = !0, await n.option.api.update({
|
|
887
886
|
_id: y._id,
|
|
888
|
-
[
|
|
889
|
-
final(
|
|
887
|
+
[$]: y[$] === D.activeValue ? D.inactiveValue : D.activeValue,
|
|
888
|
+
final(R, z, Y) {
|
|
890
889
|
e.table.loading = !1;
|
|
891
890
|
}
|
|
892
|
-
}),
|
|
891
|
+
}), U.success("操作成功"), e.table.getList(), !0;
|
|
893
892
|
} catch {
|
|
894
893
|
return !1;
|
|
895
894
|
}
|
|
@@ -924,37 +923,37 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
924
923
|
table: 0,
|
|
925
924
|
form: 0
|
|
926
925
|
}
|
|
927
|
-
},
|
|
928
|
-
Object.keys(a).forEach((
|
|
929
|
-
|
|
926
|
+
}, h = o;
|
|
927
|
+
Object.keys(a).forEach(($) => {
|
|
928
|
+
h[$] = ObjectUtil.deepMerge(a[$], h[$] || {});
|
|
930
929
|
});
|
|
931
930
|
};
|
|
932
931
|
s.column.forEach(l), s.table?.column?.forEach(l);
|
|
933
932
|
},
|
|
934
933
|
initColumnForm: () => {
|
|
935
|
-
const s =
|
|
934
|
+
const s = n.option;
|
|
936
935
|
e.update.formColumn = [], e.table.column.show = {
|
|
937
936
|
list: [],
|
|
938
937
|
listSource: []
|
|
939
938
|
};
|
|
940
|
-
const l = [], o =
|
|
939
|
+
const l = [], o = n.option.form?.maxSpan || 12, t = n.option.form?.defaultSpan || o / 2;
|
|
941
940
|
let a = [];
|
|
942
|
-
const
|
|
941
|
+
const h = (y) => {
|
|
943
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) {
|
|
944
943
|
y.form = y.form || { span: t }, y.form.span = y.form.span ?? t;
|
|
945
|
-
let
|
|
946
|
-
const
|
|
947
|
-
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);
|
|
948
947
|
}
|
|
949
948
|
};
|
|
950
949
|
s.column.forEach((y) => {
|
|
951
|
-
y.isForm = !0,
|
|
952
|
-
}),
|
|
953
|
-
y.isForm = !1,
|
|
954
|
-
}), 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,
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
e.search.formDefault[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];
|
|
958
957
|
}), s.column.forEach((y) => {
|
|
959
958
|
y.show?.search || (e.search.formDefault[y.key] = void 0);
|
|
960
959
|
}), e.search.form = JSONUtil.cp(e.search.formDefault);
|
|
@@ -965,28 +964,28 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
965
964
|
}), d({
|
|
966
965
|
conf: e
|
|
967
966
|
}), (s, l) => {
|
|
968
|
-
const o =
|
|
969
|
-
return p(), w("div",
|
|
970
|
-
|
|
967
|
+
const o = ie("loading");
|
|
968
|
+
return p(), w("div", Ce, [
|
|
969
|
+
x("div", Ve, [
|
|
971
970
|
k(s.$slots, "box-left"),
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
v(u(
|
|
971
|
+
x("div", Ee, [
|
|
972
|
+
m.option.search?.show !== !1 ? (p(), w("div", Ue, [
|
|
973
|
+
v(u(A), {
|
|
975
974
|
model: e.search.form,
|
|
976
975
|
inline: ""
|
|
977
976
|
}, {
|
|
978
|
-
default:
|
|
977
|
+
default: b(() => [
|
|
979
978
|
k(s.$slots, "search-start", {
|
|
980
979
|
row: e.search.form
|
|
981
980
|
}),
|
|
982
|
-
(p(!0), w(
|
|
981
|
+
(p(!0), w(O, null, I(e.search.column.list, (t) => (p(), w(O, {
|
|
983
982
|
key: t.key
|
|
984
983
|
}, [
|
|
985
984
|
(typeof t.show?.search == "function" ? t.show?.search(e.search.form) : t.show?.search) ? (p(), g(u(_), {
|
|
986
985
|
key: 0,
|
|
987
986
|
label: t.label
|
|
988
987
|
}, {
|
|
989
|
-
default:
|
|
988
|
+
default: b(() => [
|
|
990
989
|
k(s.$slots, "search-" + t.key, {
|
|
991
990
|
row: e.search.form
|
|
992
991
|
}, () => [
|
|
@@ -1005,7 +1004,7 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1005
1004
|
clearable: "",
|
|
1006
1005
|
disabled: t.disabled?.search
|
|
1007
1006
|
}, {
|
|
1008
|
-
default:
|
|
1007
|
+
default: b(() => [
|
|
1009
1008
|
(p(), g(u(M), {
|
|
1010
1009
|
key: t.options?.switch?.activeValue,
|
|
1011
1010
|
label: t.options?.switch?.activeLabel,
|
|
@@ -1026,8 +1025,8 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1026
1025
|
clearable: "",
|
|
1027
1026
|
disabled: t.disabled?.search
|
|
1028
1027
|
}, {
|
|
1029
|
-
default:
|
|
1030
|
-
(p(!0), w(
|
|
1028
|
+
default: b(() => [
|
|
1029
|
+
(p(!0), w(O, null, I(t.options?.select?.data, (a) => (p(), g(u(M), {
|
|
1031
1030
|
key: a.value,
|
|
1032
1031
|
label: a.label,
|
|
1033
1032
|
value: a.value
|
|
@@ -1044,22 +1043,22 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1044
1043
|
row: e.search.form
|
|
1045
1044
|
}),
|
|
1046
1045
|
v(u(_), null, {
|
|
1047
|
-
default:
|
|
1048
|
-
|
|
1046
|
+
default: b(() => [
|
|
1047
|
+
m.option.tools?.search ? (p(), g(u(S), {
|
|
1049
1048
|
key: 0,
|
|
1050
1049
|
type: "primary",
|
|
1051
1050
|
onClick: e.search.submit
|
|
1052
1051
|
}, {
|
|
1053
|
-
default:
|
|
1052
|
+
default: b(() => [...l[7] || (l[7] = [
|
|
1054
1053
|
V(" 搜索 ", -1)
|
|
1055
1054
|
])]),
|
|
1056
1055
|
_: 1
|
|
1057
1056
|
}, 8, ["onClick"])) : C("", !0),
|
|
1058
|
-
|
|
1057
|
+
m.option.tools?.reset ? (p(), g(u(S), {
|
|
1059
1058
|
key: 1,
|
|
1060
1059
|
onClick: e.search.reset
|
|
1061
1060
|
}, {
|
|
1062
|
-
default:
|
|
1061
|
+
default: b(() => [...l[8] || (l[8] = [
|
|
1063
1062
|
V("重置", -1)
|
|
1064
1063
|
])]),
|
|
1065
1064
|
_: 1
|
|
@@ -1074,62 +1073,62 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1074
1073
|
_: 3
|
|
1075
1074
|
}, 8, ["model"])
|
|
1076
1075
|
])) : C("", !0),
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
u(
|
|
1076
|
+
x("div", De, [
|
|
1077
|
+
x("div", xe, [
|
|
1078
|
+
u(i)(m.option.tools?.add) ? (p(), w("div", $e, [
|
|
1080
1079
|
v(u(S), {
|
|
1081
1080
|
type: "primary",
|
|
1082
|
-
onClick: l[0] || (l[0] = (t) => e.update.open(u(
|
|
1081
|
+
onClick: l[0] || (l[0] = (t) => e.update.open(u(r).Insert))
|
|
1083
1082
|
}, {
|
|
1084
|
-
default:
|
|
1083
|
+
default: b(() => [...l[9] || (l[9] = [
|
|
1085
1084
|
V("新增", -1)
|
|
1086
1085
|
])]),
|
|
1087
1086
|
_: 1
|
|
1088
1087
|
})
|
|
1089
1088
|
])) : C("", !0),
|
|
1090
|
-
|
|
1089
|
+
m.option.table?.selectable && u(i)(m.option.tools?.delete) ? (p(), w("div", Oe, [
|
|
1091
1090
|
v(u(S), {
|
|
1092
1091
|
type: "danger",
|
|
1093
1092
|
onClick: l[1] || (l[1] = (t) => e.remove.open(e.table.selection.list))
|
|
1094
1093
|
}, {
|
|
1095
|
-
default:
|
|
1094
|
+
default: b(() => [...l[10] || (l[10] = [
|
|
1096
1095
|
V(" 删除 ", -1)
|
|
1097
1096
|
])]),
|
|
1098
1097
|
_: 1
|
|
1099
1098
|
})
|
|
1100
1099
|
])) : C("", !0),
|
|
1101
|
-
|
|
1100
|
+
m.option.tools?.expand ? (p(), w("div", Se, [
|
|
1102
1101
|
v(u(S), {
|
|
1103
1102
|
type: "warning",
|
|
1104
1103
|
onClick: l[2] || (l[2] = (t) => e.table.expand.all())
|
|
1105
1104
|
}, {
|
|
1106
|
-
default:
|
|
1105
|
+
default: b(() => [...l[11] || (l[11] = [
|
|
1107
1106
|
V("展开/收缩", -1)
|
|
1108
1107
|
])]),
|
|
1109
1108
|
_: 1
|
|
1110
1109
|
})
|
|
1111
1110
|
])) : C("", !0),
|
|
1112
|
-
|
|
1111
|
+
m.option.tools?.export?.show ? (p(), g(u(pe), {
|
|
1113
1112
|
key: 3,
|
|
1114
1113
|
onCommand: e.table.export
|
|
1115
1114
|
}, {
|
|
1116
|
-
dropdown:
|
|
1117
|
-
v(u(
|
|
1118
|
-
default:
|
|
1115
|
+
dropdown: b(() => [
|
|
1116
|
+
v(u(ce), null, {
|
|
1117
|
+
default: b(() => [
|
|
1119
1118
|
v(u(B), { command: "select" }, {
|
|
1120
|
-
default:
|
|
1119
|
+
default: b(() => [...l[13] || (l[13] = [
|
|
1121
1120
|
V("导出选中", -1)
|
|
1122
1121
|
])]),
|
|
1123
1122
|
_: 1
|
|
1124
1123
|
}),
|
|
1125
1124
|
v(u(B), { command: "page" }, {
|
|
1126
|
-
default:
|
|
1125
|
+
default: b(() => [...l[14] || (l[14] = [
|
|
1127
1126
|
V("导出本页", -1)
|
|
1128
1127
|
])]),
|
|
1129
1128
|
_: 1
|
|
1130
1129
|
}),
|
|
1131
1130
|
v(u(B), { command: "all" }, {
|
|
1132
|
-
default:
|
|
1131
|
+
default: b(() => [...l[15] || (l[15] = [
|
|
1133
1132
|
V("导出全部", -1)
|
|
1134
1133
|
])]),
|
|
1135
1134
|
_: 1
|
|
@@ -1138,10 +1137,10 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1138
1137
|
_: 1
|
|
1139
1138
|
})
|
|
1140
1139
|
]),
|
|
1141
|
-
default:
|
|
1142
|
-
|
|
1140
|
+
default: b(() => [
|
|
1141
|
+
x("div", Fe, [
|
|
1143
1142
|
v(u(S), { type: "warning" }, {
|
|
1144
|
-
default:
|
|
1143
|
+
default: b(() => [...l[12] || (l[12] = [
|
|
1145
1144
|
V("导出", -1)
|
|
1146
1145
|
])]),
|
|
1147
1146
|
_: 1
|
|
@@ -1152,90 +1151,90 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1152
1151
|
}, 8, ["onCommand"])) : C("", !0),
|
|
1153
1152
|
k(s.$slots, "tools-left")
|
|
1154
1153
|
]),
|
|
1155
|
-
|
|
1154
|
+
x("div", Ie, [
|
|
1156
1155
|
k(s.$slots, "tools-right")
|
|
1157
1156
|
])
|
|
1158
1157
|
]),
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
re((p(), g(u(fe),
|
|
1158
|
+
x("div", je, [
|
|
1159
|
+
x("div", Le, [
|
|
1160
|
+
re((p(), g(u(fe), E({
|
|
1162
1161
|
data: e.table.data
|
|
1163
|
-
},
|
|
1162
|
+
}, m.option.table, {
|
|
1164
1163
|
onSelectionChange: e.table.selection.change,
|
|
1165
1164
|
"expand-row-keys": e.table.expand.rowKeys,
|
|
1166
1165
|
onExpandChange: e.table.expand.change
|
|
1167
1166
|
}), {
|
|
1168
|
-
default:
|
|
1169
|
-
|
|
1167
|
+
default: b(() => [
|
|
1168
|
+
m.option.table?.selectable && u(i)(m.option.tools?.delete) ? (p(), g(u(J), {
|
|
1170
1169
|
key: 0,
|
|
1171
1170
|
type: "selection",
|
|
1172
|
-
selectable: typeof
|
|
1171
|
+
selectable: typeof m.option.table?.selectable == "function" ? m.option.table?.selectable : void 0,
|
|
1173
1172
|
width: "55"
|
|
1174
1173
|
}, null, 8, ["selectable"])) : C("", !0),
|
|
1175
|
-
(p(!0), w(
|
|
1174
|
+
(p(!0), w(O, null, I(e.table.column.list, (t) => (p(), w(O, {
|
|
1176
1175
|
key: t.key
|
|
1177
1176
|
}, [
|
|
1178
|
-
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({
|
|
1179
1178
|
key: 0,
|
|
1180
1179
|
prop: t.key,
|
|
1181
1180
|
label: t.label
|
|
1182
1181
|
}, { ref_for: !0 }, t.table), {
|
|
1183
|
-
default:
|
|
1182
|
+
default: b(({ row: a }) => [
|
|
1184
1183
|
k(s.$slots, "table-" + t.key, {
|
|
1185
1184
|
row: a,
|
|
1186
1185
|
item: t
|
|
1187
1186
|
}, () => [
|
|
1188
|
-
t.type === "switch" ? (p(), g(u(H),
|
|
1187
|
+
t.type === "switch" ? (p(), g(u(H), E({
|
|
1189
1188
|
key: 0,
|
|
1190
1189
|
modelValue: a[t.key],
|
|
1191
|
-
"onUpdate:modelValue": (
|
|
1190
|
+
"onUpdate:modelValue": (h) => a[t.key] = h,
|
|
1192
1191
|
"before-change": () => t.options?.switch?.tableBeforeChange?.(t.key, a)
|
|
1193
|
-
}, { ref_for: !0 }, t.options?.switch), null, 16, ["modelValue", "onUpdate:modelValue", "before-change"])) : (p(), w(
|
|
1194
|
-
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)
|
|
1195
1194
|
], 64))
|
|
1196
1195
|
])
|
|
1197
1196
|
]),
|
|
1198
1197
|
_: 2
|
|
1199
1198
|
}, 1040, ["prop", "label"])) : C("", !0)
|
|
1200
1199
|
], 64))), 128)),
|
|
1201
|
-
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), {
|
|
1202
1201
|
key: 1,
|
|
1203
1202
|
label: "操作",
|
|
1204
1203
|
width: "180",
|
|
1205
1204
|
align: "center",
|
|
1206
1205
|
fixed: "right"
|
|
1207
1206
|
}, {
|
|
1208
|
-
default:
|
|
1207
|
+
default: b(({ row: t }) => [
|
|
1209
1208
|
k(s.$slots, "table-op-left", { row: t }),
|
|
1210
|
-
u(
|
|
1209
|
+
u(i)(m.option.tools?.add, t) ? (p(), g(u(S), {
|
|
1211
1210
|
key: 0,
|
|
1212
1211
|
link: "",
|
|
1213
1212
|
type: "primary",
|
|
1214
|
-
onClick: (a) => e.update.open(u(
|
|
1213
|
+
onClick: (a) => e.update.open(u(r).Insert, t)
|
|
1215
1214
|
}, {
|
|
1216
|
-
default:
|
|
1215
|
+
default: b(() => [...l[16] || (l[16] = [
|
|
1217
1216
|
V(" 新增 ", -1)
|
|
1218
1217
|
])]),
|
|
1219
1218
|
_: 1
|
|
1220
1219
|
}, 8, ["onClick"])) : C("", !0),
|
|
1221
|
-
u(
|
|
1220
|
+
u(i)(m.option.tools?.update, t) ? (p(), g(u(S), {
|
|
1222
1221
|
key: 1,
|
|
1223
1222
|
link: "",
|
|
1224
1223
|
type: "warning",
|
|
1225
|
-
onClick: (a) => e.update.open(u(
|
|
1224
|
+
onClick: (a) => e.update.open(u(r).Update, t)
|
|
1226
1225
|
}, {
|
|
1227
|
-
default:
|
|
1226
|
+
default: b(() => [...l[17] || (l[17] = [
|
|
1228
1227
|
V(" 编辑 ", -1)
|
|
1229
1228
|
])]),
|
|
1230
1229
|
_: 1
|
|
1231
1230
|
}, 8, ["onClick"])) : C("", !0),
|
|
1232
|
-
u(
|
|
1231
|
+
u(i)(m.option.tools?.delete, t) ? (p(), g(u(S), {
|
|
1233
1232
|
key: 2,
|
|
1234
1233
|
link: "",
|
|
1235
1234
|
type: "danger",
|
|
1236
1235
|
onClick: (a) => e.remove.open([t])
|
|
1237
1236
|
}, {
|
|
1238
|
-
default:
|
|
1237
|
+
default: b(() => [...l[18] || (l[18] = [
|
|
1239
1238
|
V(" 删除 ", -1)
|
|
1240
1239
|
])]),
|
|
1241
1240
|
_: 1
|
|
@@ -1251,8 +1250,8 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1251
1250
|
])
|
|
1252
1251
|
])
|
|
1253
1252
|
]),
|
|
1254
|
-
|
|
1255
|
-
e.page.total > e.page.size ? (p(), g(u(
|
|
1253
|
+
x("div", Te, [
|
|
1254
|
+
e.page.total > e.page.size ? (p(), g(u(me), {
|
|
1256
1255
|
key: 0,
|
|
1257
1256
|
"current-page": e.page.num,
|
|
1258
1257
|
"onUpdate:currentPage": l[3] || (l[3] = (t) => e.page.num = t),
|
|
@@ -1270,19 +1269,19 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1270
1269
|
]),
|
|
1271
1270
|
k(s.$slots, "box-right")
|
|
1272
1271
|
]),
|
|
1273
|
-
v(u(G),
|
|
1272
|
+
v(u(G), E({
|
|
1274
1273
|
modelValue: e.update.show,
|
|
1275
1274
|
"onUpdate:modelValue": l[5] || (l[5] = (t) => e.update.show = t),
|
|
1276
1275
|
title: e.update.title,
|
|
1277
1276
|
"close-on-click-modal": !1,
|
|
1278
1277
|
"before-close": e.update.close
|
|
1279
|
-
},
|
|
1280
|
-
footer:
|
|
1281
|
-
|
|
1278
|
+
}, m.option.dialog), {
|
|
1279
|
+
footer: b(() => [
|
|
1280
|
+
x("span", _e, [
|
|
1282
1281
|
v(u(S), {
|
|
1283
1282
|
onClick: e.update.close
|
|
1284
1283
|
}, {
|
|
1285
|
-
default:
|
|
1284
|
+
default: b(() => [...l[19] || (l[19] = [
|
|
1286
1285
|
V("关闭", -1)
|
|
1287
1286
|
])]),
|
|
1288
1287
|
_: 1
|
|
@@ -1292,27 +1291,27 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1292
1291
|
onClick: e.update.submit,
|
|
1293
1292
|
loading: e.update.loading
|
|
1294
1293
|
}, {
|
|
1295
|
-
default:
|
|
1294
|
+
default: b(() => [...l[20] || (l[20] = [
|
|
1296
1295
|
V(" 提交 ", -1)
|
|
1297
1296
|
])]),
|
|
1298
1297
|
_: 1
|
|
1299
1298
|
}, 8, ["onClick", "loading"])
|
|
1300
1299
|
])
|
|
1301
1300
|
]),
|
|
1302
|
-
default:
|
|
1303
|
-
v(u(
|
|
1301
|
+
default: b(() => [
|
|
1302
|
+
v(u(A), {
|
|
1304
1303
|
ref_key: "ruleFormRef",
|
|
1305
|
-
ref:
|
|
1304
|
+
ref: f,
|
|
1306
1305
|
model: e.update.form,
|
|
1307
1306
|
rules: e.update.rules
|
|
1308
1307
|
}, {
|
|
1309
|
-
default:
|
|
1310
|
-
e.update.showContent ? (p(!0), w(
|
|
1308
|
+
default: b(() => [
|
|
1309
|
+
e.update.showContent ? (p(!0), w(O, { key: 0 }, I(e.update.formColumn, (t) => (p(), w("div", Re, [
|
|
1311
1310
|
k(s.$slots, "form-start", {
|
|
1312
1311
|
row: e.update.form
|
|
1313
1312
|
}),
|
|
1314
|
-
(p(!0), w(
|
|
1315
|
-
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", {
|
|
1316
1315
|
key: 0,
|
|
1317
1316
|
class: X(a.item.form.span > 0 ? `col-${a.item.form.span}` : "col")
|
|
1318
1317
|
}, [
|
|
@@ -1321,69 +1320,69 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1321
1320
|
prop: a.item.key,
|
|
1322
1321
|
"label-width": a.item.form?.labelWidth || "100px"
|
|
1323
1322
|
}, {
|
|
1324
|
-
default:
|
|
1325
|
-
|
|
1323
|
+
default: b(() => [
|
|
1324
|
+
x("div", ze, [
|
|
1326
1325
|
k(s.$slots, "form-" + a.item.key + "-start", {
|
|
1327
1326
|
row: e.update.form,
|
|
1328
1327
|
item: a.item
|
|
1329
1328
|
}),
|
|
1330
|
-
|
|
1329
|
+
x("div", Me, [
|
|
1331
1330
|
k(s.$slots, "form-" + a.item.key, {
|
|
1332
1331
|
row: e.update.form,
|
|
1333
1332
|
item: a.item
|
|
1334
1333
|
}, () => [
|
|
1335
|
-
a.item.type === "input" ? (p(), g(u(K),
|
|
1334
|
+
a.item.type === "input" ? (p(), g(u(K), E({
|
|
1336
1335
|
key: 0,
|
|
1337
1336
|
modelValue: e.update.form[a.item.key],
|
|
1338
|
-
"onUpdate:modelValue": (
|
|
1337
|
+
"onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
|
|
1339
1338
|
}, { ref_for: !0 }, a.item.options?.input, F(a.item.options?.input?.on || {}), {
|
|
1340
1339
|
disabled: e.update.getDisabled(a.item)
|
|
1341
|
-
}), 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({
|
|
1342
1341
|
key: 1,
|
|
1343
1342
|
modelValue: e.update.form[a.item.key],
|
|
1344
|
-
"onUpdate:modelValue": (
|
|
1343
|
+
"onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
|
|
1345
1344
|
}, { ref_for: !0 }, a.item.options?.switch, {
|
|
1346
1345
|
disabled: e.update.getDisabled(a.item)
|
|
1347
|
-
}), 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({
|
|
1348
1347
|
key: 2,
|
|
1349
1348
|
modelValue: e.update.form[a.item.key],
|
|
1350
|
-
"onUpdate:modelValue": (
|
|
1349
|
+
"onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
|
|
1351
1350
|
}, { ref_for: !0 }, a.item.options?.select, F(a.item.options?.select?.on || {}), {
|
|
1352
1351
|
disabled: e.update.getDisabled(a.item),
|
|
1353
1352
|
style: { width: "100%" }
|
|
1354
1353
|
}), {
|
|
1355
|
-
default:
|
|
1356
|
-
(p(!0), w(
|
|
1357
|
-
key:
|
|
1358
|
-
label:
|
|
1359
|
-
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
|
|
1360
1359
|
}, null, 8, ["label", "value"]))), 128))
|
|
1361
1360
|
]),
|
|
1362
1361
|
_: 2
|
|
1363
|
-
}, 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({
|
|
1364
1363
|
key: 3,
|
|
1365
1364
|
row: e.update.form,
|
|
1366
1365
|
field: a.item.key
|
|
1367
1366
|
}, { ref_for: !0 }, a.item.options?.list, F(a.item.options?.list?.on || {}), {
|
|
1368
1367
|
disabled: e.update.getDisabled(a.item),
|
|
1369
1368
|
style: { width: "100%" }
|
|
1370
|
-
}), 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({
|
|
1371
1370
|
key: 4,
|
|
1372
1371
|
modelValue: e.update.form[a.item.key],
|
|
1373
|
-
"onUpdate:modelValue": (
|
|
1372
|
+
"onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
|
|
1374
1373
|
}, { ref_for: !0 }, a.item.options?.treeSelect, F(a.item.options?.treeSelect?.on || {}), {
|
|
1375
1374
|
disabled: e.update.getDisabled(a.item),
|
|
1376
1375
|
style: { width: "100%" }
|
|
1377
|
-
}), 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({
|
|
1378
1377
|
key: 5,
|
|
1379
1378
|
modelValue: e.update.form[a.item.key],
|
|
1380
|
-
"onUpdate:modelValue": (
|
|
1379
|
+
"onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
|
|
1381
1380
|
}, { ref_for: !0 }, a.item.options?.datetime, F(a.item.options?.datetime?.on || {}), {
|
|
1382
1381
|
disabled: e.update.getDisabled(a.item)
|
|
1383
|
-
}), 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({
|
|
1384
1383
|
key: 6,
|
|
1385
1384
|
modelValue: e.update.form[a.item.key],
|
|
1386
|
-
"onUpdate:modelValue": (
|
|
1385
|
+
"onUpdate:modelValue": (h) => e.update.form[a.item.key] = h
|
|
1387
1386
|
}, { ref_for: !0 }, a.item.options?.[a.item.type], F(a.item.options?.[a.item.type]?.on || {}), {
|
|
1388
1387
|
disabled: e.update.getDisabled(a.item)
|
|
1389
1388
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : C("", !0)
|
|
@@ -1415,12 +1414,12 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1415
1414
|
title: e.remove.title,
|
|
1416
1415
|
"close-on-click-modal": !1
|
|
1417
1416
|
}, {
|
|
1418
|
-
footer:
|
|
1419
|
-
|
|
1417
|
+
footer: b(() => [
|
|
1418
|
+
x("span", Ne, [
|
|
1420
1419
|
v(u(S), {
|
|
1421
1420
|
onClick: e.remove.close
|
|
1422
1421
|
}, {
|
|
1423
|
-
default:
|
|
1422
|
+
default: b(() => [...l[21] || (l[21] = [
|
|
1424
1423
|
V("关闭", -1)
|
|
1425
1424
|
])]),
|
|
1426
1425
|
_: 1
|
|
@@ -1430,39 +1429,83 @@ const we = { class: "dialog-footer" }, ke = /* @__PURE__ */ P({
|
|
|
1430
1429
|
onClick: e.remove.submit,
|
|
1431
1430
|
loading: e.remove.loading
|
|
1432
1431
|
}, {
|
|
1433
|
-
default:
|
|
1432
|
+
default: b(() => [...l[22] || (l[22] = [
|
|
1434
1433
|
V(" 确认删除 ", -1)
|
|
1435
1434
|
])]),
|
|
1436
1435
|
_: 1
|
|
1437
1436
|
}, 8, ["onClick", "loading"])
|
|
1438
1437
|
])
|
|
1439
1438
|
]),
|
|
1440
|
-
default:
|
|
1441
|
-
|
|
1439
|
+
default: b(() => [
|
|
1440
|
+
x("div", null, "确认要删除【" + W(e.remove.items.length) + "】条数据吗?", 1)
|
|
1442
1441
|
]),
|
|
1443
1442
|
_: 1
|
|
1444
1443
|
}, 8, ["modelValue", "title"]),
|
|
1445
|
-
v(
|
|
1444
|
+
v(ve, {
|
|
1446
1445
|
ref_key: "switchConfirmRef",
|
|
1447
1446
|
ref: c
|
|
1448
1447
|
}, null, 512)
|
|
1449
1448
|
]);
|
|
1450
1449
|
};
|
|
1451
1450
|
}
|
|
1452
|
-
})
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
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;
|
|
1497
|
+
for (const r in d.customComponent)
|
|
1498
|
+
m.component(r, d.customComponent[r]);
|
|
1457
1499
|
}
|
|
1458
1500
|
};
|
|
1459
1501
|
export {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1502
|
+
j as ArrUtil,
|
|
1503
|
+
we as ExcelUtil,
|
|
1504
|
+
ge as TColumn,
|
|
1505
|
+
Pe as TCurd,
|
|
1506
|
+
We as TFile,
|
|
1507
|
+
L as TForm,
|
|
1465
1508
|
Q as TFormList,
|
|
1466
|
-
|
|
1467
|
-
|
|
1509
|
+
U as TSys,
|
|
1510
|
+
Ae as install
|
|
1468
1511
|
};
|