import request from '@/utils/request';

/**
 * 详情
 */
export async function getById(id) {
  const res = await request.get(`/mes/applyoutsource/getById/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 指派
export async function outsourceAssign(data) {
  const res = await request.post(`/bpm/outsource/assign`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 不通过任务，关闭流程
export async function outsourceNotPass(data) {
  const res = await request.post(`/bpm/outsource/notPass`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
