jgy-public-component 0.0.10 → 0.0.12

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
@@ -81,26 +81,26 @@ const xe = ["disabled"], Re = {
81
81
  a.value = !0;
82
82
  }, _ = () => {
83
83
  l.value = "", n("update:modelValue", ""), R.success("删除成功");
84
- }, h = A([]), v = A(!1), O = (g) => {
85
- h.value = g.map((u, o) => ({
84
+ }, v = A([]), h = A(!1), O = (g) => {
85
+ v.value = g.map((c, o) => ({
86
86
  uid: Date.now() + o,
87
- url: u
87
+ url: c
88
88
  }));
89
89
  };
90
90
  ce(() => t.modelValue, (g) => {
91
- t.multiple ? Array.isArray(g) && g.length > 0 ? O(g) : h.value = [] : typeof g == "string" ? l.value = g : l.value = "";
91
+ t.multiple ? Array.isArray(g) && g.length > 0 ? O(g) : v.value = [] : typeof g == "string" ? l.value = g : l.value = "";
92
92
  }, { immediate: !0 });
93
93
  const J = () => {
94
94
  D();
95
95
  }, k = (g) => {
96
- h.value.splice(g, 1), D(), R.success("删除成功");
96
+ v.value.splice(g, 1), D(), R.success("删除成功");
97
97
  }, y = async (g) => {
98
- const u = g.raw;
99
- if (!u) {
98
+ const c = g.raw;
99
+ if (!c) {
100
100
  R.error("文件不存在,请重试");
101
101
  return;
102
102
  }
103
- if (u.size > t.maxSize * 1024 * 1024) {
103
+ if (c.size > t.maxSize * 1024 * 1024) {
104
104
  R.error(`图片大小不能超过 ${t.maxSize}MB`);
105
105
  return;
106
106
  }
@@ -109,25 +109,25 @@ const xe = ["disabled"], Re = {
109
109
  return;
110
110
  }
111
111
  try {
112
- v.value = !0;
113
- const o = await t.uploadFn(u);
114
- t.multiple ? (h.value.push({ uid: Date.now(), url: o }), D()) : (l.value = o, n("update:modelValue", o)), n("success", o), R.success("上传成功");
112
+ h.value = !0;
113
+ const o = await t.uploadFn(c);
114
+ t.multiple ? (v.value.push({ uid: Date.now(), url: o }), D()) : (l.value = o, n("update:modelValue", o)), n("success", o), R.success("上传成功");
115
115
  } catch (o) {
116
116
  console.error("上传出错:", o), R.error("上传失败,请重试"), n("error", o);
117
117
  } finally {
118
- v.value = !1;
118
+ h.value = !1;
119
119
  }
120
120
  }, D = () => {
121
- const g = h.value.map((u) => u.url);
121
+ const g = v.value.map((c) => c.url);
122
122
  n("update:modelValue", g);
123
123
  };
124
- return (g, u) => {
125
- const o = w("el-image"), c = w("el-icon"), I = w("el-upload"), p = w("el-image-viewer");
124
+ return (g, c) => {
125
+ const o = w("el-image"), u = w("el-icon"), I = w("el-upload"), p = w("el-image-viewer");
126
126
  return r(), B("div", Ee, [
127
127
  e.multiple ? (r(), B("div", Ae, [
128
128
  m($(je), {
129
- modelValue: h.value,
130
- "onUpdate:modelValue": u[0] || (u[0] = (S) => h.value = S),
129
+ modelValue: v.value,
130
+ "onUpdate:modelValue": c[0] || (c[0] = (S) => v.value = S),
131
131
  class: "images-list",
132
132
  "item-key": "uid",
133
133
  animation: 200,
@@ -138,7 +138,7 @@ const xe = ["disabled"], Re = {
138
138
  C("div", Ve, [
139
139
  m(o, {
140
140
  src: S.url,
141
- "preview-src-list": h.value.map((V) => V.url),
141
+ "preview-src-list": v.value.map((V) => V.url),
142
142
  "initial-index": E,
143
143
  fit: "cover",
144
144
  class: "image-preview",
@@ -150,7 +150,7 @@ const xe = ["disabled"], Re = {
150
150
  class: "delete-btn",
151
151
  onClick: G((V) => k(E), ["stop"])
152
152
  }, [
153
- m(c, { class: "icon-delete" }, {
153
+ m(u, { class: "icon-delete" }, {
154
154
  default: i(() => [
155
155
  m($(Q))
156
156
  ]),
@@ -161,18 +161,18 @@ const xe = ["disabled"], Re = {
161
161
  ]),
162
162
  _: 1
163
163
  }, 8, ["modelValue", "disabled"]),
164
- !e.disabled && (!e.limit || h.value.length < e.limit) ? (r(), b(I, {
164
+ !e.disabled && (!e.limit || v.value.length < e.limit) ? (r(), b(I, {
165
165
  key: 0,
166
166
  class: "image-uploader",
167
167
  "auto-upload": !1,
168
168
  "show-file-list": !1,
169
169
  "on-change": y,
170
- disabled: v.value,
170
+ disabled: h.value,
171
171
  "list-type": "picture-card",
172
172
  accept: e.accept
173
173
  }, {
174
174
  default: i(() => [
175
- v.value ? (r(), b(c, {
175
+ h.value ? (r(), b(u, {
176
176
  key: 1,
177
177
  class: "uploader-icon is-loading"
178
178
  }, {
@@ -180,7 +180,7 @@ const xe = ["disabled"], Re = {
180
180
  m($(se))
181
181
  ]),
182
182
  _: 1
183
- })) : (r(), b(c, {
183
+ })) : (r(), b(u, {
184
184
  key: 0,
185
185
  class: "uploader-icon"
186
186
  }, {
@@ -200,7 +200,7 @@ const xe = ["disabled"], Re = {
200
200
  class: "image-preview"
201
201
  }, null, 8, ["src"]),
202
202
  C("div", Je, [
203
- m(c, {
203
+ m(u, {
204
204
  class: "action-icon",
205
205
  onClick: G(f, ["stop"])
206
206
  }, {
@@ -209,7 +209,7 @@ const xe = ["disabled"], Re = {
209
209
  ]),
210
210
  _: 1
211
211
  }),
212
- e.disabled ? x("", !0) : (r(), b(c, {
212
+ e.disabled ? x("", !0) : (r(), b(u, {
213
213
  key: 0,
214
214
  class: "action-icon",
215
215
  onClick: G(_, ["stop"])
@@ -226,14 +226,14 @@ const xe = ["disabled"], Re = {
226
226
  "auto-upload": !1,
227
227
  "show-file-list": !1,
228
228
  "on-change": y,
229
- disabled: e.disabled || v.value,
229
+ disabled: e.disabled || h.value,
230
230
  accept: e.accept,
231
231
  "list-type": "picture-card"
232
232
  }, {
233
233
  default: i(() => [
234
- m(c, { class: "uploader-icon" }, {
234
+ m(u, { class: "uploader-icon" }, {
235
235
  default: i(() => [
236
- v.value ? (r(), b($(se), {
236
+ h.value ? (r(), b($(se), {
237
237
  key: 1,
238
238
  class: "is-loading"
239
239
  })) : (r(), b($(Y), { key: 0 }))
@@ -247,7 +247,7 @@ const xe = ["disabled"], Re = {
247
247
  key: 2,
248
248
  "url-list": [l.value],
249
249
  teleported: !0,
250
- onClose: u[1] || (u[1] = (S) => a.value = !1)
250
+ onClose: c[1] || (c[1] = (S) => a.value = !1)
251
251
  }, null, 8, ["url-list"])) : x("", !0)
252
252
  ], 64)),
253
253
  $(d) ? (r(), B("div", De, [
@@ -286,7 +286,7 @@ const xe = ["disabled"], Re = {
286
286
  },
287
287
  emits: ["search", "reset", "add", "batchDelete"],
288
288
  setup(e, { emit: s }) {
289
- const t = e, n = s, l = A(), a = A(!1), d = A(!1), f = A(0), _ = A(0), h = de(() => f.value > t.defaultVisible), v = () => {
289
+ const t = e, n = s, l = A(), a = A(!1), d = A(!1), f = A(0), _ = A(0), v = de(() => f.value > t.defaultVisible), h = () => {
290
290
  if (!l.value) return;
291
291
  const k = Array.from(l.value.children);
292
292
  f.value = k.length;
@@ -299,7 +299,7 @@ const xe = ["disabled"], Re = {
299
299
  const k = l.value;
300
300
  if (k)
301
301
  if (a.value)
302
- v(), a.value = !1, k.style.maxHeight = k.scrollHeight + "px", k.offsetHeight, k.style.maxHeight = _.value + "px";
302
+ h(), a.value = !1, k.style.maxHeight = k.scrollHeight + "px", k.offsetHeight, k.style.maxHeight = _.value + "px";
303
303
  else {
304
304
  a.value = !0, k.style.maxHeight = k.scrollHeight + "px";
305
305
  const y = () => {
@@ -310,17 +310,17 @@ const xe = ["disabled"], Re = {
310
310
  };
311
311
  let J = null;
312
312
  return ge(() => {
313
- v(), h.value && l.value && (l.value.style.maxHeight = _.value + "px"), requestAnimationFrame(() => {
313
+ h(), v.value && l.value && (l.value.style.maxHeight = _.value + "px"), requestAnimationFrame(() => {
314
314
  requestAnimationFrame(() => {
315
315
  d.value = !0;
316
316
  });
317
317
  }), l.value && (J = new MutationObserver(() => {
318
- v(), h.value && !a.value && l.value && (l.value.style.maxHeight = _.value + "px");
318
+ h(), v.value && !a.value && l.value && (l.value.style.maxHeight = _.value + "px");
319
319
  }), J.observe(l.value, { childList: !0 }));
320
320
  }), ye(() => {
321
321
  J == null || J.disconnect();
322
322
  }), (k, y) => {
323
- const D = w("el-form"), g = w("el-button"), u = w("el-icon"), o = w("el-card");
323
+ const D = w("el-form"), g = w("el-button"), c = w("el-icon"), o = w("el-card");
324
324
  return r(), b(o, {
325
325
  shadow: "never",
326
326
  class: "j-search-header-card"
@@ -350,7 +350,7 @@ const xe = ["disabled"], Re = {
350
350
  key: 0,
351
351
  type: "primary",
352
352
  icon: $(Y),
353
- onClick: y[0] || (y[0] = (c) => n("add"))
353
+ onClick: y[0] || (y[0] = (u) => n("add"))
354
354
  }, {
355
355
  default: i(() => [
356
356
  z(F(e.addText), 1)
@@ -362,7 +362,7 @@ const xe = ["disabled"], Re = {
362
362
  type: "danger",
363
363
  icon: $(Q),
364
364
  disabled: e.selectedCount === 0,
365
- onClick: y[1] || (y[1] = (c) => n("batchDelete"))
365
+ onClick: y[1] || (y[1] = (u) => n("batchDelete"))
366
366
  }, {
367
367
  default: i(() => [
368
368
  z(" 批量删除" + F(e.selectedCount ? `(${e.selectedCount})` : ""), 1)
@@ -373,7 +373,7 @@ const xe = ["disabled"], Re = {
373
373
  key: 2,
374
374
  type: "primary",
375
375
  icon: $(ke),
376
- onClick: y[2] || (y[2] = (c) => n("search"))
376
+ onClick: y[2] || (y[2] = (u) => n("search"))
377
377
  }, {
378
378
  default: i(() => [...y[4] || (y[4] = [
379
379
  z("搜索", -1)
@@ -383,7 +383,7 @@ const xe = ["disabled"], Re = {
383
383
  e.showReset ? (r(), b(g, {
384
384
  key: 3,
385
385
  icon: $(we),
386
- onClick: y[3] || (y[3] = (c) => n("reset"))
386
+ onClick: y[3] || (y[3] = (u) => n("reset"))
387
387
  }, {
388
388
  default: i(() => [...y[5] || (y[5] = [
389
389
  z("重置", -1)
@@ -392,7 +392,7 @@ const xe = ["disabled"], Re = {
392
392
  }, 8, ["icon"])) : x("", !0),
393
393
  q(k.$slots, "actions", {}, void 0, !0)
394
394
  ]),
395
- h.value ? (r(), b(g, {
395
+ v.value ? (r(), b(g, {
396
396
  key: 0,
397
397
  link: "",
398
398
  type: "primary",
@@ -400,7 +400,7 @@ const xe = ["disabled"], Re = {
400
400
  }, {
401
401
  default: i(() => [
402
402
  z(F(a.value ? "收起" : "展开") + " ", 1),
403
- m(u, {
403
+ m(c, {
404
404
  class: W(["toggle-icon", { "is-expanded": a.value }])
405
405
  }, {
406
406
  default: i(() => [
@@ -434,20 +434,20 @@ const xe = ["disabled"], Re = {
434
434
  }),
435
435
  emits: /* @__PURE__ */ ae(["success"], ["update:modelValue"]),
436
436
  setup(e, { emit: s }) {
437
- const t = e, n = s, l = be(e, "modelValue"), a = A(!1), d = A({}), f = A([]), _ = A({ total: 0, success: 0, fail: 0 }), h = {
437
+ const t = e, n = s, l = be(e, "modelValue"), a = A(!1), d = A({}), f = A([]), _ = A({ total: 0, success: 0, fail: 0 }), v = {
438
438
  0: "待创建",
439
439
  1: "创建成功",
440
440
  2: "创建中",
441
441
  [-1]: "创建失败"
442
- }, v = de(() => Object.entries(d.value).filter(([u]) => !t.excludeFields.includes(u)).map(([u, o]) => ({ id: u, label: o, prop: u }))), O = async () => {
442
+ }, h = de(() => Object.entries(d.value).filter(([c]) => !t.excludeFields.includes(c)).map(([c, o]) => ({ id: c, label: o, prop: c }))), O = async () => {
443
443
  try {
444
- const u = await t.getFieldListApi();
445
- d.value = u.data.tableFieldsInfo ?? {};
444
+ const c = await t.getFieldListApi();
445
+ d.value = c.data.tableFieldsInfo ?? {};
446
446
  } catch {
447
447
  R.error("获取字段列表失败");
448
448
  }
449
- }, J = (u) => {
450
- const o = u.raw;
449
+ }, J = (c) => {
450
+ const o = c.raw;
451
451
  if (!o) return;
452
452
  if (![
453
453
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -464,7 +464,7 @@ const xe = ["disabled"], Re = {
464
464
  R.warning("文件内容为空");
465
465
  return;
466
466
  }
467
- const P = v.value.map((T) => T.prop), H = j.map((T) => {
467
+ const P = h.value.map((T) => T.prop), H = j.map((T) => {
468
468
  const M = Object.values(T), K = { _status: 0, _error: "" };
469
469
  return P.forEach((ne, he) => {
470
470
  K[ne] = M[he];
@@ -475,20 +475,20 @@ const xe = ["disabled"], Re = {
475
475
  R.error("解析文件失败,请检查文件格式");
476
476
  }
477
477
  }, I.readAsBinaryString(o);
478
- }, k = (u) => {
479
- f.value.splice(u, 1), _.value.total = f.value.length;
478
+ }, k = (c) => {
479
+ f.value.splice(c, 1), _.value.total = f.value.length;
480
480
  }, y = async () => {
481
- const u = f.value.filter((o) => o._status === 0).map(({ _status: o, _error: c, ...I }) => I);
482
- if (!u.length) {
481
+ const c = f.value.filter((o) => o._status === 0).map(({ _status: o, _error: u, ...I }) => I);
482
+ if (!c.length) {
483
483
  R.warning("没有可导入的数据");
484
484
  return;
485
485
  }
486
486
  a.value = !0;
487
487
  try {
488
- const o = await t.importApi(u);
489
- o.code === 1 ? (f.value.forEach((c) => {
490
- c._status === 0 && (c._status = 1);
491
- }), _.value.success = f.value.filter((c) => c._status === 1).length, R.success("导入成功"), n("success")) : R.error(o.msg || "导入失败");
488
+ const o = await t.importApi(c);
489
+ o.code === 1 ? (f.value.forEach((u) => {
490
+ u._status === 0 && (u._status = 1);
491
+ }), _.value.success = f.value.filter((u) => u._status === 1).length, R.success("导入成功"), n("success")) : R.error(o.msg || "导入失败");
492
492
  } catch {
493
493
  R.error("导入失败,请重试");
494
494
  } finally {
@@ -496,18 +496,18 @@ const xe = ["disabled"], Re = {
496
496
  }
497
497
  }, D = () => {
498
498
  try {
499
- const u = N.utils.book_new(), o = v.value.map((p) => p.label), c = {};
500
- o.forEach((p) => c[p] = "");
501
- const I = N.utils.json_to_sheet([c]);
502
- N.utils.book_append_sheet(u, I, "模板"), N.writeFile(u, "导入模板.xlsx");
499
+ const c = N.utils.book_new(), o = h.value.map((p) => p.label), u = {};
500
+ o.forEach((p) => u[p] = "");
501
+ const I = N.utils.json_to_sheet([u]);
502
+ N.utils.book_append_sheet(c, I, "模板"), N.writeFile(c, "导入模板.xlsx");
503
503
  } catch {
504
504
  R.error("模板下载失败");
505
505
  }
506
506
  }, g = () => {
507
507
  a.value || (l.value = !1, f.value = [], _.value = { total: 0, success: 0, fail: 0 });
508
508
  };
509
- return (u, o) => {
510
- const c = w("el-divider"), I = w("el-button"), p = w("el-upload"), S = w("el-link"), E = w("el-card"), V = w("el-col"), j = w("el-row"), P = w("el-table-column"), H = w("el-table"), T = w("el-dialog");
509
+ return (c, o) => {
510
+ const u = w("el-divider"), I = w("el-button"), p = w("el-upload"), S = w("el-link"), E = w("el-card"), V = w("el-col"), j = w("el-row"), P = w("el-table-column"), H = w("el-table"), T = w("el-dialog");
511
511
  return r(), b(T, {
512
512
  modelValue: l.value,
513
513
  "onUpdate:modelValue": o[0] || (o[0] = (M) => l.value = M),
@@ -532,7 +532,7 @@ const xe = ["disabled"], Re = {
532
532
  }, {
533
533
  default: i(() => [
534
534
  o[3] || (o[3] = C("div", { class: "j-import-upload-card-title" }, "导入 EXCEL", -1)),
535
- m(c, { style: { margin: "10px 0" } }),
535
+ m(u, { style: { margin: "10px 0" } }),
536
536
  C("div", Ne, [
537
537
  m(p, {
538
538
  accept: ".xlsx,.xls",
@@ -550,7 +550,7 @@ const xe = ["disabled"], Re = {
550
550
  ]),
551
551
  _: 1
552
552
  }),
553
- v.value.length ? (r(), b(S, {
553
+ h.value.length ? (r(), b(S, {
554
554
  key: 0,
555
555
  type: "primary",
556
556
  class: "j-import-no-wrap",
@@ -642,7 +642,7 @@ const xe = ["disabled"], Re = {
642
642
  class: "j-import-data-table"
643
643
  }, {
644
644
  default: i(() => [
645
- (r(!0), B(Z, null, te(v.value, (M) => (r(), b(P, {
645
+ (r(!0), B(Z, null, te(h.value, (M) => (r(), b(P, {
646
646
  key: M.prop,
647
647
  prop: M.prop,
648
648
  label: M.label,
@@ -656,7 +656,7 @@ const xe = ["disabled"], Re = {
656
656
  fixed: "right"
657
657
  }, {
658
658
  default: i(({ row: M }) => [
659
- M._status === -1 ? (r(), B("span", Ke, F(M._error || "创建失败"), 1)) : (r(), B("span", Xe, F(h[M._status]), 1))
659
+ M._status === -1 ? (r(), B("span", Ke, F(M._error || "创建失败"), 1)) : (r(), B("span", Xe, F(v[M._status]), 1))
660
660
  ]),
661
661
  _: 1
662
662
  }),
@@ -702,7 +702,7 @@ const xe = ["disabled"], Re = {
702
702
  n("menu-click", t.menuItem);
703
703
  };
704
704
  return (a, d) => {
705
- const f = w("JSideMenuItem", !0), _ = w("el-sub-menu"), h = w("el-menu-item");
705
+ const f = w("JSideMenuItem", !0), _ = w("el-sub-menu"), v = w("el-menu-item");
706
706
  return e.menuItem.children && e.menuItem.children.length > 0 ? (r(), b(_, {
707
707
  key: 0,
708
708
  index: e.menuItem.path
@@ -715,16 +715,16 @@ const xe = ["disabled"], Re = {
715
715
  C("span", Qe, F(e.menuItem.title || e.menuItem.name), 1)
716
716
  ]),
717
717
  default: i(() => [
718
- (r(!0), B(Z, null, te(e.menuItem.children, (v) => (r(), b(f, {
719
- key: v.path,
720
- "menu-item": v,
718
+ (r(!0), B(Z, null, te(e.menuItem.children, (h) => (r(), b(f, {
719
+ key: h.path,
720
+ "menu-item": h,
721
721
  "is-collapse": e.isCollapse,
722
722
  depth: e.depth + 1,
723
723
  onMenuClick: d[0] || (d[0] = (O) => n("menu-click", O))
724
724
  }, null, 8, ["menu-item", "is-collapse", "depth"]))), 128))
725
725
  ]),
726
726
  _: 1
727
- }, 8, ["index"])) : (r(), b(h, {
727
+ }, 8, ["index"])) : (r(), b(v, {
728
728
  key: 1,
729
729
  index: e.menuItem.path,
730
730
  onClick: l
@@ -772,9 +772,9 @@ const xe = ["disabled"], Re = {
772
772
  }, [
773
773
  C("div", et, [
774
774
  q(d.$slots, "logo", { collapsed: l.value }, () => {
775
- var h;
775
+ var v;
776
776
  return [
777
- C("h2", tt, F(l.value ? e.collapsedTitle || ((h = e.title) == null ? void 0 : h.charAt(0)) || "" : e.title), 1)
777
+ C("h2", tt, F(l.value ? e.collapsedTitle || ((v = e.title) == null ? void 0 : v.charAt(0)) || "" : e.title), 1)
778
778
  ];
779
779
  }, !0)
780
780
  ]),
@@ -787,11 +787,11 @@ const xe = ["disabled"], Re = {
787
787
  "collapse-transition": !1
788
788
  }, {
789
789
  default: i(() => [
790
- (r(!0), B(Z, null, te(e.menus, (h) => (r(), b(fe, {
791
- key: h.path,
792
- "menu-item": h,
790
+ (r(!0), B(Z, null, te(e.menus, (v) => (r(), b(fe, {
791
+ key: v.path,
792
+ "menu-item": v,
793
793
  "is-collapse": l.value,
794
- onMenuClick: f[0] || (f[0] = (v) => n("menu-click", v))
794
+ onMenuClick: f[0] || (f[0] = (h) => n("menu-click", h))
795
795
  }, null, 8, ["menu-item", "is-collapse"]))), 128))
796
796
  ]),
797
797
  _: 1
@@ -952,8 +952,8 @@ function $t(e, s) {
952
952
  viewModules: d,
953
953
  homeComponent: f,
954
954
  notFoundComponent: _,
955
- projectName: h,
956
- layoutRouteName: v = "Layout",
955
+ projectName: v,
956
+ layoutRouteName: h = "Layout",
957
957
  publicPaths: O = ["/login", "/register"],
958
958
  loginRouteName: J = "login",
959
959
  forbiddenRouteName: k = "Forbidden",
@@ -961,14 +961,14 @@ function $t(e, s) {
961
961
  homeTitle: D = "首页",
962
962
  noPermissionMessage: g = "暂无权限"
963
963
  } = s;
964
- let u = !1;
965
- function o(c) {
966
- const p = dt(c).find((E) => E.name === v);
964
+ let c = !1;
965
+ function o(u) {
966
+ const p = dt(u).find((E) => E.name === h);
967
967
  if (!(p != null && p.children)) return;
968
- const S = pe(p.children, d, h);
968
+ const S = pe(p.children, d, v);
969
969
  S.forEach((E) => {
970
- e.addRoute(v, E), re(`添加路由: ${String(E.name)} -> ${E.path}`);
971
- }), e.addRoute(v, {
970
+ e.addRoute(h, E), re(`添加路由: ${String(E.name)} -> ${E.path}`);
971
+ }), e.addRoute(h, {
972
972
  path: "",
973
973
  name: y,
974
974
  component: f,
@@ -979,36 +979,42 @@ function $t(e, s) {
979
979
  component: _
980
980
  }), re(`动态路由添加完成,共 ${S.length} 条`);
981
981
  }
982
- return e.beforeEach(async (c, I, p) => {
983
- if (ee.start(), a() && !u)
982
+ return e.beforeEach(async (u, I, p) => {
983
+ if (ee.start(), a() && !c)
984
984
  try {
985
985
  const j = t(), P = n();
986
986
  if (await j.initRoutes(), await P.loadUserPermissions(), j.backendRoutes.length > 0) {
987
- if (o(j.backendRoutes), u = !0, c.path === "/" || c.path === "") {
987
+ if (o(j.backendRoutes), c = !0, u.path === "/" || u.path === "") {
988
988
  const T = ie(
989
989
  j.backendRoutes,
990
990
  P.routePermissions,
991
- v,
992
- h
991
+ h,
992
+ v
993
993
  );
994
994
  if (T) {
995
995
  p({ path: T.path, replace: !0 });
996
996
  return;
997
997
  }
998
+ p({ ...u, replace: !0 });
999
+ return;
1000
+ }
1001
+ if (u.name === h) {
1002
+ p({ ...u, replace: !0 });
1003
+ return;
998
1004
  }
999
- const H = j.backendRoutes.find((T) => T.name === c.name);
1005
+ const H = j.backendRoutes.find((T) => T.name === u.name);
1000
1006
  if (H && !P.routePermissions.includes(H.code)) {
1001
- ue("无权限访问:", c.path), p({ name: k, replace: !0 });
1007
+ ue("无权限访问:", u.path), p({ name: k, replace: !0 });
1002
1008
  return;
1003
1009
  }
1004
- p({ ...c, replace: !0 });
1010
+ p({ ...u, replace: !0 });
1005
1011
  return;
1006
1012
  }
1007
1013
  } catch (j) {
1008
- mt("获取权限失败:", j), u = !1, await l().logout(), p({ name: J, replace: !0 });
1014
+ mt("获取权限失败:", j), c = !1, await l().logout(), p({ name: J, replace: !0 });
1009
1015
  return;
1010
1016
  }
1011
- if (O.includes(c.path)) {
1017
+ if (O.includes(u.path)) {
1012
1018
  a() ? p({ path: "/", replace: !0 }) : p();
1013
1019
  return;
1014
1020
  }
@@ -1016,21 +1022,21 @@ function $t(e, s) {
1016
1022
  p({ name: J, replace: !0 });
1017
1023
  return;
1018
1024
  }
1019
- if (c.name === v) {
1025
+ if (u.name === h) {
1020
1026
  p();
1021
1027
  return;
1022
1028
  }
1023
1029
  const S = n(), E = t();
1024
1030
  if (S.routePermissions.length === 0) {
1025
- c.path !== "/" ? (R.warning(g), p({ path: "/", replace: !0 })) : p();
1031
+ u.path !== "/" ? (R.warning(g), p({ path: "/", replace: !0 })) : p();
1026
1032
  return;
1027
1033
  }
1028
- if (c.path === "/") {
1034
+ if (u.path === "/") {
1029
1035
  const j = ie(
1030
1036
  E.backendRoutes,
1031
1037
  S.routePermissions,
1032
- v,
1033
- h
1038
+ h,
1039
+ v
1034
1040
  );
1035
1041
  if (j && j.path !== "/") {
1036
1042
  p({ path: j.path, replace: !0 });
@@ -1039,15 +1045,15 @@ function $t(e, s) {
1039
1045
  p();
1040
1046
  return;
1041
1047
  }
1042
- const V = E.backendRoutes.find((j) => j.name === c.name);
1048
+ const V = E.backendRoutes.find((j) => j.name === u.name);
1043
1049
  if (V && !S.routePermissions.includes(V.code)) {
1044
- ue("无权限访问:", c.path), p({ name: k, replace: !0 });
1050
+ ue("无权限访问:", u.path), p({ name: k, replace: !0 });
1045
1051
  return;
1046
1052
  }
1047
1053
  p();
1048
1054
  }), e.afterEach(() => ee.done()), {
1049
1055
  resetRouterState: () => {
1050
- u = !1;
1056
+ c = !1;
1051
1057
  }
1052
1058
  };
1053
1059
  }