feat: 强化出库上链一致性(确认中即已上链/出库时间必填/上链须先出库)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user