import axios from '@/utils/request'
const baseURL = import.meta.env.VITE_APP_BASE_PROCESS_API;
// 查询分页数据：
export const getProcessInstancePage = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: '/engine-rest/history/process-instance',
    method: 'get',
    params: {
      ...arg,
      sortOrder: 'desc',
      sortBy: 'startTime',
    },
    dataType: 'json'
  })
}
// 查询详情数据：
export const getProcessInstanceDetail = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: `/sys/ProcessInstance/${arg}`,
    method: 'get',
    params: arg,
    dataType: 'json'
  })
}

// 添加数据：
export const addProcessInstance = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: '/sys/ProcessInstance',
    method: 'post',
    data: arg,
    dataType: 'json'
  })
}

// 修改数据：
export const updateProcessInstance = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: '/sys/ProcessInstance',
    method: 'put',
    data: arg,
    dataType: 'json'
  })
}

// 删除数据:
export const deleteProcessInstance = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: `/engine-rest/process-instance/${arg.id[0]}`,
    method: 'delete',
    // data: arg,
    dataType: 'json'
  })
}


// 启动流程:
export const start = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: `/start`,
    method: 'post',
    data: arg,
    dataType: 'json'
  })
}