first commit
This commit is contained in:
199
src/types/approval.ts
Normal file
199
src/types/approval.ts
Normal file
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
* 审批流程管理类型定义
|
||||
*/
|
||||
|
||||
// 审批人选择方式
|
||||
export type ApproverType = 'specified' | 'role' | 'superior' | 'self_select'
|
||||
|
||||
// 审批人类型映射
|
||||
export const ApproverTypeMap: Record<ApproverType, string> = {
|
||||
specified: '指定人员',
|
||||
role: '按角色',
|
||||
superior: '上级领导',
|
||||
self_select: '发起人自选'
|
||||
}
|
||||
|
||||
// 审批方式
|
||||
export type ApprovalMode = 'and' | 'or'
|
||||
|
||||
// 审批方式映射
|
||||
export const ApprovalModeMap: Record<ApprovalMode, string> = {
|
||||
and: '会签(所有人通过)',
|
||||
or: '或签(任一人通过)'
|
||||
}
|
||||
|
||||
// 审批节点
|
||||
export interface ApprovalNode {
|
||||
id: number
|
||||
name: string // 节点名称
|
||||
approverType: ApproverType // 审批人选择方式
|
||||
approverIds?: number[] // 指定审批人ID列表(approverType为specified时使用)
|
||||
approverRole?: string // 审批角色(approverType为role时使用)
|
||||
approvalMode: ApprovalMode // 审批方式
|
||||
timeoutHours?: number // 超时时间(小时)
|
||||
timeoutAction?: 'skip' | 'reject' // 超时操作
|
||||
order: number // 节点顺序
|
||||
}
|
||||
|
||||
// 审批流程适用场景
|
||||
export type ApprovalScenario =
|
||||
| 'project_publish'
|
||||
| 'withdrawal'
|
||||
| 'contract'
|
||||
| 'certification'
|
||||
| 'content'
|
||||
// 财务管理审批场景
|
||||
| 'expense_reimbursement' // 费用报销
|
||||
| 'payment_request' // 付款申请
|
||||
| 'purchase_request' // 采购申请
|
||||
| 'budget_adjustment' // 预算调整
|
||||
| 'invoice_apply' // 发票申请
|
||||
|
||||
// 场景映射
|
||||
export const ApprovalScenarioMap: Record<ApprovalScenario, string> = {
|
||||
project_publish: '项目发布',
|
||||
withdrawal: '提现申请',
|
||||
contract: '合同签署',
|
||||
certification: '用户认证',
|
||||
content: '内容审核',
|
||||
// 财务管理
|
||||
expense_reimbursement: '费用报销',
|
||||
payment_request: '付款申请',
|
||||
purchase_request: '采购申请',
|
||||
budget_adjustment: '预算调整',
|
||||
invoice_apply: '发票申请'
|
||||
}
|
||||
|
||||
// 审批流程模板
|
||||
export interface ApprovalTemplate {
|
||||
id: number
|
||||
name: string // 模板名称
|
||||
description?: string // 描述
|
||||
scenario: ApprovalScenario // 适用场景
|
||||
nodes: ApprovalNode[] // 审批节点列表
|
||||
enabled: boolean // 是否启用
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// 审批实例状态
|
||||
export type ApprovalInstanceStatus = 'pending' | 'in_progress' | 'approved' | 'rejected' | 'withdrawn' | 'cancelled'
|
||||
|
||||
// 实例状态映射
|
||||
export const ApprovalInstanceStatusMap: Record<ApprovalInstanceStatus, string> = {
|
||||
pending: '待提交',
|
||||
in_progress: '审批中',
|
||||
approved: '已通过',
|
||||
rejected: '已拒绝',
|
||||
withdrawn: '已撤回',
|
||||
cancelled: '已取消'
|
||||
}
|
||||
|
||||
// 实例状态徽章
|
||||
export const ApprovalInstanceStatusBadgeMap: Record<ApprovalInstanceStatus, 'default' | 'processing' | 'success' | 'error' | 'warning'> = {
|
||||
pending: 'default',
|
||||
in_progress: 'processing',
|
||||
approved: 'success',
|
||||
rejected: 'error',
|
||||
withdrawn: 'warning',
|
||||
cancelled: 'default'
|
||||
}
|
||||
|
||||
// 节点审批记录
|
||||
export interface NodeApprovalRecord {
|
||||
nodeId: number
|
||||
nodeName: string
|
||||
approverId: number
|
||||
approverName: string
|
||||
approverAvatar: string
|
||||
action: 'approve' | 'reject' | 'transfer' | 'return'
|
||||
comment?: string
|
||||
operatedAt: string
|
||||
}
|
||||
|
||||
// 审批实例
|
||||
export interface ApprovalInstance {
|
||||
id: number
|
||||
templateId: number
|
||||
templateName: string
|
||||
scenario: ApprovalScenario
|
||||
|
||||
// 业务关联
|
||||
businessType: string // 业务类型
|
||||
businessId: number // 业务ID
|
||||
businessTitle: string // 业务标题
|
||||
|
||||
// 发起人
|
||||
initiatorId: number
|
||||
initiatorName: string
|
||||
initiatorAvatar: string
|
||||
|
||||
// 状态
|
||||
status: ApprovalInstanceStatus
|
||||
currentNodeId?: number // 当前节点ID
|
||||
currentNodeName?: string // 当前节点名称
|
||||
|
||||
// 审批记录
|
||||
records: NodeApprovalRecord[]
|
||||
|
||||
// 时间
|
||||
submittedAt: string
|
||||
completedAt?: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
// 审批人信息(用于选择)
|
||||
export interface ApproverInfo {
|
||||
id: number
|
||||
name: string
|
||||
avatar: string
|
||||
role: string
|
||||
department?: string
|
||||
}
|
||||
|
||||
// 模板查询参数
|
||||
export interface ApprovalTemplateQueryParams {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
keyword?: string
|
||||
scenario?: ApprovalScenario
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
// 模板列表结果
|
||||
export interface ApprovalTemplateListResult {
|
||||
list: ApprovalTemplate[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
// 实例查询参数
|
||||
export interface ApprovalInstanceQueryParams {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
keyword?: string
|
||||
scenario?: ApprovalScenario
|
||||
status?: ApprovalInstanceStatus
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
}
|
||||
|
||||
// 实例列表结果
|
||||
export interface ApprovalInstanceListResult {
|
||||
list: ApprovalInstance[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
// 统计
|
||||
export interface ApprovalStats {
|
||||
totalTemplates: number
|
||||
enabledTemplates: number
|
||||
totalInstances: number
|
||||
pendingInstances: number
|
||||
inProgressInstances: number
|
||||
approvedInstances: number
|
||||
rejectedInstances: number
|
||||
}
|
||||
Reference in New Issue
Block a user