jgy-public-component 0.0.17 → 0.0.18

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