@skyfox2000/webui 1.2.0 → 1.2.2
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/.vscode/settings.json +1 -1
- package/lib/assets/modules/download-C3KYmuzo.js +210 -0
- package/lib/assets/modules/file-upload-CMHnVQty.js +179 -0
- package/lib/assets/modules/form-excel-Xre5F1Ez.js +211 -0
- package/lib/assets/modules/hostInfo-DK8lknRe.js +2182 -0
- package/lib/assets/modules/index-htdsukeW.js +109 -0
- package/lib/assets/modules/{index-Civhd8xG.js → index-lc53kVVe.js} +34 -35
- package/lib/assets/modules/{menuTabs-BRYvFWA-.js → menuTabs-CkAkFKU8.js} +50 -49
- package/lib/assets/modules/{index-DmWrkTXX.js → toolIcon-Dpr1pbgl.js} +1 -1
- package/lib/components/common/icon/index.vue.d.ts +1 -1
- package/lib/components/index.d.ts +4 -5
- package/lib/es/AceEditor/index.js +7 -8
- package/lib/es/BasicLayout/index.js +20 -19
- package/lib/es/Error403/index.js +7 -6
- package/lib/es/Error404/index.js +7 -6
- package/lib/es/ExcelForm/index.js +179 -380
- package/lib/es/UploadForm/index.js +24 -25
- package/lib/index.d.ts +2 -0
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +1119 -854
- package/package.json +2 -2
- package/src/components/index.ts +9 -54
- package/src/index.ts +51 -0
- package/src/utils/main-openapis.ts +1 -1
- package/vite.config.ts +1 -1
- package/lib/assets/modules/file-upload-CBUcsUnR.js +0 -170
- package/lib/assets/modules/form-validate-CgX7aR7T.js +0 -297
- package/lib/assets/modules/index-DQMdt51R.js +0 -726
- package/lib/assets/modules/settingInfo-BZakNKIN.js +0 -999
- package/lib/assets/modules/uploadList-B7XoxGOh.js +0 -278
|
@@ -1,999 +0,0 @@
|
|
|
1
|
-
var ne = Object.defineProperty;
|
|
2
|
-
var ie = (e, t, s) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
-
var m = (e, t, s) => ie(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
import { ref as h, h as I, defineComponent as ae, toRaw as re, watch as L, nextTick as le, reactive as ce } from "vue";
|
|
5
|
-
import v from "vue-m-message";
|
|
6
|
-
import { httpPost as E, ResStatus as P, setToken as H, API_HOST as M, SERVER_HOST as ue } from "@skyfox2000/fapi";
|
|
7
|
-
import { isMicroApp as G, mainAppApis as $, EnvConfig as V, AppAction as B, AppSource as K, isBaseMicroApp as W } from "@skyfox2000/microbase";
|
|
8
|
-
import "async-validator";
|
|
9
|
-
import { defineStore as w } from "pinia";
|
|
10
|
-
import { createRouter as pe, createWebHashHistory as fe } from "vue-router";
|
|
11
|
-
const he = 7 * 24 * 60 * 60 * 1e3, O = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Set(), C = h({}), Ke = (e) => {
|
|
12
|
-
var n;
|
|
13
|
-
if (!e.iconUrl) return j;
|
|
14
|
-
const t = h(!0), s = h("");
|
|
15
|
-
let o = !0;
|
|
16
|
-
return (n = e.icons) != null && n.length && (o = e.icons.every((i) => C.value[i] !== void 0)), (e.icon && !C.value[e.icon] || !o) && de(e, t).then(() => {
|
|
17
|
-
Ie(e.iconUrl, e.monoColor || !1), t.value = !0;
|
|
18
|
-
}), ae({
|
|
19
|
-
props: {
|
|
20
|
-
icon: {
|
|
21
|
-
type: String
|
|
22
|
-
},
|
|
23
|
-
icons: {
|
|
24
|
-
type: Array
|
|
25
|
-
},
|
|
26
|
-
iconIndex: {
|
|
27
|
-
type: Number
|
|
28
|
-
},
|
|
29
|
-
clickable: {
|
|
30
|
-
type: Boolean
|
|
31
|
-
},
|
|
32
|
-
angle: {
|
|
33
|
-
type: Number
|
|
34
|
-
},
|
|
35
|
-
flip: {
|
|
36
|
-
type: Boolean
|
|
37
|
-
},
|
|
38
|
-
class: {
|
|
39
|
-
type: [String, Array],
|
|
40
|
-
default: ""
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
emits: ["update:iconIndex"],
|
|
44
|
-
setup(i, { emit: r }) {
|
|
45
|
-
const a = h(i.icon), l = h(0), p = () => {
|
|
46
|
-
i.icons && l.value++;
|
|
47
|
-
};
|
|
48
|
-
return L(
|
|
49
|
-
() => i.iconIndex,
|
|
50
|
-
(c) => {
|
|
51
|
-
c !== void 0 && (l.value = c);
|
|
52
|
-
},
|
|
53
|
-
{ immediate: !0 }
|
|
54
|
-
), L(
|
|
55
|
-
() => l.value,
|
|
56
|
-
(c) => {
|
|
57
|
-
i.icons && (c >= i.icons.length && (l.value = 0), a.value = i.icons[l.value], k(s, a, a.value), r("update:iconIndex", l.value));
|
|
58
|
-
},
|
|
59
|
-
{ immediate: !0 }
|
|
60
|
-
), L(
|
|
61
|
-
() => C.value,
|
|
62
|
-
() => {
|
|
63
|
-
k(s, a, a.value);
|
|
64
|
-
},
|
|
65
|
-
{ deep: !0 }
|
|
66
|
-
), L(
|
|
67
|
-
() => i.icon,
|
|
68
|
-
(c) => {
|
|
69
|
-
k(s, a, c);
|
|
70
|
-
}
|
|
71
|
-
), k(s, a, a.value), { isLoaded: t, Icon: s, handleClick: p };
|
|
72
|
-
},
|
|
73
|
-
render() {
|
|
74
|
-
if (!t.value)
|
|
75
|
-
return j;
|
|
76
|
-
let i = this.class, r = "";
|
|
77
|
-
Array.isArray(i) ? r = i.join(" ") : typeof i == "string" && (r = i);
|
|
78
|
-
let a = [r];
|
|
79
|
-
return !/\bw-/.test(r) && !/$w-/.test(r) && a.push("w-4"), !/\bh-/.test(r) && !/$h-/.test(r) && a.push("h-4"), s.value ? I(re(s.value), {
|
|
80
|
-
onClick: this.$props.clickable ? this.handleClick : void 0,
|
|
81
|
-
class: `${a.join(" ")}`,
|
|
82
|
-
style: {
|
|
83
|
-
fill: "currentColor",
|
|
84
|
-
cursor: this.$props.clickable ? "pointer" : "default",
|
|
85
|
-
transform: ve(this.angle, this.flip)
|
|
86
|
-
}
|
|
87
|
-
}) : I("div", { class: "w-[14px] h-[14px]" });
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}, de = (e, t) => {
|
|
91
|
-
let s = e.iconUrl;
|
|
92
|
-
if (!s)
|
|
93
|
-
return console.error("图标库地址不能为空"), Promise.resolve();
|
|
94
|
-
if (O.has(s))
|
|
95
|
-
return Promise.resolve();
|
|
96
|
-
const o = X(s);
|
|
97
|
-
if (o)
|
|
98
|
-
return new Promise(async (i) => (q(o.scriptContent), i()));
|
|
99
|
-
t.value = !1;
|
|
100
|
-
const n = new Promise(async (i) => {
|
|
101
|
-
await me(s, e.monoColor || !1), i(), O.delete(s);
|
|
102
|
-
});
|
|
103
|
-
return O.set(s, n), n;
|
|
104
|
-
}, me = async (e, t) => {
|
|
105
|
-
try {
|
|
106
|
-
const s = await fetch(e);
|
|
107
|
-
if (!s.ok) {
|
|
108
|
-
v.error("网络异常,无法加载图标库!");
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
let o = await s.text();
|
|
112
|
-
o = t ? o.replace(/fill=\"[^\"]*\"/gi, "") : o;
|
|
113
|
-
let n = /^window\.(\w+)\s*=/;
|
|
114
|
-
const i = o.match(n);
|
|
115
|
-
if (i && i.length > 1) {
|
|
116
|
-
let r = i[1];
|
|
117
|
-
ge(e, r, t, o);
|
|
118
|
-
}
|
|
119
|
-
q(o);
|
|
120
|
-
return;
|
|
121
|
-
} catch (s) {
|
|
122
|
-
return console.error("网络异常,无法加载图标库:", s), null;
|
|
123
|
-
}
|
|
124
|
-
}, q = (e) => {
|
|
125
|
-
const t = document.createElement("script");
|
|
126
|
-
t.textContent = e, document.head.appendChild(t);
|
|
127
|
-
}, ge = (e, t, s, o) => {
|
|
128
|
-
let n = `icon_cache:${e}`;
|
|
129
|
-
const i = {
|
|
130
|
-
windowKey: t,
|
|
131
|
-
monoColor: s,
|
|
132
|
-
scriptContent: o,
|
|
133
|
-
expireTime: Date.now() + he
|
|
134
|
-
// 缓存时间:7天
|
|
135
|
-
};
|
|
136
|
-
localStorage.setItem(n, JSON.stringify(i));
|
|
137
|
-
}, X = (e) => {
|
|
138
|
-
let t = `icon_cache:${e}`;
|
|
139
|
-
const s = localStorage.getItem(t);
|
|
140
|
-
if (!s) return null;
|
|
141
|
-
let o;
|
|
142
|
-
try {
|
|
143
|
-
o = JSON.parse(s);
|
|
144
|
-
} catch (n) {
|
|
145
|
-
return console.error("解析缓存失败:", n), null;
|
|
146
|
-
}
|
|
147
|
-
return o.expireTime < Date.now() ? (localStorage.removeItem(e), null) : o;
|
|
148
|
-
}, k = (e, t, s) => {
|
|
149
|
-
setTimeout(() => {
|
|
150
|
-
t.value = s, t.value && (e.value = C.value[t.value]);
|
|
151
|
-
}, 1);
|
|
152
|
-
}, j = I(
|
|
153
|
-
"svg",
|
|
154
|
-
{ class: "w-4 h-4", viewBox: "0 0 50 50", style: { animation: "rotate 2s linear infinite" } },
|
|
155
|
-
[
|
|
156
|
-
I("circle", {
|
|
157
|
-
cx: "25",
|
|
158
|
-
cy: "25",
|
|
159
|
-
r: "20",
|
|
160
|
-
stroke: "currentColor",
|
|
161
|
-
fill: "none",
|
|
162
|
-
style: { strokeWidth: "3 !important" }
|
|
163
|
-
// 强制应用线宽
|
|
164
|
-
}),
|
|
165
|
-
I("circle", {
|
|
166
|
-
cx: "25",
|
|
167
|
-
cy: "6",
|
|
168
|
-
r: "6",
|
|
169
|
-
fill: "currentColor"
|
|
170
|
-
})
|
|
171
|
-
]
|
|
172
|
-
), Ie = (e, t) => {
|
|
173
|
-
const s = X(e);
|
|
174
|
-
Object.keys(window).forEach((o) => {
|
|
175
|
-
o.startsWith("_iconfont_svg_string_") && (s == null ? void 0 : s.windowKey) === o && !Y.has(o) && (Y.add(o), Se(o, t));
|
|
176
|
-
});
|
|
177
|
-
}, Se = (e, t) => {
|
|
178
|
-
const s = window[e], i = new DOMParser().parseFromString(s, "image/svg+xml").getElementsByTagName("symbol"), r = document.querySelectorAll("symbol");
|
|
179
|
-
for (const a of i) {
|
|
180
|
-
const l = a.id, p = Array.from(r).find((c) => c.id === l);
|
|
181
|
-
p && t && (p.innerHTML = a.innerHTML, p.querySelectorAll("*").forEach((c) => {
|
|
182
|
-
c.hasAttribute("fill") && c.removeAttribute("fill");
|
|
183
|
-
})), C.value[l] || (C.value[l] = I("svg", { fill: "currentColor" }, [I("use", { "xlink:href": `#${l}` })]));
|
|
184
|
-
}
|
|
185
|
-
}, ve = (e, t) => {
|
|
186
|
-
let s = "";
|
|
187
|
-
return e && (s += `rotate(${e}deg)`), t && (s += " scaleX(-1)"), s;
|
|
188
|
-
}, f = class f {
|
|
189
|
-
};
|
|
190
|
-
m(f, "dict", {}), m(f, "Keys", {
|
|
191
|
-
EnableDisable: "EnableDisable",
|
|
192
|
-
SuccessResult: "SuccessResult",
|
|
193
|
-
YesNo: "YesNo",
|
|
194
|
-
MaleFemale: "MaleFemale"
|
|
195
|
-
}), /**
|
|
196
|
-
* 静态选择项列表
|
|
197
|
-
* @param key 名称
|
|
198
|
-
* @returns
|
|
199
|
-
*/
|
|
200
|
-
m(f, "getOptions", (t) => f.dict[t]), /**
|
|
201
|
-
* 静态选择项对象
|
|
202
|
-
* @param key 名称
|
|
203
|
-
* @param value 值
|
|
204
|
-
* @returns
|
|
205
|
-
*/
|
|
206
|
-
m(f, "getOptionItem", (t, s) => f.dict[t].find((o) => o.value === s)), /**
|
|
207
|
-
* 设置静态选择项
|
|
208
|
-
* @param key 名称
|
|
209
|
-
* @param list 列表
|
|
210
|
-
*/
|
|
211
|
-
m(f, "setOptions", (t, s) => {
|
|
212
|
-
f.dict[t] = s;
|
|
213
|
-
}), /**
|
|
214
|
-
* 启用/停用选项
|
|
215
|
-
* - 启用 1
|
|
216
|
-
* - 停用 0
|
|
217
|
-
*/
|
|
218
|
-
m(f, "EnableDisable", [
|
|
219
|
-
{
|
|
220
|
-
label: "启用",
|
|
221
|
-
text: "✅ 启用",
|
|
222
|
-
value: 1
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
label: "停用",
|
|
226
|
-
text: "🚫 停用",
|
|
227
|
-
value: 0
|
|
228
|
-
}
|
|
229
|
-
]), /**
|
|
230
|
-
* 成功/失败选项
|
|
231
|
-
* - 成功 1
|
|
232
|
-
* - 失败 0
|
|
233
|
-
*/
|
|
234
|
-
m(f, "SuccessResult", [
|
|
235
|
-
{
|
|
236
|
-
label: "成功",
|
|
237
|
-
text: "✅ 成功",
|
|
238
|
-
value: 1
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
label: "失败",
|
|
242
|
-
text: "🚫 失败",
|
|
243
|
-
value: 0
|
|
244
|
-
}
|
|
245
|
-
]), /**
|
|
246
|
-
* 是/否选项
|
|
247
|
-
* - 是 1
|
|
248
|
-
* - 否 0
|
|
249
|
-
*/
|
|
250
|
-
m(f, "YesNo", [
|
|
251
|
-
{
|
|
252
|
-
label: "是",
|
|
253
|
-
text: "✅ 是",
|
|
254
|
-
value: 1
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
label: "否",
|
|
258
|
-
text: "❎ 否",
|
|
259
|
-
value: 0
|
|
260
|
-
}
|
|
261
|
-
]), /**
|
|
262
|
-
* 男/女选项
|
|
263
|
-
* - 男 M
|
|
264
|
-
* - 女 F
|
|
265
|
-
*/
|
|
266
|
-
m(f, "MaleFemale", [
|
|
267
|
-
{
|
|
268
|
-
label: "男",
|
|
269
|
-
text: "男 👨",
|
|
270
|
-
value: "M"
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
label: "女",
|
|
274
|
-
text: "女 👩",
|
|
275
|
-
value: "F"
|
|
276
|
-
}
|
|
277
|
-
]);
|
|
278
|
-
let g = f;
|
|
279
|
-
g.setOptions("EnableDisable", g.EnableDisable);
|
|
280
|
-
g.setOptions("SuccessResult", g.SuccessResult);
|
|
281
|
-
g.setOptions("YesNo", g.YesNo);
|
|
282
|
-
g.setOptions("MaleFemale", g.MaleFemale);
|
|
283
|
-
const N = "/login/", x = [], Ae = (e) => {
|
|
284
|
-
for (const t of e) {
|
|
285
|
-
const s = x.findIndex((o) => o.path === t.path);
|
|
286
|
-
s !== -1 && x.splice(s, 1), x.push(t), R.addRoute(t);
|
|
287
|
-
}
|
|
288
|
-
}, Z = (e, t, s, o = "") => {
|
|
289
|
-
const n = o + (o ? "/" : "") + e.path;
|
|
290
|
-
t[n] = { ...e, parent: s }, e.children && e.children.forEach((i) => Z(i, t, e, n));
|
|
291
|
-
}, R = pe({
|
|
292
|
-
history: fe("/"),
|
|
293
|
-
routes: x
|
|
294
|
-
}), be = (e, t) => {
|
|
295
|
-
var n, i;
|
|
296
|
-
const s = ((n = e.meta) == null ? void 0 : n.roles) ?? [], o = (i = e.meta) == null ? void 0 : i.permission;
|
|
297
|
-
if (!t)
|
|
298
|
-
return s.length === 0 && !o;
|
|
299
|
-
if (t) {
|
|
300
|
-
const r = T();
|
|
301
|
-
if (V.VITE_PERMISSION_MODE === "role")
|
|
302
|
-
return s.length === 0 ? !0 : r.hasRole(s);
|
|
303
|
-
if (V.VITE_PERMISSION_MODE === "permit") {
|
|
304
|
-
if (s.length === 0 && !o)
|
|
305
|
-
return !0;
|
|
306
|
-
let a = !1, l = !1;
|
|
307
|
-
return s.length > 0 && (a = r.hasRole(s)), o && (l = r.hasPermit(e.path, ":page")), a || l;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return !1;
|
|
311
|
-
}, y = h(null);
|
|
312
|
-
R.beforeEach((e, t, s) => {
|
|
313
|
-
var a;
|
|
314
|
-
const o = e;
|
|
315
|
-
if (e.path.startsWith("/error/") || e.path.startsWith(N))
|
|
316
|
-
return s();
|
|
317
|
-
const n = o.meta, r = ((n == null ? void 0 : n.roles) ?? []).length > 0 || ((a = n == null ? void 0 : n.permission) == null ? void 0 : a.length);
|
|
318
|
-
if (e.path === "/") {
|
|
319
|
-
const l = S();
|
|
320
|
-
if (!l.menuLoaded) {
|
|
321
|
-
y.value = {
|
|
322
|
-
to: e,
|
|
323
|
-
next: (p) => {
|
|
324
|
-
s({ path: p });
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
l.toDefaultApp();
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
if (!r)
|
|
333
|
-
s();
|
|
334
|
-
else {
|
|
335
|
-
const l = T();
|
|
336
|
-
if (!l.isLogin)
|
|
337
|
-
s({ path: N });
|
|
338
|
-
else {
|
|
339
|
-
if (!S().menuLoaded) {
|
|
340
|
-
y.value = {
|
|
341
|
-
to: e,
|
|
342
|
-
next: s
|
|
343
|
-
};
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
const c = be(o, l.isLogin);
|
|
347
|
-
s();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
R.afterEach((e) => {
|
|
352
|
-
if (G() && $.value) {
|
|
353
|
-
const { mainAppPush: t } = $.value;
|
|
354
|
-
t && t(e.hash);
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
const Ce = (e) => {
|
|
358
|
-
if (y.value) {
|
|
359
|
-
const { to: t, next: s } = y.value;
|
|
360
|
-
y.value = null, t.path === "/" ? s(e) : s(t.path);
|
|
361
|
-
}
|
|
362
|
-
}, Re = (e) => {
|
|
363
|
-
const t = D();
|
|
364
|
-
if (t.TabEnabled) {
|
|
365
|
-
if (ye(e.key, t.TabPanes))
|
|
366
|
-
return;
|
|
367
|
-
t.TabPanes.push(e);
|
|
368
|
-
}
|
|
369
|
-
}, ye = (e, t) => t.find((s) => s.key === e), D = w("pageInfo", {
|
|
370
|
-
state: () => ({
|
|
371
|
-
TabActive: "",
|
|
372
|
-
TabPanes: [],
|
|
373
|
-
TabEnabled: !0
|
|
374
|
-
}),
|
|
375
|
-
actions: {
|
|
376
|
-
/**
|
|
377
|
-
* 删除Tab,页面缓存不卸载
|
|
378
|
-
* @param path 路由地址:路由地址
|
|
379
|
-
*/
|
|
380
|
-
removeTabPane(e) {
|
|
381
|
-
if (this.TabEnabled) {
|
|
382
|
-
S().excludeComponent(e);
|
|
383
|
-
let s = 0, o = [...this.TabPanes];
|
|
384
|
-
for (let n = 0; n < o.length; n++)
|
|
385
|
-
if (o[n].key === e) {
|
|
386
|
-
o.splice(n, 1), s = n - 1 < 0 ? 0 : n - 1;
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
for (let n = 0; n < o.length; n++)
|
|
390
|
-
if (o[n].key === this.TabActive) {
|
|
391
|
-
s = n;
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
this.TabPanes = o, this.setTabActive(o[s].key);
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
/**
|
|
398
|
-
* 新增或激活Tab
|
|
399
|
-
* @param path 路由地址:路由地址
|
|
400
|
-
* @returns
|
|
401
|
-
*/
|
|
402
|
-
async setTabActive(e) {
|
|
403
|
-
let s = S().findRoute(e);
|
|
404
|
-
if (!s) return;
|
|
405
|
-
const o = {
|
|
406
|
-
key: e,
|
|
407
|
-
title: s.name.toString(),
|
|
408
|
-
content: "",
|
|
409
|
-
closable: !0,
|
|
410
|
-
// 根据路由的meta.keepAlive确定是否加入对应缓存
|
|
411
|
-
// 默认为true
|
|
412
|
-
keepAlive: !(s.meta && !s.meta.keepAlive)
|
|
413
|
-
};
|
|
414
|
-
Re(o), this.TabActive = e;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}), Te = "appInfoStore", Ee = {
|
|
418
|
-
appList: {
|
|
419
|
-
api: "PLATFORM_API",
|
|
420
|
-
authorize: !0,
|
|
421
|
-
url: "/api/RCTenanetOpSrv/getApps",
|
|
422
|
-
loadingText: !1
|
|
423
|
-
}
|
|
424
|
-
}, _ = /* @__PURE__ */ new Map(), U = (e, t) => e.map((s) => {
|
|
425
|
-
var r, a, l, p, c, u, A, b;
|
|
426
|
-
const o = { ...s };
|
|
427
|
-
if (!((a = (r = o.meta) == null ? void 0 : r.roles) != null && a.length) && !((p = (l = o.meta) == null ? void 0 : l.permission) != null && p.length))
|
|
428
|
-
return o.children && (o.children = U(o.children, t)), o;
|
|
429
|
-
const n = (u = (c = o.meta) == null ? void 0 : c.roles) != null && u.length ? t.hasRole(o.meta.roles) : !1, i = (b = (A = o.meta) == null ? void 0 : A.permission) != null && b.length ? t.hasPermit(o.meta.permission, ":page") : !1;
|
|
430
|
-
return n || i ? (o.children && (o.children = U(o.children, t)), o) : null;
|
|
431
|
-
}).filter(Boolean), ee = (e, t = "") => {
|
|
432
|
-
for (const s of e) {
|
|
433
|
-
if (!s.children && !s.redirect) {
|
|
434
|
-
let o = t + s.path;
|
|
435
|
-
return o.startsWith("/") || (o = "/" + o), o;
|
|
436
|
-
}
|
|
437
|
-
if (s.children && s.children.length > 0 && s.path !== "/error" && s.path !== "/login" && s.path !== "/:page(.*)") {
|
|
438
|
-
const o = ee(s.children, t + s.path + "/");
|
|
439
|
-
if (o)
|
|
440
|
-
return o;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}, S = w("appInfo", {
|
|
444
|
-
state: () => ({
|
|
445
|
-
microRouter: null,
|
|
446
|
-
microActions: {},
|
|
447
|
-
appInfo: {
|
|
448
|
-
Id: "",
|
|
449
|
-
Name: "",
|
|
450
|
-
AppCode: "",
|
|
451
|
-
Version: "",
|
|
452
|
-
Host: "",
|
|
453
|
-
Source: K.Manual,
|
|
454
|
-
Action: B.App,
|
|
455
|
-
Path: "",
|
|
456
|
-
Icon: "",
|
|
457
|
-
Routes: [],
|
|
458
|
-
flattenRoutes: {},
|
|
459
|
-
defaultPage: "",
|
|
460
|
-
Enabled: 1
|
|
461
|
-
},
|
|
462
|
-
appList: [],
|
|
463
|
-
CachedComponents: [],
|
|
464
|
-
ExcludeComponents: [],
|
|
465
|
-
menuLoaded: !1
|
|
466
|
-
}),
|
|
467
|
-
actions: {
|
|
468
|
-
init(e, t) {
|
|
469
|
-
this.microRouter = e, this.microActions = t;
|
|
470
|
-
},
|
|
471
|
-
/**
|
|
472
|
-
* 加载授权应用列表
|
|
473
|
-
*/
|
|
474
|
-
async loadAppList(e) {
|
|
475
|
-
return new Promise(async (t) => {
|
|
476
|
-
e && e.length > 0 ? (this.appList.length = 0, setTimeout(async () => {
|
|
477
|
-
this.appList.push(...e), t();
|
|
478
|
-
}, 1e3)) : (this.appList.length === 0 && await this.getRemoteAppList(), t());
|
|
479
|
-
});
|
|
480
|
-
},
|
|
481
|
-
async getRemoteAppList() {
|
|
482
|
-
return E(Ee.appList, {
|
|
483
|
-
Query: {}
|
|
484
|
-
}).then((e) => {
|
|
485
|
-
(e == null ? void 0 : e.status) === P.SUCCESS && e.data && (this.appList.length = 0, this.appList.push(...e.data));
|
|
486
|
-
});
|
|
487
|
-
},
|
|
488
|
-
async toDefaultApp(e) {
|
|
489
|
-
if (this.appList.length === 0 && await this.loadAppList(), this.appList.length === 0) {
|
|
490
|
-
v.error("加载应用列表失败");
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
let t = "";
|
|
494
|
-
const s = window.location.pathname.split("/");
|
|
495
|
-
if (s.length > 1) {
|
|
496
|
-
for (let n = s.length - 1; n >= 0; n--)
|
|
497
|
-
if (s[n] !== "") {
|
|
498
|
-
t = s[n];
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
let o = null;
|
|
503
|
-
t && t != "login" ? o = this.appList.find((n) => n.AppCode === t) : o = this.appList.find((n) => n.Default), t = o ? o.AppCode : this.appList[0].AppCode, await this.setActiveApp(t), (!e || e.startsWith("/#/") || e.includes("/error/") || window.location.hash.includes("/error/")) && this.push(this.appInfo.defaultPage);
|
|
504
|
-
},
|
|
505
|
-
/**
|
|
506
|
-
* 设置当前应用
|
|
507
|
-
* @param key 应用码
|
|
508
|
-
* @returns
|
|
509
|
-
*/
|
|
510
|
-
async setActiveApp(e, t) {
|
|
511
|
-
this.menuLoaded = !1;
|
|
512
|
-
const s = this.appList.find((o) => o.AppCode === e);
|
|
513
|
-
s && (s.AppCode !== this.appInfo.AppCode && (this.appInfo = {
|
|
514
|
-
...s,
|
|
515
|
-
flattenRoutes: {},
|
|
516
|
-
Routes: t ?? [],
|
|
517
|
-
defaultPage: ""
|
|
518
|
-
}), (!G() || !W()) && (await (await T()).getRolePermits(s.Id), this.appInfo.Routes.length && this.setAppRoutes(this.appInfo.Routes)));
|
|
519
|
-
},
|
|
520
|
-
/**
|
|
521
|
-
* 设置当前应用路由信息
|
|
522
|
-
* @param routes 路由信息
|
|
523
|
-
*/
|
|
524
|
-
setAppRoutes(e) {
|
|
525
|
-
this.appInfo = {
|
|
526
|
-
...this.appInfo,
|
|
527
|
-
flattenRoutes: {},
|
|
528
|
-
Routes: e,
|
|
529
|
-
defaultPage: ""
|
|
530
|
-
};
|
|
531
|
-
const t = this.appInfo.flattenRoutes;
|
|
532
|
-
for (const o of e)
|
|
533
|
-
Z(o, t, void 0);
|
|
534
|
-
Object.keys(t).forEach((o) => {
|
|
535
|
-
const n = t[o];
|
|
536
|
-
n.children || !n.component || (n.meta && n.meta.keepAlive === !1 ? this.ExcludeComponents.push(o) : this.CachedComponents.push(o));
|
|
537
|
-
});
|
|
538
|
-
const s = T();
|
|
539
|
-
if (s.isLogin) {
|
|
540
|
-
const o = U(this.appInfo.Routes, s);
|
|
541
|
-
Ae(o), this.appInfo.defaultPage = ee(o) || "", this.appInfo.defaultPage && (this.menuLoaded = !0, Ce(this.appInfo.defaultPage));
|
|
542
|
-
}
|
|
543
|
-
},
|
|
544
|
-
/**
|
|
545
|
-
* 根据地址,返回组合地址结构,/类型/子应用名/#/路由地址
|
|
546
|
-
* @param path 路由地址
|
|
547
|
-
* @returns
|
|
548
|
-
*/
|
|
549
|
-
formatRoute(e) {
|
|
550
|
-
let t = e;
|
|
551
|
-
return e.includes("#") ? e.startsWith("#") && (t = "/" + this.appInfo.Action.toLowerCase() + "/" + this.appInfo.AppCode + "/" + e) : this.appInfo.AppCode ? t = "/" + this.appInfo.Action.toLowerCase() + "/" + this.appInfo.AppCode + "/#" + e : t = "/#" + e, t;
|
|
552
|
-
},
|
|
553
|
-
/**
|
|
554
|
-
* 应用导航,菜单路由,都使用此处导航
|
|
555
|
-
* @param path 路由地址
|
|
556
|
-
*/
|
|
557
|
-
push(e) {
|
|
558
|
-
this.findRoute(e) && D().setTabActive(e), le(() => {
|
|
559
|
-
W() ? (e = this.formatRoute(e), this.microRouter ? this.microRouter.push({ path: e }) : R.push({ path: e })) : R.push({ path: e });
|
|
560
|
-
});
|
|
561
|
-
},
|
|
562
|
-
/**
|
|
563
|
-
* 快速查找路由信息
|
|
564
|
-
* @param key 路由地址
|
|
565
|
-
* @returns
|
|
566
|
-
*/
|
|
567
|
-
findRoute(e) {
|
|
568
|
-
return this.appInfo.flattenRoutes[e];
|
|
569
|
-
},
|
|
570
|
-
/**
|
|
571
|
-
* 根据路由信息返回组件实例
|
|
572
|
-
* @param component 组件
|
|
573
|
-
* @param route 路由
|
|
574
|
-
* @returns 组件实例
|
|
575
|
-
*/
|
|
576
|
-
cacheComponent(e, t) {
|
|
577
|
-
let s = _.get(t.path);
|
|
578
|
-
if (!s)
|
|
579
|
-
if (this.CachedComponents.includes(t.path))
|
|
580
|
-
s = {
|
|
581
|
-
// 设置组件包装器的名称为路由路径
|
|
582
|
-
name: t.path,
|
|
583
|
-
render() {
|
|
584
|
-
return I(e);
|
|
585
|
-
}
|
|
586
|
-
}, _.set(t.path, s);
|
|
587
|
-
else return e;
|
|
588
|
-
return s;
|
|
589
|
-
},
|
|
590
|
-
/**
|
|
591
|
-
* 删除缓存组件
|
|
592
|
-
* @param path 路由地址
|
|
593
|
-
*/
|
|
594
|
-
excludeComponent(e) {
|
|
595
|
-
this.ExcludeComponents.includes(e) || this.ExcludeComponents.push(e), this.CachedComponents.splice(this.CachedComponents.indexOf(e), 1), _.delete(e);
|
|
596
|
-
},
|
|
597
|
-
/**
|
|
598
|
-
* 路由路径层级查询,返回面包屑
|
|
599
|
-
*/
|
|
600
|
-
matchedRoutes(e) {
|
|
601
|
-
const t = [], s = this.findRoute(e);
|
|
602
|
-
if (s && (t.push(s), s.parent)) {
|
|
603
|
-
const o = this.matchedRoutes(s.parent.path);
|
|
604
|
-
t.push(...o);
|
|
605
|
-
}
|
|
606
|
-
return t.reverse();
|
|
607
|
-
},
|
|
608
|
-
clear() {
|
|
609
|
-
this.appInfo = {
|
|
610
|
-
Id: "",
|
|
611
|
-
Name: "",
|
|
612
|
-
AppCode: "",
|
|
613
|
-
Version: "",
|
|
614
|
-
Host: "",
|
|
615
|
-
Source: K.Manual,
|
|
616
|
-
Action: B.App,
|
|
617
|
-
Path: "",
|
|
618
|
-
Icon: "",
|
|
619
|
-
Routes: [],
|
|
620
|
-
flattenRoutes: {},
|
|
621
|
-
defaultPage: "",
|
|
622
|
-
Enabled: 1
|
|
623
|
-
}, this.CachedComponents.splice(0, this.CachedComponents.length), this.ExcludeComponents.splice(0, this.ExcludeComponents.length), this.appList.splice(0, this.appList.length), this.menuLoaded = !1;
|
|
624
|
-
},
|
|
625
|
-
logout() {
|
|
626
|
-
this.microRouter ? this.microActions && typeof this.microActions.login == "function" && this.microActions.login() : R.push({ path: N + "#/" });
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
persist: {
|
|
630
|
-
key: Te,
|
|
631
|
-
storage: localStorage,
|
|
632
|
-
pick: ["appList"]
|
|
633
|
-
}
|
|
634
|
-
}), Pe = "userInfoStore", te = "Token解析失败", z = "登录过期,请重新登录", F = {
|
|
635
|
-
login: {
|
|
636
|
-
api: "PLATFORM_API",
|
|
637
|
-
url: "/openapi/LoginSrv/login",
|
|
638
|
-
loadingText: !1
|
|
639
|
-
},
|
|
640
|
-
auth: {
|
|
641
|
-
api: "PLATFORM_API",
|
|
642
|
-
authorize: !0,
|
|
643
|
-
url: "/api/RCAccountOpSrv/getPermits",
|
|
644
|
-
loadingText: !1
|
|
645
|
-
},
|
|
646
|
-
logout: {
|
|
647
|
-
api: "PLATFORM_API",
|
|
648
|
-
authorize: !0,
|
|
649
|
-
url: "/api/LoginSrv/logout",
|
|
650
|
-
loadingText: "正在退出..."
|
|
651
|
-
}
|
|
652
|
-
}, we = (e) => {
|
|
653
|
-
let t = {
|
|
654
|
-
Option: {},
|
|
655
|
-
Query: e
|
|
656
|
-
};
|
|
657
|
-
return E(F.login, t).then((s) => (s == null ? void 0 : s.status) === P.SUCCESS ? s : null);
|
|
658
|
-
}, Le = (e) => {
|
|
659
|
-
let t = {
|
|
660
|
-
Query: {
|
|
661
|
-
AppId: e
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
return E(F.auth, t).then((s) => (s == null ? void 0 : s.status) === P.SUCCESS ? s.data : (v.error("获取授权信息失败," + (s == null ? void 0 : s.msg)), null));
|
|
665
|
-
}, ke = () => {
|
|
666
|
-
let e = {
|
|
667
|
-
Option: {},
|
|
668
|
-
Query: {}
|
|
669
|
-
};
|
|
670
|
-
return E(F.logout, e).then((t) => (t == null ? void 0 : t.status) === P.SUCCESS ? t.data : null);
|
|
671
|
-
}, xe = (e) => {
|
|
672
|
-
try {
|
|
673
|
-
const s = JSON.parse(atob(e.split(".")[1])).exp;
|
|
674
|
-
return Date.now() / 1e3 > s;
|
|
675
|
-
} catch (t) {
|
|
676
|
-
return console.error(te, t), !0;
|
|
677
|
-
}
|
|
678
|
-
}, J = (e, t) => e == "" ? (v.error(z, {
|
|
679
|
-
duration: 3e3,
|
|
680
|
-
onClose: t
|
|
681
|
-
}), !1) : xe(e) ? (v.error(z, {
|
|
682
|
-
duration: 3e3,
|
|
683
|
-
onClose: t
|
|
684
|
-
}), !1) : !0, He = (e) => {
|
|
685
|
-
try {
|
|
686
|
-
const t = JSON.parse(atob(e.token.split(".")[1]));
|
|
687
|
-
return t.user = JSON.parse(t.user), e.UserInfo = t.user, !0;
|
|
688
|
-
} catch (t) {
|
|
689
|
-
return console.error(te, t), !1;
|
|
690
|
-
}
|
|
691
|
-
}, d = h(null), T = w("userInfo", {
|
|
692
|
-
state: () => ({
|
|
693
|
-
isLogin: !1,
|
|
694
|
-
userInfo: {
|
|
695
|
-
Id: "",
|
|
696
|
-
Name: "",
|
|
697
|
-
Code: "",
|
|
698
|
-
TenantId: null,
|
|
699
|
-
UserLevel: "Guest"
|
|
700
|
-
},
|
|
701
|
-
token: "",
|
|
702
|
-
refreshToken: ""
|
|
703
|
-
}),
|
|
704
|
-
actions: {
|
|
705
|
-
/**
|
|
706
|
-
* 启动时初始化用户信息
|
|
707
|
-
*/
|
|
708
|
-
init() {
|
|
709
|
-
this.token && this.isLogin ? (H(this.token), J(this.token, () => this.clean())) : this.clean();
|
|
710
|
-
},
|
|
711
|
-
/**
|
|
712
|
-
* 登录操作
|
|
713
|
-
* @param loginInfo 登录信息
|
|
714
|
-
* @returns
|
|
715
|
-
*/
|
|
716
|
-
async login(e, t) {
|
|
717
|
-
const s = await we(e);
|
|
718
|
-
if (s) {
|
|
719
|
-
const o = s;
|
|
720
|
-
if (o.errno)
|
|
721
|
-
return o;
|
|
722
|
-
{
|
|
723
|
-
const n = s.data;
|
|
724
|
-
if (this.token = n.token, H(this.token), this.isLogin = !0, He(n))
|
|
725
|
-
this.userInfo = {
|
|
726
|
-
...this.userInfo,
|
|
727
|
-
...n.UserInfo
|
|
728
|
-
};
|
|
729
|
-
else {
|
|
730
|
-
v.error("用户信息解析失败");
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
t && (await S()).toDefaultApp();
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
},
|
|
737
|
-
/**
|
|
738
|
-
* 获取应用授权信息
|
|
739
|
-
* @param appId 应用ID
|
|
740
|
-
* @returns 是否获取成功
|
|
741
|
-
*/
|
|
742
|
-
async getRolePermits(e) {
|
|
743
|
-
if (!this.isLogin || !this.token)
|
|
744
|
-
return !1;
|
|
745
|
-
if (d.value && d.value.appId === e)
|
|
746
|
-
return !0;
|
|
747
|
-
try {
|
|
748
|
-
const t = await Le(e);
|
|
749
|
-
return t ? (d.value = {
|
|
750
|
-
appId: e,
|
|
751
|
-
level: this.userInfo.UserLevel,
|
|
752
|
-
permits: t.permits || [],
|
|
753
|
-
lastTime: t.lastTime
|
|
754
|
-
}, !0) : !1;
|
|
755
|
-
} catch (t) {
|
|
756
|
-
return console.error("获取授权信息出错", t), !1;
|
|
757
|
-
}
|
|
758
|
-
},
|
|
759
|
-
/**
|
|
760
|
-
* 检查角色权限
|
|
761
|
-
* @param role 资源角色编码需求
|
|
762
|
-
* @returns 是否有角色权限
|
|
763
|
-
*/
|
|
764
|
-
hasRole(e) {
|
|
765
|
-
return !d.value || !d.value.level ? !1 : Array.isArray(e) ? e.includes(d.value.level) : d.value.level === e;
|
|
766
|
-
},
|
|
767
|
-
/**
|
|
768
|
-
* 检查功能权限
|
|
769
|
-
* @param permitCode 资源权限编码
|
|
770
|
-
* @returns 是否有功能权限
|
|
771
|
-
*/
|
|
772
|
-
hasPermit(e, t) {
|
|
773
|
-
var s;
|
|
774
|
-
return !d.value || !d.value.permits ? !1 : ((s = d.value.permits[e]) == null ? void 0 : s.includes(t)) ?? !1;
|
|
775
|
-
},
|
|
776
|
-
/**
|
|
777
|
-
* 获取用户信息
|
|
778
|
-
* @returns 用户Token
|
|
779
|
-
*/
|
|
780
|
-
getUserInfo() {
|
|
781
|
-
return this.userInfo;
|
|
782
|
-
},
|
|
783
|
-
/**
|
|
784
|
-
* 获取用户Token
|
|
785
|
-
* @returns 用户Token
|
|
786
|
-
*/
|
|
787
|
-
getToken() {
|
|
788
|
-
return J(this.token, () => {
|
|
789
|
-
this.clean(), this.logout();
|
|
790
|
-
}) ? this.token : "";
|
|
791
|
-
},
|
|
792
|
-
/*
|
|
793
|
-
* 清理登录信息
|
|
794
|
-
*/
|
|
795
|
-
async clean() {
|
|
796
|
-
return this.userInfo = {
|
|
797
|
-
Id: "",
|
|
798
|
-
Name: "",
|
|
799
|
-
Code: "",
|
|
800
|
-
TenantId: "",
|
|
801
|
-
UserLevel: ""
|
|
802
|
-
}, this.token = "", H(this.token), this.isLogin = !1, d.value = null, (await S()).clear(), Promise.resolve();
|
|
803
|
-
},
|
|
804
|
-
/**
|
|
805
|
-
* 登出操作
|
|
806
|
-
* @returns
|
|
807
|
-
*/
|
|
808
|
-
async logout() {
|
|
809
|
-
try {
|
|
810
|
-
await ke();
|
|
811
|
-
} catch (e) {
|
|
812
|
-
console.error("调用登出接口失败", e);
|
|
813
|
-
} finally {
|
|
814
|
-
await this.clean(), setTimeout(async () => {
|
|
815
|
-
v.success("已退出登录");
|
|
816
|
-
}, 1e3), setTimeout(async () => {
|
|
817
|
-
(await S()).logout();
|
|
818
|
-
}, 2e3);
|
|
819
|
-
}
|
|
820
|
-
return Promise.resolve();
|
|
821
|
-
}
|
|
822
|
-
},
|
|
823
|
-
persist: {
|
|
824
|
-
key: Pe,
|
|
825
|
-
storage: localStorage,
|
|
826
|
-
pick: ["isLogin", "userInfo", "token", "refreshToken"]
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
h("small"), h(!1), h(!0), h(10), h(!1), h(["New"]);
|
|
830
|
-
const We = (e, t, s, o) => {
|
|
831
|
-
se(e, [], s, o).forEach((i) => t.push(i));
|
|
832
|
-
}, se = (e, t, s, o) => {
|
|
833
|
-
var r, a, l, p, c;
|
|
834
|
-
const n = [], i = T();
|
|
835
|
-
for (const u of e) {
|
|
836
|
-
if (u.redirect || u.path.includes("/login") || u.path.includes("/error") || u.path.includes("/:page(.*)") || (a = (r = u.meta) == null ? void 0 : r.roles) != null && a.length && !i.hasRole(u.meta.roles) && (l = u.meta) != null && l.permission && !i.hasPermit(u.meta.permission, ":page"))
|
|
837
|
-
continue;
|
|
838
|
-
const A = u.path.split("/");
|
|
839
|
-
A.unshift(...t);
|
|
840
|
-
const b = se(u.children || [], A, s, o), oe = {
|
|
841
|
-
key: A.join("/"),
|
|
842
|
-
label: ((p = u.name) == null ? void 0 : p.toString()) ?? "",
|
|
843
|
-
title: ((c = u.name) == null ? void 0 : c.toString()) ?? "",
|
|
844
|
-
icon: u.icon ? I(s, { ...o, icon: u.icon }) : void 0,
|
|
845
|
-
children: b.length > 0 ? b : void 0
|
|
846
|
-
};
|
|
847
|
-
(b.length > 0 || !u.children) && n.push(oe);
|
|
848
|
-
}
|
|
849
|
-
return n;
|
|
850
|
-
}, Q = ce([]), Ye = () => {
|
|
851
|
-
Q.length = 0;
|
|
852
|
-
const e = S();
|
|
853
|
-
let s = D().TabActive;
|
|
854
|
-
e.matchedRoutes(s).forEach((n, i) => {
|
|
855
|
-
var a;
|
|
856
|
-
const r = {
|
|
857
|
-
index: i,
|
|
858
|
-
path: n.path,
|
|
859
|
-
breadcrumbName: ((a = n.name) == null ? void 0 : a.toString()) ?? ""
|
|
860
|
-
};
|
|
861
|
-
Q.push(r);
|
|
862
|
-
});
|
|
863
|
-
}, Me = {
|
|
864
|
-
host: {
|
|
865
|
-
api: "SITEHOST_API",
|
|
866
|
-
url: "/openapi/RCSiteHostSrv/get",
|
|
867
|
-
fieldMap: {
|
|
868
|
-
hostId: "Id",
|
|
869
|
-
hostName: "Title"
|
|
870
|
-
},
|
|
871
|
-
loadingText: "站点配置加载中……",
|
|
872
|
-
// 不显示错误
|
|
873
|
-
hideErrorToast: !0
|
|
874
|
-
}
|
|
875
|
-
};
|
|
876
|
-
w("hostInfo", {
|
|
877
|
-
state: () => ({
|
|
878
|
-
hostInfo: {
|
|
879
|
-
Host: "",
|
|
880
|
-
Title: "",
|
|
881
|
-
API_HOST: {},
|
|
882
|
-
SERVER_HOST: {},
|
|
883
|
-
ExtraProps: {},
|
|
884
|
-
ExtraPropLines: []
|
|
885
|
-
}
|
|
886
|
-
}),
|
|
887
|
-
actions: {
|
|
888
|
-
/**
|
|
889
|
-
* 加载站点信息,如加载失败,则使用本地缓存或默认参数
|
|
890
|
-
* @param hostApi 启动配置主机地址
|
|
891
|
-
* @param hostKey 站点信息,默认为当前主域名
|
|
892
|
-
* @param mainOpenApis 宿主机开放接口
|
|
893
|
-
*/
|
|
894
|
-
async loadHostInfo(e, t, s) {
|
|
895
|
-
if (s) {
|
|
896
|
-
this._setHostInfo(s.getHostInfo());
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
return new Promise((o) => {
|
|
900
|
-
M.SITEHOST_API || (M.SITEHOST_API = e);
|
|
901
|
-
const n = t || window.location.origin;
|
|
902
|
-
E(Me.host, {
|
|
903
|
-
Query: {
|
|
904
|
-
Host: n
|
|
905
|
-
}
|
|
906
|
-
}).then((i) => {
|
|
907
|
-
if ((i == null ? void 0 : i.status) === P.SUCCESS && i.data) {
|
|
908
|
-
const r = i.data;
|
|
909
|
-
this._setHostInfo(r);
|
|
910
|
-
}
|
|
911
|
-
o();
|
|
912
|
-
});
|
|
913
|
-
});
|
|
914
|
-
},
|
|
915
|
-
/**
|
|
916
|
-
* 设置主机信息(私有方法)
|
|
917
|
-
*/
|
|
918
|
-
_setHostInfo(e) {
|
|
919
|
-
if (this.hostInfo = {
|
|
920
|
-
...this.hostInfo,
|
|
921
|
-
...e
|
|
922
|
-
}, this.hostInfo.API_HOST)
|
|
923
|
-
for (const t in this.hostInfo.API_HOST) M[t] = this.hostInfo.API_HOST[t];
|
|
924
|
-
if (this.hostInfo.SERVER_HOST)
|
|
925
|
-
for (const t in this.hostInfo.SERVER_HOST) ue[t] = this.hostInfo.SERVER_HOST[t];
|
|
926
|
-
},
|
|
927
|
-
getHostInfo() {
|
|
928
|
-
return this.hostInfo;
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
// 使用自定义数据缓存
|
|
932
|
-
persist: !1
|
|
933
|
-
// persist: {
|
|
934
|
-
// key: HOSTINFO_STORE_KEY,
|
|
935
|
-
// storage: localStorage,
|
|
936
|
-
// pick: ['hostInfo'],
|
|
937
|
-
// },
|
|
938
|
-
});
|
|
939
|
-
const Oe = "settingInfoStore", je = w("settingInfo", {
|
|
940
|
-
state: () => ({
|
|
941
|
-
fullscreen: !1,
|
|
942
|
-
menuCollapse: !1,
|
|
943
|
-
tableColumns: {}
|
|
944
|
-
}),
|
|
945
|
-
actions: {
|
|
946
|
-
/**
|
|
947
|
-
* 设置全屏
|
|
948
|
-
*/
|
|
949
|
-
setFullscreen(e) {
|
|
950
|
-
this.$patch({
|
|
951
|
-
fullscreen: e
|
|
952
|
-
});
|
|
953
|
-
},
|
|
954
|
-
/**
|
|
955
|
-
* 设置主菜单区折叠
|
|
956
|
-
*/
|
|
957
|
-
setMenuCollapse(e) {
|
|
958
|
-
this.$patch({
|
|
959
|
-
menuCollapse: e
|
|
960
|
-
});
|
|
961
|
-
},
|
|
962
|
-
/**
|
|
963
|
-
* 获取表格头配置
|
|
964
|
-
*/
|
|
965
|
-
getTableColumns(e) {
|
|
966
|
-
return this.tableColumns[e];
|
|
967
|
-
},
|
|
968
|
-
/**
|
|
969
|
-
* 设置表格头配置
|
|
970
|
-
*/
|
|
971
|
-
setTableColumns(e, t) {
|
|
972
|
-
this.$patch({
|
|
973
|
-
tableColumns: {
|
|
974
|
-
...this.tableColumns,
|
|
975
|
-
[e]: t
|
|
976
|
-
}
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
},
|
|
980
|
-
persist: {
|
|
981
|
-
key: Oe,
|
|
982
|
-
storage: localStorage,
|
|
983
|
-
pick: ["fullscreen", "menuCollapse", "tableColumns"]
|
|
984
|
-
}
|
|
985
|
-
});
|
|
986
|
-
export {
|
|
987
|
-
g as O,
|
|
988
|
-
j as a,
|
|
989
|
-
T as b,
|
|
990
|
-
Ke as c,
|
|
991
|
-
S as d,
|
|
992
|
-
D as e,
|
|
993
|
-
Q as f,
|
|
994
|
-
ve as g,
|
|
995
|
-
We as i,
|
|
996
|
-
R as r,
|
|
997
|
-
Ye as s,
|
|
998
|
-
je as u
|
|
999
|
-
};
|