jgy-public-component 0.0.11 → 0.0.13
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 +131 -123
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as N, openBlock as r, createElementBlock as B, normalizeClass as L, createCommentVNode as x, renderSlot as q, ref as A, watch as ce, resolveComponent as w, createVNode as m, unref as $, withCtx as i, createElementVNode as C, withModifiers as G, createBlock as b, Fragment as Z, toDisplayString as F, mergeProps as ve, computed as de, onMounted as ge, onBeforeUnmount as ye, normalizeStyle as me, createTextVNode as z, useModel as be, renderList as te, mergeModels as ae } from "vue";
|
|
2
2
|
import { ElMessage as R } from "element-plus";
|
|
3
3
|
import { Delete as Q, Plus as Y, Loading as se, ZoomIn as _e, Search as ke, Refresh as we, ArrowDown as Ce } from "@element-plus/icons-vue";
|
|
4
4
|
import je from "vuedraggable";
|
|
5
5
|
import { Icon as $e } from "@iconify/vue";
|
|
6
|
-
import * as
|
|
6
|
+
import * as U from "xlsx";
|
|
7
7
|
import ee from "nprogress";
|
|
8
8
|
const xe = ["disabled"], Re = {
|
|
9
9
|
key: 0,
|
|
@@ -11,7 +11,7 @@ const xe = ["disabled"], Re = {
|
|
|
11
11
|
}, Ie = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "j-button__text"
|
|
14
|
-
}, Se = /* @__PURE__ */
|
|
14
|
+
}, Se = /* @__PURE__ */ N({
|
|
15
15
|
__name: "JButton",
|
|
16
16
|
props: {
|
|
17
17
|
type: { default: "default" },
|
|
@@ -28,7 +28,7 @@ const xe = ["disabled"], Re = {
|
|
|
28
28
|
!t.disabled && !t.loading && n("click", a);
|
|
29
29
|
}
|
|
30
30
|
return (a, d) => (r(), B("button", {
|
|
31
|
-
class:
|
|
31
|
+
class: L(["j-button", [
|
|
32
32
|
`j-button--${e.type}`,
|
|
33
33
|
`j-button--${e.size}`,
|
|
34
34
|
{
|
|
@@ -47,12 +47,12 @@ const xe = ["disabled"], Re = {
|
|
|
47
47
|
])) : x("", !0)
|
|
48
48
|
], 10, xe));
|
|
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
|
-
}, Be = /* @__PURE__ */
|
|
55
|
+
}, Be = /* @__PURE__ */ W(Se, [["__scopeId", "data-v-22864824"]]), Ee = { class: "j-upload-img-container" }, Ae = {
|
|
56
56
|
key: 0,
|
|
57
57
|
class: "images-wrapper"
|
|
58
58
|
}, Ve = { class: "image-item" }, Me = ["onClick"], Fe = {
|
|
@@ -61,7 +61,7 @@ const xe = ["disabled"], Re = {
|
|
|
61
61
|
}, Je = { class: "image-actions" }, De = {
|
|
62
62
|
key: 2,
|
|
63
63
|
class: "upload-tip"
|
|
64
|
-
}, Te = { key: 0 }, ze = /* @__PURE__ */
|
|
64
|
+
}, Te = { key: 0 }, ze = /* @__PURE__ */ N({
|
|
65
65
|
name: "JUploadImg",
|
|
66
66
|
__name: "JUploadImg",
|
|
67
67
|
props: {
|
|
@@ -81,26 +81,26 @@ const xe = ["disabled"], Re = {
|
|
|
81
81
|
a.value = !0;
|
|
82
82
|
}, _ = () => {
|
|
83
83
|
l.value = "", n("update:modelValue", ""), R.success("删除成功");
|
|
84
|
-
},
|
|
85
|
-
|
|
84
|
+
}, v = A([]), h = A(!1), O = (g) => {
|
|
85
|
+
v.value = g.map((c, o) => ({
|
|
86
86
|
uid: Date.now() + o,
|
|
87
|
-
url:
|
|
87
|
+
url: c
|
|
88
88
|
}));
|
|
89
89
|
};
|
|
90
90
|
ce(() => t.modelValue, (g) => {
|
|
91
|
-
t.multiple ? Array.isArray(g) && g.length > 0 ? O(g) :
|
|
91
|
+
t.multiple ? Array.isArray(g) && g.length > 0 ? O(g) : v.value = [] : typeof g == "string" ? l.value = g : l.value = "";
|
|
92
92
|
}, { immediate: !0 });
|
|
93
93
|
const J = () => {
|
|
94
94
|
D();
|
|
95
95
|
}, k = (g) => {
|
|
96
|
-
|
|
96
|
+
v.value.splice(g, 1), D(), R.success("删除成功");
|
|
97
97
|
}, y = async (g) => {
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
98
|
+
const c = g.raw;
|
|
99
|
+
if (!c) {
|
|
100
100
|
R.error("文件不存在,请重试");
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
103
|
+
if (c.size > t.maxSize * 1024 * 1024) {
|
|
104
104
|
R.error(`图片大小不能超过 ${t.maxSize}MB`);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -109,25 +109,25 @@ const xe = ["disabled"], Re = {
|
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
try {
|
|
112
|
-
|
|
113
|
-
const o = await t.uploadFn(
|
|
114
|
-
t.multiple ? (
|
|
112
|
+
h.value = !0;
|
|
113
|
+
const o = await t.uploadFn(c);
|
|
114
|
+
t.multiple ? (v.value.push({ uid: Date.now(), url: o }), D()) : (l.value = o, n("update:modelValue", o)), n("success", o), R.success("上传成功");
|
|
115
115
|
} catch (o) {
|
|
116
116
|
console.error("上传出错:", o), R.error("上传失败,请重试"), n("error", o);
|
|
117
117
|
} finally {
|
|
118
|
-
|
|
118
|
+
h.value = !1;
|
|
119
119
|
}
|
|
120
120
|
}, D = () => {
|
|
121
|
-
const g =
|
|
121
|
+
const g = v.value.map((c) => c.url);
|
|
122
122
|
n("update:modelValue", g);
|
|
123
123
|
};
|
|
124
|
-
return (g,
|
|
125
|
-
const o = w("el-image"),
|
|
124
|
+
return (g, c) => {
|
|
125
|
+
const o = w("el-image"), u = w("el-icon"), I = w("el-upload"), p = w("el-image-viewer");
|
|
126
126
|
return r(), B("div", Ee, [
|
|
127
127
|
e.multiple ? (r(), B("div", Ae, [
|
|
128
128
|
m($(je), {
|
|
129
|
-
modelValue:
|
|
130
|
-
"onUpdate:modelValue":
|
|
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,
|
|
@@ -138,7 +138,7 @@ const xe = ["disabled"], Re = {
|
|
|
138
138
|
C("div", Ve, [
|
|
139
139
|
m(o, {
|
|
140
140
|
src: S.url,
|
|
141
|
-
"preview-src-list":
|
|
141
|
+
"preview-src-list": v.value.map((V) => V.url),
|
|
142
142
|
"initial-index": E,
|
|
143
143
|
fit: "cover",
|
|
144
144
|
class: "image-preview",
|
|
@@ -150,7 +150,7 @@ const xe = ["disabled"], Re = {
|
|
|
150
150
|
class: "delete-btn",
|
|
151
151
|
onClick: G((V) => k(E), ["stop"])
|
|
152
152
|
}, [
|
|
153
|
-
m(
|
|
153
|
+
m(u, { class: "icon-delete" }, {
|
|
154
154
|
default: i(() => [
|
|
155
155
|
m($(Q))
|
|
156
156
|
]),
|
|
@@ -161,18 +161,18 @@ const xe = ["disabled"], Re = {
|
|
|
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
169
|
"on-change": y,
|
|
170
|
-
disabled:
|
|
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
|
}, {
|
|
@@ -180,7 +180,7 @@ const xe = ["disabled"], Re = {
|
|
|
180
180
|
m($(se))
|
|
181
181
|
]),
|
|
182
182
|
_: 1
|
|
183
|
-
})) : (r(), b(
|
|
183
|
+
})) : (r(), b(u, {
|
|
184
184
|
key: 0,
|
|
185
185
|
class: "uploader-icon"
|
|
186
186
|
}, {
|
|
@@ -200,7 +200,7 @@ const xe = ["disabled"], Re = {
|
|
|
200
200
|
class: "image-preview"
|
|
201
201
|
}, null, 8, ["src"]),
|
|
202
202
|
C("div", Je, [
|
|
203
|
-
m(
|
|
203
|
+
m(u, {
|
|
204
204
|
class: "action-icon",
|
|
205
205
|
onClick: G(f, ["stop"])
|
|
206
206
|
}, {
|
|
@@ -209,7 +209,7 @@ const xe = ["disabled"], Re = {
|
|
|
209
209
|
]),
|
|
210
210
|
_: 1
|
|
211
211
|
}),
|
|
212
|
-
e.disabled ? x("", !0) : (r(), b(
|
|
212
|
+
e.disabled ? x("", !0) : (r(), b(u, {
|
|
213
213
|
key: 0,
|
|
214
214
|
class: "action-icon",
|
|
215
215
|
onClick: G(_, ["stop"])
|
|
@@ -226,14 +226,14 @@ const xe = ["disabled"], Re = {
|
|
|
226
226
|
"auto-upload": !1,
|
|
227
227
|
"show-file-list": !1,
|
|
228
228
|
"on-change": y,
|
|
229
|
-
disabled: e.disabled ||
|
|
229
|
+
disabled: e.disabled || h.value,
|
|
230
230
|
accept: e.accept,
|
|
231
231
|
"list-type": "picture-card"
|
|
232
232
|
}, {
|
|
233
233
|
default: i(() => [
|
|
234
|
-
m(
|
|
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($(Y), { key: 0 }))
|
|
@@ -247,7 +247,7 @@ const xe = ["disabled"], Re = {
|
|
|
247
247
|
key: 2,
|
|
248
248
|
"url-list": [l.value],
|
|
249
249
|
teleported: !0,
|
|
250
|
-
onClose:
|
|
250
|
+
onClose: c[1] || (c[1] = (S) => a.value = !1)
|
|
251
251
|
}, null, 8, ["url-list"])) : x("", !0)
|
|
252
252
|
], 64)),
|
|
253
253
|
$(d) ? (r(), B("div", De, [
|
|
@@ -257,7 +257,7 @@ const xe = ["disabled"], Re = {
|
|
|
257
257
|
]);
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
}), Oe = /* @__PURE__ */
|
|
260
|
+
}), Oe = /* @__PURE__ */ W(ze, [["__scopeId", "data-v-052bacda"]]), X = /* @__PURE__ */ N({
|
|
261
261
|
name: "JIconRender",
|
|
262
262
|
__name: "JIconRender",
|
|
263
263
|
props: {
|
|
@@ -272,7 +272,7 @@ const xe = ["disabled"], Re = {
|
|
|
272
272
|
height: e.size
|
|
273
273
|
}, s.$attrs), null, 16, ["icon", "width", "height"])) : x("", !0);
|
|
274
274
|
}
|
|
275
|
-
}), Pe = { class: "action-left" }, He = /* @__PURE__ */
|
|
275
|
+
}), Pe = { class: "action-left" }, He = /* @__PURE__ */ N({
|
|
276
276
|
name: "JSearchHeader",
|
|
277
277
|
__name: "JSearchHeader",
|
|
278
278
|
props: {
|
|
@@ -286,7 +286,7 @@ 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 = A(), a = A(!1), d = A(!1), f = A(0), _ = A(0),
|
|
289
|
+
const t = e, n = s, l = A(), a = A(!1), d = A(!1), f = A(0), _ = A(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;
|
|
@@ -299,7 +299,7 @@ const xe = ["disabled"], Re = {
|
|
|
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
305
|
const y = () => {
|
|
@@ -310,17 +310,17 @@ const xe = ["disabled"], Re = {
|
|
|
310
310
|
};
|
|
311
311
|
let J = null;
|
|
312
312
|
return ge(() => {
|
|
313
|
-
|
|
313
|
+
h(), v.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
|
+
h(), v.value && !a.value && l.value && (l.value.style.maxHeight = _.value + "px");
|
|
319
319
|
}), J.observe(l.value, { childList: !0 }));
|
|
320
320
|
}), ye(() => {
|
|
321
321
|
J == null || J.disconnect();
|
|
322
322
|
}), (k, y) => {
|
|
323
|
-
const D = w("el-form"), g = w("el-button"),
|
|
323
|
+
const D = 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"
|
|
@@ -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: L(["form-items-wrapper", { "is-animated": d.value }])
|
|
338
338
|
}, [
|
|
339
339
|
q(k.$slots, "default", {}, void 0, !0)
|
|
340
340
|
], 2)
|
|
@@ -350,7 +350,7 @@ const xe = ["disabled"], Re = {
|
|
|
350
350
|
key: 0,
|
|
351
351
|
type: "primary",
|
|
352
352
|
icon: $(Y),
|
|
353
|
-
onClick: y[0] || (y[0] = (
|
|
353
|
+
onClick: y[0] || (y[0] = (u) => n("add"))
|
|
354
354
|
}, {
|
|
355
355
|
default: i(() => [
|
|
356
356
|
z(F(e.addText), 1)
|
|
@@ -362,7 +362,7 @@ const xe = ["disabled"], Re = {
|
|
|
362
362
|
type: "danger",
|
|
363
363
|
icon: $(Q),
|
|
364
364
|
disabled: e.selectedCount === 0,
|
|
365
|
-
onClick: y[1] || (y[1] = (
|
|
365
|
+
onClick: y[1] || (y[1] = (u) => n("batchDelete"))
|
|
366
366
|
}, {
|
|
367
367
|
default: i(() => [
|
|
368
368
|
z(" 批量删除" + F(e.selectedCount ? `(${e.selectedCount})` : ""), 1)
|
|
@@ -373,7 +373,7 @@ const xe = ["disabled"], Re = {
|
|
|
373
373
|
key: 2,
|
|
374
374
|
type: "primary",
|
|
375
375
|
icon: $(ke),
|
|
376
|
-
onClick: y[2] || (y[2] = (
|
|
376
|
+
onClick: y[2] || (y[2] = (u) => n("search"))
|
|
377
377
|
}, {
|
|
378
378
|
default: i(() => [...y[4] || (y[4] = [
|
|
379
379
|
z("搜索", -1)
|
|
@@ -383,7 +383,7 @@ const xe = ["disabled"], Re = {
|
|
|
383
383
|
e.showReset ? (r(), b(g, {
|
|
384
384
|
key: 3,
|
|
385
385
|
icon: $(we),
|
|
386
|
-
onClick: y[3] || (y[3] = (
|
|
386
|
+
onClick: y[3] || (y[3] = (u) => n("reset"))
|
|
387
387
|
}, {
|
|
388
388
|
default: i(() => [...y[5] || (y[5] = [
|
|
389
389
|
z("重置", -1)
|
|
@@ -392,7 +392,7 @@ const xe = ["disabled"], Re = {
|
|
|
392
392
|
}, 8, ["icon"])) : x("", !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",
|
|
@@ -400,8 +400,8 @@ const xe = ["disabled"], Re = {
|
|
|
400
400
|
}, {
|
|
401
401
|
default: i(() => [
|
|
402
402
|
z(F(a.value ? "收起" : "展开") + " ", 1),
|
|
403
|
-
m(
|
|
404
|
-
class:
|
|
403
|
+
m(c, {
|
|
404
|
+
class: L(["toggle-icon", { "is-expanded": a.value }])
|
|
405
405
|
}, {
|
|
406
406
|
default: i(() => [
|
|
407
407
|
m($(Ce))
|
|
@@ -417,10 +417,10 @@ const xe = ["disabled"], Re = {
|
|
|
417
417
|
});
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
|
-
}), Le = /* @__PURE__ */
|
|
420
|
+
}), Le = /* @__PURE__ */ W(He, [["__scopeId", "data-v-4488c604"]]), Ne = { class: "j-import-upload-row" }, Ue = { class: "j-import-stat-num" }, We = { class: "j-import-stat-num" }, qe = { class: "j-import-stat-num" }, Ke = {
|
|
421
421
|
key: 0,
|
|
422
422
|
class: "j-import-status-fail"
|
|
423
|
-
}, Xe = { key: 1 }, Ze = /* @__PURE__ */
|
|
423
|
+
}, Xe = { key: 1 }, Ze = /* @__PURE__ */ N({
|
|
424
424
|
name: "JImportExcel",
|
|
425
425
|
__name: "JImportExcel",
|
|
426
426
|
props: /* @__PURE__ */ ae({
|
|
@@ -434,20 +434,20 @@ const xe = ["disabled"], Re = {
|
|
|
434
434
|
}),
|
|
435
435
|
emits: /* @__PURE__ */ ae(["success"], ["update:modelValue"]),
|
|
436
436
|
setup(e, { emit: s }) {
|
|
437
|
-
const t = e, n = s, l = be(e, "modelValue"), a = A(!1), d = A({}), f = A([]), _ = A({ total: 0, success: 0, fail: 0 }),
|
|
437
|
+
const t = e, n = s, l = be(e, "modelValue"), a = A(!1), d = A({}), f = A([]), _ = A({ 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 }))), O = async () => {
|
|
443
443
|
try {
|
|
444
|
-
const
|
|
445
|
-
d.value =
|
|
444
|
+
const c = await t.getFieldListApi();
|
|
445
|
+
d.value = c.data.tableFieldsInfo ?? {};
|
|
446
446
|
} catch {
|
|
447
447
|
R.error("获取字段列表失败");
|
|
448
448
|
}
|
|
449
|
-
}, J = (
|
|
450
|
-
const o =
|
|
449
|
+
}, J = (c) => {
|
|
450
|
+
const o = c.raw;
|
|
451
451
|
if (!o) return;
|
|
452
452
|
if (![
|
|
453
453
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -459,12 +459,12 @@ const xe = ["disabled"], Re = {
|
|
|
459
459
|
const I = new FileReader();
|
|
460
460
|
I.onload = (p) => {
|
|
461
461
|
try {
|
|
462
|
-
const S =
|
|
462
|
+
const S = U.read(p.target.result, { type: "binary" }), E = S.SheetNames[0], V = S.Sheets[E], j = U.utils.sheet_to_json(V);
|
|
463
463
|
if (!j.length) {
|
|
464
464
|
R.warning("文件内容为空");
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
|
-
const P =
|
|
467
|
+
const P = h.value.map((T) => T.prop), H = j.map((T) => {
|
|
468
468
|
const M = Object.values(T), K = { _status: 0, _error: "" };
|
|
469
469
|
return P.forEach((ne, he) => {
|
|
470
470
|
K[ne] = M[he];
|
|
@@ -475,20 +475,20 @@ const xe = ["disabled"], Re = {
|
|
|
475
475
|
R.error("解析文件失败,请检查文件格式");
|
|
476
476
|
}
|
|
477
477
|
}, I.readAsBinaryString(o);
|
|
478
|
-
}, k = (
|
|
479
|
-
f.value.splice(
|
|
478
|
+
}, k = (c) => {
|
|
479
|
+
f.value.splice(c, 1), _.value.total = f.value.length;
|
|
480
480
|
}, y = async () => {
|
|
481
|
-
const
|
|
482
|
-
if (!
|
|
481
|
+
const c = f.value.filter((o) => o._status === 0).map(({ _status: o, _error: u, ...I }) => I);
|
|
482
|
+
if (!c.length) {
|
|
483
483
|
R.warning("没有可导入的数据");
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
a.value = !0;
|
|
487
487
|
try {
|
|
488
|
-
const o = await t.importApi(
|
|
489
|
-
o.code === 1 ? (f.value.forEach((
|
|
490
|
-
|
|
491
|
-
}), _.value.success = f.value.filter((
|
|
488
|
+
const o = await t.importApi(c);
|
|
489
|
+
o.code === 1 ? (f.value.forEach((u) => {
|
|
490
|
+
u._status === 0 && (u._status = 1);
|
|
491
|
+
}), _.value.success = f.value.filter((u) => u._status === 1).length, R.success("导入成功"), n("success")) : R.error(o.msg || "导入失败");
|
|
492
492
|
} catch {
|
|
493
493
|
R.error("导入失败,请重试");
|
|
494
494
|
} finally {
|
|
@@ -496,18 +496,18 @@ const xe = ["disabled"], Re = {
|
|
|
496
496
|
}
|
|
497
497
|
}, D = () => {
|
|
498
498
|
try {
|
|
499
|
-
const
|
|
500
|
-
o.forEach((p) =>
|
|
501
|
-
const I =
|
|
502
|
-
|
|
499
|
+
const c = U.utils.book_new(), o = h.value.map((p) => p.label), u = {};
|
|
500
|
+
o.forEach((p) => u[p] = "");
|
|
501
|
+
const I = U.utils.json_to_sheet([u]);
|
|
502
|
+
U.utils.book_append_sheet(c, I, "模板"), U.writeFile(c, "导入模板.xlsx");
|
|
503
503
|
} catch {
|
|
504
504
|
R.error("模板下载失败");
|
|
505
505
|
}
|
|
506
506
|
}, g = () => {
|
|
507
507
|
a.value || (l.value = !1, f.value = [], _.value = { total: 0, success: 0, fail: 0 });
|
|
508
508
|
};
|
|
509
|
-
return (
|
|
510
|
-
const
|
|
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"), V = w("el-col"), j = w("el-row"), P = w("el-table-column"), H = w("el-table"), T = w("el-dialog");
|
|
511
511
|
return r(), b(T, {
|
|
512
512
|
modelValue: l.value,
|
|
513
513
|
"onUpdate:modelValue": o[0] || (o[0] = (M) => l.value = M),
|
|
@@ -532,7 +532,7 @@ const xe = ["disabled"], Re = {
|
|
|
532
532
|
}, {
|
|
533
533
|
default: i(() => [
|
|
534
534
|
o[3] || (o[3] = C("div", { class: "j-import-upload-card-title" }, "导入 EXCEL", -1)),
|
|
535
|
-
m(
|
|
535
|
+
m(u, { style: { margin: "10px 0" } }),
|
|
536
536
|
C("div", Ne, [
|
|
537
537
|
m(p, {
|
|
538
538
|
accept: ".xlsx,.xls",
|
|
@@ -550,7 +550,7 @@ const xe = ["disabled"], Re = {
|
|
|
550
550
|
]),
|
|
551
551
|
_: 1
|
|
552
552
|
}),
|
|
553
|
-
|
|
553
|
+
h.value.length ? (r(), b(S, {
|
|
554
554
|
key: 0,
|
|
555
555
|
type: "primary",
|
|
556
556
|
class: "j-import-no-wrap",
|
|
@@ -642,7 +642,7 @@ const xe = ["disabled"], Re = {
|
|
|
642
642
|
class: "j-import-data-table"
|
|
643
643
|
}, {
|
|
644
644
|
default: i(() => [
|
|
645
|
-
(r(!0), B(Z, null, te(
|
|
645
|
+
(r(!0), B(Z, null, te(h.value, (M) => (r(), b(P, {
|
|
646
646
|
key: M.prop,
|
|
647
647
|
prop: M.prop,
|
|
648
648
|
label: M.label,
|
|
@@ -656,7 +656,7 @@ const xe = ["disabled"], Re = {
|
|
|
656
656
|
fixed: "right"
|
|
657
657
|
}, {
|
|
658
658
|
default: i(({ row: M }) => [
|
|
659
|
-
M._status === -1 ? (r(), B("span", Ke, F(M._error || "创建失败"), 1)) : (r(), B("span", Xe, F(
|
|
659
|
+
M._status === -1 ? (r(), B("span", Ke, F(M._error || "创建失败"), 1)) : (r(), B("span", Xe, F(v[M._status]), 1))
|
|
660
660
|
]),
|
|
661
661
|
_: 1
|
|
662
662
|
}),
|
|
@@ -688,7 +688,7 @@ const xe = ["disabled"], Re = {
|
|
|
688
688
|
}, 8, ["modelValue", "title"]);
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
|
-
}), Ge = /* @__PURE__ */
|
|
691
|
+
}), Ge = /* @__PURE__ */ W(Ze, [["__scopeId", "data-v-2ece86f5"]]), Qe = { class: "j-sidebar__menu-item-title" }, Ye = /* @__PURE__ */ N({
|
|
692
692
|
name: "JSideMenuItem",
|
|
693
693
|
__name: "JSideMenuItem",
|
|
694
694
|
props: {
|
|
@@ -702,10 +702,11 @@ 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"), v = w("el-menu-item");
|
|
706
706
|
return e.menuItem.children && e.menuItem.children.length > 0 ? (r(), b(_, {
|
|
707
707
|
key: 0,
|
|
708
|
-
index: e.menuItem.path
|
|
708
|
+
index: e.menuItem.path,
|
|
709
|
+
class: L([`j-sidebar__depth-${e.depth}`])
|
|
709
710
|
}, {
|
|
710
711
|
title: i(() => [
|
|
711
712
|
e.menuItem.icon && e.depth === 0 ? (r(), b($(X), {
|
|
@@ -715,18 +716,19 @@ const xe = ["disabled"], Re = {
|
|
|
715
716
|
C("span", Qe, F(e.menuItem.title || e.menuItem.name), 1)
|
|
716
717
|
]),
|
|
717
718
|
default: i(() => [
|
|
718
|
-
(r(!0), B(Z, null, te(e.menuItem.children, (
|
|
719
|
-
key:
|
|
720
|
-
"menu-item":
|
|
719
|
+
(r(!0), B(Z, null, te(e.menuItem.children, (h) => (r(), b(f, {
|
|
720
|
+
key: h.path,
|
|
721
|
+
"menu-item": h,
|
|
721
722
|
"is-collapse": e.isCollapse,
|
|
722
723
|
depth: e.depth + 1,
|
|
723
724
|
onMenuClick: d[0] || (d[0] = (O) => n("menu-click", O))
|
|
724
725
|
}, null, 8, ["menu-item", "is-collapse", "depth"]))), 128))
|
|
725
726
|
]),
|
|
726
727
|
_: 1
|
|
727
|
-
}, 8, ["index"])) : (r(), b(
|
|
728
|
+
}, 8, ["index", "class"])) : (r(), b(v, {
|
|
728
729
|
key: 1,
|
|
729
730
|
index: e.menuItem.path,
|
|
731
|
+
class: L([`j-sidebar__depth-${e.depth}`]),
|
|
730
732
|
onClick: l
|
|
731
733
|
}, {
|
|
732
734
|
title: i(() => [
|
|
@@ -739,10 +741,10 @@ const xe = ["disabled"], Re = {
|
|
|
739
741
|
}, null, 8, ["icon"])) : x("", !0)
|
|
740
742
|
]),
|
|
741
743
|
_: 1
|
|
742
|
-
}, 8, ["index"]));
|
|
744
|
+
}, 8, ["index", "class"]));
|
|
743
745
|
};
|
|
744
746
|
}
|
|
745
|
-
}), fe = /* @__PURE__ */
|
|
747
|
+
}), fe = /* @__PURE__ */ W(Ye, [["__scopeId", "data-v-eb6f5fc5"]]), et = { class: "j-sidebar__logo" }, tt = { class: "j-sidebar__title" }, lt = { class: "j-sidebar__menu-wrapper" }, nt = { class: "j-sidebar__footer" }, at = /* @__PURE__ */ N({
|
|
746
748
|
name: "JSidebar",
|
|
747
749
|
__name: "JSidebar",
|
|
748
750
|
props: {
|
|
@@ -767,14 +769,14 @@ const xe = ["disabled"], Re = {
|
|
|
767
769
|
return (d, f) => {
|
|
768
770
|
const _ = w("el-menu");
|
|
769
771
|
return r(), B("div", {
|
|
770
|
-
class:
|
|
772
|
+
class: L(["j-sidebar", l.value ? "j-sidebar--collapsed" : "j-sidebar--expanded"]),
|
|
771
773
|
style: me({ width: l.value ? `${e.collapsedWidth}px` : `${e.expandedWidth}px` })
|
|
772
774
|
}, [
|
|
773
775
|
C("div", et, [
|
|
774
776
|
q(d.$slots, "logo", { collapsed: l.value }, () => {
|
|
775
|
-
var
|
|
777
|
+
var v;
|
|
776
778
|
return [
|
|
777
|
-
C("h2", tt, F(l.value ? e.collapsedTitle || ((
|
|
779
|
+
C("h2", tt, F(l.value ? e.collapsedTitle || ((v = e.title) == null ? void 0 : v.charAt(0)) || "" : e.title), 1)
|
|
778
780
|
];
|
|
779
781
|
}, !0)
|
|
780
782
|
]),
|
|
@@ -787,11 +789,11 @@ const xe = ["disabled"], Re = {
|
|
|
787
789
|
"collapse-transition": !1
|
|
788
790
|
}, {
|
|
789
791
|
default: i(() => [
|
|
790
|
-
(r(!0), B(Z, null, te(e.menus, (
|
|
791
|
-
key:
|
|
792
|
-
"menu-item":
|
|
792
|
+
(r(!0), B(Z, null, te(e.menus, (v) => (r(), b(fe, {
|
|
793
|
+
key: v.path,
|
|
794
|
+
"menu-item": v,
|
|
793
795
|
"is-collapse": l.value,
|
|
794
|
-
onMenuClick: f[0] || (f[0] = (
|
|
796
|
+
onMenuClick: f[0] || (f[0] = (h) => n("menu-click", h))
|
|
795
797
|
}, null, 8, ["menu-item", "is-collapse"]))), 128))
|
|
796
798
|
]),
|
|
797
799
|
_: 1
|
|
@@ -803,7 +805,7 @@ const xe = ["disabled"], Re = {
|
|
|
803
805
|
toggle: a
|
|
804
806
|
}, () => [
|
|
805
807
|
C("button", {
|
|
806
|
-
class:
|
|
808
|
+
class: L(["j-sidebar__collapse-btn", l.value ? "j-sidebar__collapse-btn--center" : "j-sidebar__collapse-btn--right"]),
|
|
807
809
|
onClick: a
|
|
808
810
|
}, [
|
|
809
811
|
m($(X), {
|
|
@@ -815,7 +817,7 @@ const xe = ["disabled"], Re = {
|
|
|
815
817
|
], 6);
|
|
816
818
|
};
|
|
817
819
|
}
|
|
818
|
-
}), st = /* @__PURE__ */
|
|
820
|
+
}), st = /* @__PURE__ */ W(at, [["__scopeId", "data-v-4704586e"]]);
|
|
819
821
|
function le(e, s) {
|
|
820
822
|
return Array.isArray(e) ? e.map((t) => le(t, s)) : e !== null && typeof e == "object" && !(e instanceof Date) ? s(e) : e;
|
|
821
823
|
}
|
|
@@ -952,8 +954,8 @@ function $t(e, s) {
|
|
|
952
954
|
viewModules: d,
|
|
953
955
|
homeComponent: f,
|
|
954
956
|
notFoundComponent: _,
|
|
955
|
-
projectName:
|
|
956
|
-
layoutRouteName:
|
|
957
|
+
projectName: v,
|
|
958
|
+
layoutRouteName: h = "Layout",
|
|
957
959
|
publicPaths: O = ["/login", "/register"],
|
|
958
960
|
loginRouteName: J = "login",
|
|
959
961
|
forbiddenRouteName: k = "Forbidden",
|
|
@@ -961,14 +963,14 @@ function $t(e, s) {
|
|
|
961
963
|
homeTitle: D = "首页",
|
|
962
964
|
noPermissionMessage: g = "暂无权限"
|
|
963
965
|
} = s;
|
|
964
|
-
let
|
|
965
|
-
function o(
|
|
966
|
-
const p = dt(
|
|
966
|
+
let c = !1;
|
|
967
|
+
function o(u) {
|
|
968
|
+
const p = dt(u).find((E) => E.name === h);
|
|
967
969
|
if (!(p != null && p.children)) return;
|
|
968
|
-
const S = pe(p.children, d,
|
|
970
|
+
const S = pe(p.children, d, v);
|
|
969
971
|
S.forEach((E) => {
|
|
970
|
-
e.addRoute(
|
|
971
|
-
}), e.addRoute(
|
|
972
|
+
e.addRoute(h, E), re(`添加路由: ${String(E.name)} -> ${E.path}`);
|
|
973
|
+
}), e.addRoute(h, {
|
|
972
974
|
path: "",
|
|
973
975
|
name: y,
|
|
974
976
|
component: f,
|
|
@@ -979,36 +981,42 @@ function $t(e, s) {
|
|
|
979
981
|
component: _
|
|
980
982
|
}), re(`动态路由添加完成,共 ${S.length} 条`);
|
|
981
983
|
}
|
|
982
|
-
return e.beforeEach(async (
|
|
983
|
-
if (ee.start(), a() && !
|
|
984
|
+
return e.beforeEach(async (u, I, p) => {
|
|
985
|
+
if (ee.start(), a() && !c)
|
|
984
986
|
try {
|
|
985
987
|
const j = t(), P = n();
|
|
986
988
|
if (await j.initRoutes(), await P.loadUserPermissions(), j.backendRoutes.length > 0) {
|
|
987
|
-
if (o(j.backendRoutes),
|
|
989
|
+
if (o(j.backendRoutes), c = !0, u.path === "/" || u.path === "") {
|
|
988
990
|
const T = ie(
|
|
989
991
|
j.backendRoutes,
|
|
990
992
|
P.routePermissions,
|
|
991
|
-
|
|
992
|
-
|
|
993
|
+
h,
|
|
994
|
+
v
|
|
993
995
|
);
|
|
994
996
|
if (T) {
|
|
995
997
|
p({ path: T.path, replace: !0 });
|
|
996
998
|
return;
|
|
997
999
|
}
|
|
1000
|
+
p({ ...u, replace: !0 });
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
if (u.name === h) {
|
|
1004
|
+
p({ ...u, replace: !0 });
|
|
1005
|
+
return;
|
|
998
1006
|
}
|
|
999
|
-
const H = j.backendRoutes.find((T) => T.name ===
|
|
1007
|
+
const H = j.backendRoutes.find((T) => T.name === u.name);
|
|
1000
1008
|
if (H && !P.routePermissions.includes(H.code)) {
|
|
1001
|
-
ue("无权限访问:",
|
|
1009
|
+
ue("无权限访问:", u.path), p({ name: k, replace: !0 });
|
|
1002
1010
|
return;
|
|
1003
1011
|
}
|
|
1004
|
-
p({ ...
|
|
1012
|
+
p({ ...u, replace: !0 });
|
|
1005
1013
|
return;
|
|
1006
1014
|
}
|
|
1007
1015
|
} catch (j) {
|
|
1008
|
-
mt("获取权限失败:", j),
|
|
1016
|
+
mt("获取权限失败:", j), c = !1, await l().logout(), p({ name: J, replace: !0 });
|
|
1009
1017
|
return;
|
|
1010
1018
|
}
|
|
1011
|
-
if (O.includes(
|
|
1019
|
+
if (O.includes(u.path)) {
|
|
1012
1020
|
a() ? p({ path: "/", replace: !0 }) : p();
|
|
1013
1021
|
return;
|
|
1014
1022
|
}
|
|
@@ -1016,21 +1024,21 @@ function $t(e, s) {
|
|
|
1016
1024
|
p({ name: J, replace: !0 });
|
|
1017
1025
|
return;
|
|
1018
1026
|
}
|
|
1019
|
-
if (
|
|
1027
|
+
if (u.name === h) {
|
|
1020
1028
|
p();
|
|
1021
1029
|
return;
|
|
1022
1030
|
}
|
|
1023
1031
|
const S = n(), E = t();
|
|
1024
1032
|
if (S.routePermissions.length === 0) {
|
|
1025
|
-
|
|
1033
|
+
u.path !== "/" ? (R.warning(g), p({ path: "/", replace: !0 })) : p();
|
|
1026
1034
|
return;
|
|
1027
1035
|
}
|
|
1028
|
-
if (
|
|
1036
|
+
if (u.path === "/") {
|
|
1029
1037
|
const j = ie(
|
|
1030
1038
|
E.backendRoutes,
|
|
1031
1039
|
S.routePermissions,
|
|
1032
|
-
|
|
1033
|
-
|
|
1040
|
+
h,
|
|
1041
|
+
v
|
|
1034
1042
|
);
|
|
1035
1043
|
if (j && j.path !== "/") {
|
|
1036
1044
|
p({ path: j.path, replace: !0 });
|
|
@@ -1039,15 +1047,15 @@ function $t(e, s) {
|
|
|
1039
1047
|
p();
|
|
1040
1048
|
return;
|
|
1041
1049
|
}
|
|
1042
|
-
const V = E.backendRoutes.find((j) => j.name ===
|
|
1050
|
+
const V = E.backendRoutes.find((j) => j.name === u.name);
|
|
1043
1051
|
if (V && !S.routePermissions.includes(V.code)) {
|
|
1044
|
-
ue("无权限访问:",
|
|
1052
|
+
ue("无权限访问:", u.path), p({ name: k, replace: !0 });
|
|
1045
1053
|
return;
|
|
1046
1054
|
}
|
|
1047
1055
|
p();
|
|
1048
1056
|
}), e.afterEach(() => ee.done()), {
|
|
1049
1057
|
resetRouterState: () => {
|
|
1050
|
-
|
|
1058
|
+
c = !1;
|
|
1051
1059
|
}
|
|
1052
1060
|
};
|
|
1053
1061
|
}
|