docs: annotate cloud network and upgrade components

This commit is contained in:
cieanyau committed 2026-11-06 00:34:17 +08:00
1 parent 7f54cae497
commit 9166b1376d
7 files changed
+95

No files matched your search

+14
View File
@@ -1,4 +1,8 @@
<script>
/**
* 每 IP 防御调整面板:父级提供实例、模块、IP 集合及操作权限,订单通过 pay 事件交回父级支付。
* 配置加载、取价、下单分别计数;IP/实例/目标档位变化时旧报价立即失效。
*/
import "~/assets/styles/MfCloudDefence.B2vl5Yip.css";
import { toDisplayString } from "vue";
import { onMounted } from "vue";
@@ -27,6 +31,7 @@ import select from "primevue/select";
import { n as cloud_instance_management_n } from "~/lib/cloud-instance-management.js";
import { s as cloud_instance_management_s } from "~/lib/cloud-instance-management.js";
import { t as cloud_instance_management_t } from "~/lib/cloud-instance-management.js";
// 恢复渲染函数的静态节点属性;保留 scopeId 和既有 class 与样式文件的对应关系。
var E = {
class: `defence network-section`,
},
@@ -94,6 +99,7 @@ var E = {
B = ref(!1),
V = ref(``),
H = ref(``),
// 报价快照同时包含权限和弹窗状态,不能把关闭前或另一实例的价格继续用于下单。
U = computed(() =>
JSON.stringify([
k.hostId,
@@ -105,6 +111,7 @@ var E = {
]),
),
W = ref(``),
// 不把当前档位再次当作可购买目标;K 要求当前选择确实存在且报价快照一致。
G = computed(() =>
P.value.filter((e) => String(e.value) !== String(N.value)),
),
@@ -122,6 +129,7 @@ var E = {
J = 0,
Y = 0,
X = !1;
// 同步 watcher 调用此函数,使配置变化与按钮禁用发生在同一个更新周期。
function Z() {
(J++,
(W.value = ``),
@@ -132,6 +140,7 @@ var E = {
watch(U, Z, {
flush: `sync`,
});
/** 按选中 IP 取防御配置,通过统一适配器校验列表和当前值,空 IP 不发请求。 */
async function Q() {
let e = ++q,
t = j.value,
@@ -163,6 +172,7 @@ var E = {
!X && e === q && (F.value = !1);
}
}
// 只有实例活动、允许升级且存在其他档位时才打开空白调整表单。
function ue() {
k.upgradeAllowed &&
k.active &&
@@ -171,6 +181,7 @@ var E = {
G.value.length &&
((M.value = ``), (R.value = ``), (z.value = !0));
}
/** 取得本次费用与续费差价;只接受序号和快照仍属于当前选择的结果。 */
async function $() {
if (
(Z(),
@@ -202,6 +213,7 @@ var E = {
!X && e === J && (B.value = !1);
}
}
/** 先核验有效报价再创建订单;只把合法订单号及金额发给父级,不在这里执行支付。 */
async function de() {
if (!K.value || X) return;
let e = U.value,
@@ -251,9 +263,11 @@ var E = {
},
),
onMounted(Q),
// HTTP 请求未必即时取消,因此卸载标记和递增序号共同阻止迟到响应回填。
onBeforeUnmount(() => {
((X = !0), q++, Z());
}),
// UI 分为 IP/档位状态、加载错误与调整弹窗;提交期间禁用选择和关闭操作。
(t, n) => {
let r = select,
i = button,