diff --git a/src/common/storeFabricBusinessOut.js b/src/common/storeFabricBusinessOut.js index 1135e21..186908f 100644 --- a/src/common/storeFabricBusinessOut.js +++ b/src/common/storeFabricBusinessOut.js @@ -61,12 +61,19 @@ export const STATUS_ACTION_CONFIG = { unapprove: { status: AUDIT_STATUS.PENDING, msg: '确认消审该单据?', apiKey: 'statusWait' }, }; -/** 审核 / 作废成功后播放的语音文案 */ +/** 审核 / 消审 / 作废成功后播放的语音文案 */ export const STATUS_ACTION_VOICE = { approve: '审核成功', + unapprove: '消审成功', void: '作废成功', }; +/** 将接口状态统一为数字,避免字符串导致按钮判断失效 */ +export function toAuditStatus(status) { + const n = Number(status); + return Number.isFinite(n) ? n : DRAFT_AUDIT_STATUS; +} + // 出仓类型:当前后端仅提供「坯布其他出货单」一种类型的接口 export const BILL_TYPES = [ { value: 'other', label: '坯布其他出货单' }, @@ -127,11 +134,12 @@ export function normalizeOrder(order) { if (!order) return null; const normalizedItems = (order.item_data || []).map((item) => normalizeItem(item)); const itemData = groupItemData(normalizedItems); + const auditStatus = toAuditStatus(order.audit_status); 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: auditStatus, + audit_status_name: order.audit_status_name || AUDIT_STATUS_MAP[auditStatus] || '', // 表头 sale_system_id: order.sale_system_id || '', sale_system_name: order.sale_system_name || '', @@ -432,11 +440,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; } /** 分页拉取全部列表(直至末页) */ @@ -451,9 +461,14 @@ export function fetchAllOrderList(listFn, params = {}, pageSize = LIST_PAGE_SIZE return loadPage(1, []); } -/** 新增/编辑页底部:审核、作废 */ +/** 新增/编辑页底部:审核、作废 / 已审核时消审 */ 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' }, @@ -462,14 +477,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 []; diff --git a/src/manifest.json b/src/manifest.json index a3b40d1..91ee273 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name" : "浩拓织厂", "appid" : "__UNI__F79F300", "description" : "周尚-浩拓织厂", - "versionName" : "1.1.22", - "versionCode" : 122, + "versionName" : "1.1.23", + "versionCode" : 123, "transformPx" : false, "app-plus" : { "optimization" : {