/** * 施工指导只读区:开户见套餐权益;停机见开机施工参数;变更见前后对照+原施工参数。 */ import type { ConstructionGuide, PriorActivation, ConstructionPlanSummary } from "../../lib/api/ticket"; import { PLAN_FAMILY, PLAN_KIND, label } from "../../lib/api/labels"; function exitsText(v: ConstructionPlanSummary["line_exits"]): string { if (Array.isArray(v)) return v.filter(Boolean).join("、") || "—"; if (typeof v === "string" && v.trim()) { try { const parsed = JSON.parse(v) as unknown; if (Array.isArray(parsed)) return parsed.filter(Boolean).join("、") || "—"; } catch { /* plain csv */ } return v; } return "—"; } function PlanCard({ title, plan }: { title: string; plan: ConstructionPlanSummary | null | undefined }) { if (!plan) return null; return (

{title}

{plan.summary ?

{plan.summary}

: null}
套餐{plan.plan_name ?? "—"}
交付形态{plan.plan_family ? label(PLAN_FAMILY, plan.plan_family) : "—"}
档位类型{plan.plan_kind ? label(PLAN_KIND, plan.plan_kind) : "—"}
份数{plan.quantity ?? "—"}
分账号额度{plan.quota_slots ?? plan.sub_account_quota ?? "—"}
承诺带宽 {[plan.bandwidth_down_mbps != null && `↓${plan.bandwidth_down_mbps}`, plan.bandwidth_up_mbps != null && `↑${plan.bandwidth_up_mbps}`] .filter(Boolean).join(" / ") || "—"} {plan.bandwidth_committed === false ? "(不承诺)" : ""}
线路出口{exitsText(plan.line_exits)}
); } function PriorBlock({ prior }: { prior: PriorActivation }) { return (

开机时施工参数

来源开户单 {prior.ticket_no ?? prior.ticket_id ?? "—"} {prior.actual_opened_date ? ` · 实际开通 ${prior.actual_opened_date.slice(0, 10)}` : ""} (PIN/CPID 仅显示是否已登记)

{(prior.routes?.length ?? 0) > 0 && (
{prior.routes!.map((r) => ( ))}
分账号网络账户内网 IPVLAN/VNI出口 PoP带宽
{r.sub_account_id ?? "—"} {r.network_account_name ?? "—"} {[r.intranet_ip, r.subnet_mask].filter(Boolean).join(" / ") || "—"} {[r.vlan, r.vni].filter(Boolean).join(" / ") || "—"} {r.egress_pop ?? "—"} {[r.down_mbps && `↓${r.down_mbps}`, r.up_mbps && `↑${r.up_mbps}`].filter(Boolean).join(" / ") || "—"}
)} {(prior.ips?.length ?? 0) > 0 && (
{prior.ips!.map((r) => ( ))}
出境口岸境外 IP类型带宽档凭据
{r.egress ?? "—"} {r.overseas_ip ?? "—"} {r.ip_type ?? "—"} {r.bandwidth_mbps ?? "—"} PIN {r.pin_registered === "true" ? "✓" : "—"} / CPID {r.cpid_registered === "true" ? "✓" : "—"}
)} {!prior.routes?.length && !prior.ips?.length &&

暂无历史开通明细。

}
); } export function ConstructionGuidePanel({ guide }: { guide: ConstructionGuide | null | undefined }) { if (!guide || typeof guide !== "object") return null; const t = guide.ticket_type ?? ""; const isStop = t === "expiry_stop" || t === "service_stop"; const isUpdown = t === "updown"; return (

施工指导

{isUpdown ? ( <> ) : ( )} {(guide.member_plans?.length ?? 0) > 0 && (

并单成员订阅

    {guide.member_plans!.map((m) => (
  • {m.plan_name ?? m.subscription_id} {m.plan_family ? ` · ${label(PLAN_FAMILY, m.plan_family)}` : ""}
  • ))}
)} {(isStop || isUpdown) && guide.prior_activation && } {guide.defaults && (guide.defaults.suggest_down_mbps != null || (guide.defaults.line_exits?.length ?? 0) > 0) && (

系统建议(可改):出口 {exitsText(guide.defaults.line_exits)} {guide.defaults.suggest_down_mbps != null ? ` · 下行 ${guide.defaults.suggest_down_mbps} Mbps` : ""} {guide.defaults.suggest_up_mbps != null ? ` · 上行 ${guide.defaults.suggest_up_mbps} Mbps` : ""} {guide.defaults.suggest_ip_bandwidth_mbps != null ? ` · IP 档 ${guide.defaults.suggest_ip_bandwidth_mbps}` : ""} {guide.defaults.suggest_seat_count != null ? ` · 席位约 ${guide.defaults.suggest_seat_count}` : ""}

)}
); }