|
@@ -0,0 +1,335 @@
|
|
|
|
+<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="search"
|
|
|
|
+ >查询</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']"
|
|
|
|
+ v-for="(image, index) in papers"
|
|
|
|
+ :key="index"
|
|
|
|
+ >
|
|
|
|
+ <div class="image-view-container">
|
|
|
|
+ <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">
|
|
|
|
+ <Button
|
|
|
|
+ type="error"
|
|
|
|
+ size="small"
|
|
|
|
+ @click="cancelPaper(image)"
|
|
|
|
+ :disabled="image.loading"
|
|
|
|
+ v-if="canCancel"
|
|
|
|
+ >取消</Button
|
|
|
|
+ >
|
|
|
|
+ <Button type="primary" size="small" @click="toChangePaper(image)"
|
|
|
|
+ >修改</Button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ </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>
|
|
|
|
+ <!-- change-standard-paper-dialog -->
|
|
|
|
+ <Modal
|
|
|
|
+ class="change-standard-paper-dialog"
|
|
|
|
+ v-model="modalIsShow"
|
|
|
|
+ title="修改标准卷"
|
|
|
|
+ :mask-closable="false"
|
|
|
|
+ >
|
|
|
|
+ <div class="level-list">
|
|
|
|
+ <p
|
|
|
|
+ v-for="level in levels"
|
|
|
|
+ :key="level"
|
|
|
|
+ :class="[
|
|
|
|
+ 'level-item',
|
|
|
|
+ {
|
|
|
|
+ 'level-item-act': level === curSelectLevel,
|
|
|
|
+ 'level-item-disabled': level === curChangePaper.level
|
|
|
|
+ }
|
|
|
|
+ ]"
|
|
|
|
+ @click="selectLevel(level)"
|
|
|
|
+ >
|
|
|
|
+ {{ level }}
|
|
|
|
+ </p>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div slot="footer">
|
|
|
|
+ <Button
|
|
|
|
+ shape="circle"
|
|
|
|
+ type="primary"
|
|
|
|
+ :disabled="isSubmit || !curSelectLevel"
|
|
|
|
+ @click="confirmChange"
|
|
|
|
+ >确认</Button
|
|
|
|
+ >
|
|
|
|
+ <Button shape="circle" @click="cancelChange">取消</Button>
|
|
|
|
+ </div>
|
|
|
|
+ </Modal>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import {
|
|
|
|
+ paperList,
|
|
|
|
+ sampleAreaList,
|
|
|
|
+ workLevelList,
|
|
|
|
+ cancelStandardPaper,
|
|
|
|
+ leaderGradingPaper
|
|
|
|
+} 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: true,
|
|
|
|
+ questionId: "",
|
|
|
|
+ lastQuestionId: "",
|
|
|
|
+ curLevel: "",
|
|
|
|
+ curLevelIndex: 0,
|
|
|
|
+ levels: [],
|
|
|
|
+ areas: [],
|
|
|
|
+ paperMap: {},
|
|
|
|
+ papers: [],
|
|
|
|
+ curPaper: {},
|
|
|
|
+ curPaperIndex: 0,
|
|
|
|
+ // change standard
|
|
|
|
+ modalIsShow: false,
|
|
|
|
+ curChangePaper: {},
|
|
|
|
+ curSelectLevel: null,
|
|
|
|
+ isSubmit: false
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.subject = this.subjectId.split("-")[1];
|
|
|
|
+ this.initData();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ async initData() {
|
|
|
|
+ await this.getAreaList();
|
|
|
|
+ this.questionId = this.areas[0] && this.areas[0].id;
|
|
|
|
+ if (!this.questionId) return;
|
|
|
|
+ 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 sampleAreaList({
|
|
|
|
+ workId: this.workId,
|
|
|
|
+ subject: this.subject
|
|
|
|
+ });
|
|
|
|
+ this.areas = data.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ id: item.id,
|
|
|
|
+ areaName: `${item.areaName}-${item.name}`,
|
|
|
|
+ areaCode: item.areaCode
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ search() {
|
|
|
|
+ if (this.lastQuestionId !== this.questionId) this.paperMap = {};
|
|
|
|
+ this.lastQuestionId = this.questionId;
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // change standard paper
|
|
|
|
+ toChangePaper(paper) {
|
|
|
|
+ this.curChangePaper = paper;
|
|
|
|
+ this.modalIsShow = true;
|
|
|
|
+ },
|
|
|
|
+ selectLevel(level) {
|
|
|
|
+ if (level === this.curChangePaper.level) return;
|
|
|
|
+ this.curSelectLevel = level;
|
|
|
|
+ },
|
|
|
|
+ async confirmChange() {
|
|
|
|
+ if (!this.curSelectLevel) return;
|
|
|
|
+ if (this.isSubmit) return;
|
|
|
|
+
|
|
|
|
+ this.isSubmit = true;
|
|
|
|
+ const datas = {
|
|
|
|
+ action: "sampling",
|
|
|
|
+ level: this.curSelectLevel,
|
|
|
|
+ originLevel: this.curChangePaper.level,
|
|
|
|
+ paperIds: this.curChangePaper.id
|
|
|
|
+ };
|
|
|
|
+ let result = true;
|
|
|
|
+ await leaderGradingPaper(datas).catch(() => {
|
|
|
|
+ result = false;
|
|
|
|
+ });
|
|
|
|
+ this.isSubmit = false;
|
|
|
|
+
|
|
|
|
+ if (!result) return;
|
|
|
|
+
|
|
|
|
+ this.$Message.success("操作成功!");
|
|
|
|
+ this.paperMap[datas.level] = [];
|
|
|
|
+ this.paperMap[this.curLevel] = [];
|
|
|
|
+ this.cancelChange();
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ cancelChange() {
|
|
|
|
+ this.curSelectLevel = null;
|
|
|
|
+ this.modalIsShow = false;
|
|
|
|
+ },
|
|
|
|
+ // 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>
|