import request from '@/utils/request';

// 查询实例详情
export async function getDetail(id) {
  const res = await request.get(`main/asset/getPhysicalModel/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// 查询实例详情
export async function getRealData(id) {
  const res = await request.get(`main/asset/getRealData/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 查询实例详情
export async function getHistoryData(data) {
  const res = await request.post(`main/asset/getHistoryData`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 查询实例详情
export async function getPhysicalModel(id) {
  const res = await request.get(`main/asset/getPhysicalModel/${id}`);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 保存仪表盘配置
export async function updateIotDashboardPosition(data) {
  const res = await request.post(`main/asset/updateIotDashboardPosition`, data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
