feat(frontend): 审批与系统设置模块页面接入及业务列表调整
This commit is contained in:
1 parent
8ef26e22fb
commit
74f1ef1cf9
15 files changed
+1215
-28
No files matched your search
@@ -0,0 +1,91 @@
|
||||
import request from './request'
|
||||
import type { PageData } from './types'
|
||||
|
||||
/** 审批单状态:1待财务复核 2待领导审核 3已通过 4已驳回 5已撤回 */
|
||||
export const APPROVAL_STATUS = {
|
||||
PENDING_FINANCE: 1,
|
||||
PENDING_LEADER: 2,
|
||||
APPROVED: 3,
|
||||
REJECTED: 4,
|
||||
WITHDRAWN: 5,
|
||||
} as const
|
||||
|
||||
export function approvalStatusLabel(status: number): string {
|
||||
return (
|
||||
{
|
||||
1: '待财务复核',
|
||||
2: '待领导审核',
|
||||
3: '已通过',
|
||||
4: '已驳回',
|
||||
5: '已撤回',
|
||||
}[status] ?? String(status)
|
||||
)
|
||||
}
|
||||
|
||||
export function approvalStatusTagType(status: number): 'primary' | 'success' | 'danger' | 'info' {
|
||||
return (
|
||||
({ 1: 'primary', 2: 'warning', 3: 'success', 4: 'danger', 5: 'info' } as const)[status] ??
|
||||
'info'
|
||||
) as 'primary' | 'success' | 'danger' | 'info'
|
||||
}
|
||||
|
||||
/** 节点动作:1通过 2驳回 3自动通过(系统) 4撤回 */
|
||||
export function stepActionLabel(action: number): string {
|
||||
return ({ 1: '通过', 2: '驳回', 3: '自动通过', 4: '撤回' } as const)[action] ?? String(action)
|
||||
}
|
||||
|
||||
/** 节点名:0 仅用于撤回留痕 */
|
||||
export function stepNodeLabel(node: number): string {
|
||||
return ({ 0: '撤回', 1: '财务复核', 2: '领导审核' } as const)[node] ?? `节点${node}`
|
||||
}
|
||||
|
||||
export interface ApprovalStep {
|
||||
id: number
|
||||
node: number
|
||||
action: number
|
||||
opinion: string | null
|
||||
operator_id: number | null
|
||||
operator_name: string
|
||||
create_time: string
|
||||
}
|
||||
|
||||
export interface ApprovalOrder {
|
||||
id: number
|
||||
order_no: string
|
||||
/** 1二次分配方案 2月度结算(预留) */
|
||||
order_type: number
|
||||
ref_id: number
|
||||
refer_no: string
|
||||
status: number
|
||||
submitter_id: number | null
|
||||
submitter_name: string
|
||||
create_time: string
|
||||
}
|
||||
|
||||
export interface ApprovalOrderDetail extends ApprovalOrder {
|
||||
steps: ApprovalStep[]
|
||||
}
|
||||
|
||||
export interface ApprovalQueryParams {
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
/** 审批单号/引用单号,模糊 */
|
||||
keyword?: string
|
||||
status?: number
|
||||
order_type?: number
|
||||
}
|
||||
|
||||
export function listApprovals(params: ApprovalQueryParams): Promise<PageData<ApprovalOrder>> {
|
||||
return request({ url: '/v1/system/approvals', method: 'get', params })
|
||||
}
|
||||
|
||||
export function getApproval(orderId: number): Promise<ApprovalOrderDetail> {
|
||||
return request({ url: `/v1/system/approvals/${orderId}`, method: 'get' })
|
||||
}
|
||||
|
||||
export function actApproval(
|
||||
orderId: number,
|
||||
data: { action: 1 | 2; opinion?: string | null },
|
||||
): Promise<ApprovalOrderDetail> {
|
||||
return request({ url: `/v1/system/approvals/${orderId}/action`, method: 'post', data })
|
||||
}
|
||||
Reference in new issue
Block a user