import request from '@/utils/request';
export async function workPage(data) {
  const res = await request.get('/eam/workordermaintenance/page', {
    params: data
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function maintenanceDetail(workOrderId) {
  const res = await request.get(
    `/eam/workordermaintenance/maintenanceDetail/${workOrderId}`
  );
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 报工
export async function report(data) {
  const res = await request.post('/eam/workordermaintenance/report', data);
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 查询设备工单信息
export async function deviceWorkList(data) {
  const res = await request.get(`/eam/plan/deviceWorkList`, {
    params: data
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
