feat: 强化出库上链一致性(确认中即已上链/出库时间必填/上链须先出库)

This commit is contained in:
Nixevol
2026-07-10 17:53:57 +08:00
parent f364d2d194
commit e1e1cf7308
6 changed files with 24 additions and 5 deletions
+10 -3
View File
@@ -326,7 +326,9 @@ function rowIsOutbound(row: any) {
return Boolean(row.outTime || getOutImages(row).length);
}
function rowIsOnchain(row: any) {
return Boolean(row?.latestProof);
// 已提交上链即视为已上链:ONCHAIN(已确认)/CONFIRMING(确认中)/PENDING(待处理) 均不允许重复上链,仅 FAILED 可重试
const s = row?.latestAnyProof?.status;
return s === 'ONCHAIN' || s === 'CONFIRMING' || s === 'PENDING';
}
function outboundMenuLabel(row: any) {
if (rowIsOnchain(row)) return t('pages.traceCode.onchainInfo');
@@ -336,7 +338,7 @@ function outboundMenuLabel(row: any) {
const targetOutbound = computed(() => rowIsOutbound(outboundTarget.value));
const targetOnchain = computed(() => rowIsOnchain(outboundTarget.value));
const outboundReadonly = computed(() => targetOutbound.value || targetOnchain.value);
const targetProof = computed<any>(() => outboundTarget.value?.latestProof ?? null);
const targetProof = computed<any>(() => outboundTarget.value?.latestProof ?? outboundTarget.value?.latestAnyProof ?? null);
const outboundModalTitle = computed(() => outboundMenuLabel(outboundTarget.value));
const columns = computed<DataTableColumns<any>>(() => {
@@ -819,7 +821,8 @@ function getOutImages(row: any) {
function openOutboundModal(row: any) {
outboundTarget.value = row;
outboundForm.outTime = formatDateTime(row.outTime);
// 出库时间必填:未出库时默认此刻;已出库时回显既有时间(只读)
outboundForm.outTime = row.outTime ? formatDateTime(row.outTime) : dayjs().format('YYYY-MM-DD HH:mm');
outboundForm.remark = row.remark || '';
outImages.value = getOutImages(row);
outboundModal.value = true;
@@ -827,6 +830,10 @@ function openOutboundModal(row: any) {
async function saveOutbound(triggerOnchain: boolean) {
if (!outboundTarget.value) return;
if (!outboundReadonly.value && !outboundForm.outTime) {
message.warning(t('pages.outbound.outTimeRequired'));
return;
}
if (triggerOnchain) {
outboundTriggering.value = true;
} else {
+2 -1
View File
@@ -466,7 +466,8 @@
"FAILED": "Failed",
"EXPIRED": "Expired"
},
"onchainAutoTip": "On-chain hash, attestation link, and on-chain time are written automatically from the configured blockchain API response."
"onchainAutoTip": "On-chain hash, attestation link, and on-chain time are written automatically from the configured blockchain API response.",
"outTimeRequired": "Outbound time is required"
},
"blockchain": {
"title": "Blockchain Attestation",
+2 -1
View File
@@ -466,7 +466,8 @@
"FAILED": "失败",
"EXPIRED": "已过期"
},
"onchainAutoTip": "链上哈希、存证链接、上链时间由当前配置的区块链接口返回后自动写入。"
"onchainAutoTip": "链上哈希、存证链接、上链时间由当前配置的区块链接口返回后自动写入。",
"outTimeRequired": "出库时间不能为空"
},
"blockchain": {
"title": "区块链存证",