feat: 完善报销单审批流程及退回原因追踪
新增直属领导审批通过接口和审批待办列表查询,报销单退回 支持原因码分类和审批环节标记,优化票据附件去重和路径 回退查找,前端新增退回原因对话框、审批收件箱和工作台 图标组件,补充工具函数和单元测试覆盖。
This commit is contained in:
40
web/src/utils/approvalInbox.js
Normal file
40
web/src/utils/approvalInbox.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { mapExpenseClaimToRequest } from '../composables/useRequests.js'
|
||||
import { canManageExpenseClaims } from './accessControl.js'
|
||||
|
||||
export function canProcessApprovalRequest(request, currentUser) {
|
||||
const node = String(request?.workflowNode || '').trim()
|
||||
const currentName = String(currentUser?.name || '').trim()
|
||||
const applicantName = String(request?.person || request?.employeeName || '').trim()
|
||||
|
||||
if (currentName && applicantName && currentName === applicantName) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (canManageExpenseClaims(currentUser)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return (
|
||||
node.includes('直属领导')
|
||||
|| node.includes('领导审批')
|
||||
|| node.includes('部门负责人')
|
||||
|| node.includes('负责人审批')
|
||||
)
|
||||
}
|
||||
|
||||
export function listPendingApprovalRequests(claimsPayload, currentUser) {
|
||||
if (!Array.isArray(claimsPayload)) {
|
||||
return []
|
||||
}
|
||||
|
||||
return claimsPayload
|
||||
.map((item) => mapExpenseClaimToRequest(item))
|
||||
.filter((item) => item.approvalKey === 'in_progress')
|
||||
.filter((item) => canProcessApprovalRequest(item, currentUser))
|
||||
}
|
||||
|
||||
export function resolvePendingClaimIds(claimsPayload, currentUser) {
|
||||
return listPendingApprovalRequests(claimsPayload, currentUser)
|
||||
.map((item) => String(item.claimId || '').trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
Reference in New Issue
Block a user