chore: sync project snapshot for gitea/github upload
Some checks failed
CI / build_test_package (push) Has been cancelled
CI / auto_merge (push) Has been cancelled

This commit is contained in:
Your Name
2026-03-26 15:59:53 +08:00
parent e5b0f65156
commit 5f5597ef0f
121 changed files with 5841 additions and 1357 deletions

View File

@@ -162,8 +162,8 @@ class ApprovalService {
/**
* 获取待审批列表
*/
async getPendingApprovals(userId: number): Promise<ApprovalRecord[]> {
const response = await authFetch(`${this.baseUrl}/approval/pending?userId=${userId}`, {
async getPendingApprovals(): Promise<ApprovalRecord[]> {
const response = await authFetch(`${this.baseUrl}/approval/pending`, {
credentials: undefined
})
const result = await response.json() as ApiResponse<ApprovalRecord[]>
@@ -176,8 +176,8 @@ class ApprovalService {
/**
* 获取已审批列表
*/
async getApprovedList(userId: number): Promise<ApprovalRecord[]> {
const response = await authFetch(`${this.baseUrl}/approval/processed?userId=${userId}`, {
async getApprovedList(): Promise<ApprovalRecord[]> {
const response = await authFetch(`${this.baseUrl}/approval/processed`, {
credentials: undefined
})
const result = await response.json() as ApiResponse<ApprovalRecord[]>
@@ -190,8 +190,8 @@ class ApprovalService {
/**
* 获取我发起的审批
*/
async getMyApplications(userId: number): Promise<ApprovalRecord[]> {
const response = await authFetch(`${this.baseUrl}/approval/my?userId=${userId}`, {
async getMyApplications(): Promise<ApprovalRecord[]> {
const response = await authFetch(`${this.baseUrl}/approval/my`, {
credentials: undefined
})
const result = await response.json() as ApiResponse<ApprovalRecord[]>
@@ -322,6 +322,8 @@ class ApprovalService {
/**
* 批量审批操作
* 使用新批量接口 POST /api/v1/approval/batch (approval.index.batch.ALL)
* 注意:批量转交使用 POST /api/v1/approval/batch-transfer (approval.index.batch.transfer.ALL)
*/
async batchApprove(data: {
recordIds: number[]
@@ -333,7 +335,12 @@ class ApprovalService {
failCount: number
results: Array<{ recordId: number; success: boolean; status: string; message: string }>
}> {
const response = await authFetch(`${this.baseUrl}/approval/batch-handle`, {
// 根据操作类型选择接口TRANSFER使用批量转交接口其他使用批量审批接口
const endpoint = data.action === 'TRANSFER'
? `${this.baseUrl}/api/v1/approval/batch-transfer`
: `${this.baseUrl}/api/v1/approval/batch`;
const response = await authFetch(endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: undefined,
@@ -418,6 +425,22 @@ class ApprovalService {
}
return result.data
}
/**
* 添加审批意见(不改变审批状态)
*/
async addComment(recordId: number, comment: string): Promise<void> {
const response = await authFetch(`${this.baseUrl}/approval/records/${recordId}/comment`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: undefined,
body: JSON.stringify({ comment })
})
const result = await response.json() as ApiResponse<void>
if (result.code !== 200) {
throw new Error(result.message || '添加审批意见失败')
}
}
}
export const approvalService = new ApprovalService()