jgy-public-component 0.0.13 → 0.0.15
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.js +304 -324
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/router/guards copy.d.ts +6 -0
- package/dist/style.css +1 -1
- package/package.json +73 -73
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElMessage as
|
|
3
|
-
import { Delete as
|
|
4
|
-
import
|
|
5
|
-
import { Icon as
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as L, openBlock as r, createElementBlock as R, normalizeClass as U, createCommentVNode as j, renderSlot as q, ref as V, watch as ie, resolveComponent as w, createVNode as m, unref as $, withCtx as i, createElementVNode as C, withModifiers as Z, createBlock as b, Fragment as X, toDisplayString as F, mergeProps as fe, computed as re, onMounted as pe, onBeforeUnmount as he, normalizeStyle as ue, createTextVNode as T, useModel as ve, renderList as ee, mergeModels as le } from "vue";
|
|
2
|
+
import { ElMessage as x } from "element-plus";
|
|
3
|
+
import { Delete as G, Plus as Q, Loading as ne, ZoomIn as ge, Search as ye, Refresh as be, ArrowDown as _e } from "@element-plus/icons-vue";
|
|
4
|
+
import ke from "vuedraggable";
|
|
5
|
+
import { Icon as we } from "@iconify/vue";
|
|
6
|
+
import * as N from "xlsx";
|
|
7
|
+
import Y from "nprogress";
|
|
8
|
+
const Ce = ["disabled"], $e = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "j-button__loading-icon"
|
|
11
|
-
},
|
|
11
|
+
}, je = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "j-button__text"
|
|
14
|
-
},
|
|
14
|
+
}, xe = /* @__PURE__ */ L({
|
|
15
15
|
__name: "JButton",
|
|
16
16
|
props: {
|
|
17
17
|
type: { default: "default" },
|
|
@@ -27,8 +27,8 @@ const xe = ["disabled"], Re = {
|
|
|
27
27
|
function l(a) {
|
|
28
28
|
!t.disabled && !t.loading && n("click", a);
|
|
29
29
|
}
|
|
30
|
-
return (a, d) => (r(),
|
|
31
|
-
class:
|
|
30
|
+
return (a, d) => (r(), R("button", {
|
|
31
|
+
class: U(["j-button", [
|
|
32
32
|
`j-button--${e.type}`,
|
|
33
33
|
`j-button--${e.size}`,
|
|
34
34
|
{
|
|
@@ -41,27 +41,27 @@ const xe = ["disabled"], Re = {
|
|
|
41
41
|
disabled: e.disabled || e.loading,
|
|
42
42
|
onClick: l
|
|
43
43
|
}, [
|
|
44
|
-
e.loading ? (r(),
|
|
45
|
-
a.$slots.default ? (r(),
|
|
44
|
+
e.loading ? (r(), R("span", $e)) : j("", !0),
|
|
45
|
+
a.$slots.default ? (r(), R("span", je, [
|
|
46
46
|
q(a.$slots, "default", {}, void 0, !0)
|
|
47
|
-
])) :
|
|
48
|
-
], 10,
|
|
47
|
+
])) : j("", !0)
|
|
48
|
+
], 10, Ce));
|
|
49
49
|
}
|
|
50
50
|
}), W = (e, s) => {
|
|
51
51
|
const t = e.__vccOpts || e;
|
|
52
52
|
for (const [n, l] of s)
|
|
53
53
|
t[n] = l;
|
|
54
54
|
return t;
|
|
55
|
-
},
|
|
55
|
+
}, Ie = /* @__PURE__ */ W(xe, [["__scopeId", "data-v-22864824"]]), Re = { class: "j-upload-img-container" }, Se = {
|
|
56
56
|
key: 0,
|
|
57
57
|
class: "images-wrapper"
|
|
58
|
-
},
|
|
58
|
+
}, Be = { class: "image-item" }, Ee = ["onClick"], Ae = {
|
|
59
59
|
key: 0,
|
|
60
60
|
class: "image-item single-image-item"
|
|
61
|
-
},
|
|
61
|
+
}, Ve = { class: "image-actions" }, Me = {
|
|
62
62
|
key: 2,
|
|
63
63
|
class: "upload-tip"
|
|
64
|
-
},
|
|
64
|
+
}, Fe = { key: 0 }, Je = /* @__PURE__ */ L({
|
|
65
65
|
name: "JUploadImg",
|
|
66
66
|
__name: "JUploadImg",
|
|
67
67
|
props: {
|
|
@@ -77,57 +77,57 @@ const xe = ["disabled"], Re = {
|
|
|
77
77
|
},
|
|
78
78
|
emits: ["update:modelValue", "success", "error"],
|
|
79
79
|
setup(e, { emit: s }) {
|
|
80
|
-
const t = e, n = s, l =
|
|
80
|
+
const t = e, n = s, l = V(""), a = V(!1), d = t.showTip, f = () => {
|
|
81
81
|
a.value = !0;
|
|
82
82
|
}, _ = () => {
|
|
83
|
-
l.value = "", n("update:modelValue", ""),
|
|
84
|
-
},
|
|
85
|
-
|
|
83
|
+
l.value = "", n("update:modelValue", ""), x.success("删除成功");
|
|
84
|
+
}, y = V([]), g = V(!1), z = (v) => {
|
|
85
|
+
y.value = v.map((c, o) => ({
|
|
86
86
|
uid: Date.now() + o,
|
|
87
87
|
url: c
|
|
88
88
|
}));
|
|
89
89
|
};
|
|
90
|
-
|
|
91
|
-
t.multiple ? Array.isArray(
|
|
90
|
+
ie(() => t.modelValue, (v) => {
|
|
91
|
+
t.multiple ? Array.isArray(v) && v.length > 0 ? z(v) : y.value = [] : typeof v == "string" ? l.value = v : l.value = "";
|
|
92
92
|
}, { immediate: !0 });
|
|
93
93
|
const J = () => {
|
|
94
94
|
D();
|
|
95
|
-
}, k = (
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
const c =
|
|
95
|
+
}, k = (v) => {
|
|
96
|
+
y.value.splice(v, 1), D(), x.success("删除成功");
|
|
97
|
+
}, h = async (v) => {
|
|
98
|
+
const c = v.raw;
|
|
99
99
|
if (!c) {
|
|
100
|
-
|
|
100
|
+
x.error("文件不存在,请重试");
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
if (c.size > t.maxSize * 1024 * 1024) {
|
|
104
|
-
|
|
104
|
+
x.error(`图片大小不能超过 ${t.maxSize}MB`);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
if (!t.uploadFn) {
|
|
108
|
-
|
|
108
|
+
x.error("未配置上传函数 (uploadFn)");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
try {
|
|
112
|
-
|
|
112
|
+
g.value = !0;
|
|
113
113
|
const o = await t.uploadFn(c);
|
|
114
|
-
t.multiple ? (
|
|
114
|
+
t.multiple ? (y.value.push({ uid: Date.now(), url: o }), D()) : (l.value = o, n("update:modelValue", o)), n("success", o), x.success("上传成功");
|
|
115
115
|
} catch (o) {
|
|
116
|
-
console.error("上传出错:", o),
|
|
116
|
+
console.error("上传出错:", o), x.error("上传失败,请重试"), n("error", o);
|
|
117
117
|
} finally {
|
|
118
|
-
|
|
118
|
+
g.value = !1;
|
|
119
119
|
}
|
|
120
120
|
}, D = () => {
|
|
121
|
-
const
|
|
122
|
-
n("update:modelValue",
|
|
121
|
+
const v = y.value.map((c) => c.url);
|
|
122
|
+
n("update:modelValue", v);
|
|
123
123
|
};
|
|
124
|
-
return (
|
|
124
|
+
return (v, c) => {
|
|
125
125
|
const o = w("el-image"), u = w("el-icon"), I = w("el-upload"), p = w("el-image-viewer");
|
|
126
|
-
return r(),
|
|
127
|
-
e.multiple ? (r(),
|
|
128
|
-
m($(
|
|
129
|
-
modelValue:
|
|
130
|
-
"onUpdate:modelValue": c[0] || (c[0] = (S) =>
|
|
126
|
+
return r(), R("div", Re, [
|
|
127
|
+
e.multiple ? (r(), R("div", Se, [
|
|
128
|
+
m($(ke), {
|
|
129
|
+
modelValue: y.value,
|
|
130
|
+
"onUpdate:modelValue": c[0] || (c[0] = (S) => y.value = S),
|
|
131
131
|
class: "images-list",
|
|
132
132
|
"item-key": "uid",
|
|
133
133
|
animation: 200,
|
|
@@ -135,49 +135,49 @@ const xe = ["disabled"], Re = {
|
|
|
135
135
|
onEnd: J
|
|
136
136
|
}, {
|
|
137
137
|
item: i(({ element: S, index: E }) => [
|
|
138
|
-
C("div",
|
|
138
|
+
C("div", Be, [
|
|
139
139
|
m(o, {
|
|
140
140
|
src: S.url,
|
|
141
|
-
"preview-src-list":
|
|
141
|
+
"preview-src-list": y.value.map((M) => M.url),
|
|
142
142
|
"initial-index": E,
|
|
143
143
|
fit: "cover",
|
|
144
144
|
class: "image-preview",
|
|
145
145
|
"preview-teleported": !0,
|
|
146
146
|
"hide-on-click-modal": !0
|
|
147
147
|
}, null, 8, ["src", "preview-src-list", "initial-index"]),
|
|
148
|
-
e.disabled ?
|
|
148
|
+
e.disabled ? j("", !0) : (r(), R("div", {
|
|
149
149
|
key: 0,
|
|
150
150
|
class: "delete-btn",
|
|
151
|
-
onClick:
|
|
151
|
+
onClick: Z((M) => k(E), ["stop"])
|
|
152
152
|
}, [
|
|
153
153
|
m(u, { class: "icon-delete" }, {
|
|
154
154
|
default: i(() => [
|
|
155
|
-
m($(
|
|
155
|
+
m($(G))
|
|
156
156
|
]),
|
|
157
157
|
_: 1
|
|
158
158
|
})
|
|
159
|
-
], 8,
|
|
159
|
+
], 8, Ee))
|
|
160
160
|
])
|
|
161
161
|
]),
|
|
162
162
|
_: 1
|
|
163
163
|
}, 8, ["modelValue", "disabled"]),
|
|
164
|
-
!e.disabled && (!e.limit ||
|
|
164
|
+
!e.disabled && (!e.limit || y.value.length < e.limit) ? (r(), b(I, {
|
|
165
165
|
key: 0,
|
|
166
166
|
class: "image-uploader",
|
|
167
167
|
"auto-upload": !1,
|
|
168
168
|
"show-file-list": !1,
|
|
169
|
-
"on-change":
|
|
170
|
-
disabled:
|
|
169
|
+
"on-change": h,
|
|
170
|
+
disabled: g.value,
|
|
171
171
|
"list-type": "picture-card",
|
|
172
172
|
accept: e.accept
|
|
173
173
|
}, {
|
|
174
174
|
default: i(() => [
|
|
175
|
-
|
|
175
|
+
g.value ? (r(), b(u, {
|
|
176
176
|
key: 1,
|
|
177
177
|
class: "uploader-icon is-loading"
|
|
178
178
|
}, {
|
|
179
179
|
default: i(() => [
|
|
180
|
-
m($(
|
|
180
|
+
m($(ne))
|
|
181
181
|
]),
|
|
182
182
|
_: 1
|
|
183
183
|
})) : (r(), b(u, {
|
|
@@ -185,37 +185,37 @@ const xe = ["disabled"], Re = {
|
|
|
185
185
|
class: "uploader-icon"
|
|
186
186
|
}, {
|
|
187
187
|
default: i(() => [
|
|
188
|
-
m($(
|
|
188
|
+
m($(Q))
|
|
189
189
|
]),
|
|
190
190
|
_: 1
|
|
191
191
|
}))
|
|
192
192
|
]),
|
|
193
193
|
_: 1
|
|
194
|
-
}, 8, ["disabled", "accept"])) :
|
|
195
|
-
])) : (r(),
|
|
196
|
-
l.value ? (r(),
|
|
194
|
+
}, 8, ["disabled", "accept"])) : j("", !0)
|
|
195
|
+
])) : (r(), R(X, { key: 1 }, [
|
|
196
|
+
l.value ? (r(), R("div", Ae, [
|
|
197
197
|
m(o, {
|
|
198
198
|
src: l.value,
|
|
199
199
|
fit: "cover",
|
|
200
200
|
class: "image-preview"
|
|
201
201
|
}, null, 8, ["src"]),
|
|
202
|
-
C("div",
|
|
202
|
+
C("div", Ve, [
|
|
203
203
|
m(u, {
|
|
204
204
|
class: "action-icon",
|
|
205
|
-
onClick:
|
|
205
|
+
onClick: Z(f, ["stop"])
|
|
206
206
|
}, {
|
|
207
207
|
default: i(() => [
|
|
208
|
-
m($(
|
|
208
|
+
m($(ge))
|
|
209
209
|
]),
|
|
210
210
|
_: 1
|
|
211
211
|
}),
|
|
212
|
-
e.disabled ?
|
|
212
|
+
e.disabled ? j("", !0) : (r(), b(u, {
|
|
213
213
|
key: 0,
|
|
214
214
|
class: "action-icon",
|
|
215
|
-
onClick:
|
|
215
|
+
onClick: Z(_, ["stop"])
|
|
216
216
|
}, {
|
|
217
217
|
default: i(() => [
|
|
218
|
-
m($(
|
|
218
|
+
m($(G))
|
|
219
219
|
]),
|
|
220
220
|
_: 1
|
|
221
221
|
}))
|
|
@@ -225,18 +225,18 @@ const xe = ["disabled"], Re = {
|
|
|
225
225
|
class: "image-uploader",
|
|
226
226
|
"auto-upload": !1,
|
|
227
227
|
"show-file-list": !1,
|
|
228
|
-
"on-change":
|
|
229
|
-
disabled: e.disabled ||
|
|
228
|
+
"on-change": h,
|
|
229
|
+
disabled: e.disabled || g.value,
|
|
230
230
|
accept: e.accept,
|
|
231
231
|
"list-type": "picture-card"
|
|
232
232
|
}, {
|
|
233
233
|
default: i(() => [
|
|
234
234
|
m(u, { class: "uploader-icon" }, {
|
|
235
235
|
default: i(() => [
|
|
236
|
-
|
|
236
|
+
g.value ? (r(), b($(ne), {
|
|
237
237
|
key: 1,
|
|
238
238
|
class: "is-loading"
|
|
239
|
-
})) : (r(), b($(
|
|
239
|
+
})) : (r(), b($(Q), { key: 0 }))
|
|
240
240
|
]),
|
|
241
241
|
_: 1
|
|
242
242
|
})
|
|
@@ -248,16 +248,16 @@ const xe = ["disabled"], Re = {
|
|
|
248
248
|
"url-list": [l.value],
|
|
249
249
|
teleported: !0,
|
|
250
250
|
onClose: c[1] || (c[1] = (S) => a.value = !1)
|
|
251
|
-
}, null, 8, ["url-list"])) :
|
|
251
|
+
}, null, 8, ["url-list"])) : j("", !0)
|
|
252
252
|
], 64)),
|
|
253
|
-
$(d) ? (r(),
|
|
253
|
+
$(d) ? (r(), R("div", Me, [
|
|
254
254
|
C("span", null, F(e.tip), 1),
|
|
255
|
-
e.multiple && e.limit ? (r(),
|
|
256
|
-
])) :
|
|
255
|
+
e.multiple && e.limit ? (r(), R("span", Fe, " (最多 " + F(e.limit) + " 张)", 1)) : j("", !0)
|
|
256
|
+
])) : j("", !0)
|
|
257
257
|
]);
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
}),
|
|
260
|
+
}), De = /* @__PURE__ */ W(Je, [["__scopeId", "data-v-94fad0af"]]), K = /* @__PURE__ */ L({
|
|
261
261
|
name: "JIconRender",
|
|
262
262
|
__name: "JIconRender",
|
|
263
263
|
props: {
|
|
@@ -265,14 +265,14 @@ const xe = ["disabled"], Re = {
|
|
|
265
265
|
size: { default: 24 }
|
|
266
266
|
},
|
|
267
267
|
setup(e) {
|
|
268
|
-
return (s, t) => e.icon ? (r(), b($(
|
|
268
|
+
return (s, t) => e.icon ? (r(), b($(we), fe({
|
|
269
269
|
key: 0,
|
|
270
270
|
icon: e.icon,
|
|
271
271
|
width: e.size,
|
|
272
272
|
height: e.size
|
|
273
|
-
}, s.$attrs), null, 16, ["icon", "width", "height"])) :
|
|
273
|
+
}, s.$attrs), null, 16, ["icon", "width", "height"])) : j("", !0);
|
|
274
274
|
}
|
|
275
|
-
}),
|
|
275
|
+
}), Te = { class: "action-left" }, ze = /* @__PURE__ */ L({
|
|
276
276
|
name: "JSearchHeader",
|
|
277
277
|
__name: "JSearchHeader",
|
|
278
278
|
props: {
|
|
@@ -286,41 +286,41 @@ const xe = ["disabled"], Re = {
|
|
|
286
286
|
},
|
|
287
287
|
emits: ["search", "reset", "add", "batchDelete"],
|
|
288
288
|
setup(e, { emit: s }) {
|
|
289
|
-
const t = e, n = s, l =
|
|
289
|
+
const t = e, n = s, l = V(), a = V(!1), d = V(!1), f = V(0), _ = V(0), y = re(() => f.value > t.defaultVisible), g = () => {
|
|
290
290
|
if (!l.value) return;
|
|
291
291
|
const k = Array.from(l.value.children);
|
|
292
292
|
f.value = k.length;
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
295
|
-
const D = l.value.getBoundingClientRect(),
|
|
296
|
-
_.value =
|
|
293
|
+
const h = k[t.defaultVisible - 1];
|
|
294
|
+
if (h && l.value) {
|
|
295
|
+
const D = l.value.getBoundingClientRect(), v = h.getBoundingClientRect();
|
|
296
|
+
_.value = v.bottom - D.top;
|
|
297
297
|
}
|
|
298
|
-
},
|
|
298
|
+
}, z = () => {
|
|
299
299
|
const k = l.value;
|
|
300
300
|
if (k)
|
|
301
301
|
if (a.value)
|
|
302
|
-
|
|
302
|
+
g(), a.value = !1, k.style.maxHeight = k.scrollHeight + "px", k.offsetHeight, k.style.maxHeight = _.value + "px";
|
|
303
303
|
else {
|
|
304
304
|
a.value = !0, k.style.maxHeight = k.scrollHeight + "px";
|
|
305
|
-
const
|
|
306
|
-
k.style.maxHeight = "none", k.removeEventListener("transitionend",
|
|
305
|
+
const h = () => {
|
|
306
|
+
k.style.maxHeight = "none", k.removeEventListener("transitionend", h);
|
|
307
307
|
};
|
|
308
|
-
k.addEventListener("transitionend",
|
|
308
|
+
k.addEventListener("transitionend", h);
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
let J = null;
|
|
312
|
-
return
|
|
313
|
-
|
|
312
|
+
return pe(() => {
|
|
313
|
+
g(), y.value && l.value && (l.value.style.maxHeight = _.value + "px"), requestAnimationFrame(() => {
|
|
314
314
|
requestAnimationFrame(() => {
|
|
315
315
|
d.value = !0;
|
|
316
316
|
});
|
|
317
317
|
}), l.value && (J = new MutationObserver(() => {
|
|
318
|
-
|
|
318
|
+
g(), y.value && !a.value && l.value && (l.value.style.maxHeight = _.value + "px");
|
|
319
319
|
}), J.observe(l.value, { childList: !0 }));
|
|
320
|
-
}),
|
|
320
|
+
}), he(() => {
|
|
321
321
|
J == null || J.disconnect();
|
|
322
|
-
}), (k,
|
|
323
|
-
const D = w("el-form"),
|
|
322
|
+
}), (k, h) => {
|
|
323
|
+
const D = w("el-form"), v = w("el-button"), c = w("el-icon"), o = w("el-card");
|
|
324
324
|
return r(), b(o, {
|
|
325
325
|
shadow: "never",
|
|
326
326
|
class: "j-search-header-card"
|
|
@@ -334,7 +334,7 @@ const xe = ["disabled"], Re = {
|
|
|
334
334
|
C("div", {
|
|
335
335
|
ref_key: "formItemsRef",
|
|
336
336
|
ref: l,
|
|
337
|
-
class:
|
|
337
|
+
class: U(["form-items-wrapper", { "is-animated": d.value }])
|
|
338
338
|
}, [
|
|
339
339
|
q(k.$slots, "default", {}, void 0, !0)
|
|
340
340
|
], 2)
|
|
@@ -343,87 +343,87 @@ const xe = ["disabled"], Re = {
|
|
|
343
343
|
}),
|
|
344
344
|
C("div", {
|
|
345
345
|
class: "action-bar",
|
|
346
|
-
style:
|
|
346
|
+
style: ue({ marginTop: a.value ? "0px" : "10px" })
|
|
347
347
|
}, [
|
|
348
|
-
C("div",
|
|
349
|
-
e.showAdd ? (r(), b(
|
|
348
|
+
C("div", Te, [
|
|
349
|
+
e.showAdd ? (r(), b(v, {
|
|
350
350
|
key: 0,
|
|
351
351
|
type: "primary",
|
|
352
|
-
icon: $(
|
|
353
|
-
onClick:
|
|
352
|
+
icon: $(Q),
|
|
353
|
+
onClick: h[0] || (h[0] = (u) => n("add"))
|
|
354
354
|
}, {
|
|
355
355
|
default: i(() => [
|
|
356
|
-
|
|
356
|
+
T(F(e.addText), 1)
|
|
357
357
|
]),
|
|
358
358
|
_: 1
|
|
359
|
-
}, 8, ["icon"])) :
|
|
360
|
-
e.showBatchDelete ? (r(), b(
|
|
359
|
+
}, 8, ["icon"])) : j("", !0),
|
|
360
|
+
e.showBatchDelete ? (r(), b(v, {
|
|
361
361
|
key: 1,
|
|
362
362
|
type: "danger",
|
|
363
|
-
icon: $(
|
|
363
|
+
icon: $(G),
|
|
364
364
|
disabled: e.selectedCount === 0,
|
|
365
|
-
onClick:
|
|
365
|
+
onClick: h[1] || (h[1] = (u) => n("batchDelete"))
|
|
366
366
|
}, {
|
|
367
367
|
default: i(() => [
|
|
368
|
-
|
|
368
|
+
T(" 批量删除" + F(e.selectedCount ? `(${e.selectedCount})` : ""), 1)
|
|
369
369
|
]),
|
|
370
370
|
_: 1
|
|
371
|
-
}, 8, ["icon", "disabled"])) :
|
|
372
|
-
e.showSearch ? (r(), b(
|
|
371
|
+
}, 8, ["icon", "disabled"])) : j("", !0),
|
|
372
|
+
e.showSearch ? (r(), b(v, {
|
|
373
373
|
key: 2,
|
|
374
374
|
type: "primary",
|
|
375
|
-
icon: $(
|
|
376
|
-
onClick:
|
|
375
|
+
icon: $(ye),
|
|
376
|
+
onClick: h[2] || (h[2] = (u) => n("search"))
|
|
377
377
|
}, {
|
|
378
|
-
default: i(() => [...
|
|
379
|
-
|
|
378
|
+
default: i(() => [...h[4] || (h[4] = [
|
|
379
|
+
T("搜索", -1)
|
|
380
380
|
])]),
|
|
381
381
|
_: 1
|
|
382
|
-
}, 8, ["icon"])) :
|
|
383
|
-
e.showReset ? (r(), b(
|
|
382
|
+
}, 8, ["icon"])) : j("", !0),
|
|
383
|
+
e.showReset ? (r(), b(v, {
|
|
384
384
|
key: 3,
|
|
385
|
-
icon: $(
|
|
386
|
-
onClick:
|
|
385
|
+
icon: $(be),
|
|
386
|
+
onClick: h[3] || (h[3] = (u) => n("reset"))
|
|
387
387
|
}, {
|
|
388
|
-
default: i(() => [...
|
|
389
|
-
|
|
388
|
+
default: i(() => [...h[5] || (h[5] = [
|
|
389
|
+
T("重置", -1)
|
|
390
390
|
])]),
|
|
391
391
|
_: 1
|
|
392
|
-
}, 8, ["icon"])) :
|
|
392
|
+
}, 8, ["icon"])) : j("", !0),
|
|
393
393
|
q(k.$slots, "actions", {}, void 0, !0)
|
|
394
394
|
]),
|
|
395
|
-
|
|
395
|
+
y.value ? (r(), b(v, {
|
|
396
396
|
key: 0,
|
|
397
397
|
link: "",
|
|
398
398
|
type: "primary",
|
|
399
|
-
onClick:
|
|
399
|
+
onClick: z
|
|
400
400
|
}, {
|
|
401
401
|
default: i(() => [
|
|
402
|
-
|
|
402
|
+
T(F(a.value ? "收起" : "展开") + " ", 1),
|
|
403
403
|
m(c, {
|
|
404
|
-
class:
|
|
404
|
+
class: U(["toggle-icon", { "is-expanded": a.value }])
|
|
405
405
|
}, {
|
|
406
406
|
default: i(() => [
|
|
407
|
-
m($(
|
|
407
|
+
m($(_e))
|
|
408
408
|
]),
|
|
409
409
|
_: 1
|
|
410
410
|
}, 8, ["class"])
|
|
411
411
|
]),
|
|
412
412
|
_: 1
|
|
413
|
-
})) :
|
|
413
|
+
})) : j("", !0)
|
|
414
414
|
], 4)
|
|
415
415
|
]),
|
|
416
416
|
_: 3
|
|
417
417
|
});
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
|
-
}),
|
|
420
|
+
}), Oe = /* @__PURE__ */ W(ze, [["__scopeId", "data-v-d3f83c3f"]]), He = { class: "j-import-upload-row" }, Le = { class: "j-import-stat-num" }, Pe = { class: "j-import-stat-num" }, Ne = { class: "j-import-stat-num" }, Ue = {
|
|
421
421
|
key: 0,
|
|
422
422
|
class: "j-import-status-fail"
|
|
423
|
-
},
|
|
423
|
+
}, We = { key: 1 }, qe = /* @__PURE__ */ L({
|
|
424
424
|
name: "JImportExcel",
|
|
425
425
|
__name: "JImportExcel",
|
|
426
|
-
props: /* @__PURE__ */
|
|
426
|
+
props: /* @__PURE__ */ le({
|
|
427
427
|
getFieldListApi: {},
|
|
428
428
|
importApi: {},
|
|
429
429
|
excludeFields: { default: () => ["id", "ctime", "mtime"] },
|
|
@@ -432,19 +432,19 @@ const xe = ["disabled"], Re = {
|
|
|
432
432
|
modelValue: { type: Boolean, default: !1 },
|
|
433
433
|
modelModifiers: {}
|
|
434
434
|
}),
|
|
435
|
-
emits: /* @__PURE__ */
|
|
435
|
+
emits: /* @__PURE__ */ le(["success"], ["update:modelValue"]),
|
|
436
436
|
setup(e, { emit: s }) {
|
|
437
|
-
const t = e, n = s, l =
|
|
437
|
+
const t = e, n = s, l = ve(e, "modelValue"), a = V(!1), d = V({}), f = V([]), _ = V({ total: 0, success: 0, fail: 0 }), y = {
|
|
438
438
|
0: "待创建",
|
|
439
439
|
1: "创建成功",
|
|
440
440
|
2: "创建中",
|
|
441
441
|
[-1]: "创建失败"
|
|
442
|
-
},
|
|
442
|
+
}, g = re(() => Object.entries(d.value).filter(([c]) => !t.excludeFields.includes(c)).map(([c, o]) => ({ id: c, label: o, prop: c }))), z = async () => {
|
|
443
443
|
try {
|
|
444
444
|
const c = await t.getFieldListApi();
|
|
445
445
|
d.value = c.data.tableFieldsInfo ?? {};
|
|
446
446
|
} catch {
|
|
447
|
-
|
|
447
|
+
x.error("获取字段列表失败");
|
|
448
448
|
}
|
|
449
449
|
}, J = (c) => {
|
|
450
450
|
const o = c.raw;
|
|
@@ -453,34 +453,34 @@ const xe = ["disabled"], Re = {
|
|
|
453
453
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
454
454
|
"application/vnd.ms-excel"
|
|
455
455
|
].includes(o.type) && !o.name.match(/\.xlsx?$/i)) {
|
|
456
|
-
|
|
456
|
+
x.warning("请上传 .xlsx 或 .xls 格式文件");
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
459
|
const I = new FileReader();
|
|
460
460
|
I.onload = (p) => {
|
|
461
461
|
try {
|
|
462
|
-
const S =
|
|
463
|
-
if (!
|
|
464
|
-
|
|
462
|
+
const S = N.read(p.target.result, { type: "binary" }), E = S.SheetNames[0], M = S.Sheets[E], A = N.utils.sheet_to_json(M);
|
|
463
|
+
if (!A.length) {
|
|
464
|
+
x.warning("文件内容为空");
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
|
-
const
|
|
468
|
-
const
|
|
469
|
-
return
|
|
470
|
-
|
|
471
|
-
}),
|
|
467
|
+
const O = A.map((H) => {
|
|
468
|
+
const P = { _status: 0, _error: "" };
|
|
469
|
+
return g.value.forEach((B) => {
|
|
470
|
+
P[B.prop] = H[B.label] !== void 0 ? H[B.label] : "";
|
|
471
|
+
}), P;
|
|
472
472
|
});
|
|
473
|
-
f.value =
|
|
473
|
+
f.value = O, _.value = { total: O.length, success: 0, fail: 0 };
|
|
474
474
|
} catch {
|
|
475
|
-
|
|
475
|
+
x.error("解析文件失败,请检查文件格式");
|
|
476
476
|
}
|
|
477
477
|
}, I.readAsBinaryString(o);
|
|
478
478
|
}, k = (c) => {
|
|
479
479
|
f.value.splice(c, 1), _.value.total = f.value.length;
|
|
480
|
-
},
|
|
480
|
+
}, h = async () => {
|
|
481
481
|
const c = f.value.filter((o) => o._status === 0).map(({ _status: o, _error: u, ...I }) => I);
|
|
482
482
|
if (!c.length) {
|
|
483
|
-
|
|
483
|
+
x.warning("没有可导入的数据");
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
a.value = !0;
|
|
@@ -488,39 +488,39 @@ const xe = ["disabled"], Re = {
|
|
|
488
488
|
const o = await t.importApi(c);
|
|
489
489
|
o.code === 1 ? (f.value.forEach((u) => {
|
|
490
490
|
u._status === 0 && (u._status = 1);
|
|
491
|
-
}), _.value.success = f.value.filter((u) => u._status === 1).length,
|
|
491
|
+
}), _.value.success = f.value.filter((u) => u._status === 1).length, x.success("导入成功"), n("success")) : x.error(o.msg || "导入失败");
|
|
492
492
|
} catch {
|
|
493
|
-
|
|
493
|
+
x.error("导入失败,请重试");
|
|
494
494
|
} finally {
|
|
495
495
|
a.value = !1;
|
|
496
496
|
}
|
|
497
497
|
}, D = () => {
|
|
498
498
|
try {
|
|
499
|
-
const c =
|
|
499
|
+
const c = N.utils.book_new(), o = g.value.map((p) => p.label), u = {};
|
|
500
500
|
o.forEach((p) => u[p] = "");
|
|
501
|
-
const I =
|
|
502
|
-
|
|
501
|
+
const I = N.utils.json_to_sheet([u]);
|
|
502
|
+
N.utils.book_append_sheet(c, I, "模板"), N.writeFile(c, "导入模板.xlsx");
|
|
503
503
|
} catch {
|
|
504
|
-
|
|
504
|
+
x.error("模板下载失败");
|
|
505
505
|
}
|
|
506
|
-
},
|
|
506
|
+
}, v = () => {
|
|
507
507
|
a.value || (l.value = !1, f.value = [], _.value = { total: 0, success: 0, fail: 0 });
|
|
508
508
|
};
|
|
509
509
|
return (c, o) => {
|
|
510
|
-
const u = w("el-divider"), I = w("el-button"), p = w("el-upload"), S = w("el-link"), E = w("el-card"),
|
|
511
|
-
return r(), b(
|
|
510
|
+
const u = w("el-divider"), I = w("el-button"), p = w("el-upload"), S = w("el-link"), E = w("el-card"), M = w("el-col"), A = w("el-row"), O = w("el-table-column"), H = w("el-table"), P = w("el-dialog");
|
|
511
|
+
return r(), b(P, {
|
|
512
512
|
modelValue: l.value,
|
|
513
|
-
"onUpdate:modelValue": o[0] || (o[0] = (
|
|
513
|
+
"onUpdate:modelValue": o[0] || (o[0] = (B) => l.value = B),
|
|
514
514
|
title: t.title,
|
|
515
515
|
width: "900px",
|
|
516
516
|
"close-on-click-modal": !1,
|
|
517
|
-
onOpen:
|
|
518
|
-
onClose:
|
|
517
|
+
onOpen: z,
|
|
518
|
+
onClose: v
|
|
519
519
|
}, {
|
|
520
520
|
footer: i(() => [
|
|
521
|
-
m(I, { onClick:
|
|
521
|
+
m(I, { onClick: v }, {
|
|
522
522
|
default: i(() => [...o[9] || (o[9] = [
|
|
523
|
-
|
|
523
|
+
T("关闭", -1)
|
|
524
524
|
])]),
|
|
525
525
|
_: 1
|
|
526
526
|
})
|
|
@@ -533,7 +533,7 @@ const xe = ["disabled"], Re = {
|
|
|
533
533
|
default: i(() => [
|
|
534
534
|
o[3] || (o[3] = C("div", { class: "j-import-upload-card-title" }, "导入 EXCEL", -1)),
|
|
535
535
|
m(u, { style: { margin: "10px 0" } }),
|
|
536
|
-
C("div",
|
|
536
|
+
C("div", He, [
|
|
537
537
|
m(p, {
|
|
538
538
|
accept: ".xlsx,.xls",
|
|
539
539
|
"auto-upload": !1,
|
|
@@ -543,64 +543,64 @@ const xe = ["disabled"], Re = {
|
|
|
543
543
|
default: i(() => [
|
|
544
544
|
m(I, { size: "small" }, {
|
|
545
545
|
default: i(() => [...o[1] || (o[1] = [
|
|
546
|
-
|
|
546
|
+
T("点击上传", -1)
|
|
547
547
|
])]),
|
|
548
548
|
_: 1
|
|
549
549
|
})
|
|
550
550
|
]),
|
|
551
551
|
_: 1
|
|
552
552
|
}),
|
|
553
|
-
|
|
553
|
+
g.value.length ? (r(), b(S, {
|
|
554
554
|
key: 0,
|
|
555
555
|
type: "primary",
|
|
556
556
|
class: "j-import-no-wrap",
|
|
557
557
|
onClick: D
|
|
558
558
|
}, {
|
|
559
559
|
default: i(() => [...o[2] || (o[2] = [
|
|
560
|
-
|
|
560
|
+
T(" 下载导入模板.xlsx ", -1)
|
|
561
561
|
])]),
|
|
562
562
|
_: 1
|
|
563
|
-
})) :
|
|
563
|
+
})) : j("", !0)
|
|
564
564
|
])
|
|
565
565
|
]),
|
|
566
566
|
_: 1
|
|
567
567
|
}),
|
|
568
|
-
m(
|
|
568
|
+
m(A, {
|
|
569
569
|
class: "j-import-stats-row",
|
|
570
570
|
gutter: 20,
|
|
571
571
|
align: "middle"
|
|
572
572
|
}, {
|
|
573
573
|
default: i(() => [
|
|
574
|
-
m(
|
|
574
|
+
m(M, { span: 18 }, {
|
|
575
575
|
default: i(() => [
|
|
576
|
-
m(
|
|
576
|
+
m(A, { class: "j-import-stats-cols" }, {
|
|
577
577
|
default: i(() => [
|
|
578
|
-
m(
|
|
578
|
+
m(M, {
|
|
579
579
|
span: 4,
|
|
580
580
|
class: "j-import-stat-item"
|
|
581
581
|
}, {
|
|
582
582
|
default: i(() => [
|
|
583
|
-
C("div",
|
|
583
|
+
C("div", Le, F(_.value.total), 1),
|
|
584
584
|
o[4] || (o[4] = C("div", { class: "j-import-stat-label" }, "导入数量", -1))
|
|
585
585
|
]),
|
|
586
586
|
_: 1
|
|
587
587
|
}),
|
|
588
|
-
m(
|
|
588
|
+
m(M, {
|
|
589
589
|
span: 4,
|
|
590
590
|
class: "j-import-stat-item"
|
|
591
591
|
}, {
|
|
592
592
|
default: i(() => [
|
|
593
|
-
C("div",
|
|
593
|
+
C("div", Pe, F(_.value.fail), 1),
|
|
594
594
|
o[5] || (o[5] = C("div", { class: "j-import-stat-label" }, "失败数量", -1))
|
|
595
595
|
]),
|
|
596
596
|
_: 1
|
|
597
597
|
}),
|
|
598
|
-
m(
|
|
598
|
+
m(M, {
|
|
599
599
|
span: 4,
|
|
600
600
|
class: "j-import-stat-item"
|
|
601
601
|
}, {
|
|
602
602
|
default: i(() => [
|
|
603
|
-
C("div",
|
|
603
|
+
C("div", Ne, F(_.value.success), 1),
|
|
604
604
|
o[6] || (o[6] = C("div", { class: "j-import-stat-label" }, "成功数量", -1))
|
|
605
605
|
]),
|
|
606
606
|
_: 1
|
|
@@ -611,7 +611,7 @@ const xe = ["disabled"], Re = {
|
|
|
611
611
|
]),
|
|
612
612
|
_: 1
|
|
613
613
|
}),
|
|
614
|
-
m(
|
|
614
|
+
m(M, {
|
|
615
615
|
span: 6,
|
|
616
616
|
class: "j-import-confirm-col"
|
|
617
617
|
}, {
|
|
@@ -621,10 +621,10 @@ const xe = ["disabled"], Re = {
|
|
|
621
621
|
size: "small",
|
|
622
622
|
loading: a.value,
|
|
623
623
|
disabled: !f.value.length,
|
|
624
|
-
onClick:
|
|
624
|
+
onClick: h
|
|
625
625
|
}, {
|
|
626
626
|
default: i(() => [...o[7] || (o[7] = [
|
|
627
|
-
|
|
627
|
+
T(" 确认导入 ", -1)
|
|
628
628
|
])]),
|
|
629
629
|
_: 1
|
|
630
630
|
}, 8, ["loading", "disabled"])
|
|
@@ -642,41 +642,41 @@ const xe = ["disabled"], Re = {
|
|
|
642
642
|
class: "j-import-data-table"
|
|
643
643
|
}, {
|
|
644
644
|
default: i(() => [
|
|
645
|
-
(r(!0),
|
|
646
|
-
key:
|
|
647
|
-
prop:
|
|
648
|
-
label:
|
|
645
|
+
(r(!0), R(X, null, ee(g.value, (B) => (r(), b(O, {
|
|
646
|
+
key: B.prop,
|
|
647
|
+
prop: B.prop,
|
|
648
|
+
label: B.label,
|
|
649
649
|
"min-width": 120,
|
|
650
650
|
"show-overflow-tooltip": ""
|
|
651
651
|
}, null, 8, ["prop", "label"]))), 128)),
|
|
652
|
-
m(
|
|
652
|
+
m(O, {
|
|
653
653
|
label: "状态",
|
|
654
654
|
width: "110",
|
|
655
655
|
align: "center",
|
|
656
656
|
fixed: "right"
|
|
657
657
|
}, {
|
|
658
|
-
default: i(({ row:
|
|
659
|
-
|
|
658
|
+
default: i(({ row: B }) => [
|
|
659
|
+
B._status === -1 ? (r(), R("span", Ue, F(B._error || "创建失败"), 1)) : (r(), R("span", We, F(y[B._status]), 1))
|
|
660
660
|
]),
|
|
661
661
|
_: 1
|
|
662
662
|
}),
|
|
663
|
-
m(
|
|
663
|
+
m(O, {
|
|
664
664
|
label: "操作",
|
|
665
665
|
width: "80",
|
|
666
666
|
align: "center",
|
|
667
667
|
fixed: "right"
|
|
668
668
|
}, {
|
|
669
|
-
default: i(({ $index:
|
|
670
|
-
|
|
669
|
+
default: i(({ $index: B, row: me }) => [
|
|
670
|
+
me._status === 0 ? (r(), b(I, {
|
|
671
671
|
key: 0,
|
|
672
672
|
size: "small",
|
|
673
|
-
onClick: (
|
|
673
|
+
onClick: (mt) => k(B)
|
|
674
674
|
}, {
|
|
675
675
|
default: i(() => [...o[8] || (o[8] = [
|
|
676
|
-
|
|
676
|
+
T(" 删除 ", -1)
|
|
677
677
|
])]),
|
|
678
678
|
_: 1
|
|
679
|
-
}, 8, ["onClick"])) :
|
|
679
|
+
}, 8, ["onClick"])) : j("", !0)
|
|
680
680
|
]),
|
|
681
681
|
_: 1
|
|
682
682
|
})
|
|
@@ -688,7 +688,7 @@ const xe = ["disabled"], Re = {
|
|
|
688
688
|
}, 8, ["modelValue", "title"]);
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
|
-
}),
|
|
691
|
+
}), Ke = /* @__PURE__ */ W(qe, [["__scopeId", "data-v-1e4bc163"]]), Xe = { class: "j-sidebar__menu-item-title" }, Ze = /* @__PURE__ */ L({
|
|
692
692
|
name: "JSideMenuItem",
|
|
693
693
|
__name: "JSideMenuItem",
|
|
694
694
|
props: {
|
|
@@ -702,49 +702,49 @@ const xe = ["disabled"], Re = {
|
|
|
702
702
|
n("menu-click", t.menuItem);
|
|
703
703
|
};
|
|
704
704
|
return (a, d) => {
|
|
705
|
-
const f = w("JSideMenuItem", !0), _ = w("el-sub-menu"),
|
|
705
|
+
const f = w("JSideMenuItem", !0), _ = w("el-sub-menu"), y = w("el-menu-item");
|
|
706
706
|
return e.menuItem.children && e.menuItem.children.length > 0 ? (r(), b(_, {
|
|
707
707
|
key: 0,
|
|
708
708
|
index: e.menuItem.path,
|
|
709
|
-
class:
|
|
709
|
+
class: U([`j-sidebar__depth-${e.depth}`])
|
|
710
710
|
}, {
|
|
711
711
|
title: i(() => [
|
|
712
|
-
e.menuItem.icon && e.depth === 0 ? (r(), b($(
|
|
712
|
+
e.menuItem.icon && e.depth === 0 ? (r(), b($(K), {
|
|
713
713
|
key: 0,
|
|
714
714
|
icon: e.menuItem.icon
|
|
715
|
-
}, null, 8, ["icon"])) :
|
|
716
|
-
C("span",
|
|
715
|
+
}, null, 8, ["icon"])) : j("", !0),
|
|
716
|
+
C("span", Xe, F(e.menuItem.title || e.menuItem.name), 1)
|
|
717
717
|
]),
|
|
718
718
|
default: i(() => [
|
|
719
|
-
(r(!0),
|
|
720
|
-
key:
|
|
721
|
-
"menu-item":
|
|
719
|
+
(r(!0), R(X, null, ee(e.menuItem.children, (g) => (r(), b(f, {
|
|
720
|
+
key: g.path,
|
|
721
|
+
"menu-item": g,
|
|
722
722
|
"is-collapse": e.isCollapse,
|
|
723
723
|
depth: e.depth + 1,
|
|
724
|
-
onMenuClick: d[0] || (d[0] = (
|
|
724
|
+
onMenuClick: d[0] || (d[0] = (z) => n("menu-click", z))
|
|
725
725
|
}, null, 8, ["menu-item", "is-collapse", "depth"]))), 128))
|
|
726
726
|
]),
|
|
727
727
|
_: 1
|
|
728
|
-
}, 8, ["index", "class"])) : (r(), b(
|
|
728
|
+
}, 8, ["index", "class"])) : (r(), b(y, {
|
|
729
729
|
key: 1,
|
|
730
730
|
index: e.menuItem.path,
|
|
731
|
-
class:
|
|
731
|
+
class: U([`j-sidebar__depth-${e.depth}`]),
|
|
732
732
|
onClick: l
|
|
733
733
|
}, {
|
|
734
734
|
title: i(() => [
|
|
735
735
|
C("span", null, F(e.menuItem.title || e.menuItem.name), 1)
|
|
736
736
|
]),
|
|
737
737
|
default: i(() => [
|
|
738
|
-
e.menuItem.icon && e.depth === 0 ? (r(), b($(
|
|
738
|
+
e.menuItem.icon && e.depth === 0 ? (r(), b($(K), {
|
|
739
739
|
key: 0,
|
|
740
740
|
icon: e.menuItem.icon
|
|
741
|
-
}, null, 8, ["icon"])) :
|
|
741
|
+
}, null, 8, ["icon"])) : j("", !0)
|
|
742
742
|
]),
|
|
743
743
|
_: 1
|
|
744
744
|
}, 8, ["index", "class"]));
|
|
745
745
|
};
|
|
746
746
|
}
|
|
747
|
-
}),
|
|
747
|
+
}), ce = /* @__PURE__ */ W(Ze, [["__scopeId", "data-v-3787a646"]]), Ge = { class: "j-sidebar__logo" }, Qe = { class: "j-sidebar__title" }, Ye = { class: "j-sidebar__menu-wrapper" }, et = { class: "j-sidebar__footer" }, tt = /* @__PURE__ */ L({
|
|
748
748
|
name: "JSidebar",
|
|
749
749
|
__name: "JSidebar",
|
|
750
750
|
props: {
|
|
@@ -753,14 +753,14 @@ const xe = ["disabled"], Re = {
|
|
|
753
753
|
title: { default: "" },
|
|
754
754
|
collapsedTitle: { default: "" },
|
|
755
755
|
collapsed: { type: Boolean, default: !1 },
|
|
756
|
-
collapsedWidth: { default:
|
|
756
|
+
collapsedWidth: { default: 80 },
|
|
757
757
|
expandedWidth: { default: 200 },
|
|
758
758
|
router: { type: Boolean, default: !0 }
|
|
759
759
|
},
|
|
760
760
|
emits: ["update:collapsed", "menu-click"],
|
|
761
761
|
setup(e, { emit: s }) {
|
|
762
|
-
const t = e, n = s, l =
|
|
763
|
-
|
|
762
|
+
const t = e, n = s, l = V(t.collapsed);
|
|
763
|
+
ie(() => t.collapsed, (d) => {
|
|
764
764
|
l.value = d;
|
|
765
765
|
});
|
|
766
766
|
const a = () => {
|
|
@@ -768,19 +768,19 @@ const xe = ["disabled"], Re = {
|
|
|
768
768
|
};
|
|
769
769
|
return (d, f) => {
|
|
770
770
|
const _ = w("el-menu");
|
|
771
|
-
return r(),
|
|
772
|
-
class:
|
|
773
|
-
style:
|
|
771
|
+
return r(), R("div", {
|
|
772
|
+
class: U(["j-sidebar", l.value ? "j-sidebar--collapsed" : "j-sidebar--expanded"]),
|
|
773
|
+
style: ue({ width: l.value ? `${e.collapsedWidth}px` : `${e.expandedWidth}px` })
|
|
774
774
|
}, [
|
|
775
|
-
C("div",
|
|
775
|
+
C("div", Ge, [
|
|
776
776
|
q(d.$slots, "logo", { collapsed: l.value }, () => {
|
|
777
|
-
var
|
|
777
|
+
var y;
|
|
778
778
|
return [
|
|
779
|
-
C("h2",
|
|
779
|
+
C("h2", Qe, F(l.value ? e.collapsedTitle || ((y = e.title) == null ? void 0 : y.charAt(0)) || "" : e.title), 1)
|
|
780
780
|
];
|
|
781
781
|
}, !0)
|
|
782
782
|
]),
|
|
783
|
-
C("div",
|
|
783
|
+
C("div", Ye, [
|
|
784
784
|
m(_, {
|
|
785
785
|
"default-active": e.activeMenu,
|
|
786
786
|
class: "j-sidebar__menu",
|
|
@@ -789,96 +789,96 @@ const xe = ["disabled"], Re = {
|
|
|
789
789
|
"collapse-transition": !1
|
|
790
790
|
}, {
|
|
791
791
|
default: i(() => [
|
|
792
|
-
(r(!0),
|
|
793
|
-
key:
|
|
794
|
-
"menu-item":
|
|
792
|
+
(r(!0), R(X, null, ee(e.menus, (y) => (r(), b(ce, {
|
|
793
|
+
key: y.path,
|
|
794
|
+
"menu-item": y,
|
|
795
795
|
"is-collapse": l.value,
|
|
796
|
-
onMenuClick: f[0] || (f[0] = (
|
|
796
|
+
onMenuClick: f[0] || (f[0] = (g) => n("menu-click", g))
|
|
797
797
|
}, null, 8, ["menu-item", "is-collapse"]))), 128))
|
|
798
798
|
]),
|
|
799
799
|
_: 1
|
|
800
800
|
}, 8, ["default-active", "router", "collapse"])
|
|
801
801
|
]),
|
|
802
|
-
C("div",
|
|
802
|
+
C("div", et, [
|
|
803
803
|
q(d.$slots, "footer", {
|
|
804
804
|
collapsed: l.value,
|
|
805
805
|
toggle: a
|
|
806
806
|
}, () => [
|
|
807
807
|
C("button", {
|
|
808
|
-
class:
|
|
808
|
+
class: "j-sidebar__collapse-btn",
|
|
809
809
|
onClick: a
|
|
810
810
|
}, [
|
|
811
|
-
m($(
|
|
811
|
+
m($(K), {
|
|
812
812
|
icon: l.value ? "mdi:chevron-right" : "mdi:chevron-left"
|
|
813
813
|
}, null, 8, ["icon"])
|
|
814
|
-
]
|
|
814
|
+
])
|
|
815
815
|
], !0)
|
|
816
816
|
])
|
|
817
817
|
], 6);
|
|
818
818
|
};
|
|
819
819
|
}
|
|
820
|
-
}),
|
|
821
|
-
function
|
|
822
|
-
return Array.isArray(e) ? e.map((t) =>
|
|
820
|
+
}), lt = /* @__PURE__ */ W(tt, [["__scopeId", "data-v-2e746199"]]);
|
|
821
|
+
function te(e, s) {
|
|
822
|
+
return Array.isArray(e) ? e.map((t) => te(t, s)) : e !== null && typeof e == "object" && !(e instanceof Date) ? s(e) : e;
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function nt(e, s = []) {
|
|
825
825
|
return Object.fromEntries(
|
|
826
826
|
Object.entries(e).map(([t, n]) => {
|
|
827
|
-
const l =
|
|
827
|
+
const l = te(n, (d) => nt(d, s));
|
|
828
828
|
return s.includes(t) ? [t, l] : [t.replace(/([A-Z])/g, "_$1").toLowerCase(), l];
|
|
829
829
|
})
|
|
830
830
|
);
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function at(e, s = []) {
|
|
833
833
|
return Object.fromEntries(
|
|
834
834
|
Object.entries(e).map(([t, n]) => {
|
|
835
|
-
const l =
|
|
835
|
+
const l = te(n, (d) => at(d, s));
|
|
836
836
|
return s.includes(t) ? [t, l] : [t.replace(/_([a-z])/g, (d, f) => f.toUpperCase()), l];
|
|
837
837
|
})
|
|
838
838
|
);
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function bt(e, s) {
|
|
841
841
|
const t = {};
|
|
842
842
|
for (const n of s)
|
|
843
843
|
n in e && (t[n] = e[n]);
|
|
844
844
|
return t;
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function _t(e, s) {
|
|
847
847
|
const t = { ...e };
|
|
848
848
|
for (const n of s)
|
|
849
849
|
delete t[n];
|
|
850
850
|
return t;
|
|
851
851
|
}
|
|
852
|
-
function
|
|
852
|
+
function ae(e) {
|
|
853
853
|
if (e === null || typeof e != "object") return e;
|
|
854
854
|
if (e instanceof Date) return new Date(e.getTime());
|
|
855
855
|
if (e instanceof RegExp) return new RegExp(e.source, e.flags);
|
|
856
|
-
if (Array.isArray(e)) return e.map((t) =>
|
|
856
|
+
if (Array.isArray(e)) return e.map((t) => ae(t));
|
|
857
857
|
const s = {};
|
|
858
858
|
for (const t of Object.keys(e))
|
|
859
|
-
s[t] =
|
|
859
|
+
s[t] = ae(e[t]);
|
|
860
860
|
return s;
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function st(e, s = !1) {
|
|
863
863
|
const t = {};
|
|
864
864
|
for (const [n, l] of Object.entries(e))
|
|
865
865
|
if (!(l == null || l === ""))
|
|
866
866
|
if (s && typeof l == "object" && !Array.isArray(l) && !(l instanceof Date)) {
|
|
867
|
-
const a =
|
|
867
|
+
const a = st(l, !0);
|
|
868
868
|
Object.keys(a).length > 0 && (t[n] = a);
|
|
869
869
|
} else
|
|
870
870
|
t[n] = l;
|
|
871
871
|
return t;
|
|
872
872
|
}
|
|
873
|
-
function
|
|
873
|
+
function ot(e, s = "", t = ".") {
|
|
874
874
|
const n = {};
|
|
875
875
|
for (const [l, a] of Object.entries(e)) {
|
|
876
876
|
const d = s ? `${s}${t}${l}` : l;
|
|
877
|
-
a !== null && typeof a == "object" && !Array.isArray(a) && !(a instanceof Date) ? Object.assign(n,
|
|
877
|
+
a !== null && typeof a == "object" && !Array.isArray(a) && !(a instanceof Date) ? Object.assign(n, ot(a, d, t)) : n[d] = a;
|
|
878
878
|
}
|
|
879
879
|
return n;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function kt(e, s = ".") {
|
|
882
882
|
const t = {};
|
|
883
883
|
for (const [n, l] of Object.entries(e)) {
|
|
884
884
|
const a = n.split(s);
|
|
@@ -891,21 +891,21 @@ function Ct(e, s = ".") {
|
|
|
891
891
|
}
|
|
892
892
|
return t;
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function wt(e) {
|
|
895
895
|
return Object.entries(e).map(([s, t]) => ({
|
|
896
896
|
id: s,
|
|
897
897
|
label: t,
|
|
898
898
|
prop: s
|
|
899
899
|
}));
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function it(e, s) {
|
|
902
902
|
if (!e) return null;
|
|
903
903
|
let t = e.replace(/^@\//, "");
|
|
904
904
|
t.startsWith("views/") || (t = `views/${t}`), t.endsWith(".vue") || (t = `${t}.vue`);
|
|
905
905
|
const n = `/src/${t}`;
|
|
906
906
|
return s[n] ?? s["/src/views/common/NotFound.vue"] ?? null;
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function rt(e) {
|
|
909
909
|
const s = /* @__PURE__ */ new Map(), t = [];
|
|
910
910
|
return e.forEach((n) => s.set(n.name, { ...n, children: [] })), e.forEach((n) => {
|
|
911
911
|
const l = s.get(n.name);
|
|
@@ -917,7 +917,7 @@ function dt(e) {
|
|
|
917
917
|
}
|
|
918
918
|
}), t;
|
|
919
919
|
}
|
|
920
|
-
function
|
|
920
|
+
function de(e, s, t) {
|
|
921
921
|
return e.filter((n) => !t || !n.project || n.project === t).map((n) => {
|
|
922
922
|
var d;
|
|
923
923
|
const l = {
|
|
@@ -929,20 +929,20 @@ function pe(e, s, t) {
|
|
|
929
929
|
permissions: n.permissions ? n.permissions.split(",").map((f) => f.trim()).filter(Boolean) : [],
|
|
930
930
|
params: n.params ? n.params.split("&").map((f) => f.trim()).filter(Boolean) : []
|
|
931
931
|
}
|
|
932
|
-
}, a =
|
|
933
|
-
return a && (l.component = a), n.redirect && (l.redirect = n.redirect), (d = n.children) != null && d.length && (l.children =
|
|
932
|
+
}, a = it(n.component, s);
|
|
933
|
+
return a && (l.component = a), n.redirect && (l.redirect = n.redirect), (d = n.children) != null && d.length && (l.children = de(n.children, s, t)), l;
|
|
934
934
|
});
|
|
935
935
|
}
|
|
936
|
-
function
|
|
936
|
+
function Ct(e, s, t, n) {
|
|
937
937
|
const l = e.filter(
|
|
938
938
|
(a) => a.parent_name === t && a.is_show === 1 && a.component && s.includes(a.code)
|
|
939
939
|
);
|
|
940
940
|
return l.find((a) => !n || a.project === n) ?? l[0];
|
|
941
941
|
}
|
|
942
|
-
|
|
943
|
-
const
|
|
944
|
-
},
|
|
945
|
-
},
|
|
942
|
+
Y.configure({ showSpinner: !1 });
|
|
943
|
+
const se = (...e) => {
|
|
944
|
+
}, oe = (...e) => {
|
|
945
|
+
}, ut = (...e) => {
|
|
946
946
|
console.error("[Router]", ...e);
|
|
947
947
|
};
|
|
948
948
|
function $t(e, s) {
|
|
@@ -954,69 +954,59 @@ function $t(e, s) {
|
|
|
954
954
|
viewModules: d,
|
|
955
955
|
homeComponent: f,
|
|
956
956
|
notFoundComponent: _,
|
|
957
|
-
projectName:
|
|
958
|
-
layoutRouteName:
|
|
959
|
-
publicPaths:
|
|
957
|
+
projectName: y,
|
|
958
|
+
layoutRouteName: g = "Layout",
|
|
959
|
+
publicPaths: z = ["/login", "/register"],
|
|
960
960
|
loginRouteName: J = "login",
|
|
961
961
|
forbiddenRouteName: k = "Forbidden",
|
|
962
|
-
homeRouteName:
|
|
962
|
+
homeRouteName: h = "Home",
|
|
963
963
|
homeTitle: D = "首页",
|
|
964
|
-
noPermissionMessage:
|
|
964
|
+
noPermissionMessage: v = "暂无权限"
|
|
965
965
|
} = s;
|
|
966
966
|
let c = !1;
|
|
967
967
|
function o(u) {
|
|
968
|
-
const p =
|
|
968
|
+
const p = rt(u).find((E) => E.name === g);
|
|
969
969
|
if (!(p != null && p.children)) return;
|
|
970
|
-
const S =
|
|
970
|
+
const S = de(p.children, d, y);
|
|
971
971
|
S.forEach((E) => {
|
|
972
|
-
e.addRoute(
|
|
973
|
-
}), e.addRoute(
|
|
972
|
+
e.addRoute(g, E), se(`添加路由: ${String(E.name)} -> ${E.path}`);
|
|
973
|
+
}), e.addRoute(g, {
|
|
974
974
|
path: "",
|
|
975
|
-
name:
|
|
975
|
+
name: h,
|
|
976
976
|
component: f,
|
|
977
977
|
meta: { title: D }
|
|
978
978
|
}), e.addRoute({
|
|
979
979
|
path: "/:pathMatch(.*)*",
|
|
980
980
|
name: "NotFound",
|
|
981
981
|
component: _
|
|
982
|
-
}),
|
|
982
|
+
}), se(`动态路由添加完成,共 ${S.length} 条`);
|
|
983
983
|
}
|
|
984
984
|
return e.beforeEach(async (u, I, p) => {
|
|
985
|
-
if (
|
|
985
|
+
if (Y.start(), a() && !c)
|
|
986
986
|
try {
|
|
987
|
-
const
|
|
988
|
-
if (await
|
|
989
|
-
if (o(
|
|
990
|
-
|
|
991
|
-
j.backendRoutes,
|
|
992
|
-
P.routePermissions,
|
|
993
|
-
h,
|
|
994
|
-
v
|
|
995
|
-
);
|
|
996
|
-
if (T) {
|
|
997
|
-
p({ path: T.path, replace: !0 });
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
p({ ...u, replace: !0 });
|
|
987
|
+
const A = t(), O = n();
|
|
988
|
+
if (await A.initRoutes(), await O.loadUserPermissions(), A.backendRoutes.length > 0) {
|
|
989
|
+
if (o(A.backendRoutes), c = !0, u.path === "/" || u.path === "") {
|
|
990
|
+
p({ name: h, replace: !0 });
|
|
1001
991
|
return;
|
|
1002
992
|
}
|
|
1003
|
-
if (u.name ===
|
|
993
|
+
if (u.name === g) {
|
|
1004
994
|
p({ ...u, replace: !0 });
|
|
1005
995
|
return;
|
|
1006
996
|
}
|
|
1007
|
-
const H =
|
|
1008
|
-
if (H && !
|
|
1009
|
-
|
|
997
|
+
const H = A.backendRoutes.find((P) => P.name === u.name);
|
|
998
|
+
if (H && !O.routePermissions.includes(H.code)) {
|
|
999
|
+
oe("无权限访问:", u.path), p({ name: k, replace: !0 });
|
|
1010
1000
|
return;
|
|
1011
1001
|
}
|
|
1012
1002
|
p({ ...u, replace: !0 });
|
|
1013
1003
|
return;
|
|
1014
1004
|
}
|
|
1015
|
-
} catch (
|
|
1016
|
-
|
|
1005
|
+
} catch (A) {
|
|
1006
|
+
ut("获取权限失败:", A), c = !1, await l().logout(), p({ name: J, replace: !0 });
|
|
1017
1007
|
return;
|
|
1018
1008
|
}
|
|
1019
|
-
if (
|
|
1009
|
+
if (z.includes(u.path)) {
|
|
1020
1010
|
a() ? p({ path: "/", replace: !0 }) : p();
|
|
1021
1011
|
return;
|
|
1022
1012
|
}
|
|
@@ -1024,68 +1014,58 @@ function $t(e, s) {
|
|
|
1024
1014
|
p({ name: J, replace: !0 });
|
|
1025
1015
|
return;
|
|
1026
1016
|
}
|
|
1027
|
-
if (u.name ===
|
|
1017
|
+
if (u.name === g) {
|
|
1028
1018
|
p();
|
|
1029
1019
|
return;
|
|
1030
1020
|
}
|
|
1031
1021
|
const S = n(), E = t();
|
|
1032
1022
|
if (S.routePermissions.length === 0) {
|
|
1033
|
-
u.path !== "/" ? (
|
|
1023
|
+
u.path !== "/" ? (x.warning(v), p({ path: "/", replace: !0 })) : p();
|
|
1034
1024
|
return;
|
|
1035
1025
|
}
|
|
1036
1026
|
if (u.path === "/") {
|
|
1037
|
-
|
|
1038
|
-
E.backendRoutes,
|
|
1039
|
-
S.routePermissions,
|
|
1040
|
-
h,
|
|
1041
|
-
v
|
|
1042
|
-
);
|
|
1043
|
-
if (j && j.path !== "/") {
|
|
1044
|
-
p({ path: j.path, replace: !0 });
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
p();
|
|
1027
|
+
p({ name: h, replace: !0 });
|
|
1048
1028
|
return;
|
|
1049
1029
|
}
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
1052
|
-
|
|
1030
|
+
const M = E.backendRoutes.find((A) => A.name === u.name);
|
|
1031
|
+
if (M && !S.routePermissions.includes(M.code)) {
|
|
1032
|
+
oe("无权限访问:", u.path), p({ name: k, replace: !0 });
|
|
1053
1033
|
return;
|
|
1054
1034
|
}
|
|
1055
1035
|
p();
|
|
1056
|
-
}), e.afterEach(() =>
|
|
1036
|
+
}), e.afterEach(() => Y.done()), {
|
|
1057
1037
|
resetRouterState: () => {
|
|
1058
1038
|
c = !1;
|
|
1059
1039
|
}
|
|
1060
1040
|
};
|
|
1061
1041
|
}
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1042
|
+
const ct = [Ie, De, K, Oe, Ke, lt, ce], dt = (e) => {
|
|
1043
|
+
ct.forEach((s) => {
|
|
1064
1044
|
e.component(s.name ?? s.__name ?? "", s);
|
|
1065
1045
|
});
|
|
1066
|
-
},
|
|
1046
|
+
}, jt = { install: dt };
|
|
1067
1047
|
export {
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1048
|
+
Ie as JButton,
|
|
1049
|
+
K as JIconRender,
|
|
1050
|
+
Ke as JImportExcel,
|
|
1051
|
+
Oe as JSearchHeader,
|
|
1052
|
+
ce as JSideMenuItem,
|
|
1053
|
+
lt as JSidebar,
|
|
1054
|
+
De as JUploadImg,
|
|
1055
|
+
rt as buildRouteTree,
|
|
1076
1056
|
$t as createRouterGuard,
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1057
|
+
ae as deepClone,
|
|
1058
|
+
jt as default,
|
|
1059
|
+
st as filterEmpty,
|
|
1060
|
+
Ct as findFirstAllowedRoute,
|
|
1061
|
+
ot as flatten,
|
|
1062
|
+
it as getComponentImport,
|
|
1063
|
+
_t as omit,
|
|
1064
|
+
bt as pick,
|
|
1065
|
+
at as toCamelCase,
|
|
1066
|
+
nt as toSnakeCase,
|
|
1067
|
+
wt as toTableColumns,
|
|
1068
|
+
de as transformBackendRoutes,
|
|
1069
|
+
kt as unflatten
|
|
1090
1070
|
};
|
|
1091
1071
|
//# sourceMappingURL=index.js.map
|