import request from '@/utils/request';

// 列表
export async function getPage(params) {
  const res = await request.get(`/main/meterModel/page`, { params });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 修改
export async function saveOrEdit(data) {
  const res = await request.post(`/main/meterModel/saveOrEdit`, data);
  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(`/main/meterModel/getById/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 删除
export async function del(data) {
  const res = await request.delete(`/main/meterModel/del`, { data });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
