|
|
@@ -1,13 +1,13 @@
|
|
|
import { Fragment, useEffect, useRef, useState, type FormEvent, type ReactNode } from "react";
|
|
|
import {
|
|
|
ArrowLeft, ArrowRight, Check, ChevronDown, CircleAlert, ClipboardCheck, FolderOpen,
|
|
|
- FileUp, Image, Info, Plus, RefreshCcw, ShieldAlert, TriangleAlert, X,
|
|
|
+ FileUp, Image, Info, Plus, RefreshCcw, ShieldAlert, Ticket, TriangleAlert, X,
|
|
|
} from "lucide-react";
|
|
|
import { Button } from "../components/ui/button";
|
|
|
import { Input } from "../components/ui/input";
|
|
|
import { FieldHint } from "../components/ui/field-hint";
|
|
|
import { FieldLabel } from "../components/ui/field-label";
|
|
|
-import { Navigate, useLocation, useNavigate, useParams, useSearchParams } from "react-router";
|
|
|
+import { Link, Navigate, useLocation, useNavigate, useParams, useSearchParams } from "react-router";
|
|
|
import { opsTeamGetList, rowsOf, subAccountGetList } from "../lib/api/bos";
|
|
|
import { fetchAllPages } from "../lib/fetch-all-pages";
|
|
|
import { LIST_PAGE_SIZE } from "../lib/list-paging";
|
|
|
@@ -19,7 +19,8 @@ import { ConstructionGuidePanel } from "../components/work-order/ConstructionGui
|
|
|
import { ScanFieldButton } from "../components/work-order/ScanFieldButton";
|
|
|
import { EvidencePhotoField, type EvidencePhoto } from "../components/work-order/EvidencePhotoField";
|
|
|
import { ApprovedExitSelect, alignApprovedExit } from "../components/work-order/ApprovedExitSelect";
|
|
|
-import { OpsDialog, OpsNotice } from "../components/OperationsKit";
|
|
|
+import { OpsDialog, OpsNotice, OpsStatus } from "../components/OperationsKit";
|
|
|
+import { RecordTabs } from "../components/RecordTabs";
|
|
|
import {
|
|
|
completionGenerate, completionReceipt, completionReject, isYes, messageConfirmConflict, ticketAssign, ticketBackfill,
|
|
|
ticketBackfillDraft,
|
|
|
@@ -46,6 +47,7 @@ import { useSubmit } from "../lib/useLoad";
|
|
|
import { useDemoIdentity } from "../lib/demo-session";
|
|
|
import { customerLiveTicketActions } from "../lib/customer-workspace";
|
|
|
import "../styles/operations.css";
|
|
|
+import "../styles/organization.css";
|
|
|
import "../styles/work-orders.css";
|
|
|
import "../styles/work-order-record.css";
|
|
|
import "../styles/work-order-guide.css";
|
|
|
@@ -258,31 +260,14 @@ function LogPanel({ logs }: { logs: TicketDetail["process_logs"] }) {
|
|
|
</ol>;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * 交付事实里的一段折叠(原型 v3 `details.seg`)。
|
|
|
- *
|
|
|
- * 摘要行给关键数字(结论/日期/条数),折叠也不丢信息;只有与本单当前状态相关的
|
|
|
- * 那一段默认展开,其余收起来,避免六张明细表把正文拉成几屏长。
|
|
|
- */
|
|
|
-function FactSeg({ title, summary, badge, tone, open, children }: {
|
|
|
- title: string; summary: string; badge: string; tone?: "ok" | "warn"; open: boolean; children: ReactNode;
|
|
|
-}) {
|
|
|
- /**
|
|
|
- * 展开态由本组件持有:`open` 只作为初值/本单状态变化后的落点。
|
|
|
- * ⛔ 直接把 `open` 绑到 `details`:页面因提示条、刷新等重渲染时会把用户手动展开的段收回,
|
|
|
- * 一次折叠就白点了。
|
|
|
- */
|
|
|
- const [expanded, setExpanded] = useState(open);
|
|
|
- useEffect(() => { setExpanded(open); }, [open]);
|
|
|
- return <details className="work-order-seg" open={expanded} onToggle={(e) => setExpanded(e.currentTarget.open)}>
|
|
|
- <summary>
|
|
|
- <span className="work-order-seg-title">{title}</span>
|
|
|
- <span className="work-order-seg-summary">{summary}</span>
|
|
|
- <span className={`work-order-seg-badge${tone ? ` ${tone}` : ""}`}>{badge}</span>
|
|
|
- <ChevronDown className="work-order-seg-chev" size={16} />
|
|
|
- </summary>
|
|
|
- <div className="work-order-seg-body">{children}</div>
|
|
|
- </details>;
|
|
|
+function recordValue(value: string | number | null | undefined) {
|
|
|
+ return value == null || value === "" || value === "-" ? <span className="table-placeholder">—</span> : value;
|
|
|
+}
|
|
|
+
|
|
|
+function ExecutionConclusion({ value }: { value: string | null }) {
|
|
|
+ return <span className="work-order-exec-conclusion" data-conclusion={value ?? undefined}>
|
|
|
+ {recordValue(CONCLUSION_NAMES[value ?? ""] ?? value)}
|
|
|
+ </span>;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -291,12 +276,11 @@ function FactSeg({ title, summary, badge, tone, open, children }: {
|
|
|
* 下载按 `material_id` 现签(`detail@v1` 刻意不下发对象键);`readonly` 只关下载按钮,
|
|
|
* 不影响清单本身——工单进终态后材料仍需可查。
|
|
|
*/
|
|
|
-function MaterialList({ ticketId, items, empty, allowDownload = true }: {
|
|
|
- ticketId: string; items: TicketMaterial[]; empty: string; allowDownload?: boolean;
|
|
|
+function MaterialList({ ticketId, items, label, allowDownload }: {
|
|
|
+ ticketId: string; items: TicketMaterial[]; label: string; allowDownload: boolean;
|
|
|
}) {
|
|
|
const [busy, setBusy] = useState<string | null>(null);
|
|
|
const [tip, setTip] = useState("");
|
|
|
- if (!items.length) return <p className="work-order-seg-foot">{empty}</p>;
|
|
|
const download = async (m: TicketMaterial) => {
|
|
|
setTip(""); setBusy(m.material_id);
|
|
|
try {
|
|
|
@@ -309,14 +293,14 @@ function MaterialList({ ticketId, items, empty, allowDownload = true }: {
|
|
|
}
|
|
|
};
|
|
|
return <>
|
|
|
- <div className="work-order-table-wrap compact"><table>
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label={label} tabIndex={0}><table>
|
|
|
<thead><tr><th>文件名</th><th>类型</th><th>大小</th><th>登记人</th><th>登记时间</th>{allowDownload && <th><span className="sr-only">操作</span></th>}</tr></thead>
|
|
|
<tbody>{items.map((m) => <tr key={m.material_id}>
|
|
|
- <td>{m.file_name ?? m.material_id}</td>
|
|
|
+ <td className="table-wrap-text"><span className="table-cell-title">{m.file_name ?? m.material_id}</span></td>
|
|
|
<td>{materialKindName(m.kind)}</td>
|
|
|
- <td>{numText(m.size_bytes, " B")}</td>
|
|
|
- <td>{m.uploaded_by ?? "-"}</td>
|
|
|
- <td>{fmtTime(m.uploaded_at)}</td>
|
|
|
+ <td>{recordValue(numText(m.size_bytes, " B"))}</td>
|
|
|
+ <td>{recordValue(m.uploaded_by)}</td>
|
|
|
+ <td>{recordValue(fmtTime(m.uploaded_at))}</td>
|
|
|
{allowDownload && <td><Button variant="ghost" size="sm" type="button" disabled={busy === m.material_id} onClick={() => void download(m)}>下载</Button></td>}
|
|
|
</tr>)}</tbody>
|
|
|
</table></div>
|
|
|
@@ -1135,6 +1119,28 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
</div>;
|
|
|
}
|
|
|
|
|
|
+const WORK_ORDER_RECORD_TABS = [
|
|
|
+ { id: "overview", label: "工单概况" },
|
|
|
+ { id: "guide", label: "施工指导" },
|
|
|
+ { id: "backfill", label: "施工回填" },
|
|
|
+ { id: "facts", label: "交付事实" },
|
|
|
+ { id: "receipt", label: "竣工回执" },
|
|
|
+ { id: "messages", label: "运营商报文" },
|
|
|
+ { id: "references", label: "客户与订阅" },
|
|
|
+ { id: "trace", label: "追溯与关联" },
|
|
|
+] as const;
|
|
|
+
|
|
|
+type WorkOrderRecordTab = (typeof WORK_ORDER_RECORD_TABS)[number]["id"];
|
|
|
+
|
|
|
+function WorkOrderPanel({ tab, active, className = "", children }: {
|
|
|
+ tab: WorkOrderRecordTab; active: WorkOrderRecordTab; className?: string; children: ReactNode;
|
|
|
+}) {
|
|
|
+ return <section className={`record-tab-panel work-order-record-panel ${className}`} id={`work-order-panel-${tab}`}
|
|
|
+ role="tabpanel" aria-labelledby={`work-order-tab-${tab}`} hidden={active !== tab} tabIndex={0}>
|
|
|
+ {children}
|
|
|
+ </section>;
|
|
|
+}
|
|
|
+
|
|
|
/** 工单详情(`/ticket/detail@v1`)。 */
|
|
|
export function WorkOrderRecordPage() {
|
|
|
const { id } = useParams();
|
|
|
@@ -1147,6 +1153,7 @@ export function WorkOrderRecordPage() {
|
|
|
/** 缺口入口打开对话框时的定位目标。 */
|
|
|
const [sheetFocus, setSheetFocus] = useState<GapFocus | undefined>(undefined);
|
|
|
const [notice, setNotice] = useState("");
|
|
|
+ const [selectedTab, setSelectedTab] = useState<{ ticketId: string; tab: WorkOrderRecordTab } | null>(null);
|
|
|
const [materialOpen, setMaterialOpen] = useState(false);
|
|
|
/** 关联资料对话框的浏览栈,栈顶为当前档案。 */
|
|
|
const [refStack, setRefStack] = useState<RefTarget[]>([]);
|
|
|
@@ -1222,7 +1229,8 @@ export function WorkOrderRecordPage() {
|
|
|
|
|
|
if (!id) return <Navigate to={back.to} replace />;
|
|
|
if (detail.loading) return <section className="ops-record-page"><div className="work-order-empty"><Info size={27} /><h3>正在读取工单详情…</h3></div></section>;
|
|
|
- if (fail || !d) return <section className="ops-record-page"><Button variant="outline" onClick={goBack}><ArrowLeft size={16} />{back.label}</Button>{fail && <TicketState fail={fail} onRetry={detail.reload} />}</section>;
|
|
|
+ const backLink = <Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link>;
|
|
|
+ if (fail || !d) return <section className="ops-record-page">{backLink}{fail && <TicketState fail={fail} onRetry={detail.reload} />}</section>;
|
|
|
|
|
|
const t = d.ticket;
|
|
|
const can = d.actions;
|
|
|
@@ -1277,7 +1285,7 @@ export function WorkOrderRecordPage() {
|
|
|
const canClientConfirmClose = Boolean(customerGate?.confirmClose);
|
|
|
const hasCustomerActions = canClientWithdraw || canClientConfirmClose;
|
|
|
const hasActions = primaryActions.length + opsActions.length > 0 || hasCustomerActions;
|
|
|
- const showCompletion = d.completion || can.generate_completion || can.confirm_receipt;
|
|
|
+ const showCompletion = Boolean(d.completion || can.generate_completion || can.confirm_receipt);
|
|
|
/**
|
|
|
* 终态(与后端 `domain::TERMINAL` 同口径:`settled`/`terminated`)⇒ 材料登记口**收起**。
|
|
|
* 依据:工单§4.2 不可逆点②(已办结只读,点名禁止「补一张材料」)+ §14 页约「终态 ⇒ 60401 收起入口」。
|
|
|
@@ -1301,15 +1309,16 @@ export function WorkOrderRecordPage() {
|
|
|
* 因此这些类型只展示交付条目(数量、规格),⛔ 不渲染核对结果/核对时间两列,段头也不给告警色。
|
|
|
*/
|
|
|
const checklistNote = t.ticket_type === "updown"
|
|
|
- ? "变更协议单把「新档交付+原档回收」收在一张单里:完成条件包含清单核对(清单须无未核对条目)+执行结论与凭证,故此处计数应与工单终态一致。"
|
|
|
+ ? "交付新档、回收原档后,核对条目并在施工回填中登记结论与凭证。"
|
|
|
: checklistGated
|
|
|
- ? "服务开通单的完成条件包含清单核对:清单须非空且无未核对条目、实际开通日不晚于当天、处理记录非空,故此处计数应与工单终态一致。"
|
|
|
- : t.ticket_type === "open"
|
|
|
- ? "开户单的闭环必填组是回填组(线路/境外 IP/结论与凭证),不含清单核对:本段只列订阅带出的交付条目作参照,不设核对状态、也不阻断本单完成与闭环;核对由后续服务开通单或回访动作补齐。"
|
|
|
- : "本类型工单的闭环必填组不含清单核对:本段只列交付条目作参照,不设核对状态,也不阻断完成/闭环。";
|
|
|
+ ? "完成前需核对清单,填写实际开通日期和处理记录。"
|
|
|
+ : "此清单供交付查阅。";
|
|
|
/** 参考卡的弹窗入参(在 JSX 回调里仍要能拿到主键,先固化一次,⛔ 靠闭包里的可选链猜)。 */
|
|
|
const refCustomer = d.customer;
|
|
|
const refOrder = d.order;
|
|
|
+ const refSubscriptionId = refOrder?.subscription_id ?? t.subscription_id;
|
|
|
+ const memberSubscriptions = d.subscriptions ?? [];
|
|
|
+ const submitterLabel = t.submitter_type === "customer" ? "客户侧提交" : t.submitter_type === "reporter" ? "报障人提交" : "运营侧代报";
|
|
|
|
|
|
/**
|
|
|
* 「下一步」=详情页唯一的主动作。
|
|
|
@@ -1426,49 +1435,57 @@ export function WorkOrderRecordPage() {
|
|
|
if (!todoNodes.length && t.status === "settled") todoNodes.push(
|
|
|
<div className="work-order-done-strip" key="settled">本单已办结 · 全程 {d.process_logs.length} 条留痕、{d.materials.length} 份材料 · 只读可追溯</div>);
|
|
|
|
|
|
- /**
|
|
|
- * 「交付事实」默认展开的那一段=与本单当前状态最相关的一段(原型 v3:其余收起)。
|
|
|
- * 展开哪段只用已判定过的 `can.*`/驳回态,⛔ 前端再推一遍状态机。
|
|
|
- */
|
|
|
- const openSeg: string = lastReject || can.generate_completion || can.confirm_receipt ? "completion"
|
|
|
- : can.backfill ? "backfill"
|
|
|
- : can.check_done ? "checklist" : "";
|
|
|
- /**
|
|
|
- * 材料按 `kind` 归位(2026-11-17 原型 v3):五类材料各有唯一产出方,页面上就各自回到那一段。
|
|
|
- * ⛔ 再单开一张「过程材料」平表——那样用户看不出某一份材料属于哪一步。
|
|
|
- */
|
|
|
- const byKind = (kind: string) => d.materials.filter((m) => m.kind === kind);
|
|
|
- const submitMaterials = byKind("submit_evidence");
|
|
|
- /** 回填段:回填时自动归档的凭证 + 现场补传的过程材料(后者是这一段唯一的写入口)。 */
|
|
|
- const backfillMaterials = [...byKind("backfill_evidence"), ...byKind(MANUAL_MATERIAL_KIND)];
|
|
|
- const completionMaterials = byKind("completion_pdf");
|
|
|
- /** 非主线单(故障/售后)没有回填段 ⇒ 过程材料单独成段,否则这些单上看不到任何材料。 */
|
|
|
- const hasBackfillSeg = !!(d.backfill || can.backfill);
|
|
|
+ const materialGroups = [
|
|
|
+ { kind: "submit_evidence", label: "客户提交材料" },
|
|
|
+ { kind: "backfill_evidence", label: "施工回填凭证" },
|
|
|
+ { kind: MANUAL_MATERIAL_KIND, label: "过程材料" },
|
|
|
+ { kind: "completion_pdf", label: "竣工文件" },
|
|
|
+ ].map((group) => ({ ...group, items: d.materials.filter((item) => item.kind === group.kind) }));
|
|
|
+ const canAddMaterials = !clientView && !materialLocked;
|
|
|
/** 客户视角不放置下载入口:后端 `material_grant` 对客户身份只放行 `submit_evidence`。 */
|
|
|
const canDownloadMaterial = !clientView;
|
|
|
- /** 「交付事实」里实际渲染了几段(段有数据或本单还能补时才计数,空段不占位)。 */
|
|
|
- const factsCount = [hasBackfillSeg, d.service_items.length > 0, (d.open_stop?.accounts.length ?? 0) > 0, showCompletion, d.messages.length > 0, !hasBackfillSeg && backfillMaterials.length > 0].filter(Boolean).length;
|
|
|
+ const accountRows = d.open_stop?.accounts ?? [];
|
|
|
+ const showBackfill = Boolean(d.backfill?.backfill_id || can.backfill || can.check_and_backfill || d.backfill?.ext);
|
|
|
+ const tabVisible = {
|
|
|
+ overview: true,
|
|
|
+ guide: Boolean(d.construction_guide),
|
|
|
+ backfill: showBackfill,
|
|
|
+ facts: d.service_items.length > 0 || accountRows.length > 0 || canAddMaterials || materialGroups.some((group) => group.items.length > 0),
|
|
|
+ receipt: showCompletion,
|
|
|
+ messages: d.messages.length > 0,
|
|
|
+ references: true,
|
|
|
+ trace: true,
|
|
|
+ } satisfies Record<WorkOrderRecordTab, boolean>;
|
|
|
+ const tabs = WORK_ORDER_RECORD_TABS.filter(({ id: tab }) => tabVisible[tab]).map((tab) => ({
|
|
|
+ ...tab,
|
|
|
+ count: tab.id === "messages" ? d.messages.length : undefined,
|
|
|
+ }));
|
|
|
+ const activeTab = selectedTab?.ticketId === id && tabVisible[selectedTab.tab] ? selectedTab.tab : "overview";
|
|
|
const receiptState = d.completion
|
|
|
- ? d.completion.receipt_at && d.completion.receipt_valid !== "0" ? { text: "回执已确认", tone: "ok" as const }
|
|
|
- : d.completion.receipt_at ? { text: "回执已失效", tone: "warn" as const }
|
|
|
- : { text: "已回传待回执", tone: "warn" as const }
|
|
|
- : { text: "未生成", tone: "warn" as const };
|
|
|
+ ? d.completion.receipt_at && d.completion.receipt_valid !== "0" ? { text: "回执已确认", tone: "success" as const }
|
|
|
+ : d.completion.receipt_at ? { text: "回执已失效", tone: "warning" as const }
|
|
|
+ : { text: "已回传待回执", tone: "warning" as const }
|
|
|
+ : { text: "未生成", tone: "neutral" as const };
|
|
|
const copyLink = async () => {
|
|
|
try { await navigator.clipboard.writeText(window.location.href); setNotice("本单链接已复制。"); }
|
|
|
catch { setNotice("复制失败:浏览器拒绝了剪贴板访问。"); }
|
|
|
};
|
|
|
|
|
|
return <section className={`ops-record-page${clientView ? " customer-record-view" : ""}`}>
|
|
|
- <Button className="ops-record-back" variant="ghost" size="sm" onClick={goBack}><ArrowLeft size={16} />{back.label}</Button>
|
|
|
+ {backLink}
|
|
|
{notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
|
|
|
- {/* 页首一卡收口:工单号+类型+状态、唯一主 CTA、元信息与细进度条。
|
|
|
- 原「指标条」5 格并进这一行,状态只出现一次;其余动作收进「更多操作」。 */}
|
|
|
<header className="work-order-head">
|
|
|
<div className="work-order-head-top">
|
|
|
- <div className="work-order-head-id">
|
|
|
- <span className="work-order-head-no">{t.ticket_no}</span>
|
|
|
- <TypeTag type={t.ticket_type} />
|
|
|
- <StatusTag status={t.status} type={t.ticket_type} />
|
|
|
+ <div className="work-order-head-main">
|
|
|
+ <div className="work-order-head-icon" aria-hidden="true"><Ticket size={25} /></div>
|
|
|
+ <div className="work-order-head-copy">
|
|
|
+ <span className="work-order-head-no">{t.ticket_no}</span>
|
|
|
+ <h1 className="work-order-head-title">{t.title}</h1>
|
|
|
+ <div className="work-order-head-tags">
|
|
|
+ <TypeTag type={t.ticket_type} />
|
|
|
+ <StatusTag status={t.status} type={t.ticket_type} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div className="work-order-head-actions">
|
|
|
{nextStep && !viewerReadOnly && <Button onClick={runNextStep}>{nextStep.label}<ArrowRight size={16} /></Button>}
|
|
|
@@ -1487,7 +1504,6 @@ export function WorkOrderRecordPage() {
|
|
|
</details>}
|
|
|
</div>
|
|
|
</div>
|
|
|
- <h1 className="work-order-head-title">{t.title}</h1>
|
|
|
<div className="work-order-head-meta">
|
|
|
<span>客户 <b>{refCustomer?.customer_name ?? "—"}</b></span><i>·</i>
|
|
|
<span>责任人 <b>{t.assignee_name ?? t.assignee_snapshot_name ?? "待分派"}</b></span><i>·</i>
|
|
|
@@ -1509,143 +1525,274 @@ export function WorkOrderRecordPage() {
|
|
|
<div className="work-order-steps" aria-label="工单流转进度">{steps.map((step, index) => <Fragment key={step.label}>{index > 0 && <i aria-hidden="true" className={index <= reachedStepIndex ? "on" : undefined} />}<span className={`work-order-step ${step.state === "current" ? "cur" : step.state}`} aria-current={step.state === "current" ? "step" : undefined}><b>{index + 1}</b>{step.label}</span></Fragment>)}</div>
|
|
|
</header>
|
|
|
{todoNodes.length > 0 && <div className="work-order-todo">{todoNodes}</div>}
|
|
|
- <div className="work-order-layout"><div className="work-order-sections">
|
|
|
- {/* 工单内容=正文主角:一句话内容 + 来源/外部单号/关联订阅;客户档案收到页尾参考区。 */}
|
|
|
- <section className="work-order-section work-order-section-lead">
|
|
|
- <p className="work-order-ticket-lead">{t.detail || "建单时未填写详细描述。"}</p>
|
|
|
- <div className="work-order-summary-grid"><div><span>建单来源</span><strong>{t.submitter_type === "customer" ? "客户侧提交" : t.submitter_type === "reporter" ? "报障人提交" : "运营侧代报"}</strong></div><div><span>外部单号</span><strong>{t.carrier_order_no ?? "无"}</strong></div><div><span>关联订阅</span><strong>{t.subscription_id ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: t.subscription_id!, name: refOrder?.plan_name })}>{t.subscription_id}</button> : "无"}{refOrder?.plan_name ? ` · ${refOrder.plan_name}` : ""}</strong></div>{t.deferred_until && <div><span>延期至</span><strong>{fmtDate(t.deferred_until)}</strong></div>}{t.confirm_deadline && <div><span>闭环确认期限</span><strong>{fmtDate(t.confirm_deadline)}</strong></div>}</div>
|
|
|
- {/* 客户建单时上传的图片/语音随建单同事务登记(`submit_evidence`),就放在建单来源这一屏。 */}
|
|
|
- {submitMaterials.length > 0 && <>
|
|
|
- <h4 className="work-order-subhead">客户提交材料</h4>
|
|
|
- <MaterialList ticketId={t.ticket_id} items={submitMaterials} empty="无" allowDownload={canDownloadMaterial} />
|
|
|
- </>}
|
|
|
- </section>
|
|
|
+ <div className="work-order-layout"><div className="record-tabs-frame work-order-tabs-frame">
|
|
|
+ <RecordTabs prefix="work-order" className="work-order-record-tabs" label="工单详情视图" tabs={tabs} active={activeTab}
|
|
|
+ onChange={(tab) => setSelectedTab({ ticketId: id, tab })} />
|
|
|
+ <WorkOrderPanel tab="overview" active={activeTab}>
|
|
|
+ <div className="work-order-overview-card">
|
|
|
+ <p className="work-order-ticket-lead" data-empty={!t.detail || undefined}>{t.detail || "建单时未填写详细描述。"}</p>
|
|
|
+ <dl className="work-order-overview-fields work-order-overview-context">
|
|
|
+ <div><dt>建单来源</dt><dd>{submitterLabel}</dd></div>
|
|
|
+ <div><dt>外部单号</dt><dd>{recordValue(t.carrier_order_no)}</dd></div>
|
|
|
+ <div>
|
|
|
+ <dt>关联订阅</dt>
|
|
|
+ <dd>{refSubscriptionId ? <>
|
|
|
+ <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refSubscriptionId, name: refOrder?.plan_name })}>{refSubscriptionId}</button>
|
|
|
+ {refOrder?.plan_name && <><span className="work-order-overview-separator" aria-hidden="true">·</span>{refOrder.plan_name}</>}
|
|
|
+ </> : recordValue(null)}</dd>
|
|
|
+ </div>
|
|
|
+ </dl>
|
|
|
+ {(t.deferred_until || t.confirm_deadline) && <dl className="work-order-overview-fields work-order-overview-deadlines">
|
|
|
+ {t.deferred_until && <div><dt>延期至</dt><dd>{fmtDate(t.deferred_until)}</dd></div>}
|
|
|
+ {t.confirm_deadline && <div><dt>闭环确认期限</dt><dd>{fmtDate(t.confirm_deadline)}</dd></div>}
|
|
|
+ </dl>}
|
|
|
+ </div>
|
|
|
+ </WorkOrderPanel>
|
|
|
|
|
|
{d.construction_guide && (
|
|
|
- <section className="work-order-section">
|
|
|
- <ConstructionGuidePanel guide={d.construction_guide} />
|
|
|
- </section>
|
|
|
+ <WorkOrderPanel tab="guide" active={activeTab}>
|
|
|
+ <ConstructionGuidePanel guide={d.construction_guide} showPendingAccounts={false} />
|
|
|
+ </WorkOrderPanel>
|
|
|
)}
|
|
|
|
|
|
- {/* 交付事实:按段折叠。段头摘要行给关键数字(结论/日期/条数),折叠也不丢信息;
|
|
|
- 只有与本单状态相关的一段默认展开,其余收起,避免六张明细表把正文拉成几屏长。 */}
|
|
|
- <section className="work-order-section work-order-facts">
|
|
|
- <header className="work-order-facts-head"><h2>交付事实</h2><span>{factsCount} 段 · 默认只展开与本单状态相关的一段</span></header>
|
|
|
- {(d.backfill?.backfill_id || can.backfill || d.backfill?.ext) && <FactSeg title="施工回填" open={openSeg === "backfill"}
|
|
|
- summary={d.backfill?.backfill_id ? `${CONCLUSION_NAMES[d.backfill.exec_conclusion ?? ""] ?? d.backfill.exec_conclusion ?? "—"} · 实际开通 ${d.backfill.actual_opened_date ? fmtDate(d.backfill.actual_opened_date) : "—"} · 线路 ${d.backfill.routes?.length ?? 0} 条 / 境外 IP ${d.backfill.ips?.length ?? 0} 条` : "尚未回填 · 缺 线路与路由、执行结论与凭证"}
|
|
|
- badge={d.backfill?.backfill_id ? "已回填" : "待回填"} tone={d.backfill?.backfill_id ? "ok" : "warn"}>
|
|
|
+ {showBackfill && <WorkOrderPanel tab="backfill" active={activeTab} className="work-order-panel-stack">
|
|
|
{d.backfill?.backfill_id ? <>
|
|
|
- <div className="work-order-summary-grid"><div><span>执行结论</span><strong>{CONCLUSION_NAMES[d.backfill.exec_conclusion ?? ""] ?? d.backfill.exec_conclusion ?? "-"}</strong></div><div><span>实际开通日期</span><strong>{d.backfill.actual_opened_date ? fmtDate(d.backfill.actual_opened_date) : "-"}</strong></div><div><span>停机完成日期</span><strong>{d.backfill.stop_done_date ? fmtDate(d.backfill.stop_done_date) : "-"}</strong></div><div><span>回填次数</span><strong>{numText(d.backfill.attempt_count)} 次</strong></div><div className="wide"><span>结论说明</span><strong>{d.backfill.conclusion_note ?? "-"}</strong></div><div className="wide"><span>凭证与佐证</span><strong>{d.backfill.evidence_text ?? "-"}</strong></div></div>
|
|
|
+ <section className="work-order-outcome">
|
|
|
+ <header className="work-order-content-heading">
|
|
|
+ <h2 className="work-order-panel-title">执行结论</h2>
|
|
|
+ <OpsStatus tone="success">已回填</OpsStatus>
|
|
|
+ </header>
|
|
|
+ <p className="work-order-outcome-value"><ExecutionConclusion value={d.backfill.exec_conclusion} /></p>
|
|
|
+ <div className="work-order-summary-grid">
|
|
|
+ <div><span>实际开通日期</span><strong>{recordValue(fmtDate(d.backfill.actual_opened_date))}</strong></div>
|
|
|
+ <div><span>停机完成日期</span><strong>{recordValue(fmtDate(d.backfill.stop_done_date))}</strong></div>
|
|
|
+ <div><span>回填次数</span><strong>{recordValue(numText(d.backfill.attempt_count, " 次"))}</strong></div>
|
|
|
+ </div>
|
|
|
+ {(d.backfill.conclusion_note || d.backfill.evidence_text) && <dl className="work-order-narrative-fields">
|
|
|
+ {d.backfill.conclusion_note && <div><dt>结论说明</dt><dd>{d.backfill.conclusion_note}</dd></div>}
|
|
|
+ {d.backfill.evidence_text && <div><dt>凭证与佐证</dt><dd>{d.backfill.evidence_text}</dd></div>}
|
|
|
+ </dl>}
|
|
|
+ </section>
|
|
|
<TicketExtForm ext={d.backfill.ext} readOnly />
|
|
|
- {(d.backfill.routes?.length ?? 0) > 0 && <><h4 className="work-order-subhead">网络线路</h4><div className="work-order-table-wrap compact"><table><thead><tr><th>网络账户名</th><th>内网 IP / 掩码</th><th>端点(源 → 目的)</th><th>出口 PoP</th><th>带宽</th></tr></thead><tbody>{d.backfill.routes.map((r) => <tr key={r.id}><td>{r.network_account_name ?? "-"}</td><td>{[r.intranet_ip, r.subnet_mask].filter(Boolean).join(" / ") || "-"}</td><td>{r.src_endpoint ?? "-"} → {r.dst_endpoint ?? "-"}</td><td>{r.egress_pop ?? "-"}</td><td>{[r.down_mbps && `↓${r.down_mbps}`, r.up_mbps && `↑${r.up_mbps}`].filter(Boolean).join(" / ") || "-"}</td></tr>)}</tbody></table></div></>}
|
|
|
- {(d.backfill.ips?.length ?? 0) > 0 && <><h4 className="work-order-subhead">境外出口 IP</h4><div className="work-order-table-wrap compact"><table><thead><tr><th>出口</th><th>IP</th><th>类型</th><th>带宽</th><th>凭据</th></tr></thead><tbody>{d.backfill.ips.map((r) => <tr key={r.id}><td>{r.egress ?? "-"}</td><td>{r.overseas_ip ?? "-"}</td><td>{r.ip_type ?? "-"}</td><td>{numText(r.bandwidth_mbps, "M")}</td><td>PIN {isYes(r.pin_registered) ? "✓" : <span className="table-placeholder">—</span>} / CPID {isYes(r.cpid_registered) ? "✓" : <span className="table-placeholder">—</span>}</td></tr>)}</tbody></table></div></>}
|
|
|
- <p className="work-order-seg-foot">库内仅存 PIN/CPID 密文,此处只显示「是否登记」;IP 规则 v{d.backfill.ip_rule_version}。</p>
|
|
|
+ {(d.backfill.routes?.length ?? 0) > 0 && <section className="work-order-content-group">
|
|
|
+ <h2 className="work-order-panel-title">网络线路</h2>
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label="网络线路清单" tabIndex={0}><table>
|
|
|
+ <thead><tr><th>网络账户名</th><th>内网 IP / 掩码</th><th>端点(源 → 目的)</th><th>出口 PoP</th><th>带宽</th></tr></thead>
|
|
|
+ <tbody>{d.backfill.routes.map((r) => <tr key={r.id}>
|
|
|
+ <td><span className="table-cell-title">{recordValue(r.network_account_name)}</span></td>
|
|
|
+ <td>{recordValue([r.intranet_ip, r.subnet_mask].filter(Boolean).join(" / "))}</td>
|
|
|
+ <td>{recordValue(r.src_endpoint)} → {recordValue(r.dst_endpoint)}</td>
|
|
|
+ <td>{recordValue(r.egress_pop)}</td>
|
|
|
+ <td>{recordValue([r.down_mbps && `↓${r.down_mbps}`, r.up_mbps && `↑${r.up_mbps}`].filter(Boolean).join(" / "))}</td>
|
|
|
+ </tr>)}</tbody>
|
|
|
+ </table></div>
|
|
|
+ </section>}
|
|
|
+ {(d.backfill.ips?.length ?? 0) > 0 && <section className="work-order-content-group">
|
|
|
+ <h2 className="work-order-panel-title">境外出口 IP</h2>
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label="境外出口 IP 清单" tabIndex={0}><table>
|
|
|
+ <thead><tr><th>出口</th><th>IP</th><th>类型</th><th>带宽</th><th>凭据</th></tr></thead>
|
|
|
+ <tbody>{d.backfill.ips.map((r) => <tr key={r.id}>
|
|
|
+ <td>{recordValue(r.egress)}</td>
|
|
|
+ <td><span className="table-cell-title">{recordValue(r.overseas_ip)}</span></td>
|
|
|
+ <td>{recordValue(r.ip_type)}</td>
|
|
|
+ <td>{recordValue(numText(r.bandwidth_mbps, "M"))}</td>
|
|
|
+ <td>PIN {recordValue(isYes(r.pin_registered) ? "✓" : null)} / CPID {recordValue(isYes(r.cpid_registered) ? "✓" : null)}</td>
|
|
|
+ </tr>)}</tbody>
|
|
|
+ </table></div>
|
|
|
+ <p className="work-order-panel-note">PIN/CPID 仅显示登记状态。IP 规则 v{d.backfill.ip_rule_version}。</p>
|
|
|
+ </section>}
|
|
|
</> : <>
|
|
|
- <p className="work-order-seg-foot">登记执行结论、实际开通日期、线路与境外 IP;保存即推进工单。</p>
|
|
|
- <p className="work-order-seg-foot">建单人取当前登录身份,无需手填。</p>
|
|
|
+ <div className="work-order-empty-panel">
|
|
|
+ <h2 className="work-order-panel-title">尚未回填</h2>
|
|
|
+ <p>施工完成后,在此查看执行结论、开通日期和线路参数。</p>
|
|
|
+ </div>
|
|
|
+ <TicketExtForm ext={d.backfill?.ext} readOnly />
|
|
|
</>}
|
|
|
- {/* 材料跟着这一段走:回填时自动归档的凭证 + 现场补传的过程材料(后者是本段唯一的写入口)。 */}
|
|
|
- <h4 className="work-order-subhead">凭证与过程材料({backfillMaterials.length} 份)</h4>
|
|
|
- <MaterialList ticketId={t.ticket_id} items={backfillMaterials} empty="暂无材料:回填保存时凭证清单里的文档名会自动归档到这里。" allowDownload={canDownloadMaterial} />
|
|
|
- {!clientView && (materialLocked
|
|
|
- ? <p className="work-order-seg-foot"><Info size={15} />工单已{t.status === "terminated" ? "作废" : "办结"},材料只读:终态不再提供任何追加入口(服务端同样拒绝,KLT-G20401)。</p>
|
|
|
- : <div className="work-order-materials-actions"><Button variant="outline" size="sm" type="button" onClick={() => setMaterialOpen(true)}><FolderOpen size={15} />补充过程材料</Button></div>)}
|
|
|
- </FactSeg>}
|
|
|
- {d.service_items.length > 0 && <FactSeg title="服务清单" open={openSeg === "checklist"}
|
|
|
- summary={checklistGated ? `${checkedItems} / ${d.service_items.length} 已核对` : `${d.service_items.length} 条交付项 · 仅供交付参照`}
|
|
|
- badge={checklistGated ? (checklistAllDone ? "已核对" : "待核对") : `${d.service_items.length} 条`}
|
|
|
- tone={checklistGated ? (checklistAllDone ? "ok" : "warn") : undefined}>
|
|
|
+ </WorkOrderPanel>}
|
|
|
+
|
|
|
+ {tabVisible.facts && <WorkOrderPanel tab="facts" active={activeTab} className="work-order-panel-stack">
|
|
|
+ {d.service_items.length > 0 && <section className="work-order-content-group">
|
|
|
+ <header className="work-order-content-heading">
|
|
|
+ <h2 className="work-order-panel-title">服务清单</h2>
|
|
|
+ {checklistGated
|
|
|
+ ? <OpsStatus tone={checklistAllDone ? "success" : "warning"}>{checkedItems} / {d.service_items.length} 已核对</OpsStatus>
|
|
|
+ : <small>{d.service_items.length} 条交付项</small>}
|
|
|
+ </header>
|
|
|
{/* 变更协议单的「原值 → 新值」并成一列(原型 v3),⛔ 再单独渲染一张参数对照表。
|
|
|
核对两列只对门槛类型渲染:非门槛类型没有核对动作,`pending` 不是缺口。 */}
|
|
|
- <div className="work-order-table-wrap compact"><table><thead><tr><th>序号</th><th>条目</th>{t.ticket_type === "updown" ? <th>原值 → 新值</th> : <th>规格</th>}<th>数量</th>{checklistGated && <><th>核对结果</th><th>核对时间</th></>}</tr></thead><tbody>{d.service_items.map((item) => <tr key={item.item_id}><td>{item.seq_no}</td><td><strong>{item.item_name ?? "-"}</strong></td>{t.ticket_type === "updown" ? <td>{item.spec_before ?? "-"} → {item.spec_after ?? "-"}</td> : <td>{item.spec_text ?? "-"}</td>}<td>{numText(item.expect_qty)}</td>{checklistGated && <><td>{item.check_result === "done" ? <span className="ops-state tone-valid">已核对</span> : item.check_result === "absent" ? <span className="ops-state tone-invalid">缺项</span> : <span className="ops-state tone-invalid">未核对</span>}</td><td>{fmtTime(item.checked_at)}</td></>}</tr>)}</tbody></table></div>
|
|
|
- <p className="work-order-seg-foot">{checklistNote}</p>
|
|
|
- </FactSeg>}
|
|
|
- {(d.open_stop?.accounts.length ?? 0) > 0 && <FactSeg title="账号清单" open={openSeg === "accounts"}
|
|
|
- summary={`${d.open_stop!.accounts.length} 个账号 · ${d.open_stop!.preview ? "待停预览" : d.open_stop!.exec_status === "pending" ? "待生效" : "已生效"}`}
|
|
|
- badge={d.open_stop!.preview ? "预览" : d.open_stop!.exec_status === "pending" ? "待生效" : "已生效"} tone={d.open_stop!.preview || d.open_stop!.exec_status === "pending" ? "warn" : "ok"}>
|
|
|
- <div className="work-order-table-wrap compact"><table><thead><tr><th>显示名</th><th>网络账户名</th><th>停机前 → 生效后</th><th>生效日</th><th>来源</th></tr></thead><tbody>{d.open_stop!.accounts.map((a) => <tr key={a.id ?? a.sub_account_id ?? `${a.display_name}-${a.net_account}`}><td>{a.display_name ?? "-"}</td><td>{a.net_account ?? "-"}</td><td>{label(ACCT_STATUS, a.before_status) || "-"} → {label(ACCT_STATUS, a.after_status) || (a.source === "preview" ? "待停" : "-")}</td><td>{a.effective_date ? fmtDate(a.effective_date) : "-"}</td><td>{a.source ?? "-"}</td></tr>)}</tbody></table></div>
|
|
|
- {d.open_stop && <p className="work-order-seg-foot">{d.open_stop.preview ? `待停账号预览 ${numText(d.open_stop.effective_account_count)} 个(回填前供现场核对)。` : <>开停记录:{d.open_stop.action ? (OPEN_STOP_ACTION_NAMES[d.open_stop.action] ?? d.open_stop.action) : "-"} / {d.open_stop.exec_status ? (EXEC_STATUS_NAMES[d.open_stop.exec_status] ?? d.open_stop.exec_status) : "-"} / 生效账号 {numText(d.open_stop.effective_account_count)} 个{d.open_stop.exec_status === "pending" ? "(待生效)" : ""}{isYes(d.open_stop.closed_flag) ? " · 已随工单关闭" : ""}。</>}</p>}
|
|
|
- </FactSeg>}
|
|
|
- {showCompletion && <FactSeg title="竣工与回执" open={openSeg === "completion"}
|
|
|
- summary={d.completion ? `${d.completion.completion_no ?? "—"} · ${receiptState.text}` : "未生成 · 缺口齐备后可生成"}
|
|
|
- badge={receiptState.text} tone={receiptState.tone}>
|
|
|
- {d.completion ? <div className="work-order-summary-grid"><div><span>竣工单号</span><strong>{d.completion.completion_no ?? "-"}</strong></div><div><span>动作</span><strong>{d.completion.action ? (OPEN_STOP_ACTION_NAMES[d.completion.action] ?? d.completion.action) : "-"}</strong></div><div><span>执行结论</span><strong>{d.completion.exec_conclusion ? (CONCLUSION_NAMES[d.completion.exec_conclusion] ?? d.completion.exec_conclusion) : "-"}</strong></div><div><span>回传方式</span><strong>{d.completion.mode === "auto" ? "自动" : "手工"}</strong></div><div><span>回传时间</span><strong>{fmtTime(d.completion.pushed_at)}</strong></div><div><span>回执时间</span><strong>{fmtTime(d.completion.receipt_at)}</strong></div><div className="wide"><span>回执说明</span><strong>{d.completion.receipt_remark ?? "-"}</strong></div></div> : <p className="work-order-seg-foot">{d.gaps.length ? `缺口未清,竣工暂不可生成:${d.gaps.map(groupLabel).join(" / ")}` : conclusionBlocksCompletion(d.backfill?.exec_conclusion) ? "回填结论为失败,须重新回填成功/部分成功后才可生成竣工并回传。" : "缺口已齐,可生成竣工并回传。"}</p>}
|
|
|
- {/* 等待回执:出口是回执确认;权限不足时说明谁可执行——⛔ 给一个点了会被服务端拒的按钮。 */}
|
|
|
- {d.completion && !d.completion.receipt_at && t.status !== "rejected" && (viewerReadOnly || !can.confirm_receipt
|
|
|
- ? <p className="work-order-seg-foot"><ShieldAlert size={15} />回执确认仅总运营与该团队主账号可执行。</p>
|
|
|
- : <div className="work-order-seg-actions"><Button onClick={() => openSheet("confirm_receipt")}><Check size={15} />回执确认闭环</Button></div>)}
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label="服务清单" tabIndex={0}><table>
|
|
|
+ <thead><tr><th>序号</th><th>条目</th><th>{t.ticket_type === "updown" ? "原值 → 新值" : "规格"}</th><th>数量</th>{checklistGated && <><th>核对结果</th><th>核对时间</th></>}</tr></thead>
|
|
|
+ <tbody>{d.service_items.map((item) => <tr key={item.item_id}>
|
|
|
+ <td>{item.seq_no}</td>
|
|
|
+ <td><span className="table-cell-title">{recordValue(item.item_name)}</span></td>
|
|
|
+ <td className="table-wrap-text">{t.ticket_type === "updown" ? <>{recordValue(item.spec_before)} → {recordValue(item.spec_after)}</> : recordValue(item.spec_text)}</td>
|
|
|
+ <td>{item.expect_qty != null && item.expect_qty !== "" ? <span className="table-number">{numText(item.expect_qty)}</span> : recordValue(null)}</td>
|
|
|
+ {checklistGated && <>
|
|
|
+ <td><OpsStatus tone={item.check_result === "done" ? "success" : "neutral"}>{item.check_result === "done" ? "已核对" : item.check_result === "absent" ? "缺项" : "未核对"}</OpsStatus></td>
|
|
|
+ <td>{recordValue(fmtTime(item.checked_at))}</td>
|
|
|
+ </>}
|
|
|
+ </tr>)}</tbody>
|
|
|
+ </table></div>
|
|
|
+ <p className="work-order-panel-note">{checklistNote}</p>
|
|
|
+ </section>}
|
|
|
+ {d.open_stop && accountRows.length > 0 && <section className="work-order-content-group">
|
|
|
+ <header className="work-order-content-heading">
|
|
|
+ <h2 className="work-order-panel-title">账号清单 <small>{accountRows.length} 个</small></h2>
|
|
|
+ <OpsStatus tone={d.open_stop.preview || d.open_stop.exec_status === "pending" ? "warning" : "success"}>{d.open_stop.preview ? "待停预览" : d.open_stop.exec_status === "pending" ? "待生效" : "已生效"}</OpsStatus>
|
|
|
+ </header>
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label="账号清单" tabIndex={0}><table>
|
|
|
+ <thead><tr><th>显示名</th><th>网络账户名</th><th>停机前 → 生效后</th><th>生效日</th><th>来源</th></tr></thead>
|
|
|
+ <tbody>{accountRows.map((a) => <tr key={a.id ?? a.sub_account_id ?? `${a.display_name}-${a.net_account}`}>
|
|
|
+ <td><span className="table-cell-title">{recordValue(a.display_name)}</span></td>
|
|
|
+ <td>{recordValue(a.net_account)}</td>
|
|
|
+ <td>{recordValue(label(ACCT_STATUS, a.before_status))} → {recordValue(label(ACCT_STATUS, a.after_status) || (a.source === "preview" ? "待停" : null))}</td>
|
|
|
+ <td>{recordValue(fmtDate(a.effective_date))}</td>
|
|
|
+ <td>{recordValue(a.source)}</td>
|
|
|
+ </tr>)}</tbody>
|
|
|
+ </table></div>
|
|
|
+ <p className="work-order-panel-note">{d.open_stop.preview ? "预览名单供回填前核对。" : <>开停记录:{d.open_stop.action ? (OPEN_STOP_ACTION_NAMES[d.open_stop.action] ?? d.open_stop.action) : "-"} / {d.open_stop.exec_status ? (EXEC_STATUS_NAMES[d.open_stop.exec_status] ?? d.open_stop.exec_status) : "-"} / 生效账号 {numText(d.open_stop.effective_account_count)} 个{d.open_stop.exec_status === "pending" ? "(待生效)" : ""}{isYes(d.open_stop.closed_flag) ? " · 已随工单关闭" : ""}。</>}</p>
|
|
|
+ </section>}
|
|
|
+ {materialGroups.map((group) => {
|
|
|
+ const showUpload = group.kind === MANUAL_MATERIAL_KIND && canAddMaterials;
|
|
|
+ if (!group.items.length && !showUpload) return null;
|
|
|
+ return <section key={group.kind} className="work-order-content-group">
|
|
|
+ <header className="work-order-content-heading">
|
|
|
+ <h2 className="work-order-panel-title">{group.label}{group.items.length > 0 && <small>{group.items.length} 份</small>}</h2>
|
|
|
+ {showUpload && <button className="org-button org-button-compact org-button-scope" type="button" onClick={() => setMaterialOpen(true)}><FolderOpen size={15} aria-hidden="true" />补充过程材料</button>}
|
|
|
+ </header>
|
|
|
+ {group.items.length > 0
|
|
|
+ ? <MaterialList ticketId={t.ticket_id} items={group.items} label={group.label} allowDownload={canDownloadMaterial} />
|
|
|
+ : <p className="work-order-empty-panel">暂无过程材料,可上传现场照片或处理截图。</p>}
|
|
|
+ </section>;
|
|
|
+ })}
|
|
|
+ </WorkOrderPanel>}
|
|
|
+ {showCompletion && <WorkOrderPanel tab="receipt" active={activeTab} className="work-order-panel-stack">
|
|
|
+ <section className="work-order-outcome">
|
|
|
+ <header className="work-order-content-heading">
|
|
|
+ <h2 className="work-order-panel-title">竣工单</h2>
|
|
|
+ <OpsStatus tone={receiptState.tone}>{receiptState.text}</OpsStatus>
|
|
|
+ </header>
|
|
|
+ {d.completion ? <>
|
|
|
+ <p className="work-order-outcome-value work-order-document-number">{recordValue(d.completion.completion_no)}</p>
|
|
|
+ <div className="work-order-summary-grid">
|
|
|
+ <div><span>回传时间</span><strong>{recordValue(fmtTime(d.completion.pushed_at))}</strong></div>
|
|
|
+ <div><span>回执时间</span><strong>{recordValue(fmtTime(d.completion.receipt_at))}</strong></div>
|
|
|
+ <div><span>回传方式</span><strong>{d.completion.mode === "auto" ? "自动" : "手工"}</strong></div>
|
|
|
+ <div><span>动作</span><strong>{recordValue(OPEN_STOP_ACTION_NAMES[d.completion.action ?? ""] ?? d.completion.action)}</strong></div>
|
|
|
+ <div><span>执行结论</span><strong><ExecutionConclusion value={d.completion.exec_conclusion} /></strong></div>
|
|
|
+ </div>
|
|
|
+ {d.completion.receipt_remark && <dl className="work-order-narrative-fields">
|
|
|
+ <div><dt>回执说明</dt><dd>{d.completion.receipt_remark}</dd></div>
|
|
|
+ </dl>}
|
|
|
+ {!d.completion.receipt_at && t.status !== "rejected" && (viewerReadOnly || !can.confirm_receipt
|
|
|
+ ? <p className="work-order-panel-note">回执由总运营或承接团队主账号确认。</p>
|
|
|
+ : <div><Button onClick={() => openSheet("confirm_receipt")}><Check size={15} />确认回执</Button></div>)}
|
|
|
+ </> : <p className="work-order-panel-note">{d.gaps.length ? `待补齐:${d.gaps.map(groupLabel).join(" / ")}` : conclusionBlocksCompletion(d.backfill?.exec_conclusion) ? "请先重新回填成功或部分成功的执行结论。" : "已具备生成并回传竣工单的条件。"}</p>}
|
|
|
+ </section>
|
|
|
{/* 驳回历史(工单§5.5.3):⚠️ 只读运维视角——客户门户对驳回原因⛔ 展示(门户口径=
|
|
|
"待补充资料后重新提交"),且出参本身就没有 `external_reject_no` 这一列。 */}
|
|
|
- {!clientView && !!d.completion_rejects?.length && <>
|
|
|
- <h4 className="work-order-subhead">驳回历史({d.completion_rejects.length} 次{d.reject_pending ? " · 外部等待中" : ""})</h4>
|
|
|
- <div className="work-order-table-wrap compact"><table><thead><tr><th>次数</th><th>件号</th><th>理由</th><th>时间</th></tr></thead><tbody>{d.completion_rejects.map((r) => <tr key={r.reject_seq}><td>第 {r.reject_seq} 次</td><td>{r.completion_no}</td><td>{rejectReasonNames(r.reason_codes)}{r.reason_text ? `:${r.reason_text}` : ""}</td><td>{fmtTime(r.rejected_at)} · {r.channel === "human" ? "人工登记" : r.channel}{r.pushed_at ? ` · 回传于 ${fmtDate(r.pushed_at)}` : ""}</td></tr>)}</tbody></table></div>
|
|
|
- <p className="work-order-seg-foot">驳回期间期限日不重置,超期判定扣掉这段外部等待;出口=同号覆盖重推(驳回态即可执行)或退回重办(总运营/本团队主账号)后再改回填。</p>
|
|
|
- </>}
|
|
|
- <p className="work-order-seg-foot">回执确认后完成日改写为当天;开停记录的执行日不变。</p>
|
|
|
- {/* 竣工件=生成竣工时同事务归档的 PDF;终态后仍可下载(需求 §7.8 竣工材料事后仍可导出)。 */}
|
|
|
- <h4 className="work-order-subhead">竣工材料({completionMaterials.length} 份)</h4>
|
|
|
- <MaterialList ticketId={t.ticket_id} items={completionMaterials} empty="生成竣工单时自动归档,无需手工上传。" allowDownload={canDownloadMaterial} />
|
|
|
- </FactSeg>}
|
|
|
+ {!clientView && !!d.completion_rejects?.length && <section className="work-order-content-group">
|
|
|
+ <header className="work-order-content-heading">
|
|
|
+ <h2 className="work-order-panel-title">驳回历史 <small>{d.completion_rejects.length} 次</small></h2>
|
|
|
+ {d.reject_pending && <OpsStatus tone="warning">外部等待中</OpsStatus>}
|
|
|
+ </header>
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label="驳回历史" tabIndex={0}><table>
|
|
|
+ <thead><tr><th>次数</th><th>件号</th><th>理由</th><th>时间</th></tr></thead>
|
|
|
+ <tbody>{d.completion_rejects.map((r) => <tr key={r.reject_seq}>
|
|
|
+ <td>第 {r.reject_seq} 次</td>
|
|
|
+ <td><span className="table-cell-title">{recordValue(r.completion_no)}</span></td>
|
|
|
+ <td className="table-wrap-text">{rejectReasonNames(r.reason_codes)}{r.reason_text ? `:${r.reason_text}` : ""}</td>
|
|
|
+ <td>{recordValue(fmtTime(r.rejected_at))}{r.channel ? ` · ${r.channel === "human" ? "人工登记" : r.channel}` : ""}{r.pushed_at && <small>回传于 {fmtDate(r.pushed_at)}</small>}</td>
|
|
|
+ </tr>)}</tbody>
|
|
|
+ </table></div>
|
|
|
+ <p className="work-order-panel-note">驳回期间保留原期限日,超期计算扣除外部等待时间。</p>
|
|
|
+ </section>}
|
|
|
+ </WorkOrderPanel>}
|
|
|
|
|
|
- {d.messages.length > 0 && <FactSeg title="关联报文" open={openSeg === "messages"}
|
|
|
- summary={`${d.messages.length} 条 · 运营商报文与处置状态`} badge={`${d.messages.length} 条`}>
|
|
|
- <div className="work-order-table-wrap compact"><table><thead><tr><th>外部单号</th><th>动作</th><th>状态</th><th>接收时间</th><th>生效时间</th><th>说明</th><th><span className="sr-only">操作</span></th></tr></thead><tbody>{d.messages.map((m) => <tr key={m.message_id}><td>{m.carrier_order_no ?? "-"}</td><td>{m.action ?? "-"}</td><td>{m.status ?? "-"}</td><td>{fmtTime(m.received_at)}</td><td>{fmtTime(m.effective_at)}</td><td>{m.conflict_note ?? m.void_reason ?? "-"}</td><td>{m.status === "conflict" && !clientView && <Button variant="ghost" size="sm" onClick={() => void (async () => { const ok = await submit.run(() => messageConfirmConflict({ message_id: m.message_id, disposition: "as_is" })); if (ok) { setNotice("冲突已按现状归档。"); detail.reload(); } })()}>按现状归档</Button>}</td></tr>)}</tbody></table></div>
|
|
|
- </FactSeg>}
|
|
|
- {/* 非主线单(故障/售后)没有施工回填段 ⇒ 过程材料单独成段:这些单上它就是主证据,不是某段的补充。
|
|
|
- ⚠️ 空清单不给 warn 色调:照片明确定义为「不是完成门槛」(需求 §7.5),不能读成缺项。 */}
|
|
|
- {!hasBackfillSeg && <FactSeg title="过程材料" open={openSeg === "materials"}
|
|
|
- summary={backfillMaterials.length ? `${backfillMaterials.length} 份 · 现场照片与佐证` : "暂无材料 · 可补充现场照片"}
|
|
|
- badge={backfillMaterials.length ? `${backfillMaterials.length} 份` : "可补充"} tone={backfillMaterials.length ? "ok" : undefined}>
|
|
|
- <MaterialList ticketId={t.ticket_id} items={backfillMaterials} empty="暂无材料:可在此补充现场照片、处理截图等过程留痕。" allowDownload={canDownloadMaterial} />
|
|
|
- {!clientView && (materialLocked
|
|
|
- ? <p className="work-order-seg-foot"><Info size={15} />工单已{t.status === "terminated" ? "作废" : "办结"},材料只读:终态不再提供任何追加入口(服务端同样拒绝,KLT-G20401)。</p>
|
|
|
- : <div className="work-order-materials-actions"><Button variant="outline" size="sm" type="button" onClick={() => setMaterialOpen(true)}><FolderOpen size={15} />补充过程材料</Button></div>)}
|
|
|
- </FactSeg>}
|
|
|
- </section>
|
|
|
+ {tabVisible.messages && <WorkOrderPanel tab="messages" active={activeTab}>
|
|
|
+ <div className="work-order-table-wrap compact" role="region" aria-label="关联报文列表" tabIndex={0}><table>
|
|
|
+ <thead><tr><th>外部单号</th><th>动作</th><th>状态</th><th>接收时间</th><th>生效时间</th><th>说明</th><th><span className="sr-only">操作</span></th></tr></thead>
|
|
|
+ <tbody>{d.messages.map((m) => <tr key={m.message_id}>
|
|
|
+ <td><span className="table-cell-title">{recordValue(m.carrier_order_no)}</span></td>
|
|
|
+ <td>{recordValue(m.action)}</td>
|
|
|
+ <td>{recordValue(m.status)}</td>
|
|
|
+ <td>{recordValue(fmtTime(m.received_at))}</td>
|
|
|
+ <td>{recordValue(fmtTime(m.effective_at))}</td>
|
|
|
+ <td className="table-wrap-text">{recordValue(m.conflict_note ?? m.void_reason)}</td>
|
|
|
+ <td>{m.status === "conflict" && !clientView && <Button variant="ghost" size="sm" onClick={() => void (async () => { const ok = await submit.run(() => messageConfirmConflict({ message_id: m.message_id, disposition: "as_is" })); if (ok) { setNotice("冲突已按现状归档。"); detail.reload(); } })()}>按现状归档</Button>}</td>
|
|
|
+ </tr>)}</tbody>
|
|
|
+ </table></div>
|
|
|
+ </WorkOrderPanel>}
|
|
|
|
|
|
- {/* 参考信息移到正文底部:宽度由主列决定,与上方卡片天然对齐;右栏腾给「处理记录」专席。 */}
|
|
|
- <div className="work-order-refs">
|
|
|
- <section className="work-order-section">
|
|
|
- <h2>客户与订阅</h2>
|
|
|
- {refCustomer ? <>
|
|
|
- <div className="work-order-trace"><span>客户名称</span><strong>{refCustomer.customer_name
|
|
|
- ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>{refCustomer.customer_name}</button>
|
|
|
- : "-"}</strong></div>
|
|
|
- <div className="work-order-trace"><span>客户编号</span><strong>{refCustomer.customer_code || refCustomer.customer_id
|
|
|
- ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>{refCustomer.customer_code ?? refCustomer.customer_id}</button>
|
|
|
- : "-"}</strong></div>
|
|
|
- <div className="work-order-trace"><span>联系人 / 电话</span><strong>{
|
|
|
- refCustomer.contact_name_missing && refCustomer.contact_mobile_missing
|
|
|
- ? "资料缺失"
|
|
|
- : [
|
|
|
- refCustomer.contact_name_missing ? "联系人资料缺失" : refCustomer.contact_name,
|
|
|
- refCustomer.contact_mobile_missing
|
|
|
- ? "电话资料缺失"
|
|
|
- : (refCustomer.contact_mobile_full || refCustomer.contact_mobile),
|
|
|
- ].filter(Boolean).join(" / ") || "-"
|
|
|
- }</strong></div>
|
|
|
- <div className="work-order-trace"><span>通信地址</span><strong>{refCustomer.address_missing
|
|
|
- ? <button type="button" className="work-order-trace-link work-order-trace-missing" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>资料缺失,需补充</button>
|
|
|
- : (refCustomer.address ?? "-")}</strong></div>
|
|
|
- </> : <p className="work-order-reference-empty">该单未关联客户档案。</p>}
|
|
|
- {refOrder && <div className="work-order-trace"><span>关联订阅</span><strong><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refOrder.subscription_id, name: refOrder.plan_name })}>{refOrder.plan_name ?? refOrder.subscription_id}</button></strong><small>{[refOrder.subscription_id, label(PLAN_KIND, refOrder.plan_kind), label(PLAN_FAMILY, refOrder.plan_family), label(ORDER_STATUS, refOrder.status), refOrder.actual_opened_at ? `实际开通 ${fmtDate(refOrder.actual_opened_at)}` : null].filter(Boolean).join(" · ")}</small>{refOrder.parent_subscription_id && <small className="order-parent-mark">叠加于 {refOrder.parent_subscription_id}</small>}</div>}
|
|
|
- {/* P1(D-2/D-7):并单成员订阅**平铺**列出,附加成员只标「叠加于 SUB-xxx」,⛔ 折叠成树。 */}
|
|
|
- {(d.subscriptions ?? []).length > 0 && <div className="work-order-trace"><span>并单成员订阅({(d.subscriptions ?? []).length})</span><div className="work-order-member-list">{(d.subscriptions ?? []).map((member) => <div key={member.subscription_id} className="work-order-member-row"><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: member.subscription_id, name: member.plan_name ?? null })}>{member.plan_name ?? member.subscription_id}</button><small>{member.subscription_id}{member.plan_family ? ` · ${label(PLAN_FAMILY, member.plan_family)}` : ""}{member.status ? ` · ${label(ORDER_STATUS, member.status)}` : ""}</small>{member.parent_subscription_id && <small className="order-parent-mark">叠加于 {member.parent_subscription_id}</small>}</div>)}</div></div>}
|
|
|
- </section>
|
|
|
- <section className="work-order-section">
|
|
|
- <h2>追溯与关联</h2>
|
|
|
- {t.ticket_type === "renewal" && (t.renew_from_contract_id || t.renew_from_contract_no) && (
|
|
|
- <div className="work-order-trace"><span>续签来源合同</span><strong>{t.renew_from_contract_no ?? t.renew_from_contract_id}</strong>
|
|
|
- {t.renew_from_end_date ? <small>原到期 {fmtDate(t.renew_from_end_date)}</small> : null}
|
|
|
- {t.renew_contract_no || t.renew_contract_id ? <small> · 新合同 {t.renew_contract_no ?? t.renew_contract_id}</small> : null}
|
|
|
+ <WorkOrderPanel tab="references" active={activeTab} className="work-order-refs">
|
|
|
+ <section className="record-summary-panel">
|
|
|
+ <h2 className="work-order-panel-title">客户资料</h2>
|
|
|
+ {refCustomer ? <dl className="ops-record-summary">
|
|
|
+ <div>
|
|
|
+ <dt>客户名称</dt>
|
|
|
+ <dd>{refCustomer.customer_name && refCustomer.customer_id
|
|
|
+ ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>{refCustomer.customer_name}</button>
|
|
|
+ : recordValue(refCustomer.customer_name)}</dd>
|
|
|
+ </div>
|
|
|
+ <div><dt>客户编号</dt><dd>{recordValue(refCustomer.customer_code || refCustomer.customer_id)}</dd></div>
|
|
|
+ <div><dt>联系人</dt><dd>{refCustomer.contact_name_missing ? <span className="table-placeholder">资料缺失</span> : recordValue(refCustomer.contact_name)}</dd></div>
|
|
|
+ <div><dt>联系电话</dt><dd>{refCustomer.contact_mobile_missing ? <span className="table-placeholder">资料缺失</span> : recordValue(refCustomer.contact_mobile_full || refCustomer.contact_mobile)}</dd></div>
|
|
|
+ <div className="work-order-reference-wide">
|
|
|
+ <dt>客户地址</dt>
|
|
|
+ <dd>{refCustomer.address_missing && refCustomer.customer_id
|
|
|
+ ? <button type="button" className="work-order-trace-link work-order-trace-missing" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>资料缺失,需补充</button>
|
|
|
+ : recordValue(refCustomer.address)}</dd>
|
|
|
</div>
|
|
|
- )}
|
|
|
- <div className="work-order-trace"><span>本单来源</span><strong>{t.source_message_id ? "运营商报文触发" : t.submitter_type === "customer" ? "客户侧提交" : "运营侧代报"}</strong></div>
|
|
|
- {d.messages.length > 0 && <div className="work-order-trace"><span>关联报文</span><strong>{d.messages.map((m) => m.carrier_order_no ?? m.message_id).join("、")}</strong></div>}
|
|
|
- {t.source_message_id && <div className="work-order-trace"><span>来源报文</span><strong>{t.source_message_id}</strong></div>}
|
|
|
- {t.subscription_id && <div className="work-order-trace"><span>关联订单号</span><strong><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: t.subscription_id!, name: refOrder?.plan_name })}>{t.subscription_id}</button></strong></div>}
|
|
|
+ </dl> : <p className="work-order-reference-empty">该单未关联客户档案。</p>}
|
|
|
</section>
|
|
|
- </div>
|
|
|
+
|
|
|
+ {(refSubscriptionId || memberSubscriptions.length > 0) && <section className="record-summary-panel">
|
|
|
+ <h2 className="work-order-panel-title">关联订阅</h2>
|
|
|
+ <dl className="ops-record-summary">
|
|
|
+ {refSubscriptionId && <div>
|
|
|
+ <dt>订阅编号</dt>
|
|
|
+ <dd><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refSubscriptionId, name: refOrder?.plan_name })}>{refSubscriptionId}</button></dd>
|
|
|
+ </div>}
|
|
|
+ {refOrder && <>
|
|
|
+ <div><dt>套餐名称</dt><dd>{refOrder.plan_name
|
|
|
+ ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refOrder.subscription_id, name: refOrder.plan_name })}>{refOrder.plan_name}</button>
|
|
|
+ : recordValue(null)}</dd></div>
|
|
|
+ <div><dt>套餐类型</dt><dd>{recordValue(label(PLAN_KIND, refOrder.plan_kind))}</dd></div>
|
|
|
+ <div><dt>交付形态</dt><dd>{recordValue(label(PLAN_FAMILY, refOrder.plan_family))}</dd></div>
|
|
|
+ <div><dt>订阅状态</dt><dd>{recordValue(label(ORDER_STATUS, refOrder.status))}</dd></div>
|
|
|
+ {refOrder.actual_opened_at && <div><dt>实际开通日</dt><dd>{fmtDate(refOrder.actual_opened_at)}</dd></div>}
|
|
|
+ {refOrder.parent_subscription_id && <div><dt>叠加于</dt><dd>{refOrder.parent_subscription_id}</dd></div>}
|
|
|
+ </>}
|
|
|
+ {memberSubscriptions.length > 0 && <div className="work-order-reference-wide">
|
|
|
+ <dt>并单成员订阅({memberSubscriptions.length})</dt>
|
|
|
+ <dd className="work-order-member-list">{memberSubscriptions.map((member) => <div key={member.subscription_id} className="work-order-member-row">
|
|
|
+ <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: member.subscription_id, name: member.plan_name ?? null })}>{member.plan_name ?? member.subscription_id}</button>
|
|
|
+ <small>{[member.subscription_id, label(PLAN_FAMILY, member.plan_family), label(ORDER_STATUS, member.status)].filter(Boolean).join(" · ")}</small>
|
|
|
+ {member.parent_subscription_id && <small className="order-parent-mark">叠加于 {member.parent_subscription_id}</small>}
|
|
|
+ </div>)}</dd>
|
|
|
+ </div>}
|
|
|
+ </dl>
|
|
|
+ </section>}
|
|
|
+ </WorkOrderPanel>
|
|
|
+
|
|
|
+ <WorkOrderPanel tab="trace" active={activeTab} className="work-order-refs">
|
|
|
+ <section className="record-summary-panel">
|
|
|
+ <dl className="ops-record-summary">
|
|
|
+ <div><dt>本单来源</dt><dd>{t.source_message_id ? "运营商报文触发" : submitterLabel}</dd></div>
|
|
|
+ {t.source_message_id && <div><dt>来源报文</dt><dd>{t.source_message_id}</dd></div>}
|
|
|
+ {refSubscriptionId && <div>
|
|
|
+ <dt>关联订单号</dt>
|
|
|
+ <dd><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refSubscriptionId, name: refOrder?.plan_name })}>{refOrder?.order_no || refSubscriptionId}</button></dd>
|
|
|
+ </div>}
|
|
|
+ {t.ticket_type === "renewal" && (t.renew_from_contract_id || t.renew_from_contract_no) && <>
|
|
|
+ <div><dt>续签来源合同</dt><dd>{t.renew_from_contract_no ?? t.renew_from_contract_id}</dd></div>
|
|
|
+ {t.renew_from_end_date && <div><dt>原合同到期日</dt><dd>{fmtDate(t.renew_from_end_date)}</dd></div>}
|
|
|
+ {(t.renew_contract_no || t.renew_contract_id) && <div><dt>新合同</dt><dd>{t.renew_contract_no ?? t.renew_contract_id}</dd></div>}
|
|
|
+ </>}
|
|
|
+ {d.messages.length > 0 && <div className="work-order-reference-wide"><dt>关联报文</dt><dd>{d.messages.map((m) => m.carrier_order_no ?? m.message_id).join("、")}</dd></div>}
|
|
|
+ </dl>
|
|
|
+ </section>
|
|
|
+ </WorkOrderPanel>
|
|
|
</div>
|
|
|
<aside className="work-order-side">
|
|
|
{/* 右栏=处理记录专席:面板高度随窗口自适应、条数超出时面板内滚动,页面本身不变长。 */}
|