|
|
@@ -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) {
|