|
|
@@ -347,6 +347,8 @@ export function ContractEditorPage() {
|
|
|
row_version: version,
|
|
|
...shared,
|
|
|
});
|
|
|
+ // 落库成功 ⇒ 清单里的对象键已被合同引用(服务端也会拒删),⛔ 别再当孤儿回收。
|
|
|
+ pendingAttachmentKeys.current = [];
|
|
|
navigate(`/contracts/${encodeURIComponent(row.contract_id)}`);
|
|
|
} else {
|
|
|
const res = await contractCreate({
|
|
|
@@ -372,6 +374,8 @@ export function ContractEditorPage() {
|
|
|
},
|
|
|
}),
|
|
|
});
|
|
|
+ // 合同已生成 ⇒ 附件对象已被引用(服务端也会拒删)⇒ 清空孤儿清单。
|
|
|
+ pendingAttachmentKeys.current = [];
|
|
|
// 内联建档成功 ⇒ 停在回执页展示客户号与主账号(激活码明文由「导出激活码」取,⛔ 在此伪造)。
|
|
|
if (res?.inline_customer) {
|
|
|
setCreated({ contractId: res.contract_id, customer: res.inline_customer });
|
|
|
@@ -715,7 +719,13 @@ export function ContractEditorPage() {
|
|
|
<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={() => { set("attachmentUrl", ""); setAttachmentName(""); setAttachmentError(""); }}><X size={15} />移除</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>
|