import request from '@/utils/request';




// 列表 

export async function getList (data) {
  let par = new URLSearchParams(data);
  const res = await request.get(`/qms/qualitylevel/page?` + par, {});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}


  

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




  // 编辑
  export async function update (data) {
    const res = await request.put(`/qms/qualitylevel/update`, data);
    if (res.data.code == 0) {
      return res.data.message;
    }
    return Promise.reject(new Error(res.data.message));
  }
  
// 删除
export async function removeItem (data) {
  const res = await request.delete('/qms/qualitylevel/delete', { data });
  if (res.data.code == 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}


// 批量保存
export async function saveBatch (data) {
  const res = await request.post(`/qms/qualitylevel/saveBatch`, data);
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

