feat(web-admin): OA CC read/unread API helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-06 12:12:57 +08:00
1 parent fbfbaa6d17
commit 9825d52bfb
1 file changed
+31 -2
+31 -2
View File
@@ -244,8 +244,37 @@ export function fetchOaInstanceDetail(id: string) {
})
}
export function fetchOaTasks(kind: 'pending' | 'done' | 'mine' | 'cc') {
return request.get<{ list: any[] }>({ url: `${BASE}/tasks/${kind}` })
export function fetchOaTasks(
kind: 'pending' | 'done' | 'mine' | 'cc',
params?: { readStatus?: 'unread' | 'read' | 'all' }
) {
return request.get<{ list: any[] }>({
url: `${BASE}/tasks/${kind}`,
params: kind === 'cc' ? { readStatus: params?.readStatus ?? 'unread' } : undefined
})
}
export function fetchOaCcUnreadCount() {
return request.get<{ count: number }>({ url: `${BASE}/tasks/cc/unread-count` })
}
export function fetchMarkOaCcTaskRead(taskId: string) {
return request.post({
url: `${BASE}/tasks/${taskId}/read`,
showSuccessMessage: false
})
}
export function fetchBatchMarkOaCcTasksRead(ids: string[]) {
return request.post({
url: `${BASE}/tasks/cc/read-batch`,
data: { ids },
showSuccessMessage: true
})
}
export function formatOaCcUnreadBadgeCount(count: number): string {
return count > 99 ? '99+' : String(count)
}
export function fetchApproveOaTask(taskId: string, comment?: string) {