fix: 修复详情页消审显示并跳转编辑

This commit is contained in:
2026-11-09 13:45:12 +08:00
parent 036b331e9a
commit 4825cd13f2
10 changed files with 185 additions and 80 deletions
+22 -7
View File
@@ -18,6 +18,13 @@ export const AUDIT_STATUS = {
export const DRAFT_AUDIT_STATUS = 0;
export const DRAFT_AUDIT_STATUS_NAME = '待保存';
/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */
export function toAuditStatus(status) {
const n = Number(status);
return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS;
}
export const AUDIT_STATUS_MAP = {
1: '待审核',
2: '已审核',
@@ -117,8 +124,8 @@ export function normalizeOrder(order) {
return {
id: order.id,
order_no: order.order_no || '',
audit_status: order.audit_status,
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[order.audit_status] || '',
audit_status: toAuditStatus(order.audit_status),
audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[toAuditStatus(order.audit_status)] || '',
// 表头
sale_system_id: order.sale_system_id || '',
sale_system_name: order.sale_system_name || '',
@@ -470,11 +477,13 @@ export function formatDisplayTime(value, format = 'YYYY-MM-DD') {
}
export function canScanAtStatus(status) {
return [AUDIT_STATUS.PENDING, AUDIT_STATUS.REJECTED].includes(status);
const s = toAuditStatus(status);
return s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED;
}
export function isLockedOrderStatus(status) {
return [AUDIT_STATUS.APPROVED, AUDIT_STATUS.VOIDED].includes(status);
const s = toAuditStatus(status);
return s === AUDIT_STATUS.APPROVED || s === AUDIT_STATUS.VOIDED;
}
/** 分页拉取全部列表(直至末页) */
@@ -491,7 +500,12 @@ export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE
/** 新增/编辑页底部:审核、作废 */
export function getFormStatusActionButtons(headerSaved, orderId, status) {
if (!headerSaved || !orderId || !canScanAtStatus(status)) return [];
if (!headerSaved || !orderId) return [];
const s = toAuditStatus(status);
if (s === AUDIT_STATUS.APPROVED) {
return [{ label: '消审', action: 'unapprove' }];
}
if (!canScanAtStatus(s)) return [];
return [
{ label: '审核', action: 'approve' },
{ label: '作废', action: 'void' },
@@ -500,14 +514,15 @@ export function getFormStatusActionButtons(headerSaved, orderId, status) {
/** 查看页底部:编辑、审核、作废 / 消审 */
export function getViewStatusActionButtons(status) {
if (status === AUDIT_STATUS.PENDING || status === AUDIT_STATUS.REJECTED) {
const s = toAuditStatus(status);
if (s === AUDIT_STATUS.PENDING || s === AUDIT_STATUS.REJECTED) {
return [
{ label: '编辑', action: 'edit' },
{ label: '审核', action: 'approve' },
{ label: '作废', action: 'void' },
];
}
if (status === AUDIT_STATUS.APPROVED) {
if (s === AUDIT_STATUS.APPROVED) {
return [{ label: '消审', action: 'unapprove' }];
}
return [];