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