@morningfast/platform 1.0.4 → 1.0.6

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.
@@ -0,0 +1,426 @@
1
+ import { c as e, d as t, f as n, l as r, m as i, p as a, t as o, u as s } from "./register-dGBgzdRh.js";
2
+ import { t as c } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
3
+ import { ElMessage as l, ElMessageBox as u } from "element-plus";
4
+ import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, normalizeClass as b, openBlock as x, reactive as S, ref as C, renderList as w, resolveComponent as T, toDisplayString as E, withCtx as D, withModifiers as O } from "vue";
5
+ //#region src/main/pages/system/application-config/index.vue?vue&type=script&setup=true&lang.ts
6
+ var k = { class: "app-config-page" }, ee = { class: "app-config-page__apps" }, te = { class: "app-config-section__header" }, ne = { class: "app-config-section__title" }, re = { class: "app-config-page__grid" }, ie = ["onClick"], ae = { class: "app-config-card__title-row" }, oe = { class: "app-config-card__desc" }, se = { class: "app-config-card__path" }, ce = { class: "app-config-card__meta" }, le = { class: "app-config-card__meta-row" }, ue = { class: "app-config-card__meta-value" }, de = {
7
+ key: 0,
8
+ class: "app-config-card__meta-muted"
9
+ }, fe = { class: "app-config-card__footer" }, pe = { class: "app-config-card__footer-actions" }, me = {
10
+ key: 0,
11
+ class: "app-config-page__empty"
12
+ }, he = { class: "app-config-empty__actions" }, ge = { class: "app-config-dialog__footer" }, _e = { class: "app-config-dialog__footer" }, ve = { class: "app-config-remove__text" }, A = { class: "app-config-dialog__footer" }, j = /* @__PURE__ */ c(/* @__PURE__ */ y({
13
+ __name: "index",
14
+ setup(c) {
15
+ let y = C(!1), j = C("create"), M = C(!1), N = C(!1), P = C(!1), F = C(""), I = C(0), L = C(!1), R = C(!1), z = C(null), B = C(be()), V = C(B.value[0]?.id || ""), H = C(""), U = S(J()), W = S({ entry: "" }), ye = f(() => j.value === "edit" ? "编辑应用配置" : j.value === "copy" ? "复制应用配置" : "新增应用配置"), G = f(() => (I.value, B.value.map((e) => ({
16
+ ...e,
17
+ entryResolution: n(e)
18
+ })))), K = f(() => G.value.find((e) => e.id === F.value)), q = f(() => K.value?.entryResolution);
19
+ function be() {
20
+ return e();
21
+ }
22
+ function J() {
23
+ return {
24
+ id: "",
25
+ name: "",
26
+ description: "",
27
+ basePath: "",
28
+ entry: ""
29
+ };
30
+ }
31
+ function Y() {
32
+ j.value = "create", H.value = "", Object.assign(U, J()), y.value = !0;
33
+ }
34
+ function xe(e) {
35
+ j.value = "edit", H.value = e.id, Object.assign(U, {
36
+ id: e.id,
37
+ name: e.name,
38
+ description: e.description,
39
+ basePath: e.basePath,
40
+ entry: e.entry
41
+ }), y.value = !0;
42
+ }
43
+ function Se(e) {
44
+ j.value = "copy", H.value = "", Object.assign(U, {
45
+ id: "",
46
+ name: e.name,
47
+ description: e.description,
48
+ basePath: e.basePath,
49
+ entry: e.entry
50
+ }), y.value = !0;
51
+ }
52
+ function Ce(e) {
53
+ z.value = e, L.value = !0;
54
+ }
55
+ function we(e) {
56
+ let t = n(e);
57
+ F.value = e.id, W.entry = t.localEntry, N.value = !0;
58
+ }
59
+ async function Te() {
60
+ if (!U.name.trim() || !U.basePath.trim()) {
61
+ l.warning("请先填写子应用名称和路由前缀");
62
+ return;
63
+ }
64
+ if (U.entry.trim() && r(U.entry)) {
65
+ await u.alert("公共应用配置不能保存 localhost、127.0.0.1 或内网 IP。请把本地调试地址保存到“本地覆盖”。", "入口地址不能保存到公共配置", {
66
+ type: "warning",
67
+ confirmButtonText: "知道了"
68
+ });
69
+ return;
70
+ }
71
+ M.value = !0;
72
+ try {
73
+ let e = {
74
+ id: H.value || `app-${Date.now()}`,
75
+ name: U.name.trim(),
76
+ type: "sub",
77
+ description: U.description.trim(),
78
+ basePath: s(U.basePath),
79
+ entry: U.entry.trim()
80
+ };
81
+ j.value === "edit" ? B.value = B.value.map((t) => t.id === H.value ? e : t) : B.value = [e, ...B.value], await Z(), await o(), V.value = e.id, y.value = !1, l.success(De());
82
+ } finally {
83
+ M.value = !1;
84
+ }
85
+ }
86
+ async function Ee() {
87
+ if (K.value) {
88
+ P.value = !0;
89
+ try {
90
+ await i(K.value.id, W.entry), await o(), I.value += 1, N.value = !1, l.success(W.entry.trim() ? "本地覆盖已保存" : "本地覆盖已清除");
91
+ } finally {
92
+ P.value = !1;
93
+ }
94
+ }
95
+ }
96
+ async function X() {
97
+ if (K.value) {
98
+ P.value = !0;
99
+ try {
100
+ await t(K.value.id), await o(), W.entry = "", I.value += 1, N.value = !1, l.success("本地覆盖已清除");
101
+ } finally {
102
+ P.value = !1;
103
+ }
104
+ }
105
+ }
106
+ function De() {
107
+ return j.value === "edit" ? "应用配置已更新" : j.value === "copy" ? "应用配置已复制" : "应用配置已新增";
108
+ }
109
+ async function Oe() {
110
+ if (!z.value) {
111
+ L.value = !1;
112
+ return;
113
+ }
114
+ R.value = !0;
115
+ try {
116
+ await t(z.value.id), B.value = B.value.filter((e) => e.id !== z.value?.id), await Z(), await o(), I.value += 1, V.value = B.value[0]?.id || "", L.value = !1, l.success("应用配置已删除");
117
+ } finally {
118
+ R.value = !1, z.value = null;
119
+ }
120
+ }
121
+ async function Z() {
122
+ await a(B.value);
123
+ }
124
+ function ke() {
125
+ H.value = "", Object.assign(U, J());
126
+ }
127
+ function Ae() {
128
+ F.value = "", W.entry = "";
129
+ }
130
+ function Q(e) {
131
+ return e === "local" ? "本地覆盖" : e === "config" ? "接口配置" : "环境默认";
132
+ }
133
+ function $(e) {
134
+ return e === "local" ? "warning" : e === "config" ? "success" : "info";
135
+ }
136
+ return (e, t) => {
137
+ let n = T("el-tag"), r = T("el-button"), i = T("el-scrollbar"), a = T("el-empty"), o = T("el-input"), s = T("el-form-item"), c = T("el-col"), l = T("el-row"), u = T("el-alert"), f = T("el-form"), S = T("el-dialog");
138
+ return x(), h("div", k, [
139
+ g("section", ee, [g("div", te, [g("div", ne, [t[13] ||= g("h2", null, "子应用", -1), v(n, {
140
+ size: "small",
141
+ effect: "plain"
142
+ }, {
143
+ default: D(() => [_(E(B.value.length), 1)]),
144
+ _: 1
145
+ })]), v(r, {
146
+ type: "primary",
147
+ onClick: Y
148
+ }, {
149
+ default: D(() => [...t[14] ||= [_("新增子应用", -1)]]),
150
+ _: 1
151
+ })]), v(i, { class: "app-config-page__scroll" }, {
152
+ default: D(() => [g("div", re, [(x(!0), h(d, null, w(G.value, (e) => (x(), h("article", {
153
+ key: e.id,
154
+ class: b(["app-config-card", { "is-active": V.value === e.id }]),
155
+ onClick: (t) => V.value = e.id
156
+ }, [
157
+ g("div", ae, [g("h2", null, E(e.name), 1), v(n, {
158
+ type: "success",
159
+ effect: "plain",
160
+ size: "small"
161
+ }, {
162
+ default: D(() => [...t[15] ||= [_("子应用", -1)]]),
163
+ _: 1
164
+ })]),
165
+ g("p", oe, E(e.description || "暂无子应用说明"), 1),
166
+ g("div", se, E(e.basePath), 1),
167
+ g("div", ce, [
168
+ g("div", le, [t[16] ||= g("span", { class: "app-config-card__meta-label" }, "当前入口", -1), v(n, {
169
+ type: $(e.entryResolution.source),
170
+ effect: "plain",
171
+ size: "small"
172
+ }, {
173
+ default: D(() => [_(E(Q(e.entryResolution.source)), 1)]),
174
+ _: 2
175
+ }, 1032, ["type"])]),
176
+ g("div", ue, E(e.entryResolution.entry), 1),
177
+ e.entryResolution.source === "config" ? m("", !0) : (x(), h("div", de, " 公共入口:" + E(e.entry || "未配置"), 1))
178
+ ]),
179
+ g("div", fe, [t[21] ||= g("span", { class: "app-config-card__mount" }, "qiankun", -1), g("div", pe, [
180
+ v(r, {
181
+ type: "primary",
182
+ link: "",
183
+ onClick: O((t) => xe(e), ["stop"])
184
+ }, {
185
+ default: D(() => [...t[17] ||= [_("配置", -1)]]),
186
+ _: 1
187
+ }, 8, ["onClick"]),
188
+ v(r, {
189
+ type: "primary",
190
+ link: "",
191
+ onClick: O((t) => we(e), ["stop"])
192
+ }, {
193
+ default: D(() => [...t[18] ||= [_("本地覆盖", -1)]]),
194
+ _: 1
195
+ }, 8, ["onClick"]),
196
+ v(r, {
197
+ type: "primary",
198
+ link: "",
199
+ onClick: O((t) => Se(e), ["stop"])
200
+ }, {
201
+ default: D(() => [...t[19] ||= [_("复制", -1)]]),
202
+ _: 1
203
+ }, 8, ["onClick"]),
204
+ v(r, {
205
+ type: "danger",
206
+ link: "",
207
+ onClick: O((t) => Ce(e), ["stop"])
208
+ }, {
209
+ default: D(() => [...t[20] ||= [_("删除", -1)]]),
210
+ _: 1
211
+ }, 8, ["onClick"])
212
+ ])])
213
+ ], 10, ie))), 128))])]),
214
+ _: 1
215
+ })]),
216
+ B.value.length ? m("", !0) : (x(), h("section", me, [v(a, { description: "暂无子应用配置" }, {
217
+ default: D(() => [g("div", he, [v(r, {
218
+ type: "primary",
219
+ onClick: Y
220
+ }, {
221
+ default: D(() => [...t[22] ||= [_("新增子应用", -1)]]),
222
+ _: 1
223
+ })])]),
224
+ _: 1
225
+ })])),
226
+ v(S, {
227
+ modelValue: y.value,
228
+ "onUpdate:modelValue": t[6] ||= (e) => y.value = e,
229
+ title: ye.value,
230
+ width: "720px",
231
+ "destroy-on-close": "",
232
+ onClosed: ke
233
+ }, {
234
+ footer: D(() => [g("div", ge, [v(r, { onClick: t[5] ||= (e) => y.value = !1 }, {
235
+ default: D(() => [...t[23] ||= [_("取消", -1)]]),
236
+ _: 1
237
+ }), v(r, {
238
+ type: "primary",
239
+ loading: M.value,
240
+ onClick: Te
241
+ }, {
242
+ default: D(() => [...t[24] ||= [_("保存", -1)]]),
243
+ _: 1
244
+ }, 8, ["loading"])])]),
245
+ default: D(() => [v(f, {
246
+ "label-width": "92px",
247
+ onSubmit: t[4] ||= O(() => {}, ["prevent"])
248
+ }, {
249
+ default: D(() => [v(l, { gutter: 16 }, {
250
+ default: D(() => [
251
+ v(c, {
252
+ xs: 24,
253
+ sm: 12
254
+ }, {
255
+ default: D(() => [v(s, { label: "子应用名称" }, {
256
+ default: D(() => [v(o, {
257
+ modelValue: U.name,
258
+ "onUpdate:modelValue": t[0] ||= (e) => U.name = e,
259
+ placeholder: "请输入子应用名称"
260
+ }, null, 8, ["modelValue"])]),
261
+ _: 1
262
+ })]),
263
+ _: 1
264
+ }),
265
+ v(c, {
266
+ xs: 24,
267
+ sm: 12
268
+ }, {
269
+ default: D(() => [v(s, { label: "路由前缀" }, {
270
+ default: D(() => [v(o, {
271
+ modelValue: U.basePath,
272
+ "onUpdate:modelValue": t[1] ||= (e) => U.basePath = e,
273
+ placeholder: "例如 /micro/sub-app"
274
+ }, null, 8, ["modelValue"])]),
275
+ _: 1
276
+ })]),
277
+ _: 1
278
+ }),
279
+ v(c, {
280
+ xs: 24,
281
+ sm: 12
282
+ }, {
283
+ default: D(() => [v(s, { label: "公共入口" }, {
284
+ default: D(() => [v(o, {
285
+ modelValue: U.entry,
286
+ "onUpdate:modelValue": t[2] ||= (e) => U.entry = e,
287
+ placeholder: "例如 https://test.xxx.com/reporting-center"
288
+ }, null, 8, ["modelValue"])]),
289
+ _: 1
290
+ })]),
291
+ _: 1
292
+ }),
293
+ v(c, { xs: 24 }, {
294
+ default: D(() => [v(s, { label: "子应用说明" }, {
295
+ default: D(() => [v(o, {
296
+ modelValue: U.description,
297
+ "onUpdate:modelValue": t[3] ||= (e) => U.description = e,
298
+ type: "textarea",
299
+ rows: 3,
300
+ placeholder: "请输入子应用说明"
301
+ }, null, 8, ["modelValue"])]),
302
+ _: 1
303
+ })]),
304
+ _: 1
305
+ })
306
+ ]),
307
+ _: 1
308
+ }), v(u, {
309
+ type: "info",
310
+ closable: !1,
311
+ "show-icon": "",
312
+ title: "公共配置用于环境共享;本地调试地址请使用本地覆盖。"
313
+ })]),
314
+ _: 1
315
+ })]),
316
+ _: 1
317
+ }, 8, ["modelValue", "title"]),
318
+ v(S, {
319
+ modelValue: N.value,
320
+ "onUpdate:modelValue": t[10] ||= (e) => N.value = e,
321
+ title: "本地调试覆盖",
322
+ width: "640px",
323
+ "destroy-on-close": "",
324
+ onClosed: Ae
325
+ }, {
326
+ footer: D(() => [g("div", _e, [
327
+ v(r, {
328
+ disabled: !q.value?.localEntry,
329
+ onClick: X
330
+ }, {
331
+ default: D(() => [...t[25] ||= [_(" 清除覆盖 ", -1)]]),
332
+ _: 1
333
+ }, 8, ["disabled"]),
334
+ v(r, { onClick: t[9] ||= (e) => N.value = !1 }, {
335
+ default: D(() => [...t[26] ||= [_("取消", -1)]]),
336
+ _: 1
337
+ }),
338
+ v(r, {
339
+ type: "primary",
340
+ loading: P.value,
341
+ onClick: Ee
342
+ }, {
343
+ default: D(() => [...t[27] ||= [_(" 保存本地覆盖 ", -1)]]),
344
+ _: 1
345
+ }, 8, ["loading"])
346
+ ])]),
347
+ default: D(() => [v(f, {
348
+ "label-width": "92px",
349
+ onSubmit: t[8] ||= O(() => {}, ["prevent"])
350
+ }, {
351
+ default: D(() => [
352
+ v(s, { label: "子应用" }, {
353
+ default: D(() => [v(o, {
354
+ "model-value": K.value?.name || "",
355
+ disabled: ""
356
+ }, null, 8, ["model-value"])]),
357
+ _: 1
358
+ }),
359
+ v(s, { label: "当前入口" }, {
360
+ default: D(() => [v(o, {
361
+ "model-value": q.value?.entry || "",
362
+ disabled: ""
363
+ }, null, 8, ["model-value"])]),
364
+ _: 1
365
+ }),
366
+ v(s, { label: "来源" }, {
367
+ default: D(() => [q.value ? (x(), p(n, {
368
+ key: 0,
369
+ type: $(q.value.source),
370
+ effect: "plain"
371
+ }, {
372
+ default: D(() => [_(E(Q(q.value.source)), 1)]),
373
+ _: 1
374
+ }, 8, ["type"])) : m("", !0)]),
375
+ _: 1
376
+ }),
377
+ v(s, { label: "本地入口" }, {
378
+ default: D(() => [v(o, {
379
+ modelValue: W.entry,
380
+ "onUpdate:modelValue": t[7] ||= (e) => W.entry = e,
381
+ placeholder: "例如 http://localhost:8084"
382
+ }, null, 8, ["modelValue"])]),
383
+ _: 1
384
+ }),
385
+ v(u, {
386
+ type: "warning",
387
+ closable: !1,
388
+ "show-icon": "",
389
+ title: "本地覆盖只写入当前浏览器,不会保存到公共配置。"
390
+ })
391
+ ]),
392
+ _: 1
393
+ })]),
394
+ _: 1
395
+ }, 8, ["modelValue"]),
396
+ v(S, {
397
+ modelValue: L.value,
398
+ "onUpdate:modelValue": t[12] ||= (e) => L.value = e,
399
+ title: "删除子应用",
400
+ width: "420px",
401
+ "destroy-on-close": ""
402
+ }, {
403
+ footer: D(() => [g("div", A, [v(r, { onClick: t[11] ||= (e) => L.value = !1 }, {
404
+ default: D(() => [...t[30] ||= [_("取消", -1)]]),
405
+ _: 1
406
+ }), v(r, {
407
+ type: "danger",
408
+ loading: R.value,
409
+ onClick: Oe
410
+ }, {
411
+ default: D(() => [...t[31] ||= [_("确认删除", -1)]]),
412
+ _: 1
413
+ }, 8, ["loading"])])]),
414
+ default: D(() => [g("p", ve, [
415
+ t[28] ||= _(" 确认删除 ", -1),
416
+ g("strong", null, E(z.value?.name), 1),
417
+ t[29] ||= _(" 吗?删除后公共配置和本地覆盖会立即移除。 ", -1)
418
+ ])]),
419
+ _: 1
420
+ }, 8, ["modelValue"])
421
+ ]);
422
+ };
423
+ }
424
+ }), [["__scopeId", "data-v-56645a53"]]);
425
+ //#endregion
426
+ export { j as default };