import request from '@/utils/request';


/**
 * 列表
 */
export async function getList(data) {
  const res = await request.post('/mes/please_entrust_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/please_entrust_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 remove(data) {
  const res = await request.delete('/mes/please_entrust_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/please_entrust/submit', data);
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// please_entrust_management/warehouseEntry/?id=132133123&warehouseId=123131
// 申请入库
export async function warehouseEntry (params) {
  const res = await request.get(`/mes/please_entrust_management/warehouseEntry`, { params });
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}