123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- <template>
- <div class="task-review-manage">
- <div class="mb-4 tab-btns">
- <el-button
- v-for="(val, key) in AUDITING_TYPE"
- :key="key"
- size="medium"
- :type="auditStatus == key ? 'primary' : 'default'"
- @click="selectMenu(key)"
- >{{ val }}</el-button
- >
- </div>
- <div class="part-box part-box-filter">
- <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
- <template
- v-if="
- (AUDITED && checkPrivilege('condition', 'reviewCondition')) ||
- (!AUDITED && checkPrivilege('condition', 'notReviewCondition'))
- "
- >
- <secp-select
- v-model="filter"
- defaultSelectExam
- @exam-default="toPage(1)"
- ></secp-select>
- <el-form-item label="命题老师:">
- <question-teacher-select
- ref="QuestionTeacherSelect"
- v-model="filter.userId"
- :course-code="filter.courseCode"
- placeholder="命题老师"
- ></question-teacher-select>
- </el-form-item>
- <el-form-item label="命题时间:">
- <el-date-picker
- v-model="createTime"
- type="datetimerange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="命题开始时间"
- end-placeholder="命题结束时间"
- value-format="timestamp"
- align="right"
- unlink-panels
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="申请时间:">
- <el-date-picker
- v-model="applyTime"
- type="datetimerange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="申请开始时间"
- end-placeholder="申请结束时间"
- value-format="timestamp"
- align="right"
- unlink-panels
- >
- </el-date-picker>
- </el-form-item>
- </template>
- <el-form-item label-width="0px">
- <el-button
- v-if="
- (AUDITED && checkPrivilege('button', 'reviewSelect')) ||
- (!AUDITED && checkPrivilege('button', 'notReviewSelect'))
- "
- type="primary"
- @click="toPage(1)"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="box-justify" v-if="!AUDITED">
- <div>
- <el-button
- v-if="checkPrivilege('button', 'notReviewExport')"
- icon="el-icon-download"
- type="success"
- :disabled="loading"
- @click="toExport"
- >
- 导出审核样本
- </el-button>
- <el-button
- v-if="checkPrivilege('button', 'notReviewExport')"
- type="primary"
- icon="el-icon-s-order"
- @click="toDataTask"
- >导出结果查询</el-button
- >
- </div>
- <div>
- <!-- <el-button
- v-if="checkPrivilege('button', 'notReviewBatchNotPass')"
- icon="el-icon-circle-close"
- type="danger"
- @click="toBatchAudit(0)"
- >
- 批量不通过
- </el-button> -->
- <el-button
- v-if="checkPrivilege('button', 'notReviewBatchPass')"
- icon="el-icon-circle-check"
- type="primary"
- @click="toBatchAudit(1)"
- >
- 批量通过
- </el-button>
- </div>
- </div>
- </div>
- <div class="part-box part-box-pad">
- <el-table
- ref="TableList"
- :data="examTasks"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- v-if="!AUDITED"
- type="selection"
- fixed="left"
- width="55"
- align="center"
- :selectable="checkAbleSelected"
- ></el-table-column>
- <el-table-column
- type="index"
- label="序号"
- width="70"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column
- prop="semesterName"
- label="学期"
- min-width="210"
- ></el-table-column>
- <el-table-column
- prop="examName"
- label="考试"
- min-width="160"
- ></el-table-column>
- <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
- <el-table-column prop="courseName" label="课程(代码)">
- <template slot-scope="scope">
- {{ scope.row.courseName }}({{ scope.row.courseCode }})
- </template>
- </el-table-column>
- <el-table-column
- prop="userName"
- label="命题老师"
- width="100"
- ></el-table-column>
- <el-table-column prop="startTime" label="命题开始时间">
- <span slot-scope="scope">{{
- scope.row.startTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="endTime" label="命题结束时间">
- <span slot-scope="scope">{{
- scope.row.endTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="createTime" label="申请时间">
- <template slot-scope="scope">
- {{ scope.row.createTime | timestampFilter }}
- </template>
- </el-table-column>
- <el-table-column class-name="action-column" label="操作" width="80px">
- <template slot-scope="scope">
- <el-button
- v-if="AUDITED && checkPrivilege('link', 'reviewPreview')"
- class="btn-primary"
- type="text"
- @click="toPreview(scope.row)"
- >查看详情</el-button
- >
- <el-button
- v-if="
- !AUDITED &&
- checkPrivilege('link', 'notReviewEdit') &&
- scope.row.myself
- "
- class="btn-primary"
- type="text"
- @click="toEdit(scope.row)"
- >审核</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- background
- layout="total, sizes, prev, pager, next, jumper"
- :pager-count="5"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- @size-change="pageSizeChange"
- >
- </el-pagination>
- </div>
- </div>
- <!-- ModifyTaskApply -->
- <modify-task-apply
- v-if="
- checkPrivilege('link', 'notReviewEdit') ||
- checkPrivilege('link', 'reviewPreview')
- "
- ref="ModifyTaskApply"
- :edit-type="editType"
- :instance="curExamTask"
- @modified="taskModified"
- ></modify-task-apply>
- <!-- audit-dialog-->
- <el-dialog
- :visible.sync="auditDialogShow"
- title="审核不通过"
- width="500px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- >
- <el-form ref="AuditForm" :rules="auditRules" :model="auditModal">
- <el-form-item prop="reason">
- <el-input
- class="mb-2"
- v-model="auditModal.reason"
- type="textarea"
- resize="none"
- :rows="5"
- :maxlength="1000"
- clearable
- show-word-limit
- placeholder="建议不超过1000个字"
- ></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button type="primary" @click="auditNotPass">确认</el-button>
- <el-button type="danger" @click="auditDialogShow = false" plain
- >取消</el-button
- >
- </div>
- </el-dialog>
- <!-- data-task-dialog -->
- <data-task-dialog
- v-if="checkPrivilege('button', 'notReviewExport')"
- ref="DataTaskDialog"
- task-type="SAMPLE_EXPORT"
- ></data-task-dialog>
- </div>
- </template>
- <script>
- import ModifyTaskApply from "../components/ModifyTaskApply";
- import pickerOptions from "@/constants/datePickerOptions";
- import {
- taskReviewAuditedListPage,
- taskReviewUnauditedListPage,
- batchUpdateTaskReview,
- reviewSampleDataExport,
- } from "../api";
- import { mapActions } from "vuex";
- export default {
- name: "task-review-manage",
- components: {
- ModifyTaskApply,
- },
- data() {
- return {
- auditStatus: "NOT_AUDITED",
- filter: {
- semesterId: "",
- examId: "",
- userId: "",
- cardRuleId: "",
- courseCode: "",
- paperNumber: "",
- startTime: null,
- endTime: null,
- startCreateTime: null,
- endCreateTime: null,
- createName: "",
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- editType: "AUDIT",
- AUDITING_TYPE: {
- NOT_AUDITED: "未审核",
- AUDITED: "已审核",
- },
- caches: {},
- examTasks: [],
- curExamTask: {},
- multipleSelection: [],
- loading: false,
- curUserId: this.$ls.get("user", { id: "" }).id,
- // audit-dialog
- auditDialogShow: false,
- auditModal: { reason: "" },
- auditRules: {
- reason: [
- { required: true, message: "请输入审核意见", trigger: "change" },
- ],
- },
- // date-picker
- createTime: [],
- applyTime: [],
- pickerOptions,
- };
- },
- computed: {
- AUDITED() {
- return this.auditStatus === "AUDITED";
- },
- },
- methods: {
- ...mapActions("exam", ["updateWaitTaskCount"]),
- async getList() {
- const valid =
- (this.AUDITED && this.checkPrivilege("list", "reviewList")) ||
- (!this.AUDITED && this.checkPrivilege("list", "notReviewList"));
- if (!valid) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size,
- };
- if (this.createTime) {
- datas.startTime = this.createTime[0];
- datas.endTime = this.createTime[1];
- }
- if (this.applyTime) {
- datas.startCreateTime = this.applyTime[0];
- datas.endCreateTime = this.applyTime[1];
- }
- const func = this.AUDITED
- ? taskReviewAuditedListPage
- : taskReviewUnauditedListPage;
- const data = await func(datas);
- this.examTasks = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- this.multipleSelection = [];
- },
- handleSelectionChange(val) {
- this.multipleSelection = val.map((item) => item.id);
- console.log(this.multipleSelection);
- },
- checkAbleSelected(row) {
- return row.myself;
- },
- selectMenu(val) {
- if (this.auditStatus === val) return;
- this.caches[this.auditStatus] = {
- current: this.current,
- examTasks: this.examTasks,
- total: this.total,
- };
- this.auditStatus = val;
- if (this.caches[val] && this.caches[val].examTasks) {
- this.current = this.caches[val].current;
- this.total = this.caches[val].total;
- this.examTasks = this.caches[val].examTasks;
- } else {
- this.toPage(1);
- }
- },
- toBatchAudit(isPass) {
- if (!this.multipleSelection.length) {
- this.$message.error("请选择要审核的记录!");
- return;
- }
- const actionName = isPass ? "通过" : "不通过";
- this.$confirm(`确定${actionName}这些申请吗?`, "提示", {
- type: "warning",
- })
- .then(() => {
- this.auditModal.reason = "";
- if (isPass) {
- this.auditApply("PASS", this.multipleSelection);
- } else {
- this.auditDialogShow = true;
- }
- })
- .catch(() => {});
- },
- async auditNotPass() {
- const valid = await this.$refs.AuditForm.validate().catch(() => {});
- if (!valid) return;
- await this.auditApply("NOT_PASS", this.multipleSelection);
- this.auditDialogShow = false;
- },
- async auditApply(type, ids) {
- const data = await batchUpdateTaskReview({
- reviewStatus: type,
- examTaskIds: ids,
- reason: this.auditModal.reason,
- }).catch(() => {});
- if (!data) return;
- this.$message.success("审核成功!");
- this.taskModified();
- },
- async toExport() {
- if (!this.multipleSelection.length) {
- this.$message.error("请选择要导出的记录!");
- return;
- }
- if (this.loading) return;
- this.loading = true;
- const res = await reviewSampleDataExport({
- ids: this.multipleSelection,
- }).catch(() => {});
- this.loading = false;
- if (res) {
- this.$message.success("导出任务已提交!");
- } else {
- this.$message.error("导出任务提交失败,请重新尝试!");
- }
- },
- toEdit(row) {
- this.curExamTask = { ...row, source: "REVIEW" };
- this.editType = "AUDIT";
- this.$refs.ModifyTaskApply.open();
- },
- toPreview(row) {
- this.curExamTask = { ...row, source: "REVIEW" };
- this.editType = "PREVIEW";
- this.$refs.ModifyTaskApply.open();
- },
- taskModified() {
- this.getList();
- this.updateWaitTaskCount();
- },
- toDataTask() {
- this.$refs.DataTaskDialog.open();
- },
- },
- };
- </script>
|