|
@@ -0,0 +1,254 @@
|
|
|
+<template>
|
|
|
+ <div class="grading-standard-paper-manage">
|
|
|
+ <div class="part-box-head">
|
|
|
+ <Form
|
|
|
+ class="part-box-head-left"
|
|
|
+ ref="FilterForm"
|
|
|
+ label-position="left"
|
|
|
+ inline
|
|
|
+ >
|
|
|
+ <FormItem>
|
|
|
+ <Select v-model="questionId" placeholder="选择考区">
|
|
|
+ <Option
|
|
|
+ v-for="area in areas"
|
|
|
+ :key="area.id"
|
|
|
+ :value="area.id"
|
|
|
+ :label="area.areaName"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem>
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ class="btn-form-search"
|
|
|
+ type="primary"
|
|
|
+ @click="toPage(1)"
|
|
|
+ >查询</Button
|
|
|
+ >
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ <div class="part-box-head-right">
|
|
|
+ <div class="level-list">
|
|
|
+ <p
|
|
|
+ v-for="(level, index) in levels"
|
|
|
+ :key="level"
|
|
|
+ :class="[
|
|
|
+ 'level-item',
|
|
|
+ { 'level-item-act': index === curLevelIndex }
|
|
|
+ ]"
|
|
|
+ @click="switchLevel(index)"
|
|
|
+ >
|
|
|
+ {{ level }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="standard-papers-list" v-if="papers.length">
|
|
|
+ <div class="image-view-list image-view-list-5">
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ 'image-view',
|
|
|
+ { 'image-view-act': curPaperIndex === index || image.selected }
|
|
|
+ ]"
|
|
|
+ v-for="(image, index) in papers"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <h5 class="image-view-title">{{ image.title }}</h5>
|
|
|
+ <div class="image-view-contain">
|
|
|
+ <img
|
|
|
+ :src="image.thumbSrc"
|
|
|
+ :alt="image.title"
|
|
|
+ @click="toReview(index)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="image-view-actions" v-if="canCancel">
|
|
|
+ <Button
|
|
|
+ type="error"
|
|
|
+ size="small"
|
|
|
+ @click="cancelPaper(image)"
|
|
|
+ :disabled="image.loading"
|
|
|
+ >取消标准卷</Button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="standard-papers-list" v-else>
|
|
|
+ <p class="standard-papers-none">暂无数据</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- image-preview -->
|
|
|
+ <simple-image-preview
|
|
|
+ :cur-image="curPaper"
|
|
|
+ @on-prev="toPrevPaper"
|
|
|
+ @on-next="toNextPaper"
|
|
|
+ ref="SimpleImagePreview"
|
|
|
+ ></simple-image-preview>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ paperList,
|
|
|
+ subjectDetail,
|
|
|
+ areaList,
|
|
|
+ workLevelList,
|
|
|
+ cancelStandardPaper
|
|
|
+} from "@/api";
|
|
|
+import SimpleImagePreview from "@/components/SimpleImagePreview";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "grading-standard-paper-manage",
|
|
|
+ components: { SimpleImagePreview },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ workId: this.$route.params.workId,
|
|
|
+ subjectId: this.$route.params.subjectId,
|
|
|
+ subject: "",
|
|
|
+ canCancel: false,
|
|
|
+ questionId: "",
|
|
|
+ curLevel: "",
|
|
|
+ curLevelIndex: 0,
|
|
|
+ levels: [],
|
|
|
+ areas: [],
|
|
|
+ paperMap: {},
|
|
|
+ papers: [],
|
|
|
+ curPaper: {},
|
|
|
+ curPaperIndex: 0
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.subject = this.subjectId.split("-")[1];
|
|
|
+ this.initData();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async initData() {
|
|
|
+ this.curSubject = await subjectDetail(this.subjectId);
|
|
|
+ const isLevelOrScore =
|
|
|
+ (this.curSubject.stage === "LEVEL" ||
|
|
|
+ this.curSubject.stage === "SCORE") &&
|
|
|
+ this.curSubject.test === 0;
|
|
|
+ this.canCancel = !isLevelOrScore;
|
|
|
+
|
|
|
+ await this.getAreaList();
|
|
|
+ this.questionId = this.areas[0].id;
|
|
|
+ await this.getWorkLevels();
|
|
|
+ this.switchLevel(0);
|
|
|
+ },
|
|
|
+ async getWorkLevels() {
|
|
|
+ const data = await workLevelList(this.workId);
|
|
|
+ this.levels = data.map(item => item.code);
|
|
|
+ },
|
|
|
+ async getAreaList() {
|
|
|
+ const data = await areaList({
|
|
|
+ workId: this.workId,
|
|
|
+ subject: this.subject
|
|
|
+ });
|
|
|
+ this.areas = data.map(item => {
|
|
|
+ return {
|
|
|
+ id: item.id,
|
|
|
+ areaName: item.areaName,
|
|
|
+ areaCode: item.areaCode
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async getList() {
|
|
|
+ if (this.paperMap[this.curLevel] && this.paperMap[this.curLevel].length) {
|
|
|
+ this.papers = this.paperMap[this.curLevel];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const datas = {
|
|
|
+ questionId: this.questionId,
|
|
|
+ level: this.curLevel,
|
|
|
+ sort: "secretNumber",
|
|
|
+ isSample: true,
|
|
|
+ page: 0,
|
|
|
+ size: 100
|
|
|
+ };
|
|
|
+ const data = await paperList(datas);
|
|
|
+ this.papers = data.data.map(item => {
|
|
|
+ item.title = `NO.${item.sn}`;
|
|
|
+ item.loading = false;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.paperMap[this.curLevel] = data.data;
|
|
|
+ },
|
|
|
+ switchLevel(index) {
|
|
|
+ this.curLevelIndex = index;
|
|
|
+ this.curLevel = this.levels[index];
|
|
|
+
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ cancelPaper(paper) {
|
|
|
+ if (paper.loading) return;
|
|
|
+ this.$Modal.confirm({
|
|
|
+ content: "确定要取消当前标准卷吗?",
|
|
|
+ onOk: async () => {
|
|
|
+ paper.loading = true;
|
|
|
+ const res = await cancelStandardPaper(paper.id).catch(() => {});
|
|
|
+ paper.loading = false;
|
|
|
+ if (!res) return;
|
|
|
+ this.paperMap[this.curLevel] = null;
|
|
|
+ await this.getList();
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // to review
|
|
|
+ toReview(index) {
|
|
|
+ this.selectPaper(index);
|
|
|
+ this.$refs.SimpleImagePreview.open();
|
|
|
+ },
|
|
|
+ selectPaper(index) {
|
|
|
+ let nindex = index;
|
|
|
+ if (!this.papers.length) {
|
|
|
+ nindex = 0;
|
|
|
+ } else if (index > this.papers.length - 1) {
|
|
|
+ nindex = this.papers.length - 1;
|
|
|
+ } else if (index < 0) {
|
|
|
+ nindex = 0;
|
|
|
+ }
|
|
|
+ this.curPaperIndex = nindex;
|
|
|
+ this.curPaper = this.papers[nindex] ? { ...this.papers[nindex] } : {};
|
|
|
+ },
|
|
|
+ async toPrevPaper() {
|
|
|
+ if (this.curPaperIndex === 0) {
|
|
|
+ if (this.curLevelIndex === 0) {
|
|
|
+ this.$Message.warning("当前已经是第一条数据了");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ this.curLevelIndex--;
|
|
|
+ this.curLevel = this.levels[this.curLevelIndex];
|
|
|
+ await this.getList();
|
|
|
+ this.curPaperIndex = this.papers.length - 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.curPaperIndex--;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
+ },
|
|
|
+ async toNextPaper() {
|
|
|
+ if (
|
|
|
+ this.curPaperIndex === this.papers.length - 1 ||
|
|
|
+ !this.papers.length
|
|
|
+ ) {
|
|
|
+ if (this.curLevelIndex === this.levels.length - 1) {
|
|
|
+ this.$Message.warning("当前已经是最后一条数据了");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ this.curLevelIndex++;
|
|
|
+ this.curLevel = this.levels[this.curLevelIndex];
|
|
|
+ await this.getList();
|
|
|
+ this.curPaperIndex = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.curPaperIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.selectPaper(this.curPaperIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|