73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
export type SettlementStatus = 'pending' | 'rejected' | 'approving' | 'approved' | 'confirmed' | 'cancelled'
|
|
|
|
/** 草稿或已驳回:可编辑运输明细、提交审批、作废 */
|
|
export function isEditableDraftSettlement(status?: string) {
|
|
return status === 'pending' || status === 'rejected'
|
|
}
|
|
|
|
export function getSettlementStatusTagType(
|
|
status: string
|
|
): 'info' | 'warning' | 'success' | 'primary' | 'danger' {
|
|
const map: Record<string, 'info' | 'warning' | 'success' | 'primary' | 'danger'> = {
|
|
pending: 'info',
|
|
rejected: 'danger',
|
|
approving: 'warning',
|
|
approved: 'primary',
|
|
confirmed: 'success',
|
|
cancelled: 'danger'
|
|
}
|
|
return map[status] || 'info'
|
|
}
|
|
|
|
export function getSettlementStatusLabel(status: string) {
|
|
const map: Record<string, string> = {
|
|
pending: '草稿',
|
|
rejected: '已驳回',
|
|
approving: '审批中',
|
|
approved: '待发放',
|
|
confirmed: '已发放',
|
|
cancelled: '已作废'
|
|
}
|
|
return map[status] || status
|
|
}
|
|
|
|
export function getPlanTypeTagType(planType: string): 'primary' | 'success' | 'warning' | 'info' {
|
|
const map: Record<string, 'primary' | 'success' | 'warning' | 'info'> = {
|
|
direct: 'primary',
|
|
inbound: 'success',
|
|
outbound: 'warning'
|
|
}
|
|
return map[planType] || 'info'
|
|
}
|
|
|
|
export function getPlanTypeLabel(planType: string) {
|
|
const map: Record<string, string> = {
|
|
direct: '直销单',
|
|
inbound: '入库单',
|
|
outbound: '出库单'
|
|
}
|
|
return map[planType] || planType
|
|
}
|
|
|
|
export function mapApprovalFlowToNodes(
|
|
flow: Array<{
|
|
id: string
|
|
step: number
|
|
stepName?: string
|
|
approverName?: string
|
|
approvalResult: string
|
|
approvalOpinion?: string
|
|
approvalTime?: string
|
|
}>
|
|
) {
|
|
return flow.map((item) => ({
|
|
id: item.id as unknown as number,
|
|
nodeName: item.stepName || item.approverName || `步骤${item.step}`,
|
|
nodeOrder: item.step,
|
|
approvalStatus: item.approvalResult,
|
|
approvalOpinion: item.approvalOpinion,
|
|
approverName: item.approverName || '',
|
|
approvalTime: item.approvalTime
|
|
}))
|
|
}
|