142 lines
3.9 KiB
JavaScript
142 lines
3.9 KiB
JavaScript
import { get, post, put, request } from '../utils/http.js'
|
|
|
|
export function fetchUserList(params) {
|
|
return get('/web/admin/users', params)
|
|
}
|
|
|
|
export function fetchDeptTree(params) {
|
|
return get('/web/admin/depts', params)
|
|
}
|
|
|
|
export function fetchPostList(params) {
|
|
return get('/web/admin/posts', params)
|
|
}
|
|
|
|
export function fetchReceiveAccountOptions() {
|
|
return get('/web/admin/oa-approval/receive-accounts/options')
|
|
}
|
|
|
|
export function fetchRelatedCandidates(params) {
|
|
return get('/web/admin/oa-approval/related-candidates', params)
|
|
}
|
|
|
|
export function fetchRelatedSummaries(ids, mode = 'view') {
|
|
return get('/web/admin/oa-approval/related-summaries', {
|
|
ids: (ids || []).filter(Boolean).join(','),
|
|
mode
|
|
})
|
|
}
|
|
|
|
export function uploadAttachment(file) {
|
|
const fd = new FormData()
|
|
fd.append('file', file)
|
|
fd.append('folder', 'oa-approval')
|
|
return request({
|
|
url: '/web/admin/attachment/upload',
|
|
method: 'POST',
|
|
data: fd
|
|
})
|
|
}
|
|
|
|
/** 获取带 Content-Disposition 的下载地址(保留原始文件名) */
|
|
export function fetchAttachmentDownloadUrl({ fileUrl, fileName } = {}) {
|
|
return post('/web/admin/attachment/download-url', {
|
|
fileUrl,
|
|
fileName: fileName || undefined
|
|
})
|
|
}
|
|
|
|
// —— 发起审批运行时(对齐 web-admin oaApproval.ts)——
|
|
|
|
export function fetchOaGroupList() {
|
|
return get('/web/admin/oa-approval/groups')
|
|
}
|
|
|
|
export function fetchOaTemplates() {
|
|
return get('/web/admin/oa-approval/templates')
|
|
}
|
|
|
|
export function fetchOaTemplateDetail(appId) {
|
|
return get(`/web/admin/oa-approval/templates/${encodeURIComponent(appId)}`)
|
|
}
|
|
|
|
export function fetchOaFlowPreview(appId, { formData, initiatorSelectByNode } = {}) {
|
|
return post(`/web/admin/oa-approval/templates/${encodeURIComponent(appId)}/flow-preview`, {
|
|
formData: formData || {},
|
|
initiatorSelectByNode: initiatorSelectByNode || undefined
|
|
})
|
|
}
|
|
|
|
export function fetchCreateOaInstanceDraft(data) {
|
|
return post('/web/admin/oa-approval/drafts', data)
|
|
}
|
|
|
|
export function fetchUpdateOaInstanceDraft(id, data) {
|
|
return put(`/web/admin/oa-approval/drafts/${encodeURIComponent(id)}`, data)
|
|
}
|
|
|
|
export function fetchOaInstanceDraftDetail(id) {
|
|
return get(`/web/admin/oa-approval/drafts/${encodeURIComponent(id)}`)
|
|
}
|
|
|
|
export function fetchSubmitOaInstanceDraft(id, data) {
|
|
return post(`/web/admin/oa-approval/drafts/${encodeURIComponent(id)}/submit`, data)
|
|
}
|
|
|
|
export function fetchStartOaInstance(data) {
|
|
return post('/web/admin/oa-approval/instances', data)
|
|
}
|
|
|
|
export function fetchCurrentUser() {
|
|
return get('/web/auth/current-user')
|
|
}
|
|
|
|
export function fetchCnHolidayRange(start, end) {
|
|
return get('/cn-holiday/range', { start, end })
|
|
}
|
|
|
|
// —— 详情 / 办理动作(对齐 web-admin oaApproval.ts)——
|
|
|
|
export function fetchOaInstanceDetail(id) {
|
|
return get(`/web/admin/oa-approval/instances/${encodeURIComponent(id)}`)
|
|
}
|
|
|
|
export function fetchApproveOaTask(taskId, comment) {
|
|
return post(`/web/admin/oa-approval/tasks/${encodeURIComponent(taskId)}/approve`, {
|
|
comment
|
|
})
|
|
}
|
|
|
|
export function fetchRejectOaTask(taskId, comment) {
|
|
return post(`/web/admin/oa-approval/tasks/${encodeURIComponent(taskId)}/reject`, {
|
|
comment
|
|
})
|
|
}
|
|
|
|
export function fetchReturnOaTask(taskId, comment) {
|
|
return post(`/web/admin/oa-approval/tasks/${encodeURIComponent(taskId)}/return`, {
|
|
comment
|
|
})
|
|
}
|
|
|
|
export function fetchAddSignOaTask(taskId, data) {
|
|
return post(`/web/admin/oa-approval/tasks/${encodeURIComponent(taskId)}/add-sign`, data)
|
|
}
|
|
|
|
export function fetchTransferOaTask(taskId, data) {
|
|
return post(`/web/admin/oa-approval/tasks/${encodeURIComponent(taskId)}/transfer`, data)
|
|
}
|
|
|
|
export function fetchWithdrawOaInstance(instanceId) {
|
|
return post(
|
|
`/web/admin/oa-approval/instances/${encodeURIComponent(instanceId)}/withdraw`,
|
|
{}
|
|
)
|
|
}
|
|
|
|
export function fetchMarkOaCcTaskRead(taskId) {
|
|
return post(`/web/admin/oa-approval/tasks/${encodeURIComponent(taskId)}/read`, {})
|
|
}
|
|
|
|
export { post, put }
|