|
|
@@ -1,7 +1,8 @@
|
|
|
import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
|
|
|
import { ArrowLeft, Lock, Plus, Trash2, Upload, X } from "lucide-react";
|
|
|
import { FetchError } from "../components/fetchError";
|
|
|
-import { useLocation, useNavigate, useParams, useSearchParams } from "react-router";
|
|
|
+import { Link, useLocation, useNavigate, useParams, useSearchParams } from "react-router";
|
|
|
+import { RecordRequiredProgress } from "../components/RecordRequiredProgress";
|
|
|
import { Button } from "../components/ui/button";
|
|
|
import { Input } from "../components/ui/input";
|
|
|
import { TreeSelect } from "../components/ui/tree-select";
|
|
|
@@ -1029,7 +1030,7 @@ export function ContractEditorPage() {
|
|
|
const missing = items.filter((item) => !item.filled).map((item) => item.label);
|
|
|
const total = items.length;
|
|
|
const done = total - missing.length;
|
|
|
- return { done, total, pct: total ? Math.round((done / total) * 100) : 100, missing };
|
|
|
+ return { done, total, missing };
|
|
|
}, [customerId, customerTerm, draft.agent, draft.agentPhone, draft.amount, draft.contractType, draft.items, draft.serviceMonths, draft.signDate, draft.start, editing, inline.businessName, inline.businessPhone, inline.financeName, inline.financePhone, inline.idNo, inline.operatorId, inline.regionId, inline.teamId, inline.techName, inline.techPhone, renewFrom]);
|
|
|
|
|
|
async function save() {
|
|
|
@@ -1277,6 +1278,7 @@ export function ContractEditorPage() {
|
|
|
</section>;
|
|
|
}
|
|
|
|
|
|
+ const backToLedger = <Link to="/contracts" className="ops-back-link"><ArrowLeft size={16} />返回合同台账</Link>;
|
|
|
return <section className="ops-page ops-record-page contract-editor record-editor-fields">
|
|
|
<header className="ops-page-head">
|
|
|
<div>
|
|
|
@@ -1284,13 +1286,11 @@ export function ContractEditorPage() {
|
|
|
<h1>{editing ? "编辑合同" : "合同签订表单"}</h1>
|
|
|
<p>{editing ? `合同 ${no}` : "采集客户、商务、订购额度与合规信息,用于生成合同快照、资源额度和后续工单的授权依据。"}</p>
|
|
|
</div>
|
|
|
- <div className="ops-head-actions">
|
|
|
- <Button variant="outline" size="sm" onClick={() => navigate("/contracts")}><ArrowLeft size={15} />返回合同台账</Button>
|
|
|
- </div>
|
|
|
+ {backToLedger}
|
|
|
</header>
|
|
|
{record.loading && <div className="ops-record-layout"><section className="ops-record-card ops-record-card-full"><h2>合同资料</h2><p className="contract-form-summary">正在从合同接口读取…</p></section></div>}
|
|
|
- {record.error && <div className="ops-record-layout"><section className="ops-record-card ops-record-card-full"><h2>合同资料</h2><p className="ops-form-error" role="alert">{record.error.message}</p><div className="ops-form-actions"><Button variant="outline" size="sm" onClick={() => navigate("/contracts")}>返回合同台账</Button></div></section></div>}
|
|
|
- {!record.loading && !record.error && editing && !record.data && <div className="ops-record-layout"><section className="ops-record-card ops-record-card-full"><h2>合同资料</h2><p className="contract-form-summary">未找到合同 {no},可能已被删除。请从合同台账重新进入,或返回台账检索。</p><div className="ops-form-actions"><Button variant="outline" size="sm" onClick={() => navigate("/contracts")}>返回合同台账</Button></div></section></div>}
|
|
|
+ {record.error && <div className="ops-record-layout"><section className="ops-record-card ops-record-card-full"><h2>合同资料</h2><p className="ops-form-error" role="alert">{record.error.message}</p><div className="ops-form-actions">{backToLedger}</div></section></div>}
|
|
|
+ {!record.loading && !record.error && editing && !record.data && <div className="ops-record-layout"><section className="ops-record-card ops-record-card-full"><h2>合同资料</h2><p className="contract-form-summary">未找到合同 {no},可能已被删除。请从合同台账重新进入,或返回台账检索。</p><div className="ops-form-actions">{backToLedger}</div></section></div>}
|
|
|
{(!editing || record.data) && <div className="ops-record-layout">
|
|
|
<div className="ops-record-stack">
|
|
|
<section className="ops-record-card">
|
|
|
@@ -1801,19 +1801,13 @@ export function ContractEditorPage() {
|
|
|
</div>
|
|
|
</section>
|
|
|
|
|
|
- <section className="ops-record-card">
|
|
|
- <h2>必填完成度</h2>
|
|
|
- <div className="contract-progress" role="progressbar" aria-valuemin={0} aria-valuemax={100} aria-valuenow={requiredProgress.pct} aria-label="必填完成度"><i style={{ width: `${requiredProgress.pct}%` }} /></div>
|
|
|
- <div className="ops-contract-summary contract-side-kv">
|
|
|
- <div><span>已填 / 必填</span><strong>{requiredProgress.done} / {requiredProgress.total}</strong></div>
|
|
|
- </div>
|
|
|
- </section>
|
|
|
+ <RecordRequiredProgress done={requiredProgress.done} total={requiredProgress.total} />
|
|
|
|
|
|
{/* 动作区(2026-11-19):不再列「提交后系统生成」说明,只留提交与取消。 */}
|
|
|
<section className="ops-record-card">
|
|
|
{error && <p className="ops-form-error" role="alert">{error}</p>}
|
|
|
<div className="ops-form-actions">
|
|
|
- <Button size="sm" disabled={submitting || replacementBusy || (editing && record.loading)} onClick={save}>{submitting ? "正在提交…" : replacementBusy ? "正在比对替换候选…" : editing ? "保存修改" : "校验并提交"}</Button>
|
|
|
+ <Button size="sm" disabled={submitting || replacementBusy || (editing && record.loading)} onClick={save}>{submitting ? "正在提交…" : replacementBusy ? "正在比对替换候选…" : editing ? "保存修改" : "检查并签订"}</Button>
|
|
|
<Button size="sm" variant="outline" onClick={() => navigate(-1)}>取消</Button>
|
|
|
</div>
|
|
|
</section>
|