import request from "@/Utils/requestUtils.js";
import $api from "@/Apis/api";
// 任务中心接口
export const planTaskService = {
  addOrUpdateRoutinePlan: (data) => {
    return request.post(
      $api.taskCenter.taskSet.planTask.addOrUpdateRoutinePlan,
      data
    );
  },
  planPageList: (data) => {
    return request.post($api.taskCenter.taskSet.planTask.planPageList, data);
  },
  planoprationPageList: (data) => {
    return request.post(
      $api.taskCenter.taskSet.planTask.planoprationPageList,
      data
    );
  },
  setPlanStatus: (data) => {
    return request.post($api.taskCenter.taskSet.planTask.setPlanStatus, data);
  },
  getPlanListInfo: (data) => {
    return request.get($api.taskCenter.taskSet.planTask.getPlanListInfo, {
      params: data,
    });
  },
};
// 设备维护任务设置
export const deviceTaskService = {
  planUserList: (data) => {
    return request.post($api.taskCenter.taskSet.deviceTask.planUserList, data);
  }, //查询计划可设置人员
  getPlanUserList: (data) => {
    return request.get($api.taskCenter.taskSet.deviceTask.getPlanUserList, {
      params: data,
    });
  }, //已选中计划人员
  getRoutinePlanWorkGroupList: (data) => {
    return request.post(
      $api.taskCenter.taskSet.planTask.getRoutinePlanWorkGroupList,
      data
    );
  },
  getPlanWorkGroupList: (data) => {
    return request.get($api.taskCenter.taskSet.planTask.getPlanWorkGroupList, {
      params: data,
    });
  },
  addDevOpsPlan: (data) => {
    return request.post($api.taskCenter.taskSet.deviceTask.addDevOpsPlan, data);
  },
  planDevOpsPageList: (data) => {
    return request.post(
      $api.taskCenter.taskSet.deviceTask.planDevOpsPageList,
      data
    );
  },
  removePlan: (data) => {
    return request.get($api.taskCenter.taskSet.deviceTask.removePlan, {
      params: data,
    });
  },
  updateDevOpsPlan: (data) => {
    return request.post(
      $api.taskCenter.taskSet.deviceTask.updateDevOpsPlan,
      data
    );
  },
  planDevopsExport: (data) => {
    return request
      .post($api.taskCenter.taskSet.deviceTask.planDevopsExport, data, {
        responseType: "blob",
      })
      .then((res) => {
        request.download("设备维护任务记录", res);
      });
  },
  setPlanFlag: (data) => {
    return request.post($api.taskCenter.taskSet.planTask.setPlanFlag, data);
  },
};

// 指派任务
export const assignTaskService = {
  planPageList(data) {
    return request.post($api.taskCenter.taskSet.assignTask.planPageList, data);
  },
  removePlan(data) {
    return request.get($api.taskCenter.taskSet.assignTask.removePlan, {
      params: data,
    });
  },
  addOrUpdateAppointPlan(data) {
    return request.post(
      $api.taskCenter.taskSet.assignTask.addOrUpdateAppointPlan,
      data
    );
  },
  setPlanStatus(data) {
    return request.post($api.taskCenter.taskSet.assignTask.setPlanStatus, data);
  },
  appointPlanUserList(data) {
    return request.post(
      $api.taskCenter.taskSet.assignTask.appointPlanUserList,
      data
    );
  },
  getPlanUserList(data) {
    return request.get($api.taskCenter.taskSet.assignTask.getPlanUserList, {
      params: data,
    });
  },
  planAppointExport(data) {
    return request
      .post($api.taskCenter.taskSet.assignTask.planAppointExport, data, {
        responseType: "blob",
      })
      .then((res) => {
        request.download("指派任务记录", res);
      });
  },
  getRoutinePlanWorkGroupList(data) {
    return request.post(
      $api.taskCenter.taskSet.assignTask.getRoutinePlanWorkGroupList,
      data
    );
  },
  getPlanWorkGroupList(planId) {
    return request.get(
      $api.taskCenter.taskSet.assignTask.getPlanWorkGroupList,
      {
        params: planId,
      }
    );
  },
};
// 打卡记录
export const attendanceService = {
  pageList(data) {
    return request.post($api.taskCenter.attendance.pageList, data);
  },
  export(data) {
    return request
      .post($api.taskCenter.attendance.export, data, {
        responseType: "blob",
      })
      .then((res) => {
        request.download("打卡记录", res);
      });
  },
};
// 保洁任务
export const purifierTaskService = {
  pageList(data) {
    return request.post($api.taskCenter.purifierTask.pageList, data);
  },
  export(data) {
    return request
      .post($api.taskCenter.purifierTask.export, data, {
        responseType: "blob",
      })
      .then((res) => {
        request.download("保洁任务记录", res);
      });
  },
  look(data) {
    return request.post($api.taskCenter.purifierTask.look, data);
  },
  cancel(data) {
    return request.post($api.taskCenter.purifierTask.cancel, data);
  },
  gridTree(districtId) {
    return request.get($api.basicInfo.regionalGridManage.gridTree, {
      params: districtId,
    });
  },
};
// 用户上报管理
export const userReportService = {
  pageList(data) {
    return request.post($api.taskCenter.userReport.pageList, data);
  },
  userReportExport(data) {
    return request
      .post($api.taskCenter.userReport.export, data, {
        responseType: "blob",
      })
      .then((res) => {
        request.download("用户上报管理纪录", res);
      });
  },
  userSelectList(data) {
    return request.post($api.taskCenter.userReport.userSelectList, data);
  },
  add(data) {
    return request.post($api.taskCenter.userReport.add, data);
  },
  update(data) {
    return request.post($api.taskCenter.userReport.update, data);
  },
  delete(data) {
    return request.post($api.taskCenter.userReport.delete, data);
  },
};
export const patrolTaskService = {
  statistics: data => {
    return request.post($api.taskCenter.patrolTask.statistics, data)
  },//统计查询：
  pageList: data => {
    return request.post($api.taskCenter.patrolTask.pageList, data)
  },//列表查询：
  export: data => {
    return request.post($api.taskCenter.patrolTask.export, data, {
      responseType: "blob",
    }).then((res) => {
      request.download("巡检任务", res);
    });
  },//导出：
  cancel: data => {
    return request.post($api.taskCenter.patrolTask.cancel, data)
  },//取消任务：
  look: data => {
    return request.post($api.taskCenter.patrolTask.look, data)
  },//查看任务：
  scenesPageList: data => {
    return request.post($api.taskCenter.patrolTask.scenesPageList, data)
  },//明细列表
  scenesExport: data => {
    return request.post($api.taskCenter.patrolTask.scenesExport, data, {
      responseType: "blob",
    }).then((res) => {
      request.download("巡检任务明细", res);
    });
  },//明细导出
  lookInspectDetail: data => {
    return request.post($api.taskCenter.patrolTask.lookInspectDetail, data)
  },//巡检点详情
  inspectPlanList: data => {
    return request.post($api.taskCenter.patrolTask.inspectPlanList, data)
  },//巡检计划查询
  planInspectExport: data => {
    return request.post($api.taskCenter.patrolTask.planInspectExport, data, {
      responseType: "blob",
    }).then((res) => {
      request.download("巡检计划", res);
    });
  },//巡检计划导出
  setWageHout: data => {
    return request.post($api.taskCenter.patrolTask.setWageHout, data)
  }//计划工时设置
};
// 用户上报任务
export const userReportTaskService = {
  pageList(data) {
    return request.post($api.taskCenter.userReportTask.pageList, data);
  },
  userReportTaskExport(data) {
    return request
      .post($api.taskCenter.userReportTask.export, data, {
        responseType: "blob",
      })
      .then((res) => {
        request.download("用户上报管理纪录", res);
      });
  },
  delete(data) {
    return request.post($api.taskCenter.userReportTask.delete, data);
  },
  cancel(data) {
    return request.post($api.taskCenter.userReportTask.cancel, data);
  },
  look(data) {
    return request.post($api.taskCenter.userReportTask.look, data);
  },
  wageSet(data) {
    return request.post($api.taskCenter.userReportTask.wageSet, data);
  },
  setTaskOrder(data) {
    return request.post($api.taskCenter.userReportTask.setTaskOrder, data);
  },
};
export const setPlanTaskOrderService = {
  setPlanTaskOrder(data) {
    return request.post($api.taskCenter.planSetPlanTaskOrder.setPlanTaskOrder, data);
  },
}
