diff --git a/web-admin/src/api/oaApproval.ts b/web-admin/src/api/oaApproval.ts index ef279c56..14f847d1 100644 --- a/web-admin/src/api/oaApproval.ts +++ b/web-admin/src/api/oaApproval.ts @@ -331,6 +331,54 @@ export function fetchOaInstanceDetail(id: string) { }) } +export type OaCommentAttachmentRef = { + fieldKey: string + fieldLabel?: string + url: string + fileName: string +} + +export type OaInstanceComment = { + id: string + instanceId?: string + content: string + attachmentRefs: OaCommentAttachmentRef[] + status: 'normal' | 'revoked' | string + revokedTime?: string + createBy: string + createByName?: string + createTime: string + canRevoke?: boolean +} + +export function fetchOaFormAttachments(instanceId: string) { + return request.get<{ items: Array<{ fieldKey: string; fieldLabel: string; files: OaCommentAttachmentRef[] }> }>({ + url: `${BASE}/instances/${instanceId}/form-attachments` + }) +} + +export function fetchOaInstanceComments(instanceId: string) { + return request.get<{ list: OaInstanceComment[] }>({ + url: `${BASE}/instances/${instanceId}/comments` + }) +} + +export function fetchCreateOaComment( + instanceId: string, + data: { content: string; attachmentRefs?: OaCommentAttachmentRef[] } +) { + return request.post({ + url: `${BASE}/instances/${instanceId}/comments`, + data + }) +} + +export function fetchRevokeOaComment(instanceId: string, commentId: string) { + return request.post({ + url: `${BASE}/instances/${instanceId}/comments/${commentId}/revoke` + }) +} + export function fetchOaTasks( kind: 'pending' | 'done' | 'mine' | 'cc', params?: {