jgy-public-component 0.0.7 → 0.0.8
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/components/JIconRender/JIconRender.d.ts +19 -3
- package/dist/components/JIconRender/types.d.ts +1 -0
- package/dist/components/JSidebar/JSidebar.d.ts +0 -8
- package/dist/components/JSidebar/types.d.ts +0 -2
- package/dist/index.js +454 -436
- 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,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as O, openBlock as s, createElementBlock as
|
|
2
|
-
import { ElMessage as
|
|
3
|
-
import { Delete as
|
|
4
|
-
import
|
|
5
|
-
import { Icon as
|
|
6
|
-
import * as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as O, openBlock as s, createElementBlock as j, normalizeClass as H, createCommentVNode as C, renderSlot as W, ref as B, watch as ie, resolveComponent as b, createVNode as r, unref as x, withCtx as u, createElementVNode as _, withModifiers as Q, createBlock as p, Fragment as K, toDisplayString as S, mergeProps as re, computed as te, onMounted as me, onBeforeUnmount as fe, normalizeStyle as ue, createTextVNode as M, useModel as pe, renderList as G, mergeModels as ne } from "vue";
|
|
2
|
+
import { ElMessage as $ } from "element-plus";
|
|
3
|
+
import { Delete as Y, Plus as ee, Loading as se, ZoomIn as ve, Search as he, Refresh as ge, ArrowDown as ye } from "@element-plus/icons-vue";
|
|
4
|
+
import be from "vuedraggable";
|
|
5
|
+
import { Icon as _e } from "@iconify/vue";
|
|
6
|
+
import * as T from "xlsx";
|
|
7
|
+
const ke = ["disabled"], we = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "j-button__loading-icon"
|
|
10
|
-
},
|
|
10
|
+
}, xe = {
|
|
11
11
|
key: 1,
|
|
12
12
|
class: "j-button__text"
|
|
13
|
-
},
|
|
13
|
+
}, je = /* @__PURE__ */ O({
|
|
14
14
|
__name: "JButton",
|
|
15
15
|
props: {
|
|
16
16
|
type: { default: "default" },
|
|
@@ -21,13 +21,13 @@ const xe = ["disabled"], Ce = {
|
|
|
21
21
|
loading: { type: Boolean, default: !1 }
|
|
22
22
|
},
|
|
23
23
|
emits: ["click"],
|
|
24
|
-
setup(e, { emit:
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
!
|
|
24
|
+
setup(e, { emit: o }) {
|
|
25
|
+
const t = e, i = o;
|
|
26
|
+
function l(a) {
|
|
27
|
+
!t.disabled && !t.loading && i("click", a);
|
|
28
28
|
}
|
|
29
|
-
return (
|
|
30
|
-
class:
|
|
29
|
+
return (a, f) => (s(), j("button", {
|
|
30
|
+
class: H(["j-button", [
|
|
31
31
|
`j-button--${e.type}`,
|
|
32
32
|
`j-button--${e.size}`,
|
|
33
33
|
{
|
|
@@ -38,29 +38,29 @@ const xe = ["disabled"], Ce = {
|
|
|
38
38
|
}
|
|
39
39
|
]]),
|
|
40
40
|
disabled: e.disabled || e.loading,
|
|
41
|
-
onClick:
|
|
41
|
+
onClick: l
|
|
42
42
|
}, [
|
|
43
|
-
e.loading ? (s(),
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
e.loading ? (s(), j("span", we)) : C("", !0),
|
|
44
|
+
a.$slots.default ? (s(), j("span", xe, [
|
|
45
|
+
W(a.$slots, "default", {}, void 0, !0)
|
|
46
46
|
])) : C("", !0)
|
|
47
|
-
], 10,
|
|
47
|
+
], 10, ke));
|
|
48
48
|
}
|
|
49
|
-
}),
|
|
50
|
-
const
|
|
51
|
-
for (const [
|
|
52
|
-
|
|
53
|
-
return
|
|
54
|
-
},
|
|
49
|
+
}), L = (e, o) => {
|
|
50
|
+
const t = e.__vccOpts || e;
|
|
51
|
+
for (const [i, l] of o)
|
|
52
|
+
t[i] = l;
|
|
53
|
+
return t;
|
|
54
|
+
}, Ce = /* @__PURE__ */ L(je, [["__scopeId", "data-v-22864824"]]), $e = { class: "j-upload-img-container" }, Ie = {
|
|
55
55
|
key: 0,
|
|
56
56
|
class: "images-wrapper"
|
|
57
|
-
},
|
|
57
|
+
}, Be = { class: "image-item" }, Se = ["onClick"], Ve = {
|
|
58
58
|
key: 0,
|
|
59
59
|
class: "image-item single-image-item"
|
|
60
|
-
},
|
|
60
|
+
}, Ae = { class: "image-actions" }, Ee = {
|
|
61
61
|
key: 2,
|
|
62
62
|
class: "upload-tip"
|
|
63
|
-
},
|
|
63
|
+
}, Me = { key: 0 }, Je = /* @__PURE__ */ O({
|
|
64
64
|
name: "JUploadImg",
|
|
65
65
|
__name: "JUploadImg",
|
|
66
66
|
props: {
|
|
@@ -75,200 +75,203 @@ const xe = ["disabled"], Ce = {
|
|
|
75
75
|
uploadFn: { type: Function, default: void 0 }
|
|
76
76
|
},
|
|
77
77
|
emits: ["update:modelValue", "success", "error"],
|
|
78
|
-
setup(e, { emit:
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
uid: Date.now() +
|
|
86
|
-
url:
|
|
78
|
+
setup(e, { emit: o }) {
|
|
79
|
+
const t = e, i = o, l = B(""), a = B(!1), f = t.showTip, m = () => {
|
|
80
|
+
a.value = !0;
|
|
81
|
+
}, v = () => {
|
|
82
|
+
l.value = "", i("update:modelValue", ""), $.success("删除成功");
|
|
83
|
+
}, k = B([]), c = B(!1), A = (h) => {
|
|
84
|
+
k.value = h.map((d, n) => ({
|
|
85
|
+
uid: Date.now() + n,
|
|
86
|
+
url: d
|
|
87
87
|
}));
|
|
88
88
|
};
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
ie(() => t.modelValue, (h) => {
|
|
90
|
+
t.multiple ? Array.isArray(h) && h.length > 0 ? A(h) : k.value = [] : typeof h == "string" ? l.value = h : l.value = "";
|
|
91
91
|
}, { immediate: !0 });
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
}, g = async (
|
|
97
|
-
const
|
|
98
|
-
if (!
|
|
99
|
-
|
|
92
|
+
const J = () => {
|
|
93
|
+
D();
|
|
94
|
+
}, w = (h) => {
|
|
95
|
+
k.value.splice(h, 1), D(), $.success("删除成功");
|
|
96
|
+
}, g = async (h) => {
|
|
97
|
+
const d = h.raw;
|
|
98
|
+
if (!d) {
|
|
99
|
+
$.error("文件不存在,请重试");
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
102
|
+
if (d.size > t.maxSize * 1024 * 1024) {
|
|
103
|
+
$.error(`图片大小不能超过 ${t.maxSize}MB`);
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
if (!
|
|
107
|
-
|
|
106
|
+
if (!t.uploadFn) {
|
|
107
|
+
$.error("未配置上传函数 (uploadFn)");
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
try {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
} catch (
|
|
115
|
-
console.error("上传出错:",
|
|
111
|
+
c.value = !0;
|
|
112
|
+
const n = await t.uploadFn(d);
|
|
113
|
+
t.multiple ? (k.value.push({ uid: Date.now(), url: n }), D()) : (l.value = n, i("update:modelValue", n)), i("success", n), $.success("上传成功");
|
|
114
|
+
} catch (n) {
|
|
115
|
+
console.error("上传出错:", n), $.error("上传失败,请重试"), i("error", n);
|
|
116
116
|
} finally {
|
|
117
|
-
|
|
117
|
+
c.value = !1;
|
|
118
118
|
}
|
|
119
|
-
},
|
|
120
|
-
const
|
|
121
|
-
|
|
119
|
+
}, D = () => {
|
|
120
|
+
const h = k.value.map((d) => d.url);
|
|
121
|
+
i("update:modelValue", h);
|
|
122
122
|
};
|
|
123
|
-
return (
|
|
124
|
-
const
|
|
125
|
-
return s(),
|
|
126
|
-
e.multiple ? (s(),
|
|
127
|
-
|
|
128
|
-
modelValue:
|
|
129
|
-
"onUpdate:modelValue":
|
|
123
|
+
return (h, d) => {
|
|
124
|
+
const n = b("el-image"), y = b("el-icon"), I = b("el-upload"), z = b("el-image-viewer");
|
|
125
|
+
return s(), j("div", $e, [
|
|
126
|
+
e.multiple ? (s(), j("div", Ie, [
|
|
127
|
+
r(x(be), {
|
|
128
|
+
modelValue: k.value,
|
|
129
|
+
"onUpdate:modelValue": d[0] || (d[0] = (F) => k.value = F),
|
|
130
130
|
class: "images-list",
|
|
131
131
|
"item-key": "uid",
|
|
132
132
|
animation: 200,
|
|
133
133
|
disabled: e.disabled,
|
|
134
|
-
onEnd:
|
|
134
|
+
onEnd: J
|
|
135
135
|
}, {
|
|
136
|
-
item:
|
|
137
|
-
_("div",
|
|
138
|
-
|
|
136
|
+
item: u(({ element: F, index: R }) => [
|
|
137
|
+
_("div", Be, [
|
|
138
|
+
r(n, {
|
|
139
139
|
src: F.url,
|
|
140
|
-
"preview-src-list":
|
|
140
|
+
"preview-src-list": k.value.map((E) => E.url),
|
|
141
141
|
"initial-index": R,
|
|
142
142
|
fit: "cover",
|
|
143
143
|
class: "image-preview",
|
|
144
144
|
"preview-teleported": !0,
|
|
145
145
|
"hide-on-click-modal": !0
|
|
146
146
|
}, null, 8, ["src", "preview-src-list", "initial-index"]),
|
|
147
|
-
e.disabled ? C("", !0) : (s(),
|
|
147
|
+
e.disabled ? C("", !0) : (s(), j("div", {
|
|
148
148
|
key: 0,
|
|
149
149
|
class: "delete-btn",
|
|
150
|
-
onClick:
|
|
150
|
+
onClick: Q((E) => w(R), ["stop"])
|
|
151
151
|
}, [
|
|
152
|
-
|
|
153
|
-
default:
|
|
154
|
-
|
|
152
|
+
r(y, { class: "icon-delete" }, {
|
|
153
|
+
default: u(() => [
|
|
154
|
+
r(x(Y))
|
|
155
155
|
]),
|
|
156
156
|
_: 1
|
|
157
157
|
})
|
|
158
|
-
], 8,
|
|
158
|
+
], 8, Se))
|
|
159
159
|
])
|
|
160
160
|
]),
|
|
161
161
|
_: 1
|
|
162
162
|
}, 8, ["modelValue", "disabled"]),
|
|
163
|
-
!e.disabled && (!e.limit ||
|
|
163
|
+
!e.disabled && (!e.limit || k.value.length < e.limit) ? (s(), p(I, {
|
|
164
164
|
key: 0,
|
|
165
165
|
class: "image-uploader",
|
|
166
166
|
"auto-upload": !1,
|
|
167
167
|
"show-file-list": !1,
|
|
168
168
|
"on-change": g,
|
|
169
|
-
disabled:
|
|
169
|
+
disabled: c.value,
|
|
170
170
|
"list-type": "picture-card",
|
|
171
171
|
accept: e.accept
|
|
172
172
|
}, {
|
|
173
|
-
default:
|
|
174
|
-
|
|
173
|
+
default: u(() => [
|
|
174
|
+
c.value ? (s(), p(y, {
|
|
175
175
|
key: 1,
|
|
176
176
|
class: "uploader-icon is-loading"
|
|
177
177
|
}, {
|
|
178
|
-
default:
|
|
179
|
-
|
|
178
|
+
default: u(() => [
|
|
179
|
+
r(x(se))
|
|
180
180
|
]),
|
|
181
181
|
_: 1
|
|
182
|
-
})) : (s(),
|
|
182
|
+
})) : (s(), p(y, {
|
|
183
183
|
key: 0,
|
|
184
184
|
class: "uploader-icon"
|
|
185
185
|
}, {
|
|
186
|
-
default:
|
|
187
|
-
|
|
186
|
+
default: u(() => [
|
|
187
|
+
r(x(ee))
|
|
188
188
|
]),
|
|
189
189
|
_: 1
|
|
190
190
|
}))
|
|
191
191
|
]),
|
|
192
192
|
_: 1
|
|
193
193
|
}, 8, ["disabled", "accept"])) : C("", !0)
|
|
194
|
-
])) : (s(),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
src:
|
|
194
|
+
])) : (s(), j(K, { key: 1 }, [
|
|
195
|
+
l.value ? (s(), j("div", Ve, [
|
|
196
|
+
r(n, {
|
|
197
|
+
src: l.value,
|
|
198
198
|
fit: "cover",
|
|
199
199
|
class: "image-preview"
|
|
200
200
|
}, null, 8, ["src"]),
|
|
201
|
-
_("div",
|
|
202
|
-
|
|
201
|
+
_("div", Ae, [
|
|
202
|
+
r(y, {
|
|
203
203
|
class: "action-icon",
|
|
204
|
-
onClick:
|
|
204
|
+
onClick: Q(m, ["stop"])
|
|
205
205
|
}, {
|
|
206
|
-
default:
|
|
207
|
-
|
|
206
|
+
default: u(() => [
|
|
207
|
+
r(x(ve))
|
|
208
208
|
]),
|
|
209
209
|
_: 1
|
|
210
210
|
}),
|
|
211
|
-
e.disabled ? C("", !0) : (s(),
|
|
211
|
+
e.disabled ? C("", !0) : (s(), p(y, {
|
|
212
212
|
key: 0,
|
|
213
213
|
class: "action-icon",
|
|
214
|
-
onClick:
|
|
214
|
+
onClick: Q(v, ["stop"])
|
|
215
215
|
}, {
|
|
216
|
-
default:
|
|
217
|
-
|
|
216
|
+
default: u(() => [
|
|
217
|
+
r(x(Y))
|
|
218
218
|
]),
|
|
219
219
|
_: 1
|
|
220
220
|
}))
|
|
221
221
|
])
|
|
222
|
-
])) : (s(),
|
|
222
|
+
])) : (s(), p(I, {
|
|
223
223
|
key: 1,
|
|
224
224
|
class: "image-uploader",
|
|
225
225
|
"auto-upload": !1,
|
|
226
226
|
"show-file-list": !1,
|
|
227
227
|
"on-change": g,
|
|
228
|
-
disabled: e.disabled ||
|
|
228
|
+
disabled: e.disabled || c.value,
|
|
229
229
|
accept: e.accept,
|
|
230
230
|
"list-type": "picture-card"
|
|
231
231
|
}, {
|
|
232
|
-
default:
|
|
233
|
-
|
|
234
|
-
default:
|
|
235
|
-
|
|
232
|
+
default: u(() => [
|
|
233
|
+
r(y, { class: "uploader-icon" }, {
|
|
234
|
+
default: u(() => [
|
|
235
|
+
c.value ? (s(), p(x(se), {
|
|
236
236
|
key: 1,
|
|
237
237
|
class: "is-loading"
|
|
238
|
-
})) : (s(),
|
|
238
|
+
})) : (s(), p(x(ee), { key: 0 }))
|
|
239
239
|
]),
|
|
240
240
|
_: 1
|
|
241
241
|
})
|
|
242
242
|
]),
|
|
243
243
|
_: 1
|
|
244
244
|
}, 8, ["disabled", "accept"])),
|
|
245
|
-
|
|
245
|
+
a.value ? (s(), p(z, {
|
|
246
246
|
key: 2,
|
|
247
|
-
"url-list": [
|
|
247
|
+
"url-list": [l.value],
|
|
248
248
|
teleported: !0,
|
|
249
|
-
onClose:
|
|
249
|
+
onClose: d[1] || (d[1] = (F) => a.value = !1)
|
|
250
250
|
}, null, 8, ["url-list"])) : C("", !0)
|
|
251
251
|
], 64)),
|
|
252
|
-
x(
|
|
252
|
+
x(f) ? (s(), j("div", Ee, [
|
|
253
253
|
_("span", null, S(e.tip), 1),
|
|
254
|
-
e.multiple && e.limit ? (s(),
|
|
254
|
+
e.multiple && e.limit ? (s(), j("span", Me, " (最多 " + S(e.limit) + " 张)", 1)) : C("", !0)
|
|
255
255
|
])) : C("", !0)
|
|
256
256
|
]);
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
}),
|
|
259
|
+
}), De = /* @__PURE__ */ L(Je, [["__scopeId", "data-v-052bacda"]]), X = /* @__PURE__ */ O({
|
|
260
260
|
name: "JIconRender",
|
|
261
261
|
__name: "JIconRender",
|
|
262
262
|
props: {
|
|
263
|
-
icon: {}
|
|
263
|
+
icon: {},
|
|
264
|
+
size: { default: 24 }
|
|
264
265
|
},
|
|
265
266
|
setup(e) {
|
|
266
|
-
return (
|
|
267
|
+
return (o, t) => e.icon ? (s(), p(x(_e), re({
|
|
267
268
|
key: 0,
|
|
268
|
-
icon: e.icon
|
|
269
|
-
|
|
269
|
+
icon: e.icon,
|
|
270
|
+
width: e.size,
|
|
271
|
+
height: e.size
|
|
272
|
+
}, o.$attrs), null, 16, ["icon", "width", "height"])) : C("", !0);
|
|
270
273
|
}
|
|
271
|
-
}),
|
|
274
|
+
}), ze = { class: "action-left" }, Fe = /* @__PURE__ */ O({
|
|
272
275
|
name: "JSearchHeader",
|
|
273
276
|
__name: "JSearchHeader",
|
|
274
277
|
props: {
|
|
@@ -281,126 +284,126 @@ const xe = ["disabled"], Ce = {
|
|
|
281
284
|
showReset: { type: Boolean, default: !0 }
|
|
282
285
|
},
|
|
283
286
|
emits: ["search", "reset", "add", "batchDelete"],
|
|
284
|
-
setup(e, { emit:
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
const g =
|
|
290
|
-
if (g &&
|
|
291
|
-
const
|
|
292
|
-
|
|
287
|
+
setup(e, { emit: o }) {
|
|
288
|
+
const t = e, i = o, l = B(), a = B(!1), f = B(!1), m = B(0), v = B(0), k = te(() => m.value > t.defaultVisible), c = () => {
|
|
289
|
+
if (!l.value) return;
|
|
290
|
+
const w = Array.from(l.value.children);
|
|
291
|
+
m.value = w.length;
|
|
292
|
+
const g = w[t.defaultVisible - 1];
|
|
293
|
+
if (g && l.value) {
|
|
294
|
+
const D = l.value.getBoundingClientRect(), h = g.getBoundingClientRect();
|
|
295
|
+
v.value = h.bottom - D.top;
|
|
293
296
|
}
|
|
294
|
-
},
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
if (
|
|
298
|
-
|
|
297
|
+
}, A = () => {
|
|
298
|
+
const w = l.value;
|
|
299
|
+
if (w)
|
|
300
|
+
if (a.value)
|
|
301
|
+
c(), a.value = !1, w.style.maxHeight = w.scrollHeight + "px", w.offsetHeight, w.style.maxHeight = v.value + "px";
|
|
299
302
|
else {
|
|
300
|
-
|
|
303
|
+
a.value = !0, w.style.maxHeight = w.scrollHeight + "px";
|
|
301
304
|
const g = () => {
|
|
302
|
-
|
|
305
|
+
w.style.maxHeight = "none", w.removeEventListener("transitionend", g);
|
|
303
306
|
};
|
|
304
|
-
|
|
307
|
+
w.addEventListener("transitionend", g);
|
|
305
308
|
}
|
|
306
309
|
};
|
|
307
|
-
let
|
|
310
|
+
let J = null;
|
|
308
311
|
return me(() => {
|
|
309
|
-
|
|
312
|
+
c(), k.value && l.value && (l.value.style.maxHeight = v.value + "px"), requestAnimationFrame(() => {
|
|
310
313
|
requestAnimationFrame(() => {
|
|
311
|
-
|
|
314
|
+
f.value = !0;
|
|
312
315
|
});
|
|
313
|
-
}),
|
|
314
|
-
|
|
315
|
-
}),
|
|
316
|
+
}), l.value && (J = new MutationObserver(() => {
|
|
317
|
+
c(), k.value && !a.value && l.value && (l.value.style.maxHeight = v.value + "px");
|
|
318
|
+
}), J.observe(l.value, { childList: !0 }));
|
|
316
319
|
}), fe(() => {
|
|
317
|
-
|
|
318
|
-
}), (
|
|
319
|
-
const
|
|
320
|
-
return s(),
|
|
320
|
+
J == null || J.disconnect();
|
|
321
|
+
}), (w, g) => {
|
|
322
|
+
const D = b("el-form"), h = b("el-button"), d = b("el-icon"), n = b("el-card");
|
|
323
|
+
return s(), p(n, {
|
|
321
324
|
shadow: "never",
|
|
322
325
|
class: "j-search-header-card"
|
|
323
326
|
}, {
|
|
324
|
-
default:
|
|
325
|
-
|
|
327
|
+
default: u(() => [
|
|
328
|
+
r(D, {
|
|
326
329
|
inline: "",
|
|
327
330
|
class: "search-form"
|
|
328
331
|
}, {
|
|
329
|
-
default:
|
|
332
|
+
default: u(() => [
|
|
330
333
|
_("div", {
|
|
331
334
|
ref_key: "formItemsRef",
|
|
332
|
-
ref:
|
|
333
|
-
class:
|
|
335
|
+
ref: l,
|
|
336
|
+
class: H(["form-items-wrapper", { "is-animated": f.value }])
|
|
334
337
|
}, [
|
|
335
|
-
|
|
338
|
+
W(w.$slots, "default", {}, void 0, !0)
|
|
336
339
|
], 2)
|
|
337
340
|
]),
|
|
338
341
|
_: 3
|
|
339
342
|
}),
|
|
340
343
|
_("div", {
|
|
341
344
|
class: "action-bar",
|
|
342
|
-
style: ue({ marginTop:
|
|
345
|
+
style: ue({ marginTop: a.value ? "0px" : "10px" })
|
|
343
346
|
}, [
|
|
344
|
-
_("div",
|
|
345
|
-
e.showAdd ? (s(),
|
|
347
|
+
_("div", ze, [
|
|
348
|
+
e.showAdd ? (s(), p(h, {
|
|
346
349
|
key: 0,
|
|
347
350
|
type: "primary",
|
|
348
|
-
icon: x(
|
|
349
|
-
onClick: g[0] || (g[0] = (
|
|
351
|
+
icon: x(ee),
|
|
352
|
+
onClick: g[0] || (g[0] = (y) => i("add"))
|
|
350
353
|
}, {
|
|
351
|
-
default:
|
|
352
|
-
|
|
354
|
+
default: u(() => [
|
|
355
|
+
M(S(e.addText), 1)
|
|
353
356
|
]),
|
|
354
357
|
_: 1
|
|
355
358
|
}, 8, ["icon"])) : C("", !0),
|
|
356
|
-
e.showBatchDelete ? (s(),
|
|
359
|
+
e.showBatchDelete ? (s(), p(h, {
|
|
357
360
|
key: 1,
|
|
358
361
|
type: "danger",
|
|
359
|
-
icon: x(
|
|
362
|
+
icon: x(Y),
|
|
360
363
|
disabled: e.selectedCount === 0,
|
|
361
|
-
onClick: g[1] || (g[1] = (
|
|
364
|
+
onClick: g[1] || (g[1] = (y) => i("batchDelete"))
|
|
362
365
|
}, {
|
|
363
|
-
default:
|
|
364
|
-
|
|
366
|
+
default: u(() => [
|
|
367
|
+
M(" 批量删除" + S(e.selectedCount ? `(${e.selectedCount})` : ""), 1)
|
|
365
368
|
]),
|
|
366
369
|
_: 1
|
|
367
370
|
}, 8, ["icon", "disabled"])) : C("", !0),
|
|
368
|
-
e.showSearch ? (s(),
|
|
371
|
+
e.showSearch ? (s(), p(h, {
|
|
369
372
|
key: 2,
|
|
370
373
|
type: "primary",
|
|
371
|
-
icon: x(
|
|
372
|
-
onClick: g[2] || (g[2] = (
|
|
374
|
+
icon: x(he),
|
|
375
|
+
onClick: g[2] || (g[2] = (y) => i("search"))
|
|
373
376
|
}, {
|
|
374
|
-
default:
|
|
375
|
-
|
|
377
|
+
default: u(() => [...g[4] || (g[4] = [
|
|
378
|
+
M("搜索", -1)
|
|
376
379
|
])]),
|
|
377
380
|
_: 1
|
|
378
381
|
}, 8, ["icon"])) : C("", !0),
|
|
379
|
-
e.showReset ? (s(),
|
|
382
|
+
e.showReset ? (s(), p(h, {
|
|
380
383
|
key: 3,
|
|
381
|
-
icon: x(
|
|
382
|
-
onClick: g[3] || (g[3] = (
|
|
384
|
+
icon: x(ge),
|
|
385
|
+
onClick: g[3] || (g[3] = (y) => i("reset"))
|
|
383
386
|
}, {
|
|
384
|
-
default:
|
|
385
|
-
|
|
387
|
+
default: u(() => [...g[5] || (g[5] = [
|
|
388
|
+
M("重置", -1)
|
|
386
389
|
])]),
|
|
387
390
|
_: 1
|
|
388
391
|
}, 8, ["icon"])) : C("", !0),
|
|
389
|
-
|
|
392
|
+
W(w.$slots, "actions", {}, void 0, !0)
|
|
390
393
|
]),
|
|
391
|
-
|
|
394
|
+
k.value ? (s(), p(h, {
|
|
392
395
|
key: 0,
|
|
393
396
|
link: "",
|
|
394
397
|
type: "primary",
|
|
395
|
-
onClick:
|
|
398
|
+
onClick: A
|
|
396
399
|
}, {
|
|
397
|
-
default:
|
|
398
|
-
|
|
399
|
-
d
|
|
400
|
-
class:
|
|
400
|
+
default: u(() => [
|
|
401
|
+
M(S(a.value ? "收起" : "展开") + " ", 1),
|
|
402
|
+
r(d, {
|
|
403
|
+
class: H(["toggle-icon", { "is-expanded": a.value }])
|
|
401
404
|
}, {
|
|
402
|
-
default:
|
|
403
|
-
|
|
405
|
+
default: u(() => [
|
|
406
|
+
r(x(ye))
|
|
404
407
|
]),
|
|
405
408
|
_: 1
|
|
406
409
|
}, 8, ["class"])
|
|
@@ -413,13 +416,13 @@ const xe = ["disabled"], Ce = {
|
|
|
413
416
|
});
|
|
414
417
|
};
|
|
415
418
|
}
|
|
416
|
-
}),
|
|
419
|
+
}), Oe = /* @__PURE__ */ L(Fe, [["__scopeId", "data-v-4488c604"]]), Re = { class: "j-import-upload-row" }, Te = { class: "j-import-stat-num" }, He = { class: "j-import-stat-num" }, Le = { class: "j-import-stat-num" }, Ue = {
|
|
417
420
|
key: 0,
|
|
418
421
|
class: "j-import-status-fail"
|
|
419
|
-
},
|
|
422
|
+
}, Ne = { key: 1 }, Pe = /* @__PURE__ */ O({
|
|
420
423
|
name: "JImportExcel",
|
|
421
424
|
__name: "JImportExcel",
|
|
422
|
-
props: /* @__PURE__ */
|
|
425
|
+
props: /* @__PURE__ */ ne({
|
|
423
426
|
getFieldListApi: {},
|
|
424
427
|
importApi: {},
|
|
425
428
|
excludeFields: { default: () => ["id", "ctime", "mtime"] },
|
|
@@ -428,132 +431,132 @@ const xe = ["disabled"], Ce = {
|
|
|
428
431
|
modelValue: { type: Boolean, default: !1 },
|
|
429
432
|
modelModifiers: {}
|
|
430
433
|
}),
|
|
431
|
-
emits: /* @__PURE__ */
|
|
432
|
-
setup(e, { emit:
|
|
433
|
-
const
|
|
434
|
+
emits: /* @__PURE__ */ ne(["success"], ["update:modelValue"]),
|
|
435
|
+
setup(e, { emit: o }) {
|
|
436
|
+
const t = e, i = o, l = pe(e, "modelValue"), a = B(!1), f = B({}), m = B([]), v = B({ total: 0, success: 0, fail: 0 }), k = {
|
|
434
437
|
0: "待创建",
|
|
435
438
|
1: "创建成功",
|
|
436
439
|
2: "创建中",
|
|
437
440
|
[-1]: "创建失败"
|
|
438
|
-
},
|
|
441
|
+
}, c = te(() => Object.entries(f.value).filter(([d]) => !t.excludeFields.includes(d)).map(([d, n]) => ({ id: d, label: n, prop: d }))), A = async () => {
|
|
439
442
|
try {
|
|
440
|
-
const
|
|
441
|
-
|
|
443
|
+
const d = await t.getFieldListApi();
|
|
444
|
+
f.value = d.data.tableFieldsInfo ?? {};
|
|
442
445
|
} catch {
|
|
443
|
-
|
|
446
|
+
$.error("获取字段列表失败");
|
|
444
447
|
}
|
|
445
|
-
},
|
|
446
|
-
const
|
|
447
|
-
if (!
|
|
448
|
+
}, J = (d) => {
|
|
449
|
+
const n = d.raw;
|
|
450
|
+
if (!n) return;
|
|
448
451
|
if (![
|
|
449
452
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
450
453
|
"application/vnd.ms-excel"
|
|
451
|
-
].includes(
|
|
452
|
-
|
|
454
|
+
].includes(n.type) && !n.name.match(/\.xlsx?$/i)) {
|
|
455
|
+
$.warning("请上传 .xlsx 或 .xls 格式文件");
|
|
453
456
|
return;
|
|
454
457
|
}
|
|
455
458
|
const I = new FileReader();
|
|
456
|
-
I.onload = (
|
|
459
|
+
I.onload = (z) => {
|
|
457
460
|
try {
|
|
458
|
-
const F =
|
|
459
|
-
if (!
|
|
460
|
-
|
|
461
|
+
const F = T.read(z.target.result, { type: "binary" }), R = F.SheetNames[0], E = F.Sheets[R], U = T.utils.sheet_to_json(E);
|
|
462
|
+
if (!U.length) {
|
|
463
|
+
$.warning("文件内容为空");
|
|
461
464
|
return;
|
|
462
465
|
}
|
|
463
|
-
const
|
|
464
|
-
const V = Object.values(
|
|
465
|
-
return
|
|
466
|
-
|
|
467
|
-
}),
|
|
466
|
+
const N = c.value.map((P) => P.prop), q = U.map((P) => {
|
|
467
|
+
const V = Object.values(P), Z = { _status: 0, _error: "" };
|
|
468
|
+
return N.forEach((ae, de) => {
|
|
469
|
+
Z[ae] = V[de];
|
|
470
|
+
}), Z;
|
|
468
471
|
});
|
|
469
|
-
|
|
472
|
+
m.value = q, v.value = { total: q.length, success: 0, fail: 0 };
|
|
470
473
|
} catch {
|
|
471
|
-
|
|
474
|
+
$.error("解析文件失败,请检查文件格式");
|
|
472
475
|
}
|
|
473
|
-
}, I.readAsBinaryString(
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
+
}, I.readAsBinaryString(n);
|
|
477
|
+
}, w = (d) => {
|
|
478
|
+
m.value.splice(d, 1), v.value.total = m.value.length;
|
|
476
479
|
}, g = async () => {
|
|
477
|
-
const
|
|
478
|
-
if (!
|
|
479
|
-
|
|
480
|
+
const d = m.value.filter((n) => n._status === 0).map(({ _status: n, _error: y, ...I }) => I);
|
|
481
|
+
if (!d.length) {
|
|
482
|
+
$.warning("没有可导入的数据");
|
|
480
483
|
return;
|
|
481
484
|
}
|
|
482
|
-
|
|
485
|
+
a.value = !0;
|
|
483
486
|
try {
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}),
|
|
487
|
+
const n = await t.importApi(d);
|
|
488
|
+
n.code === 1 ? (m.value.forEach((y) => {
|
|
489
|
+
y._status === 0 && (y._status = 1);
|
|
490
|
+
}), v.value.success = m.value.filter((y) => y._status === 1).length, $.success("导入成功"), i("success")) : $.error(n.msg || "导入失败");
|
|
488
491
|
} catch {
|
|
489
|
-
|
|
492
|
+
$.error("导入失败,请重试");
|
|
490
493
|
} finally {
|
|
491
|
-
|
|
494
|
+
a.value = !1;
|
|
492
495
|
}
|
|
493
|
-
},
|
|
496
|
+
}, D = () => {
|
|
494
497
|
try {
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
const I =
|
|
498
|
-
|
|
498
|
+
const d = T.utils.book_new(), n = c.value.map((z) => z.label), y = {};
|
|
499
|
+
n.forEach((z) => y[z] = "");
|
|
500
|
+
const I = T.utils.json_to_sheet([y]);
|
|
501
|
+
T.utils.book_append_sheet(d, I, "模板"), T.writeFile(d, "导入模板.xlsx");
|
|
499
502
|
} catch {
|
|
500
|
-
|
|
503
|
+
$.error("模板下载失败");
|
|
501
504
|
}
|
|
502
|
-
},
|
|
503
|
-
|
|
505
|
+
}, h = () => {
|
|
506
|
+
a.value || (l.value = !1, m.value = [], v.value = { total: 0, success: 0, fail: 0 });
|
|
504
507
|
};
|
|
505
|
-
return (
|
|
506
|
-
const
|
|
507
|
-
return s(),
|
|
508
|
-
modelValue:
|
|
509
|
-
"onUpdate:modelValue":
|
|
510
|
-
title:
|
|
508
|
+
return (d, n) => {
|
|
509
|
+
const y = b("el-divider"), I = b("el-button"), z = b("el-upload"), F = b("el-link"), R = b("el-card"), E = b("el-col"), U = b("el-row"), N = b("el-table-column"), q = b("el-table"), P = b("el-dialog");
|
|
510
|
+
return s(), p(P, {
|
|
511
|
+
modelValue: l.value,
|
|
512
|
+
"onUpdate:modelValue": n[0] || (n[0] = (V) => l.value = V),
|
|
513
|
+
title: t.title,
|
|
511
514
|
width: "900px",
|
|
512
515
|
"close-on-click-modal": !1,
|
|
513
|
-
onOpen:
|
|
514
|
-
onClose:
|
|
516
|
+
onOpen: A,
|
|
517
|
+
onClose: h
|
|
515
518
|
}, {
|
|
516
|
-
footer:
|
|
517
|
-
|
|
518
|
-
default:
|
|
519
|
-
|
|
519
|
+
footer: u(() => [
|
|
520
|
+
r(I, { onClick: h }, {
|
|
521
|
+
default: u(() => [...n[9] || (n[9] = [
|
|
522
|
+
M("关闭", -1)
|
|
520
523
|
])]),
|
|
521
524
|
_: 1
|
|
522
525
|
})
|
|
523
526
|
]),
|
|
524
|
-
default:
|
|
525
|
-
|
|
527
|
+
default: u(() => [
|
|
528
|
+
r(R, {
|
|
526
529
|
shadow: "never",
|
|
527
530
|
class: "j-import-upload-card"
|
|
528
531
|
}, {
|
|
529
|
-
default:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
_("div",
|
|
533
|
-
|
|
532
|
+
default: u(() => [
|
|
533
|
+
n[3] || (n[3] = _("div", { class: "j-import-upload-card-title" }, "导入 EXCEL", -1)),
|
|
534
|
+
r(y, { style: { margin: "10px 0" } }),
|
|
535
|
+
_("div", Re, [
|
|
536
|
+
r(z, {
|
|
534
537
|
accept: ".xlsx,.xls",
|
|
535
538
|
"auto-upload": !1,
|
|
536
539
|
"show-file-list": !1,
|
|
537
|
-
"on-change":
|
|
540
|
+
"on-change": J
|
|
538
541
|
}, {
|
|
539
|
-
default:
|
|
540
|
-
|
|
541
|
-
default:
|
|
542
|
-
|
|
542
|
+
default: u(() => [
|
|
543
|
+
r(I, { size: "small" }, {
|
|
544
|
+
default: u(() => [...n[1] || (n[1] = [
|
|
545
|
+
M("点击上传", -1)
|
|
543
546
|
])]),
|
|
544
547
|
_: 1
|
|
545
548
|
})
|
|
546
549
|
]),
|
|
547
550
|
_: 1
|
|
548
551
|
}),
|
|
549
|
-
|
|
552
|
+
c.value.length ? (s(), p(F, {
|
|
550
553
|
key: 0,
|
|
551
554
|
type: "primary",
|
|
552
555
|
class: "j-import-no-wrap",
|
|
553
|
-
onClick:
|
|
556
|
+
onClick: D
|
|
554
557
|
}, {
|
|
555
|
-
default:
|
|
556
|
-
|
|
558
|
+
default: u(() => [...n[2] || (n[2] = [
|
|
559
|
+
M(" 下载导入模板.xlsx ", -1)
|
|
557
560
|
])]),
|
|
558
561
|
_: 1
|
|
559
562
|
})) : C("", !0)
|
|
@@ -561,43 +564,43 @@ const xe = ["disabled"], Ce = {
|
|
|
561
564
|
]),
|
|
562
565
|
_: 1
|
|
563
566
|
}),
|
|
564
|
-
|
|
567
|
+
r(U, {
|
|
565
568
|
class: "j-import-stats-row",
|
|
566
569
|
gutter: 20,
|
|
567
570
|
align: "middle"
|
|
568
571
|
}, {
|
|
569
|
-
default:
|
|
570
|
-
|
|
571
|
-
default:
|
|
572
|
-
|
|
573
|
-
default:
|
|
574
|
-
|
|
572
|
+
default: u(() => [
|
|
573
|
+
r(E, { span: 18 }, {
|
|
574
|
+
default: u(() => [
|
|
575
|
+
r(U, { class: "j-import-stats-cols" }, {
|
|
576
|
+
default: u(() => [
|
|
577
|
+
r(E, {
|
|
575
578
|
span: 4,
|
|
576
579
|
class: "j-import-stat-item"
|
|
577
580
|
}, {
|
|
578
|
-
default:
|
|
579
|
-
_("div",
|
|
580
|
-
|
|
581
|
+
default: u(() => [
|
|
582
|
+
_("div", Te, S(v.value.total), 1),
|
|
583
|
+
n[4] || (n[4] = _("div", { class: "j-import-stat-label" }, "导入数量", -1))
|
|
581
584
|
]),
|
|
582
585
|
_: 1
|
|
583
586
|
}),
|
|
584
|
-
|
|
587
|
+
r(E, {
|
|
585
588
|
span: 4,
|
|
586
589
|
class: "j-import-stat-item"
|
|
587
590
|
}, {
|
|
588
|
-
default:
|
|
589
|
-
_("div",
|
|
590
|
-
|
|
591
|
+
default: u(() => [
|
|
592
|
+
_("div", He, S(v.value.fail), 1),
|
|
593
|
+
n[5] || (n[5] = _("div", { class: "j-import-stat-label" }, "失败数量", -1))
|
|
591
594
|
]),
|
|
592
595
|
_: 1
|
|
593
596
|
}),
|
|
594
|
-
|
|
597
|
+
r(E, {
|
|
595
598
|
span: 4,
|
|
596
599
|
class: "j-import-stat-item"
|
|
597
600
|
}, {
|
|
598
|
-
default:
|
|
599
|
-
_("div",
|
|
600
|
-
|
|
601
|
+
default: u(() => [
|
|
602
|
+
_("div", Le, S(v.value.success), 1),
|
|
603
|
+
n[6] || (n[6] = _("div", { class: "j-import-stat-label" }, "成功数量", -1))
|
|
601
604
|
]),
|
|
602
605
|
_: 1
|
|
603
606
|
})
|
|
@@ -607,20 +610,20 @@ const xe = ["disabled"], Ce = {
|
|
|
607
610
|
]),
|
|
608
611
|
_: 1
|
|
609
612
|
}),
|
|
610
|
-
|
|
613
|
+
r(E, {
|
|
611
614
|
span: 6,
|
|
612
615
|
class: "j-import-confirm-col"
|
|
613
616
|
}, {
|
|
614
|
-
default:
|
|
615
|
-
|
|
617
|
+
default: u(() => [
|
|
618
|
+
r(I, {
|
|
616
619
|
type: "primary",
|
|
617
620
|
size: "small",
|
|
618
|
-
loading:
|
|
619
|
-
disabled: !
|
|
621
|
+
loading: a.value,
|
|
622
|
+
disabled: !m.value.length,
|
|
620
623
|
onClick: g
|
|
621
624
|
}, {
|
|
622
|
-
default:
|
|
623
|
-
|
|
625
|
+
default: u(() => [...n[7] || (n[7] = [
|
|
626
|
+
M(" 确认导入 ", -1)
|
|
624
627
|
])]),
|
|
625
628
|
_: 1
|
|
626
629
|
}, 8, ["loading", "disabled"])
|
|
@@ -630,46 +633,46 @@ const xe = ["disabled"], Ce = {
|
|
|
630
633
|
]),
|
|
631
634
|
_: 1
|
|
632
635
|
}),
|
|
633
|
-
|
|
634
|
-
data:
|
|
636
|
+
r(q, {
|
|
637
|
+
data: m.value,
|
|
635
638
|
border: "",
|
|
636
639
|
size: "small",
|
|
637
640
|
"max-height": "360",
|
|
638
641
|
class: "j-import-data-table"
|
|
639
642
|
}, {
|
|
640
|
-
default:
|
|
641
|
-
(s(!0),
|
|
643
|
+
default: u(() => [
|
|
644
|
+
(s(!0), j(K, null, G(c.value, (V) => (s(), p(N, {
|
|
642
645
|
key: V.prop,
|
|
643
646
|
prop: V.prop,
|
|
644
647
|
label: V.label,
|
|
645
648
|
"min-width": 120,
|
|
646
649
|
"show-overflow-tooltip": ""
|
|
647
650
|
}, null, 8, ["prop", "label"]))), 128)),
|
|
648
|
-
|
|
651
|
+
r(N, {
|
|
649
652
|
label: "状态",
|
|
650
653
|
width: "110",
|
|
651
654
|
align: "center",
|
|
652
655
|
fixed: "right"
|
|
653
656
|
}, {
|
|
654
|
-
default:
|
|
655
|
-
V._status === -1 ? (s(),
|
|
657
|
+
default: u(({ row: V }) => [
|
|
658
|
+
V._status === -1 ? (s(), j("span", Ue, S(V._error || "创建失败"), 1)) : (s(), j("span", Ne, S(k[V._status]), 1))
|
|
656
659
|
]),
|
|
657
660
|
_: 1
|
|
658
661
|
}),
|
|
659
|
-
|
|
662
|
+
r(N, {
|
|
660
663
|
label: "操作",
|
|
661
664
|
width: "80",
|
|
662
665
|
align: "center",
|
|
663
666
|
fixed: "right"
|
|
664
667
|
}, {
|
|
665
|
-
default:
|
|
666
|
-
|
|
668
|
+
default: u(({ $index: V, row: Z }) => [
|
|
669
|
+
Z._status === 0 ? (s(), p(I, {
|
|
667
670
|
key: 0,
|
|
668
671
|
size: "small",
|
|
669
|
-
onClick: (
|
|
672
|
+
onClick: (ae) => w(V)
|
|
670
673
|
}, {
|
|
671
|
-
default:
|
|
672
|
-
|
|
674
|
+
default: u(() => [...n[8] || (n[8] = [
|
|
675
|
+
M(" 删除 ", -1)
|
|
673
676
|
])]),
|
|
674
677
|
_: 1
|
|
675
678
|
}, 8, ["onClick"])) : C("", !0)
|
|
@@ -684,7 +687,7 @@ const xe = ["disabled"], Ce = {
|
|
|
684
687
|
}, 8, ["modelValue", "title"]);
|
|
685
688
|
};
|
|
686
689
|
}
|
|
687
|
-
}),
|
|
690
|
+
}), We = /* @__PURE__ */ L(Pe, [["__scopeId", "data-v-2ece86f5"]]), Ke = { class: "j-sidebar__menu-item-title" }, Xe = /* @__PURE__ */ O({
|
|
688
691
|
name: "JSideMenuItem",
|
|
689
692
|
__name: "JSideMenuItem",
|
|
690
693
|
props: {
|
|
@@ -693,43 +696,43 @@ const xe = ["disabled"], Ce = {
|
|
|
693
696
|
depth: { default: 0 }
|
|
694
697
|
},
|
|
695
698
|
emits: ["menu-click"],
|
|
696
|
-
setup(e, { emit:
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
+
setup(e, { emit: o }) {
|
|
700
|
+
const t = e, i = o, l = () => {
|
|
701
|
+
i("menu-click", t.menuItem);
|
|
699
702
|
};
|
|
700
|
-
return (
|
|
701
|
-
const
|
|
702
|
-
return e.menuItem.children && e.menuItem.children.length > 0 ? (s(),
|
|
703
|
+
return (a, f) => {
|
|
704
|
+
const m = b("JSideMenuItem", !0), v = b("el-sub-menu"), k = b("el-menu-item");
|
|
705
|
+
return e.menuItem.children && e.menuItem.children.length > 0 ? (s(), p(v, {
|
|
703
706
|
key: 0,
|
|
704
707
|
index: e.menuItem.path
|
|
705
708
|
}, {
|
|
706
|
-
title:
|
|
707
|
-
e.menuItem.icon && e.depth === 0 ? (s(),
|
|
709
|
+
title: u(() => [
|
|
710
|
+
e.menuItem.icon && e.depth === 0 ? (s(), p(x(X), {
|
|
708
711
|
key: 0,
|
|
709
712
|
icon: e.menuItem.icon
|
|
710
713
|
}, null, 8, ["icon"])) : C("", !0),
|
|
711
|
-
_("span",
|
|
714
|
+
_("span", Ke, S(e.menuItem.title || e.menuItem.name), 1)
|
|
712
715
|
]),
|
|
713
|
-
default:
|
|
714
|
-
(s(!0),
|
|
715
|
-
key:
|
|
716
|
-
"menu-item":
|
|
716
|
+
default: u(() => [
|
|
717
|
+
(s(!0), j(K, null, G(e.menuItem.children, (c) => (s(), p(m, {
|
|
718
|
+
key: c.path,
|
|
719
|
+
"menu-item": c,
|
|
717
720
|
"is-collapse": e.isCollapse,
|
|
718
721
|
depth: e.depth + 1,
|
|
719
|
-
onMenuClick:
|
|
722
|
+
onMenuClick: f[0] || (f[0] = (A) => i("menu-click", A))
|
|
720
723
|
}, null, 8, ["menu-item", "is-collapse", "depth"]))), 128))
|
|
721
724
|
]),
|
|
722
725
|
_: 1
|
|
723
|
-
}, 8, ["index"])) : (s(),
|
|
726
|
+
}, 8, ["index"])) : (s(), p(k, {
|
|
724
727
|
key: 1,
|
|
725
728
|
index: e.menuItem.path,
|
|
726
|
-
onClick:
|
|
729
|
+
onClick: l
|
|
727
730
|
}, {
|
|
728
|
-
title:
|
|
731
|
+
title: u(() => [
|
|
729
732
|
_("span", null, S(e.menuItem.title || e.menuItem.name), 1)
|
|
730
733
|
]),
|
|
731
|
-
default:
|
|
732
|
-
e.menuItem.icon && e.depth === 0 ? (s(),
|
|
734
|
+
default: u(() => [
|
|
735
|
+
e.menuItem.icon && e.depth === 0 ? (s(), p(x(X), {
|
|
733
736
|
key: 0,
|
|
734
737
|
icon: e.menuItem.icon
|
|
735
738
|
}, null, 8, ["icon"])) : C("", !0)
|
|
@@ -738,7 +741,10 @@ const xe = ["disabled"], Ce = {
|
|
|
738
741
|
}, 8, ["index"]));
|
|
739
742
|
};
|
|
740
743
|
}
|
|
741
|
-
}),
|
|
744
|
+
}), ce = /* @__PURE__ */ L(Xe, [["__scopeId", "data-v-c83c4ba1"]]), qe = { class: "j-sidebar__logo" }, Ze = { class: "j-sidebar__title" }, Ge = { class: "j-sidebar__menu-wrapper" }, Qe = {
|
|
745
|
+
key: 1,
|
|
746
|
+
class: "j-sidebar__collapsed-menu"
|
|
747
|
+
}, Ye = ["onClick"], et = { class: "j-sidebar__collapsed-item-text" }, tt = { class: "j-sidebar__footer" }, lt = /* @__PURE__ */ O({
|
|
742
748
|
name: "JSidebar",
|
|
743
749
|
__name: "JSidebar",
|
|
744
750
|
props: {
|
|
@@ -749,177 +755,189 @@ const xe = ["disabled"], Ce = {
|
|
|
749
755
|
collapsed: { type: Boolean, default: !1 },
|
|
750
756
|
collapsedWidth: { default: 64 },
|
|
751
757
|
expandedWidth: { default: 200 },
|
|
752
|
-
expandText: { default: "展开" },
|
|
753
|
-
collapseText: { default: "折叠" },
|
|
754
758
|
router: { type: Boolean, default: !0 }
|
|
755
759
|
},
|
|
756
760
|
emits: ["update:collapsed", "menu-click"],
|
|
757
|
-
setup(e, { emit:
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
+
setup(e, { emit: o }) {
|
|
762
|
+
const t = e, i = o, l = te(() => {
|
|
763
|
+
const m = [], v = (k) => {
|
|
764
|
+
for (const c of k)
|
|
765
|
+
c.children && c.children.length > 0 ? v(c.children) : m.push(c);
|
|
766
|
+
};
|
|
767
|
+
return v(t.menus), m;
|
|
768
|
+
}), a = B(t.collapsed);
|
|
769
|
+
ie(() => t.collapsed, (m) => {
|
|
770
|
+
a.value = m;
|
|
761
771
|
});
|
|
762
|
-
const
|
|
763
|
-
|
|
772
|
+
const f = () => {
|
|
773
|
+
a.value = !a.value, i("update:collapsed", a.value);
|
|
764
774
|
};
|
|
765
|
-
return (
|
|
766
|
-
const
|
|
767
|
-
return s(),
|
|
768
|
-
class:
|
|
769
|
-
style: ue({ width:
|
|
775
|
+
return (m, v) => {
|
|
776
|
+
const k = b("el-menu");
|
|
777
|
+
return s(), j("div", {
|
|
778
|
+
class: H(["j-sidebar", a.value ? "j-sidebar--collapsed" : "j-sidebar--expanded"]),
|
|
779
|
+
style: ue({ width: a.value ? `${e.collapsedWidth}px` : `${e.expandedWidth}px` })
|
|
770
780
|
}, [
|
|
771
781
|
_("div", qe, [
|
|
772
|
-
|
|
773
|
-
var
|
|
782
|
+
W(m.$slots, "logo", { collapsed: a.value }, () => {
|
|
783
|
+
var c;
|
|
774
784
|
return [
|
|
775
|
-
_("h2", Ze, S(
|
|
785
|
+
_("h2", Ze, S(a.value ? e.collapsedTitle || ((c = e.title) == null ? void 0 : c.charAt(0)) || "" : e.title), 1)
|
|
776
786
|
];
|
|
777
787
|
}, !0)
|
|
778
788
|
]),
|
|
779
789
|
_("div", Ge, [
|
|
780
|
-
|
|
790
|
+
a.value ? (s(), j("div", Qe, [
|
|
791
|
+
(s(!0), j(K, null, G(l.value, (c) => (s(), j("div", {
|
|
792
|
+
key: c.path,
|
|
793
|
+
class: H(["j-sidebar__collapsed-item", { "is-active": e.activeMenu === c.path }]),
|
|
794
|
+
onClick: (A) => i("menu-click", c)
|
|
795
|
+
}, [
|
|
796
|
+
c.icon ? (s(), p(x(X), {
|
|
797
|
+
key: 0,
|
|
798
|
+
icon: c.icon,
|
|
799
|
+
size: 20
|
|
800
|
+
}, null, 8, ["icon"])) : C("", !0),
|
|
801
|
+
_("span", et, S(c.title || c.name), 1)
|
|
802
|
+
], 10, Ye))), 128))
|
|
803
|
+
])) : (s(), p(k, {
|
|
804
|
+
key: 0,
|
|
781
805
|
"default-active": e.activeMenu,
|
|
782
806
|
class: "j-sidebar__menu",
|
|
783
|
-
router: e.router
|
|
784
|
-
collapse: t.value,
|
|
785
|
-
"collapse-transition": !1
|
|
807
|
+
router: e.router
|
|
786
808
|
}, {
|
|
787
|
-
default:
|
|
788
|
-
(s(!0),
|
|
789
|
-
key:
|
|
790
|
-
"menu-item":
|
|
791
|
-
"is-collapse":
|
|
792
|
-
onMenuClick:
|
|
793
|
-
}, null, 8, ["menu-item"
|
|
809
|
+
default: u(() => [
|
|
810
|
+
(s(!0), j(K, null, G(e.menus, (c) => (s(), p(ce, {
|
|
811
|
+
key: c.path,
|
|
812
|
+
"menu-item": c,
|
|
813
|
+
"is-collapse": !1,
|
|
814
|
+
onMenuClick: v[0] || (v[0] = (A) => i("menu-click", A))
|
|
815
|
+
}, null, 8, ["menu-item"]))), 128))
|
|
794
816
|
]),
|
|
795
817
|
_: 1
|
|
796
|
-
}, 8, ["default-active", "router"
|
|
818
|
+
}, 8, ["default-active", "router"]))
|
|
797
819
|
]),
|
|
798
|
-
_("div",
|
|
799
|
-
|
|
800
|
-
collapsed:
|
|
801
|
-
toggle:
|
|
820
|
+
_("div", tt, [
|
|
821
|
+
W(m.$slots, "footer", {
|
|
822
|
+
collapsed: a.value,
|
|
823
|
+
toggle: f
|
|
802
824
|
}, () => [
|
|
803
825
|
_("button", {
|
|
804
|
-
class: "j-sidebar__collapse-btn",
|
|
805
|
-
onClick:
|
|
826
|
+
class: H(["j-sidebar__collapse-btn", a.value ? "j-sidebar__collapse-btn--center" : "j-sidebar__collapse-btn--right"]),
|
|
827
|
+
onClick: f
|
|
806
828
|
}, [
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
_: 1
|
|
812
|
-
}),
|
|
813
|
-
_("span", Ye, S(t.value ? e.expandText : e.collapseText), 1)
|
|
814
|
-
])
|
|
829
|
+
r(x(X), {
|
|
830
|
+
icon: a.value ? "mdi:chevron-right" : "mdi:chevron-left"
|
|
831
|
+
}, null, 8, ["icon"])
|
|
832
|
+
], 2)
|
|
815
833
|
], !0)
|
|
816
834
|
])
|
|
817
835
|
], 6);
|
|
818
836
|
};
|
|
819
837
|
}
|
|
820
|
-
}),
|
|
821
|
-
function
|
|
822
|
-
return Array.isArray(e) ? e.map((
|
|
838
|
+
}), at = /* @__PURE__ */ L(lt, [["__scopeId", "data-v-57993957"]]);
|
|
839
|
+
function le(e, o) {
|
|
840
|
+
return Array.isArray(e) ? e.map((t) => le(t, o)) : e !== null && typeof e == "object" && !(e instanceof Date) ? o(e) : e;
|
|
823
841
|
}
|
|
824
|
-
function
|
|
842
|
+
function nt(e, o = []) {
|
|
825
843
|
return Object.fromEntries(
|
|
826
|
-
Object.entries(e).map(([
|
|
827
|
-
const
|
|
828
|
-
return
|
|
844
|
+
Object.entries(e).map(([t, i]) => {
|
|
845
|
+
const l = le(i, (f) => nt(f, o));
|
|
846
|
+
return o.includes(t) ? [t, l] : [t.replace(/([A-Z])/g, "_$1").toLowerCase(), l];
|
|
829
847
|
})
|
|
830
848
|
);
|
|
831
849
|
}
|
|
832
|
-
function
|
|
850
|
+
function st(e, o = []) {
|
|
833
851
|
return Object.fromEntries(
|
|
834
|
-
Object.entries(e).map(([
|
|
835
|
-
const
|
|
836
|
-
return
|
|
852
|
+
Object.entries(e).map(([t, i]) => {
|
|
853
|
+
const l = le(i, (f) => st(f, o));
|
|
854
|
+
return o.includes(t) ? [t, l] : [t.replace(/_([a-z])/g, (f, m) => m.toUpperCase()), l];
|
|
837
855
|
})
|
|
838
856
|
);
|
|
839
857
|
}
|
|
840
|
-
function
|
|
841
|
-
const
|
|
842
|
-
for (const
|
|
843
|
-
|
|
844
|
-
return
|
|
858
|
+
function vt(e, o) {
|
|
859
|
+
const t = {};
|
|
860
|
+
for (const i of o)
|
|
861
|
+
i in e && (t[i] = e[i]);
|
|
862
|
+
return t;
|
|
845
863
|
}
|
|
846
|
-
function
|
|
847
|
-
const
|
|
848
|
-
for (const
|
|
849
|
-
delete
|
|
850
|
-
return
|
|
864
|
+
function ht(e, o) {
|
|
865
|
+
const t = { ...e };
|
|
866
|
+
for (const i of o)
|
|
867
|
+
delete t[i];
|
|
868
|
+
return t;
|
|
851
869
|
}
|
|
852
|
-
function
|
|
870
|
+
function oe(e) {
|
|
853
871
|
if (e === null || typeof e != "object") return e;
|
|
854
872
|
if (e instanceof Date) return new Date(e.getTime());
|
|
855
873
|
if (e instanceof RegExp) return new RegExp(e.source, e.flags);
|
|
856
|
-
if (Array.isArray(e)) return e.map((
|
|
857
|
-
const
|
|
858
|
-
for (const
|
|
859
|
-
|
|
860
|
-
return
|
|
874
|
+
if (Array.isArray(e)) return e.map((t) => oe(t));
|
|
875
|
+
const o = {};
|
|
876
|
+
for (const t of Object.keys(e))
|
|
877
|
+
o[t] = oe(e[t]);
|
|
878
|
+
return o;
|
|
861
879
|
}
|
|
862
|
-
function
|
|
863
|
-
const
|
|
864
|
-
for (const [
|
|
865
|
-
if (!(
|
|
866
|
-
if (
|
|
867
|
-
const
|
|
868
|
-
Object.keys(
|
|
880
|
+
function ot(e, o = !1) {
|
|
881
|
+
const t = {};
|
|
882
|
+
for (const [i, l] of Object.entries(e))
|
|
883
|
+
if (!(l == null || l === ""))
|
|
884
|
+
if (o && typeof l == "object" && !Array.isArray(l) && !(l instanceof Date)) {
|
|
885
|
+
const a = ot(l, !0);
|
|
886
|
+
Object.keys(a).length > 0 && (t[i] = a);
|
|
869
887
|
} else
|
|
870
|
-
|
|
871
|
-
return
|
|
888
|
+
t[i] = l;
|
|
889
|
+
return t;
|
|
872
890
|
}
|
|
873
|
-
function
|
|
874
|
-
const
|
|
875
|
-
for (const [
|
|
876
|
-
const
|
|
877
|
-
|
|
891
|
+
function it(e, o = "", t = ".") {
|
|
892
|
+
const i = {};
|
|
893
|
+
for (const [l, a] of Object.entries(e)) {
|
|
894
|
+
const f = o ? `${o}${t}${l}` : l;
|
|
895
|
+
a !== null && typeof a == "object" && !Array.isArray(a) && !(a instanceof Date) ? Object.assign(i, it(a, f, t)) : i[f] = a;
|
|
878
896
|
}
|
|
879
|
-
return
|
|
897
|
+
return i;
|
|
880
898
|
}
|
|
881
|
-
function
|
|
882
|
-
const
|
|
883
|
-
for (const [
|
|
884
|
-
const
|
|
885
|
-
let
|
|
886
|
-
for (let
|
|
887
|
-
const
|
|
888
|
-
|
|
899
|
+
function gt(e, o = ".") {
|
|
900
|
+
const t = {};
|
|
901
|
+
for (const [i, l] of Object.entries(e)) {
|
|
902
|
+
const a = i.split(o);
|
|
903
|
+
let f = t;
|
|
904
|
+
for (let m = 0; m < a.length - 1; m++) {
|
|
905
|
+
const v = a[m];
|
|
906
|
+
v in f || (f[v] = {}), f = f[v];
|
|
889
907
|
}
|
|
890
|
-
|
|
908
|
+
f[a[a.length - 1]] = l;
|
|
891
909
|
}
|
|
892
|
-
return
|
|
910
|
+
return t;
|
|
893
911
|
}
|
|
894
|
-
function
|
|
895
|
-
return Object.entries(e).map(([
|
|
896
|
-
id:
|
|
897
|
-
label:
|
|
898
|
-
prop:
|
|
912
|
+
function yt(e) {
|
|
913
|
+
return Object.entries(e).map(([o, t]) => ({
|
|
914
|
+
id: o,
|
|
915
|
+
label: t,
|
|
916
|
+
prop: o
|
|
899
917
|
}));
|
|
900
918
|
}
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
e.component(
|
|
919
|
+
const ut = [Ce, De, X, Oe, We, at, ce], ct = (e) => {
|
|
920
|
+
ut.forEach((o) => {
|
|
921
|
+
e.component(o.name ?? o.__name ?? "", o);
|
|
904
922
|
});
|
|
905
|
-
},
|
|
923
|
+
}, bt = { install: ct };
|
|
906
924
|
export {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
925
|
+
Ce as JButton,
|
|
926
|
+
X as JIconRender,
|
|
927
|
+
We as JImportExcel,
|
|
928
|
+
Oe as JSearchHeader,
|
|
911
929
|
ce as JSideMenuItem,
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
930
|
+
at as JSidebar,
|
|
931
|
+
De as JUploadImg,
|
|
932
|
+
oe as deepClone,
|
|
933
|
+
bt as default,
|
|
934
|
+
ot as filterEmpty,
|
|
935
|
+
it as flatten,
|
|
936
|
+
ht as omit,
|
|
937
|
+
vt as pick,
|
|
938
|
+
st as toCamelCase,
|
|
939
|
+
nt as toSnakeCase,
|
|
940
|
+
yt as toTableColumns,
|
|
941
|
+
gt as unflatten
|
|
924
942
|
};
|
|
925
943
|
//# sourceMappingURL=index.js.map
|