chuangte_bike_newxcx/common/enums/fault.js
2026-02-12 15:07:28 +08:00

36 lines
943 B
JavaScript

/**
* 故障申报状态(与后台一致)
*/
export const FaultStatus = {
IGNORED: { label: '已忽略', value: '0' },
PENDING: { label: '待处理', value: '1' },
COMPLETED: { label: '已完成', value: '3' }
}
/** 仅待处理可审核 */
export const FAULT_PENDING = FaultStatus.PENDING.value
/**
* 根据状态码获取展示文案
* @param {string} status appealStatus
* @returns {string}
*/
export function getFaultStatusLabel(status) {
if (status == null || status === '') return '未知'
const map = {
[FaultStatus.IGNORED.value]: FaultStatus.IGNORED.label,
[FaultStatus.PENDING.value]: FaultStatus.PENDING.label,
[FaultStatus.COMPLETED.value]: FaultStatus.COMPLETED.label
}
return map[status] || '未知'
}
/**
* 是否为可审核状态(待处理)
* @param {string} status appealStatus
* @returns {boolean}
*/
export function canAuditFault(status) {
return status === FAULT_PENDING
}