import { $postParam, $post } from "@/plugins/axios";

// other
// 试卷编号模糊查询
export const pageNumberQuery = (datas) => {
  return $postParam("/api/admin/exam/task/paper_number_query", datas);
};
// 命题老师模糊查询
export const questionTeatherQuery = (datas) => {
  return $postParam("/api/admin/exam/task/user_query", datas);
};
// 机构查询
export const teachingRoomList = (datas) => {
  return $postParam("/api/admin/exam/task/room_query", datas);
};

// 待办任务-------------->
// 命题任务待办
export const waitExamTaskListPage = (datas) => {
  return $postParam("/api/admin/work/exam/task/ready", datas);
};
export const waitExamTaskCount = () => {
  return $postParam("/api/admin/work/exam/task/ready_count", {});
};
// 阅卷待办
export const stmmsWaitTaskListPage = (datas) => {
  return $postParam("/api/admin/work/structure/task/ready", datas);
};
export const stmmsWaitTaskCount = () => {
  return $postParam("/api/admin/work/structure/task/ready_count", {});
};
// 教研待办
export const analysisWaitTaskListPage = (datas) => {
  return $postParam("/api/admin/work/grade/task/ready", datas);
};
export const analysisWaitTaskCount = () => {
  return $postParam("/api/admin/work/grade/task/ready_count", {});
};
// 评卷待办
export const markWaitTaskListPage = (datas) => {
  return $postParam("/api/admin/work/mark/task/ready", datas);
};
export const markWaitTaskCount = () => {
  return $postParam("/api/admin/work/mark/task/ready_count", {});
};
// 已办任务数量
export const auditedTaskCount = () => {
  return $postParam("/api/admin/exam/task/review_list_audited_count", {});
};

// exam-task-manage
export const examTaskListPage = (datas) => {
  return $postParam("/api/admin/exam/task/list", datas);
};
export const updateExamTask = (datas) => {
  return $post("/api/admin/exam/task/save", datas);
};
export const updatExamTaskTeacher = ({ id, userId }) => {
  return $post("/api/admin/exam/task/assign_user", { id, userId });
};
export const ableExamTask = ({ id, enable }) => {
  return $post("/api/admin/exam/task/enable", { id, enable });
};
export const deleteExamTask = (idList) => {
  return $postParam("/api/admin/exam/task/delete", { idList });
};
export const batchAddExamTask = (datas) => {
  return $post("/api/admin/exam/task/save_batch", datas);
};
export const taskApplyAuditHistory = (flowId) => {
  return $postParam("/api/admin/exam/task/review_list", { flowId });
};
export const taskApplySubmitHistory = (examTaskId) => {
  return $postParam("/api/admin/flow/task/approver/submit/list", {
    examTaskId,
  });
};
export const taskApplyExamObject = ({ paperNumber, examId }) => {
  return $postParam("/api/admin/exam/task/find_exam_object", {
    paperNumber,
    examId,
  });
};
export const examTaskApproveForm = (datas) => {
  // examTaskId or examId and paperNumber
  return $postParam("/api/admin/exam/task/find_approve_form_json", datas);
};
export const downloadExamTaskApproveForm = ({ examTaskId, htmlContent }) => {
  return $post(
    "/api/admin/exam/task/find_approve_form_pdf",
    {
      examTaskId,
      htmlContent,
    },
    { responseType: "blob" }
  );
};
export const examTaskGetOne = (examTaskId) => {
  return $postParam("/api/admin/exam/task/exam_task_get_one", {
    examTaskId,
  });
};

// task-apply-manage
export const taskApplyListPage = (datas) => {
  return $postParam("/api/admin/exam/task/apply_list", datas);
};
export const taskApplyDetail = (examTaskId, source = "") => {
  return $postParam("/api/admin/exam/task/apply_get_one", {
    examTaskId,
    source,
  });
};
export const updateTaskApply = (datas) => {
  return $post("/api/admin/exam/task/apply_save", datas);
};
export const cancelOrRestartTaskApply = ({ id, status }) => {
  return $post("/api/admin/exam/task/apply_status", { id, status });
};
export const deleteTaskApply = (id) => {
  return $postParam("/api/admin/exam/task/apply_delete", { id });
};
// exam-flow
export const taskAllFlowSetups = (flowId) => {
  return $postParam("/api/admin/flow/task/all", { flowId });
};
export const taskAllApproverPeople = ({ taskId, courseId }) => {
  return $postParam("/api/admin/flow/task/approver/people_all", {
    taskId,
    courseId,
  });
};

export const taskAllApproverExchangePeople = ({ taskId, realName }) => {
  return $postParam("/api/admin/flow/task/approver/exchange/people", {
    taskId,
    realName,
  });
};
export const taskApproverNextPeople = ({ taskId, courseId }) => {
  return $postParam("/api/admin/flow/task/approver/next/people", {
    taskId,
    courseId,
  });
};
// 命题老师创建命题任务
export const teacherCreateTaskApply = (datas) => {
  return $post("/api/admin/exam/task/save_task_apply", datas);
};
export const teacherSubmitTaskApply = (datas) => {
  return $post("/api/admin/exam/task/submit_task_apply", datas);
};
export const teacherCancelTaskApply = (examTaskId) => {
  return $postParam("/api/admin/exam/task/remove_task_apply", { examTaskId });
};
export const switchCardCreateMethod = (examTaskId) => {
  return $postParam("/api/admin/exam/task/switch_card", { examTaskId });
};
export const uploadOrFindExamTaskStudent = (datas) => {
  return $postParam(
    "/api/admin/exam/task/find_exam_task_student_object",
    datas
  );
};
// 从题库选择试卷 创建命题任务
export const tikuPaperListQuery = (datas) => {
  return $postParam("/api/admin/exam/task/page_tiku_paper", datas);
};
export const tikuPaperDetail = (datas) => {
  return $postParam("/api/admin/exam/task/get_tiku_paper_data", datas);
};

// task-review-manage
export const taskReviewUnauditedListPage = (datas) => {
  return $postParam("/api/admin/exam/task/review_list_unaudited", datas);
};
export const taskReviewAuditedListPage = (datas) => {
  return $postParam("/api/admin/exam/task/review_list_audited", datas);
};
export const taskAuditApply = (datas) => {
  return $post("/api/admin/exam/task/apply_resave", datas);
};
export const batchUpdateTaskReview = (datas) => {
  return $post("/api/admin/exam/task/review_save_batch", datas);
};
export const reviewSampleDataExport = (datas) => {
  return $post("/api/admin/exam/task/review_export", datas);
};
// task-paper-manage
export const taskPaperListPage = (datas) => {
  return $postParam("/api/admin/exam/task/paper_list", datas);
};
export const ableTaskPaper = ({ id, enable }) => {
  return $post("/api/admin/exam/task/paper_enable", { id, enable });
};
export const cancelTaskPaper = ({ id, cancelRemark }) => {
  return $postParam("/api/admin/exam/task/cancel", { id, cancelRemark });
};
export const restartTaskPaper = ({ examTaskId, paperType }) => {
  return $post("/api/admin/exam/task/restart", { examTaskId, paperType });
};
export const taskPaperApplyEdit = (datas) => {
  return $post("/api/admin/exam/task/paper_update", datas);
};
export const downloadPaper = (examTaskId) => {
  return $postParam(
    "/api/admin/exam/task/paper_download",
    { examTaskId },
    { responseType: "blob" }
  );
};
export const paperAndCardBatchExport = (datas) => {
  return $postParam("/api/admin/exam/task/paper_card_download_pdf", datas);
};
// publish-print-task
export const listTaskPrint = (datas) => {
  return $postParam("/api/admin/exam/task/list_task_print", datas);
};
export const createTaskPrint = (datas) => {
  return $post("/api/admin/exam/task/save_task_print", datas);
};
export const removeTaskPrint = (examTaskPrintId) => {
  return $postParam("/api/admin/exam/task/remove_task_print", {
    examTaskPrintId,
  });
};
export const listTaskPrintStudent = (datas) => {
  return $postParam("/api/admin/exam/task/list_task_print_student", datas);
};
export const submitTaskPrint = (datas) => {
  return $post("/api/admin/exam/task/submit_task_print", datas);
};

// 班级查询
export const listTaskPrintClass = (datas) => {
  return $postParam("/api/admin/exam/task/list_task_print_class", datas);
};
export const listTaskApplyClass = (datas) => {
  return $postParam("/api/admin/exam/task/list_task_apply_class", datas);
};
// 印刷室查询
export const listTaskPrintHouse = (datas) => {
  return $postParam("/api/admin/exam/task/list_task_print_house", datas);
};

// card
export const cardForSelectList = (datas) => {
  return $postParam("/api/admin/exam/card/select_card_list", datas);
};

// data-manage ie-task-manage
export const dataTaskList = (datas) => {
  return $postParam("/api/admin/data/task/query_result", datas);
};
export const taskResetPdf = (id) => {
  return $postParam("/api/admin/data/task/reset_create_pdf", { id });
};
export const removeDataTask = ({ ids, type }) => {
  return $post("/api/admin/data/task/query11", { ids, type });
};

// statistics-manage
export const statisticsList = (datas) => {
  return $postParam("/api/admin/statistics/list", datas);
};
export const statisticsDelete = (ids) => {
  return $post("/api/admin/statistics/delete", { ids });
};
export const statisticsFreshen = (datas) => {
  return $postParam("/api/admin/statistics/freshen", datas);
};
// download-manage
export const dataDownloadList = (datas) => {
  return $postParam("/api/admin/data/download/page", datas);
};
export const dataDownloadDetail = (id) => {
  return $postParam(
    "/api/admin/data/download/download_one",
    { id },
    {
      responseType: "blob",
    }
  );
};
export const dataBatchDownload = (datas) => {
  return $post("/api/admin/data/download/download_batch", datas);
};
// action-log-manage
export const actionLogList = (datas) => {
  return $postParam("/api/admin/basic/operation_log/query", datas);
};
export const savePreviewLog = (datas) => {
  // examTaskId,paperType,type
  return $postParam("/api/admin/basic/operation_log/save_preview_log", datas);
};

// pdf-build-manage
export const pdfBuildListPage = (datas) => {
  return $postParam("/api/admin/data/task/page_pdf_create", datas);
};
