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