浏览代码

标准卷管理新增

zhangjie 4 年之前
父节点
当前提交
6c26cde902

+ 7 - 0
src/api.js

@@ -284,6 +284,10 @@ export const publishScoreTask = ({ subjectId, questionId, taskList }) => {
     "json"
   );
 };
+// grading-standard-paper-manage
+export const cancelStandardPaper = paperIds => {
+  return $patch(`/api/papers/batch/cancelSample`, { paperIds }, "json");
+};
 
 // grading-detail ------------------------->
 // grading-analysis
@@ -310,6 +314,9 @@ export const markerLevelTotalStatData = (userId, questionId) => {
 export const areaList = ({ workId, subject }) => {
   return $get("/api/questions", { workId, subject });
 };
+export const sampleAreaList = ({ workId, subject }) => {
+  return $get("/api/questions/sampleQuestions", { workId, subject });
+};
 // papers
 export const paperList = datas => {
   // ?questionId=64&level=A&page=0&size=6&sort=secretNumber&isSample=true

+ 1 - 1
src/assets/styles/main.less

@@ -561,7 +561,7 @@
 }
 .check-grade {
   flex-grow: 2;
-  min-height: 500px;
+  min-height: 400px;
   display: flex;
   justify-content: space-between;
 

+ 48 - 2
src/assets/styles/mark.less

@@ -339,7 +339,7 @@
 
   .detail-body {
     flex-grow: 2;
-    min-height: 500px;
+    min-height: 400px;
     display: flex;
     justify-content: space-between;
 
@@ -381,7 +381,7 @@
     flex-grow: 2;
     display: flex;
     justify-content: space-between;
-    min-height: 500px;
+    min-height: 400px;
 
     &-carousel {
       position: relative;
@@ -985,3 +985,49 @@
     background-color: @background-color;
   }
 }
+
+// grading-standard-paper-manage
+.grading-standard-paper-manage {
+  .level-list {
+    font-size: 0;
+    white-space: nowrap;
+  }
+  .level-item {
+    display: inline-block;
+    vertical-align: top;
+    height: 32px;
+    line-height: 32px;
+    padding: 0 12px;
+    border-radius: @box-border-radius-small;
+    background-color: @white;
+    color: @dark-color-light;
+    font-size: 16px;
+    cursor: pointer;
+    &:not(:last-child) {
+      margin-right: 10px;
+    }
+    &:hover {
+      box-shadow: 0px 10px 10px 0px rgba(34, 192, 255, 0.4);
+    }
+
+    &-act {
+      background-color: @info-color;
+      color: @white;
+      box-shadow: 0px 10px 10px 0px rgba(34, 192, 255, 0.4);
+    }
+  }
+
+  .standard-papers-none {
+    padding-top: 200px;
+    text-align: center;
+    font-size: 24px;
+    color: @dark-color-lighter;
+  }
+  .standard-papers-list {
+    min-height: 400px;
+
+    .image-view-list .image-view {
+      height: 400px;
+    }
+  }
+}

+ 5 - 0
src/constants/authority.js

@@ -119,6 +119,11 @@ export const grading = [
     title: "分档分组",
     icon: "ivu-icon-group"
   },
+  {
+    name: "GradingStandardPaperManage",
+    title: "标准卷管理",
+    icon: "ivu-icon-score"
+  },
   {
     name: "ExamPaperView",
     title: "查看试卷",

+ 335 - 0
src/modules/grading/GradingStandardPaperManage.vue

@@ -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>

+ 9 - 0
src/routers/grading.js

@@ -6,6 +6,7 @@ import GradingAnalysis from "../modules/grading/GradingAnalysis";
 import GradingUserManage from "../modules/grading/GradingUserManage";
 import GradingGroupManage from "../modules/grading/GradingGroupManage";
 import ExamPaperView from "../modules/main/ExamPaperView";
+import GradingStandardPaperManage from "../modules/grading/GradingStandardPaperManage";
 
 // 阅卷员分档
 import GradingOperation from "../modules/grading/GradingOperation";
@@ -58,6 +59,14 @@ const gradingRoutes = [
     meta: {
       title: "试卷查看"
     }
+  },
+  {
+    path: "grading-standard-paper-manage",
+    name: "GradingStandardPaperManage",
+    component: GradingStandardPaperManage,
+    meta: {
+      title: "标准卷管理"
+    }
   }
 ];