import request from '@/utils/request';


/**
 * 异常列表
 */
export async function getList(data) {
  const res = await request.post('/mes/exception_management/page', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

//新建/修改
export async function save(data) {
  const res = await request.post('/mes/exception_management/' + (data.id ? 'update' : 'add'), data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
//处置
export async function dispose(data) {
  const res = await request.post('mes/exception_management_detail/dispose', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 删除
export async function remove(data) {
  const res = await request.delete('/mes/exception_management/remove' ,{data});
  if (res.data.code == 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
//提交
export async function submit(data) {
  const res = await request.post('/bpm/exception/submit', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
