| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- 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 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 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 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 fetchBusinessAllTasks(businessType: string, businessId: string) {
- return request.get<Api.Workflow.BusinessAllTasks>({
- url: `/web/admin/workflow/instances/by-business/${businessType}/${businessId}`
- })
- }
|