Support filtered and selected rows for process defs, pending/completed tasks, and my applications. Co-authored-by: Cursor <cursoragent@cursor.com>
235 lines
5.5 KiB
TypeScript
235 lines
5.5 KiB
TypeScript
import request from '@/utils/http'
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// 流程定义
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export function fetchProcessDefList(params?: {
|
|
page?: number
|
|
pageSize?: number
|
|
keyword?: string
|
|
status?: string
|
|
}) {
|
|
return request.get<{
|
|
list: Api.Workflow.ProcessDefItem[]
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
totalPages: number
|
|
}>({
|
|
url: '/web/admin/workflow/defs',
|
|
params
|
|
})
|
|
}
|
|
|
|
export function fetchExportProcessDefs(data: Record<string, any>) {
|
|
return request.post({
|
|
url: '/web/admin/workflow/defs/export',
|
|
data,
|
|
responseType: 'blob'
|
|
})
|
|
}
|
|
|
|
export function fetchCreateProcessDef(data: {
|
|
processCode: string
|
|
processName: string
|
|
status?: string
|
|
orderNum?: number
|
|
remark?: string
|
|
}) {
|
|
return request.post<Api.Workflow.ProcessDefItem>({
|
|
url: '/web/admin/workflow/defs',
|
|
data,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchUpdateProcessDef(
|
|
id: string,
|
|
data: Partial<{
|
|
processCode: string
|
|
processName: string
|
|
status: string
|
|
orderNum: number
|
|
remark: string
|
|
}>
|
|
) {
|
|
return request.put<Api.Workflow.ProcessDefItem>({
|
|
url: `/web/admin/workflow/defs/${id}`,
|
|
data,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchDeleteProcessDef(id: string) {
|
|
return request.del({
|
|
url: `/web/admin/workflow/defs/${id}`,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// 发布版本
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export function fetchPublishVersion(
|
|
defId: string,
|
|
data: {
|
|
graphJson: string
|
|
nodes: Array<{
|
|
nodeKey: string
|
|
nodeType: string
|
|
nodeName?: string | null
|
|
configJson?: string | null
|
|
}>
|
|
transitions: Array<{
|
|
fromNodeKey: string
|
|
toNodeKey: string
|
|
conditionExpr?: string | null
|
|
}>
|
|
remark?: string
|
|
}
|
|
) {
|
|
return request.post({
|
|
url: `/web/admin/workflow/defs/${defId}/publish`,
|
|
data
|
|
})
|
|
}
|
|
|
|
export function fetchVersionList(defId: string) {
|
|
return request.get<Api.Workflow.VersionItem[]>({
|
|
url: `/web/admin/workflow/defs/${defId}/versions`
|
|
})
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// 设计器数据
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export function fetchDesignerData(defId: string) {
|
|
return request.get<Api.Workflow.DesignerData>({
|
|
url: `/web/admin/workflow/defs/${defId}/designer`
|
|
})
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// 流程实例
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export function fetchStartInstance(data: {
|
|
processCode: string
|
|
businessType?: string
|
|
businessId?: string
|
|
variables?: Record<string, any>
|
|
callbackUrl?: string
|
|
}) {
|
|
return request.post<{ instanceId: string }>({
|
|
url: '/web/admin/workflow/instances',
|
|
data
|
|
})
|
|
}
|
|
|
|
export function fetchInstanceDetail(instanceId: string) {
|
|
return request.get<Api.Workflow.InstanceDetail>({
|
|
url: `/web/admin/workflow/instances/${instanceId}`
|
|
})
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// 任务办理
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export function fetchPendingTasks(params?: { page?: number; pageSize?: number; keyword?: string }) {
|
|
return request.get<{
|
|
list: Api.Workflow.TaskItem[]
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
totalPages: number
|
|
}>({
|
|
url: '/web/admin/workflow/tasks/pending',
|
|
params
|
|
})
|
|
}
|
|
|
|
export function fetchExportPendingTasks(data: Record<string, any>) {
|
|
return request.post({
|
|
url: '/web/admin/workflow/tasks/pending/export',
|
|
data,
|
|
responseType: 'blob'
|
|
})
|
|
}
|
|
|
|
export function fetchCompletedTasks(params?: {
|
|
page?: number
|
|
pageSize?: number
|
|
keyword?: string
|
|
}) {
|
|
return request.get<{
|
|
list: Api.Workflow.TaskItem[]
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
totalPages: number
|
|
}>({
|
|
url: '/web/admin/workflow/tasks/completed',
|
|
params
|
|
})
|
|
}
|
|
|
|
export function fetchExportCompletedTasks(data: Record<string, any>) {
|
|
return request.post({
|
|
url: '/web/admin/workflow/tasks/completed/export',
|
|
data,
|
|
responseType: 'blob'
|
|
})
|
|
}
|
|
|
|
export function fetchApproveTask(taskId: string, data?: { commentText?: string }) {
|
|
return request.post({
|
|
url: `/web/admin/workflow/tasks/${taskId}/approve`,
|
|
data,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchRejectTask(taskId: string, data?: { commentText?: string }) {
|
|
return request.post({
|
|
url: `/web/admin/workflow/tasks/${taskId}/reject`,
|
|
data,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchMyInstances(params?: {
|
|
page?: number
|
|
pageSize?: number
|
|
keyword?: string
|
|
status?: string
|
|
}) {
|
|
return request.get<{
|
|
list: Api.Workflow.MyInstanceItem[]
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
totalPages: number
|
|
}>({
|
|
url: '/web/admin/workflow/instances/my',
|
|
params
|
|
})
|
|
}
|
|
|
|
export function fetchExportMyInstances(data: Record<string, any>) {
|
|
return request.post({
|
|
url: '/web/admin/workflow/instances/my/export',
|
|
data,
|
|
responseType: 'blob'
|
|
})
|
|
}
|
|
|
|
export function fetchBusinessAllTasks(businessType: string, businessId: string) {
|
|
return request.get<Api.Workflow.BusinessAllTasks>({
|
|
url: `/web/admin/workflow/instances/by-business/${businessType}/${businessId}`
|
|
})
|
|
}
|