|
@@ -1,7 +1,7 @@
|
|
|
import { Fragment, useEffect, useRef, useState, type FormEvent, type ReactNode } from "react";
|
|
import { Fragment, useEffect, useRef, useState, type FormEvent, type ReactNode } from "react";
|
|
|
import {
|
|
import {
|
|
|
ArrowLeft, ArrowRight, Check, ChevronDown, CircleAlert, ClipboardCheck, FolderOpen,
|
|
ArrowLeft, ArrowRight, Check, ChevronDown, CircleAlert, ClipboardCheck, FolderOpen,
|
|
|
- Image, Info, Link2, Plus, RefreshCcw, ShieldAlert, TriangleAlert, X,
|
|
|
|
|
|
|
+ FileUp, Image, Info, Plus, RefreshCcw, ShieldAlert, TriangleAlert, X,
|
|
|
} from "lucide-react";
|
|
} from "lucide-react";
|
|
|
import { Button } from "../components/ui/button";
|
|
import { Button } from "../components/ui/button";
|
|
|
import { Input } from "../components/ui/input";
|
|
import { Input } from "../components/ui/input";
|
|
@@ -113,7 +113,7 @@ const OPEN_STOP_ACTION_NAMES: Record<string, string> = { open: "开户", stop: "
|
|
|
const EXEC_STATUS_NAMES: Record<string, string> = { pending: "待回填", ...CONCLUSION_NAMES };
|
|
const EXEC_STATUS_NAMES: Record<string, string> = { pending: "待回填", ...CONCLUSION_NAMES };
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 缺口组 → 「去处理」的目标:打开哪个动作抽屉、抽屉里滚到哪一段。
|
|
|
|
|
|
|
+ * 缺口组对应的动作和表单位置。
|
|
|
*
|
|
*
|
|
|
* 2026-11-17:缺口清单原先是「只读提示」,运维看到「线路与路由未回填」还得自己回想该点哪个按钮。
|
|
* 2026-11-17:缺口清单原先是「只读提示」,运维看到「线路与路由未回填」还得自己回想该点哪个按钮。
|
|
|
* 这里把组名(服务端 `domain::GROUP_*` 中文名与旧短键都收)映射成动作位+焦点段,
|
|
* 这里把组名(服务端 `domain::GROUP_*` 中文名与旧短键都收)映射成动作位+焦点段,
|
|
@@ -144,46 +144,6 @@ function StatusTag({ status, type }: { status: string; type: string }) {
|
|
|
return <TicketStatusTag status={status} type={type} />;
|
|
return <TicketStatusTag status={status} type={type} />;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 抽屉容器(详情页各动作表单共用;模态框的打开/焦点恢复/滚动锁定与建单抽屉同构)。
|
|
|
|
|
- * `presentation="page"`=移动端全屏页(非 dialog),复用同一套表单、无遮罩侧栏。 */
|
|
|
|
|
-function Sheet({ title, subtitle, onClose, children, presentation = "drawer" }: {
|
|
|
|
|
- title: string; subtitle: string; onClose: () => void; children: ReactNode;
|
|
|
|
|
- presentation?: "drawer" | "page";
|
|
|
|
|
-}) {
|
|
|
|
|
- const ref = useRef<HTMLDialogElement>(null);
|
|
|
|
|
- useEffect(() => {
|
|
|
|
|
- if (presentation === "page") return;
|
|
|
|
|
- const dialog = ref.current;
|
|
|
|
|
- if (!dialog) return;
|
|
|
|
|
- const previous = document.activeElement as HTMLElement | null;
|
|
|
|
|
- const overflow = document.body.style.overflow;
|
|
|
|
|
- document.body.style.overflow = "hidden";
|
|
|
|
|
- dialog.showModal();
|
|
|
|
|
- return () => { dialog.close(); document.body.style.overflow = overflow; previous?.focus(); };
|
|
|
|
|
- }, [presentation]);
|
|
|
|
|
- const header = (
|
|
|
|
|
- <header>
|
|
|
|
|
- <div><p>{subtitle}</p><h2>{title}</h2></div>
|
|
|
|
|
- <Button variant="ghost" size="icon" aria-label="关闭" onClick={onClose}><X size={19} /></Button>
|
|
|
|
|
- </header>
|
|
|
|
|
- );
|
|
|
|
|
- if (presentation === "page") {
|
|
|
|
|
- return (
|
|
|
|
|
- <div className="work-order-drawer work-order-drawer--page" aria-label={title}>
|
|
|
|
|
- {header}
|
|
|
|
|
- {children}
|
|
|
|
|
- </div>
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- // ⛔ 同时给 `open` 属性和 `showModal()`:规范规定 `open` 已置位时 `showModal()` 抛
|
|
|
|
|
- // `InvalidStateError`,异常从 effect 里冒出会把整棵 React 树卸载(实测点「施工回填」整页白屏)。
|
|
|
|
|
- // 抽屉的打开态一律交给 `showModal()`,`::backdrop` 也只在模态态下才生效。
|
|
|
|
|
- return <dialog ref={ref} className="work-order-drawer" aria-label={title} onCancel={onClose} onClick={(e) => { if (e.target === e.currentTarget) onClose(); }}>
|
|
|
|
|
- {header}
|
|
|
|
|
- {children}
|
|
|
|
|
- </dialog>;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 驳回理由码 → 中文名(出参 `reason_codes` 是 `jsonb::text`,形如 `["doc_missing"]`)。
|
|
* 驳回理由码 → 中文名(出参 `reason_codes` 是 `jsonb::text`,形如 `["doc_missing"]`)。
|
|
|
* 解析失败就**原样显示**,⛔ 让一条脏 JSON 把整块驳回记录抹白。
|
|
* 解析失败就**原样显示**,⛔ 让一条脏 JSON 把整块驳回记录抹白。
|
|
@@ -388,7 +348,7 @@ function logTone(action: string | null | undefined): string {
|
|
|
*/
|
|
*/
|
|
|
function Repeater({ title, hint, required, onAdd, addDisabled, foot, children, dataFocus }: {
|
|
function Repeater({ title, hint, required, onAdd, addDisabled, foot, children, dataFocus }: {
|
|
|
title: string; hint: string; required?: boolean; onAdd?: () => void; addDisabled?: boolean; foot: string; children: ReactNode;
|
|
title: string; hint: string; required?: boolean; onAdd?: () => void; addDisabled?: boolean; foot: string; children: ReactNode;
|
|
|
- /** 缺口「去处理」落点:抽屉打开后滚到这一段并短暂高亮(见 ActionSheet 的 focus effect)。 */
|
|
|
|
|
|
|
+ /** 缺口入口定位到这一段并短暂高亮。 */
|
|
|
dataFocus?: GapFocus;
|
|
dataFocus?: GapFocus;
|
|
|
}) {
|
|
}) {
|
|
|
return <div className="wide work-order-repeater" data-gap-focus={dataFocus}>
|
|
return <div className="wide work-order-repeater" data-gap-focus={dataFocus}>
|
|
@@ -402,16 +362,16 @@ function Repeater({ title, hint, required, onAdd, addDisabled, foot, children, d
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 工单动作表单。移动端全屏回填也复用该表单。 */
|
|
/** 工单动作表单。移动端全屏回填也复用该表单。 */
|
|
|
-export function TicketActionSheet({ action, detail, onClose, onDone, focus, onReload, presentation = "drawer" }: {
|
|
|
|
|
|
|
+export function TicketActionSheet({ action, detail, onClose, onDone, focus, onReload, presentation = "dialog" }: {
|
|
|
action: string;
|
|
action: string;
|
|
|
detail: TicketDetail;
|
|
detail: TicketDetail;
|
|
|
onClose: () => void;
|
|
onClose: () => void;
|
|
|
onDone: (msg: string) => void;
|
|
onDone: (msg: string) => void;
|
|
|
/** 从缺口入口打开时定位并高亮对应字段。 */
|
|
/** 从缺口入口打开时定位并高亮对应字段。 */
|
|
|
focus?: GapFocus;
|
|
focus?: GapFocus;
|
|
|
- /** 乐观锁冲突后的「重新读取」:由详情页重取,⛔ 在本抽屉里静默重试写请求。 */
|
|
|
|
|
|
|
+ /** 版本冲突时由详情页重新读取。 */
|
|
|
onReload: () => void;
|
|
onReload: () => void;
|
|
|
- presentation?: "drawer" | "dialog" | "page";
|
|
|
|
|
|
|
+ presentation?: "dialog" | "page";
|
|
|
}) {
|
|
}) {
|
|
|
const submit = useSubmit();
|
|
const submit = useSubmit();
|
|
|
const me = useDemoIdentity();
|
|
const me = useDemoIdentity();
|
|
@@ -429,19 +389,19 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
/** `60404` 的缺口组(P4-D10):与整句提示并列展示,按组红显。 */
|
|
/** `60404` 的缺口组(P4-D10):与整句提示并列展示,按组红显。 */
|
|
|
const [gapGroups, setGapGroups] = useState<string[]>([]);
|
|
const [gapGroups, setGapGroups] = useState<string[]>([]);
|
|
|
const [reason, setReason] = useState("");
|
|
const [reason, setReason] = useState("");
|
|
|
- /** 无正式回填时,打开抽屉直接载入服务端草稿(⛔ 再点「恢复」才看得见)。 */
|
|
|
|
|
|
|
+ /** 无正式回填时,打开表单直接载入服务端草稿。 */
|
|
|
const serverDraft = !detail.backfill?.backfill_id ? detail.backfill_draft : null;
|
|
const serverDraft = !detail.backfill?.backfill_id ? detail.backfill_draft : null;
|
|
|
const [note, setNote] = useState(() => serverDraft?.check_note || "");
|
|
const [note, setNote] = useState(() => serverDraft?.check_note || "");
|
|
|
const [assignee, setAssignee] = useState("");
|
|
const [assignee, setAssignee] = useState("");
|
|
|
const [trustee, setTrustee] = useState("");
|
|
const [trustee, setTrustee] = useState("");
|
|
|
- const [candidates, setCandidates] = useState<AssignCandidate[]>([]);
|
|
|
|
|
- const [members, setMembers] = useState<{ user_id: string; username: string | null; display_name?: string | null }[]>([]);
|
|
|
|
|
|
|
+ const [candidates, setCandidates] = useState<AssignCandidate[] | null>(null);
|
|
|
|
|
+ const [members, setMembers] = useState<{ user_id: string; username: string | null; display_name?: string | null }[] | null>(null);
|
|
|
const [pickedItems, setPickedItems] = useState<string[]>(() => serverDraft?.check_item_ids ?? []);
|
|
const [pickedItems, setPickedItems] = useState<string[]>(() => serverDraft?.check_item_ids ?? []);
|
|
|
const [conclusion, setConclusion] = useState(() => serverDraft?.exec_conclusion || "success");
|
|
const [conclusion, setConclusion] = useState(() => serverDraft?.exec_conclusion || "success");
|
|
|
const [conclusionNote, setConclusionNote] = useState(() => serverDraft?.conclusion_note || "");
|
|
const [conclusionNote, setConclusionNote] = useState(() => serverDraft?.conclusion_note || "");
|
|
|
/**
|
|
/**
|
|
|
* 结论区主日期:开通类=实际开通日期(受执行锁 `min` 约束,缺省留空由运维按实施工日填写);
|
|
* 结论区主日期:开通类=实际开通日期(受执行锁 `min` 约束,缺省留空由运维按实施工日填写);
|
|
|
- * 停机类回填=实际停机完成日期,打开抽屉即落到当天(已回填过则沿用旧值),与原型 `bfsDate` 同口径。
|
|
|
|
|
|
|
+ * 停机类默认实际停机日期为当天,已回填时沿用旧值。
|
|
|
*/
|
|
*/
|
|
|
const [mainDate, setMainDate] = useState(() => {
|
|
const [mainDate, setMainDate] = useState(() => {
|
|
|
if (serverDraft?.actual_opened_date || serverDraft?.stop_done_date) {
|
|
if (serverDraft?.actual_opened_date || serverDraft?.stop_done_date) {
|
|
@@ -550,7 +510,7 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (presentation !== "dialog" || !tip) return;
|
|
if (presentation !== "dialog" || !tip) return;
|
|
|
- formRef.current?.querySelector(".work-order-form-error")?.scrollIntoView?.({ block: "nearest" });
|
|
|
|
|
|
|
+ formRef.current?.querySelector(".work-order-action-error")?.scrollIntoView?.({ block: "nearest" });
|
|
|
}, [presentation, tip]);
|
|
}, [presentation, tip]);
|
|
|
|
|
|
|
|
/** 核定出口到位后:单值自动带入空行;多值把不在集合内的草稿/历史值清掉逼重选。 */
|
|
/** 核定出口到位后:单值自动带入空行;多值把不在集合内的草稿/历史值清掉逼重选。 */
|
|
@@ -778,16 +738,50 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const rows = <div className="work-order-form-grid">
|
|
const rows = <div className="work-order-form-grid">
|
|
|
- {action === "assign" && <label className="wide">处理人(本团队接该类型的在册成员/运营账号)<select value={assignee} onChange={(e) => setAssignee(e.target.value)}><option value="">请选择</option>{candidates.map((c) => <option key={c.user_id} value={c.user_id}>{c.display_name ?? c.username ?? c.user_id}{c.source === "ops_account" ? "(运营账号)" : ""}{c.pending_count > 0 ? `(在办 ${c.pending_count} 单)` : ""}</option>)}</select></label>}
|
|
|
|
|
- {action === "assign" && !candidates.length && <p className="work-order-detail-footnote"><CircleAlert size={15} />候选人来自「待分派队列」:名单为空说明本团队没有具备该工单类型接单资质的成员、也没有负责范围覆盖该客户的运营账号,请先配置工单类型或运营团队负责范围。</p>}
|
|
|
|
|
- {action === "delegate" && <label className="wide">代管人(承接团队在册成员)<select value={trustee} onChange={(e) => setTrustee(e.target.value)}><option value="">请选择</option>{members.map((m) => <option key={m.user_id} value={m.user_id}>{m.display_name ?? m.username ?? m.user_id}</option>)}</select></label>}
|
|
|
|
|
- {action === "check_done" && <div className="wide work-order-gap-anchor" data-gap-focus="checklist">
|
|
|
|
|
- <div className="wide work-order-checklist">{detail.service_items.map((item) => <label key={item.item_id}><input type="checkbox" disabled={item.check_result !== "pending"} checked={item.check_result === "done" || pickedItems.includes(item.item_id)} onChange={(e) => setPickedItems((prev) => e.target.checked ? [...prev, item.item_id] : prev.filter((id) => id !== item.item_id))} /><span>{item.item_name ?? item.item_id}{item.check_result === "done" && <small> 已核对</small>}{item.check_result === "absent" && <small> 缺项</small>}</span></label>)}</div>
|
|
|
|
|
- <label className="wide">实际开通日期 <em>*</em><Input type="date" value={mainDate} min={execNotBefore ?? undefined} max={todayStr} onChange={(e) => setMainDate(e.target.value)} /></label>
|
|
|
|
|
|
|
+ {action === "assign" && <>
|
|
|
|
|
+ <FieldLabel className="wide" label="处理人" required>
|
|
|
|
|
+ <select value={assignee} disabled={!candidates?.length} onChange={(e) => setAssignee(e.target.value)}>
|
|
|
|
|
+ <option value="">{candidates === null ? "正在读取候选成员…" : candidates.length ? "请选择处理人" : "暂无可分派成员"}</option>
|
|
|
|
|
+ {candidates?.map((c) => <option key={c.user_id} value={c.user_id}>
|
|
|
|
|
+ {c.display_name ?? c.username ?? c.user_id}{c.source === "ops_account" ? "(运营账号)" : ""}{c.pending_count > 0 ? ` · 在办 ${c.pending_count} 单` : ""}
|
|
|
|
|
+ </option>)}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ <p className="wide work-order-dialog-notice"><Info size={16} aria-hidden="true" />
|
|
|
|
|
+ {candidates?.length === 0 ? "没有符合当前工单类型和负责范围的成员,请检查团队配置。" : "分派后,工单将进入该成员的待处理列表。"}
|
|
|
|
|
+ </p>
|
|
|
|
|
+ </>}
|
|
|
|
|
+ {action === "delegate" && <>
|
|
|
|
|
+ <FieldLabel className="wide" label="代管人" required>
|
|
|
|
|
+ <select value={trustee} disabled={!members?.length} onChange={(e) => setTrustee(e.target.value)}>
|
|
|
|
|
+ <option value="">{!t.assign_team_id || members?.length === 0 ? "暂无可选成员" : members === null ? "正在读取团队成员…" : "请选择代管人"}</option>
|
|
|
|
|
+ {members?.map((m) => <option key={m.user_id} value={m.user_id}>{m.display_name ?? m.username ?? m.user_id}</option>)}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ <p className="wide work-order-dialog-notice"><Info size={16} aria-hidden="true" />代管人接手后,原责任人仍可跟踪工单进度。</p>
|
|
|
|
|
+ </>}
|
|
|
|
|
+ {action === "check_done" && <>
|
|
|
|
|
+ {execLocked && <p className="wide work-order-dialog-notice" data-tone="warning"><CircleAlert size={16} aria-hidden="true" />计划执行日为 {execNotBefore ? fmtDate(execNotBefore) : "待定"},请在计划执行日或之后核对。</p>}
|
|
|
|
|
+ <fieldset className="wide work-order-dialog-checklist" data-gap-focus="checklist">
|
|
|
|
|
+ <legend>服务清单 <em>*</em></legend>
|
|
|
|
|
+ {detail.service_items.length ? <div className="work-order-checklist">
|
|
|
|
|
+ {detail.service_items.map((item) => (
|
|
|
|
|
+ <label key={item.item_id}>
|
|
|
|
|
+ <input type="checkbox" disabled={item.check_result !== "pending"} checked={item.check_result === "done" || pickedItems.includes(item.item_id)}
|
|
|
|
|
+ onChange={(e) => setPickedItems((prev) => e.target.checked ? [...prev, item.item_id] : prev.filter((id) => id !== item.item_id))} />
|
|
|
|
|
+ <span>{item.item_name ?? item.item_id}{item.check_result === "done" && <small>已核对</small>}{item.check_result === "absent" && <small>缺项</small>}</span>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </div> : <p className="table-placeholder">暂无服务条目</p>}
|
|
|
|
|
+ </fieldset>
|
|
|
|
|
+ <FieldLabel className="wide" label="实际开通日期" required>
|
|
|
|
|
+ <Input type="date" value={mainDate} min={execNotBefore ?? undefined} max={todayStr} onChange={(e) => setMainDate(e.target.value)} />
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ <FieldLabel className="wide" label="处理记录" required>
|
|
|
|
|
+ <textarea rows={3} maxLength={500} value={note} placeholder="填写核对结果和处理情况" onChange={(e) => setNote(e.target.value)} />
|
|
|
|
|
+ </FieldLabel>
|
|
|
<TicketExtForm ref={extFormRef} ext={extMeta} values={extValues} onChange={setExtValues} enforceRequired />
|
|
<TicketExtForm ref={extFormRef} ext={extMeta} values={extValues} onChange={setExtValues} enforceRequired />
|
|
|
- </div>}
|
|
|
|
|
- {action === "check_done" && execLocked && <p className="work-order-detail-footnote wide"><CircleAlert size={15} />本单计划执行日(服务开始日)为 {execNotBefore ? fmtDate(execNotBefore) : "待定"},未到该日不可核对竣工;实际开通日也⛔ 早于该日。</p>}
|
|
|
|
|
- {action === "check_done" && <p className="work-order-detail-footnote wide"><Info size={15} />三件套=服务清单全部核对 ∧ 实际开通日不晚于当天 ∧ 处理记录非空。服务开通单没有「施工回填」口(扩展字段随本核对口提交);变更协议单可另走结论区回填,实际开通日亦可随本次核对登记并回写该条订阅。</p>}
|
|
|
|
|
|
|
+ </>}
|
|
|
{action === "backfill" && <>
|
|
{action === "backfill" && <>
|
|
|
{execLocked && <p className="work-order-detail-footnote wide"><CircleAlert size={15} />本单计划执行日(服务开始日)为 {execNotBefore ? fmtDate(execNotBefore) : "待定"},未到该日不可回填;实际开通日也⛔ 早于该日。</p>}
|
|
{execLocked && <p className="work-order-detail-footnote wide"><CircleAlert size={15} />本单计划执行日(服务开始日)为 {execNotBefore ? fmtDate(execNotBefore) : "待定"},未到该日不可回填;实际开通日也⛔ 早于该日。</p>}
|
|
|
{draftHint && (
|
|
{draftHint && (
|
|
@@ -978,44 +972,75 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
})}
|
|
})}
|
|
|
</Repeater>}
|
|
</Repeater>}
|
|
|
</>}
|
|
</>}
|
|
|
- {action === "reject_completion" && <div className="wide">
|
|
|
|
|
- <p className="work-order-detail-footnote"><Info size={15} />驳回对象=竣工件 <strong>{detail.completion?.completion_no ?? "—"}</strong>(回传 {fmtDate(detail.completion?.pushed_at)});不得指定别的件号。驳回后工单进入「竣工驳回」,该态只开「同号覆盖重推」;要改回填须先退回重办(总运营或本团队主账号,回到「处理中」)。</p>
|
|
|
|
|
- <p style={{ margin: "10px 0 6px" }}>驳回理由 <em>*</em>(1~{REJECT_REASON_MAX} 枚,「其他」不得与他项混选)</p>
|
|
|
|
|
- <div style={{ display: "flex", flexWrap: "wrap", gap: 6 }}>
|
|
|
|
|
|
|
+ {action === "reject_completion" && <>
|
|
|
|
|
+ <div className="wide work-order-dialog-notice" data-tone="warning">
|
|
|
|
|
+ <TriangleAlert size={16} aria-hidden="true" />
|
|
|
|
|
+ <div><strong>竣工件 {detail.completion?.completion_no ?? "—"}</strong>
|
|
|
|
|
+ <p>驳回后可同号重推。如需修改施工回填,请先退回重办。</p></div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <fieldset className="wide work-order-reject-options">
|
|
|
|
|
+ <legend>驳回理由 <em>*</em></legend>
|
|
|
|
|
+ <p>请选择 1–{REJECT_REASON_MAX} 项。「其他」需单独选择。</p>
|
|
|
|
|
+ <div>
|
|
|
{REJECT_REASONS.map((r) => {
|
|
{REJECT_REASONS.map((r) => {
|
|
|
const on = rejectCodes.includes(r.code);
|
|
const on = rejectCodes.includes(r.code);
|
|
|
// 独占与超限在界面上就挡掉(勾了其他就锁其余),到服务端仍是同一套校验。
|
|
// 独占与超限在界面上就挡掉(勾了其他就锁其余),到服务端仍是同一套校验。
|
|
|
const exclusive = rejectCodes.includes("other") || r.code === "other";
|
|
const exclusive = rejectCodes.includes("other") || r.code === "other";
|
|
|
const blocked = !on && (exclusive ? rejectCodes.length > 0 : rejectCodes.length >= REJECT_REASON_MAX);
|
|
const blocked = !on && (exclusive ? rejectCodes.length > 0 : rejectCodes.length >= REJECT_REASON_MAX);
|
|
|
- return <Button key={r.code} type="button" variant={on ? "default" : "outline"} size="sm" disabled={blocked}
|
|
|
|
|
|
|
+ return <Button key={r.code} type="button" variant="outline" size="sm" aria-pressed={on} disabled={blocked}
|
|
|
onClick={() => setRejectCodes((p) => (on ? p.filter((c) => c !== r.code) : [...p, r.code]))}>{on && <Check size={14} />}{r.name}</Button>;
|
|
onClick={() => setRejectCodes((p) => (on ? p.filter((c) => c !== r.code) : [...p, r.code]))}>{on && <Check size={14} />}{r.name}</Button>;
|
|
|
})}
|
|
})}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {rejectCodes.length > 0 && <p>主原因 <strong>{rejectPrimaryReason(rejectCodes)}</strong></p>}
|
|
|
|
|
+ </fieldset>
|
|
|
|
|
+ <div className="wide">
|
|
|
|
|
+ <FieldLabel label="驳回说明" required>
|
|
|
|
|
+ <textarea rows={3} maxLength={500} placeholder="说明具体问题和需补正的内容(至少 5 字)" value={rejectText} onChange={(e) => setRejectText(e.target.value)} />
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ <p className="work-order-dialog-count">{rejectText.trim().length} / 500</p>
|
|
|
</div>
|
|
</div>
|
|
|
- <p className="work-order-detail-footnote" style={{ marginTop: 6 }}>主原因=<strong>{rejectPrimaryReason(rejectCodes) || "待勾选"}</strong>(服务端按枚举定义序归一化,不由点击先后决定)</p>
|
|
|
|
|
- <label style={{ display: "block", marginTop: 10 }}>驳回说明 <em>*</em>(5~500 字,进处理记录与审计)<textarea rows={3} maxLength={500} value={rejectText} onChange={(e) => setRejectText(e.target.value)} /></label>
|
|
|
|
|
- <label style={{ display: "block", marginTop: 10 }}>对方驳回编号(选填;只落库,不对门户/合伙人回显)<Input maxLength={64} value={rejectExtNo} onChange={(e) => setRejectExtNo(e.target.value)} /></label>
|
|
|
|
|
- <p style={{ marginTop: 4 }}><small>{rejectText.trim().length} / 500</small></p>
|
|
|
|
|
- </div>}
|
|
|
|
|
- {(action === "close" || action === "withdraw" || action === "revert") && <label className="wide">原因 <em>*</em><textarea rows={3} maxLength={500} value={reason} onChange={(e) => setReason(e.target.value)} /></label>}
|
|
|
|
|
|
|
+ <FieldLabel className="wide" label="对方驳回编号" hint="仅供内部追溯。">
|
|
|
|
|
+ <Input maxLength={64} value={rejectExtNo} placeholder="填写运营商侧驳回编号" onChange={(e) => setRejectExtNo(e.target.value)} />
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ </>}
|
|
|
|
|
+ {(action === "close" || action === "withdraw" || action === "revert") && <>
|
|
|
|
|
+ <p className="wide work-order-dialog-notice" data-tone={action === "revert" ? "warning" : "danger"}>
|
|
|
|
|
+ <TriangleAlert size={16} aria-hidden="true" />
|
|
|
|
|
+ {action === "close" ? "工单作废后退出处理流程。" : action === "withdraw" ? "撤回后工单会关闭。" : "工单将退回「处理中」,原因会记入审计日志。"}
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <FieldLabel className="wide" label={action === "close" ? "作废原因" : action === "withdraw" ? "撤回原因" : "退回原因"} required>
|
|
|
|
|
+ <textarea rows={4} maxLength={500} value={reason} placeholder="填写原因" onChange={(e) => setReason(e.target.value)} />
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ </>}
|
|
|
{/* 客户确认闭环:与列表页弹框同口径(门户册 9 §7.5.1,7 天未确认由系统自动关闭)。 */}
|
|
{/* 客户确认闭环:与列表页弹框同口径(门户册 9 §7.5.1,7 天未确认由系统自动关闭)。 */}
|
|
|
- {action === "confirm_close" && <p className="work-order-detail-footnote wide"><Info size={15} />运维已标记完成,确认后工单立即关闭并形成服务闭环;7 天内未确认由系统自动关闭。该动作与列表页「确认完成,关闭工单」是同一个(`ticket/confirm_close@v1`)。</p>}
|
|
|
|
|
- {(action === "check_done" || action === "mark_done" || action === "confirm_receipt") && <label className="wide" data-gap-focus={action === "mark_done" ? "note" : undefined}>备注<textarea rows={3} maxLength={500} value={note} onChange={(e) => setNote(e.target.value)} /></label>}
|
|
|
|
|
- {(action === "defer_open_stop" || action === "defer_ticket") && <p className="work-order-detail-footnote wide"><Info size={15} />延期只顺延提醒期限,不改变账户状态或计费;期限由服务端按超期天数推进。</p>}
|
|
|
|
|
|
|
+ {action === "confirm_close" && <p className="wide work-order-dialog-notice"><Info size={16} aria-hidden="true" />运维已标记完成。确认后工单将关闭,7 天内未确认的工单会自动关闭。</p>}
|
|
|
|
|
+ {action === "confirm_receipt" && <p className="wide work-order-dialog-notice"><Info size={16} aria-hidden="true" />
|
|
|
|
|
+ <span>确认运营商已回执后,工单将闭环。{detail.completion?.completion_no && <strong> 竣工件 {detail.completion.completion_no}</strong>}</span>
|
|
|
|
|
+ </p>}
|
|
|
|
|
+ {(action === "mark_done" || action === "confirm_receipt") && <div className="wide" data-gap-focus={action === "mark_done" ? "note" : undefined}>
|
|
|
|
|
+ <FieldLabel label={action === "mark_done" ? "处理记录" : "回执说明"}>
|
|
|
|
|
+ <textarea rows={4} maxLength={500} value={note} placeholder={action === "mark_done" ? "填写处理经过和结果" : "填写回执情况或补充说明"} onChange={(e) => setNote(e.target.value)} />
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ {action === "mark_done" && <p className="work-order-dialog-support">标记完成后,工单将等待客户确认。</p>}
|
|
|
|
|
+ </div>}
|
|
|
|
|
+ {(action === "defer_open_stop" || action === "defer_ticket") && <p className="wide work-order-dialog-notice"><Info size={16} aria-hidden="true" />确认后将顺延提醒期限。账户状态和计费规则照常执行。</p>}
|
|
|
</div>;
|
|
</div>;
|
|
|
|
|
|
|
|
const titles: Record<string, [string, string]> = {
|
|
const titles: Record<string, [string, string]> = {
|
|
|
- assign: ["分派工单", "分派后进入待处理"], delegate: ["转交代管", "责任人把单交给同事代管"],
|
|
|
|
|
- check_done: ["服务清单核对", "逐条登记核对结果"],
|
|
|
|
|
- mark_done: ["标记完成", "非主线单标记完成"], close: ["作废工单", "填写原因后作废"],
|
|
|
|
|
- withdraw: ["撤回并关闭", "客户侧本人撤回"], revert: ["退回重办", "总运营或本团队主账号,退回到「处理中」,原因写入审计"],
|
|
|
|
|
- confirm_close: ["确认完成,关闭工单", "客户确认处理结果,工单即时闭环"],
|
|
|
|
|
- defer_open_stop: ["开停记录延期", "顺延到期停机提醒"], defer_ticket: ["工单延期", "顺延服务开通提醒"],
|
|
|
|
|
- confirm_receipt: ["回执确认闭环", "确认运营商竣工回执"],
|
|
|
|
|
- reject_completion: ["登记竣工驳回", "驳回这一版竣工交付物"],
|
|
|
|
|
- backfill: isUpdown ? ["核对并回填", "清单核对与执行结论同批"] : ["施工回填", "执行结论与日期"],
|
|
|
|
|
|
|
+ assign: ["分派工单", "确认分派"], delegate: ["转交代管", "确认转交"],
|
|
|
|
|
+ check_done: ["服务清单核对", "提交核对结果"],
|
|
|
|
|
+ mark_done: ["标记完成", "确认完成"], close: ["作废工单", "确认作废"],
|
|
|
|
|
+ withdraw: ["撤回工单", "确认撤回"], revert: ["退回重办", "确认退回"],
|
|
|
|
|
+ confirm_close: ["确认完成,关闭工单", "确认关闭"],
|
|
|
|
|
+ defer_open_stop: ["开停记录延期", "确认延期"], defer_ticket: ["工单延期", "确认延期"],
|
|
|
|
|
+ confirm_receipt: ["回执确认闭环", "确认回执"],
|
|
|
|
|
+ reject_completion: ["登记竣工驳回", "确认驳回"],
|
|
|
|
|
+ backfill: [isUpdown ? "核对并回填" : "施工回填", "提交回填"],
|
|
|
};
|
|
};
|
|
|
- const [title, subtitle] = titles[action] ?? ["处理工单", ""];
|
|
|
|
|
|
|
+ const [title, submitLabel] = titles[action] ?? ["处理工单", "提交"];
|
|
|
const dialogTitle = focus === "conclusion" ? "登记执行结论" : title;
|
|
const dialogTitle = focus === "conclusion" ? "登记执行结论" : title;
|
|
|
|
|
+ const dialogSize = action === "backfill" ? " is-wide" : action === "check_done" || action === "reject_completion" ? " is-form" : "";
|
|
|
|
|
+ const destructive = action === "close" || action === "withdraw" || action === "reject_completion";
|
|
|
|
|
|
|
|
async function saveDraft() {
|
|
async function saveDraft() {
|
|
|
if (uploadingEvidence || submit.busy) return;
|
|
if (uploadingEvidence || submit.busy) return;
|
|
@@ -1053,7 +1078,7 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
});
|
|
});
|
|
|
if (ok) {
|
|
if (ok) {
|
|
|
// 父页 useLoad 已改为「有数据时 reload 不闪 loading」,可安全 soft-reload:
|
|
// 父页 useLoad 已改为「有数据时 reload 不闪 loading」,可安全 soft-reload:
|
|
|
- // 把 `backfill_draft` 写进详情缓存,关掉抽屉再开才能灌回表单(此前不 reload ⇒ 缓存仍空)。
|
|
|
|
|
|
|
+ // 刷新草稿缓存,重新打开时载入最新表单。
|
|
|
setDraftVersion(nextVer);
|
|
setDraftVersion(nextVer);
|
|
|
hydratedDraftVer.current = nextVer;
|
|
hydratedDraftVer.current = nextVer;
|
|
|
setDraftSavedNote("回填草稿已暂存(未生效),可继续编辑或正式提交。");
|
|
setDraftSavedNote("回填草稿已暂存(未生效),可继续编辑或正式提交。");
|
|
@@ -1073,8 +1098,8 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const body = <>
|
|
const body = <>
|
|
|
- <section>{rows}</section>
|
|
|
|
|
- {tip && <p className="work-order-form-error" role="alert">{tip}</p>}
|
|
|
|
|
|
|
+ {rows}
|
|
|
|
|
+ {tip && <p className="work-order-form-error work-order-action-error" role="alert">{tip}</p>}
|
|
|
{/请刷新后(重新填写|重试)|20417/.test(`${submit.error?.code ?? ""} ${submit.error?.message ?? ""}`) && <div className="work-order-form-error" role="alert">
|
|
{/请刷新后(重新填写|重试)|20417/.test(`${submit.error?.code ?? ""} ${submit.error?.message ?? ""}`) && <div className="work-order-form-error" role="alert">
|
|
|
<p>数据已被他人修改(乐观锁),本次提交未生效。请重新读取最新版本后再操作。</p>
|
|
<p>数据已被他人修改(乐观锁),本次提交未生效。请重新读取最新版本后再操作。</p>
|
|
|
<Button variant="ghost" size="sm" type="button" onClick={() => { onClose(); onReload(); }}><RefreshCcw size={14} />重新读取</Button>
|
|
<Button variant="ghost" size="sm" type="button" onClick={() => { onClose(); onReload(); }}><RefreshCcw size={14} />重新读取</Button>
|
|
@@ -1092,20 +1117,25 @@ export function TicketActionSheet({ action, detail, onClose, onDone, focus, onRe
|
|
|
{action === "backfill" && (
|
|
{action === "backfill" && (
|
|
|
<Button variant="outline" type="button" disabled={submit.busy || uploadingEvidence} onClick={() => void saveDraft()}>暂存草稿</Button>
|
|
<Button variant="outline" type="button" disabled={submit.busy || uploadingEvidence} onClick={() => void saveDraft()}>暂存草稿</Button>
|
|
|
)}
|
|
)}
|
|
|
- <Button type="submit" disabled={submit.busy || uploadingEvidence}><Check size={16} />{dialogView ? "提交回填" : "提交"}</Button>
|
|
|
|
|
|
|
+ <Button type="submit" variant={destructive ? "destructive" : "default"} disabled={submit.busy || uploadingEvidence}>
|
|
|
|
|
+ {submit.busy ? "正在提交…" : submitLabel}
|
|
|
|
|
+ </Button>
|
|
|
</footer>
|
|
</footer>
|
|
|
</form>;
|
|
</form>;
|
|
|
- if (presentation === "dialog") return <OpsDialog title={dialogTitle} subtitle={[t.ticket_no, t.title].filter(Boolean).join(" · ")}
|
|
|
|
|
- className="work-order-action-dialog" onClose={onClose}>
|
|
|
|
|
|
|
+ if (dialogView) return <OpsDialog title={dialogTitle} subtitle={[t.ticket_no, t.title].filter(Boolean).join(" · ")}
|
|
|
|
|
+ className={`work-order-action-dialog${dialogSize}`} onClose={onClose}>
|
|
|
{editor}
|
|
{editor}
|
|
|
</OpsDialog>;
|
|
</OpsDialog>;
|
|
|
- return <Sheet title={title} subtitle={subtitle} onClose={onClose} presentation={presentation}>{editor}</Sheet>;
|
|
|
|
|
|
|
+ return <div className="work-order-drawer work-order-drawer--page" aria-label={title}>
|
|
|
|
|
+ <header>
|
|
|
|
|
+ <div><p>{isUpdown ? "清单核对与执行结论" : "执行结论与日期"}</p><h2>{title}</h2></div>
|
|
|
|
|
+ <Button variant="ghost" size="icon" aria-label="关闭" onClick={onClose}><X size={19} /></Button>
|
|
|
|
|
+ </header>
|
|
|
|
|
+ {editor}
|
|
|
|
|
+ </div>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** @deprecated 内部别名:详情页仍用 ActionSheet 名,导出名见 TicketActionSheet。 */
|
|
|
|
|
-const ActionSheet = TicketActionSheet;
|
|
|
|
|
-
|
|
|
|
|
-/** 工单详情(真接口:`/ticket/detail@v1` + 11 动作位)。 */
|
|
|
|
|
|
|
+/** 工单详情(`/ticket/detail@v1`)。 */
|
|
|
export function WorkOrderRecordPage() {
|
|
export function WorkOrderRecordPage() {
|
|
|
const { id } = useParams();
|
|
const { id } = useParams();
|
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
@@ -1114,12 +1144,11 @@ export function WorkOrderRecordPage() {
|
|
|
const clientView = identity?.role === "enterprise" || identity?.role === "sub";
|
|
const clientView = identity?.role === "enterprise" || identity?.role === "sub";
|
|
|
const viewerReadOnly = Boolean(identity && !["admin", "regAdmin", "teamLead", "ops"].includes(identity.role));
|
|
const viewerReadOnly = Boolean(identity && !["admin", "regAdmin", "teamLead", "ops"].includes(identity.role));
|
|
|
const [sheet, setSheet] = useState<string | null>(null);
|
|
const [sheet, setSheet] = useState<string | null>(null);
|
|
|
- /** 抽屉内滚到哪一段(缺口「去处理」带的落点;正常打开抽屉时为 undefined)。 */
|
|
|
|
|
|
|
+ /** 缺口入口打开对话框时的定位目标。 */
|
|
|
const [sheetFocus, setSheetFocus] = useState<GapFocus | undefined>(undefined);
|
|
const [sheetFocus, setSheetFocus] = useState<GapFocus | undefined>(undefined);
|
|
|
const [notice, setNotice] = useState("");
|
|
const [notice, setNotice] = useState("");
|
|
|
- /** 材料登记改为抽屉(原型 v3):常驻表单会把过程材料卡撑到 300px,抽屉里填完即走。 */
|
|
|
|
|
const [materialOpen, setMaterialOpen] = useState(false);
|
|
const [materialOpen, setMaterialOpen] = useState(false);
|
|
|
- /** 右栏参考卡的弹窗栈:客户档案 → 名下订阅 → …,栈顶即当前抽屉内容。 */
|
|
|
|
|
|
|
+ /** 关联资料对话框的浏览栈,栈顶为当前档案。 */
|
|
|
const [refStack, setRefStack] = useState<RefTarget[]>([]);
|
|
const [refStack, setRefStack] = useState<RefTarget[]>([]);
|
|
|
const openRef = (target: RefTarget) => setRefStack((stack) => [...stack, target]);
|
|
const openRef = (target: RefTarget) => setRefStack((stack) => [...stack, target]);
|
|
|
const detail = useTicketDetail(id ?? "", !clientView);
|
|
const detail = useTicketDetail(id ?? "", !clientView);
|
|
@@ -1127,7 +1156,7 @@ export function WorkOrderRecordPage() {
|
|
|
const openSheet = (action: string, focus?: GapFocus) => {
|
|
const openSheet = (action: string, focus?: GapFocus) => {
|
|
|
setSheetFocus(focus);
|
|
setSheetFocus(focus);
|
|
|
if (action === "backfill") {
|
|
if (action === "backfill") {
|
|
|
- // 缓存里已有草稿/正式回填:先开抽屉(表单能直接灌),后台再 soft-reload。
|
|
|
|
|
|
|
+ // 缓存已有回填时立即打开表单,并在后台刷新。
|
|
|
// 否则等 reload 完成再开,避免用「暂存前的空详情」初始化后怎么刷都不回填。
|
|
// 否则等 reload 完成再开,避免用「暂存前的空详情」初始化后怎么刷都不回填。
|
|
|
const cached = detail.data;
|
|
const cached = detail.data;
|
|
|
if (cached?.backfill_draft || cached?.backfill?.backfill_id) {
|
|
if (cached?.backfill_draft || cached?.backfill?.backfill_id) {
|
|
@@ -1164,7 +1193,7 @@ export function WorkOrderRecordPage() {
|
|
|
* `?act=` 深链(台账/交付页的行内主操作直接落到处置表单)。
|
|
* `?act=` 深链(台账/交付页的行内主操作直接落到处置表单)。
|
|
|
*
|
|
*
|
|
|
* 只在**详情已加载**且该动作在服务端 `actions` 内时打开;打开后立刻用 replace 摘掉参数,
|
|
* 只在**详情已加载**且该动作在服务端 `actions` 内时打开;打开后立刻用 replace 摘掉参数,
|
|
|
- * 用户关掉抽屉不会因地址栏残留而反复弹开。⛔ 自动提交:深链只负责「把抽屉摆到面前」。
|
|
|
|
|
|
|
+ * 消费深链参数后移除它,深链只打开对话框。
|
|
|
*/
|
|
*/
|
|
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
|
const actParam = searchParams.get("act");
|
|
const actParam = searchParams.get("act");
|
|
@@ -1183,16 +1212,11 @@ export function WorkOrderRecordPage() {
|
|
|
setSearchParams(next, { replace: true, state: location.state });
|
|
setSearchParams(next, { replace: true, state: location.state });
|
|
|
}, [d, actParam, searchParams, setSearchParams, location.state]);
|
|
}, [d, actParam, searchParams, setSearchParams, location.state]);
|
|
|
|
|
|
|
|
- async function quick(action: "generate_completion" | "confirm_receipt" | "defer_open_stop" | "defer_ticket") {
|
|
|
|
|
|
|
+ async function generateCompletion() {
|
|
|
if (!d) return;
|
|
if (!d) return;
|
|
|
setNotice("");
|
|
setNotice("");
|
|
|
- const ok = await submit.run(async () => {
|
|
|
|
|
- if (action === "generate_completion") await completionGenerate({ ticket_id: d.ticket.ticket_id });
|
|
|
|
|
- else if (action === "defer_open_stop") await ticketDefer({ ticket_id: d.ticket.ticket_id, defer_scope: "open_stop" });
|
|
|
|
|
- else if (action === "defer_ticket") await ticketDefer({ ticket_id: d.ticket.ticket_id, defer_scope: "ticket" });
|
|
|
|
|
- else await completionReceipt({ ticket_id: d.ticket.ticket_id, completion_no: d.completion?.completion_no ?? undefined });
|
|
|
|
|
- });
|
|
|
|
|
- if (ok) { setNotice(action === "generate_completion" ? "竣工已回传,等待回执确认。" : action === "confirm_receipt" ? "运营商已回执,工单闭环。" : "已延期。"); detail.reload(); }
|
|
|
|
|
|
|
+ const ok = await submit.run(() => completionGenerate({ ticket_id: d.ticket.ticket_id }));
|
|
|
|
|
+ if (ok) { setNotice("竣工已回传,等待回执确认。"); detail.reload(); }
|
|
|
else setNotice(submitErrorText(submit.errorRef.current, "操作失败"));
|
|
else setNotice(submitErrorText(submit.errorRef.current, "操作失败"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1294,7 +1318,7 @@ export function WorkOrderRecordPage() {
|
|
|
* → 生成竣工 → 回执确认。⛔ 前端再叠状态判断:可用性只读服务端 `actions`。
|
|
* → 生成竣工 → 回执确认。⛔ 前端再叠状态判断:可用性只读服务端 `actions`。
|
|
|
* 原「当前可执行」面板保留为全部动作清单(含转交、延期、作废等旁路)。
|
|
* 原「当前可执行」面板保留为全部动作清单(含转交、延期、作废等旁路)。
|
|
|
*/
|
|
*/
|
|
|
- const nextStep: { action: string; label: string; quick?: boolean } | null =
|
|
|
|
|
|
|
+ const nextStep: { action: string; label: string } | null =
|
|
|
can.assign ? { action: "assign", label: "分派工单" } :
|
|
can.assign ? { action: "assign", label: "分派工单" } :
|
|
|
can.check_and_backfill ? { action: "backfill", label: "核对并回填" } :
|
|
can.check_and_backfill ? { action: "backfill", label: "核对并回填" } :
|
|
|
can.backfill ? { action: "backfill", label: "施工回填" } :
|
|
can.backfill ? { action: "backfill", label: "施工回填" } :
|
|
@@ -1304,11 +1328,11 @@ export function WorkOrderRecordPage() {
|
|
|
* 驳回态服务端只开重推(`actions.backfill` 在 `rejected` 恒 false),按钮就该叫「同号覆盖重推」:
|
|
* 驳回态服务端只开重推(`actions.backfill` 在 `rejected` 恒 false),按钮就该叫「同号覆盖重推」:
|
|
|
* 同一个动作位在驳回态是**重推**,在正常态才是**首次生成**,⛔ 让运维在驳回页看到「生成竣工」。
|
|
* 同一个动作位在驳回态是**重推**,在正常态才是**首次生成**,⛔ 让运维在驳回页看到「生成竣工」。
|
|
|
*/
|
|
*/
|
|
|
- can.generate_completion ? { action: "generate_completion", label: t.status === "rejected" ? "同号覆盖重推" : "生成竣工", quick: true } :
|
|
|
|
|
- can.confirm_receipt ? { action: "confirm_receipt", label: "回执确认", quick: true } : null;
|
|
|
|
|
|
|
+ can.generate_completion ? { action: "generate_completion", label: t.status === "rejected" ? "同号覆盖重推" : "生成竣工" } :
|
|
|
|
|
+ can.confirm_receipt ? { action: "confirm_receipt", label: "回执确认" } : null;
|
|
|
/**
|
|
/**
|
|
|
* 执行锁(2026-11-17):开通类工单的计划执行日=订阅**服务开始日**,未到该日服务端
|
|
* 执行锁(2026-11-17):开通类工单的计划执行日=订阅**服务开始日**,未到该日服务端
|
|
|
- * `actions.backfill`/`check_done` 恒 false ⇒ 这里只给提示、不给深链(⛔ 开一个点不动的抽屉)。
|
|
|
|
|
|
|
+ * `actions.backfill`/`check_done` 关闭时,在详情显示计划执行日提示。
|
|
|
* 判定全用服务端下发的 `execution_locked`,⛔ 前端按浏览器日期自行推断。
|
|
* 判定全用服务端下发的 `execution_locked`,⛔ 前端按浏览器日期自行推断。
|
|
|
*/
|
|
*/
|
|
|
const execLocked = !!t.execution_locked;
|
|
const execLocked = !!t.execution_locked;
|
|
@@ -1340,7 +1364,7 @@ export function WorkOrderRecordPage() {
|
|
|
can.confirm_receipt ? "运营商已回执,确认后本单闭环。" : "按服务端可执行动作推进。";
|
|
can.confirm_receipt ? "运营商已回执,确认后本单闭环。" : "按服务端可执行动作推进。";
|
|
|
const runNextStep = () => {
|
|
const runNextStep = () => {
|
|
|
if (!nextStep) return;
|
|
if (!nextStep) return;
|
|
|
- if (nextStep.quick) void quick(nextStep.action as "generate_completion" | "confirm_receipt");
|
|
|
|
|
|
|
+ if (nextStep.action === "generate_completion") void generateCompletion();
|
|
|
else openSheet(nextStep.action);
|
|
else openSheet(nextStep.action);
|
|
|
};
|
|
};
|
|
|
/** 最近一次驳回(流水按 `reject_seq` 升序,取末尾=最新)。 */
|
|
/** 最近一次驳回(流水按 `reject_seq` 升序,取末尾=最新)。 */
|
|
@@ -1369,7 +1393,7 @@ export function WorkOrderRecordPage() {
|
|
|
{can.backfill
|
|
{can.backfill
|
|
|
? <Button onClick={() => openSheet("backfill", "conclusion")}><RefreshCcw size={16} />改回填后同号重推</Button>
|
|
? <Button onClick={() => openSheet("backfill", "conclusion")}><RefreshCcw size={16} />改回填后同号重推</Button>
|
|
|
: can.generate_completion
|
|
: can.generate_completion
|
|
|
- ? <Button onClick={() => void quick("generate_completion")}><RefreshCcw size={16} />同号覆盖重推</Button>
|
|
|
|
|
|
|
+ ? <Button onClick={() => void generateCompletion()}><RefreshCcw size={16} />同号覆盖重推</Button>
|
|
|
: null}
|
|
: null}
|
|
|
</div>);
|
|
</div>);
|
|
|
/**
|
|
/**
|
|
@@ -1549,7 +1573,7 @@ export function WorkOrderRecordPage() {
|
|
|
{/* 等待回执:出口是回执确认;权限不足时说明谁可执行——⛔ 给一个点了会被服务端拒的按钮。 */}
|
|
{/* 等待回执:出口是回执确认;权限不足时说明谁可执行——⛔ 给一个点了会被服务端拒的按钮。 */}
|
|
|
{d.completion && !d.completion.receipt_at && t.status !== "rejected" && (viewerReadOnly || !can.confirm_receipt
|
|
{d.completion && !d.completion.receipt_at && t.status !== "rejected" && (viewerReadOnly || !can.confirm_receipt
|
|
|
? <p className="work-order-seg-foot"><ShieldAlert size={15} />回执确认仅总运营与该团队主账号可执行。</p>
|
|
? <p className="work-order-seg-foot"><ShieldAlert size={15} />回执确认仅总运营与该团队主账号可执行。</p>
|
|
|
- : <div className="work-order-seg-actions"><Button onClick={() => void quick("confirm_receipt")}><Check size={15} />回执确认闭环</Button></div>)}
|
|
|
|
|
|
|
+ : <div className="work-order-seg-actions"><Button onClick={() => openSheet("confirm_receipt")}><Check size={15} />回执确认闭环</Button></div>)}
|
|
|
{/* 驳回历史(工单§5.5.3):⚠️ 只读运维视角——客户门户对驳回原因⛔ 展示(门户口径=
|
|
{/* 驳回历史(工单§5.5.3):⚠️ 只读运维视角——客户门户对驳回原因⛔ 展示(门户口径=
|
|
|
"待补充资料后重新提交"),且出参本身就没有 `external_reject_no` 这一列。 */}
|
|
"待补充资料后重新提交"),且出参本身就没有 `external_reject_no` 这一列。 */}
|
|
|
{!clientView && !!d.completion_rejects?.length && <>
|
|
{!clientView && !!d.completion_rejects?.length && <>
|
|
@@ -1633,11 +1657,11 @@ export function WorkOrderRecordPage() {
|
|
|
</div>
|
|
</div>
|
|
|
{/* 窄屏(≤900px)底部固定条:主按钮与返回不随正文滚走。桌面隐藏,见 CSS。 */}
|
|
{/* 窄屏(≤900px)底部固定条:主按钮与返回不随正文滚走。桌面隐藏,见 CSS。 */}
|
|
|
{nextStep && !viewerReadOnly && <div className="work-order-sticky-bar"><Button variant="outline" onClick={goBack}><ArrowLeft size={16} />返回</Button><Button className="work-order-sticky-next" onClick={runNextStep}><ArrowRight size={16} />{nextStep.label}</Button></div>}
|
|
{nextStep && !viewerReadOnly && <div className="work-order-sticky-bar"><Button variant="outline" onClick={goBack}><ArrowLeft size={16} />返回</Button><Button className="work-order-sticky-next" onClick={runNextStep}><ArrowRight size={16} />{nextStep.label}</Button></div>}
|
|
|
- {materialOpen && <Sheet title="补充过程材料" subtitle="现场照片、处理截图等过程留痕" onClose={() => setMaterialOpen(false)}><MaterialForm ticketId={t.ticket_id} onDone={(m) => { setMaterialOpen(false); setNotice(m); detail.reload(); }} /></Sheet>}
|
|
|
|
|
- {sheet && <ActionSheet action={sheet} detail={d} focus={sheetFocus}
|
|
|
|
|
- presentation={sheet === "backfill" ? "dialog" : "drawer"}
|
|
|
|
|
|
|
+ {materialOpen && <MaterialDialog ticketId={t.ticket_id} ticketNo={t.ticket_no} onClose={() => setMaterialOpen(false)}
|
|
|
|
|
+ onDone={(message) => { setMaterialOpen(false); setNotice(message); detail.reload(); }} />}
|
|
|
|
|
+ {sheet && <TicketActionSheet key={sheet} action={sheet} detail={d} focus={sheetFocus}
|
|
|
onReload={detail.reload} onClose={() => { setSheet(null); setSheetFocus(undefined); if (sheet === "backfill") detail.reload(); }} onDone={(message) => { setSheet(null); setSheetFocus(undefined); setNotice(message); detail.reload(); }} />}
|
|
onReload={detail.reload} onClose={() => { setSheet(null); setSheetFocus(undefined); if (sheet === "backfill") detail.reload(); }} onDone={(message) => { setSheet(null); setSheetFocus(undefined); setNotice(message); detail.reload(); }} />}
|
|
|
- {refStack.length > 0 && <ReferenceDrawer stack={refStack} onPush={openRef} onBack={() => setRefStack((stack) => stack.slice(0, -1))} onClose={() => setRefStack([])} />}
|
|
|
|
|
|
|
+ {refStack.length > 0 && <ReferenceDrawer presentation="dialog" stack={refStack} onPush={openRef} onBack={() => setRefStack((stack) => stack.slice(0, -1))} onClose={() => setRefStack([])} />}
|
|
|
</section>;
|
|
</section>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1651,14 +1675,18 @@ export function WorkOrderRecordPage() {
|
|
|
* 键由服务端派生(工单§5.8.1 的封闭前缀集),浏览器只负责把文件直传到那把键上,
|
|
* 键由服务端派生(工单§5.8.1 的封闭前缀集),浏览器只负责把文件直传到那把键上,
|
|
|
* ⛔ 自造键、⛔ 伪造上传成功。
|
|
* ⛔ 自造键、⛔ 伪造上传成功。
|
|
|
*/
|
|
*/
|
|
|
-function MaterialForm({ ticketId, onDone }: { ticketId: string; onDone: (m: string) => void }) {
|
|
|
|
|
|
|
+function MaterialDialog({ ticketId, ticketNo, onClose, onDone }: {
|
|
|
|
|
+ ticketId: string; ticketNo?: string | null; onClose: () => void; onDone: (message: string) => void;
|
|
|
|
|
+}) {
|
|
|
const submit = useSubmit();
|
|
const submit = useSubmit();
|
|
|
|
|
+ const filePicker = useRef<HTMLInputElement>(null);
|
|
|
const [file, setFile] = useState<File | null>(null);
|
|
const [file, setFile] = useState<File | null>(null);
|
|
|
const [fileName, setFileName] = useState("");
|
|
const [fileName, setFileName] = useState("");
|
|
|
const [tip, setTip] = useState("");
|
|
const [tip, setTip] = useState("");
|
|
|
|
|
|
|
|
async function upload(e: FormEvent<HTMLFormElement>) {
|
|
async function upload(e: FormEvent<HTMLFormElement>) {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
|
|
+ if (submit.busy) return;
|
|
|
setTip("");
|
|
setTip("");
|
|
|
const name = (fileName.trim() || file?.name || "").trim();
|
|
const name = (fileName.trim() || file?.name || "").trim();
|
|
|
if (!file) { setTip("请选择要上传的文件。"); return; }
|
|
if (!file) { setTip("请选择要上传的文件。"); return; }
|
|
@@ -1678,18 +1706,42 @@ function MaterialForm({ ticketId, onDone }: { ticketId: string; onDone: (m: stri
|
|
|
});
|
|
});
|
|
|
onDone("过程材料已上传并登记。");
|
|
onDone("过程材料已上传并登记。");
|
|
|
});
|
|
});
|
|
|
- if (!ok) setTip(submit.error?.message ?? "上传失败");
|
|
|
|
|
|
|
+ if (!ok) setTip(submitErrorText(submit.errorRef.current, "上传失败"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return <form className="work-order-process-form" onSubmit={upload}>
|
|
|
|
|
- <div className="work-order-form-grid">
|
|
|
|
|
- <label>文件<input type="file" onChange={(e) => { const f = e.target.files?.[0] ?? null; setFile(f); if (f) setFileName(f.name); }} /></label>
|
|
|
|
|
- <label>展示文件名<Input maxLength={200} value={fileName} onChange={(e) => setFileName(e.target.value)} placeholder="默认取所选文件名" /></label>
|
|
|
|
|
- </div>
|
|
|
|
|
- {tip && <p className="work-order-form-error" role="alert">{tip}</p>}
|
|
|
|
|
- <div className="work-order-inbox-actions">
|
|
|
|
|
- <Button size="sm" type="submit" disabled={submit.busy}><Link2 size={15} />上传并登记</Button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <p className="work-order-detail-footnote"><Info size={15} />回填凭证与竣工 PDF 由回填/竣工动作自动生成,无需在此上传;单件上限与格式随平台桶策略。</p>
|
|
|
|
|
- </form>;
|
|
|
|
|
|
|
+ return <OpsDialog title="补充过程材料" subtitle={ticketNo || ticketId} className="work-order-action-dialog" onClose={onClose}>
|
|
|
|
|
+ <form className="work-order-editor" onSubmit={upload}>
|
|
|
|
|
+ <div className="work-order-action-body work-order-material-body">
|
|
|
|
|
+ <div className="work-order-material-picker">
|
|
|
|
|
+ <span className="work-order-material-icon"><FileUp size={20} aria-hidden="true" /></span>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <strong>{file?.name ?? "选择过程文件"}</strong>
|
|
|
|
|
+ <p>{file ? "文件已选,可在下方调整展示名称。" : "支持现场照片、处理截图及其他过程文件。"}</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <Button variant="ghost" size="sm" className="org-button org-button-compact org-button-scope"
|
|
|
|
|
+ disabled={submit.busy} onClick={() => filePicker.current?.click()}>
|
|
|
|
|
+ {file ? "更换文件" : "选择文件"}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <input ref={filePicker} type="file" hidden disabled={submit.busy} onChange={(e) => {
|
|
|
|
|
+ const selected = e.target.files?.[0];
|
|
|
|
|
+ e.target.value = "";
|
|
|
|
|
+ if (!selected) return;
|
|
|
|
|
+ setFile(selected);
|
|
|
|
|
+ setFileName(selected.name.slice(0, 200));
|
|
|
|
|
+ setTip("");
|
|
|
|
|
+ }} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <FieldLabel label="展示文件名">
|
|
|
|
|
+ <Input maxLength={200} value={fileName} onChange={(e) => setFileName(e.target.value)} placeholder="默认使用所选文件名" />
|
|
|
|
|
+ </FieldLabel>
|
|
|
|
|
+ {tip && <p className="work-order-form-error work-order-action-error" role="alert">{tip}</p>}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <footer>
|
|
|
|
|
+ <Button variant="outline" onClick={onClose}>取消</Button>
|
|
|
|
|
+ <Button type="submit" disabled={!file || submit.busy}>
|
|
|
|
|
+ <FileUp size={15} aria-hidden="true" />{submit.busy ? "正在上传…" : "上传并登记"}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </footer>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ </OpsDialog>;
|
|
|
}
|
|
}
|