import apis from '../utils/request';
const { GET, POST, PUT, DELETE } = apis

// 检索园区路线列表
export const getMeterReadingRouteList = async function(keyword) {
  return await GET(`/park/route/list?keyword=${keyword}`);
}

// 更新园区路线状态
export const changeMeterRouteStatus = async function(data) {
  return await PUT(`/park/route/${data?.id}/status/update`, data);
}

// 检索电表路线详细
export const getMeterReadingRouteDetail = async function(id) {
  return await GET(`/park/meter/${id}/route/list`);
}

// 抄表路线中的表计详细信息
export const getMeterReadingRouteMeterDetail = async function(id) {
  return await GET(`/route/meter/${id}`);
}

// 新建一条抄表记录
export const createReading = async function(park, code, routeId, data) {
  return await POST(`/reading/hand/${park}/${code}?parkRouteId=${routeId}`, data);
}


// 查询符合指定条件的抄表记录
export const getReadingList = async function(park, keyword, page) {
  return await GET(`/reading/${park}?keyword=${keyword}&page=${page}`,);
}

// 删除抄表记录
export const deleteReading = async function(id, overall) {
  return await DELETE(`/meter/delete/records/${id}`, { overall });
}

// 修改抄表记录
export const updateReading = async function(park, code, read_at, data) {
  return await PUT(`/reading/${park}/${code}/${read_at}`, data);
}
// 检查是否抄表完全
export const checkReadingFinish = async function(id) {
  return await GET(`/park/meter/${id}/route/status`,);
}

// 获取工作台首页
export const getWorkBenchHome = async function() {
  return await GET(`/workHome/mainPage`,);
}

// 获取工单列表
export const getWorkOrderList = async function({
  page, size, park = "", meter = "", tenement = "", status = "", type = "", time = ""
}) {
  return await GET(`/noticeFlow/getDisposeList?page=${page}&size=${size}&park=${park}&meter=${meter}&tenement=${tenement}&status=${status}&type=${type}&time=${time}`,);
}

// 确认当前流程
export const doNoticeFlow = async function(id) {
  return await PUT(`/noticeFlow/${id}/meter/dispose`,);
}

// 当前流程详情
export const getNoticeFlowDetail = async function(id) {
  return await GET(`/noticeFlow/${id}/detail`,);
}

