jgy-public-component 0.0.19 → 0.0.21

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 CHANGED
@@ -1,17 +1,17 @@
1
- import { defineComponent as N, openBlock as d, createElementBlock as I, normalizeClass as U, createCommentVNode as C, renderSlot as P, ref as F, watch as ce, resolveComponent as w, createVNode as f, unref as x, withCtx as u, createElementVNode as y, withModifiers as Y, createBlock as b, Fragment as Z, toDisplayString as S, mergeProps as ge, computed as G, onMounted as ye, onBeforeUnmount as be, normalizeStyle as le, createTextVNode as D, useModel as _e, renderList as Q, mergeModels as se, createSlots as we } from "vue";
2
- import { ElMessage as B } from "element-plus";
3
- import { Delete as ee, Plus as te, Loading as ie, ZoomIn as ke, Search as je, Refresh as $e, ArrowDown as me } from "@element-plus/icons-vue";
4
- import Ce from "vuedraggable";
5
- import { Icon as xe } from "@iconify/vue";
6
- import * as K from "xlsx";
7
- import ne from "nprogress";
8
- const Re = ["disabled"], Ie = {
1
+ import { defineComponent as z, openBlock as r, createElementBlock as x, normalizeClass as U, createCommentVNode as C, renderSlot as D, ref as M, watch as ye, createVNode as f, unref as n, withCtx as d, createElementVNode as k, withModifiers as te, createBlock as y, Fragment as G, toDisplayString as I, mergeProps as xe, computed as Q, onMounted as Ie, onBeforeUnmount as Re, normalizeStyle as oe, createTextVNode as A, useModel as Se, renderList as Y, mergeModels as re, resolveComponent as Me, createSlots as Be } from "vue";
2
+ import { ElImage as ce, ElIcon as P, ElUpload as le, ElImageViewer as Ae, ElMessage as S, ElCard as be, ElForm as Te, ElButton as _, ElDialog as Ve, ElDivider as Fe, ElLink as De, ElRow as me, ElCol as X, ElTable as Je, ElTableColumn as ae, ElSubMenu as _e, ElMenuItem as ke, ElMenu as we, ElDropdown as Le, ElDropdownMenu as Pe, ElDropdownItem as fe } from "element-plus";
3
+ import { Delete as ne, Plus as se, Loading as pe, ZoomIn as ze, Search as Oe, Refresh as He, ArrowDown as Ce } from "@element-plus/icons-vue";
4
+ import Ne from "vuedraggable";
5
+ import { Icon as Ue } from "@iconify/vue";
6
+ import * as q from "xlsx";
7
+ import ie from "nprogress";
8
+ const We = ["disabled"], qe = {
9
9
  key: 0,
10
10
  class: "j-button__loading-icon"
11
- }, Se = {
11
+ }, Ke = {
12
12
  key: 1,
13
13
  class: "j-button__text"
14
- }, Be = /* @__PURE__ */ N({
14
+ }, Xe = /* @__PURE__ */ z({
15
15
  __name: "JButton",
16
16
  props: {
17
17
  type: { default: "default" },
@@ -22,12 +22,12 @@ const Re = ["disabled"], Ie = {
22
22
  loading: { type: Boolean, default: !1 }
23
23
  },
24
24
  emits: ["click"],
25
- setup(e, { emit: a }) {
26
- const t = e, l = a;
27
- function n(o) {
28
- !t.disabled && !t.loading && l("click", o);
25
+ setup(e, { emit: s }) {
26
+ const t = e, l = s;
27
+ function a(i) {
28
+ !t.disabled && !t.loading && l("click", i);
29
29
  }
30
- return (o, i) => (d(), I("button", {
30
+ return (i, u) => (r(), x("button", {
31
31
  class: U(["j-button", [
32
32
  `j-button--${e.type}`,
33
33
  `j-button--${e.size}`,
@@ -39,29 +39,29 @@ const Re = ["disabled"], Ie = {
39
39
  }
40
40
  ]]),
41
41
  disabled: e.disabled || e.loading,
42
- onClick: n
42
+ onClick: a
43
43
  }, [
44
- e.loading ? (d(), I("span", Ie)) : C("", !0),
45
- o.$slots.default ? (d(), I("span", Se, [
46
- P(o.$slots, "default", {}, void 0, !0)
44
+ e.loading ? (r(), x("span", qe)) : C("", !0),
45
+ i.$slots.default ? (r(), x("span", Ke, [
46
+ D(i.$slots, "default", {}, void 0, !0)
47
47
  ])) : C("", !0)
48
- ], 10, Re));
48
+ ], 10, We));
49
49
  }
50
- }), W = (e, a) => {
50
+ }), W = (e, s) => {
51
51
  const t = e.__vccOpts || e;
52
- for (const [l, n] of a)
53
- t[l] = n;
52
+ for (const [l, a] of s)
53
+ t[l] = a;
54
54
  return t;
55
- }, Me = /* @__PURE__ */ W(Be, [["__scopeId", "data-v-22864824"]]), Ae = { class: "j-upload-img-container" }, Ee = {
55
+ }, Ze = /* @__PURE__ */ W(Xe, [["__scopeId", "data-v-22864824"]]), Ge = { class: "j-upload-img-container" }, Qe = {
56
56
  key: 0,
57
57
  class: "images-wrapper"
58
- }, Te = { class: "image-item" }, Ve = ["onClick"], Fe = {
58
+ }, Ye = { class: "image-item" }, et = ["onClick"], tt = {
59
59
  key: 0,
60
60
  class: "image-item single-image-item"
61
- }, Je = { class: "image-actions" }, De = {
61
+ }, at = { class: "image-actions" }, lt = {
62
62
  key: 2,
63
63
  class: "upload-tip"
64
- }, Le = { key: 0 }, Oe = /* @__PURE__ */ N({
64
+ }, nt = { key: 0 }, st = /* @__PURE__ */ z({
65
65
  name: "JUploadImg",
66
66
  __name: "JUploadImg",
67
67
  props: {
@@ -76,188 +76,185 @@ const Re = ["disabled"], Ie = {
76
76
  uploadFn: { type: Function, default: void 0 }
77
77
  },
78
78
  emits: ["update:modelValue", "success", "error"],
79
- setup(e, { emit: a }) {
80
- const t = e, l = a, n = F(""), o = F(!1), i = t.showTip, r = () => {
81
- o.value = !0;
79
+ setup(e, { emit: s }) {
80
+ const t = e, l = s, a = M(""), i = M(!1), u = t.showTip, m = () => {
81
+ i.value = !0;
82
82
  }, c = () => {
83
- n.value = "", l("update:modelValue", ""), B.success("删除成功");
84
- }, h = F([]), _ = F(!1), O = (m) => {
85
- h.value = m.map((p, s) => ({
86
- uid: Date.now() + s,
87
- url: p
83
+ a.value = "", l("update:modelValue", ""), S.success("删除成功");
84
+ }, v = M([]), p = M(!1), J = (E) => {
85
+ v.value = E.map((h, o) => ({
86
+ uid: Date.now() + o,
87
+ url: h
88
88
  }));
89
89
  };
90
- ce(() => t.modelValue, (m) => {
91
- t.multiple ? Array.isArray(m) && m.length > 0 ? O(m) : h.value = [] : typeof m == "string" ? n.value = m : n.value = "";
90
+ ye(() => t.modelValue, (E) => {
91
+ t.multiple ? Array.isArray(E) && E.length > 0 ? J(E) : v.value = [] : typeof E == "string" ? a.value = E : a.value = "";
92
92
  }, { immediate: !0 });
93
- const V = () => {
94
- J();
95
- }, j = (m) => {
96
- h.value.splice(m, 1), J(), B.success("删除成功");
97
- }, g = async (m) => {
98
- const p = m.raw;
99
- if (!p) {
100
- B.error("文件不存在,请重试");
93
+ const T = () => {
94
+ B();
95
+ }, $ = (E) => {
96
+ v.value.splice(E, 1), B(), S.success("删除成功");
97
+ }, b = async (E) => {
98
+ const h = E.raw;
99
+ if (!h) {
100
+ S.error("文件不存在,请重试");
101
101
  return;
102
102
  }
103
- if (p.size > t.maxSize * 1024 * 1024) {
104
- B.error(`图片大小不能超过 ${t.maxSize}MB`);
103
+ if (h.size > t.maxSize * 1024 * 1024) {
104
+ S.error(`图片大小不能超过 ${t.maxSize}MB`);
105
105
  return;
106
106
  }
107
107
  if (!t.uploadFn) {
108
- B.error("未配置上传函数 (uploadFn)");
108
+ S.error("未配置上传函数 (uploadFn)");
109
109
  return;
110
110
  }
111
111
  try {
112
- _.value = !0;
113
- const s = await t.uploadFn(p);
114
- t.multiple ? (h.value.push({ uid: Date.now(), url: s }), J()) : (n.value = s, l("update:modelValue", s)), l("success", s), B.success("上传成功");
115
- } catch (s) {
116
- console.error("上传出错:", s), B.error("上传失败,请重试"), l("error", s);
112
+ p.value = !0;
113
+ const o = await t.uploadFn(h);
114
+ t.multiple ? (v.value.push({ uid: Date.now(), url: o }), B()) : (a.value = o, l("update:modelValue", o)), l("success", o), S.success("上传成功");
115
+ } catch (o) {
116
+ console.error("上传出错:", o), S.error("上传失败,请重试"), l("error", o);
117
117
  } finally {
118
- _.value = !1;
118
+ p.value = !1;
119
119
  }
120
- }, J = () => {
121
- const m = h.value.map((p) => p.url);
122
- l("update:modelValue", m);
120
+ }, B = () => {
121
+ const E = v.value.map((h) => h.url);
122
+ l("update:modelValue", E);
123
123
  };
124
- return (m, p) => {
125
- const s = w("el-image"), $ = w("el-icon"), R = w("el-upload"), v = w("el-image-viewer");
126
- return d(), I("div", Ae, [
127
- e.multiple ? (d(), I("div", Ee, [
128
- f(x(Ce), {
129
- modelValue: h.value,
130
- "onUpdate:modelValue": p[0] || (p[0] = (E) => h.value = E),
131
- class: "images-list",
132
- "item-key": "uid",
133
- animation: 200,
134
- disabled: e.disabled,
135
- onEnd: V
136
- }, {
137
- item: u(({ element: E, index: k }) => [
138
- y("div", Te, [
139
- f(s, {
140
- src: E.url,
141
- "preview-src-list": h.value.map((M) => M.url),
142
- "initial-index": k,
143
- fit: "cover",
144
- class: "image-preview",
145
- "preview-teleported": !0,
146
- "hide-on-click-modal": !0
147
- }, null, 8, ["src", "preview-src-list", "initial-index"]),
148
- e.disabled ? C("", !0) : (d(), I("div", {
149
- key: 0,
150
- class: "delete-btn",
151
- onClick: Y((M) => j(k), ["stop"])
152
- }, [
153
- f($, { class: "icon-delete" }, {
154
- default: u(() => [
155
- f(x(ee))
156
- ]),
157
- _: 1
158
- })
159
- ], 8, Ve))
160
- ])
161
- ]),
162
- _: 1
163
- }, 8, ["modelValue", "disabled"]),
164
- !e.disabled && (!e.limit || h.value.length < e.limit) ? (d(), b(R, {
165
- key: 0,
166
- class: "image-uploader",
167
- "auto-upload": !1,
168
- "show-file-list": !1,
169
- "on-change": g,
170
- disabled: _.value,
171
- "list-type": "picture-card",
172
- accept: e.accept
173
- }, {
174
- default: u(() => [
175
- _.value ? (d(), b($, {
176
- key: 1,
177
- class: "uploader-icon is-loading"
178
- }, {
179
- default: u(() => [
180
- f(x(ie))
181
- ]),
182
- _: 1
183
- })) : (d(), b($, {
184
- key: 0,
185
- class: "uploader-icon"
186
- }, {
187
- default: u(() => [
188
- f(x(te))
189
- ]),
190
- _: 1
191
- }))
192
- ]),
193
- _: 1
194
- }, 8, ["disabled", "accept"])) : C("", !0)
195
- ])) : (d(), I(Z, { key: 1 }, [
196
- n.value ? (d(), I("div", Fe, [
197
- f(s, {
198
- src: n.value,
199
- fit: "cover",
200
- class: "image-preview"
201
- }, null, 8, ["src"]),
202
- y("div", Je, [
203
- f($, {
204
- class: "action-icon",
205
- onClick: Y(r, ["stop"])
206
- }, {
207
- default: u(() => [
208
- f(x(ke))
209
- ]),
210
- _: 1
211
- }),
212
- e.disabled ? C("", !0) : (d(), b($, {
124
+ return (E, h) => (r(), x("div", Ge, [
125
+ e.multiple ? (r(), x("div", Qe, [
126
+ f(n(Ne), {
127
+ modelValue: v.value,
128
+ "onUpdate:modelValue": h[0] || (h[0] = (o) => v.value = o),
129
+ class: "images-list",
130
+ "item-key": "uid",
131
+ animation: 200,
132
+ disabled: e.disabled,
133
+ onEnd: T
134
+ }, {
135
+ item: d(({ element: o, index: w }) => [
136
+ k("div", Ye, [
137
+ f(n(ce), {
138
+ src: o.url,
139
+ "preview-src-list": v.value.map((R) => R.url),
140
+ "initial-index": w,
141
+ fit: "cover",
142
+ class: "image-preview",
143
+ "preview-teleported": !0,
144
+ "hide-on-click-modal": !0
145
+ }, null, 8, ["src", "preview-src-list", "initial-index"]),
146
+ e.disabled ? C("", !0) : (r(), x("div", {
213
147
  key: 0,
214
- class: "action-icon",
215
- onClick: Y(c, ["stop"])
216
- }, {
217
- default: u(() => [
218
- f(x(ee))
219
- ]),
220
- _: 1
221
- }))
148
+ class: "delete-btn",
149
+ onClick: te((R) => $(w), ["stop"])
150
+ }, [
151
+ f(n(P), { class: "icon-delete" }, {
152
+ default: d(() => [
153
+ f(n(ne))
154
+ ]),
155
+ _: 1
156
+ })
157
+ ], 8, et))
222
158
  ])
223
- ])) : (d(), b(R, {
224
- key: 1,
225
- class: "image-uploader",
226
- "auto-upload": !1,
227
- "show-file-list": !1,
228
- "on-change": g,
229
- disabled: e.disabled || _.value,
230
- accept: e.accept,
231
- "list-type": "picture-card"
232
- }, {
233
- default: u(() => [
234
- f($, { class: "uploader-icon" }, {
235
- default: u(() => [
236
- _.value ? (d(), b(x(ie), {
237
- key: 1,
238
- class: "is-loading"
239
- })) : (d(), b(x(te), { key: 0 }))
240
- ]),
241
- _: 1
242
- })
243
- ]),
244
- _: 1
245
- }, 8, ["disabled", "accept"])),
246
- o.value ? (d(), b(v, {
247
- key: 2,
248
- "url-list": [n.value],
249
- teleported: !0,
250
- onClose: p[1] || (p[1] = (E) => o.value = !1)
251
- }, null, 8, ["url-list"])) : C("", !0)
252
- ], 64)),
253
- x(i) ? (d(), I("div", De, [
254
- y("span", null, S(e.tip), 1),
255
- e.multiple && e.limit ? (d(), I("span", Le, " (最多 " + S(e.limit) + " 张)", 1)) : C("", !0)
256
- ])) : C("", !0)
257
- ]);
258
- };
159
+ ]),
160
+ _: 1
161
+ }, 8, ["modelValue", "disabled"]),
162
+ !e.disabled && (!e.limit || v.value.length < e.limit) ? (r(), y(n(le), {
163
+ key: 0,
164
+ class: "image-uploader",
165
+ "auto-upload": !1,
166
+ "show-file-list": !1,
167
+ "on-change": b,
168
+ disabled: p.value,
169
+ "list-type": "picture-card",
170
+ accept: e.accept
171
+ }, {
172
+ default: d(() => [
173
+ p.value ? (r(), y(n(P), {
174
+ key: 1,
175
+ class: "uploader-icon is-loading"
176
+ }, {
177
+ default: d(() => [
178
+ f(n(pe))
179
+ ]),
180
+ _: 1
181
+ })) : (r(), y(n(P), {
182
+ key: 0,
183
+ class: "uploader-icon"
184
+ }, {
185
+ default: d(() => [
186
+ f(n(se))
187
+ ]),
188
+ _: 1
189
+ }))
190
+ ]),
191
+ _: 1
192
+ }, 8, ["disabled", "accept"])) : C("", !0)
193
+ ])) : (r(), x(G, { key: 1 }, [
194
+ a.value ? (r(), x("div", tt, [
195
+ f(n(ce), {
196
+ src: a.value,
197
+ fit: "cover",
198
+ class: "image-preview"
199
+ }, null, 8, ["src"]),
200
+ k("div", at, [
201
+ f(n(P), {
202
+ class: "action-icon",
203
+ onClick: te(m, ["stop"])
204
+ }, {
205
+ default: d(() => [
206
+ f(n(ze))
207
+ ]),
208
+ _: 1
209
+ }),
210
+ e.disabled ? C("", !0) : (r(), y(n(P), {
211
+ key: 0,
212
+ class: "action-icon",
213
+ onClick: te(c, ["stop"])
214
+ }, {
215
+ default: d(() => [
216
+ f(n(ne))
217
+ ]),
218
+ _: 1
219
+ }))
220
+ ])
221
+ ])) : (r(), y(n(le), {
222
+ key: 1,
223
+ class: "image-uploader",
224
+ "auto-upload": !1,
225
+ "show-file-list": !1,
226
+ "on-change": b,
227
+ disabled: e.disabled || p.value,
228
+ accept: e.accept,
229
+ "list-type": "picture-card"
230
+ }, {
231
+ default: d(() => [
232
+ f(n(P), { class: "uploader-icon" }, {
233
+ default: d(() => [
234
+ p.value ? (r(), y(n(pe), {
235
+ key: 1,
236
+ class: "is-loading"
237
+ })) : (r(), y(n(se), { key: 0 }))
238
+ ]),
239
+ _: 1
240
+ })
241
+ ]),
242
+ _: 1
243
+ }, 8, ["disabled", "accept"])),
244
+ i.value ? (r(), y(n(Ae), {
245
+ key: 2,
246
+ "url-list": [a.value],
247
+ teleported: !0,
248
+ onClose: h[1] || (h[1] = (o) => i.value = !1)
249
+ }, null, 8, ["url-list"])) : C("", !0)
250
+ ], 64)),
251
+ n(u) ? (r(), x("div", lt, [
252
+ k("span", null, I(e.tip), 1),
253
+ e.multiple && e.limit ? (r(), x("span", nt, " (最多 " + I(e.limit) + " 张)", 1)) : C("", !0)
254
+ ])) : C("", !0)
255
+ ]));
259
256
  }
260
- }), Pe = /* @__PURE__ */ W(Oe, [["__scopeId", "data-v-94fad0af"]]), X = /* @__PURE__ */ N({
257
+ }), it = /* @__PURE__ */ W(st, [["__scopeId", "data-v-7dc4f798"]]), Z = /* @__PURE__ */ z({
261
258
  name: "JIconRender",
262
259
  __name: "JIconRender",
263
260
  props: {
@@ -265,14 +262,14 @@ const Re = ["disabled"], Ie = {
265
262
  size: { default: 24 }
266
263
  },
267
264
  setup(e) {
268
- return (a, t) => e.icon ? (d(), b(x(xe), ge({
265
+ return (s, t) => e.icon ? (r(), y(n(Ue), xe({
269
266
  key: 0,
270
267
  icon: e.icon,
271
268
  width: e.size,
272
269
  height: e.size
273
- }, a.$attrs), null, 16, ["icon", "width", "height"])) : C("", !0);
270
+ }, s.$attrs), null, 16, ["icon", "width", "height"])) : C("", !0);
274
271
  }
275
- }), ze = { class: "action-left" }, He = /* @__PURE__ */ N({
272
+ }), ot = { class: "action-left" }, ut = /* @__PURE__ */ z({
276
273
  name: "JSearchHeader",
277
274
  __name: "JSearchHeader",
278
275
  props: {
@@ -285,145 +282,142 @@ const Re = ["disabled"], Ie = {
285
282
  showReset: { type: Boolean, default: !0 }
286
283
  },
287
284
  emits: ["search", "reset", "add", "batchDelete"],
288
- setup(e, { emit: a }) {
289
- const t = e, l = a, n = F(), o = F(!1), i = F(!1), r = F(0), c = F(0), h = G(() => r.value > t.defaultVisible), _ = () => {
290
- if (!n.value) return;
291
- const j = Array.from(n.value.children);
292
- r.value = j.length;
293
- const g = j[t.defaultVisible - 1];
294
- if (g && n.value) {
295
- const J = n.value.getBoundingClientRect(), m = g.getBoundingClientRect();
296
- c.value = m.bottom - J.top;
285
+ setup(e, { emit: s }) {
286
+ const t = e, l = s, a = M(), i = M(!1), u = M(!1), m = M(0), c = M(0), v = Q(() => m.value > t.defaultVisible), p = () => {
287
+ if (!a.value) return;
288
+ const $ = Array.from(a.value.children);
289
+ m.value = $.length;
290
+ const b = $[t.defaultVisible - 1];
291
+ if (b && a.value) {
292
+ const B = a.value.getBoundingClientRect(), E = b.getBoundingClientRect();
293
+ c.value = E.bottom - B.top;
297
294
  }
298
- }, O = () => {
299
- const j = n.value;
300
- if (j)
301
- if (o.value)
302
- _(), o.value = !1, j.style.maxHeight = j.scrollHeight + "px", j.offsetHeight, j.style.maxHeight = c.value + "px";
295
+ }, J = () => {
296
+ const $ = a.value;
297
+ if ($)
298
+ if (i.value)
299
+ p(), i.value = !1, $.style.maxHeight = $.scrollHeight + "px", $.offsetHeight, $.style.maxHeight = c.value + "px";
303
300
  else {
304
- o.value = !0, j.style.maxHeight = j.scrollHeight + "px";
305
- const g = () => {
306
- j.style.maxHeight = "none", j.removeEventListener("transitionend", g);
301
+ i.value = !0, $.style.maxHeight = $.scrollHeight + "px";
302
+ const b = () => {
303
+ $.style.maxHeight = "none", $.removeEventListener("transitionend", b);
307
304
  };
308
- j.addEventListener("transitionend", g);
305
+ $.addEventListener("transitionend", b);
309
306
  }
310
307
  };
311
- let V = null;
312
- return ye(() => {
313
- _(), h.value && n.value && (n.value.style.maxHeight = c.value + "px"), requestAnimationFrame(() => {
308
+ let T = null;
309
+ return Ie(() => {
310
+ p(), v.value && a.value && (a.value.style.maxHeight = c.value + "px"), requestAnimationFrame(() => {
314
311
  requestAnimationFrame(() => {
315
- i.value = !0;
312
+ u.value = !0;
316
313
  });
317
- }), n.value && (V = new MutationObserver(() => {
318
- _(), h.value && !o.value && n.value && (n.value.style.maxHeight = c.value + "px");
319
- }), V.observe(n.value, { childList: !0 }));
320
- }), be(() => {
321
- V == null || V.disconnect();
322
- }), (j, g) => {
323
- const J = w("el-form"), m = w("el-button"), p = w("el-icon"), s = w("el-card");
324
- return d(), b(s, {
325
- shadow: "never",
326
- class: "j-search-header-card"
327
- }, {
328
- default: u(() => [
329
- f(J, {
330
- inline: "",
331
- class: "search-form"
332
- }, {
333
- default: u(() => [
334
- y("div", {
335
- ref_key: "formItemsRef",
336
- ref: n,
337
- class: U(["form-items-wrapper", { "is-animated": i.value }])
338
- }, [
339
- P(j.$slots, "default", {}, void 0, !0)
340
- ], 2)
341
- ]),
342
- _: 3
343
- }),
344
- y("div", {
345
- class: "action-bar",
346
- style: le({ marginTop: o.value ? "0px" : "10px" })
347
- }, [
348
- y("div", ze, [
349
- e.showAdd ? (d(), b(m, {
350
- key: 0,
351
- type: "primary",
352
- icon: x(te),
353
- onClick: g[0] || (g[0] = ($) => l("add"))
354
- }, {
355
- default: u(() => [
356
- D(S(e.addText), 1)
357
- ]),
358
- _: 1
359
- }, 8, ["icon"])) : C("", !0),
360
- e.showBatchDelete ? (d(), b(m, {
361
- key: 1,
362
- type: "danger",
363
- icon: x(ee),
364
- disabled: e.selectedCount === 0,
365
- onClick: g[1] || (g[1] = ($) => l("batchDelete"))
366
- }, {
367
- default: u(() => [
368
- D(" 批量删除" + S(e.selectedCount ? `(${e.selectedCount})` : ""), 1)
369
- ]),
370
- _: 1
371
- }, 8, ["icon", "disabled"])) : C("", !0),
372
- e.showSearch ? (d(), b(m, {
373
- key: 2,
374
- type: "primary",
375
- icon: x(je),
376
- onClick: g[2] || (g[2] = ($) => l("search"))
377
- }, {
378
- default: u(() => [...g[4] || (g[4] = [
379
- D("搜索", -1)
380
- ])]),
381
- _: 1
382
- }, 8, ["icon"])) : C("", !0),
383
- e.showReset ? (d(), b(m, {
384
- key: 3,
385
- icon: x($e),
386
- onClick: g[3] || (g[3] = ($) => l("reset"))
387
- }, {
388
- default: u(() => [...g[5] || (g[5] = [
389
- D("重置", -1)
390
- ])]),
391
- _: 1
392
- }, 8, ["icon"])) : C("", !0),
393
- P(j.$slots, "actions", {}, void 0, !0)
394
- ]),
395
- h.value ? (d(), b(m, {
314
+ }), a.value && (T = new MutationObserver(() => {
315
+ p(), v.value && !i.value && a.value && (a.value.style.maxHeight = c.value + "px");
316
+ }), T.observe(a.value, { childList: !0 }));
317
+ }), Re(() => {
318
+ T == null || T.disconnect();
319
+ }), ($, b) => (r(), y(n(be), {
320
+ shadow: "never",
321
+ class: "j-search-header-card"
322
+ }, {
323
+ default: d(() => [
324
+ f(n(Te), {
325
+ inline: "",
326
+ class: "search-form"
327
+ }, {
328
+ default: d(() => [
329
+ k("div", {
330
+ ref_key: "formItemsRef",
331
+ ref: a,
332
+ class: U(["form-items-wrapper", { "is-animated": u.value }])
333
+ }, [
334
+ D($.$slots, "default", {}, void 0, !0)
335
+ ], 2)
336
+ ]),
337
+ _: 3
338
+ }),
339
+ k("div", {
340
+ class: "action-bar",
341
+ style: oe({ marginTop: i.value ? "0px" : "10px" })
342
+ }, [
343
+ k("div", ot, [
344
+ e.showAdd ? (r(), y(n(_), {
396
345
  key: 0,
397
- link: "",
398
346
  type: "primary",
399
- onClick: O
347
+ icon: n(se),
348
+ onClick: b[0] || (b[0] = (B) => l("add"))
400
349
  }, {
401
- default: u(() => [
402
- D(S(o.value ? "收起" : "展开") + " ", 1),
403
- f(p, {
404
- class: U(["toggle-icon", { "is-expanded": o.value }])
405
- }, {
406
- default: u(() => [
407
- f(x(me))
408
- ]),
409
- _: 1
410
- }, 8, ["class"])
350
+ default: d(() => [
351
+ A(I(e.addText), 1)
411
352
  ]),
412
353
  _: 1
413
- })) : C("", !0)
414
- ], 4)
415
- ]),
416
- _: 3
417
- });
418
- };
354
+ }, 8, ["icon"])) : C("", !0),
355
+ e.showBatchDelete ? (r(), y(n(_), {
356
+ key: 1,
357
+ type: "danger",
358
+ icon: n(ne),
359
+ disabled: e.selectedCount === 0,
360
+ onClick: b[1] || (b[1] = (B) => l("batchDelete"))
361
+ }, {
362
+ default: d(() => [
363
+ A(" 批量删除" + I(e.selectedCount ? `(${e.selectedCount})` : ""), 1)
364
+ ]),
365
+ _: 1
366
+ }, 8, ["icon", "disabled"])) : C("", !0),
367
+ e.showSearch ? (r(), y(n(_), {
368
+ key: 2,
369
+ type: "primary",
370
+ icon: n(Oe),
371
+ onClick: b[2] || (b[2] = (B) => l("search"))
372
+ }, {
373
+ default: d(() => [...b[4] || (b[4] = [
374
+ A("搜索", -1)
375
+ ])]),
376
+ _: 1
377
+ }, 8, ["icon"])) : C("", !0),
378
+ e.showReset ? (r(), y(n(_), {
379
+ key: 3,
380
+ icon: n(He),
381
+ onClick: b[3] || (b[3] = (B) => l("reset"))
382
+ }, {
383
+ default: d(() => [...b[5] || (b[5] = [
384
+ A("重置", -1)
385
+ ])]),
386
+ _: 1
387
+ }, 8, ["icon"])) : C("", !0),
388
+ D($.$slots, "actions", {}, void 0, !0)
389
+ ]),
390
+ v.value ? (r(), y(n(_), {
391
+ key: 0,
392
+ link: "",
393
+ type: "primary",
394
+ onClick: J
395
+ }, {
396
+ default: d(() => [
397
+ A(I(i.value ? "收起" : "展开") + " ", 1),
398
+ f(n(P), {
399
+ class: U(["toggle-icon", { "is-expanded": i.value }])
400
+ }, {
401
+ default: d(() => [
402
+ f(n(Ce))
403
+ ]),
404
+ _: 1
405
+ }, 8, ["class"])
406
+ ]),
407
+ _: 1
408
+ })) : C("", !0)
409
+ ], 4)
410
+ ]),
411
+ _: 3
412
+ }));
419
413
  }
420
- }), Ne = /* @__PURE__ */ W(He, [["__scopeId", "data-v-d3f83c3f"]]), Ue = { class: "j-import-upload-row" }, We = { class: "j-import-stat-num" }, qe = { class: "j-import-stat-num" }, Ke = { class: "j-import-stat-num" }, Xe = {
414
+ }), dt = /* @__PURE__ */ W(ut, [["__scopeId", "data-v-c1f4bf4c"]]), rt = { class: "j-import-upload-row" }, ct = { class: "j-import-stat-num" }, mt = { class: "j-import-stat-num" }, ft = { class: "j-import-stat-num" }, pt = {
421
415
  key: 0,
422
416
  class: "j-import-status-fail"
423
- }, Ze = { key: 1 }, Ge = /* @__PURE__ */ N({
417
+ }, ht = { key: 1 }, vt = /* @__PURE__ */ z({
424
418
  name: "JImportExcel",
425
419
  __name: "JImportExcel",
426
- props: /* @__PURE__ */ se({
420
+ props: /* @__PURE__ */ re({
427
421
  getFieldListApi: {},
428
422
  importApi: {},
429
423
  excludeFields: { default: () => ["id", "ctime", "mtime"] },
@@ -432,263 +426,263 @@ const Re = ["disabled"], Ie = {
432
426
  modelValue: { type: Boolean, default: !1 },
433
427
  modelModifiers: {}
434
428
  }),
435
- emits: /* @__PURE__ */ se(["success"], ["update:modelValue"]),
436
- setup(e, { emit: a }) {
437
- const t = e, l = a, n = _e(e, "modelValue"), o = F(!1), i = F({}), r = F([]), c = F({ total: 0, success: 0, fail: 0 }), h = {
429
+ emits: /* @__PURE__ */ re(["success"], ["update:modelValue"]),
430
+ setup(e, { emit: s }) {
431
+ const t = e, l = s, a = Se(e, "modelValue"), i = M(!1), u = M({}), m = M([]), c = M({ total: 0, success: 0, fail: 0 }), v = {
438
432
  0: "待创建",
439
433
  1: "创建成功",
440
434
  2: "创建中",
441
435
  [-1]: "创建失败"
442
- }, _ = G(() => Object.entries(i.value).filter(([p]) => !t.excludeFields.includes(p)).map(([p, s]) => ({ id: p, label: s, prop: p }))), O = async () => {
436
+ }, p = Q(() => Object.entries(u.value).filter(([h]) => !t.excludeFields.includes(h)).map(([h, o]) => ({ id: h, label: o, prop: h }))), J = async () => {
443
437
  try {
444
- const p = await t.getFieldListApi();
445
- i.value = p.data.tableFieldsInfo ?? {};
438
+ const h = await t.getFieldListApi();
439
+ u.value = h.data.tableFieldsInfo ?? {};
446
440
  } catch {
447
- B.error("获取字段列表失败");
441
+ S.error("获取字段列表失败");
448
442
  }
449
- }, V = (p) => {
450
- const s = p.raw;
451
- if (!s) return;
443
+ }, T = (h) => {
444
+ const o = h.raw;
445
+ if (!o) return;
452
446
  if (![
453
447
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
454
448
  "application/vnd.ms-excel"
455
- ].includes(s.type) && !s.name.match(/\.xlsx?$/i)) {
456
- B.warning("请上传 .xlsx 或 .xls 格式文件");
449
+ ].includes(o.type) && !o.name.match(/\.xlsx?$/i)) {
450
+ S.warning("请上传 .xlsx 或 .xls 格式文件");
457
451
  return;
458
452
  }
459
453
  const R = new FileReader();
460
- R.onload = (v) => {
454
+ R.onload = (g) => {
461
455
  try {
462
- const E = K.read(v.target.result, { type: "binary" }), k = E.SheetNames[0], M = E.Sheets[k], T = K.utils.sheet_to_json(M);
463
- if (!T.length) {
464
- B.warning("文件内容为空");
456
+ const L = q.read(g.target.result, { type: "binary" }), j = L.SheetNames[0], O = L.Sheets[j], K = q.utils.sheet_to_json(O, {
457
+ header: 1,
458
+ defval: ""
459
+ }).slice(1).filter((H) => H.some((N) => N !== ""));
460
+ if (!K.length) {
461
+ S.warning("文件内容为空");
465
462
  return;
466
463
  }
467
- const z = _.value.map((H) => H.prop), L = T.map((H) => {
468
- const A = Object.values(H), q = { _status: 0, _error: "" };
469
- return z.forEach((oe, ve) => {
470
- q[oe] = A[ve];
471
- }), q;
464
+ const F = K.map((H) => {
465
+ const N = { _status: 0, _error: "" };
466
+ return p.value.forEach((ee, de) => {
467
+ N[ee.prop] = H[de] !== void 0 ? H[de] : "";
468
+ }), N;
472
469
  });
473
- r.value = L, c.value = { total: L.length, success: 0, fail: 0 };
470
+ m.value = F, c.value = { total: F.length, success: 0, fail: 0 };
474
471
  } catch {
475
- B.error("解析文件失败,请检查文件格式");
472
+ S.error("解析文件失败,请检查文件格式");
476
473
  }
477
- }, R.readAsBinaryString(s);
478
- }, j = (p) => {
479
- r.value.splice(p, 1), c.value.total = r.value.length;
480
- }, g = async () => {
481
- const p = r.value.filter((s) => s._status === 0).map(({ _status: s, _error: $, ...R }) => R);
482
- if (!p.length) {
483
- B.warning("没有可导入的数据");
474
+ }, R.readAsBinaryString(o);
475
+ }, $ = (h) => {
476
+ m.value.splice(h, 1), c.value.total = m.value.length;
477
+ }, b = async () => {
478
+ const h = m.value.filter((o) => o._status === 0).map(({ _status: o, _error: w, ...R }) => R);
479
+ if (!h.length) {
480
+ S.warning("没有可导入的数据");
484
481
  return;
485
482
  }
486
- o.value = !0;
483
+ i.value = !0;
487
484
  try {
488
- const s = await t.importApi(p);
489
- s.code === 1 ? (r.value.forEach(($) => {
490
- $._status === 0 && ($._status = 1);
491
- }), c.value.success = r.value.filter(($) => $._status === 1).length, B.success("导入成功"), l("success")) : B.error(s.msg || "导入失败");
485
+ const o = await t.importApi(h);
486
+ o.code === 1 ? (m.value.forEach((w) => {
487
+ w._status === 0 && (w._status = 1);
488
+ }), c.value.success = m.value.filter((w) => w._status === 1).length, S.success("导入成功"), l("success")) : S.error(o.msg || "导入失败");
492
489
  } catch {
493
- B.error("导入失败,请重试");
490
+ S.error("导入失败,请重试");
494
491
  } finally {
495
- o.value = !1;
492
+ i.value = !1;
496
493
  }
497
- }, J = () => {
494
+ }, B = () => {
498
495
  try {
499
- const p = K.utils.book_new(), s = _.value.map((v) => v.label), $ = {};
500
- s.forEach((v) => $[v] = "");
501
- const R = K.utils.json_to_sheet([$]);
502
- K.utils.book_append_sheet(p, R, "模板"), K.writeFile(p, "导入模板.xlsx");
496
+ const h = q.utils.book_new(), o = p.value.map((g) => g.label), w = {};
497
+ o.forEach((g) => w[g] = "");
498
+ const R = q.utils.json_to_sheet([w]);
499
+ q.utils.book_append_sheet(h, R, "模板"), q.writeFile(h, "导入模板.xlsx");
503
500
  } catch {
504
- B.error("模板下载失败");
501
+ S.error("模板下载失败");
505
502
  }
506
- }, m = () => {
507
- o.value || (n.value = !1, r.value = [], c.value = { total: 0, success: 0, fail: 0 });
503
+ }, E = () => {
504
+ i.value || (a.value = !1, m.value = [], c.value = { total: 0, success: 0, fail: 0 });
508
505
  };
509
- return (p, s) => {
510
- const $ = w("el-divider"), R = w("el-button"), v = w("el-upload"), E = w("el-link"), k = w("el-card"), M = w("el-col"), T = w("el-row"), z = w("el-table-column"), L = w("el-table"), H = w("el-dialog");
511
- return d(), b(H, {
512
- modelValue: n.value,
513
- "onUpdate:modelValue": s[0] || (s[0] = (A) => n.value = A),
514
- title: t.title,
515
- width: "900px",
516
- "close-on-click-modal": !1,
517
- onOpen: O,
518
- onClose: m
519
- }, {
520
- footer: u(() => [
521
- f(R, { onClick: m }, {
522
- default: u(() => [...s[9] || (s[9] = [
523
- D("关闭", -1)
524
- ])]),
525
- _: 1
526
- })
527
- ]),
528
- default: u(() => [
529
- f(k, {
530
- shadow: "never",
531
- class: "j-import-upload-card"
532
- }, {
533
- default: u(() => [
534
- s[3] || (s[3] = y("div", { class: "j-import-upload-card-title" }, "导入 EXCEL", -1)),
535
- f($, { style: { margin: "10px 0" } }),
536
- y("div", Ue, [
537
- f(v, {
538
- accept: ".xlsx,.xls",
539
- "auto-upload": !1,
540
- "show-file-list": !1,
541
- "on-change": V
542
- }, {
543
- default: u(() => [
544
- f(R, { size: "small" }, {
545
- default: u(() => [...s[1] || (s[1] = [
546
- D("点击上传", -1)
547
- ])]),
548
- _: 1
549
- })
550
- ]),
551
- _: 1
552
- }),
553
- _.value.length ? (d(), b(E, {
554
- key: 0,
555
- type: "primary",
556
- class: "j-import-no-wrap",
557
- onClick: J
558
- }, {
559
- default: u(() => [...s[2] || (s[2] = [
560
- D(" 下载导入模板.xlsx ", -1)
561
- ])]),
562
- _: 1
563
- })) : C("", !0)
564
- ])
565
- ]),
566
- _: 1
567
- }),
568
- f(T, {
569
- class: "j-import-stats-row",
570
- gutter: 20,
571
- align: "middle"
572
- }, {
573
- default: u(() => [
574
- f(M, { span: 18 }, {
575
- default: u(() => [
576
- f(T, { class: "j-import-stats-cols" }, {
577
- default: u(() => [
578
- f(M, {
579
- span: 4,
580
- class: "j-import-stat-item"
581
- }, {
582
- default: u(() => [
583
- y("div", We, S(c.value.total), 1),
584
- s[4] || (s[4] = y("div", { class: "j-import-stat-label" }, "导入数量", -1))
585
- ]),
586
- _: 1
587
- }),
588
- f(M, {
589
- span: 4,
590
- class: "j-import-stat-item"
591
- }, {
592
- default: u(() => [
593
- y("div", qe, S(c.value.fail), 1),
594
- s[5] || (s[5] = y("div", { class: "j-import-stat-label" }, "失败数量", -1))
595
- ]),
596
- _: 1
597
- }),
598
- f(M, {
599
- span: 4,
600
- class: "j-import-stat-item"
601
- }, {
602
- default: u(() => [
603
- y("div", Ke, S(c.value.success), 1),
604
- s[6] || (s[6] = y("div", { class: "j-import-stat-label" }, "成功数量", -1))
605
- ]),
606
- _: 1
607
- })
608
- ]),
609
- _: 1
610
- })
611
- ]),
612
- _: 1
613
- }),
614
- f(M, {
615
- span: 6,
616
- class: "j-import-confirm-col"
506
+ return (h, o) => (r(), y(n(Ve), {
507
+ modelValue: a.value,
508
+ "onUpdate:modelValue": o[0] || (o[0] = (w) => a.value = w),
509
+ title: t.title,
510
+ width: "900px",
511
+ "close-on-click-modal": !1,
512
+ onOpen: J,
513
+ onClose: E
514
+ }, {
515
+ footer: d(() => [
516
+ f(n(_), { onClick: E }, {
517
+ default: d(() => [...o[9] || (o[9] = [
518
+ A("关闭", -1)
519
+ ])]),
520
+ _: 1
521
+ })
522
+ ]),
523
+ default: d(() => [
524
+ f(n(be), {
525
+ shadow: "never",
526
+ class: "j-import-upload-card"
527
+ }, {
528
+ default: d(() => [
529
+ o[3] || (o[3] = k("div", { class: "j-import-upload-card-title" }, "导入 EXCEL", -1)),
530
+ f(n(Fe), { style: { margin: "10px 0" } }),
531
+ k("div", rt, [
532
+ f(n(le), {
533
+ accept: ".xlsx,.xls",
534
+ "auto-upload": !1,
535
+ "show-file-list": !1,
536
+ "on-change": T
617
537
  }, {
618
- default: u(() => [
619
- f(R, {
620
- type: "primary",
621
- size: "small",
622
- loading: o.value,
623
- disabled: !r.value.length,
624
- onClick: g
625
- }, {
626
- default: u(() => [...s[7] || (s[7] = [
627
- D(" 确认导入 ", -1)
538
+ default: d(() => [
539
+ f(n(_), { size: "small" }, {
540
+ default: d(() => [...o[1] || (o[1] = [
541
+ A("点击上传", -1)
628
542
  ])]),
629
543
  _: 1
630
- }, 8, ["loading", "disabled"])
631
- ]),
632
- _: 1
633
- })
634
- ]),
635
- _: 1
636
- }),
637
- f(L, {
638
- data: r.value,
639
- border: "",
640
- size: "small",
641
- "max-height": "360",
642
- class: "j-import-data-table"
643
- }, {
644
- default: u(() => [
645
- (d(!0), I(Z, null, Q(_.value, (A) => (d(), b(z, {
646
- key: A.prop,
647
- prop: A.prop,
648
- label: A.label,
649
- "min-width": 120,
650
- "show-overflow-tooltip": ""
651
- }, null, 8, ["prop", "label"]))), 128)),
652
- f(z, {
653
- label: "状态",
654
- width: "110",
655
- align: "center",
656
- fixed: "right"
657
- }, {
658
- default: u(({ row: A }) => [
659
- A._status === -1 ? (d(), I("span", Xe, S(A._error || "创建失败"), 1)) : (d(), I("span", Ze, S(h[A._status]), 1))
544
+ })
660
545
  ]),
661
546
  _: 1
662
547
  }),
663
- f(z, {
664
- label: "操作",
665
- width: "80",
666
- align: "center",
667
- fixed: "right"
548
+ p.value.length ? (r(), y(n(De), {
549
+ key: 0,
550
+ type: "primary",
551
+ class: "j-import-no-wrap",
552
+ onClick: B
668
553
  }, {
669
- default: u(({ $index: A, row: q }) => [
670
- q._status === 0 ? (d(), b(R, {
671
- key: 0,
672
- size: "small",
673
- onClick: (oe) => j(A)
674
- }, {
675
- default: u(() => [...s[8] || (s[8] = [
676
- D(" 删除 ", -1)
677
- ])]),
678
- _: 1
679
- }, 8, ["onClick"])) : C("", !0)
680
- ]),
554
+ default: d(() => [...o[2] || (o[2] = [
555
+ A(" 下载导入模板.xlsx ", -1)
556
+ ])]),
681
557
  _: 1
682
- })
683
- ]),
684
- _: 1
685
- }, 8, ["data"])
686
- ]),
687
- _: 1
688
- }, 8, ["modelValue", "title"]);
689
- };
558
+ })) : C("", !0)
559
+ ])
560
+ ]),
561
+ _: 1
562
+ }),
563
+ f(n(me), {
564
+ class: "j-import-stats-row",
565
+ gutter: 20,
566
+ align: "middle"
567
+ }, {
568
+ default: d(() => [
569
+ f(n(X), { span: 18 }, {
570
+ default: d(() => [
571
+ f(n(me), { class: "j-import-stats-cols" }, {
572
+ default: d(() => [
573
+ f(n(X), {
574
+ span: 4,
575
+ class: "j-import-stat-item"
576
+ }, {
577
+ default: d(() => [
578
+ k("div", ct, I(c.value.total), 1),
579
+ o[4] || (o[4] = k("div", { class: "j-import-stat-label" }, "导入数量", -1))
580
+ ]),
581
+ _: 1
582
+ }),
583
+ f(n(X), {
584
+ span: 4,
585
+ class: "j-import-stat-item"
586
+ }, {
587
+ default: d(() => [
588
+ k("div", mt, I(c.value.fail), 1),
589
+ o[5] || (o[5] = k("div", { class: "j-import-stat-label" }, "失败数量", -1))
590
+ ]),
591
+ _: 1
592
+ }),
593
+ f(n(X), {
594
+ span: 4,
595
+ class: "j-import-stat-item"
596
+ }, {
597
+ default: d(() => [
598
+ k("div", ft, I(c.value.success), 1),
599
+ o[6] || (o[6] = k("div", { class: "j-import-stat-label" }, "成功数量", -1))
600
+ ]),
601
+ _: 1
602
+ })
603
+ ]),
604
+ _: 1
605
+ })
606
+ ]),
607
+ _: 1
608
+ }),
609
+ f(n(X), {
610
+ span: 6,
611
+ class: "j-import-confirm-col"
612
+ }, {
613
+ default: d(() => [
614
+ f(n(_), {
615
+ type: "primary",
616
+ size: "small",
617
+ loading: i.value,
618
+ disabled: !m.value.length,
619
+ onClick: b
620
+ }, {
621
+ default: d(() => [...o[7] || (o[7] = [
622
+ A(" 确认导入 ", -1)
623
+ ])]),
624
+ _: 1
625
+ }, 8, ["loading", "disabled"])
626
+ ]),
627
+ _: 1
628
+ })
629
+ ]),
630
+ _: 1
631
+ }),
632
+ f(n(Je), {
633
+ data: m.value,
634
+ border: "",
635
+ size: "small",
636
+ "max-height": "360",
637
+ class: "j-import-data-table"
638
+ }, {
639
+ default: d(() => [
640
+ (r(!0), x(G, null, Y(p.value, (w) => (r(), y(n(ae), {
641
+ key: w.prop,
642
+ prop: w.prop,
643
+ label: w.label,
644
+ "min-width": 120,
645
+ "show-overflow-tooltip": ""
646
+ }, null, 8, ["prop", "label"]))), 128)),
647
+ f(n(ae), {
648
+ label: "状态",
649
+ width: "110",
650
+ align: "center",
651
+ fixed: "right"
652
+ }, {
653
+ default: d(({ row: w }) => [
654
+ w._status === -1 ? (r(), x("span", pt, I(w._error || "创建失败"), 1)) : (r(), x("span", ht, I(v[w._status]), 1))
655
+ ]),
656
+ _: 1
657
+ }),
658
+ f(n(ae), {
659
+ label: "操作",
660
+ width: "80",
661
+ align: "center",
662
+ fixed: "right"
663
+ }, {
664
+ default: d(({ $index: w, row: R }) => [
665
+ R._status === 0 ? (r(), y(n(_), {
666
+ key: 0,
667
+ size: "small",
668
+ onClick: (g) => $(w)
669
+ }, {
670
+ default: d(() => [...o[8] || (o[8] = [
671
+ A(" 删除 ", -1)
672
+ ])]),
673
+ _: 1
674
+ }, 8, ["onClick"])) : C("", !0)
675
+ ]),
676
+ _: 1
677
+ })
678
+ ]),
679
+ _: 1
680
+ }, 8, ["data"])
681
+ ]),
682
+ _: 1
683
+ }, 8, ["modelValue", "title"]));
690
684
  }
691
- }), Qe = /* @__PURE__ */ W(Ge, [["__scopeId", "data-v-bd8f8139"]]), Ye = { class: "j-sidebar__menu-item-title" }, et = /* @__PURE__ */ N({
685
+ }), gt = /* @__PURE__ */ W(vt, [["__scopeId", "data-v-74dcefaa"]]), yt = { class: "j-sidebar__menu-item-title" }, bt = /* @__PURE__ */ z({
692
686
  name: "JSideMenuItem",
693
687
  __name: "JSideMenuItem",
694
688
  props: {
@@ -697,45 +691,45 @@ const Re = ["disabled"], Ie = {
697
691
  depth: { default: 0 }
698
692
  },
699
693
  emits: ["menu-click"],
700
- setup(e, { emit: a }) {
701
- const t = e, l = a, n = () => {
694
+ setup(e, { emit: s }) {
695
+ const t = e, l = s, a = () => {
702
696
  l("menu-click", t.menuItem);
703
697
  };
704
- return (o, i) => {
705
- const r = w("JSideMenuItem", !0), c = w("el-sub-menu"), h = w("el-menu-item");
706
- return e.menuItem.children && e.menuItem.children.length > 0 ? (d(), b(c, {
698
+ return (i, u) => {
699
+ const m = Me("JSideMenuItem", !0);
700
+ return e.menuItem.children && e.menuItem.children.length > 0 ? (r(), y(n(_e), {
707
701
  key: 0,
708
702
  index: e.menuItem.path,
709
703
  class: U([`j-sidebar__depth-${e.depth}`])
710
704
  }, {
711
- title: u(() => [
712
- e.menuItem.icon && e.depth === 0 ? (d(), b(x(X), {
705
+ title: d(() => [
706
+ e.menuItem.icon && e.depth === 0 ? (r(), y(n(Z), {
713
707
  key: 0,
714
708
  icon: e.menuItem.icon
715
709
  }, null, 8, ["icon"])) : C("", !0),
716
- y("span", Ye, S(e.menuItem.title || e.menuItem.name), 1)
710
+ k("span", yt, I(e.menuItem.title || e.menuItem.name), 1)
717
711
  ]),
718
- default: u(() => [
719
- (d(!0), I(Z, null, Q(e.menuItem.children, (_) => (d(), b(r, {
720
- key: _.path,
721
- "menu-item": _,
712
+ default: d(() => [
713
+ (r(!0), x(G, null, Y(e.menuItem.children, (c) => (r(), y(m, {
714
+ key: c.path,
715
+ "menu-item": c,
722
716
  "is-collapse": e.isCollapse,
723
717
  depth: e.depth + 1,
724
- onMenuClick: i[0] || (i[0] = (O) => l("menu-click", O))
718
+ onMenuClick: u[0] || (u[0] = (v) => l("menu-click", v))
725
719
  }, null, 8, ["menu-item", "is-collapse", "depth"]))), 128))
726
720
  ]),
727
721
  _: 1
728
- }, 8, ["index", "class"])) : (d(), b(h, {
722
+ }, 8, ["index", "class"])) : (r(), y(n(ke), {
729
723
  key: 1,
730
724
  index: e.menuItem.path,
731
725
  class: U([`j-sidebar__depth-${e.depth}`]),
732
- onClick: n
726
+ onClick: a
733
727
  }, {
734
- title: u(() => [
735
- y("span", null, S(e.menuItem.title || e.menuItem.name), 1)
728
+ title: d(() => [
729
+ k("span", null, I(e.menuItem.title || e.menuItem.name), 1)
736
730
  ]),
737
- default: u(() => [
738
- e.menuItem.icon && e.depth === 0 ? (d(), b(x(X), {
731
+ default: d(() => [
732
+ e.menuItem.icon && e.depth === 0 ? (r(), y(n(Z), {
739
733
  key: 0,
740
734
  icon: e.menuItem.icon
741
735
  }, null, 8, ["icon"])) : C("", !0)
@@ -744,7 +738,7 @@ const Re = ["disabled"], Ie = {
744
738
  }, 8, ["index", "class"]));
745
739
  };
746
740
  }
747
- }), fe = /* @__PURE__ */ W(et, [["__scopeId", "data-v-3787a646"]]), tt = { class: "j-sidebar__logo" }, nt = { class: "j-sidebar__title" }, lt = { class: "j-sidebar__menu-wrapper" }, at = { class: "j-sidebar__footer" }, ot = /* @__PURE__ */ N({
741
+ }), $e = /* @__PURE__ */ W(bt, [["__scopeId", "data-v-3a990426"]]), kt = { class: "j-sidebar__logo" }, wt = { class: "j-sidebar__title" }, Ct = { class: "j-sidebar__menu-wrapper" }, $t = { class: "j-sidebar__footer" }, jt = /* @__PURE__ */ z({
748
742
  name: "JSidebar",
749
743
  __name: "JSidebar",
750
744
  props: {
@@ -758,69 +752,66 @@ const Re = ["disabled"], Ie = {
758
752
  router: { type: Boolean, default: !0 }
759
753
  },
760
754
  emits: ["update:collapsed", "menu-click"],
761
- setup(e, { emit: a }) {
762
- const t = e, l = a, n = F(t.collapsed);
763
- ce(() => t.collapsed, (i) => {
764
- n.value = i;
755
+ setup(e, { emit: s }) {
756
+ const t = e, l = s, a = M(t.collapsed);
757
+ ye(() => t.collapsed, (u) => {
758
+ a.value = u;
765
759
  });
766
- const o = () => {
767
- n.value = !n.value, l("update:collapsed", n.value);
768
- };
769
- return (i, r) => {
770
- const c = w("el-menu");
771
- return d(), I("div", {
772
- class: U(["j-sidebar", n.value ? "j-sidebar--collapsed" : "j-sidebar--expanded"]),
773
- style: le({ width: n.value ? `${e.collapsedWidth}px` : `${e.expandedWidth}px` })
774
- }, [
775
- y("div", tt, [
776
- P(i.$slots, "logo", { collapsed: n.value }, () => {
777
- var h;
778
- return [
779
- y("h2", nt, S(n.value ? e.collapsedTitle || ((h = e.title) == null ? void 0 : h.charAt(0)) || "" : e.title), 1)
780
- ];
781
- }, !0)
782
- ]),
783
- y("div", lt, [
784
- f(c, {
785
- "default-active": e.activeMenu,
786
- class: "j-sidebar__menu",
787
- router: e.router,
788
- collapse: n.value,
789
- "collapse-transition": !1
790
- }, {
791
- default: u(() => [
792
- (d(!0), I(Z, null, Q(e.menus, (h) => (d(), b(fe, {
793
- key: h.path,
794
- "menu-item": h,
795
- "is-collapse": n.value,
796
- onMenuClick: r[0] || (r[0] = (_) => l("menu-click", _))
797
- }, null, 8, ["menu-item", "is-collapse"]))), 128))
798
- ]),
799
- _: 1
800
- }, 8, ["default-active", "router", "collapse"])
801
- ]),
802
- y("div", at, [
803
- P(i.$slots, "footer", {
804
- collapsed: n.value,
805
- toggle: o
806
- }, () => [
807
- y("button", {
808
- class: "j-sidebar__collapse-btn",
809
- onClick: o
810
- }, [
811
- f(x(X), {
812
- icon: n.value ? "mdi:chevron-right" : "mdi:chevron-left"
813
- }, null, 8, ["icon"])
814
- ])
815
- ], !0)
816
- ])
817
- ], 6);
760
+ const i = () => {
761
+ a.value = !a.value, l("update:collapsed", a.value);
818
762
  };
763
+ return (u, m) => (r(), x("div", {
764
+ class: U(["j-sidebar", a.value ? "j-sidebar--collapsed" : "j-sidebar--expanded"]),
765
+ style: oe({ width: a.value ? `${e.collapsedWidth}px` : `${e.expandedWidth}px` })
766
+ }, [
767
+ k("div", kt, [
768
+ D(u.$slots, "logo", { collapsed: a.value }, () => {
769
+ var c;
770
+ return [
771
+ k("h2", wt, I(a.value ? e.collapsedTitle || ((c = e.title) == null ? void 0 : c.charAt(0)) || "" : e.title), 1)
772
+ ];
773
+ }, !0)
774
+ ]),
775
+ k("div", Ct, [
776
+ f(n(we), {
777
+ "default-active": e.activeMenu,
778
+ class: "j-sidebar__menu",
779
+ router: e.router,
780
+ collapse: a.value,
781
+ "collapse-transition": !1
782
+ }, {
783
+ default: d(() => [
784
+ (r(!0), x(G, null, Y(e.menus, (c) => (r(), y($e, {
785
+ key: c.path,
786
+ "menu-item": c,
787
+ "is-collapse": a.value,
788
+ onMenuClick: m[0] || (m[0] = (v) => l("menu-click", v))
789
+ }, null, 8, ["menu-item", "is-collapse"]))), 128))
790
+ ]),
791
+ _: 1
792
+ }, 8, ["default-active", "router", "collapse"])
793
+ ]),
794
+ k("div", $t, [
795
+ D(u.$slots, "footer", {
796
+ collapsed: a.value,
797
+ toggle: i
798
+ }, () => [
799
+ k("button", {
800
+ class: "j-sidebar__collapse-btn",
801
+ onClick: i
802
+ }, [
803
+ f(n(Z), {
804
+ icon: a.value ? "mdi:chevron-right" : "mdi:chevron-left"
805
+ }, null, 8, ["icon"])
806
+ ])
807
+ ], !0)
808
+ ])
809
+ ], 6));
819
810
  }
820
- }), pe = /* @__PURE__ */ W(ot, [["__scopeId", "data-v-2e746199"]]), st = { class: "j-admin-layout__right-panel" }, it = { class: "j-admin-layout__header" }, ut = { class: "j-admin-layout__header-left" }, dt = {
811
+ }), je = /* @__PURE__ */ W(jt, [["__scopeId", "data-v-a3fac9de"]]), Et = { class: "j-admin-layout__right-panel" }, xt = { class: "j-admin-layout__header" }, It = { class: "j-admin-layout__header-left" }, Rt = {
821
812
  key: 0,
822
813
  class: "j-admin-layout__logo"
823
- }, rt = { class: "j-admin-layout__header-right" }, ct = { class: "j-admin-layout__user" }, mt = { class: "j-admin-layout__content-container" }, ft = /* @__PURE__ */ N({
814
+ }, St = { class: "j-admin-layout__header-right" }, Mt = { class: "j-admin-layout__user" }, Bt = { class: "j-admin-layout__content-container" }, At = /* @__PURE__ */ z({
824
815
  name: "JAdminLayout",
825
816
  __name: "JAdminLayout",
826
817
  props: {
@@ -846,417 +837,415 @@ const Re = ["disabled"], Ie = {
846
837
  hideContentScrollbar: { type: Boolean, default: !1 }
847
838
  },
848
839
  emits: ["update:collapsed", "top-menu-select", "side-menu-click", "profile", "logout"],
849
- setup(e, { emit: a }) {
850
- const t = e, l = a, n = G({
840
+ setup(e, { emit: s }) {
841
+ const t = e, l = s, a = Q({
851
842
  get: () => t.collapsed,
852
843
  set: (c) => l("update:collapsed", c)
853
- }), o = G(() => ({
844
+ }), i = Q(() => ({
854
845
  "--j-admin-layout-header-height": t.headerHeight,
855
846
  "--j-admin-layout-content-padding": t.contentPadding,
856
847
  "--j-admin-layout-content-bg": t.contentBackground,
857
848
  "--j-admin-layout-header-bg": t.headerBackground
858
- })), i = (c) => {
849
+ })), u = (c) => {
859
850
  l("top-menu-select", c);
860
- }, r = (c) => {
851
+ }, m = (c) => {
861
852
  l("side-menu-click", c);
862
853
  };
863
- return (c, h) => {
864
- const _ = w("el-menu-item"), O = w("el-menu"), V = w("el-icon"), j = w("el-dropdown-item"), g = w("el-dropdown-menu"), J = w("el-dropdown");
865
- return d(), I("div", {
866
- class: "j-admin-layout",
867
- style: le(o.value)
868
- }, [
869
- e.sideMenus.length > 0 ? (d(), b(x(pe), {
870
- key: 0,
871
- collapsed: n.value,
872
- "onUpdate:collapsed": h[0] || (h[0] = (m) => n.value = m),
873
- menus: e.sideMenus,
874
- "active-menu": e.activeMenu,
875
- title: e.title,
876
- "collapsed-title": e.collapsedTitle,
877
- "collapsed-width": e.sidebarCollapsedWidth,
878
- "expanded-width": e.sidebarExpandedWidth,
879
- onMenuClick: r
880
- }, we({ _: 2 }, [
881
- c.$slots.sidebarFooter ? {
882
- name: "footer",
883
- fn: u(({ collapsed: m, toggle: p }) => [
884
- P(c.$slots, "sidebarFooter", {
885
- collapsed: m,
886
- toggle: p
887
- }, void 0, !0)
888
- ]),
889
- key: "0"
890
- } : void 0
891
- ]), 1032, ["collapsed", "menus", "active-menu", "title", "collapsed-title", "collapsed-width", "expanded-width"])) : C("", !0),
892
- y("div", st, [
893
- y("div", it, [
894
- y("div", ut, [
895
- e.sideMenus.length === 0 ? (d(), I("div", dt, [
896
- P(c.$slots, "logo", {}, () => [
897
- y("h2", null, S(e.logoTitle || e.title), 1)
898
- ], !0)
899
- ])) : C("", !0),
900
- f(O, {
901
- mode: "horizontal",
902
- "default-active": e.activeTopMenu,
903
- class: "j-admin-layout__top-menu",
904
- onSelect: i
905
- }, {
906
- default: u(() => [
907
- (d(!0), I(Z, null, Q(e.topMenus, (m) => (d(), b(_, {
908
- key: m.path,
909
- index: m.path
910
- }, {
911
- default: u(() => [
912
- f(x(X), {
913
- icon: m.icon || "ep:menu",
914
- class: "j-admin-layout__top-menu-icon"
915
- }, null, 8, ["icon"]),
916
- y("span", null, S(m.title || m.name), 1)
854
+ return (c, v) => (r(), x("div", {
855
+ class: "j-admin-layout",
856
+ style: oe(i.value)
857
+ }, [
858
+ e.sideMenus.length > 0 ? (r(), y(n(je), {
859
+ key: 0,
860
+ collapsed: a.value,
861
+ "onUpdate:collapsed": v[0] || (v[0] = (p) => a.value = p),
862
+ menus: e.sideMenus,
863
+ "active-menu": e.activeMenu,
864
+ title: e.title,
865
+ "collapsed-title": e.collapsedTitle,
866
+ "collapsed-width": e.sidebarCollapsedWidth,
867
+ "expanded-width": e.sidebarExpandedWidth,
868
+ onMenuClick: m
869
+ }, Be({ _: 2 }, [
870
+ c.$slots.sidebarFooter ? {
871
+ name: "footer",
872
+ fn: d(({ collapsed: p, toggle: J }) => [
873
+ D(c.$slots, "sidebarFooter", {
874
+ collapsed: p,
875
+ toggle: J
876
+ }, void 0, !0)
877
+ ]),
878
+ key: "0"
879
+ } : void 0
880
+ ]), 1032, ["collapsed", "menus", "active-menu", "title", "collapsed-title", "collapsed-width", "expanded-width"])) : C("", !0),
881
+ k("div", Et, [
882
+ k("div", xt, [
883
+ k("div", It, [
884
+ e.sideMenus.length === 0 ? (r(), x("div", Rt, [
885
+ D(c.$slots, "logo", {}, () => [
886
+ k("h2", null, I(e.logoTitle || e.title), 1)
887
+ ], !0)
888
+ ])) : C("", !0),
889
+ f(n(we), {
890
+ mode: "horizontal",
891
+ "default-active": e.activeTopMenu,
892
+ class: "j-admin-layout__top-menu",
893
+ onSelect: u
894
+ }, {
895
+ default: d(() => [
896
+ (r(!0), x(G, null, Y(e.topMenus, (p) => (r(), y(n(ke), {
897
+ key: p.path,
898
+ index: p.path
899
+ }, {
900
+ default: d(() => [
901
+ p.icon ? (r(), y(n(Z), {
902
+ key: 0,
903
+ icon: p.icon,
904
+ class: "j-admin-layout__top-menu-icon"
905
+ }, null, 8, ["icon"])) : C("", !0),
906
+ k("span", null, I(p.title || p.name), 1)
907
+ ]),
908
+ _: 2
909
+ }, 1032, ["index"]))), 128))
910
+ ]),
911
+ _: 1
912
+ }, 8, ["default-active"])
913
+ ]),
914
+ k("div", St, [
915
+ D(c.$slots, "headerRight", { username: e.username }, () => [
916
+ e.showProfile || e.showLogout ? (r(), y(n(Le), { key: 0 }, {
917
+ dropdown: d(() => [
918
+ f(n(Pe), null, {
919
+ default: d(() => [
920
+ e.showProfile ? (r(), y(n(fe), {
921
+ key: 0,
922
+ onClick: v[1] || (v[1] = (p) => l("profile"))
923
+ }, {
924
+ default: d(() => [
925
+ A(I(e.profileText), 1)
926
+ ]),
927
+ _: 1
928
+ })) : C("", !0),
929
+ e.showLogout ? (r(), y(n(fe), {
930
+ key: 1,
931
+ onClick: v[2] || (v[2] = (p) => l("logout"))
932
+ }, {
933
+ default: d(() => [
934
+ A(I(e.logoutText), 1)
935
+ ]),
936
+ _: 1
937
+ })) : C("", !0)
917
938
  ]),
918
- _: 2
919
- }, 1032, ["index"]))), 128))
939
+ _: 1
940
+ })
920
941
  ]),
921
- _: 1
922
- }, 8, ["default-active"])
923
- ]),
924
- y("div", rt, [
925
- P(c.$slots, "headerRight", { username: e.username }, () => [
926
- e.showProfile || e.showLogout ? (d(), b(J, { key: 0 }, {
927
- dropdown: u(() => [
928
- f(g, null, {
929
- default: u(() => [
930
- e.showProfile ? (d(), b(j, {
931
- key: 0,
932
- onClick: h[1] || (h[1] = (m) => l("profile"))
933
- }, {
934
- default: u(() => [
935
- D(S(e.profileText), 1)
936
- ]),
937
- _: 1
938
- })) : C("", !0),
939
- e.showLogout ? (d(), b(j, {
940
- key: 1,
941
- onClick: h[2] || (h[2] = (m) => l("logout"))
942
- }, {
943
- default: u(() => [
944
- D(S(e.logoutText), 1)
945
- ]),
946
- _: 1
947
- })) : C("", !0)
942
+ default: d(() => [
943
+ k("span", Mt, [
944
+ A(I(e.username) + " ", 1),
945
+ f(n(P), null, {
946
+ default: d(() => [
947
+ f(n(Ce))
948
948
  ]),
949
949
  _: 1
950
950
  })
951
- ]),
952
- default: u(() => [
953
- y("span", ct, [
954
- D(S(e.username) + " ", 1),
955
- f(V, null, {
956
- default: u(() => [
957
- f(x(me))
958
- ]),
959
- _: 1
960
- })
961
- ])
962
- ]),
963
- _: 1
964
- })) : C("", !0)
965
- ], !0)
966
- ])
967
- ]),
968
- y("div", mt, [
969
- P(c.$slots, "tabs", {}, void 0, !0),
970
- y("div", {
971
- class: U([
972
- "j-admin-layout__content",
973
- { "j-admin-layout__content--scrollbar-hidden": e.hideContentScrollbar }
974
- ])
975
- }, [
976
- P(c.$slots, "default", {}, void 0, !0)
977
- ], 2)
951
+ ])
952
+ ]),
953
+ _: 1
954
+ })) : C("", !0)
955
+ ], !0)
978
956
  ])
957
+ ]),
958
+ k("div", Bt, [
959
+ D(c.$slots, "tabs", {}, void 0, !0),
960
+ k("div", {
961
+ class: U([
962
+ "j-admin-layout__content",
963
+ { "j-admin-layout__content--scrollbar-hidden": e.hideContentScrollbar }
964
+ ])
965
+ }, [
966
+ D(c.$slots, "default", {}, void 0, !0)
967
+ ], 2)
979
968
  ])
980
- ], 4);
981
- };
969
+ ])
970
+ ], 4));
982
971
  }
983
- }), pt = /* @__PURE__ */ W(ft, [["__scopeId", "data-v-f36e5274"]]);
984
- function ae(e, a) {
985
- return Array.isArray(e) ? e.map((t) => ae(t, a)) : e !== null && typeof e == "object" && !(e instanceof Date) ? a(e) : e;
972
+ }), Tt = /* @__PURE__ */ W(At, [["__scopeId", "data-v-51b44ebf"]]);
973
+ function ue(e, s) {
974
+ return Array.isArray(e) ? e.map((t) => ue(t, s)) : e !== null && typeof e == "object" && !(e instanceof Date) ? s(e) : e;
986
975
  }
987
- function ht(e, a = []) {
976
+ function Vt(e, s = []) {
988
977
  return Object.fromEntries(
989
978
  Object.entries(e).map(([t, l]) => {
990
- const n = ae(l, (i) => ht(i, a));
991
- return a.includes(t) ? [t, n] : [t.replace(/([A-Z])/g, "_$1").toLowerCase(), n];
979
+ const a = ue(l, (u) => Vt(u, s));
980
+ return s.includes(t) ? [t, a] : [t.replace(/([A-Z])/g, "_$1").toLowerCase(), a];
992
981
  })
993
982
  );
994
983
  }
995
- function vt(e, a = []) {
984
+ function Ft(e, s = []) {
996
985
  return Object.fromEntries(
997
986
  Object.entries(e).map(([t, l]) => {
998
- const n = ae(l, (i) => vt(i, a));
999
- return a.includes(t) ? [t, n] : [t.replace(/_([a-z])/g, (i, r) => r.toUpperCase()), n];
987
+ const a = ue(l, (u) => Ft(u, s));
988
+ return s.includes(t) ? [t, a] : [t.replace(/_([a-z])/g, (u, m) => m.toUpperCase()), a];
1000
989
  })
1001
990
  );
1002
991
  }
1003
- function Bt(e, a) {
992
+ function Xt(e, s) {
1004
993
  const t = {};
1005
- for (const l of a)
994
+ for (const l of s)
1006
995
  l in e && (t[l] = e[l]);
1007
996
  return t;
1008
997
  }
1009
- function Mt(e, a) {
998
+ function Zt(e, s) {
1010
999
  const t = { ...e };
1011
- for (const l of a)
1000
+ for (const l of s)
1012
1001
  delete t[l];
1013
1002
  return t;
1014
1003
  }
1015
- function ue(e) {
1004
+ function he(e) {
1016
1005
  if (e === null || typeof e != "object") return e;
1017
1006
  if (e instanceof Date) return new Date(e.getTime());
1018
1007
  if (e instanceof RegExp) return new RegExp(e.source, e.flags);
1019
- if (Array.isArray(e)) return e.map((t) => ue(t));
1020
- const a = {};
1008
+ if (Array.isArray(e)) return e.map((t) => he(t));
1009
+ const s = {};
1021
1010
  for (const t of Object.keys(e))
1022
- a[t] = ue(e[t]);
1023
- return a;
1011
+ s[t] = he(e[t]);
1012
+ return s;
1024
1013
  }
1025
- function gt(e, a = !1) {
1014
+ function Dt(e, s = !1) {
1026
1015
  const t = {};
1027
- for (const [l, n] of Object.entries(e))
1028
- if (!(n == null || n === ""))
1029
- if (a && typeof n == "object" && !Array.isArray(n) && !(n instanceof Date)) {
1030
- const o = gt(n, !0);
1031
- Object.keys(o).length > 0 && (t[l] = o);
1016
+ for (const [l, a] of Object.entries(e))
1017
+ if (!(a == null || a === ""))
1018
+ if (s && typeof a == "object" && !Array.isArray(a) && !(a instanceof Date)) {
1019
+ const i = Dt(a, !0);
1020
+ Object.keys(i).length > 0 && (t[l] = i);
1032
1021
  } else
1033
- t[l] = n;
1022
+ t[l] = a;
1034
1023
  return t;
1035
1024
  }
1036
- function yt(e, a = "", t = ".") {
1025
+ function Jt(e, s = "", t = ".") {
1037
1026
  const l = {};
1038
- for (const [n, o] of Object.entries(e)) {
1039
- const i = a ? `${a}${t}${n}` : n;
1040
- o !== null && typeof o == "object" && !Array.isArray(o) && !(o instanceof Date) ? Object.assign(l, yt(o, i, t)) : l[i] = o;
1027
+ for (const [a, i] of Object.entries(e)) {
1028
+ const u = s ? `${s}${t}${a}` : a;
1029
+ i !== null && typeof i == "object" && !Array.isArray(i) && !(i instanceof Date) ? Object.assign(l, Jt(i, u, t)) : l[u] = i;
1041
1030
  }
1042
1031
  return l;
1043
1032
  }
1044
- function At(e, a = ".") {
1033
+ function Gt(e, s = ".") {
1045
1034
  const t = {};
1046
- for (const [l, n] of Object.entries(e)) {
1047
- const o = l.split(a);
1048
- let i = t;
1049
- for (let r = 0; r < o.length - 1; r++) {
1050
- const c = o[r];
1051
- c in i || (i[c] = {}), i = i[c];
1035
+ for (const [l, a] of Object.entries(e)) {
1036
+ const i = l.split(s);
1037
+ let u = t;
1038
+ for (let m = 0; m < i.length - 1; m++) {
1039
+ const c = i[m];
1040
+ c in u || (u[c] = {}), u = u[c];
1052
1041
  }
1053
- i[o[o.length - 1]] = n;
1042
+ u[i[i.length - 1]] = a;
1054
1043
  }
1055
1044
  return t;
1056
1045
  }
1057
- function Et(e) {
1058
- return Object.entries(e).map(([a, t]) => ({
1059
- id: a,
1046
+ function Qt(e) {
1047
+ return Object.entries(e).map(([s, t]) => ({
1048
+ id: s,
1060
1049
  label: t,
1061
- prop: a
1050
+ prop: s
1062
1051
  }));
1063
1052
  }
1064
- function bt(e, a) {
1053
+ function _t(e, s) {
1065
1054
  if (!e) return null;
1066
1055
  let t = e.replace(/^@\//, "");
1067
1056
  t.startsWith("views/") || (t = `views/${t}`), t.endsWith(".vue") || (t = `${t}.vue`);
1068
1057
  const l = `/src/${t}`;
1069
- return a[l] ?? a["/src/views/common/NotFound.vue"] ?? null;
1058
+ return s[l] ?? s["/src/views/common/NotFound.vue"] ?? null;
1070
1059
  }
1071
- function _t(e) {
1072
- const a = /* @__PURE__ */ new Map(), t = [];
1073
- return e.forEach((l) => a.set(l.name, { ...l, children: [] })), e.forEach((l) => {
1074
- const n = a.get(l.name);
1060
+ function Lt(e) {
1061
+ const s = /* @__PURE__ */ new Map(), t = [];
1062
+ return e.forEach((l) => s.set(l.name, { ...l, children: [] })), e.forEach((l) => {
1063
+ const a = s.get(l.name);
1075
1064
  if (!l.parent_name)
1076
- t.push(n);
1065
+ t.push(a);
1077
1066
  else {
1078
- const o = a.get(l.parent_name);
1079
- o ? (o.children ?? (o.children = []), o.children.push(n)) : t.push(n);
1067
+ const i = s.get(l.parent_name);
1068
+ i ? (i.children ?? (i.children = []), i.children.push(a)) : t.push(a);
1080
1069
  }
1081
1070
  }), t;
1082
1071
  }
1083
- function he(e, a, t) {
1072
+ function Ee(e, s, t) {
1084
1073
  return e.filter((l) => !t || !l.project || l.project === t).map((l) => {
1085
- var i;
1086
- const n = {
1074
+ var u;
1075
+ const a = {
1087
1076
  path: l.path,
1088
1077
  name: l.name,
1089
1078
  meta: {
1090
1079
  requiresAuth: l.requiresAuth === 1,
1091
1080
  title: l.title,
1092
- permissions: l.permissions ? l.permissions.split(",").map((r) => r.trim()).filter(Boolean) : [],
1093
- params: l.params ? l.params.split("&").map((r) => r.trim()).filter(Boolean) : []
1081
+ permissions: l.permissions ? l.permissions.split(",").map((m) => m.trim()).filter(Boolean) : [],
1082
+ params: l.params ? l.params.split("&").map((m) => m.trim()).filter(Boolean) : []
1094
1083
  }
1095
- }, o = bt(l.component, a);
1096
- return o && (n.component = o), l.redirect && (n.redirect = l.redirect), (i = l.children) != null && i.length && (n.children = he(l.children, a, t)), n;
1084
+ }, i = _t(l.component, s);
1085
+ return i && (a.component = i), l.redirect && (a.redirect = l.redirect), (u = l.children) != null && u.length && (a.children = Ee(l.children, s, t)), a;
1097
1086
  });
1098
1087
  }
1099
- function Tt(e, a, t, l) {
1100
- const n = /* @__PURE__ */ new Map();
1101
- e.forEach((i) => n.set(i.name, i));
1102
- const o = (i) => {
1103
- let r = i.parent_name;
1088
+ function Yt(e, s, t, l) {
1089
+ const a = /* @__PURE__ */ new Map();
1090
+ e.forEach((u) => a.set(u.name, u));
1091
+ const i = (u) => {
1092
+ let m = u.parent_name;
1104
1093
  const c = /* @__PURE__ */ new Set();
1105
- for (; r; ) {
1106
- if (r === t) return !0;
1107
- if (c.has(r)) return !1;
1108
- c.add(r);
1109
- const h = n.get(r);
1110
- if (!h) return !1;
1111
- r = h.parent_name;
1094
+ for (; m; ) {
1095
+ if (m === t) return !0;
1096
+ if (c.has(m)) return !1;
1097
+ c.add(m);
1098
+ const v = a.get(m);
1099
+ if (!v) return !1;
1100
+ m = v.parent_name;
1112
1101
  }
1113
1102
  return !1;
1114
1103
  };
1115
1104
  return e.filter(
1116
- (i) => i.name !== t && i.is_show === 1 && i.component && a.includes(i.code) && o(i) && (!l || !i.project || i.project === l)
1117
- ).sort((i, r) => i.sorts - r.sorts)[0];
1105
+ (u) => u.name !== t && u.is_show === 1 && u.component && s.includes(u.code) && i(u) && (!l || !u.project || u.project === l)
1106
+ ).sort((u, m) => u.sorts - m.sorts)[0];
1118
1107
  }
1119
- ne.configure({ showSpinner: !1 });
1120
- const de = (...e) => {
1121
- }, re = (...e) => {
1122
- }, wt = (...e) => {
1108
+ ie.configure({ showSpinner: !1 });
1109
+ const ve = (...e) => {
1110
+ }, ge = (...e) => {
1111
+ }, Pt = (...e) => {
1123
1112
  console.error("[Router]", ...e);
1124
1113
  };
1125
- function Vt(e, a) {
1114
+ function ea(e, s) {
1126
1115
  const {
1127
1116
  getRouteStore: t,
1128
1117
  getPermissionStore: l,
1129
- getUserStore: n,
1130
- isAuthenticated: o,
1131
- viewModules: i,
1132
- homeComponent: r,
1118
+ getUserStore: a,
1119
+ isAuthenticated: i,
1120
+ viewModules: u,
1121
+ homeComponent: m,
1133
1122
  notFoundComponent: c,
1134
- projectName: h,
1135
- layoutRouteName: _ = "Layout",
1136
- publicPaths: O = ["/login", "/register"],
1137
- loginRouteName: V = "login",
1138
- forbiddenRouteName: j = "Forbidden",
1139
- homeRouteName: g = "Home",
1140
- homeRoutePath: J = "home",
1141
- homeTitle: m = "首页",
1142
- noPermissionMessage: p = "暂无权限"
1143
- } = a;
1144
- let s = !1;
1145
- function $(v) {
1146
- const k = _t(v).find((T) => T.name === _), M = k != null && k.children ? he(k.children, i, h) : [];
1147
- M.forEach((T) => {
1148
- T.name && e.hasRoute(T.name) || (e.addRoute(_, T), de(`Add route: ${String(T.name)} -> ${T.path}`));
1149
- }), e.hasRoute(g) || e.addRoute(_, {
1150
- path: J,
1151
- name: g,
1152
- component: r,
1153
- meta: { title: m }
1123
+ projectName: v,
1124
+ layoutRouteName: p = "Layout",
1125
+ publicPaths: J = ["/login", "/register"],
1126
+ loginRouteName: T = "login",
1127
+ forbiddenRouteName: $ = "Forbidden",
1128
+ homeRouteName: b = "Home",
1129
+ homeRoutePath: B = "home",
1130
+ homeTitle: E = "首页",
1131
+ noPermissionMessage: h = "暂无权限"
1132
+ } = s;
1133
+ let o = !1;
1134
+ function w(g) {
1135
+ const j = Lt(g).find((V) => V.name === p), O = j != null && j.children ? Ee(j.children, u, v) : [];
1136
+ O.forEach((V) => {
1137
+ V.name && e.hasRoute(V.name) || (e.addRoute(p, V), ve(`Add route: ${String(V.name)} -> ${V.path}`));
1138
+ }), e.hasRoute(b) || e.addRoute(p, {
1139
+ path: B,
1140
+ name: b,
1141
+ component: m,
1142
+ meta: { title: E }
1154
1143
  }), e.hasRoute("NotFound") || e.addRoute({
1155
1144
  path: "/:pathMatch(.*)*",
1156
1145
  name: "NotFound",
1157
1146
  component: c
1158
- }), de(`Dynamic routes added: ${M.length}`);
1147
+ }), ve(`Dynamic routes added: ${O.length}`);
1159
1148
  }
1160
- function R(v, E) {
1161
- if (v === g) {
1162
- E();
1149
+ function R(g, L) {
1150
+ if (g === b) {
1151
+ L();
1163
1152
  return;
1164
1153
  }
1165
- e.hasRoute(g) ? E({ name: g, replace: !0 }) : E();
1154
+ e.hasRoute(b) ? L({ name: b, replace: !0 }) : L();
1166
1155
  }
1167
- return e.beforeEach(async (v, E, k) => {
1168
- if (ne.start(), o() && !s)
1156
+ return e.beforeEach(async (g, L, j) => {
1157
+ if (ie.start(), i() && !o)
1169
1158
  try {
1170
- const L = t(), H = l();
1171
- if (await L.initRoutes(), await H.loadUserPermissions(), $(L.backendRoutes), s = !0, v.path === "/" || v.path === "") {
1172
- R(v.name, k);
1159
+ const F = t(), H = l();
1160
+ if (await F.initRoutes(), await H.loadUserPermissions(), w(F.backendRoutes), o = !0, g.path === "/" || g.path === "") {
1161
+ R(g.name, j);
1173
1162
  return;
1174
1163
  }
1175
- if (v.name === _) {
1176
- R(v.name, k);
1164
+ if (g.name === p) {
1165
+ R(g.name, j);
1177
1166
  return;
1178
1167
  }
1179
- const A = L.backendRoutes.find((q) => q.name === v.name);
1180
- if (A && !H.routePermissions.includes(A.code)) {
1181
- re("No route permission:", v.path), k({ name: j, replace: !0 });
1168
+ const N = F.backendRoutes.find((ee) => ee.name === g.name);
1169
+ if (N && !H.routePermissions.includes(N.code)) {
1170
+ ge("No route permission:", g.path), j({ name: $, replace: !0 });
1182
1171
  return;
1183
1172
  }
1184
- k({
1185
- path: v.path,
1186
- query: v.query,
1187
- hash: v.hash,
1173
+ j({
1174
+ path: g.path,
1175
+ query: g.query,
1176
+ hash: g.hash,
1188
1177
  replace: !0
1189
1178
  });
1190
1179
  return;
1191
- } catch (L) {
1192
- wt("Failed to load route permissions:", L), s = !1, await n().logout(), k({ name: V, replace: !0 });
1180
+ } catch (F) {
1181
+ Pt("Failed to load route permissions:", F), o = !1, await a().logout(), j({ name: T, replace: !0 });
1193
1182
  return;
1194
1183
  }
1195
- if (O.includes(v.path)) {
1196
- o() ? k({ path: "/", replace: !0 }) : k();
1184
+ if (J.includes(g.path)) {
1185
+ i() ? j({ path: "/", replace: !0 }) : j();
1197
1186
  return;
1198
1187
  }
1199
- if (!o()) {
1200
- k({ name: V, replace: !0 });
1188
+ if (!i()) {
1189
+ j({ name: T, replace: !0 });
1201
1190
  return;
1202
1191
  }
1203
- const M = l(), T = t();
1204
- if (v.name === g) {
1205
- k();
1192
+ const O = l(), V = t();
1193
+ if (g.name === b) {
1194
+ j();
1206
1195
  return;
1207
1196
  }
1208
- if (M.routePermissions.length === 0) {
1209
- v.path !== "/" ? (B.warning(p), k({ path: "/", replace: !0 })) : R(v.name, k);
1197
+ if (O.routePermissions.length === 0) {
1198
+ g.path !== "/" ? (S.warning(h), j({ path: "/", replace: !0 })) : R(g.name, j);
1210
1199
  return;
1211
1200
  }
1212
- if (v.path === "/") {
1213
- R(v.name, k);
1201
+ if (g.path === "/") {
1202
+ R(g.name, j);
1214
1203
  return;
1215
1204
  }
1216
- if (v.name === _) {
1217
- R(v.name, k);
1205
+ if (g.name === p) {
1206
+ R(g.name, j);
1218
1207
  return;
1219
1208
  }
1220
- const z = T.backendRoutes.find((L) => L.name === v.name);
1221
- if (z && !M.routePermissions.includes(z.code)) {
1222
- re("No route permission:", v.path), k({ name: j, replace: !0 });
1209
+ const K = V.backendRoutes.find((F) => F.name === g.name);
1210
+ if (K && !O.routePermissions.includes(K.code)) {
1211
+ ge("No route permission:", g.path), j({ name: $, replace: !0 });
1223
1212
  return;
1224
1213
  }
1225
- k();
1226
- }), e.afterEach(() => ne.done()), {
1214
+ j();
1215
+ }), e.afterEach(() => ie.done()), {
1227
1216
  resetRouterState: () => {
1228
- s = !1;
1217
+ o = !1;
1229
1218
  }
1230
1219
  };
1231
1220
  }
1232
- const kt = [Me, Pe, X, Ne, Qe, pe, fe, pt], jt = (e) => {
1233
- kt.forEach((a) => {
1234
- e.component(a.name ?? a.__name ?? "", a);
1221
+ const zt = [Ze, it, Z, dt, gt, je, $e, Tt], Ot = (e) => {
1222
+ zt.forEach((s) => {
1223
+ e.component(s.name ?? s.__name ?? "", s);
1235
1224
  });
1236
- }, Ft = { install: jt };
1225
+ }, ta = { install: Ot };
1237
1226
  export {
1238
- pt as JAdminLayout,
1239
- Me as JButton,
1240
- X as JIconRender,
1241
- Qe as JImportExcel,
1242
- Ne as JSearchHeader,
1243
- fe as JSideMenuItem,
1244
- pe as JSidebar,
1245
- Pe as JUploadImg,
1246
- _t as buildRouteTree,
1247
- Vt as createRouterGuard,
1248
- ue as deepClone,
1249
- Ft as default,
1250
- gt as filterEmpty,
1251
- Tt as findFirstAllowedRoute,
1252
- yt as flatten,
1253
- bt as getComponentImport,
1254
- Mt as omit,
1255
- Bt as pick,
1256
- vt as toCamelCase,
1257
- ht as toSnakeCase,
1258
- Et as toTableColumns,
1259
- he as transformBackendRoutes,
1260
- At as unflatten
1227
+ Tt as JAdminLayout,
1228
+ Ze as JButton,
1229
+ Z as JIconRender,
1230
+ gt as JImportExcel,
1231
+ dt as JSearchHeader,
1232
+ $e as JSideMenuItem,
1233
+ je as JSidebar,
1234
+ it as JUploadImg,
1235
+ Lt as buildRouteTree,
1236
+ ea as createRouterGuard,
1237
+ he as deepClone,
1238
+ ta as default,
1239
+ Dt as filterEmpty,
1240
+ Yt as findFirstAllowedRoute,
1241
+ Jt as flatten,
1242
+ _t as getComponentImport,
1243
+ Zt as omit,
1244
+ Xt as pick,
1245
+ Ft as toCamelCase,
1246
+ Vt as toSnakeCase,
1247
+ Qt as toTableColumns,
1248
+ Ee as transformBackendRoutes,
1249
+ Gt as unflatten
1261
1250
  };
1262
1251
  //# sourceMappingURL=index.js.map