import axios from '@/utils/request'
const baseURL = import.meta.env.VITE_APP_BASE_PROCESS_API;
// 查询分页数据：
export const getProcessPage = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: '/engine-rest/process-definition',
    method: 'get',
    params: {
      ...arg,
      latestVersion: true
    },
    dataType: 'json'
  })
}
// 查询详情数据：
export const getProcessDetail = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: `/sys/Process/${arg}`,
    method: 'get',
    params: arg,
    dataType: 'json'
  })
}

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

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

// 删除数据:
export const deleteProcess = (arg) => {
  return axios.request({
    baseURL: baseURL,
    url: `/engine-rest/process-definition/${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'
  })
}