@xmszm/core 0.0.1
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/index.cjs +2 -0
- package/dist/index.mjs +2145 -0
- package/dist/style.css +1 -0
- package/docs/components/dataform.md +61 -0
- package/docs/components/datatable.md +77 -0
- package/docs/components/dialog.md +78 -0
- package/docs/components/options.md +55 -0
- package/docs/components/query.md +49 -0
- package/docs/components/utils.md +56 -0
- package/docs/guide/demo.md +213 -0
- package/docs/guide/quickstart.md +77 -0
- package/docs/index.md +25 -0
- package/docs/usage.md +61 -0
- package/examples/demo.vue +224 -0
- package/package.json +64 -0
- package/src/dialog/commonDialog.jsx +230 -0
- package/src/dialog/style/commonDialog.less +40 -0
- package/src/dialog/utils/dialog.js +82 -0
- package/src/enum/options.js +3 -0
- package/src/enum/sort.jsx +31 -0
- package/src/form/DataForm.vue +125 -0
- package/src/image/ImagesUpload.vue +268 -0
- package/src/image/SvgIcon.vue +30 -0
- package/src/index.js +46 -0
- package/src/list/useList.jsx +99 -0
- package/src/options/Options.jsx +338 -0
- package/src/options/defaultOptions.jsx +580 -0
- package/src/options/options.md +77 -0
- package/src/plugin/vite/initRouteMeta.js +54 -0
- package/src/query/CommonQuery.vue +272 -0
- package/src/store/utils/index.js +6 -0
- package/src/table/DataTable.vue +315 -0
- package/src/table/FilterDialog.vue +157 -0
- package/src/table/opr/DataColumnCollet.jsx +127 -0
- package/src/table/opr/useDataColumn.jsx +196 -0
- package/src/table/opr/useDataColumnButton.jsx +56 -0
- package/src/table/opr/useDataColumnPop.jsx +57 -0
- package/src/table/test.md +248 -0
- package/src/table/utils/ellipsis.js +22 -0
- package/src/utils/array.js +26 -0
- package/src/utils/auth.js +118 -0
- package/src/utils/object.js +32 -0
- package/src/utils/time.js +7 -0
- package/src/utils/upload.js +46 -0
- package/types/index.d.ts +67 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2145 @@
|
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var Ve = (t, l, e) => l in t ? Re(t, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[l] = e;
|
|
3
|
+
var ne = (t, l, e) => Ve(t, typeof l != "symbol" ? l + "" : l, e);
|
|
4
|
+
import { useCssVars as je, unref as w, ref as U, watchEffect as ge, resolveComponent as E, createElementBlock as G, openBlock as q, createVNode as d, createElementVNode as fe, withCtx as B, Fragment as Z, renderList as ue, createBlock as V, createTextVNode as L, toDisplayString as re, computed as _, watch as W, onMounted as Fe, renderSlot as oe, isProxy as ze, normalizeStyle as De, mergeProps as I, isVNode as H, defineComponent as Q, withDirectives as Ke, resolveDirective as Le, isRef as We, mergeModels as ie, useModel as $e, reactive as He, onUnmounted as Je, createCommentVNode as Ge, resolveDynamicComponent as Xe } from "vue";
|
|
5
|
+
import { useThemeVars as Ze, NTooltip as Qe, NButton as z, NCheckboxGroup as ve, NSpace as k, NCheckbox as et, NSwitch as tt, NDivider as lt, NProgress as nt, NUpload as at, NUploadDragger as ut, NIcon as Me, NText as rt, NInputNumber as ot, NInput as pe, NRadioGroup as it, NRadio as st, NDatePicker as be, NTimePicker as ft, NSelect as ct, NEllipsis as dt, NFormItem as yt, NForm as mt, NPopconfirm as ht, NPopover as gt } from "naive-ui";
|
|
6
|
+
import { Funnel as pt, RefreshOutline as bt, SearchOutline as xt, Code as wt, ChevronDown as Ot, ChevronUp as Ct } from "@vicons/ionicons5";
|
|
7
|
+
import { hasPermission as Nt } from "@/utils/permission";
|
|
8
|
+
import { useRoute as Ue, useRouter as St } from "vue-router";
|
|
9
|
+
import { BASE_URL as xe } from "@/utils/request";
|
|
10
|
+
import T from "dayjs";
|
|
11
|
+
import { uniqueId as we } from "lodash-es";
|
|
12
|
+
const P = "name", Y = "id";
|
|
13
|
+
function qe(t, { labelField: l = P, valueField: e = Y } = {}) {
|
|
14
|
+
return Object.keys(t).reduce((u, a) => {
|
|
15
|
+
const i = At(t[a], a), n = {
|
|
16
|
+
...i
|
|
17
|
+
};
|
|
18
|
+
return n[l] = i == null ? void 0 : i[l], n[e] = i == null ? void 0 : i[e], u.concat(n);
|
|
19
|
+
}, []);
|
|
20
|
+
}
|
|
21
|
+
function At(t, l) {
|
|
22
|
+
const e = {
|
|
23
|
+
[P]: unref(t),
|
|
24
|
+
[Y]: Number.isNaN(Number(l)) ? l : Number(l)
|
|
25
|
+
};
|
|
26
|
+
return typeof unref(t) == "object" ? {
|
|
27
|
+
...unref(t),
|
|
28
|
+
[Y]: Number.isNaN(Number(l)) ? l : Number(l)
|
|
29
|
+
} : e;
|
|
30
|
+
}
|
|
31
|
+
const Oe = {
|
|
32
|
+
style: {
|
|
33
|
+
cursor: "pointer"
|
|
34
|
+
},
|
|
35
|
+
tooltip: {
|
|
36
|
+
flip: !0,
|
|
37
|
+
arrowPointToCenter: !0,
|
|
38
|
+
contentStyle: {
|
|
39
|
+
minWidth: "100px",
|
|
40
|
+
maxWidth: "300px",
|
|
41
|
+
maxHeight: "300px",
|
|
42
|
+
overflowY: "auto",
|
|
43
|
+
whiteSpace: "pre-line",
|
|
44
|
+
boxSizing: "border-box",
|
|
45
|
+
margin: "0 -14px",
|
|
46
|
+
padding: "0 14px"
|
|
47
|
+
},
|
|
48
|
+
arrowStyle: {
|
|
49
|
+
backgroundColor: "--n-color"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, v = (t, l) => {
|
|
53
|
+
const e = t.__vccOpts || t;
|
|
54
|
+
for (const [u, a] of l)
|
|
55
|
+
e[u] = a;
|
|
56
|
+
return e;
|
|
57
|
+
}, It = { class: "filter-box" }, Ft = { class: "filter-footer" }, Dt = {
|
|
58
|
+
__name: "FilterDialog",
|
|
59
|
+
props: {
|
|
60
|
+
type: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: () => "primary"
|
|
63
|
+
},
|
|
64
|
+
filterItem: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => []
|
|
67
|
+
},
|
|
68
|
+
selectItem: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: () => []
|
|
71
|
+
},
|
|
72
|
+
defaultItem: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: () => []
|
|
75
|
+
},
|
|
76
|
+
filterButtonKey: {
|
|
77
|
+
type: Array,
|
|
78
|
+
default: () => ["all", "selectDefault"]
|
|
79
|
+
// default: () => ['all', 'selectDefault','currentSelect']
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
emits: ["submit"],
|
|
83
|
+
setup(t, { emit: l }) {
|
|
84
|
+
var x, b;
|
|
85
|
+
je((A) => ({
|
|
86
|
+
e0ecc754: w(a).infoColor
|
|
87
|
+
}));
|
|
88
|
+
const e = t, u = l, a = Ze(), i = U([]);
|
|
89
|
+
ge(() => {
|
|
90
|
+
i.value = e.selectItem;
|
|
91
|
+
});
|
|
92
|
+
const n = U([]), f = [
|
|
93
|
+
{
|
|
94
|
+
key: "all",
|
|
95
|
+
label: "全选",
|
|
96
|
+
onCheck: () => {
|
|
97
|
+
var A;
|
|
98
|
+
return i.value = (A = e.filterItem) == null ? void 0 : A.map((N) => N.key);
|
|
99
|
+
},
|
|
100
|
+
unCheck: () => i.value = []
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "selectDefault",
|
|
104
|
+
label: "选中默认",
|
|
105
|
+
onCheck: () => i.value = e.defaultItem,
|
|
106
|
+
unCheck: () => i.value = e.selectItem
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "currentSelect",
|
|
110
|
+
label: "选中当前列表",
|
|
111
|
+
onCheck: () => i.value = e.selectItem,
|
|
112
|
+
unCheck: () => i.value = e.selectItem
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
ge(() => {
|
|
116
|
+
n.value = f.filter(
|
|
117
|
+
(A) => e.filterButtonKey.includes(A.key)
|
|
118
|
+
), console.log(e.filterButtonKey);
|
|
119
|
+
});
|
|
120
|
+
function o() {
|
|
121
|
+
u("submit", i.value);
|
|
122
|
+
}
|
|
123
|
+
const c = U(
|
|
124
|
+
((x = e.filterItem) == null ? void 0 : x.length) === ((b = e.selectItem) == null ? void 0 : b.length) ? ["all"] : []
|
|
125
|
+
);
|
|
126
|
+
function m(A, N) {
|
|
127
|
+
var r, h, y, g;
|
|
128
|
+
console.log(A), console.log(N), N.actionType === "uncheck" ? ((h = (r = n.value) == null ? void 0 : r.find((s) => (s == null ? void 0 : s.key) === N.value)) == null || h.unCheck(), c.value = []) : ((g = (y = n.value) == null ? void 0 : y.find((s) => (s == null ? void 0 : s.key) === N.value)) == null || g.onCheck(), c.value = [N.value]);
|
|
129
|
+
}
|
|
130
|
+
return (A, N) => {
|
|
131
|
+
const r = E("n-ellipsis"), h = E("n-checkbox"), y = E("n-checkbox-group"), g = E("n-button");
|
|
132
|
+
return q(), G("div", It, [
|
|
133
|
+
d(y, {
|
|
134
|
+
value: i.value,
|
|
135
|
+
"onUpdate:value": N[0] || (N[0] = (s) => i.value = s),
|
|
136
|
+
class: "filter-main"
|
|
137
|
+
}, {
|
|
138
|
+
default: B(() => [
|
|
139
|
+
(q(!0), G(Z, null, ue(t.filterItem, (s) => (q(), V(h, {
|
|
140
|
+
key: s.key,
|
|
141
|
+
value: s.key,
|
|
142
|
+
class: "filter-item"
|
|
143
|
+
}, {
|
|
144
|
+
default: B(() => [
|
|
145
|
+
d(r, { style: { "max-width": "100px" } }, {
|
|
146
|
+
default: B(() => [
|
|
147
|
+
L(re(s.title), 1)
|
|
148
|
+
]),
|
|
149
|
+
_: 2
|
|
150
|
+
}, 1024)
|
|
151
|
+
]),
|
|
152
|
+
_: 2
|
|
153
|
+
}, 1032, ["value"]))), 128))
|
|
154
|
+
]),
|
|
155
|
+
_: 1
|
|
156
|
+
}, 8, ["value"]),
|
|
157
|
+
fe("div", Ft, [
|
|
158
|
+
d(y, {
|
|
159
|
+
type: e.type,
|
|
160
|
+
value: c.value,
|
|
161
|
+
"onUpdate:value": m
|
|
162
|
+
}, {
|
|
163
|
+
default: B(() => [
|
|
164
|
+
(q(!0), G(Z, null, ue(n.value, (s) => (q(), V(h, {
|
|
165
|
+
key: s.key,
|
|
166
|
+
value: s.key
|
|
167
|
+
}, {
|
|
168
|
+
default: B(() => [
|
|
169
|
+
L(re(s.label), 1)
|
|
170
|
+
]),
|
|
171
|
+
_: 2
|
|
172
|
+
}, 1032, ["value"]))), 128))
|
|
173
|
+
]),
|
|
174
|
+
_: 1
|
|
175
|
+
}, 8, ["type", "value"]),
|
|
176
|
+
d(g, {
|
|
177
|
+
class: "submit-btn",
|
|
178
|
+
type: e.type,
|
|
179
|
+
onClick: o
|
|
180
|
+
}, {
|
|
181
|
+
default: B(() => [...N[1] || (N[1] = [
|
|
182
|
+
L(" 保存 ", -1)
|
|
183
|
+
])]),
|
|
184
|
+
_: 1
|
|
185
|
+
}, 8, ["type"])
|
|
186
|
+
])
|
|
187
|
+
]);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}, $t = /* @__PURE__ */ v(Dt, [["__scopeId", "data-v-2aba8b9e"]]), Ce = "filter_key", Mt = {
|
|
191
|
+
__name: "DataTable",
|
|
192
|
+
props: {
|
|
193
|
+
data: {
|
|
194
|
+
type: Array,
|
|
195
|
+
default: () => []
|
|
196
|
+
},
|
|
197
|
+
pagination: {
|
|
198
|
+
type: [Object, null],
|
|
199
|
+
default: () => {
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
columns: {
|
|
203
|
+
type: Array,
|
|
204
|
+
default: () => [{
|
|
205
|
+
title: "测试案例"
|
|
206
|
+
}]
|
|
207
|
+
},
|
|
208
|
+
oprColumns: {
|
|
209
|
+
type: [Object, null],
|
|
210
|
+
default: () => null
|
|
211
|
+
},
|
|
212
|
+
selectColumns: {
|
|
213
|
+
type: [Object, null],
|
|
214
|
+
default: () => null
|
|
215
|
+
},
|
|
216
|
+
defaultColumns: {
|
|
217
|
+
type: Array,
|
|
218
|
+
default: () => []
|
|
219
|
+
},
|
|
220
|
+
summaryColumns: {
|
|
221
|
+
type: null,
|
|
222
|
+
default: () => null
|
|
223
|
+
},
|
|
224
|
+
emptyText: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: () => "没有数据"
|
|
227
|
+
},
|
|
228
|
+
emptyIcon: {
|
|
229
|
+
type: String,
|
|
230
|
+
default: () => ""
|
|
231
|
+
},
|
|
232
|
+
isFilter: {
|
|
233
|
+
type: Boolean,
|
|
234
|
+
default: () => !1
|
|
235
|
+
},
|
|
236
|
+
isEllipsis: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
default: () => !0
|
|
239
|
+
},
|
|
240
|
+
virtual: {
|
|
241
|
+
type: null,
|
|
242
|
+
default: () => {
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
singleColumn: {
|
|
246
|
+
type: Boolean,
|
|
247
|
+
default: () => !1
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
emits: ["sorted"],
|
|
251
|
+
setup(t, {
|
|
252
|
+
expose: l,
|
|
253
|
+
emit: e
|
|
254
|
+
}) {
|
|
255
|
+
const u = t, a = Ue(), i = e, n = _(() => (console.log("table -data", u.data), u.data));
|
|
256
|
+
function f(g) {
|
|
257
|
+
window.localStorage.setItem(Ce, JSON.stringify(g));
|
|
258
|
+
}
|
|
259
|
+
function o() {
|
|
260
|
+
return JSON.parse(window.localStorage.getItem(Ce)) || {};
|
|
261
|
+
}
|
|
262
|
+
const c = U(o()), m = U([]), x = U(0);
|
|
263
|
+
function b(g) {
|
|
264
|
+
if (u.summaryColumns)
|
|
265
|
+
return [u.selectColumns, ...w(u.columns), u.oprColumns].reduce((s, p) => {
|
|
266
|
+
var S, F;
|
|
267
|
+
return p != null && p.key ? s[p.key] = ((F = (S = u.summaryColumns) == null ? void 0 : S.call(u, g)) == null ? void 0 : F[p.key]) || {
|
|
268
|
+
value: null
|
|
269
|
+
} : s[we("table")] = {
|
|
270
|
+
value: null
|
|
271
|
+
}, s;
|
|
272
|
+
}, {});
|
|
273
|
+
}
|
|
274
|
+
const A = U([]);
|
|
275
|
+
W(() => w(u.columns), () => {
|
|
276
|
+
N();
|
|
277
|
+
}, {
|
|
278
|
+
immediate: !0
|
|
279
|
+
}), W(() => u.oprColumns, (g) => {
|
|
280
|
+
console.log("oprColumns", g);
|
|
281
|
+
});
|
|
282
|
+
function N() {
|
|
283
|
+
var S;
|
|
284
|
+
const g = w(u.columns);
|
|
285
|
+
m.value = ((S = c.value) == null ? void 0 : S[a.fullPath]) || (g == null ? void 0 : g.map((F, C) => (F == null ? void 0 : F.key) || T().valueOf() + C));
|
|
286
|
+
const s = u.isFilter ? g.filter((F) => {
|
|
287
|
+
var C;
|
|
288
|
+
return (C = m.value) == null ? void 0 : C.includes(F.key);
|
|
289
|
+
}) : [...g];
|
|
290
|
+
u.selectColumns && s.unshift({
|
|
291
|
+
key: "selectKey",
|
|
292
|
+
...u.selectColumns
|
|
293
|
+
}), u.oprColumns && s.push(u.oprColumns);
|
|
294
|
+
let p = 0;
|
|
295
|
+
A.value = s.reduce((F, C) => {
|
|
296
|
+
var K;
|
|
297
|
+
if (C != null && C.display && console.log("display", C == null ? void 0 : C.display), !((C == null ? void 0 : C.display) ?? !0)) return F;
|
|
298
|
+
const $ = {
|
|
299
|
+
align: "center",
|
|
300
|
+
width: 120,
|
|
301
|
+
...C,
|
|
302
|
+
key: (C == null ? void 0 : C.key) || we("table"),
|
|
303
|
+
ellipsis: C != null && C.ellipsis || u.isEllipsis ? C != null && C.ellipsisProp ? C == null ? void 0 : C.ellipsisProp(Oe) : Oe : !1,
|
|
304
|
+
"ellipsis-component": "ellipsis",
|
|
305
|
+
title: () => {
|
|
306
|
+
const M = (C == null ? void 0 : C.label) || (C == null ? void 0 : C.title) || "";
|
|
307
|
+
return d("div", {
|
|
308
|
+
style: {
|
|
309
|
+
width: "100%",
|
|
310
|
+
whiteSpace: "pre-wrap"
|
|
311
|
+
}
|
|
312
|
+
}, [typeof M == "string" ? M : M == null ? void 0 : M()]);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
return C != null && C.sorter && ($.renderSorterIcon = ({
|
|
316
|
+
order: M
|
|
317
|
+
}) => {
|
|
318
|
+
const {
|
|
319
|
+
Icon: J,
|
|
320
|
+
title: ee
|
|
321
|
+
} = ae[M];
|
|
322
|
+
return d(Qe, null, {
|
|
323
|
+
trigger: () => J,
|
|
324
|
+
default: () => ee
|
|
325
|
+
});
|
|
326
|
+
}, $.sorter = {
|
|
327
|
+
multiple: 1,
|
|
328
|
+
fn: C.sorter
|
|
329
|
+
}), p += $ != null && $.width ? Number.parseInt($ == null ? void 0 : $.width) : ((K = $ == null ? void 0 : $.title) == null ? void 0 : K.length) * $.length + 30 || 0, F.push($), F;
|
|
330
|
+
}, []), x.value = p, console.log("计算");
|
|
331
|
+
}
|
|
332
|
+
function r() {
|
|
333
|
+
return d(z, {
|
|
334
|
+
type: "info",
|
|
335
|
+
onClick: () => h()
|
|
336
|
+
}, {
|
|
337
|
+
default: () => "筛选字段",
|
|
338
|
+
icon: () => d(pt, null, null)
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function h() {
|
|
342
|
+
const {
|
|
343
|
+
cancel: g
|
|
344
|
+
} = Ht({
|
|
345
|
+
title: "筛选字段",
|
|
346
|
+
read: !0,
|
|
347
|
+
options: [{
|
|
348
|
+
render: () => d($t, {
|
|
349
|
+
style: {
|
|
350
|
+
width: "100%",
|
|
351
|
+
margin: "0",
|
|
352
|
+
padding: 0
|
|
353
|
+
},
|
|
354
|
+
filterItem: w(u.columns),
|
|
355
|
+
selectItem: m.value,
|
|
356
|
+
defaultItem: u.defaultColumns,
|
|
357
|
+
onSubmit: (s) => {
|
|
358
|
+
c.value[a.fullPath] = s, f(c.value), N(), g();
|
|
359
|
+
}
|
|
360
|
+
}, null)
|
|
361
|
+
}]
|
|
362
|
+
}, {
|
|
363
|
+
closable: !1,
|
|
364
|
+
style: {
|
|
365
|
+
width: "500px"
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function y(g) {
|
|
370
|
+
if (console.log("onSorter", g), !g) return;
|
|
371
|
+
ce(g).forEach((p) => {
|
|
372
|
+
var S, F;
|
|
373
|
+
console.log("v", p), p != null && p.sorter && ((F = p == null ? void 0 : p.sorter) == null || F.fn((C, $, K) => {
|
|
374
|
+
var M;
|
|
375
|
+
(M = ae[p.order]) == null || M.fn(C, K), $.fetchData();
|
|
376
|
+
}, {
|
|
377
|
+
field: p == null ? void 0 : p.columnKey,
|
|
378
|
+
value: (S = ae[p == null ? void 0 : p.order]) == null ? void 0 : S.value,
|
|
379
|
+
isClick: !ze(p)
|
|
380
|
+
}));
|
|
381
|
+
}), i("sorted");
|
|
382
|
+
}
|
|
383
|
+
return l({
|
|
384
|
+
filterHandle: h,
|
|
385
|
+
filterButton: r,
|
|
386
|
+
initColumns: N
|
|
387
|
+
}), Fe(() => {
|
|
388
|
+
}), (g, s) => {
|
|
389
|
+
const p = E("n-empty"), S = E("n-data-table");
|
|
390
|
+
return q(), V(S, {
|
|
391
|
+
data: n.value,
|
|
392
|
+
columns: A.value,
|
|
393
|
+
"scroll-x": x.value,
|
|
394
|
+
"single-column": u.singleColumn,
|
|
395
|
+
summary: u.summaryColumns ? b : void 0,
|
|
396
|
+
"summary-placement": "bottom",
|
|
397
|
+
pagination: u.pagination,
|
|
398
|
+
"row-props": () => ({
|
|
399
|
+
style: {
|
|
400
|
+
height: "60px"
|
|
401
|
+
}
|
|
402
|
+
}),
|
|
403
|
+
"flex-height": "",
|
|
404
|
+
remote: "",
|
|
405
|
+
"virtual-scroll": u.virtual ?? u.data.length > 1e3,
|
|
406
|
+
style: {
|
|
407
|
+
flex: "1"
|
|
408
|
+
},
|
|
409
|
+
"onUpdate:sorter": y
|
|
410
|
+
}, {
|
|
411
|
+
empty: B(() => [oe(g.$slots, "empty", {}, () => [d(p, null, {
|
|
412
|
+
default: B(() => [L(re(t.emptyText), 1)]),
|
|
413
|
+
_: 1
|
|
414
|
+
})], !0)]),
|
|
415
|
+
_: 3
|
|
416
|
+
}, 8, ["data", "columns", "scroll-x", "single-column", "summary", "pagination", "virtual-scroll"]);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}, Ut = /* @__PURE__ */ v(Mt, [["__scopeId", "data-v-8fbdfcbb"]]);
|
|
420
|
+
let se = null;
|
|
421
|
+
function cl(t) {
|
|
422
|
+
se = t;
|
|
423
|
+
}
|
|
424
|
+
function qt(...t) {
|
|
425
|
+
if (typeof se != "function")
|
|
426
|
+
throw new TypeError("请先通过 registryUpload(fn) 注册上传实现");
|
|
427
|
+
return se(...t);
|
|
428
|
+
}
|
|
429
|
+
function R(t, l = null) {
|
|
430
|
+
return t && !(t != null && t.startsWith("http")) ? l ? `${xe}${t}?x-oss-process=style/w${l}` : `${xe}${t}` : t;
|
|
431
|
+
}
|
|
432
|
+
const Et = "/admin/file", Bt = {
|
|
433
|
+
__name: "ImagesUpload",
|
|
434
|
+
props: {
|
|
435
|
+
value: {
|
|
436
|
+
type: [Array, String],
|
|
437
|
+
default: () => []
|
|
438
|
+
},
|
|
439
|
+
max: {
|
|
440
|
+
type: Number,
|
|
441
|
+
default: () => 5
|
|
442
|
+
},
|
|
443
|
+
lib: {
|
|
444
|
+
type: Boolean,
|
|
445
|
+
default: () => !0
|
|
446
|
+
},
|
|
447
|
+
clip: {
|
|
448
|
+
type: Boolean,
|
|
449
|
+
default: () => !1
|
|
450
|
+
},
|
|
451
|
+
read: {
|
|
452
|
+
type: Boolean,
|
|
453
|
+
default: () => !1
|
|
454
|
+
},
|
|
455
|
+
size: {
|
|
456
|
+
type: Number,
|
|
457
|
+
default: () => 100
|
|
458
|
+
},
|
|
459
|
+
width: {
|
|
460
|
+
type: Number,
|
|
461
|
+
default: () => 100
|
|
462
|
+
},
|
|
463
|
+
height: {
|
|
464
|
+
type: Number,
|
|
465
|
+
default: () => 100
|
|
466
|
+
},
|
|
467
|
+
mode: {
|
|
468
|
+
type: String,
|
|
469
|
+
default: () => "fill"
|
|
470
|
+
},
|
|
471
|
+
formData: {
|
|
472
|
+
type: Object,
|
|
473
|
+
default: () => {
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
emits: ["update:value", "complete"],
|
|
478
|
+
setup(t, {
|
|
479
|
+
emit: l
|
|
480
|
+
}) {
|
|
481
|
+
const e = t, u = l, a = U([]);
|
|
482
|
+
W(() => e.value, (o) => {
|
|
483
|
+
console.log("props.value", o), a.value = e.max === 1 ? o ? typeof o != "string" ? o != null && o.length ? [{
|
|
484
|
+
id: T().valueOf(),
|
|
485
|
+
name: `img${T().valueOf()}`,
|
|
486
|
+
url: R(o[0]),
|
|
487
|
+
thumbnailUrl: R(o[0]),
|
|
488
|
+
fullPath: o[0],
|
|
489
|
+
status: "finished"
|
|
490
|
+
}] : [] : [{
|
|
491
|
+
id: T().valueOf(),
|
|
492
|
+
name: `img${T().valueOf()}`,
|
|
493
|
+
url: R(o),
|
|
494
|
+
fullPath: o,
|
|
495
|
+
thumbnailUrl: R(o),
|
|
496
|
+
status: "finished"
|
|
497
|
+
}] : [] : (o == null ? void 0 : o.map((c, m) => ({
|
|
498
|
+
id: T().valueOf() + m,
|
|
499
|
+
name: `img${T().valueOf()}`,
|
|
500
|
+
url: R(c),
|
|
501
|
+
fullPath: c,
|
|
502
|
+
thumbnailUrl: R(c),
|
|
503
|
+
status: "finished"
|
|
504
|
+
}))) || [], console.log("1", a.value);
|
|
505
|
+
}, {
|
|
506
|
+
immediate: !0
|
|
507
|
+
});
|
|
508
|
+
function i(...o) {
|
|
509
|
+
n(o[0]);
|
|
510
|
+
}
|
|
511
|
+
async function n({
|
|
512
|
+
file: o,
|
|
513
|
+
onFinish: c,
|
|
514
|
+
onError: m,
|
|
515
|
+
onProgress: x
|
|
516
|
+
}, b) {
|
|
517
|
+
const A = new FormData();
|
|
518
|
+
o.status === "pending" && (A.append("file", o.file), e.formData && Object.keys(e.formData).length && Object.keys(e.formData).forEach((N) => {
|
|
519
|
+
A.append(N, e.formData[N]);
|
|
520
|
+
}), qt({
|
|
521
|
+
url: Et,
|
|
522
|
+
data: A,
|
|
523
|
+
method: "post",
|
|
524
|
+
onUploadProgress: ({
|
|
525
|
+
percent: N
|
|
526
|
+
}) => x({
|
|
527
|
+
percent: N
|
|
528
|
+
})
|
|
529
|
+
}).then((N) => {
|
|
530
|
+
const {
|
|
531
|
+
url: r
|
|
532
|
+
} = N.data;
|
|
533
|
+
o.url = R(r), o.fullPath = r, o.thumbnailUrl = R(r), c(), f();
|
|
534
|
+
}).catch(() => {
|
|
535
|
+
o = null, m();
|
|
536
|
+
}).finally(() => {
|
|
537
|
+
}));
|
|
538
|
+
}
|
|
539
|
+
function f() {
|
|
540
|
+
console.log("onSubmit", a.value);
|
|
541
|
+
const o = a.value.reduce((c, m) => (m.status === "finished" && (m != null && m.fullPath) && c.push(m.fullPath), c), []);
|
|
542
|
+
e.max === 1 && o.length === 1 ? u("update:value", o[0]) : o.length ? u("update:value", o) : u("update:value", e.max === 1 ? null : []);
|
|
543
|
+
}
|
|
544
|
+
return (o, c) => {
|
|
545
|
+
const m = E("n-upload"), x = E("n-space");
|
|
546
|
+
return q(), V(x, {
|
|
547
|
+
align: "end",
|
|
548
|
+
"wrap-item": !1
|
|
549
|
+
}, {
|
|
550
|
+
default: B(() => [d(m, {
|
|
551
|
+
"file-list": a.value,
|
|
552
|
+
"onUpdate:fileList": c[0] || (c[0] = (b) => a.value = b),
|
|
553
|
+
accept: ".jpeg,.jpg,.png",
|
|
554
|
+
"list-type": "image-card",
|
|
555
|
+
"custom-request": i,
|
|
556
|
+
max: e.read ? Array.isArray(e.value) ? e.value.length : 1 : e.max,
|
|
557
|
+
"show-retry-button": !1,
|
|
558
|
+
"show-remove-button": !e.read,
|
|
559
|
+
class: "upload-box",
|
|
560
|
+
style: De({
|
|
561
|
+
...e.size ? {
|
|
562
|
+
"--image-w": `${e.size}px`,
|
|
563
|
+
"--image-h": `${e.size}px`
|
|
564
|
+
} : {
|
|
565
|
+
"--image-w": `${e.width}px`,
|
|
566
|
+
"--image-h": `${e.height}px`
|
|
567
|
+
},
|
|
568
|
+
"--image-mode": e.mode
|
|
569
|
+
}),
|
|
570
|
+
onFinish: c[1] || (c[1] = () => {
|
|
571
|
+
f(), u("complete");
|
|
572
|
+
}),
|
|
573
|
+
onRemove: c[2] || (c[2] = (b, A) => (a.value.splice(A, 1), f(), !1))
|
|
574
|
+
}, null, 8, ["file-list", "max", "show-remove-button", "style"])]),
|
|
575
|
+
_: 1
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}, Yt = /* @__PURE__ */ v(Bt, [["__scopeId", "data-v-54e2cc87"]]);
|
|
580
|
+
function Ne(t = [], { labelField: l = P, valueField: e = Y } = {
|
|
581
|
+
labelField: P,
|
|
582
|
+
valueField: Y
|
|
583
|
+
}) {
|
|
584
|
+
return w(t).reduce((u, a) => (u[a[e]] = {
|
|
585
|
+
...a,
|
|
586
|
+
[l]: a[l],
|
|
587
|
+
[e]: a[e]
|
|
588
|
+
}, u), {});
|
|
589
|
+
}
|
|
590
|
+
function ce(t) {
|
|
591
|
+
return Array.isArray(t) ? t : [t];
|
|
592
|
+
}
|
|
593
|
+
function Se(t, l = "YYYY-MM-DD", e = { emptyText: "" }) {
|
|
594
|
+
return t ? T(Number.isNaN(Number(t)) ? t : Number(t)).format(l) : (e == null ? void 0 : e.emptyText) || "";
|
|
595
|
+
}
|
|
596
|
+
function Tt(t) {
|
|
597
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !H(t);
|
|
598
|
+
}
|
|
599
|
+
const Pt = {
|
|
600
|
+
input: ({
|
|
601
|
+
label: t,
|
|
602
|
+
key: l,
|
|
603
|
+
props: e,
|
|
604
|
+
readProps: u,
|
|
605
|
+
format: a = null,
|
|
606
|
+
read: i
|
|
607
|
+
}, {
|
|
608
|
+
_value: n,
|
|
609
|
+
_isRead: f
|
|
610
|
+
}) => i ?? f ? d(dt, u, {
|
|
611
|
+
default: () => [a ? a == null ? void 0 : a(w(n)[l], w(n)) : w(n)[l]]
|
|
612
|
+
}) : d(pe, I({
|
|
613
|
+
value: n[l],
|
|
614
|
+
"onUpdate:value": (o) => n[l] = o,
|
|
615
|
+
clearable: !0,
|
|
616
|
+
placeholder: `请输入${w(t)}`
|
|
617
|
+
}, e), {
|
|
618
|
+
...(e == null ? void 0 : e.slots) || {}
|
|
619
|
+
}),
|
|
620
|
+
select: ({
|
|
621
|
+
label: t,
|
|
622
|
+
key: l,
|
|
623
|
+
props: e,
|
|
624
|
+
options: u = [],
|
|
625
|
+
loading: a = !1,
|
|
626
|
+
format: i = null,
|
|
627
|
+
read: n
|
|
628
|
+
}, {
|
|
629
|
+
_value: f,
|
|
630
|
+
_isRead: o
|
|
631
|
+
}) => {
|
|
632
|
+
var m, x;
|
|
633
|
+
const c = (Array.isArray(w(u)) ? w(u) : u == null ? void 0 : u(f[l])) || [];
|
|
634
|
+
return n ?? o ? d("div", null, [i ? i == null ? void 0 : i(f[l], c) : (x = (m = Ne(c, (e == null ? void 0 : e.labelField) || P, (e == null ? void 0 : e.valueField) || Y)) == null ? void 0 : m[f[l]]) == null ? void 0 : x[(e == null ? void 0 : e.labelField) || P]]) : d(ct, I({
|
|
635
|
+
value: f[l],
|
|
636
|
+
"onUpdate:value": (b) => f[l] = b,
|
|
637
|
+
options: c,
|
|
638
|
+
loading: w(a),
|
|
639
|
+
clearable: !0,
|
|
640
|
+
filterable: !0,
|
|
641
|
+
"fallback-option": () => (e != null && e.asyncFallback || (f[l] = null), !1),
|
|
642
|
+
labelField: (e == null ? void 0 : e.labelField) || P,
|
|
643
|
+
valueField: (e == null ? void 0 : e.valueField) || Y,
|
|
644
|
+
placeholder: `请选择${w(t)}`,
|
|
645
|
+
style: "width:100%",
|
|
646
|
+
"max-tag-count": "responsive"
|
|
647
|
+
}, e), {
|
|
648
|
+
...(e == null ? void 0 : e.slots) || {}
|
|
649
|
+
});
|
|
650
|
+
},
|
|
651
|
+
date: ({
|
|
652
|
+
label: t,
|
|
653
|
+
key: l,
|
|
654
|
+
props: e,
|
|
655
|
+
formatTime: u = "YYYY-MM-DD",
|
|
656
|
+
type: a = "date",
|
|
657
|
+
format: i,
|
|
658
|
+
read: n
|
|
659
|
+
}, {
|
|
660
|
+
_value: f,
|
|
661
|
+
_isRead: o
|
|
662
|
+
}) => n ?? o ? d("div", null, [i ? i == null ? void 0 : i(f[l]) : Se(f[l], u)]) : d(be, I({
|
|
663
|
+
"formatted-value": f[l],
|
|
664
|
+
"onUpdate:formatted-value": (c) => {
|
|
665
|
+
f[l] = c;
|
|
666
|
+
},
|
|
667
|
+
type: a,
|
|
668
|
+
clearable: !0,
|
|
669
|
+
placeholder: `请选择${w(t)}`,
|
|
670
|
+
"update-value-on-close": !["year"].includes(e == null ? void 0 : e.type),
|
|
671
|
+
style: "width:100%"
|
|
672
|
+
}, e), {
|
|
673
|
+
...(e == null ? void 0 : e.slots) || {}
|
|
674
|
+
}),
|
|
675
|
+
time: ({
|
|
676
|
+
label: t,
|
|
677
|
+
key: l,
|
|
678
|
+
props: e,
|
|
679
|
+
format: u,
|
|
680
|
+
formatTime: a = "YYYY-MM-DD",
|
|
681
|
+
read: i
|
|
682
|
+
}, {
|
|
683
|
+
_value: n,
|
|
684
|
+
_isRead: f
|
|
685
|
+
}) => i ?? f ? d("div", null, [u ? u == null ? void 0 : u(n[l]) : Se(n[l], a)]) : d(ft, I({
|
|
686
|
+
"formatted-value": n[l],
|
|
687
|
+
"onUpdate:value": (o, c) => {
|
|
688
|
+
console.log("v", c), n[l] = c;
|
|
689
|
+
},
|
|
690
|
+
clearable: !0,
|
|
691
|
+
format: "HH:mm:ss",
|
|
692
|
+
style: "width:100%",
|
|
693
|
+
placeholder: `请选择${w(t)}`
|
|
694
|
+
}, e), {
|
|
695
|
+
...(e == null ? void 0 : e.slots) || {}
|
|
696
|
+
}),
|
|
697
|
+
dateRange: ({
|
|
698
|
+
key: t,
|
|
699
|
+
props: l,
|
|
700
|
+
type: e = "datetimerange",
|
|
701
|
+
read: u
|
|
702
|
+
}, {
|
|
703
|
+
_value: a,
|
|
704
|
+
_isRead: i
|
|
705
|
+
}) => {
|
|
706
|
+
var o, c;
|
|
707
|
+
const n = {
|
|
708
|
+
date: "YYYY-MM-DD",
|
|
709
|
+
datetime: "YYYY-MM-DD HH:mm:ss",
|
|
710
|
+
time: "HH:mm:ss",
|
|
711
|
+
datetimerange: "YYYY-MM-DD HH:mm:ss",
|
|
712
|
+
daterange: "YYYY-MM-DD"
|
|
713
|
+
}, f = l != null && l.format ? (c = (o = l == null ? void 0 : l.format) == null ? void 0 : o.replace("yyyy", "YYYY")) == null ? void 0 : c.replace("dd", "DD") : n[(l == null ? void 0 : l.type) || e];
|
|
714
|
+
return console.log("formatStr type", e), console.log("formatStr", f), u ?? i ? d("div", null, [Array.isArray(t) ? `${a == null ? void 0 : a[t == null ? void 0 : t[0]]} - ${a == null ? void 0 : a[t == null ? void 0 : t[1]]}` : a == null ? void 0 : a[t]]) : d(be, I({
|
|
715
|
+
"formatted-value": Array.isArray(t) ? a != null && a[t == null ? void 0 : t[0]] && (a != null && a[t == null ? void 0 : t[1]]) ? [T(a == null ? void 0 : a[t == null ? void 0 : t[0]]).format(f), T(a == null ? void 0 : a[t == null ? void 0 : t[1]]).format(f)] : null : (a == null ? void 0 : a[t]) || null,
|
|
716
|
+
"onUpdate:formatted-value": (m) => {
|
|
717
|
+
console.log(m), m && ![n.datetime, n.datetimerange].includes(f) && (m = m.map((x, b) => T(x, f)[b ? "endOf" : "startOf"]("day").format(f))), Array.isArray(t) ? (a[t == null ? void 0 : t[0]] = m == null ? void 0 : m[0], a[t == null ? void 0 : t[1]] = m == null ? void 0 : m[1]) : a[t] = m;
|
|
718
|
+
},
|
|
719
|
+
"update-value-on-close": !["year", "month"].includes(l == null ? void 0 : l.type),
|
|
720
|
+
type: e,
|
|
721
|
+
clearable: !0,
|
|
722
|
+
style: "width:100%"
|
|
723
|
+
}, l), {
|
|
724
|
+
...(l == null ? void 0 : l.slots) || {}
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
radio: ({
|
|
728
|
+
key: t,
|
|
729
|
+
options: l = [],
|
|
730
|
+
props: e,
|
|
731
|
+
radioLabelProps: u,
|
|
732
|
+
read: a
|
|
733
|
+
}, {
|
|
734
|
+
_value: i,
|
|
735
|
+
_isRead: n,
|
|
736
|
+
labelField: f,
|
|
737
|
+
valueField: o
|
|
738
|
+
}) => {
|
|
739
|
+
var c, m;
|
|
740
|
+
return a ?? n ? d("div", null, [(m = (c = Ne(l, (e == null ? void 0 : e.labelField) || f, (e == null ? void 0 : e.valueField) || o)) == null ? void 0 : c[i[t]]) == null ? void 0 : m[(e == null ? void 0 : e.labelField) || f]]) : d(it, I({
|
|
741
|
+
style: {
|
|
742
|
+
width: "100%"
|
|
743
|
+
},
|
|
744
|
+
value: i[t],
|
|
745
|
+
"onUpdate:value": (x) => i[t] = x
|
|
746
|
+
}, e), {
|
|
747
|
+
...(e == null ? void 0 : e.slots) || {},
|
|
748
|
+
default: () => d(k, I({
|
|
749
|
+
"item-wrap": !1
|
|
750
|
+
}, (e == null ? void 0 : e.radioProps) || {}), {
|
|
751
|
+
default: () => [l == null ? void 0 : l.map((x) => d(st, {
|
|
752
|
+
key: x.value,
|
|
753
|
+
value: x == null ? void 0 : x[(e == null ? void 0 : e.valueField) || o],
|
|
754
|
+
class: "items-center"
|
|
755
|
+
}, {
|
|
756
|
+
default: () => [d("div", (u == null ? void 0 : u(x)) || {}, [x == null ? void 0 : x[(e == null ? void 0 : e.labelField) || f]])]
|
|
757
|
+
}))]
|
|
758
|
+
})
|
|
759
|
+
});
|
|
760
|
+
},
|
|
761
|
+
inputPhone: ({
|
|
762
|
+
label: t,
|
|
763
|
+
key: l,
|
|
764
|
+
props: e,
|
|
765
|
+
read: u
|
|
766
|
+
}, {
|
|
767
|
+
_value: a,
|
|
768
|
+
_isRead: i
|
|
769
|
+
}) => u ?? i ? d("div", null, [a[l]]) : d(pe, I({
|
|
770
|
+
value: a[l],
|
|
771
|
+
"onUpdate:value": (n) => a[l] = n,
|
|
772
|
+
clearable: !0,
|
|
773
|
+
style: "width:100%",
|
|
774
|
+
"allow-input": (n) => !n || /^\d$/.test(n) || n.length <= 11,
|
|
775
|
+
placeholder: `请输入${w(t)}`
|
|
776
|
+
}, e), {
|
|
777
|
+
...e == null ? void 0 : e.slots
|
|
778
|
+
}),
|
|
779
|
+
inputNumber: ({
|
|
780
|
+
label: t,
|
|
781
|
+
key: l,
|
|
782
|
+
props: e,
|
|
783
|
+
read: u
|
|
784
|
+
}, {
|
|
785
|
+
_value: a,
|
|
786
|
+
_isRead: i
|
|
787
|
+
}) => u ?? i ? d("div", null, [a[l]]) : d(ot, I({
|
|
788
|
+
value: typeof a[l] == "string" && a[l] ? Number(a[l]) : a[l],
|
|
789
|
+
"onUpdate:value": (n) => {
|
|
790
|
+
a[l] = n;
|
|
791
|
+
},
|
|
792
|
+
showButton: !1,
|
|
793
|
+
clearable: !0,
|
|
794
|
+
style: "width:100%",
|
|
795
|
+
placeholder: `请输入${w(t)}`,
|
|
796
|
+
min: 0
|
|
797
|
+
}, e), {
|
|
798
|
+
...(e == null ? void 0 : e.slots) || {}
|
|
799
|
+
}),
|
|
800
|
+
uploadFile: ({
|
|
801
|
+
key: t,
|
|
802
|
+
props: l
|
|
803
|
+
}, {
|
|
804
|
+
_value: e
|
|
805
|
+
}) => d(at, I({
|
|
806
|
+
multiple: !0,
|
|
807
|
+
max: 1,
|
|
808
|
+
accept: ".xls,.xlsx",
|
|
809
|
+
"file-list": e[t],
|
|
810
|
+
"onUpdate:file-list": (u) => e[t] = u
|
|
811
|
+
}, l), {
|
|
812
|
+
default: () => [d(ut, null, {
|
|
813
|
+
default: () => [d("div", {
|
|
814
|
+
style: "margin-bottom: 12px"
|
|
815
|
+
}, [d(Me, {
|
|
816
|
+
size: "48",
|
|
817
|
+
depth: 3
|
|
818
|
+
}, {
|
|
819
|
+
default: () => [d(E("ArchiveOutline"), null, null)]
|
|
820
|
+
})]), d(rt, {
|
|
821
|
+
style: "font-size: 16px"
|
|
822
|
+
}, {
|
|
823
|
+
default: () => [L("点击或者拖动文件到该区域来上传")]
|
|
824
|
+
})]
|
|
825
|
+
})]
|
|
826
|
+
}),
|
|
827
|
+
dataTable: ({
|
|
828
|
+
key: t,
|
|
829
|
+
loading: l = !1,
|
|
830
|
+
props: e,
|
|
831
|
+
options: u,
|
|
832
|
+
opr: a,
|
|
833
|
+
pageState: i
|
|
834
|
+
}, {
|
|
835
|
+
_value: n,
|
|
836
|
+
_isRead: f
|
|
837
|
+
}) => {
|
|
838
|
+
var o;
|
|
839
|
+
return console.log(l), console.log(i), d(Ut, I({
|
|
840
|
+
data: (o = i == null ? void 0 : i.data) != null && o.length ? i.data : n[t],
|
|
841
|
+
columns: w(u),
|
|
842
|
+
maxHeight: 200,
|
|
843
|
+
minHeight: 200,
|
|
844
|
+
"is-ellipsis": !1,
|
|
845
|
+
"opr-columns": a,
|
|
846
|
+
loading: i == null ? void 0 : i.loading
|
|
847
|
+
}, e), null);
|
|
848
|
+
},
|
|
849
|
+
progress: ({
|
|
850
|
+
key: t,
|
|
851
|
+
props: l
|
|
852
|
+
}, {
|
|
853
|
+
_value: e
|
|
854
|
+
}) => d(nt, I({
|
|
855
|
+
percentage: e[t]
|
|
856
|
+
}, l), null),
|
|
857
|
+
line: () => d(lt, null, null),
|
|
858
|
+
image: ({
|
|
859
|
+
key: t,
|
|
860
|
+
props: l,
|
|
861
|
+
read: e
|
|
862
|
+
}, {
|
|
863
|
+
_isRead: u,
|
|
864
|
+
_value: a
|
|
865
|
+
}) => d(Yt, I({
|
|
866
|
+
value: a[t],
|
|
867
|
+
"onUpdate:value": (i) => a[t] = i,
|
|
868
|
+
max: 1
|
|
869
|
+
}, l, {
|
|
870
|
+
read: e ?? u
|
|
871
|
+
}), null),
|
|
872
|
+
button: ({
|
|
873
|
+
onClick: t,
|
|
874
|
+
props: l,
|
|
875
|
+
text: e
|
|
876
|
+
}, {
|
|
877
|
+
_value: u
|
|
878
|
+
}) => d(z, I({
|
|
879
|
+
type: "info"
|
|
880
|
+
}, l, {
|
|
881
|
+
onClick: () => l != null && l.onClick ? l == null ? void 0 : l.onClick(w(u)) : t(w(u))
|
|
882
|
+
}), Tt(e) ? e : {
|
|
883
|
+
default: () => [e]
|
|
884
|
+
}),
|
|
885
|
+
switch: ({
|
|
886
|
+
key: t,
|
|
887
|
+
props: l,
|
|
888
|
+
read: e
|
|
889
|
+
}, {
|
|
890
|
+
_isRead: u,
|
|
891
|
+
_value: a
|
|
892
|
+
}) => e ?? u ? d("div", null, [a[t] ? "是" : "否"]) : d(tt, I({
|
|
893
|
+
value: a[t],
|
|
894
|
+
"onUpdate:value": (i) => a[t] = i
|
|
895
|
+
}, l), {
|
|
896
|
+
...(l == null ? void 0 : l.slots) || {}
|
|
897
|
+
}),
|
|
898
|
+
checkbox: ({
|
|
899
|
+
key: t,
|
|
900
|
+
options: l = [],
|
|
901
|
+
props: e,
|
|
902
|
+
read: u
|
|
903
|
+
}, {
|
|
904
|
+
_value: a,
|
|
905
|
+
_isRead: i,
|
|
906
|
+
labelField: n,
|
|
907
|
+
valueField: f
|
|
908
|
+
}) => {
|
|
909
|
+
var o, c, m;
|
|
910
|
+
return u ?? i ? d("div", null, [(m = (c = (o = w(l)) == null ? void 0 : o.filter((x) => {
|
|
911
|
+
var b;
|
|
912
|
+
return (b = w(a)[t]) == null ? void 0 : b.includes(x[(e == null ? void 0 : e.valueField) || f || Y]);
|
|
913
|
+
})) == null ? void 0 : c.map((x) => x[[(e == null ? void 0 : e.labelField) || n || P]])) == null ? void 0 : m.join("、")]) : d(ve, I({
|
|
914
|
+
value: a[t],
|
|
915
|
+
"onUpdate:value": (x) => a[t] = x,
|
|
916
|
+
style: {
|
|
917
|
+
width: "100%"
|
|
918
|
+
}
|
|
919
|
+
}, e), {
|
|
920
|
+
...(e == null ? void 0 : e.slots) || {},
|
|
921
|
+
default: () => d(k, (e == null ? void 0 : e.checkBoxProps) || {}, {
|
|
922
|
+
default: () => {
|
|
923
|
+
var x;
|
|
924
|
+
return [(x = w(l)) == null ? void 0 : x.map((b) => d(et, {
|
|
925
|
+
key: b == null ? void 0 : b[(e == null ? void 0 : e.valueField) || f || Y],
|
|
926
|
+
value: b == null ? void 0 : b[(e == null ? void 0 : e.valueField) || f || Y]
|
|
927
|
+
}, {
|
|
928
|
+
default: () => [b == null ? void 0 : b[(e == null ? void 0 : e.labelField) || n || P]]
|
|
929
|
+
}))];
|
|
930
|
+
}
|
|
931
|
+
})
|
|
932
|
+
});
|
|
933
|
+
},
|
|
934
|
+
filterList: ({
|
|
935
|
+
key: t,
|
|
936
|
+
props: l,
|
|
937
|
+
options: e
|
|
938
|
+
}, {
|
|
939
|
+
_value: u
|
|
940
|
+
}) => d(E("FilterSelect"), I({
|
|
941
|
+
value: u[t],
|
|
942
|
+
"onUpdate:value": (a) => u[t] = a,
|
|
943
|
+
option: e,
|
|
944
|
+
clearable: !0,
|
|
945
|
+
filterButtonKey: ["all", "selectDefault"]
|
|
946
|
+
}, l), null)
|
|
947
|
+
};
|
|
948
|
+
let j = {};
|
|
949
|
+
class _t {
|
|
950
|
+
constructor() {
|
|
951
|
+
ne(this, "defaultMap", null);
|
|
952
|
+
ne(this, "extendOptions", null);
|
|
953
|
+
console.log("DefaultOptions init"), this.defaultMap = null, this.init();
|
|
954
|
+
}
|
|
955
|
+
set(l, e) {
|
|
956
|
+
this.options.set(l, e);
|
|
957
|
+
}
|
|
958
|
+
get(l) {
|
|
959
|
+
return this.options.get(l);
|
|
960
|
+
}
|
|
961
|
+
clear() {
|
|
962
|
+
this.defaultMap.clear();
|
|
963
|
+
}
|
|
964
|
+
setupOptions(l, e) {
|
|
965
|
+
const u = this.defaultMap.size > 0 ? [...this.defaultMap.keys()] : [];
|
|
966
|
+
if (this.defaultMap.has(l)) return console.error(`${l} 已存在,不能使用${u == null ? void 0 : u.join("、")}`);
|
|
967
|
+
this.defaultMap.set(l, e);
|
|
968
|
+
}
|
|
969
|
+
setupExtendOptions(l, e) {
|
|
970
|
+
j || (j = {}), j != null && j[l] || (j[l] = e);
|
|
971
|
+
}
|
|
972
|
+
getAllOptions() {
|
|
973
|
+
const l = {};
|
|
974
|
+
return this.defaultMap.forEach((e, u) => {
|
|
975
|
+
l[u] = e;
|
|
976
|
+
}), l;
|
|
977
|
+
}
|
|
978
|
+
getOptions(l = []) {
|
|
979
|
+
return console.log("getOptions", this.defaultMap), l.reduce((u, a) => (this.defaultMap.has(a) && (u[a] = this.defaultMap.get(a)), u), {});
|
|
980
|
+
}
|
|
981
|
+
initOptions(l = []) {
|
|
982
|
+
Object.keys(l).forEach((e) => {
|
|
983
|
+
this.setupOptions(e, l[e]);
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
initSetup(l) {
|
|
987
|
+
this.defaultMap && this.clear(), this.defaultMap = /* @__PURE__ */ new Map(), this.initOptions(Pt), l && l(), this.initOptions(j);
|
|
988
|
+
}
|
|
989
|
+
init(l) {
|
|
990
|
+
this.initSetup(l);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
const de = new _t(), Ee = (...t) => de.getOptions(...t);
|
|
994
|
+
function dl(...t) {
|
|
995
|
+
return de.getAllOptions(...t);
|
|
996
|
+
}
|
|
997
|
+
function yl(...t) {
|
|
998
|
+
return de.setupExtendOptions(...t);
|
|
999
|
+
}
|
|
1000
|
+
const kt = ["xlink:href", "fill"], Rt = /* @__PURE__ */ Q({
|
|
1001
|
+
__name: "SvgIcon",
|
|
1002
|
+
props: {
|
|
1003
|
+
name: {
|
|
1004
|
+
type: String,
|
|
1005
|
+
required: !0
|
|
1006
|
+
},
|
|
1007
|
+
color: {
|
|
1008
|
+
type: String,
|
|
1009
|
+
default: ""
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
setup(t) {
|
|
1013
|
+
const l = t, e = _(() => `#svg-${l.name}`);
|
|
1014
|
+
return (u, a) => (q(), G("svg", I({ class: "svg-icon" }, u.$attrs, {
|
|
1015
|
+
style: { color: t.color },
|
|
1016
|
+
"aria-hidden": ""
|
|
1017
|
+
}), [
|
|
1018
|
+
fe("use", {
|
|
1019
|
+
"xlink:href": e.value,
|
|
1020
|
+
fill: t.color
|
|
1021
|
+
}, null, 8, kt)
|
|
1022
|
+
], 16));
|
|
1023
|
+
}
|
|
1024
|
+
}), Vt = /* @__PURE__ */ v(Rt, [["__scopeId", "data-v-9dbe5f10"]]);
|
|
1025
|
+
function jt(t) {
|
|
1026
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !H(t);
|
|
1027
|
+
}
|
|
1028
|
+
const zt = /* @__PURE__ */ Q((t, {
|
|
1029
|
+
emit: l
|
|
1030
|
+
}) => {
|
|
1031
|
+
const e = U(t.value), u = _(() => t.read || !1);
|
|
1032
|
+
let a = t.formRef;
|
|
1033
|
+
W(() => t.formRef, (r) => a = r);
|
|
1034
|
+
const i = _(() => t.option);
|
|
1035
|
+
function n(r) {
|
|
1036
|
+
return r.reduce((h, y) => {
|
|
1037
|
+
h.push((y == null ? void 0 : y.way) ?? "input");
|
|
1038
|
+
const g = [y == null ? void 0 : y.default, y == null ? void 0 : y.suffix, y == null ? void 0 : y.prefix].reduce((s, p) => {
|
|
1039
|
+
var S;
|
|
1040
|
+
return Array.isArray(p) ? s = s.concat(p) : p && ((S = Object.keys(p)) != null && S.length) && s.push(p), s;
|
|
1041
|
+
}, []);
|
|
1042
|
+
return console.log(g), g.length && g.forEach((s) => h.push((s == null ? void 0 : s.way) ?? "input")), h;
|
|
1043
|
+
}, []);
|
|
1044
|
+
}
|
|
1045
|
+
const f = _(() => [...new Set(n(t.option))]), o = Ee(f.value);
|
|
1046
|
+
console.log(t.option), console.log("defaultOption", o, f.value), W(() => e.value, (r) => {
|
|
1047
|
+
l("update:value", r);
|
|
1048
|
+
}, {
|
|
1049
|
+
immediate: !0
|
|
1050
|
+
});
|
|
1051
|
+
function c(r) {
|
|
1052
|
+
let h = {};
|
|
1053
|
+
const y = typeof r;
|
|
1054
|
+
let g = null;
|
|
1055
|
+
try {
|
|
1056
|
+
return r ? y === "string" || y === "object" ? g = r : y === "function" && (g = r(w(e), {
|
|
1057
|
+
formRef: a,
|
|
1058
|
+
resetForm: () => {
|
|
1059
|
+
var s;
|
|
1060
|
+
return (s = a == null ? void 0 : a.value) == null ? void 0 : s.restoreValidation();
|
|
1061
|
+
},
|
|
1062
|
+
close: () => t.cancel(),
|
|
1063
|
+
setValue: m
|
|
1064
|
+
})) : g = r, typeof g == "object" && !Array.isArray(g) ? Object.keys(g).forEach((s) => {
|
|
1065
|
+
const p = g[s];
|
|
1066
|
+
We(p) ? h[s] = w(p) : h[s] = p;
|
|
1067
|
+
}) : h = g, h;
|
|
1068
|
+
} catch {
|
|
1069
|
+
return {};
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
W(() => t.value, (r) => {
|
|
1073
|
+
console.log(r), e.value = r;
|
|
1074
|
+
}, {
|
|
1075
|
+
immediate: !0
|
|
1076
|
+
});
|
|
1077
|
+
function m(r) {
|
|
1078
|
+
e.value = r;
|
|
1079
|
+
}
|
|
1080
|
+
function x(r) {
|
|
1081
|
+
return d(k, I({
|
|
1082
|
+
"wrap-item": !1,
|
|
1083
|
+
wrap: !!(r != null && r.isWrap),
|
|
1084
|
+
align: "center",
|
|
1085
|
+
style: {
|
|
1086
|
+
width: "100%"
|
|
1087
|
+
}
|
|
1088
|
+
}, (r == null ? void 0 : r.contentProps) || {}), {
|
|
1089
|
+
default: () => [b(r == null ? void 0 : r.prefix), b((r == null ? void 0 : r.default) || r), b(r == null ? void 0 : r.suffix)]
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
function b(r) {
|
|
1093
|
+
if (!r) return;
|
|
1094
|
+
let h = r;
|
|
1095
|
+
if (typeof r == "function" && (h = c(r)), h = c(h), H(h))
|
|
1096
|
+
return console.log("??? isVNode"), h;
|
|
1097
|
+
if (typeof h == "string")
|
|
1098
|
+
return console.log("??? string"), h;
|
|
1099
|
+
if (Array.isArray(h))
|
|
1100
|
+
return console.log("???"), d(Z, null, [h.map((y, g) => d(N, {
|
|
1101
|
+
item: y,
|
|
1102
|
+
index: g
|
|
1103
|
+
}, null))]);
|
|
1104
|
+
if (typeof h == "object")
|
|
1105
|
+
return console.log("??? object"), h.props = c((h == null ? void 0 : h.props) ?? {}), w(_(() => {
|
|
1106
|
+
var y;
|
|
1107
|
+
return (y = o == null ? void 0 : o[(h == null ? void 0 : h.way) || "input"]) == null ? void 0 : y.call(o, A(h), {
|
|
1108
|
+
_value: h != null && h.queryType ? w(e)[h == null ? void 0 : h.queryType] : w(e),
|
|
1109
|
+
_formRef: w(a),
|
|
1110
|
+
_isRead: w(u),
|
|
1111
|
+
labelField: P,
|
|
1112
|
+
valueField: Y
|
|
1113
|
+
});
|
|
1114
|
+
}));
|
|
1115
|
+
}
|
|
1116
|
+
function A(r) {
|
|
1117
|
+
return w(r.enum) && (r.options = qe(w(r.enum))), r;
|
|
1118
|
+
}
|
|
1119
|
+
function N({
|
|
1120
|
+
item: r,
|
|
1121
|
+
index: h
|
|
1122
|
+
}) {
|
|
1123
|
+
var y, g, s, p, S, F;
|
|
1124
|
+
return r.formItemProps = c(r == null ? void 0 : r.formItemProps), r.formItemProps || (r.formItemProps = {}), !((y = r == null ? void 0 : r.formItemProps) != null && y.labelWidth) && ((g = t.formProps) != null && g.labelWidth) && (r.formItemProps.labelWidth = (s = t.formProps) == null ? void 0 : s.labelWidth), Ke(d(yt, I({
|
|
1125
|
+
key: h,
|
|
1126
|
+
showLabel: !(r != null && r.noLabel)
|
|
1127
|
+
}, r == null ? void 0 : r.formItemProps, {
|
|
1128
|
+
labelWidth: ((p = r == null ? void 0 : r.formItemProps) == null ? void 0 : p.labelWidth) || "auto",
|
|
1129
|
+
feedback: c((S = r == null ? void 0 : r.formItemProps) == null ? void 0 : S.feedback),
|
|
1130
|
+
style: {
|
|
1131
|
+
padding: "0 15px",
|
|
1132
|
+
boxSizing: "border-box",
|
|
1133
|
+
width: "100%",
|
|
1134
|
+
...((F = r == null ? void 0 : r.formItemProps) == null ? void 0 : F.style) || {}
|
|
1135
|
+
},
|
|
1136
|
+
path: String(r.key)
|
|
1137
|
+
}), {
|
|
1138
|
+
default: () => x(r),
|
|
1139
|
+
label: () => {
|
|
1140
|
+
var C, $;
|
|
1141
|
+
return d("div", {
|
|
1142
|
+
class: r != null && r.labelClass || r != null && r.labelSuffix ? ` ${r == null ? void 0 : r.labelClass} flex items-center gap-col-9px` : ""
|
|
1143
|
+
}, [r != null && r.labelSuffix ? typeof (r == null ? void 0 : r.labelSuffix) == "string" ? d(Me, {
|
|
1144
|
+
class: "wh-20px c-inherit",
|
|
1145
|
+
...r == null ? void 0 : r.labelSuffixProps
|
|
1146
|
+
}, {
|
|
1147
|
+
default: () => [d(Vt, {
|
|
1148
|
+
name: r == null ? void 0 : r.labelSuffix
|
|
1149
|
+
}, null)]
|
|
1150
|
+
}) : (C = r == null ? void 0 : r.labelSuffix) == null ? void 0 : C.call(r) : d(Z, null, null), `${w(typeof (r == null ? void 0 : r[t.labelField]) == "function" ? ($ = r == null ? void 0 : r[t.labelField]) == null ? void 0 : $.call(r) : r == null ? void 0 : r[t.labelField]) || ""} ${u.value || r.read, " "}
|
|
1151
|
+
`]);
|
|
1152
|
+
}
|
|
1153
|
+
}), [[Le("permission"), r == null ? void 0 : r.permission]]);
|
|
1154
|
+
}
|
|
1155
|
+
return () => {
|
|
1156
|
+
let r;
|
|
1157
|
+
return d(k, {
|
|
1158
|
+
"wrap-item": !1,
|
|
1159
|
+
size: [0, 8],
|
|
1160
|
+
style: {
|
|
1161
|
+
width: "100%",
|
|
1162
|
+
minHeight: "100%",
|
|
1163
|
+
alignContent: "baseline",
|
|
1164
|
+
...t.style
|
|
1165
|
+
}
|
|
1166
|
+
}, jt(r = i.value.map(({
|
|
1167
|
+
isRender: h = !0,
|
|
1168
|
+
...y
|
|
1169
|
+
}, g) => (typeof w(h) != "boolean" ? h != null && h(w(e)) : w(h)) ? y != null && y.render ? y == null ? void 0 : y.render(w(e), g, {
|
|
1170
|
+
setValue: m,
|
|
1171
|
+
value: w(e)
|
|
1172
|
+
}) : d(N, {
|
|
1173
|
+
item: y,
|
|
1174
|
+
index: g
|
|
1175
|
+
}, null) : null)) ? r : {
|
|
1176
|
+
default: () => [r]
|
|
1177
|
+
});
|
|
1178
|
+
};
|
|
1179
|
+
}, {
|
|
1180
|
+
props: {
|
|
1181
|
+
option: {
|
|
1182
|
+
type: Array,
|
|
1183
|
+
default: () => []
|
|
1184
|
+
},
|
|
1185
|
+
value: {
|
|
1186
|
+
type: Object,
|
|
1187
|
+
default: () => ({})
|
|
1188
|
+
},
|
|
1189
|
+
read: {
|
|
1190
|
+
type: Boolean,
|
|
1191
|
+
default: () => !1
|
|
1192
|
+
},
|
|
1193
|
+
labelField: {
|
|
1194
|
+
type: String,
|
|
1195
|
+
default: () => P
|
|
1196
|
+
},
|
|
1197
|
+
valueField: {
|
|
1198
|
+
type: String,
|
|
1199
|
+
default: () => Y
|
|
1200
|
+
},
|
|
1201
|
+
style: {
|
|
1202
|
+
type: Object,
|
|
1203
|
+
default: () => ({})
|
|
1204
|
+
},
|
|
1205
|
+
formRef: {
|
|
1206
|
+
type: Object,
|
|
1207
|
+
default: () => ({})
|
|
1208
|
+
},
|
|
1209
|
+
formProps: {
|
|
1210
|
+
type: Object,
|
|
1211
|
+
default: () => ({})
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
emits: ["update:value"]
|
|
1215
|
+
}), Kt = {
|
|
1216
|
+
showIcon: !1,
|
|
1217
|
+
autoFocus: !1
|
|
1218
|
+
};
|
|
1219
|
+
function Lt({
|
|
1220
|
+
options: t = [],
|
|
1221
|
+
model: l,
|
|
1222
|
+
labelField: e = "label",
|
|
1223
|
+
formOpr: u = {}
|
|
1224
|
+
}) {
|
|
1225
|
+
return computed(
|
|
1226
|
+
() => (t == null ? void 0 : t.reduce((a, { fields: i, ...n }) => {
|
|
1227
|
+
var o, c;
|
|
1228
|
+
Array.isArray(n == null ? void 0 : n.key) && n.key.forEach((m) => {
|
|
1229
|
+
n != null && n.required && (a[String(m)] = {
|
|
1230
|
+
key: m,
|
|
1231
|
+
type: "any",
|
|
1232
|
+
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(unref(l), { ...u }) : n == null ? void 0 : n.required : !1,
|
|
1233
|
+
message: (n == null ? void 0 : n.message) || `请选择${n == null ? void 0 : n[e]}`,
|
|
1234
|
+
fields: i
|
|
1235
|
+
});
|
|
1236
|
+
});
|
|
1237
|
+
const f = n != null && n.rule ? typeof (n == null ? void 0 : n.rule) != "function" ? n == null ? void 0 : n.rule : n == null ? void 0 : n.rule(unref(l), { ...u }) : i ? {
|
|
1238
|
+
key: n == null ? void 0 : n.key,
|
|
1239
|
+
type: "any",
|
|
1240
|
+
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(unref(l), { ...u }) : n == null ? void 0 : n.required : !1,
|
|
1241
|
+
message: (n == null ? void 0 : n.message) || `请${(o = n == null ? void 0 : n.options) != null && o.length ? "选择" : "输入"}${n == null ? void 0 : n[e]}`,
|
|
1242
|
+
fields: i
|
|
1243
|
+
} : {
|
|
1244
|
+
key: n == null ? void 0 : n.key,
|
|
1245
|
+
type: "any",
|
|
1246
|
+
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(unref(l), { ...u }) : n == null ? void 0 : n.required : !1,
|
|
1247
|
+
message: (n == null ? void 0 : n.message) || `请${(c = n == null ? void 0 : n.options) != null && c.length ? "选择" : "输入"}${n == null ? void 0 : n[e]}`,
|
|
1248
|
+
...Array.isArray(n == null ? void 0 : n.key) ? {
|
|
1249
|
+
validator: (m) => (console.log(m), !(n == null ? void 0 : n.key.every((b) => unref(l)[b])) && (n != null && n.required) ? new Error(m == null ? void 0 : m.message) : !0)
|
|
1250
|
+
} : {}
|
|
1251
|
+
};
|
|
1252
|
+
return f != null && f.required && (a[String(n == null ? void 0 : n.key)] = f), a;
|
|
1253
|
+
}, {})) || {}
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
const Be = {
|
|
1257
|
+
__name: "DataForm",
|
|
1258
|
+
props: /* @__PURE__ */ ie({
|
|
1259
|
+
isNo: {
|
|
1260
|
+
type: Boolean,
|
|
1261
|
+
default: () => !0
|
|
1262
|
+
},
|
|
1263
|
+
read: {
|
|
1264
|
+
type: Boolean,
|
|
1265
|
+
default: () => !1
|
|
1266
|
+
},
|
|
1267
|
+
labelField: {
|
|
1268
|
+
type: String,
|
|
1269
|
+
default: () => "label"
|
|
1270
|
+
},
|
|
1271
|
+
contentStyle: {
|
|
1272
|
+
type: Object,
|
|
1273
|
+
default: () => ({})
|
|
1274
|
+
},
|
|
1275
|
+
options: {
|
|
1276
|
+
type: Array,
|
|
1277
|
+
default: () => []
|
|
1278
|
+
},
|
|
1279
|
+
rules: {
|
|
1280
|
+
type: Object,
|
|
1281
|
+
default: () => ({})
|
|
1282
|
+
},
|
|
1283
|
+
formProps: {
|
|
1284
|
+
type: Object,
|
|
1285
|
+
default: () => ({})
|
|
1286
|
+
},
|
|
1287
|
+
formItemProps: {
|
|
1288
|
+
type: Object,
|
|
1289
|
+
default: () => ({})
|
|
1290
|
+
},
|
|
1291
|
+
dialog: {
|
|
1292
|
+
type: Boolean,
|
|
1293
|
+
default: () => !1
|
|
1294
|
+
}
|
|
1295
|
+
}, {
|
|
1296
|
+
value: {
|
|
1297
|
+
type: Object,
|
|
1298
|
+
default: () => ({})
|
|
1299
|
+
},
|
|
1300
|
+
valueModifiers: {}
|
|
1301
|
+
}),
|
|
1302
|
+
emits: ["update:value"],
|
|
1303
|
+
setup(t, { expose: l }) {
|
|
1304
|
+
const e = t, u = computed(() => e.options), a = U(), i = $e(t, "value"), n = computed(() => w(
|
|
1305
|
+
u.value ? Lt({
|
|
1306
|
+
options: u.value,
|
|
1307
|
+
model: i,
|
|
1308
|
+
labelField: e.labelField,
|
|
1309
|
+
formOpr: { formRef: a }
|
|
1310
|
+
}) : {}
|
|
1311
|
+
));
|
|
1312
|
+
return console.log(n.value), l({
|
|
1313
|
+
formRef: a,
|
|
1314
|
+
getRule: () => n.value,
|
|
1315
|
+
valid: (f = []) => (console.log("?? valid", f), new Promise((o, c) => {
|
|
1316
|
+
var x;
|
|
1317
|
+
const m = ce(f);
|
|
1318
|
+
(x = a.value) == null || x.validate((b) => {
|
|
1319
|
+
if (b) return c(b);
|
|
1320
|
+
o();
|
|
1321
|
+
}, (b) => m.length ? m.includes(b == null ? void 0 : b.key) : !0);
|
|
1322
|
+
})),
|
|
1323
|
+
confirm: (f) => new Promise((o, c) => {
|
|
1324
|
+
var m;
|
|
1325
|
+
(m = a.value) == null || m.validate((x) => {
|
|
1326
|
+
if (x) return c(x);
|
|
1327
|
+
f && f(w(i)), o(w(i));
|
|
1328
|
+
});
|
|
1329
|
+
})
|
|
1330
|
+
}), (f, o) => (q(), V(w(mt), I({
|
|
1331
|
+
ref_key: "formRef",
|
|
1332
|
+
ref: a,
|
|
1333
|
+
model: i.value,
|
|
1334
|
+
rules: e.read ? {} : w(n),
|
|
1335
|
+
"label-placement": "left",
|
|
1336
|
+
"label-width": "100px",
|
|
1337
|
+
"require-mark-placement": "right-hanging",
|
|
1338
|
+
class: e.dialog ? e.read ? "core-dialog-content" : "core-dialog-main" : "",
|
|
1339
|
+
style: { minHeight: e.isNo ? "unset" : null }
|
|
1340
|
+
}, e.formProps), {
|
|
1341
|
+
default: B(() => [
|
|
1342
|
+
d(w(zt), {
|
|
1343
|
+
value: i.value,
|
|
1344
|
+
"onUpdate:value": o[0] || (o[0] = (c) => i.value = c),
|
|
1345
|
+
"form-ref": a.value,
|
|
1346
|
+
option: e.options,
|
|
1347
|
+
"label-field": e.labelField,
|
|
1348
|
+
read: e.read,
|
|
1349
|
+
style: De(e.contentStyle),
|
|
1350
|
+
"form-props": e.formProps
|
|
1351
|
+
}, null, 8, ["value", "form-ref", "option", "label-field", "read", "style", "form-props"])
|
|
1352
|
+
]),
|
|
1353
|
+
_: 1
|
|
1354
|
+
}, 16, ["model", "rules", "class", "style"]));
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
function Wt(t) {
|
|
1358
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !H(t);
|
|
1359
|
+
}
|
|
1360
|
+
function Ht({
|
|
1361
|
+
title: t = "",
|
|
1362
|
+
noTitle: l = !1,
|
|
1363
|
+
titleFull: e = null,
|
|
1364
|
+
options: u = [],
|
|
1365
|
+
mode: a = "add",
|
|
1366
|
+
modeEnum: i = {},
|
|
1367
|
+
labelField: n = "label",
|
|
1368
|
+
isNo: f = !0,
|
|
1369
|
+
formProps: o = {},
|
|
1370
|
+
interfaceFn: c = null,
|
|
1371
|
+
interfaceFnCancel: m = null,
|
|
1372
|
+
valueData: x,
|
|
1373
|
+
read: b,
|
|
1374
|
+
isRead: A,
|
|
1375
|
+
action: N = null,
|
|
1376
|
+
contentStyle: r = {},
|
|
1377
|
+
actionProps: h = {}
|
|
1378
|
+
} = {
|
|
1379
|
+
title: "自定义弹窗",
|
|
1380
|
+
noTitle: !1,
|
|
1381
|
+
action: [],
|
|
1382
|
+
options: [],
|
|
1383
|
+
read: !1,
|
|
1384
|
+
isRead: !1,
|
|
1385
|
+
valueData: {}
|
|
1386
|
+
}, y = null) {
|
|
1387
|
+
var ye;
|
|
1388
|
+
const g = {
|
|
1389
|
+
none: {
|
|
1390
|
+
sub: "",
|
|
1391
|
+
read: !1
|
|
1392
|
+
},
|
|
1393
|
+
create: {
|
|
1394
|
+
sub: "创建",
|
|
1395
|
+
read: !1
|
|
1396
|
+
},
|
|
1397
|
+
add: {
|
|
1398
|
+
sub: "添加",
|
|
1399
|
+
read: !1
|
|
1400
|
+
},
|
|
1401
|
+
edit: {
|
|
1402
|
+
sub: "编辑",
|
|
1403
|
+
read: !1
|
|
1404
|
+
},
|
|
1405
|
+
view: {
|
|
1406
|
+
sub: "查看",
|
|
1407
|
+
read: !0
|
|
1408
|
+
},
|
|
1409
|
+
export: {
|
|
1410
|
+
sub: "导出",
|
|
1411
|
+
read: !1
|
|
1412
|
+
},
|
|
1413
|
+
import: {
|
|
1414
|
+
sub: "导入",
|
|
1415
|
+
read: !1
|
|
1416
|
+
},
|
|
1417
|
+
delete: {
|
|
1418
|
+
sub: "删除",
|
|
1419
|
+
read: !1
|
|
1420
|
+
},
|
|
1421
|
+
copy: {
|
|
1422
|
+
sub: "复制",
|
|
1423
|
+
read: !1
|
|
1424
|
+
},
|
|
1425
|
+
...i
|
|
1426
|
+
}, s = U(), p = He([]), S = U({
|
|
1427
|
+
...x
|
|
1428
|
+
}), F = {
|
|
1429
|
+
justify: "end",
|
|
1430
|
+
wrapItem: !1,
|
|
1431
|
+
style: {
|
|
1432
|
+
width: "100%"
|
|
1433
|
+
}
|
|
1434
|
+
}, C = {
|
|
1435
|
+
width: "120px"
|
|
1436
|
+
}, $ = [{
|
|
1437
|
+
label: "取消",
|
|
1438
|
+
props: {
|
|
1439
|
+
type: "primary",
|
|
1440
|
+
ghost: !0
|
|
1441
|
+
},
|
|
1442
|
+
onClick: ({
|
|
1443
|
+
cancel: D
|
|
1444
|
+
}) => {
|
|
1445
|
+
m ? m(w(S), {
|
|
1446
|
+
close: D
|
|
1447
|
+
}) : D();
|
|
1448
|
+
}
|
|
1449
|
+
}, {
|
|
1450
|
+
label: "确定",
|
|
1451
|
+
valid: !0,
|
|
1452
|
+
onClick: async ({
|
|
1453
|
+
cancel: D,
|
|
1454
|
+
hideLoading: O
|
|
1455
|
+
}) => c ? await c(w(S), {
|
|
1456
|
+
close: D,
|
|
1457
|
+
hideLoading: O
|
|
1458
|
+
}) : D()
|
|
1459
|
+
}];
|
|
1460
|
+
N || $.forEach((D, O) => {
|
|
1461
|
+
p[O] = !1;
|
|
1462
|
+
});
|
|
1463
|
+
const K = typeof e == "function" ? () => {
|
|
1464
|
+
var D;
|
|
1465
|
+
return e((D = g[a]) == null ? void 0 : D.sub);
|
|
1466
|
+
} : e, M = $dialog.create({
|
|
1467
|
+
type: "info",
|
|
1468
|
+
...Kt,
|
|
1469
|
+
...l ? {} : {
|
|
1470
|
+
title: K || (((ye = g[a]) == null ? void 0 : ye.sub) ?? "") + t
|
|
1471
|
+
},
|
|
1472
|
+
style: {
|
|
1473
|
+
width: "500px"
|
|
1474
|
+
},
|
|
1475
|
+
content: () => d(Be, {
|
|
1476
|
+
ref: (D) => {
|
|
1477
|
+
s.value = D;
|
|
1478
|
+
},
|
|
1479
|
+
options: u,
|
|
1480
|
+
value: S.value,
|
|
1481
|
+
"onUpdate:value": (D) => S.value = D,
|
|
1482
|
+
isNo: f,
|
|
1483
|
+
read: b ?? A,
|
|
1484
|
+
labelField: n,
|
|
1485
|
+
formProps: o,
|
|
1486
|
+
contentStyle: r,
|
|
1487
|
+
dialog: !0
|
|
1488
|
+
}, null),
|
|
1489
|
+
action: b ?? A ? null : typeof N == "function" ? () => N({
|
|
1490
|
+
formRef: s,
|
|
1491
|
+
data: w(S),
|
|
1492
|
+
d: M,
|
|
1493
|
+
close: J
|
|
1494
|
+
}) : () => {
|
|
1495
|
+
let D;
|
|
1496
|
+
return d(k, I(F, h, {
|
|
1497
|
+
style: {
|
|
1498
|
+
...F == null ? void 0 : F.style,
|
|
1499
|
+
...(h == null ? void 0 : h.style) || {}
|
|
1500
|
+
}
|
|
1501
|
+
}), Wt(D = (N || $).map((O, te) => {
|
|
1502
|
+
var me;
|
|
1503
|
+
return O != null && O.render ? (me = O == null ? void 0 : O.render) == null ? void 0 : me.call(O) : d(z, I({
|
|
1504
|
+
type: "primary",
|
|
1505
|
+
ghost: O.mode === "cancel"
|
|
1506
|
+
}, {
|
|
1507
|
+
...O == null ? void 0 : O.props,
|
|
1508
|
+
...h == null ? void 0 : h.buttonProps
|
|
1509
|
+
}, {
|
|
1510
|
+
style: {
|
|
1511
|
+
...C,
|
|
1512
|
+
...(O == null ? void 0 : O.style) || {}
|
|
1513
|
+
},
|
|
1514
|
+
loading: p[te],
|
|
1515
|
+
onClick: async () => {
|
|
1516
|
+
if (O.mode === "cancel")
|
|
1517
|
+
M.destroy();
|
|
1518
|
+
else {
|
|
1519
|
+
const le = () => p[te] = !0, he = () => p[te] = !1;
|
|
1520
|
+
O != null && O.loading && le();
|
|
1521
|
+
try {
|
|
1522
|
+
console.log("model", w(S)), O != null && O.valid && await ee(), console.log(O == null ? void 0 : O.valid), (O != null && O.valid || O != null && O.loading) && le(), await (O == null ? void 0 : O.onClick({
|
|
1523
|
+
model: w(S),
|
|
1524
|
+
comfirm: _e,
|
|
1525
|
+
cancel: J,
|
|
1526
|
+
validate: ee,
|
|
1527
|
+
showLoading: le,
|
|
1528
|
+
hideLoading: he
|
|
1529
|
+
}));
|
|
1530
|
+
} catch (ke) {
|
|
1531
|
+
console.log(ke);
|
|
1532
|
+
} finally {
|
|
1533
|
+
(O != null && O.valid || O != null && O.loading) && he();
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}), {
|
|
1538
|
+
default: () => [O.label || ""]
|
|
1539
|
+
});
|
|
1540
|
+
})) ? D : {
|
|
1541
|
+
default: () => [D]
|
|
1542
|
+
});
|
|
1543
|
+
},
|
|
1544
|
+
// ...readButton.value,
|
|
1545
|
+
...y,
|
|
1546
|
+
class: `core-dialog ${w(b) ? "core-dialog-read" : ""} ${(y == null ? void 0 : y.class) || ""}`
|
|
1547
|
+
});
|
|
1548
|
+
function J() {
|
|
1549
|
+
console.log("取消", S.value), M == null || M.destroy();
|
|
1550
|
+
}
|
|
1551
|
+
async function ee(D = []) {
|
|
1552
|
+
var O;
|
|
1553
|
+
console.log("开启验证"), await ((O = s.value) == null ? void 0 : O.valid());
|
|
1554
|
+
}
|
|
1555
|
+
async function _e(D) {
|
|
1556
|
+
return D && D();
|
|
1557
|
+
}
|
|
1558
|
+
return {
|
|
1559
|
+
cancel: J,
|
|
1560
|
+
setValue: (D, O) => O ? S.value[O] = D : S.value = {
|
|
1561
|
+
...S.value,
|
|
1562
|
+
...D
|
|
1563
|
+
},
|
|
1564
|
+
model: w(S),
|
|
1565
|
+
modeEnum: g
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
const Jt = {
|
|
1569
|
+
class: "flex-1"
|
|
1570
|
+
}, Gt = {
|
|
1571
|
+
__name: "CommonQuery",
|
|
1572
|
+
props: /* @__PURE__ */ ie({
|
|
1573
|
+
inlineText: {
|
|
1574
|
+
type: Boolean,
|
|
1575
|
+
default: () => !0
|
|
1576
|
+
},
|
|
1577
|
+
options: {
|
|
1578
|
+
type: Array,
|
|
1579
|
+
default: () => []
|
|
1580
|
+
},
|
|
1581
|
+
query: {
|
|
1582
|
+
type: Object,
|
|
1583
|
+
default: () => ({})
|
|
1584
|
+
},
|
|
1585
|
+
selectCount: {
|
|
1586
|
+
type: Number,
|
|
1587
|
+
default: () => 1
|
|
1588
|
+
},
|
|
1589
|
+
type: {
|
|
1590
|
+
type: String,
|
|
1591
|
+
default: () => "primary"
|
|
1592
|
+
},
|
|
1593
|
+
noButton: {
|
|
1594
|
+
type: Boolean,
|
|
1595
|
+
default: () => !1
|
|
1596
|
+
},
|
|
1597
|
+
isRead: {
|
|
1598
|
+
type: Boolean,
|
|
1599
|
+
default: () => !1
|
|
1600
|
+
},
|
|
1601
|
+
btn: {
|
|
1602
|
+
type: Array,
|
|
1603
|
+
default: () => ["reset", "search"]
|
|
1604
|
+
},
|
|
1605
|
+
size: {
|
|
1606
|
+
type: String,
|
|
1607
|
+
default: () => "medium"
|
|
1608
|
+
}
|
|
1609
|
+
}, {
|
|
1610
|
+
query: {
|
|
1611
|
+
type: Object,
|
|
1612
|
+
default: () => ({})
|
|
1613
|
+
},
|
|
1614
|
+
queryModifiers: {}
|
|
1615
|
+
}),
|
|
1616
|
+
emits: /* @__PURE__ */ ie(["update:query", "submit", "reset"], ["update:query"]),
|
|
1617
|
+
setup(t, {
|
|
1618
|
+
emit: l
|
|
1619
|
+
}) {
|
|
1620
|
+
function e(y, g) {
|
|
1621
|
+
let s;
|
|
1622
|
+
return function(...p) {
|
|
1623
|
+
clearTimeout(s), s = setTimeout(() => {
|
|
1624
|
+
y.apply(this, p);
|
|
1625
|
+
}, g);
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
const u = l, a = t;
|
|
1629
|
+
function i(y) {
|
|
1630
|
+
return y.map((g) => ({
|
|
1631
|
+
...g,
|
|
1632
|
+
props: {
|
|
1633
|
+
...g.props,
|
|
1634
|
+
...!g.way || g.way === "input" ? {
|
|
1635
|
+
onUpdateValue: (...s) => {
|
|
1636
|
+
var p, S;
|
|
1637
|
+
(S = (p = s.props) == null ? void 0 : p.onUpdateValue) == null || S.call(p, ...s), n();
|
|
1638
|
+
}
|
|
1639
|
+
} : {},
|
|
1640
|
+
...(g == null ? void 0 : g.way) === "select" ? {
|
|
1641
|
+
onUpdateValue: (...s) => {
|
|
1642
|
+
var p, S;
|
|
1643
|
+
(S = (p = s.props) == null ? void 0 : p.onUpdateValue) == null || S.call(p, ...s), n();
|
|
1644
|
+
}
|
|
1645
|
+
} : {}
|
|
1646
|
+
}
|
|
1647
|
+
}));
|
|
1648
|
+
}
|
|
1649
|
+
const n = e(() => {
|
|
1650
|
+
u("submit");
|
|
1651
|
+
}, 500);
|
|
1652
|
+
function f() {
|
|
1653
|
+
n();
|
|
1654
|
+
}
|
|
1655
|
+
const o = U(!1), c = $e(t, "query"), m = {
|
|
1656
|
+
style: {
|
|
1657
|
+
width: "33%"
|
|
1658
|
+
}
|
|
1659
|
+
}, x = _(() => {
|
|
1660
|
+
var y;
|
|
1661
|
+
return (y = a.options) == null ? void 0 : y.map((g) => (g == null ? void 0 : g.way) || "input");
|
|
1662
|
+
});
|
|
1663
|
+
Ee(x.value);
|
|
1664
|
+
const b = _(() => {
|
|
1665
|
+
try {
|
|
1666
|
+
const y = [];
|
|
1667
|
+
for (let g = 0; g < a.options.length; g++) {
|
|
1668
|
+
const s = a.options[g];
|
|
1669
|
+
s != null && s.enum && !(s != null && s.options) && (s.options = qe(s.enum)), s != null && s.props || (s.props = {
|
|
1670
|
+
size: a.size
|
|
1671
|
+
}), s != null && s.formItemProps ? s.formItemProps = {
|
|
1672
|
+
...m,
|
|
1673
|
+
...s.formItemProps,
|
|
1674
|
+
style: {
|
|
1675
|
+
...m.style,
|
|
1676
|
+
...s.formItemProps.style
|
|
1677
|
+
}
|
|
1678
|
+
} : s.formItemProps = {
|
|
1679
|
+
...m
|
|
1680
|
+
};
|
|
1681
|
+
const p = (s == null ? void 0 : s.key) || (s == null ? void 0 : s.value);
|
|
1682
|
+
if (!p) throw new Error("key no set");
|
|
1683
|
+
y.push({
|
|
1684
|
+
...s,
|
|
1685
|
+
key: p
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
return i(y);
|
|
1689
|
+
} catch (y) {
|
|
1690
|
+
return console.warn("error", y), [];
|
|
1691
|
+
}
|
|
1692
|
+
}), A = {
|
|
1693
|
+
style: {
|
|
1694
|
+
borderRadius: "3px"
|
|
1695
|
+
}
|
|
1696
|
+
}, N = {
|
|
1697
|
+
search: () => d(E("NButton"), I({
|
|
1698
|
+
type: a.type,
|
|
1699
|
+
loading: o.value,
|
|
1700
|
+
"default-props": {
|
|
1701
|
+
attrType: "submit"
|
|
1702
|
+
},
|
|
1703
|
+
onClick: () => f()
|
|
1704
|
+
}, A), {
|
|
1705
|
+
default: () => "搜索",
|
|
1706
|
+
icon: () => d(xt, null, null)
|
|
1707
|
+
}),
|
|
1708
|
+
reset: () => d(E("NButton"), I({
|
|
1709
|
+
type: "default",
|
|
1710
|
+
onClick: () => {
|
|
1711
|
+
r();
|
|
1712
|
+
}
|
|
1713
|
+
}, A), {
|
|
1714
|
+
default: () => "重置",
|
|
1715
|
+
icon: () => d(bt, null, null)
|
|
1716
|
+
})
|
|
1717
|
+
};
|
|
1718
|
+
function r() {
|
|
1719
|
+
a.options.forEach((y) => {
|
|
1720
|
+
const g = (y == null ? void 0 : y.key) || (y == null ? void 0 : y.value);
|
|
1721
|
+
g && (y != null && y.queryType ? c.value[y.queryType][g] = null : c.value[g] = null);
|
|
1722
|
+
}), u("reset");
|
|
1723
|
+
}
|
|
1724
|
+
function h(y) {
|
|
1725
|
+
y.key === "Enter" && f();
|
|
1726
|
+
}
|
|
1727
|
+
return Fe(() => {
|
|
1728
|
+
document.addEventListener("keydown", h);
|
|
1729
|
+
}), Je(() => {
|
|
1730
|
+
document.removeEventListener("keydown", h);
|
|
1731
|
+
}), (y, g) => {
|
|
1732
|
+
const s = E("n-space");
|
|
1733
|
+
return q(), V(s, {
|
|
1734
|
+
"wrap-item": !1,
|
|
1735
|
+
justify: "space-between",
|
|
1736
|
+
align: "center",
|
|
1737
|
+
wrap: !1
|
|
1738
|
+
}, {
|
|
1739
|
+
default: B(() => [fe("div", Jt, [d(w(Be), {
|
|
1740
|
+
value: c.value,
|
|
1741
|
+
"onUpdate:value": g[0] || (g[0] = (p) => c.value = p),
|
|
1742
|
+
options: b.value,
|
|
1743
|
+
"form-props": {
|
|
1744
|
+
showFeedback: !1
|
|
1745
|
+
}
|
|
1746
|
+
}, null, 8, ["value", "options"])]), a.noButton ? Ge("", !0) : (q(), V(s, {
|
|
1747
|
+
key: 0,
|
|
1748
|
+
align: "center",
|
|
1749
|
+
wrap: !1
|
|
1750
|
+
}, {
|
|
1751
|
+
default: B(() => [oe(y.$slots, "left-btn", {}, void 0, !0), (q(!0), G(Z, null, ue(a.btn, (p, S) => {
|
|
1752
|
+
var F;
|
|
1753
|
+
return q(), V(Xe((F = N == null ? void 0 : N[p]) == null ? void 0 : F.call(N)), {
|
|
1754
|
+
key: S
|
|
1755
|
+
});
|
|
1756
|
+
}), 128)), oe(y.$slots, "right-btn", {}, void 0, !0)]),
|
|
1757
|
+
_: 3
|
|
1758
|
+
}))]),
|
|
1759
|
+
_: 3
|
|
1760
|
+
});
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
}, ml = /* @__PURE__ */ v(Gt, [["__scopeId", "data-v-a0acb8e2"]]), Ye = /* @__PURE__ */ Q(({
|
|
1764
|
+
action: t,
|
|
1765
|
+
row: l,
|
|
1766
|
+
index: e
|
|
1767
|
+
}) => {
|
|
1768
|
+
const {
|
|
1769
|
+
onClick: u,
|
|
1770
|
+
disabled: a,
|
|
1771
|
+
type: i = "primary",
|
|
1772
|
+
loading: n = !1,
|
|
1773
|
+
label: f = null,
|
|
1774
|
+
...o
|
|
1775
|
+
} = t, c = U(!1);
|
|
1776
|
+
return () => d(z, I({
|
|
1777
|
+
text: !0,
|
|
1778
|
+
onClick: async () => {
|
|
1779
|
+
if (u)
|
|
1780
|
+
try {
|
|
1781
|
+
n && (c.value = !0), await u(l, e);
|
|
1782
|
+
} finally {
|
|
1783
|
+
setTimeout(() => c.value = !1, 500);
|
|
1784
|
+
}
|
|
1785
|
+
},
|
|
1786
|
+
disabled: a && a(l),
|
|
1787
|
+
loading: c.value,
|
|
1788
|
+
type: a && a(l) ? "default" : i
|
|
1789
|
+
}, o), {
|
|
1790
|
+
default: () => [typeof f == "function" ? f == null ? void 0 : f(l) : f]
|
|
1791
|
+
});
|
|
1792
|
+
}, {
|
|
1793
|
+
props: {
|
|
1794
|
+
action: {
|
|
1795
|
+
type: [Object, null],
|
|
1796
|
+
default: null
|
|
1797
|
+
},
|
|
1798
|
+
row: {
|
|
1799
|
+
type: [Object, null],
|
|
1800
|
+
default: null
|
|
1801
|
+
},
|
|
1802
|
+
index: {
|
|
1803
|
+
type: Number,
|
|
1804
|
+
default: 0
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}), Te = /* @__PURE__ */ Q(({
|
|
1808
|
+
onClick: t,
|
|
1809
|
+
row: l,
|
|
1810
|
+
index: e,
|
|
1811
|
+
action: u
|
|
1812
|
+
}, {
|
|
1813
|
+
slots: a
|
|
1814
|
+
}) => {
|
|
1815
|
+
const i = U(!1);
|
|
1816
|
+
return () => d(ht, {
|
|
1817
|
+
"positive-button-props": {
|
|
1818
|
+
type: "warning",
|
|
1819
|
+
loading: i.value
|
|
1820
|
+
},
|
|
1821
|
+
onPositiveClick: async () => {
|
|
1822
|
+
try {
|
|
1823
|
+
if (t)
|
|
1824
|
+
return i.value = !0, await t(l, e), i.value = !1, !0;
|
|
1825
|
+
} catch {
|
|
1826
|
+
return i.value = !1, !1;
|
|
1827
|
+
}
|
|
1828
|
+
return !1;
|
|
1829
|
+
}
|
|
1830
|
+
}, {
|
|
1831
|
+
trigger: a.default,
|
|
1832
|
+
default: () => {
|
|
1833
|
+
var n;
|
|
1834
|
+
return ((n = u == null ? void 0 : u.popProps) == null ? void 0 : n.content) || (u == null ? void 0 : u.content) || "确定删除该记录?";
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
}, {
|
|
1838
|
+
props: {
|
|
1839
|
+
onClick: {
|
|
1840
|
+
type: [Function, null],
|
|
1841
|
+
default: null
|
|
1842
|
+
},
|
|
1843
|
+
row: {
|
|
1844
|
+
type: [Object, null],
|
|
1845
|
+
default: null
|
|
1846
|
+
},
|
|
1847
|
+
action: {
|
|
1848
|
+
type: [Object, null],
|
|
1849
|
+
default: null
|
|
1850
|
+
},
|
|
1851
|
+
index: {
|
|
1852
|
+
type: Number,
|
|
1853
|
+
default: 0
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
function Ae(t) {
|
|
1858
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !H(t);
|
|
1859
|
+
}
|
|
1860
|
+
const Xt = /* @__PURE__ */ Q((t) => {
|
|
1861
|
+
const l = t.options.length, e = U(!1), u = _(() => t.options.slice(0, e.value ? l : t.max)), a = _(() => t.options.slice(t.max));
|
|
1862
|
+
function i(n) {
|
|
1863
|
+
return n == null ? void 0 : n.map(({
|
|
1864
|
+
isRender: f = () => !0,
|
|
1865
|
+
onClick: o = null,
|
|
1866
|
+
mode: c = null,
|
|
1867
|
+
disabled: m = !1,
|
|
1868
|
+
type: x = "primary",
|
|
1869
|
+
...b
|
|
1870
|
+
}, A) => f != null && f(t.data) ? c === "pop" ? d(Te, {
|
|
1871
|
+
onClick: o,
|
|
1872
|
+
row: t.data,
|
|
1873
|
+
action: b,
|
|
1874
|
+
key: X(t.data, t.index) + A
|
|
1875
|
+
}, {
|
|
1876
|
+
default: () => [d(z, I({
|
|
1877
|
+
text: !0,
|
|
1878
|
+
disabled: m && m(t.data),
|
|
1879
|
+
type: m && m(t.data) ? "default" : x
|
|
1880
|
+
}, b), {
|
|
1881
|
+
default: () => [typeof (b == null ? void 0 : b.label) == "function" ? b == null ? void 0 : b.label(t.data) : b == null ? void 0 : b.label]
|
|
1882
|
+
})]
|
|
1883
|
+
}) : d(Ye, {
|
|
1884
|
+
row: t.data,
|
|
1885
|
+
action: {
|
|
1886
|
+
...b,
|
|
1887
|
+
disabled: m,
|
|
1888
|
+
onClick: o,
|
|
1889
|
+
type: x
|
|
1890
|
+
},
|
|
1891
|
+
key: X(t.data, t.index) + A
|
|
1892
|
+
}, null) : void 0).filter((f) => f);
|
|
1893
|
+
}
|
|
1894
|
+
return () => {
|
|
1895
|
+
let n;
|
|
1896
|
+
return d(k, {
|
|
1897
|
+
style: {
|
|
1898
|
+
width: "100%"
|
|
1899
|
+
},
|
|
1900
|
+
"wrap-item": !1,
|
|
1901
|
+
justify: "center",
|
|
1902
|
+
align: "center"
|
|
1903
|
+
}, {
|
|
1904
|
+
default: () => [d(k, {
|
|
1905
|
+
"wrap-item": !1,
|
|
1906
|
+
align: "center"
|
|
1907
|
+
}, Ae(n = i(u.value)) ? n : {
|
|
1908
|
+
default: () => [n]
|
|
1909
|
+
}), d(gt, {
|
|
1910
|
+
trigger: "click"
|
|
1911
|
+
}, {
|
|
1912
|
+
trigger: () => d(z, {
|
|
1913
|
+
text: !0,
|
|
1914
|
+
type: "info"
|
|
1915
|
+
}, {
|
|
1916
|
+
default: () => [L("更多")]
|
|
1917
|
+
}),
|
|
1918
|
+
default: () => {
|
|
1919
|
+
let f;
|
|
1920
|
+
return d(k, {
|
|
1921
|
+
"wrap-item": !1,
|
|
1922
|
+
align: "center",
|
|
1923
|
+
style: {
|
|
1924
|
+
width: "250px",
|
|
1925
|
+
padding: "5px"
|
|
1926
|
+
}
|
|
1927
|
+
}, Ae(f = i(a.value)) ? f : {
|
|
1928
|
+
default: () => [f]
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
})]
|
|
1932
|
+
});
|
|
1933
|
+
};
|
|
1934
|
+
}, {
|
|
1935
|
+
name: "DataColumnCollet",
|
|
1936
|
+
props: {
|
|
1937
|
+
options: {
|
|
1938
|
+
type: Array,
|
|
1939
|
+
default: () => []
|
|
1940
|
+
},
|
|
1941
|
+
max: {
|
|
1942
|
+
type: Number,
|
|
1943
|
+
default: 3
|
|
1944
|
+
},
|
|
1945
|
+
data: {
|
|
1946
|
+
type: Object,
|
|
1947
|
+
default: () => {
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
index: {
|
|
1951
|
+
type: Number,
|
|
1952
|
+
default: 0
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
function Zt(t) {
|
|
1957
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !H(t);
|
|
1958
|
+
}
|
|
1959
|
+
const X = (t, l) => t ? JSON.stringify(t) : l;
|
|
1960
|
+
function hl(t, l = null, e) {
|
|
1961
|
+
const u = {
|
|
1962
|
+
max: 4,
|
|
1963
|
+
width: 80
|
|
1964
|
+
};
|
|
1965
|
+
let a = !1;
|
|
1966
|
+
if (typeof e == "boolean" ? a = u : typeof e == "object" && (a = {
|
|
1967
|
+
...u,
|
|
1968
|
+
...e
|
|
1969
|
+
}), console.log("collect", a), console.log(Array.isArray(t)), !Array.isArray(t))
|
|
1970
|
+
throw new TypeError("需要配置数组");
|
|
1971
|
+
console.log("ddd");
|
|
1972
|
+
let i = [], n = 0;
|
|
1973
|
+
const f = [];
|
|
1974
|
+
return Array.isArray(t) && (i = t, i.forEach((o, c) => {
|
|
1975
|
+
var m, x;
|
|
1976
|
+
o.permission ? Nt(o.permission) && ((!e || c < a.max) && (n += ((m = o == null ? void 0 : o.label) == null ? void 0 : m.length) * 12 + 36), f.push(o)) : ((!e || c < a.max) && (n += ((x = o == null ? void 0 : o.label) == null ? void 0 : x.length) * 12 + 36), f.push(o));
|
|
1977
|
+
})), n = Math.max(80, n), n += 0, a && (n += 2), f.length ? {
|
|
1978
|
+
title: "操作",
|
|
1979
|
+
key: "opr",
|
|
1980
|
+
fixed: "right",
|
|
1981
|
+
align: "left",
|
|
1982
|
+
width: n,
|
|
1983
|
+
...l,
|
|
1984
|
+
render(o, c) {
|
|
1985
|
+
const m = a ? d(Xt, {
|
|
1986
|
+
data: o,
|
|
1987
|
+
index: c,
|
|
1988
|
+
max: a.max,
|
|
1989
|
+
options: f
|
|
1990
|
+
}, null) : f.map(({
|
|
1991
|
+
isRender: x = () => !0,
|
|
1992
|
+
onClick: b = null,
|
|
1993
|
+
mode: A = null,
|
|
1994
|
+
disabled: N = !1,
|
|
1995
|
+
type: r = "primary",
|
|
1996
|
+
...h
|
|
1997
|
+
}, y) => x != null && x(o) ? A === "pop" ? d(Te, {
|
|
1998
|
+
onClick: b,
|
|
1999
|
+
row: o,
|
|
2000
|
+
index: c,
|
|
2001
|
+
action: h,
|
|
2002
|
+
key: X(o, c) + y
|
|
2003
|
+
}, {
|
|
2004
|
+
default: () => [d(z, I({
|
|
2005
|
+
text: !0,
|
|
2006
|
+
disabled: N && N(o),
|
|
2007
|
+
type: N && N(o) ? "default" : r
|
|
2008
|
+
}, h), {
|
|
2009
|
+
default: () => [typeof (h == null ? void 0 : h.label) == "function" ? h == null ? void 0 : h.label(o) : h == null ? void 0 : h.label]
|
|
2010
|
+
})]
|
|
2011
|
+
}) : d(Ye, {
|
|
2012
|
+
row: o,
|
|
2013
|
+
action: {
|
|
2014
|
+
...h,
|
|
2015
|
+
disabled: N,
|
|
2016
|
+
onClick: b,
|
|
2017
|
+
type: r
|
|
2018
|
+
},
|
|
2019
|
+
index: c,
|
|
2020
|
+
key: X(o, c) + y
|
|
2021
|
+
}, null) : void 0).filter((x) => x);
|
|
2022
|
+
return l != null && l.isRender ? l == null ? void 0 : l.render(o) : d(k, {
|
|
2023
|
+
align: "center",
|
|
2024
|
+
"wrap-item": !1,
|
|
2025
|
+
size: 18,
|
|
2026
|
+
key: X(o, c)
|
|
2027
|
+
}, Zt(m) ? m : {
|
|
2028
|
+
default: () => [m]
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
} : void 0;
|
|
2032
|
+
}
|
|
2033
|
+
function Qt(t) {
|
|
2034
|
+
var l, e;
|
|
2035
|
+
if ((l = t == null ? void 0 : t.children) != null && l.length) {
|
|
2036
|
+
const u = [];
|
|
2037
|
+
t.children.forEach((a) => {
|
|
2038
|
+
var n, f, o, c;
|
|
2039
|
+
Qt(a);
|
|
2040
|
+
let i = [];
|
|
2041
|
+
typeof ((n = a == null ? void 0 : a.meta) == null ? void 0 : n.permission) == "string" ? i = [a.meta.permission] : Array.isArray((f = a.meta) == null ? void 0 : f.permission) ? i.push(...a.meta.permission) : typeof ((o = a.meta) == null ? void 0 : o.permission) == "object" ? i.push(...vt(Pe(a.meta.permission))) : (c = a == null ? void 0 : a.meta) != null && c.permission || (i = null), a.meta.permission = i, u.push(...new Set(i));
|
|
2042
|
+
}), (e = t == null ? void 0 : t.meta) != null && e.permission ? t.meta.permission = [...new Set(t.meta.permission.concat(u))] : t.meta.permission = u;
|
|
2043
|
+
}
|
|
2044
|
+
return t;
|
|
2045
|
+
}
|
|
2046
|
+
function vt(...t) {
|
|
2047
|
+
const l = t == null ? void 0 : t.map((e) => Array.isArray(e) ? e : e == null ? void 0 : e.ALL);
|
|
2048
|
+
return [].concat(...l);
|
|
2049
|
+
}
|
|
2050
|
+
function Pe(t) {
|
|
2051
|
+
return t ? Object.keys(t).reduce((l, e) => (typeof t[e] != "string" ? l.concat(Pe(t[e])) : l.push(t[e]), l), []) : [];
|
|
2052
|
+
}
|
|
2053
|
+
function gl(...t) {
|
|
2054
|
+
return {
|
|
2055
|
+
...el("api", t)
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
function pl(t, l = {}) {
|
|
2059
|
+
const e = Object.keys(l);
|
|
2060
|
+
return e.length && e.forEach((u) => {
|
|
2061
|
+
const a = new RegExp(`${u}`, "g");
|
|
2062
|
+
t = t == null ? void 0 : t.replace(a, l[u]);
|
|
2063
|
+
}), t;
|
|
2064
|
+
}
|
|
2065
|
+
function el(t, l) {
|
|
2066
|
+
var n;
|
|
2067
|
+
const e = Ue(), u = St(), a = Ie(((n = e == null ? void 0 : e.meta) == null ? void 0 : n[t]) ?? {}), i = ce(l[0]);
|
|
2068
|
+
return i != null && i.length && u.getRoutes().filter((o) => i.includes(o.name)).forEach((o) => {
|
|
2069
|
+
var c;
|
|
2070
|
+
(c = o.meta) != null && c[t] && (a[o.name] = Ie(o.meta[t]));
|
|
2071
|
+
}), {
|
|
2072
|
+
...a
|
|
2073
|
+
};
|
|
2074
|
+
}
|
|
2075
|
+
function Ie(t = {}) {
|
|
2076
|
+
return Object.keys(t).reduce((l, e) => {
|
|
2077
|
+
const u = t[e];
|
|
2078
|
+
return typeof u == "object" ? l[e] = u == null ? void 0 : u.key : typeof u == "string" && (l[e] = String(u)), l;
|
|
2079
|
+
}, {});
|
|
2080
|
+
}
|
|
2081
|
+
function tl(t, l = "") {
|
|
2082
|
+
return t.length ? (t.forEach((e) => {
|
|
2083
|
+
var i;
|
|
2084
|
+
e.children && tl(e.children, e == null ? void 0 : e.path), e.path && (e.sourceFullPath = `${l ? `${l}/`.replace(/^\/\//, "/") : ""}${e.path}`), e.meta || (e.meta = {});
|
|
2085
|
+
const u = (e == null ? void 0 : e.title) ?? ((i = e == null ? void 0 : e.meta) == null ? void 0 : i.title) ?? "未命名页面";
|
|
2086
|
+
e != null && e.api && (e.meta.api = e.api), u && (e.meta.title = u, e.title = u), e != null && e.hidden && (e.meta.hidden = e.hidden);
|
|
2087
|
+
let a = [];
|
|
2088
|
+
e != null && e.auth && (e.meta.auth = e.auth, a = Object.keys(e.auth).reduce((n, f) => (typeof e.auth[f] == "string" ? n.push(e.auth[f]) : typeof e.auth[f] == "boolean" && n.push(f), n), [])), e != null && e.permission && (e.meta.permission = e.permission), e.meta.permission && Array.isArray(e.meta.permission) ? e.meta.permission = e.meta.permission.concat(a) : a.length && (e.meta.permission = a);
|
|
2089
|
+
}), t) : [];
|
|
2090
|
+
}
|
|
2091
|
+
const ae = {
|
|
2092
|
+
ascend: {
|
|
2093
|
+
title: "升序",
|
|
2094
|
+
value: !0,
|
|
2095
|
+
Icon: d(Ct, null, null),
|
|
2096
|
+
fn: (t, l) => {
|
|
2097
|
+
t.desc = !0, t.sortFieldName = l;
|
|
2098
|
+
}
|
|
2099
|
+
},
|
|
2100
|
+
descend: {
|
|
2101
|
+
title: "降序",
|
|
2102
|
+
value: !1,
|
|
2103
|
+
Icon: d(Ot, null, null),
|
|
2104
|
+
fn: (t) => {
|
|
2105
|
+
t.sortFieldName = "", t.desc = !0;
|
|
2106
|
+
}
|
|
2107
|
+
},
|
|
2108
|
+
false: {
|
|
2109
|
+
title: "默认",
|
|
2110
|
+
value: null,
|
|
2111
|
+
Icon: d(wt, {
|
|
2112
|
+
style: "transform:rotateZ(90deg)"
|
|
2113
|
+
}, null),
|
|
2114
|
+
fn: (t) => {
|
|
2115
|
+
t.desc = !1, t.sortFieldName = "";
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
export {
|
|
2120
|
+
Ne as ArrayToObject,
|
|
2121
|
+
ml as CommonQuery,
|
|
2122
|
+
Be as DataForm,
|
|
2123
|
+
Ut as DataTable,
|
|
2124
|
+
qe as ObjectToArray,
|
|
2125
|
+
Ye as OprButton,
|
|
2126
|
+
zt as Options,
|
|
2127
|
+
Te as Pop,
|
|
2128
|
+
Qt as cellectChildenPermission,
|
|
2129
|
+
Ht as commonDialogMethod,
|
|
2130
|
+
hl as createActionColumnJsx,
|
|
2131
|
+
qt as customUpload,
|
|
2132
|
+
Oe as ellipsis,
|
|
2133
|
+
dl as getAllOptions,
|
|
2134
|
+
Ee as getOptions,
|
|
2135
|
+
P as globalLabelField,
|
|
2136
|
+
Y as globalValueField,
|
|
2137
|
+
pl as handleParams,
|
|
2138
|
+
tl as initRouteMeta,
|
|
2139
|
+
Lt as initRules,
|
|
2140
|
+
ae as orderEnum,
|
|
2141
|
+
cl as registryUpload,
|
|
2142
|
+
yl as setupOptions,
|
|
2143
|
+
ce as toArray,
|
|
2144
|
+
gl as useApiConfig
|
|
2145
|
+
};
|