|
@@ -1,4 +1,4 @@
|
|
|
-import { useEffect, useMemo, useRef, useState, type KeyboardEvent } from "react";
|
|
|
|
|
|
|
+import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
|
|
|
import { ArrowLeft, Lock, Plus, Trash2, Upload, X } from "lucide-react";
|
|
import { ArrowLeft, Lock, Plus, Trash2, Upload, X } from "lucide-react";
|
|
|
import { FetchError } from "../components/fetchError";
|
|
import { FetchError } from "../components/fetchError";
|
|
|
import { useNavigate, useParams, useSearchParams } from "react-router";
|
|
import { useNavigate, useParams, useSearchParams } from "react-router";
|
|
@@ -8,20 +8,19 @@ import { TreeSelect } from "../components/ui/tree-select";
|
|
|
import { FieldHint } from "../components/ui/field-hint";
|
|
import { FieldHint } from "../components/ui/field-hint";
|
|
|
import { CustomerTeamSelect } from "../components/CustomerTeamSelect";
|
|
import { CustomerTeamSelect } from "../components/CustomerTeamSelect";
|
|
|
import { contractRawByParam } from "../lib/contract-demo";
|
|
import { contractRawByParam } from "../lib/contract-demo";
|
|
|
-import { contractAttachmentDiscard, contractCreate, contractCustomerLookup, contractGet, contractGetList, contractUpdate, customerGet, orderGetList, rowsOf, subscriptionReplacementCandidates } from "../lib/api/bos";
|
|
|
|
|
|
|
+import { contractCreate, contractCustomerLookup, contractGet, contractGetList, contractUpdate, customerGet, orderGetList, rowsOf, subscriptionReplacementCandidates } from "../lib/api/bos";
|
|
|
import { ApiError } from "../lib/api/http";
|
|
import { ApiError } from "../lib/api/http";
|
|
|
-import { OPTIONS, label, PAY_CYCLE, PLAN_FAMILY } from "../lib/api/labels";
|
|
|
|
|
|
|
+import { label, PLAN_FAMILY } from "../lib/api/labels";
|
|
|
import { WORD_UNCONFIGURED } from "../lib/api/lockedCopy";
|
|
import { WORD_UNCONFIGURED } from "../lib/api/lockedCopy";
|
|
|
import { Tri } from "../components/triState";
|
|
import { Tri } from "../components/triState";
|
|
|
import { useCatalogPlans, useIpBandwidthTiers, useLineExits } from "../lib/package-catalog";
|
|
import { useCatalogPlans, useIpBandwidthTiers, useLineExits } from "../lib/package-catalog";
|
|
|
-import { centsToYuanText, LINE_EXIT_MAX } from "../domain/contract-items";
|
|
|
|
|
|
|
+import { CONTRACT_REQUIRED_FIELDS, centsToYuanText, LINE_EXIT_MAX, yuanTextToCents } from "../domain/contract-items";
|
|
|
import type { ContractMissing, ContractRequiredKey } from "../domain/contract-items";
|
|
import type { ContractMissing, ContractRequiredKey } from "../domain/contract-items";
|
|
|
-import { REQUIRED_KEY_BY_DRAFT, buildContractWrite, businessToday, childExitOptions, contractEndFromCycle, draftFromRow, emptyDraft, emptyItem, itemSubtreeKeys, itemTree, renewalPrefill, resolveReplacementSelection, type ContractDraft as Draft, type ItemDraft } from "../domain/contract-draft";
|
|
|
|
|
|
|
+import { CONTRACT_TYPES, REQUIRED_KEY_BY_DRAFT, SERVICE_MONTH_PRESETS, buildContractWrite, businessToday, childExitOptions, contractEndFromMonths, draftFromRow, emptyDraft, emptyItem, itemSubtreeKeys, itemTree, renewalPrefill, resolveReplacementSelection, type ContractDraft as Draft, type ItemDraft } from "../domain/contract-draft";
|
|
|
import { regionTreeNodes } from "../lib/region-tree";
|
|
import { regionTreeNodes } from "../lib/region-tree";
|
|
|
import { useOrganizationData } from "../lib/organization-demo";
|
|
import { useOrganizationData } from "../lib/organization-demo";
|
|
|
import type { ContractCreateResult, ContractReplacementResult, ReplacementCandidate, ReplacementSkipped } from "../lib/api/types";
|
|
import type { ContractCreateResult, ContractReplacementResult, ReplacementCandidate, ReplacementSkipped } from "../lib/api/types";
|
|
|
import { uploadContractAttachment, uploadCustomerLicense, type UploadedObject } from "../lib/api/oss-upload";
|
|
import { uploadContractAttachment, uploadCustomerLicense, type UploadedObject } from "../lib/api/oss-upload";
|
|
|
-import { contractAttachmentLabel } from "../lib/contract-attachments";
|
|
|
|
|
import { useLoad } from "../lib/useLoad";
|
|
import { useLoad } from "../lib/useLoad";
|
|
|
import { useDemoIdentity } from "../lib/demo-session";
|
|
import { useDemoIdentity } from "../lib/demo-session";
|
|
|
import { PackagePlanEditor, type EditorState } from "../components/PackagePlanEditor";
|
|
import { PackagePlanEditor, type EditorState } from "../components/PackagePlanEditor";
|
|
@@ -39,6 +38,10 @@ type ReplacementProbe = { loading: boolean; error: string; candidates: Replaceme
|
|
|
|
|
|
|
|
const CUSTOMER_LOOKUP_DEBOUNCE_MS = 300;
|
|
const CUSTOMER_LOOKUP_DEBOUNCE_MS = 300;
|
|
|
|
|
|
|
|
|
|
+/** 拖进来的确实是文件(⛔ 文本/选区/页内元素),拖曳上传区只对文件亮起并接管落点。 */
|
|
|
|
|
+const hasFiles = (transfer: DataTransfer | null): boolean =>
|
|
|
|
|
+ Boolean(transfer && Array.from(transfer.types ?? []).includes("Files"));
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 续签源下拉的选项文案(合同号 · 期间 · 金额)。深链续签(`?renew=`)也要用同一句,
|
|
* 续签源下拉的选项文案(合同号 · 期间 · 金额)。深链续签(`?renew=`)也要用同一句,
|
|
|
* 否则列表没回这份合同时下拉会空着、看不出带了哪一份。
|
|
* 否则列表没回这份合同时下拉会空着、看不出带了哪一份。
|
|
@@ -95,6 +98,29 @@ function emptyInlineCustomer() {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 区域门禁(业主 2026-11-19):「所属区域」未选时,运营商/合伙人/运营团队/运维团队一律只读。
|
|
|
|
|
+ * 原生 `disabled` 控件**不派发点击事件也不冒泡**,点上去毫无反馈 ⇒ 外面包一层接管点击、就地弹提示;
|
|
|
|
|
+ * 门禁生效时子节点 `pointer-events:none`(样式里),点击必落在包装层上。
|
|
|
|
|
+ */
|
|
|
|
|
+function RegionGate({ gated, children }: { gated: boolean; children: ReactNode }) {
|
|
|
|
|
+ const [tip, setTip] = useState(false);
|
|
|
|
|
+ const timer = useRef<number | undefined>(undefined);
|
|
|
|
|
+ useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
|
|
|
+ if (!gated) return <>{children}</>;
|
|
|
|
|
+ const openTip = () => {
|
|
|
|
|
+ setTip(true);
|
|
|
|
|
+ window.clearTimeout(timer.current);
|
|
|
|
|
+ timer.current = window.setTimeout(() => setTip(false), 3000);
|
|
|
|
|
+ };
|
|
|
|
|
+ return (
|
|
|
|
|
+ <span className="contract-region-gate" onClick={openTip}>
|
|
|
|
|
+ {children}
|
|
|
|
|
+ {tip && <span className="contract-region-gate-tip" role="status">请先选取所属区域</span>}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export function ContractEditorPage() {
|
|
export function ContractEditorPage() {
|
|
|
const { no } = useParams();
|
|
const { no } = useParams();
|
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
@@ -107,10 +133,11 @@ export function ContractEditorPage() {
|
|
|
const exitCatalog = useLineExits();
|
|
const exitCatalog = useLineExits();
|
|
|
const record = useLoad(() => contractRawByParam(no), [no]);
|
|
const record = useLoad(() => contractRawByParam(no), [no]);
|
|
|
/**
|
|
/**
|
|
|
- * 新建态草稿:**交接日期默认录入当日**(2026-11-17 定案;`Asia/Shanghai` 业务日,
|
|
|
|
|
- * 编辑态恒以库里的值为准,⛔ 拿今天覆盖已记录的历史交接单)。
|
|
|
|
|
|
|
+ * 新建态草稿:**签署日期默认录入当日**(2026-11-17 定案;`Asia/Shanghai` 业务日,
|
|
|
|
|
+ * 编辑态恒以库里的值为准,⛔ 拿今天覆盖已记录的历史签署日)。
|
|
|
|
|
+ * 2026-11-19 起「交接日期」并入签署日期:表单只留一个日期框,写口仍按 `agent_handover_on` 送。
|
|
|
*/
|
|
*/
|
|
|
- const [draft, setDraft] = useState<Draft>(() => ({ ...emptyDraft(), handoverOn: businessToday() }));
|
|
|
|
|
|
|
+ const [draft, setDraft] = useState<Draft>(() => ({ ...emptyDraft(), signDate: businessToday() }));
|
|
|
const [customerId, setCustomerId] = useState<string | null>(null);
|
|
const [customerId, setCustomerId] = useState<string | null>(null);
|
|
|
/**
|
|
/**
|
|
|
* P1(D-9)增量合同的「既有链路」候选:本客户 `active` ∧ 未到期 ∧ `plan_family='link'` 的订阅
|
|
* P1(D-9)增量合同的「既有链路」候选:本客户 `active` ∧ 未到期 ∧ `plan_family='link'` 的订阅
|
|
@@ -290,6 +317,8 @@ export function ContractEditorPage() {
|
|
|
setRenewFrom(contractId);
|
|
setRenewFrom(contractId);
|
|
|
setRenewError("");
|
|
setRenewError("");
|
|
|
setRenewSourceLabel("");
|
|
setRenewSourceLabel("");
|
|
|
|
|
+ /** 选/清续签来源即同步合同类型(续签 ⇄ 新建),⛔ 让类型与来源各说一套。 */
|
|
|
|
|
+ setDraft((current) => (current.increment ? current : { ...current, contractType: contractId ? "renew" : "new" }));
|
|
|
if (!contractId) return;
|
|
if (!contractId) return;
|
|
|
setRenewLoading(true);
|
|
setRenewLoading(true);
|
|
|
try {
|
|
try {
|
|
@@ -303,8 +332,8 @@ export function ContractEditorPage() {
|
|
|
setRenewSourceLabel(renewalOptionLabel(row));
|
|
setRenewSourceLabel(renewalOptionLabel(row));
|
|
|
setDraft((current) => {
|
|
setDraft((current) => {
|
|
|
const next = { ...current, ...prefill };
|
|
const next = { ...current, ...prefill };
|
|
|
- /** 账期被带出后结束日跟着重算(结束日恒由生效日+付款周期推算)。 */
|
|
|
|
|
- next.end = contractEndFromCycle(next.start, next.payCycle);
|
|
|
|
|
|
|
+ /** 服务期被带出后结束日跟着重算(结束日恒由生效日+服务期(月)推算)。 */
|
|
|
|
|
+ next.end = contractEndFromMonths(next.start, next.serviceMonths);
|
|
|
return next;
|
|
return next;
|
|
|
});
|
|
});
|
|
|
/** 续签=按新订阅开通:清掉可能残留的替换选择与探测结果。 */
|
|
/** 续签=按新订阅开通:清掉可能残留的替换选择与探测结果。 */
|
|
@@ -348,7 +377,7 @@ export function ContractEditorPage() {
|
|
|
setRenewSourceLabel(renewalOptionLabel(row));
|
|
setRenewSourceLabel(renewalOptionLabel(row));
|
|
|
setDraft((current) => {
|
|
setDraft((current) => {
|
|
|
const next = { ...current, ...prefill };
|
|
const next = { ...current, ...prefill };
|
|
|
- next.end = contractEndFromCycle(next.start, next.payCycle);
|
|
|
|
|
|
|
+ next.end = contractEndFromMonths(next.start, next.serviceMonths);
|
|
|
return next;
|
|
return next;
|
|
|
});
|
|
});
|
|
|
setReplacementProbes({});
|
|
setReplacementProbes({});
|
|
@@ -364,53 +393,16 @@ export function ContractEditorPage() {
|
|
|
// `navigate`/setters 都是稳定引用,只在带进来的合同号变化时重跑。
|
|
// `navigate`/setters 都是稳定引用,只在带进来的合同号变化时重跑。
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
}, [renewParam]);
|
|
}, [renewParam]);
|
|
|
- /**
|
|
|
|
|
- * 合同附件(单份,2026-11-16 定案):选中即直传平台对象存储,成功后只把**对象键**挂进
|
|
|
|
|
- * `draft.attachmentUrl`(字面量须与后端 `CONTRACT_ATTACHMENT_KEY_PREFIX` 同前缀)。
|
|
|
|
|
- * ⛔ 字节流/上传凭证经本服务;查看地址由详情读口现签,⛔ 前端缓存签名。
|
|
|
|
|
- */
|
|
|
|
|
- const attachmentInput = useRef<HTMLInputElement | null>(null);
|
|
|
|
|
- const [attachmentBusy, setAttachmentBusy] = useState(false);
|
|
|
|
|
- const [attachmentError, setAttachmentError] = useState("");
|
|
|
|
|
- /** 本次刚上传的原始文件名(键里不含文件名 ⇒ 刷新后按后缀显示「合同附件.<ext>」)。 */
|
|
|
|
|
- const [attachmentName, setAttachmentName] = useState("");
|
|
|
|
|
- /**
|
|
|
|
|
- * 本页**刚上传、还没被任何合同引用**的对象键(孤儿回收清单)。
|
|
|
|
|
- *
|
|
|
|
|
- * 平台只有「即时删除」一条通道(`object/delete@v1`,见 unified-oss §6.6.10:不做后台遍历删对象),
|
|
|
|
|
- * 所以「换了/移除了/取消了」的那一刻必须由本页把没人要的那一份退回去([`discardPendingAttachments`])。
|
|
|
|
|
- * 服务端还会再查一次引用面(仍被合同引用就拒删)⇒ 这里可以放宽心调,⛔ 当成前端独占真相。
|
|
|
|
|
- */
|
|
|
|
|
- const pendingAttachmentKeys = useRef<string[]>([]);
|
|
|
|
|
|
|
+ /** 右栏上次落库的附件(只用于保存时原样回传,页面不再提供上传入口:附件在详情页维护)。 */
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (record.data) setDraft(draftFromRow(record.data));
|
|
if (record.data) setDraft(draftFromRow(record.data));
|
|
|
}, [record.data]);
|
|
}, [record.data]);
|
|
|
/**
|
|
/**
|
|
|
- * 把清单里的对象键交给服务端回收(best-effort):失败⛔ 拦用户、⛔ 回滚草稿——
|
|
|
|
|
- * 用户的动作(换文件/移除/取消)已经完成,回收只是桶侧的清尾。
|
|
|
|
|
- */
|
|
|
|
|
- const discardPendingAttachments = (keys?: string[]) => {
|
|
|
|
|
- const targets = keys ?? pendingAttachmentKeys.current;
|
|
|
|
|
- if (!targets.length) return;
|
|
|
|
|
- pendingAttachmentKeys.current = pendingAttachmentKeys.current.filter(
|
|
|
|
|
- (key) => !targets.includes(key),
|
|
|
|
|
- );
|
|
|
|
|
- for (const objectKey of targets) {
|
|
|
|
|
- void contractAttachmentDiscard({ object_key: objectKey }).catch(() => {});
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- /** 离开本页(返回/取消)时把没落库的上传一起退掉:`useRef` 读的是最新清单,⛔ 闭包快照。 */
|
|
|
|
|
- useEffect(() => () => discardPendingAttachments(), []);
|
|
|
|
|
- /**
|
|
|
|
|
- * 新建态的「运营商经办人」姓名默认取当前登录身份(与姓名同一来源、可改,⛔ 写死号码);
|
|
|
|
|
- * `auth/context@v1` 实测只回 7 个键、不含手机号 ⇒ 取不到就留空由必填校验拦下,⛔ 造号。
|
|
|
|
|
- * ⚠️ 这一组是**交接单上的运营商侧联系人**,不是「录入账号」(`created_by`,服务端另写、恒只读);
|
|
|
|
|
- * 建后它随档案轴(未开通且 72h 内或未到期)仍可改,与「交接日期」同一命运。
|
|
|
|
|
|
|
+ * 「运营商经办人」**恒由人工填写**(2026-11-19 定案):它是**交接单上的运营商侧联系人**,
|
|
|
|
|
+ * 与「录入账号」(`created_by`,服务端从鉴权上下文写入、页面恒只读)是两个不同的人
|
|
|
|
|
+ * ⇒ ⛔ 拿当前登录身份的姓名/手机号预填,否则一线会把自家账号当成运营商对接人提交。
|
|
|
|
|
+ * 必填校验照旧拦(姓名+联系电话成对),留空即报 `60004` 原话。
|
|
|
*/
|
|
*/
|
|
|
- useEffect(() => {
|
|
|
|
|
- if (editing || !identity) return;
|
|
|
|
|
- setDraft((current) => ({ ...current, agent: current.agent || identity.name, agentPhone: current.agentPhone || identity.phone || "" }));
|
|
|
|
|
- }, [editing, identity]);
|
|
|
|
|
/**
|
|
/**
|
|
|
* 客户检索=**输入防抖**(300ms 内的连击只打一次 `contract/customer_lookup@v1`)
|
|
* 客户检索=**输入防抖**(300ms 内的连击只打一次 `contract/customer_lookup@v1`)
|
|
|
* + **沿用上一次结果**:防抖窗口里⛔ 把候选清空——否则每敲一个字下拉就消失再出现,列表整体抖一下。
|
|
* + **沿用上一次结果**:防抖窗口里⛔ 把候选清空——否则每敲一个字下拉就消失再出现,列表整体抖一下。
|
|
@@ -486,15 +478,30 @@ export function ContractEditorPage() {
|
|
|
* 企业营业执照影像**选填**(业主 2026-11-19 定案,⛔ 强制登记),建档后到客户档案「登记材料」格补传。
|
|
* 企业营业执照影像**选填**(业主 2026-11-19 定案,⛔ 强制登记),建档后到客户档案「登记材料」格补传。
|
|
|
*/
|
|
*/
|
|
|
const org = useOrganizationData(["regions", "operators", "partners", "operationsTeams", "maintenanceTeams"]);
|
|
const org = useOrganizationData(["regions", "operators", "partners", "operationsTeams", "maintenanceTeams"]);
|
|
|
- /** 区域树:保留「全网」为层级上下文但不能选中(业主 2026-11-19 定案)。 */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 区域树:「全网」是平台虚根,**整层不进下拉**(业主 2026-11-19 定案,替代原「保留但置灰」)——
|
|
|
|
|
+ * 直接以省一级为根,选起来少一层展开。把它从建树集合里摘掉即可:省节点的父级不在可见集合内,
|
|
|
|
|
+ * `regionTreeNodes` 会按根渲染(与「授权子树只回省」同一口径,⛔ 另写一套 re-root 逻辑)。
|
|
|
|
|
+ */
|
|
|
const regionTree = useMemo(() => {
|
|
const regionTree = useMemo(() => {
|
|
|
const blocked = new Set(org.regions.filter((item) => item.name.trim() === "全网" || (item.pathName ?? "").trim() === "全网").map((item) => item.id));
|
|
const blocked = new Set(org.regions.filter((item) => item.name.trim() === "全网" || (item.pathName ?? "").trim() === "全网").map((item) => item.id));
|
|
|
- return regionTreeNodes(org.regions, org.regions.filter((item) => !blocked.has(item.id)).map((item) => item.id));
|
|
|
|
|
|
|
+ const visible = org.regions.filter((item) => !blocked.has(item.id));
|
|
|
|
|
+ return regionTreeNodes(visible, visible.map((item) => item.id));
|
|
|
}, [org.regions]);
|
|
}, [org.regions]);
|
|
|
const [inline, setInline] = useState(emptyInlineCustomer);
|
|
const [inline, setInline] = useState(emptyInlineCustomer);
|
|
|
const [licenseObj, setLicenseObj] = useState<UploadedObject | null>(null);
|
|
const [licenseObj, setLicenseObj] = useState<UploadedObject | null>(null);
|
|
|
const [licenseBusy, setLicenseBusy] = useState(false);
|
|
const [licenseBusy, setLicenseBusy] = useState(false);
|
|
|
const [licenseError, setLicenseError] = useState("");
|
|
const [licenseError, setLicenseError] = useState("");
|
|
|
|
|
+ /** 拖曳悬停态(只用于整块上传区的视觉反馈;离开/落下即复位)。 */
|
|
|
|
|
+ const [licenseDragging, setLicenseDragging] = useState(false);
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 合同附件(业主 2026-11-19):与营业执照影像同一套整块拖曳卡片,放在 02 合同基本信息最下面。
|
|
|
|
|
+ * 附件是**单值**(`contract.attachment_url`)⇒ 只存对象键;`file_name` 仅用于回显。
|
|
|
|
|
+ */
|
|
|
|
|
+ const [attachmentObj, setAttachmentObj] = useState<UploadedObject | null>(null);
|
|
|
|
|
+ const [attachmentBusy, setAttachmentBusy] = useState(false);
|
|
|
|
|
+ const [attachmentError, setAttachmentError] = useState("");
|
|
|
|
|
+ const [attachmentDragging, setAttachmentDragging] = useState(false);
|
|
|
/** 内联建档成功后的回执(客户号/主账号/激活码口径);合同已生成,下一步是去合同详情。 */
|
|
/** 内联建档成功后的回执(客户号/主账号/激活码口径);合同已生成,下一步是去合同详情。 */
|
|
|
const [created, setCreated] = useState<{ contractId: string; customer: NonNullable<ContractCreateResult["inline_customer"]>; replacements: ContractReplacementResult[] } | null>(null);
|
|
const [created, setCreated] = useState<{ contractId: string; customer: NonNullable<ContractCreateResult["inline_customer"]>; replacements: ContractReplacementResult[] } | null>(null);
|
|
|
const setInlineField = <K extends keyof typeof inline>(key: K, value: (typeof inline)[K]) => {
|
|
const setInlineField = <K extends keyof typeof inline>(key: K, value: (typeof inline)[K]) => {
|
|
@@ -657,12 +664,12 @@ export function ContractEditorPage() {
|
|
|
setDraft((current) => {
|
|
setDraft((current) => {
|
|
|
const next = { ...current, [key]: value };
|
|
const next = { ...current, [key]: value };
|
|
|
/**
|
|
/**
|
|
|
- * 合同结束日=生效日+付款周期推算(2026-11-17 定案,**锁定手填**):
|
|
|
|
|
|
|
+ * 合同结束日=生效日+服务期(月)推算(2026-11-19 定案,**锁定手填**):
|
|
|
* 两个输入项任一变化即重算,⛔ 只改其一留下一个与期间对不上的旧结束日。
|
|
* 两个输入项任一变化即重算,⛔ 只改其一留下一个与期间对不上的旧结束日。
|
|
|
* 任一为空 ⇒ 结束日一并清空,由页面提示先补齐两项。
|
|
* 任一为空 ⇒ 结束日一并清空,由页面提示先补齐两项。
|
|
|
*/
|
|
*/
|
|
|
- if (key === "start" || key === "payCycle") {
|
|
|
|
|
- next.end = contractEndFromCycle(next.start, next.payCycle);
|
|
|
|
|
|
|
+ if (key === "start" || key === "serviceMonths") {
|
|
|
|
|
+ next.end = contractEndFromMonths(next.start, next.serviceMonths);
|
|
|
}
|
|
}
|
|
|
return next;
|
|
return next;
|
|
|
});
|
|
});
|
|
@@ -720,13 +727,41 @@ export function ContractEditorPage() {
|
|
|
});
|
|
});
|
|
|
setError("");
|
|
setError("");
|
|
|
};
|
|
};
|
|
|
- /** 切换录入模式会清空服务构成:两种模式的根节点不是同一类东西(链路 vs 引用订阅),⛔ 硬转。 */
|
|
|
|
|
- const toggleIncrement = (on: boolean) => {
|
|
|
|
|
- setDraft((current) => (current.items.length && !window.confirm("切换合同类型会清空当前服务构成,继续?")
|
|
|
|
|
- ? current
|
|
|
|
|
- : { ...current, increment: on, items: [] }));
|
|
|
|
|
- setReplacementProbes({});
|
|
|
|
|
- setItemNotice("");
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 合同类型下拉(2026-11-19):类型决定服务构成的录入模式。
|
|
|
|
|
+ * `expand` ⇒ 切到增量模式(引用既有链路、只补附加项);`renew` ⇒ 普通模式且须选续签来源;
|
|
|
|
|
+ * `new`/`change` ⇒ 普通模式。两种模式的根节点不是同一类东西(链路 vs 引用订阅),
|
|
|
|
|
+ * 切换会清空服务构成 ⇒ 先征得确认,用户取消就整次不改。
|
|
|
|
|
+ */
|
|
|
|
|
+ const pickContractType = (value: string) => {
|
|
|
|
|
+ if (editing) return;
|
|
|
|
|
+ /** 模式切换会清空服务构成(根节点不是同一类东西),先征得确认;用户取消就整次不改。 */
|
|
|
|
|
+ const willClear = draft.items.length > 0;
|
|
|
|
|
+ if (value === "expand") {
|
|
|
|
|
+ if (!draft.increment) {
|
|
|
|
|
+ if (willClear && !window.confirm("切换合同类型会清空当前服务构成,继续?")) return;
|
|
|
|
|
+ setDraft((current) => ({ ...current, increment: true, items: [], contractType: "expand" }));
|
|
|
|
|
+ setReplacementProbes({});
|
|
|
|
|
+ setItemNotice("");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setDraft((current) => ({ ...current, contractType: "expand" }));
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (draft.increment) {
|
|
|
|
|
+ if (willClear && !window.confirm("切换合同类型会清空当前服务构成,继续?")) return;
|
|
|
|
|
+ setDraft((current) => ({ ...current, increment: false, items: [], contractType: value }));
|
|
|
|
|
+ setReplacementProbes({});
|
|
|
|
|
+ setItemNotice("");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setDraft((current) => ({ ...current, contractType: value }));
|
|
|
|
|
+ }
|
|
|
|
|
+ /** 续签来源只在「续签」类型下有意义:类型改走后清掉,避免带一份对不上的来源提交。 */
|
|
|
|
|
+ if (value !== "renew" && renewFrom) {
|
|
|
|
|
+ setRenewFrom("");
|
|
|
|
|
+ setRenewSourceLabel("");
|
|
|
|
|
+ }
|
|
|
|
|
+ setError("");
|
|
|
};
|
|
};
|
|
|
const removeItem = (index: number) => setDraft((current) => {
|
|
const removeItem = (index: number) => setDraft((current) => {
|
|
|
const item = current.items[index];
|
|
const item = current.items[index];
|
|
@@ -813,6 +848,100 @@ export function ContractEditorPage() {
|
|
|
return [...new Set([...names, ...legacy])];
|
|
return [...new Set([...names, ...legacy])];
|
|
|
}, [exitCatalog.data, draft.items]);
|
|
}, [exitCatalog.data, draft.items]);
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 右侧「业务口径摘要」(2026-11-19,随原型):订购项/带宽/境外 IP/账号上限/月度费用
|
|
|
|
|
+ * **一律按所选档位×份数实时汇总**,⛔ 手填;目录没配的一律显示「未配置」,⛔ 兜底 0。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 口径来源:带宽=`bandwidth_committed` 为真时的上/下行 Mbps(附加项不占带宽);
|
|
|
|
|
+ * 境外固定 IP=附加项里名称含「IP」的档位份数(D-9:单独境外 IP 按份叠加);
|
|
|
|
|
+ * 账号上限=`sub_account_quota × 份数`;月度费用=`monthly_settle_cents × 份数`。
|
|
|
|
|
+ */
|
|
|
|
|
+ const sideMetrics = useMemo(() => {
|
|
|
|
|
+ const planById = new Map(plans.map((plan) => [plan.plan_id, plan]));
|
|
|
|
|
+ let up = 0;
|
|
|
|
|
+ let down = 0;
|
|
|
|
|
+ let bandwidthKnown = 0;
|
|
|
|
|
+ let bandwidthMissing = 0;
|
|
|
|
|
+ let ip = 0;
|
|
|
|
|
+ let quota = 0;
|
|
|
|
|
+ let quotaKnown = false;
|
|
|
|
|
+ let quotaMissing = false;
|
|
|
|
|
+ let feeCents = 0;
|
|
|
|
|
+ let feeKnown = false;
|
|
|
|
|
+ let feeMissing = false;
|
|
|
|
|
+ for (const item of draft.items) {
|
|
|
|
|
+ const plan = planById.get(item.planId);
|
|
|
|
|
+ const quantity = item.quantity > 0 ? item.quantity : 1;
|
|
|
|
|
+ if (!plan) {
|
|
|
|
|
+ bandwidthMissing += 1;
|
|
|
|
|
+ quotaMissing = true;
|
|
|
|
|
+ feeMissing = true;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (plan.bandwidth_committed) {
|
|
|
|
|
+ if (plan.bandwidth_up_mbps !== null && plan.bandwidth_up_mbps !== undefined && plan.bandwidth_down_mbps !== null && plan.bandwidth_down_mbps !== undefined) {
|
|
|
|
|
+ up += plan.bandwidth_up_mbps * quantity;
|
|
|
|
|
+ down += plan.bandwidth_down_mbps * quantity;
|
|
|
|
|
+ bandwidthKnown += 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bandwidthMissing += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (plan.plan_family === "addon" && /ip/i.test(plan.plan_name)) ip += quantity;
|
|
|
|
|
+ if (plan.sub_account_quota === null || plan.sub_account_quota === undefined) quotaMissing = true;
|
|
|
|
|
+ else {
|
|
|
|
|
+ quota += plan.sub_account_quota * quantity;
|
|
|
|
|
+ quotaKnown = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (plan.monthly_settle_cents === null || plan.monthly_settle_cents === undefined) feeMissing = true;
|
|
|
|
|
+ else {
|
|
|
|
|
+ feeCents += plan.monthly_settle_cents * quantity;
|
|
|
|
|
+ feeKnown = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ const money = (cents: number) => `¥${Number(centsToYuanText(cents)).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
|
|
|
+ return {
|
|
|
|
|
+ items: draft.items.length,
|
|
|
|
|
+ bandwidth: bandwidthKnown === 0
|
|
|
|
|
+ ? (bandwidthMissing ? "未配置" : "—")
|
|
|
|
|
+ : `上行 ${up} / 下行 ${down} Mbps${bandwidthMissing ? `(${bandwidthMissing} 条未配置)` : ""}`,
|
|
|
|
|
+ ip: `${ip} 个`,
|
|
|
|
|
+ quota: quotaKnown ? `${quota} 个${quotaMissing ? "(部分未配置)" : ""}` : "未配置",
|
|
|
|
|
+ fee: feeKnown ? `${money(feeCents)}${feeMissing ? "(部分未配置)" : ""}` : "未配置",
|
|
|
|
|
+ };
|
|
|
|
|
+ }, [draft.items, plans]);
|
|
|
|
|
+
|
|
|
|
|
+ /** 右侧「必填完成度」:客户+6 个写入口径必填(同源 `CONTRACT_REQUIRED_FIELDS`),⛔ 另写一套判据。 */
|
|
|
|
|
+ const requiredProgress = useMemo(() => {
|
|
|
|
|
+ const values: Record<ContractRequiredKey, string> = {
|
|
|
|
|
+ serviceMonths: draft.serviceMonths,
|
|
|
|
|
+ amount: draft.amount,
|
|
|
|
|
+ start: draft.start,
|
|
|
|
|
+ agent: draft.agent,
|
|
|
|
|
+ agentPhone: draft.agentPhone,
|
|
|
|
|
+ signDate: draft.signDate,
|
|
|
|
|
+ };
|
|
|
|
|
+ const missing: string[] = [];
|
|
|
|
|
+ for (const field of CONTRACT_REQUIRED_FIELDS) {
|
|
|
|
|
+ const raw = (values[field.key] ?? "").trim();
|
|
|
|
|
+ let filled = Boolean(raw);
|
|
|
|
|
+ if (filled && field.key === "amount") {
|
|
|
|
|
+ const cents = yuanTextToCents(raw);
|
|
|
|
|
+ filled = cents !== null && cents > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (filled && field.key === "serviceMonths") {
|
|
|
|
|
+ const months = Number(raw);
|
|
|
|
|
+ filled = Number.isInteger(months) && months >= 1 && months <= 600;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!filled) missing.push(field.label);
|
|
|
|
|
+ }
|
|
|
|
|
+ const customerFilled = editing || Boolean(customerId) || customerTerm.trim().length >= 2;
|
|
|
|
|
+ if (!customerFilled) missing.unshift("客户");
|
|
|
|
|
+ const total = CONTRACT_REQUIRED_FIELDS.length + 1;
|
|
|
|
|
+ const done = total - missing.length;
|
|
|
|
|
+ return { done, total, pct: total ? Math.round((done / total) * 100) : 100, missing };
|
|
|
|
|
+ }, [customerId, customerTerm, draft.agent, draft.agentPhone, draft.amount, draft.serviceMonths, draft.signDate, draft.start, editing]);
|
|
|
|
|
+
|
|
|
async function save() {
|
|
async function save() {
|
|
|
if (!identity) { setError("请先登录后再提交合同;写入权限由服务端判定。"); return; }
|
|
if (!identity) { setError("请先登录后再提交合同;写入权限由服务端判定。"); return; }
|
|
|
if (submitting) return;
|
|
if (submitting) return;
|
|
@@ -839,25 +968,32 @@ export function ContractEditorPage() {
|
|
|
const half = pairs.find(([, name, phone]) => Boolean(name.trim()) !== Boolean(phone.trim()));
|
|
const half = pairs.find(([, name, phone]) => Boolean(name.trim()) !== Boolean(phone.trim()));
|
|
|
if (half) { setError(`${half[0]}需同时填写姓名与电话(只填一项会留下残缺的联系人)。`); return; }
|
|
if (half) { setError(`${half[0]}需同时填写姓名与电话(只填一项会留下残缺的联系人)。`); return; }
|
|
|
}
|
|
}
|
|
|
|
|
+ /** 类型与来源必须自洽(2026-11-19):续签必须有旧合同可接,⛔ 只改个标签就提交。 */
|
|
|
|
|
+ if (!editing && draft.contractType === "renew" && !renewFrom) {
|
|
|
|
|
+ setError("合同类型为「续签」:请在 02 合同基本信息里选定「续签自旧合同」,或把类型改为「新建」。");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
const built = buildContractWrite(draft);
|
|
const built = buildContractWrite(draft);
|
|
|
if (!built.ok) {
|
|
if (!built.ok) {
|
|
|
setFieldError(built.fieldError ?? null);
|
|
setFieldError(built.fieldError ?? null);
|
|
|
setError(built.error);
|
|
setError(built.error);
|
|
|
- // 失败⛔ 清空任何已录入内容(合同、条目、替换选择、已上传附件),只把视口带到首个出错条目。
|
|
|
|
|
|
|
+ // 失败⛔ 清空任何已录入内容(合同、条目、替换选择),只把视口带到首个出错条目。
|
|
|
focusFirstErrorItem(built.error);
|
|
focusFirstErrorItem(built.error);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
const w = built.write;
|
|
const w = built.write;
|
|
|
/**
|
|
/**
|
|
|
* 写入口径必填 5 项(2026-11-14 探针实测 `contract/create@v1` 逐字段短路的 `60004`):
|
|
* 写入口径必填 5 项(2026-11-14 探针实测 `contract/create@v1` 逐字段短路的 `60004`):
|
|
|
- * 付款周期(需求 §5.3 第 523 行)→ 合同金额(第 522 行「须大于 0…不保存并红显该字段」)→
|
|
|
|
|
- * 经办人姓名 → 经办人联系电话 → 交接日期;提示语照抄后端原话并红显命中的那个字段,
|
|
|
|
|
|
|
+ * 服务期(月)(需求 §5.3 第 523 行)→ 合同金额(第 522 行「须大于 0…不保存并红显该字段」)→
|
|
|
|
|
+ * 经办人姓名 → 经办人联系电话 → 签署日期;提示语照抄后端原话并红显命中的那个字段,
|
|
|
* `agent_org` 选填(不送也 `10000`)⇒ ⛔ 参与校验。校验同源 `domain/contract-draft`。
|
|
* `agent_org` 选填(不送也 `10000`)⇒ ⛔ 参与校验。校验同源 `domain/contract-draft`。
|
|
|
*/
|
|
*/
|
|
|
const shared = {
|
|
const shared = {
|
|
|
...(w.externalNo ? { external_no: w.externalNo } : {}),
|
|
...(w.externalNo ? { external_no: w.externalNo } : {}),
|
|
|
|
|
+ contract_type: w.contractType,
|
|
|
|
|
+ sign_date: w.signDate,
|
|
|
contract_amount_cents: w.contractAmountCents,
|
|
contract_amount_cents: w.contractAmountCents,
|
|
|
- pay_cycle: w.payCycle,
|
|
|
|
|
|
|
+ service_months: w.serviceMonths,
|
|
|
start_date: w.startDate,
|
|
start_date: w.startDate,
|
|
|
end_date: w.endDate,
|
|
end_date: w.endDate,
|
|
|
agent_name: w.agentName,
|
|
agent_name: w.agentName,
|
|
@@ -865,7 +1001,10 @@ export function ContractEditorPage() {
|
|
|
agent_handover_on: w.agentHandoverOn,
|
|
agent_handover_on: w.agentHandoverOn,
|
|
|
/** `agent_org`=选填:恒送 trim 值(空串=后端 `text_param` 置 `NULL`),⛔ 因缺它而拦人。 */
|
|
/** `agent_org`=选填:恒送 trim 值(空串=后端 `text_param` 置 `NULL`),⛔ 因缺它而拦人。 */
|
|
|
agent_org: w.agentOrg,
|
|
agent_org: w.agentOrg,
|
|
|
- /** 附件单值:空串=清空(后端 `text_param` 置 `NULL`)⇒ ⛔ 省略键,否则「移除附件」永远存不下去。 */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 附件原样回传(2026-11-19 起录入页不再放上传格:新建态为空串,编辑态是读口回带的库值)。
|
|
|
|
|
+ * ⛔ 省略键:存量合同带附件时,省略在新建口等于「没传」,语义不如显式空串清楚。
|
|
|
|
|
+ */
|
|
|
attachment_url: w.attachmentUrl.trim(),
|
|
attachment_url: w.attachmentUrl.trim(),
|
|
|
service_items: w.serviceItems,
|
|
service_items: w.serviceItems,
|
|
|
};
|
|
};
|
|
@@ -882,8 +1021,6 @@ export function ContractEditorPage() {
|
|
|
row_version: version,
|
|
row_version: version,
|
|
|
...shared,
|
|
...shared,
|
|
|
});
|
|
});
|
|
|
- // 落库成功 ⇒ 清单里的对象键已被合同引用(服务端也会拒删),⛔ 别再当孤儿回收。
|
|
|
|
|
- pendingAttachmentKeys.current = [];
|
|
|
|
|
navigate(`/contracts/${encodeURIComponent(row.contract_id)}`);
|
|
navigate(`/contracts/${encodeURIComponent(row.contract_id)}`);
|
|
|
} else {
|
|
} else {
|
|
|
const res = await contractCreate({
|
|
const res = await contractCreate({
|
|
@@ -917,8 +1054,6 @@ export function ContractEditorPage() {
|
|
|
},
|
|
},
|
|
|
}),
|
|
}),
|
|
|
});
|
|
});
|
|
|
- // 合同已生成 ⇒ 附件对象已被引用(服务端也会拒删)⇒ 清空孤儿清单。
|
|
|
|
|
- pendingAttachmentKeys.current = [];
|
|
|
|
|
// 内联建档成功 ⇒ 停在回执页展示客户号与主账号(激活码明文由「导出激活码」取,⛔ 在此伪造)。
|
|
// 内联建档成功 ⇒ 停在回执页展示客户号与主账号(激活码明文由「导出激活码」取,⛔ 在此伪造)。
|
|
|
if (res?.inline_customer) {
|
|
if (res?.inline_customer) {
|
|
|
setCreated({ contractId: res.contract_id, customer: res.inline_customer, replacements: res.replacements ?? [] });
|
|
setCreated({ contractId: res.contract_id, customer: res.inline_customer, replacements: res.replacements ?? [] });
|
|
@@ -931,7 +1066,7 @@ export function ContractEditorPage() {
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
// 写口整批回滚(合同、条目、派生档、IP、截原、新订阅、额度一起)⇒ 页面**保留**已录入内容:
|
|
// 写口整批回滚(合同、条目、派生档、IP、截原、新订阅、额度一起)⇒ 页面**保留**已录入内容:
|
|
|
- // 只显示错误、把视口带到首个出错条目,用户可改后直接重提(已上传附件仍在孤儿清单里,⛔ 回收)。
|
|
|
|
|
|
|
+ // 只显示错误、把视口带到首个出错条目,用户可改后直接重提(⛔ 清空已录内容)。
|
|
|
const message = e instanceof ApiError ? e.message : "保存失败,请稍后重试。";
|
|
const message = e instanceof ApiError ? e.message : "保存失败,请稍后重试。";
|
|
|
setError(message);
|
|
setError(message);
|
|
|
focusFirstErrorItem(message);
|
|
focusFirstErrorItem(message);
|
|
@@ -959,46 +1094,24 @@ export function ContractEditorPage() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 合同附件:选中即直传平台桶(同一两段式通路,前缀换成合同附件),成功才写进草稿;
|
|
|
|
|
- * `attachment_url` 在提交时才随合同落库 ⇒ 上传成功但未保存=库里仍是旧附件。
|
|
|
|
|
- *
|
|
|
|
|
- * 孤儿回收(2026-11-16):上一份若也是**本页刚上传、还没落库**的,换掉的那一刻它就没人引用了
|
|
|
|
|
- * ⇒ 立刻退回服务端(库里那份仍在引用,由写口的 `attachment_object_delete` 回收,⛔ 在这里删)。
|
|
|
|
|
|
|
+ * 合同附件:选中即直传平台对象存储(`klt/contract/attachment/` 前缀),成功后把对象键写进草稿。
|
|
|
|
|
+ * 附件**选填**;已有附件的合同在编辑态先回显库里的键,重传即覆盖(⛔ 追加成多份)。
|
|
|
*/
|
|
*/
|
|
|
async function pickAttachment(file: File | null) {
|
|
async function pickAttachment(file: File | null) {
|
|
|
if (!file) return;
|
|
if (!file) return;
|
|
|
setAttachmentError("");
|
|
setAttachmentError("");
|
|
|
setAttachmentBusy(true);
|
|
setAttachmentBusy(true);
|
|
|
try {
|
|
try {
|
|
|
- const previous = draft.attachmentUrl.trim();
|
|
|
|
|
const uploaded = await uploadContractAttachment(file);
|
|
const uploaded = await uploadContractAttachment(file);
|
|
|
- if (previous && previous !== record.data?.attachment_url) {
|
|
|
|
|
- discardPendingAttachments([previous]);
|
|
|
|
|
- }
|
|
|
|
|
- pendingAttachmentKeys.current = [
|
|
|
|
|
- ...pendingAttachmentKeys.current.filter((key) => key !== previous),
|
|
|
|
|
- uploaded.object_key,
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ setAttachmentObj(uploaded);
|
|
|
set("attachmentUrl", uploaded.object_key);
|
|
set("attachmentUrl", uploaded.object_key);
|
|
|
- setAttachmentName(uploaded.file_name);
|
|
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
- // 失败⛔ 清掉上一份:用户点的是「更换」,换失败时旧附件仍在库里,草稿也保持旧值。
|
|
|
|
|
- setAttachmentError((e as Error)?.message || "合同附件上传失败。");
|
|
|
|
|
|
|
+ setAttachmentError((e as Error)?.message || "附件上传失败。");
|
|
|
} finally {
|
|
} finally {
|
|
|
setAttachmentBusy(false);
|
|
setAttachmentBusy(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** 现签查看地址只在「库里那一条=草稿这一条」时有效(刚换过/未保存的还没签)。 */
|
|
|
|
|
- const attachmentView = useMemo(() => {
|
|
|
|
|
- const current = draft.attachmentUrl.trim();
|
|
|
|
|
- if (!current) return "";
|
|
|
|
|
- const row = record.data;
|
|
|
|
|
- if (row && row.attachment_url === current) return row.attachment_view_url ?? "";
|
|
|
|
|
- return /^https?:\/\//i.test(current) ? current : "";
|
|
|
|
|
- }, [draft.attachmentUrl, record.data]);
|
|
|
|
|
- const attachmentLabelText = attachmentName || contractAttachmentLabel(draft.attachmentUrl);
|
|
|
|
|
-
|
|
|
|
|
if (created) {
|
|
if (created) {
|
|
|
const c = created.customer;
|
|
const c = created.customer;
|
|
|
return <section className="ops-page ops-record-page">
|
|
return <section className="ops-page ops-record-page">
|
|
@@ -1041,9 +1154,9 @@ export function ContractEditorPage() {
|
|
|
return <section className="ops-page ops-record-page contract-editor">
|
|
return <section className="ops-page ops-record-page contract-editor">
|
|
|
<header className="ops-page-head">
|
|
<header className="ops-page-head">
|
|
|
<div>
|
|
<div>
|
|
|
- <p className="ops-eyebrow"><span /> 合同管理 · {editing ? "编辑" : "新增"}</p>
|
|
|
|
|
- <h1>{editing ? "编辑合同" : "新增合同"}</h1>
|
|
|
|
|
- <p>{editing ? `合同 ${no}` : "录入合同与固定套餐式、自定义规格式两类服务构成。"}</p>
|
|
|
|
|
|
|
+ <p className="ops-eyebrow"><span /> 合同管理 · {editing ? "编辑" : "签订"}</p>
|
|
|
|
|
+ <h1>{editing ? "编辑合同" : "合同签订表单"}</h1>
|
|
|
|
|
+ <p>{editing ? `合同 ${no}` : "采集客户、商务、订购额度与合规信息,用于生成合同快照、资源额度和后续工单的授权依据。"}</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="ops-head-actions">
|
|
<div className="ops-head-actions">
|
|
|
<Button variant="outline" size="sm" onClick={() => navigate("/contracts")}><ArrowLeft size={15} />返回合同台账</Button>
|
|
<Button variant="outline" size="sm" onClick={() => navigate("/contracts")}><ArrowLeft size={15} />返回合同台账</Button>
|
|
@@ -1127,14 +1240,17 @@ export function ContractEditorPage() {
|
|
|
*/}
|
|
*/}
|
|
|
{!editing && (
|
|
{!editing && (
|
|
|
<div className="ops-form-grid ops-form-grid--business contract-customer-fields">
|
|
<div className="ops-form-grid ops-form-grid--business contract-customer-fields">
|
|
|
- <label htmlFor="inline-region"><span className="ops-field-title">所属区域 <b title="必填">*</b><FieldHint label="所属区域说明">客户挂载的区域节点;「全网」是平台虚根,不允许选中。选定后才反查运营商、合伙人、运营团队与运维团队。</FieldHint></span>
|
|
|
|
|
|
|
+ <label htmlFor="inline-region"><span className="ops-field-title">所属区域 <b title="必填">*</b><FieldHint label="所属区域说明">客户挂载的区域节点,从省一级开始选(「全网」是平台虚根,不下拉)。选定后才反查运营商、合伙人、运营团队与运维团队。</FieldHint></span>
|
|
|
<TreeSelect treeData={regionTreeShown} value={inline.regionId} onChange={(value) => setInlineField("regionId", value)} ariaLabel="所属区域" placeholder={lockedCustomerFields ? "客户档案未挂载区域" : "请选择区域节点"} name="inline-region" disabled={lockedCustomerFields} />
|
|
<TreeSelect treeData={regionTreeShown} value={inline.regionId} onChange={(value) => setInlineField("regionId", value)} ariaLabel="所属区域" placeholder={lockedCustomerFields ? "客户档案未挂载区域" : "请选择区域节点"} name="inline-region" disabled={lockedCustomerFields} />
|
|
|
</label>
|
|
</label>
|
|
|
- <label htmlFor="inline-operator"><span className="ops-field-title">运营商 <b title="必填">*</b><FieldHint label="运营商说明">{provinceId ? "候选=所挂区域省份下可见的运营商档案;唯一候选自动选中,录入人身份命中时自动选中并只读。" : "先选所属区域:运营商档案须与该区域同省,否则建档会被省份一致性校验拦下。"}</FieldHint></span>
|
|
|
|
|
- <select id="inline-operator" disabled={lockedCustomerFields || Boolean(lockedOperatorId) || !inline.regionId} value={inline.operatorId} onChange={(event) => setInlineField("operatorId", event.target.value)}>
|
|
|
|
|
- <option value="">{inline.regionId ? "请选择运营商" : "请先选择所属区域"}</option>
|
|
|
|
|
- {operatorChoices.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
|
|
|
|
|
- </select>
|
|
|
|
|
|
|
+ <label htmlFor="inline-operator">
|
|
|
|
|
+ <RegionGate gated={!inline.regionId}>
|
|
|
|
|
+ <span className="ops-field-title">运营商 <b title="必填">*</b><FieldHint label="运营商说明">{provinceId ? "候选=所挂区域省份下可见的运营商档案;唯一候选自动选中,录入人身份命中时自动选中并只读。" : "先选所属区域:运营商档案须与该区域同省,否则建档会被省份一致性校验拦下。"}</FieldHint></span>
|
|
|
|
|
+ <select id="inline-operator" disabled={lockedCustomerFields || Boolean(lockedOperatorId) || !inline.regionId} value={inline.operatorId} onChange={(event) => setInlineField("operatorId", event.target.value)}>
|
|
|
|
|
+ <option value="">{inline.regionId ? "请选择运营商" : "请先选取所属区域"}</option>
|
|
|
|
|
+ {operatorChoices.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </RegionGate>
|
|
|
</label>
|
|
</label>
|
|
|
<label htmlFor="inline-address"><span className="ops-field-title">客户地址</span><Input id="inline-address" disabled={lockedCustomerFields} placeholder={lockedCustomerFields ? "客户档案未登记地址" : "客户地址(含楼栋与房间号)"} value={inline.address} onChange={(event) => setInlineField("address", event.target.value)} /></label>
|
|
<label htmlFor="inline-address"><span className="ops-field-title">客户地址</span><Input id="inline-address" disabled={lockedCustomerFields} placeholder={lockedCustomerFields ? "客户档案未登记地址" : "客户地址(含楼栋与房间号)"} value={inline.address} onChange={(event) => setInlineField("address", event.target.value)} /></label>
|
|
|
<div className="contract-contact-field">
|
|
<div className="contract-contact-field">
|
|
@@ -1158,35 +1274,77 @@ export function ContractEditorPage() {
|
|
|
<Input aria-label="财务联系人电话" inputMode="tel" disabled={lockedCustomerFields} placeholder={lockedCustomerFields ? "未登记" : "手机号"} value={inline.financePhone} onChange={(event) => setInlineField("financePhone", event.target.value)} />
|
|
<Input aria-label="财务联系人电话" inputMode="tel" disabled={lockedCustomerFields} placeholder={lockedCustomerFields ? "未登记" : "手机号"} value={inline.financePhone} onChange={(event) => setInlineField("financePhone", event.target.value)} />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <label htmlFor="inline-partner"><span className="ops-field-title">合伙人 <FieldHint label="合伙人说明">候选=负责范围覆盖所挂区域的合伙人;唯一候选自动选中,录入人身份命中时自动选中并只读,多个候选需手选。</FieldHint></span>
|
|
|
|
|
- <select id="inline-partner" disabled={lockedCustomerFields || Boolean(lockedPartnerId) || !inline.regionId} value={inline.partnerId} onChange={(event) => setInlineField("partnerId", event.target.value)}>
|
|
|
|
|
- <option value="">{inline.regionId ? "未匹配合伙人" : "请先选择所属区域"}</option>
|
|
|
|
|
- {partnerChoices.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
|
|
|
|
|
- </select>
|
|
|
|
|
|
|
+ <label htmlFor="inline-partner">
|
|
|
|
|
+ <RegionGate gated={!inline.regionId}>
|
|
|
|
|
+ <span className="ops-field-title">合伙人 <FieldHint label="合伙人说明">候选=负责范围覆盖所挂区域的合伙人;唯一候选自动选中,录入人身份命中时自动选中并只读,多个候选需手选。</FieldHint></span>
|
|
|
|
|
+ <select id="inline-partner" disabled={lockedCustomerFields || Boolean(lockedPartnerId) || !inline.regionId} value={inline.partnerId} onChange={(event) => setInlineField("partnerId", event.target.value)}>
|
|
|
|
|
+ <option value="">{inline.regionId ? "未匹配合伙人" : "请先选取所属区域"}</option>
|
|
|
|
|
+ {partnerChoices.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </RegionGate>
|
|
|
</label>
|
|
</label>
|
|
|
- <label htmlFor="inline-operations-team"><span className="ops-field-title">运营团队 <FieldHint label="运营团队说明">按所挂区域实时反查,仅用于展示、不写入客户档案;唯一候选自动选中,录入人身份命中时自动选中并只读,多个候选需手选。</FieldHint></span>
|
|
|
|
|
- <select id="inline-operations-team" disabled={lockedCustomerFields || Boolean(lockedOperationsTeamId) || !inline.regionId} value={inline.operationsTeamId} onChange={(event) => setInlineField("operationsTeamId", event.target.value)}>
|
|
|
|
|
- <option value="">{!inline.regionId ? "请先选择所属区域" : lockedCustomerFields ? (regionOptions.operationsTeams.length ? "按区域反查有多个候选" : "所挂区域未匹配运营团队") : "未匹配运营团队"}</option>
|
|
|
|
|
- {regionOptions.operationsTeams.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
|
|
|
|
|
- </select>
|
|
|
|
|
|
|
+ <label htmlFor="inline-operations-team">
|
|
|
|
|
+ <RegionGate gated={!inline.regionId}>
|
|
|
|
|
+ <span className="ops-field-title">运营团队 <FieldHint label="运营团队说明">按所挂区域实时反查,仅用于展示、不写入客户档案;唯一候选自动选中,录入人身份命中时自动选中并只读,多个候选需手选。</FieldHint></span>
|
|
|
|
|
+ <select id="inline-operations-team" disabled={lockedCustomerFields || Boolean(lockedOperationsTeamId) || !inline.regionId} value={inline.operationsTeamId} onChange={(event) => setInlineField("operationsTeamId", event.target.value)}>
|
|
|
|
|
+ <option value="">{!inline.regionId ? "请先选取所属区域" : lockedCustomerFields ? (regionOptions.operationsTeams.length ? "按区域反查有多个候选" : "所挂区域未匹配运营团队") : "未匹配运营团队"}</option>
|
|
|
|
|
+ {regionOptions.operationsTeams.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </RegionGate>
|
|
|
</label>
|
|
</label>
|
|
|
- <div className="customer-team-field"><span className="ops-field-title">运维团队 <b title="必填">*</b><FieldHint label="运维团队说明">单支定案:一个客户同一时刻恰好挂 1 支运维团队;候选=负责范围覆盖所挂区域的团队,唯一候选自动选中,录入人身份命中时自动选中并只读。</FieldHint></span>
|
|
|
|
|
- <CustomerTeamSelect disabled={lockedCustomerFields || Boolean(lockedTeamId) || !inline.regionId} options={teamChoices.map((item) => ({ id: item.id, name: item.name, hint: (org.maintenanceTeams.find((team) => team.id === item.id)?.ticketTypes ?? []).join("、") }))} value={inline.teamId} onChange={(id) => setInlineField("teamId", id)} />
|
|
|
|
|
|
|
+ <div className="customer-team-field">
|
|
|
|
|
+ <RegionGate gated={!inline.regionId}>
|
|
|
|
|
+ <span className="ops-field-title">运维团队 <b title="必填">*</b><FieldHint label="运维团队说明">单支定案:一个客户同一时刻恰好挂 1 支运维团队;候选=负责范围覆盖所挂区域的团队,唯一候选自动选中,录入人身份命中时自动选中并只读。</FieldHint></span>
|
|
|
|
|
+ <CustomerTeamSelect disabled={lockedCustomerFields || Boolean(lockedTeamId) || !inline.regionId} options={teamChoices.map((item) => ({ id: item.id, name: item.name, hint: (org.maintenanceTeams.find((team) => team.id === item.id)?.ticketTypes ?? []).join("、") }))} value={inline.teamId} onChange={(id) => setInlineField("teamId", id)} />
|
|
|
|
|
+ </RegionGate>
|
|
|
</div>
|
|
</div>
|
|
|
<label htmlFor="inline-remark" className="ops-form-span-full"><span className="ops-field-title">客户备注 <small>选填</small><FieldHint label="客户备注说明">多行文本,≤512 字;随客户建档写入客户档案的备注列。命中已有客户时显示档案里的备注(只读)。</FieldHint></span>
|
|
<label htmlFor="inline-remark" className="ops-form-span-full"><span className="ops-field-title">客户备注 <small>选填</small><FieldHint label="客户备注说明">多行文本,≤512 字;随客户建档写入客户档案的备注列。命中已有客户时显示档案里的备注(只读)。</FieldHint></span>
|
|
|
<textarea id="inline-remark" rows={3} maxLength={512} disabled={lockedCustomerFields} placeholder={lockedCustomerFields ? "客户档案未登记备注" : "补充说明(≤512 字)"} value={inline.remark} onChange={(event) => setInlineField("remark", event.target.value)} />
|
|
<textarea id="inline-remark" rows={3} maxLength={512} disabled={lockedCustomerFields} placeholder={lockedCustomerFields ? "客户档案未登记备注" : "补充说明(≤512 字)"} value={inline.remark} onChange={(event) => setInlineField("remark", event.target.value)} />
|
|
|
</label>
|
|
</label>
|
|
|
{inline.subject === "enterprise" ? (
|
|
{inline.subject === "enterprise" ? (
|
|
|
- <div className="ops-form-span-2 customer-document-picker">
|
|
|
|
|
- <div><strong>营业执照影像(选填)</strong>
|
|
|
|
|
- <label className="customer-upload-button" title="选择后立即直传平台对象存储(字节流不经过本系统)">
|
|
|
|
|
- <Upload size={15} />{licenseBusy ? "正在上传…" : licenseObj ? "重新选择" : "选择文件"}
|
|
|
|
|
- <input aria-label="上传营业执照影像" type="file" disabled={licenseBusy || submitting || lockedCustomerFields} onChange={(event) => { const file = event.target.files?.[0] ?? null; event.target.value = ""; void pickLicense(file); }} />
|
|
|
|
|
- </label>
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 营业执照影像(2026-11-19 定案):整块拖曳上传区,点击任意位置同样可选文件。
|
|
|
|
|
+ * 文件输入铺满整块(透明覆盖层)⇒ 点哪儿都能选;「移除」按钮抬到覆盖层之上才点得到。
|
|
|
|
|
+ * 拖曳高亮只认「拖进来的确实是文件」——拖文字/选区进框会被浏览器当成 drop,
|
|
|
|
|
+ * 不加判据会让整块闪一下又把 URL 写进地址栏。
|
|
|
|
|
+ */
|
|
|
|
|
+ <>
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={`ops-form-span-full contract-license-drop${licenseDragging ? " is-dragging" : ""}${lockedCustomerFields ? " is-locked" : ""}`}
|
|
|
|
|
+ onDragEnter={(event) => { if (!hasFiles(event.dataTransfer)) return; event.preventDefault(); if (!licenseBusy && !submitting && !lockedCustomerFields) setLicenseDragging(true); }}
|
|
|
|
|
+ onDragOver={(event) => { if (!hasFiles(event.dataTransfer)) return; event.preventDefault(); event.dataTransfer.dropEffect = licenseBusy || submitting || lockedCustomerFields ? "none" : "copy"; }}
|
|
|
|
|
+ onDragLeave={(event) => { if (event.currentTarget.contains(event.relatedTarget as Node | null)) return; setLicenseDragging(false); }}
|
|
|
|
|
+ onDrop={(event) => {
|
|
|
|
|
+ event.preventDefault();
|
|
|
|
|
+ setLicenseDragging(false);
|
|
|
|
|
+ if (licenseBusy || submitting || lockedCustomerFields) return;
|
|
|
|
|
+ const file = event.dataTransfer.files?.[0] ?? null;
|
|
|
|
|
+ if (file) void pickLicense(file);
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <span className="contract-license-drop-body">
|
|
|
|
|
+ <Upload size={22} />
|
|
|
|
|
+ <strong>营业执照影像(选填)</strong>
|
|
|
|
|
+ <span>{licenseObj
|
|
|
|
|
+ ? `已上传:${licenseObj.file_name}`
|
|
|
|
|
+ : licenseBusy
|
|
|
|
|
+ ? "正在上传…"
|
|
|
|
|
+ : lockedCustomerFields
|
|
|
|
|
+ ? archivedLicenseText
|
|
|
|
|
+ : "拖曳图片到此处,或点击选择文件"}</span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ {licenseObj && !lockedCustomerFields && <Button type="button" variant="ghost" size="sm" className="contract-license-drop-remove" disabled={licenseBusy || submitting} onClick={() => { setLicenseObj(null); setLicenseError(""); }}><X size={15} />移除</Button>}
|
|
|
|
|
+ <input
|
|
|
|
|
+ className="contract-license-drop-input"
|
|
|
|
|
+ aria-label="上传营业执照影像"
|
|
|
|
|
+ type="file"
|
|
|
|
|
+ accept="image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp,.pdf"
|
|
|
|
|
+ disabled={licenseBusy || submitting || lockedCustomerFields}
|
|
|
|
|
+ onChange={(event) => { const file = event.target.files?.[0] ?? null; event.target.value = ""; void pickLicense(file); }}
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
- <p>{licenseObj ? `已上传:${licenseObj.file_name}` : lockedCustomerFields ? archivedLicenseText : "留空=建档后到客户档案「登记材料」格补传;营业执照影像选填。"}</p>
|
|
|
|
|
- {licenseError && <small className="customer-field-error">{licenseError}</small>}
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ {licenseError && <small className="ops-form-span-full customer-field-error">{licenseError}</small>}
|
|
|
|
|
+ </>
|
|
|
) : null}
|
|
) : null}
|
|
|
{/* 客户主账号只在建档时录入:命中已有客户时它已经存在,⛔ 显示成「沿用已有客户档案」的空输入框。 */}
|
|
{/* 客户主账号只在建档时录入:命中已有客户时它已经存在,⛔ 显示成「沿用已有客户档案」的空输入框。 */}
|
|
|
{!lockedCustomerFields && <>
|
|
{!lockedCustomerFields && <>
|
|
@@ -1200,10 +1358,10 @@ export function ContractEditorPage() {
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
<section className="ops-record-card">
|
|
<section className="ops-record-card">
|
|
|
- <div className="customer-form-section-title"><span>02</span><div><h2>合同基本要素</h2><p>必填。金额与付款周期确定期间,结束日由生效日自动推算、不可手改。</p></div></div>
|
|
|
|
|
|
|
+ <div className="customer-form-section-title"><span>02</span><div><h2>合同基本信息</h2><p>商务归档口径,用于对账、到期提醒与版本追溯</p></div></div>
|
|
|
{!editing && customerId && (
|
|
{!editing && customerId && (
|
|
|
<div className="contract-renew-block">
|
|
<div className="contract-renew-block">
|
|
|
- <label htmlFor="renew-from"><span className="ops-field-title">续签自旧合同 <small>可选</small><FieldHint label="续签自旧合同说明">选中即带出旧合同的合同金额、付款周期、服务条目与运营商经办人三件套,并把<b>合同生效日自动推为旧合同结束日的次日</b>(该日已早于今天时取今天,结束日再按付款周期推算);合同编号/外部单号/附件/交接日期仍按本合同填写(交接日期默认录入当日)。续签按「新订阅开通」落库:不截原、不挂替换边、不出第七类工单;<b>服务条目与旧合同逐条一致(形式/档位/份数/席位/带宽/出口,价格不算)时视为无需施工,不出开通工单</b>,新订阅按续签开始日记为已交付。</FieldHint></span>
|
|
|
|
|
|
|
+ <label htmlFor="renew-from"><span className="ops-field-title">续签自旧合同 <small>可选</small><FieldHint label="续签自旧合同说明">选中即带出旧合同的合同金额、服务期(月)、服务条目与运营商经办人三件套,并把<b>合同生效日自动推为旧合同结束日的次日</b>(该日已早于今天时取今天,结束日再按服务期(月)推算);合同编号/外部单号/附件/签署日期仍按本合同填写(签署日期默认录入当日)。续签按「新订阅开通」落库:不截原、不挂替换边、不出第七类工单;<b>服务条目与旧合同逐条一致(形式/档位/份数/席位/带宽/出口,价格不算)时视为无需施工,不出开通工单</b>,新订阅按续签开始日记为已交付。</FieldHint></span>
|
|
|
<select id="renew-from" value={renewFrom} disabled={renewLoading || submitting} onChange={(event) => void pickRenewal(event.target.value)}>
|
|
<select id="renew-from" value={renewFrom} disabled={renewLoading || submitting} onChange={(event) => void pickRenewal(event.target.value)}>
|
|
|
<option value="">不续签(手工录入)</option>
|
|
<option value="">不续签(手工录入)</option>
|
|
|
{/* 深链续签源若不在客户合同列表里(已归档等),补一个同文案的选项,⛔ 让下拉空着。 */}
|
|
{/* 深链续签源若不在客户合同列表里(已归档等),补一个同文案的选项,⛔ 让下拉空着。 */}
|
|
@@ -1220,36 +1378,91 @@ export function ContractEditorPage() {
|
|
|
<div className="ops-form-grid ops-form-grid--business">
|
|
<div className="ops-form-grid ops-form-grid--business">
|
|
|
<label htmlFor="contract-no"><span className="ops-field-title">合同编号 <small>{editing ? "服务端生成" : "可选"}</small></span><Input id="contract-no" placeholder={editing ? "" : "不填由服务端生成"} value={draft.contractNo} disabled={editing} onChange={(event) => set("contractNo", event.target.value)} /></label>
|
|
<label htmlFor="contract-no"><span className="ops-field-title">合同编号 <small>{editing ? "服务端生成" : "可选"}</small></span><Input id="contract-no" placeholder={editing ? "" : "不填由服务端生成"} value={draft.contractNo} disabled={editing} onChange={(event) => set("contractNo", event.target.value)} /></label>
|
|
|
<label htmlFor="external-no"><span className="ops-field-title">外部单号</span><Input id="external-no" placeholder="外部单号" value={draft.externalNo} onChange={(event) => set("externalNo", event.target.value)} /></label>
|
|
<label htmlFor="external-no"><span className="ops-field-title">外部单号</span><Input id="external-no" placeholder="外部单号" value={draft.externalNo} onChange={(event) => set("externalNo", event.target.value)} /></label>
|
|
|
- <label htmlFor="contract-amount"><span className="ops-field-title">合同金额(元) <b title="必填">*</b></span><Input id="contract-amount" inputMode="decimal" placeholder="0.00" aria-invalid={invalidOf("amount")} value={draft.amount} onChange={(event) => set("amount", event.target.value)} />{requiredErrorOf("amount")}</label>
|
|
|
|
|
- <label htmlFor="pay-cycle"><span className="ops-field-title">付款周期 <b title="必填">*</b></span><select id="pay-cycle" aria-invalid={invalidOf("payCycle")} value={draft.payCycle} onChange={(event) => set("payCycle", event.target.value)}><option value="">未配置</option>{OPTIONS.pay_cycle.map((item) => <option key={item.value} value={item.value}>{item.label}</option>)}</select>{requiredErrorOf("payCycle")}</label>
|
|
|
|
|
- <label htmlFor="start-date"><span className="ops-field-title">合同生效日 <b title="必填">*</b></span><Input id="start-date" type="date" aria-invalid={invalidOf("start")} value={draft.start} onChange={(event) => set("start", event.target.value)} />{requiredErrorOf("start")}</label>
|
|
|
|
|
- <label htmlFor="end-date"><span className="ops-field-title">合同结束日 <small>自动推算</small><FieldHint label="合同结束日说明">{draft.start && draft.payCycle ? <>=生效日+付款周期(年付 12/季付 3/月付 1 个月)再减一天,该月无对应日先取月末;<b>不可手改</b>,改生效日或付款周期即自动重算。</> : <>先填「合同生效日」与「付款周期」,结束日自动算出,<b>不可手改</b>。</>}</FieldHint></span><Input id="end-date" type="date" value={draft.end} readOnly aria-readonly="true" className="cursor-not-allowed bg-muted/40" /></label>
|
|
|
|
|
- {/* 运营商经办人=交接单口径的三段,独占一行(机构/姓名/联系方式),⛔ 与上面六个商务格混排。 */}
|
|
|
|
|
- <div className="ops-form-span-full contract-agent-block">
|
|
|
|
|
- <span className="ops-field-title">运营商经办人</span>
|
|
|
|
|
- <div className="ops-form-grid contract-agent-grid">
|
|
|
|
|
- <label htmlFor="agent-org"><span className="ops-field-title">机构 <small>选填</small><FieldHint label="经办人机构说明">选填,不填也可提交;清空后保存即清除已记录的机构。</FieldHint></span><Input id="agent-org" placeholder="经办人所属机构" value={draft.agentOrg} onChange={(event) => set("agentOrg", event.target.value)} /></label>
|
|
|
|
|
- <label htmlFor="agent-name"><span className="ops-field-title">姓名 <b title="必填">*</b></span><Input id="agent-name" aria-invalid={invalidOf("agent")} value={draft.agent} onChange={(event) => set("agent", event.target.value)} />{requiredErrorOf("agent")}</label>
|
|
|
|
|
- <label htmlFor="agent-phone"><span className="ops-field-title">联系方式 <b title="必填">*</b><FieldHint label="经办人联系方式说明">必填。当前登录身份未提供手机号时留空,请手工录入经办人实际联系电话。</FieldHint></span><Input id="agent-phone" inputMode="numeric" aria-invalid={invalidOf("agentPhone")} value={draft.agentPhone} onChange={(event) => set("agentPhone", event.target.value)} />{requiredErrorOf("agentPhone")}</label>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <label htmlFor="contract-type"><span className="ops-field-title">合同类型 <b title="必填">*</b><FieldHint label="合同类型说明">新建=新签(可新开链路);续签=接在本客户某份旧合同之后,须选「续签自旧合同」;扩容补充协议=在既有链路上只叠加附加项(服务构成整批为增量条目);变更协议=可含逐条替换的变更。类型决定 03 服务构成的录入模式,建后不改。</FieldHint></span>
|
|
|
|
|
+ <select id="contract-type" value={draft.contractType} disabled={editing} onChange={(event) => pickContractType(event.target.value)}>
|
|
|
|
|
+ {CONTRACT_TYPES.map((item) => <option key={item.value} value={item.value}>{item.label}</option>)}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </label>
|
|
|
|
|
+
|
|
|
{/*
|
|
{/*
|
|
|
- * 录入经办人=界面录入账号,服务端从鉴权上下文写入(⛔ 入参、建后恒只读):
|
|
|
|
|
- * 机构取账号绑定团队(运营/运维团队名,`hq` 回落「总运营」)、姓名取账号显示名、联系方式取绑定手机号(出参已掩码)。
|
|
|
|
|
- * 新建态只在提交后才拿得到机构,故此处不给可编辑控件,⛔ 让前端「代填」一个值造成与后端不一致。
|
|
|
|
|
- * 独占一行(`ops-form-span-full`),⛔ 与运营商经办人挤在同一行。
|
|
|
|
|
|
|
+ * 运营商经办人=姓名+联系电话(2026-11-19 三列排布):两项必填、成对录入。
|
|
|
|
|
+ * 机构不再采集(业主 2026-11-19 定案):`agentOrg` 仍随草稿原样回传,
|
|
|
|
|
+ * 存量合同已记录的机构⛔ 被本次保存清空,但本页不再提供录入格。
|
|
|
*/}
|
|
*/}
|
|
|
- <div className="ops-form-span-full contract-agent-readonly">
|
|
|
|
|
- <span className="ops-field-title">录入经办人 <small>=当前录入账号,提交时自动带入</small><FieldHint label="录入经办人说明">这三段由录入时账号自动带入,建后恒只读(KLT-L221),不得手工改。</FieldHint></span>
|
|
|
|
|
- <div className="contract-inline-group">
|
|
|
|
|
- <span className="contract-inline-seg"><small>机构</small><span className="contract-inline-readonly">{editing ? record.data?.created_by_org || "未记录" : "取账号绑定团队"}</span></span>
|
|
|
|
|
- <span className="contract-inline-seg"><small>姓名</small><span className="contract-inline-readonly">{editing ? record.data?.created_by_name || record.data?.created_by || "未记录" : identity?.name || "未登录"}</span></span>
|
|
|
|
|
- <span className="contract-inline-seg"><small>联系方式</small><span className="contract-inline-readonly">{editing ? record.data?.created_by_mobile || "未绑定" : identity?.phone || "账号未绑手机号"}</span></span>
|
|
|
|
|
|
|
+ <div className="contract-agent-cell">
|
|
|
|
|
+ <span className="ops-field-title">运营商经办人 <b title="必填">*</b><FieldHint label="运营商经办人说明">运营商侧的对接人(<b>不是</b>录入账号,页面不预填):姓名与联系电话必填、成对录入。</FieldHint></span>
|
|
|
|
|
+ <div className="contract-agent-combo">
|
|
|
|
|
+ <Input id="agent-name" aria-label="运营商经办人姓名" placeholder="姓名" aria-invalid={invalidOf("agent")} value={draft.agent} onChange={(event) => set("agent", event.target.value)} />
|
|
|
|
|
+ <Input id="agent-phone" aria-label="运营商经办人电话" inputMode="numeric" placeholder="联系电话" aria-invalid={invalidOf("agentPhone")} value={draft.agentPhone} onChange={(event) => set("agentPhone", event.target.value)} />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ {requiredErrorOf("agent")}{requiredErrorOf("agentPhone")}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <label htmlFor="sign-date"><span className="ops-field-title">签署日期 <b title="必填">*</b><FieldHint label="签署日期说明">交接日期即签署日期(2026-11-19 定案),表单只留这一格;提交时同值写入合同的签署日期与交接日期两列。新建默认录入当日。</FieldHint></span><Input id="sign-date" type="date" aria-invalid={invalidOf("signDate")} value={draft.signDate} onChange={(event) => set("signDate", event.target.value)} />{requiredErrorOf("signDate")}</label>
|
|
|
|
|
+ <label htmlFor="contract-amount"><span className="ops-field-title">合同金额(元) <b title="必填">*</b></span><Input id="contract-amount" inputMode="decimal" placeholder="0.00" aria-invalid={invalidOf("amount")} value={draft.amount} onChange={(event) => set("amount", event.target.value)} />{requiredErrorOf("amount")}</label>
|
|
|
|
|
+
|
|
|
|
|
+ {/* 服务期(月):替代原「付款周期」,标题右侧挂月/季/年/3 年快捷档(点一下直接填月数)。 */}
|
|
|
|
|
+ <div className="contract-months-cell">
|
|
|
|
|
+ <span className="ops-field-title">服务期(月) <b title="必填">*</b>
|
|
|
|
|
+ <span className="contract-months-presets" role="group" aria-label="服务期快捷档">
|
|
|
|
|
+ {SERVICE_MONTH_PRESETS.map((preset) => {
|
|
|
|
|
+ const active = draft.serviceMonths.trim() === String(preset.months);
|
|
|
|
|
+ return <button key={preset.months} type="button" className={active ? "is-active" : ""} aria-pressed={active} onClick={() => set("serviceMonths", String(preset.months))}>{preset.label}</button>;
|
|
|
|
|
+ })}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <FieldHint label="服务期说明">可填 1~600 的整数月;也可点标题右侧的快捷档(月 1/季 3/年 12/3 年 36)。到期日期=生效日+服务期(月)−1 天,该月无对应日先取月末,不可手改。</FieldHint>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <Input id="service-months" type="number" min={1} max={600} step={1} inputMode="numeric" placeholder="1~600" aria-invalid={invalidOf("serviceMonths")} value={draft.serviceMonths} onChange={(event) => set("serviceMonths", event.target.value)} />
|
|
|
|
|
+ {requiredErrorOf("serviceMonths")}
|
|
|
</div>
|
|
</div>
|
|
|
- <label htmlFor="handover-on"><span className="ops-field-title">交接日期 <b title="必填">*</b></span><Input id="handover-on" type="date" aria-invalid={invalidOf("handoverOn")} value={draft.handoverOn} onChange={(event) => set("handoverOn", event.target.value)} />{requiredErrorOf("handoverOn")}</label>
|
|
|
|
|
|
|
+ <label htmlFor="start-date"><span className="ops-field-title">生效日期 <b title="必填">*</b></span><Input id="start-date" type="date" aria-invalid={invalidOf("start")} value={draft.start} onChange={(event) => set("start", event.target.value)} />{requiredErrorOf("start")}</label>
|
|
|
|
|
+ <label htmlFor="end-date"><span className="ops-field-title">到期日期 <small>自动推算</small><FieldHint label="到期日期说明">{draft.start && draft.serviceMonths ? <>=生效日+服务期(月)再减一天,该月无对应日先取月末;<b>不可手改</b>,改生效日或服务期即自动重算。</> : <>先填「生效日期」与「服务期(月)」,到期日期自动算出,<b>不可手改</b>。</>}</FieldHint></span><Input id="end-date" type="date" value={draft.end} readOnly aria-readonly="true" className="cursor-not-allowed bg-muted/40" /></label>
|
|
|
</div>
|
|
</div>
|
|
|
- {record.data?.source_label !== undefined && <p className="contract-form-summary">来源:{record.data.source_label === null ? WORD_UNCONFIGURED : record.data.source_label}{record.data.pay_cycle ? `;付款周期 ${record.data.pay_cycle} → ${label(PAY_CYCLE, record.data.pay_cycle)}` : ""}</p>}
|
|
|
|
|
|
|
+ {draft.contractType === "renew" && !renewFrom && !editing && <p className="ops-field-note contract-type-hint">合同类型为「续签」:请在上方「续签自旧合同」选定旧合同,否则提交会被类型校验拦下。</p>}
|
|
|
|
|
+ {draft.contractType === "expand" && <p className="ops-field-note contract-type-hint">合同类型为「扩容补充协议」:03 服务构成须全部为增量附加项(引用本客户既有跨境链路订阅,不新开链路)。</p>}
|
|
|
|
|
+ {/*
|
|
|
|
|
+ * 「录入经办人」块已下线(业主 2026-11-19):录入账号由服务端从鉴权上下文写入
|
|
|
|
|
+ * (`created_by*` 三列、建后恒只读 KLT-L221),合同表单不必再回显一遍——
|
|
|
|
|
+ * 它在合同详情页仍是独立只读行,需要核对时到详情页看。
|
|
|
|
|
+ */}
|
|
|
|
|
+ {/**
|
|
|
|
|
+ * 合同附件(业主 2026-11-19 定案):样式与「营业执照影像」同一块拖曳卡片,位置固定在 02 最下面。
|
|
|
|
|
+ * 选填;单值覆盖(重传即替换),提交时把一个对象键交给 `attachment_url`。
|
|
|
|
|
+ */}
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={`contract-license-drop contract-attachment-drop${attachmentDragging ? " is-dragging" : ""}${attachmentBusy || submitting ? " is-locked" : ""}`}
|
|
|
|
|
+ onDragEnter={(event) => { if (!hasFiles(event.dataTransfer)) return; event.preventDefault(); if (!attachmentBusy && !submitting) setAttachmentDragging(true); }}
|
|
|
|
|
+ onDragOver={(event) => { if (!hasFiles(event.dataTransfer)) return; event.preventDefault(); event.dataTransfer.dropEffect = attachmentBusy || submitting ? "none" : "copy"; }}
|
|
|
|
|
+ onDragLeave={(event) => { if (event.currentTarget.contains(event.relatedTarget as Node | null)) return; setAttachmentDragging(false); }}
|
|
|
|
|
+ onDrop={(event) => {
|
|
|
|
|
+ event.preventDefault();
|
|
|
|
|
+ setAttachmentDragging(false);
|
|
|
|
|
+ if (attachmentBusy || submitting) return;
|
|
|
|
|
+ const file = event.dataTransfer.files?.[0] ?? null;
|
|
|
|
|
+ if (file) void pickAttachment(file);
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <span className="contract-license-drop-body">
|
|
|
|
|
+ <Upload size={22} />
|
|
|
|
|
+ <strong>合同附件(选填)</strong>
|
|
|
|
|
+ <span>{attachmentObj
|
|
|
|
|
+ ? `已上传:${attachmentObj.file_name}`
|
|
|
|
|
+ : attachmentBusy
|
|
|
|
|
+ ? "正在上传…"
|
|
|
|
|
+ : draft.attachmentUrl
|
|
|
|
|
+ ? `已登记:${draft.attachmentUrl.split("/").slice(-1)[0]}`
|
|
|
|
|
+ : "拖曳合同扫描件(PDF/图片)到此处,或点击选择文件"}</span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ {(attachmentObj || draft.attachmentUrl) && <Button type="button" variant="ghost" size="sm" className="contract-license-drop-remove" disabled={attachmentBusy || submitting} onClick={() => { setAttachmentObj(null); setAttachmentError(""); set("attachmentUrl", ""); }}><X size={15} />移除</Button>}
|
|
|
|
|
+ <input
|
|
|
|
|
+ className="contract-license-drop-input"
|
|
|
|
|
+ aria-label="上传合同附件"
|
|
|
|
|
+ type="file"
|
|
|
|
|
+ accept="image/png,image/jpeg,image/webp,application/pdf,.png,.jpg,.jpeg,.webp,.pdf"
|
|
|
|
|
+ disabled={attachmentBusy || submitting}
|
|
|
|
|
+ onChange={(event) => { const file = event.target.files?.[0] ?? null; event.target.value = ""; void pickAttachment(file); }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {attachmentError && <small className="customer-field-error">{attachmentError}</small>}
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
<section className="ops-record-card">
|
|
<section className="ops-record-card">
|
|
@@ -1260,15 +1473,8 @@ export function ContractEditorPage() {
|
|
|
* P1(D-9)增量合同:树的第一层是**被引用的既有链路订阅**(本合同没有链路条目),
|
|
* P1(D-9)增量合同:树的第一层是**被引用的既有链路订阅**(本合同没有链路条目),
|
|
|
* 整行只读(灰底+锁标),本合同的附加项只能挂在这条引用下面。
|
|
* 整行只读(灰底+锁标),本合同的附加项只能挂在这条引用下面。
|
|
|
*/}
|
|
*/}
|
|
|
- {!editing && (
|
|
|
|
|
- <div className="ops-form-span-full contract-increment-mode">
|
|
|
|
|
- <label className="ops-field-title">合同类型<FieldHint label="合同类型说明">{draft.increment ? "增量合同⛔ 新建链路:只能引用本客户一条在期跨境链路订阅(可跨合同),并在其下叠加附加项(D-9)。" : "普通合同可新建跨境链路,并在任意链路节点下挂附加项(D-7)。"}</FieldHint></label>
|
|
|
|
|
- <div className="contract-increment-switch">
|
|
|
|
|
- <Button type="button" variant={draft.increment ? "default" : "outline"} size="sm" aria-pressed={!draft.increment} onClick={() => toggleIncrement(false)}>普通合同(新建链路)</Button>
|
|
|
|
|
- <Button type="button" variant={draft.increment ? "default" : "outline"} size="sm" aria-pressed={draft.increment} onClick={() => toggleIncrement(true)}>增量合同(链路已在用、只补附加项)</Button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ {/* 合同类型已上移到 02 合同基本信息(2026-11-19):此处只按类型呈现录入模式,⛔ 再给一套并行的类型开关。 */}
|
|
|
|
|
+ {draft.increment && !editing && <p className="ops-form-span-full contract-form-summary">合同类型为「扩容补充协议」:不新建链路,只引用本客户一条在期跨境链路订阅并叠加附加项(D-9)。</p>}
|
|
|
{draft.increment && !editing && (
|
|
{draft.increment && !editing && (
|
|
|
<div className="ops-form-span-full">
|
|
<div className="ops-form-span-full">
|
|
|
<label htmlFor="increment-link"><span className="ops-field-title">引用既有跨境链路订阅 <b title="必填">*</b><FieldHint label="引用既有跨境链路订阅说明">只列本客户 status=active、未到期、plan_family=link 的订阅;引用后该节点只读,要换链路请另开一份增量合同,⛔ 在原合同上改引。</FieldHint></span></label>
|
|
<label htmlFor="increment-link"><span className="ops-field-title">引用既有跨境链路订阅 <b title="必填">*</b><FieldHint label="引用既有跨境链路订阅说明">只列本客户 status=active、未到期、plan_family=link 的订阅;引用后该节点只读,要换链路请另开一份增量合同,⛔ 在原合同上改引。</FieldHint></span></label>
|
|
@@ -1397,61 +1603,36 @@ export function ContractEditorPage() {
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <div className="ops-record-pair">
|
|
|
|
|
- <section className="ops-record-card">
|
|
|
|
|
- <div className="customer-form-section-title"><span>04</span><div><h2>境外 IP</h2><p>随服务构成核定。</p></div></div>
|
|
|
|
|
- <p className="contract-form-summary">固定 IP 条目已下线(2026-11-17):境外 IP 不再在合同上单独登记「线路出口+带宽档位+IP 数量」三元组,改由<strong>上方服务构成里选「叠加增值」档位并填份数</strong>表达(例:单独境外 IP 选 2 份=2 个 IP;不可叠加档份数恒 1)。</p>
|
|
|
|
|
- <p className="contract-form-summary">存量 IP 条目保留在库里仅供追溯,本页不再展示、也不再随合同提交;后端读口同样不再下发 `ip_entries`。</p>
|
|
|
|
|
- </section>
|
|
|
|
|
- <section className="ops-record-card">
|
|
|
|
|
- <div className="customer-form-section-title"><span>05</span><div><h2>合同附件</h2><p>可选 · 单份。</p></div></div>
|
|
|
|
|
- <div className="ops-contract-upload-list">
|
|
|
|
|
- {draft.attachmentUrl.trim()
|
|
|
|
|
- ? <div><span>{attachmentLabelText} · 已上传</span></div>
|
|
|
|
|
- : <div><Tri tone="missing" text={WORD_UNCONFIGURED} title="尚未选择附件文件" /></div>}
|
|
|
|
|
- </div>
|
|
|
|
|
- <input
|
|
|
|
|
- ref={attachmentInput}
|
|
|
|
|
- type="file"
|
|
|
|
|
- accept=".pdf,.ofd,.png,.jpg,.jpeg,.doc,.docx,.xls,.xlsx"
|
|
|
|
|
- hidden
|
|
|
|
|
- aria-label="选择合同附件文件"
|
|
|
|
|
- onChange={(event) => { void pickAttachment(event.target.files?.[0] ?? null); event.target.value = ""; }}
|
|
|
|
|
- />
|
|
|
|
|
- <div className="ops-contract-item-actions">
|
|
|
|
|
- <Button variant="outline" size="sm" disabled={attachmentBusy || submitting} onClick={() => attachmentInput.current?.click()}>
|
|
|
|
|
- <Upload size={15} />{attachmentBusy ? "正在上传…" : draft.attachmentUrl.trim() ? "更换附件" : "选择并上传附件"}
|
|
|
|
|
- </Button>
|
|
|
|
|
- {attachmentView && <Button variant="ghost" size="sm" onClick={() => window.open(attachmentView, "_blank", "noopener,noreferrer")}>查看附件</Button>}
|
|
|
|
|
- {draft.attachmentUrl.trim() && <Button variant="ghost" size="sm" disabled={attachmentBusy || submitting} onClick={() => {
|
|
|
|
|
- // 移除的若是「本页刚上传、还没落库」的那一份 ⇒ 它当场失去引用,立即退回;
|
|
|
|
|
- // 库里那份仍被合同引用(保存后才由写口回收),这里⛔ 提前删。
|
|
|
|
|
- const current = draft.attachmentUrl.trim();
|
|
|
|
|
- if (current && current !== record.data?.attachment_url) discardPendingAttachments([current]);
|
|
|
|
|
- set("attachmentUrl", ""); setAttachmentName(""); setAttachmentError("");
|
|
|
|
|
- }}><X size={15} />移除</Button>}
|
|
|
|
|
- </div>
|
|
|
|
|
- {attachmentError && <p className="ops-form-error" role="alert">{attachmentError}</p>}
|
|
|
|
|
- <p className="contract-form-summary">文件选中即直传平台对象存储(字节流与上传凭证都不经本服务),成功后随合同保存对象键;单份,重传即替换,保存前不影响库里已有附件。查看地址由详情读口按需现签。</p>
|
|
|
|
|
- </section>
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<aside className="ops-record-side">
|
|
<aside className="ops-record-side">
|
|
|
|
|
+ {/* 业务口径摘要(原型同款):随所选档位×份数实时汇总,⛔ 手填。 */}
|
|
|
|
|
+ <section className="ops-record-card">
|
|
|
|
|
+ <h2>业务口径摘要</h2>
|
|
|
|
|
+ <div className="ops-contract-summary contract-side-kv">
|
|
|
|
|
+ <div><span>订购项</span><strong>{sideMetrics.items} 条</strong></div>
|
|
|
|
|
+ <div><span>带宽合计</span><strong>{sideMetrics.bandwidth}</strong></div>
|
|
|
|
|
+ <div><span>境外固定 IP</span><strong>{sideMetrics.ip}</strong></div>
|
|
|
|
|
+ <div><span>账号上限</span><strong>{sideMetrics.quota}</strong></div>
|
|
|
|
|
+ <div><span>月度费用合计</span><strong>{sideMetrics.fee}</strong></div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </section>
|
|
|
|
|
+
|
|
|
<section className="ops-record-card">
|
|
<section className="ops-record-card">
|
|
|
- <h2>提交校验</h2>
|
|
|
|
|
- <div className="ops-contract-summary">
|
|
|
|
|
- <div><span>客户</span><strong>{editing ? customerLabel : (customerId ? (candidates.find((item) => item.customer_id === customerId)?.customer_name || customerTerm.trim() || WORD_UNCONFIGURED) : freeText ? `${customerTerm.trim()}(自由录入)` : "待填写")}</strong></div>
|
|
|
|
|
- <div><span>合同编号</span><strong>{draft.contractNo || "服务端生成"}</strong></div>
|
|
|
|
|
- <div><span>合同金额</span><strong>{/^\d+(?:\.\d{1,2})?$/.test(draft.amount.trim()) ? `¥${Number(draft.amount).toLocaleString("zh-CN")}` : "待填写"}</strong></div>
|
|
|
|
|
- <div><span>付款周期</span><strong>{draft.payCycle ? label(PAY_CYCLE, draft.payCycle) : WORD_UNCONFIGURED}</strong></div>
|
|
|
|
|
- <div><span>合同期间</span><strong>{draft.start && draft.end ? `${draft.start} 至 ${draft.end}` : "待填写"}</strong></div>
|
|
|
|
|
- <div><span>构成条目</span><strong>{draft.items.length} 个</strong></div>
|
|
|
|
|
- <div><span>替换原订阅</span><strong>{renewFrom ? "续签(按新订阅开通,不替换原订阅)" : (() => { const picked = draft.items.filter((item) => item.replacesSubscriptionId); return picked.length ? `${picked.length} 条(升降配)` : "无(按新订阅开通)"; })()}</strong></div>
|
|
|
|
|
- <div><span>附件</span><strong>{draft.attachmentUrl.trim() ? (attachmentBusy ? "上传中…" : attachmentLabelText) : "无附件"}</strong></div>
|
|
|
|
|
|
|
+ <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>
|
|
</div>
|
|
|
|
|
+ </section>
|
|
|
|
|
+
|
|
|
|
|
+ {/* 动作区(2026-11-19):不再列「提交后系统生成」说明,只留提交与取消。 */}
|
|
|
|
|
+ <section className="ops-record-card">
|
|
|
{error && <p className="ops-form-error" role="alert">{error}</p>}
|
|
{error && <p className="ops-form-error" role="alert">{error}</p>}
|
|
|
- <div className="ops-form-actions"><Button size="sm" variant="outline" onClick={() => navigate(-1)}>取消</Button><Button size="sm" disabled={submitting || attachmentBusy || replacementBusy || (editing && record.loading)} onClick={save}>{submitting ? "正在提交…" : replacementBusy ? "正在比对替换候选…" : editing ? "保存修改" : "提交合同"}</Button></div>
|
|
|
|
|
|
|
+ <div className="ops-form-actions">
|
|
|
|
|
+ <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>
|
|
</section>
|
|
|
</aside>
|
|
</aside>
|
|
|
</div>}
|
|
</div>}
|