Browse Source

数据校验

zhangjie 3 years ago
parent
commit
92b696e726

+ 7 - 0
src/api.js

@@ -176,6 +176,13 @@ export const uploadPaperList = workId => {
   return $get(`/api/papers/${workId}/listUploadPaper`);
 };
 
+// check-data
+export const checkDataList = workId => {
+  return $get(`/api/check_data/list`, { workId });
+};
+export const dataItemCheck = ({ workId, checkItem, paramValue }) => {
+  return $get(`/api/check_data/check`, { workId, checkItem, paramValue });
+};
 // grading -------------------------->
 // grading-user-manage
 export const gradingUserList = datas => {

+ 12 - 0
src/assets/styles/main.less

@@ -767,3 +767,15 @@
     }
   }
 }
+
+// check-data
+.check-data {
+  .check-list {
+    min-height: 300px;
+  }
+}
+.check-data-result {
+  .ivu-modal-content {
+    background-color: @background-color;
+  }
+}

+ 5 - 0
src/constants/authority.js

@@ -48,6 +48,11 @@ export const main = [
     name: "StudentScore",
     title: "成绩查询",
     icon: "ivu-icon-score"
+  },
+  {
+    name: "CheckData",
+    title: "数据校验",
+    icon: "ivu-icon-task"
   }
 ];
 

+ 1 - 1
src/modules/grading-set/GradingRuleSet.vue

@@ -71,7 +71,7 @@
           ></Option>
         </Select>
       </FormItem>
-      <FormItem label="是否启取优原则:">
+      <FormItem label="是否启取优原则:">
         <Select
           v-model="modalForm.takeBest"
           :disabled="!modalFormCanEdit"

+ 143 - 0
src/modules/main/CheckData.vue

@@ -0,0 +1,143 @@
+<template>
+  <div class="check-data ">
+    <div class="part-box check-list">
+      <table class="table">
+        <tr>
+          <th>序号</th>
+          <th>校验内容</th>
+          <th>执行结果</th>
+          <th>操作</th>
+        </tr>
+        <tr v-for="(citem, cindex) in checkItemInfo" :key="cindex">
+          <td>{{ cindex + 1 }}</td>
+          <td>
+            {{ citem.desc }}
+            <InputNumber
+              v-if="paramCheckItems.includes(citem.checkItem)"
+              v-model="citem.paramValue"
+              :min="1"
+              :max="1000"
+            ></InputNumber>
+          </td>
+          <td>
+            {{ resultStr(citem.result) }}
+          </td>
+          <td>
+            <Button
+              size="small"
+              type="primary"
+              :loading="loading"
+              :disabled="citem.status && citem.status !== 'FINISH'"
+              @click="submit(citem)"
+              >开始</Button
+            >
+            <Button
+              size="small"
+              type="primary"
+              :loading="loading"
+              :disabled="!citem.result && !citem.content"
+              @click="toView(citem)"
+              >详情</Button
+            >
+          </td>
+        </tr>
+      </table>
+    </div>
+
+    <!-- CheckDataResult -->
+    <CheckDataResult ref="CheckDataResult" :content="curCheckItemContent" />
+  </div>
+</template>
+
+<script>
+import { checkDataList, dataItemCheck } from "@/api";
+import CheckDataResult from "./components/CheckDataResult.vue";
+
+export default {
+  name: "check-data",
+  components: { CheckDataResult },
+  data() {
+    return {
+      workId: this.$route.params && this.$route.params.workId,
+      checkItemInfo: [],
+      paramCheckItems: ["LEVEL_DIFF", "SCORE_DIFF"],
+      loading: false,
+      curCheckItemContent: []
+    };
+  },
+  created() {
+    this.initCheckDataInfo();
+  },
+  methods: {
+    initCheckDataInfo() {
+      const checkItems = [
+        "PAPER_SIZE",
+        "ALL_SCORE",
+        "LEVEL_SCORE_MATCH",
+        "LEVEL_DIFF",
+        "SCORE_DIFF"
+      ];
+      const checkItemDesc = {
+        PAPER_SIZE: "所有试卷图片大小均不为0",
+        ALL_SCORE: "校验每张试卷都有分数",
+        LEVEL_SCORE_MATCH: "每张试卷分数都在其所属档位分数区间内",
+        LEVEL_DIFF: "同一考生各科目档位差不超过",
+        SCORE_DIFF: "同一考生各科目成绩差不超过"
+      };
+      const checkItemInfo = checkItems.map(item => {
+        return {
+          checkItem: item,
+          desc: checkItemDesc[item],
+          paramValue: null,
+          status: null,
+          result: null,
+          errorCount: 0,
+          content: null
+        };
+      });
+      this.checkItemInfo = checkItemInfo;
+    },
+    async getCheckDataInfo() {
+      const res = await checkDataList(this.workId);
+      const data = res || [];
+      const checkItemInfoMap = {};
+      data.forEach(item => {
+        checkItemInfoMap[item.checkItem] = item;
+      });
+
+      this.checkItemInfo = this.checkItemInfo.map(item => {
+        return Object.assign({}, item, checkItemInfoMap[item.checkItem]);
+      });
+    },
+    resultStr(val) {
+      if (val === null) return "--";
+      return val ? "成功" : "失败";
+    },
+    toView(row) {
+      this.curCheckItemContent = row.content;
+      this.$refs.CheckDataResult.open();
+    },
+    async submit(row) {
+      if (
+        ["LEVEL_DIFF", "SCORE_DIFF"].includes(row.checkItem) &&
+        !row.paramValue
+      ) {
+        this.$Message.error("请输入参数");
+        return;
+      }
+
+      if (this.loading) return;
+      this.loading = true;
+      const res = await dataItemCheck({
+        workId: this.workId,
+        checkItem: row.checkItem,
+        paramValue: row.paramValue
+      }).catch(() => {});
+      this.loading = false;
+      if (!res) return;
+      this.$Message.success("提交成功!");
+      this.getCheckDataInfo();
+    }
+  }
+};
+</script>

+ 5 - 1
src/modules/main/StudentScore.vue

@@ -217,7 +217,11 @@ export default {
         this.getAreaList();
       } else {
         await this.getSubjects();
-        this.filter.subject = this.subjects[0].subject;
+        // this.filter.subject = this.subjects[0].subject;
+        if (this.$route.query && this.$route.query.examNumber) {
+          this.filter.number = this.$route.query.examNumber;
+          this.toSearch();
+        }
       }
     },
     async getWorkList() {

+ 127 - 0
src/modules/main/components/CheckDataResult.vue

@@ -0,0 +1,127 @@
+<template>
+  <Modal
+    class="check-data-result"
+    v-model="modalIsShow"
+    title="校验详情"
+    :mask-closable="false"
+    width="800"
+    @on-visible-change="visibleChange"
+  >
+    <Table
+      ref="TableList"
+      :columns="columns"
+      :data="students"
+      disabled-hover
+      border
+    ></Table>
+
+    <div class="part-page" v-if="total > size">
+      <Page
+        :current="current"
+        :total="total"
+        :page-size="size"
+        show-total
+        show-elevator
+        @on-change="toPage"
+      ></Page>
+    </div>
+  </Modal>
+</template>
+
+<script>
+export default {
+  name: "check-data-result",
+  props: {
+    content: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      students: [],
+      columns: [
+        {
+          type: "index",
+          title: "序号",
+          width: 80,
+          align: "center",
+          indexMethod: row => {
+            return (this.current - 1) * this.size + row._index + 1;
+          }
+        },
+        {
+          title: "姓名",
+          key: "studentName",
+          width: 100
+        },
+        {
+          title: "考号",
+          key: "examNumber",
+          width: 120
+        },
+        {
+          title: "错误原因",
+          key: "errorMessage"
+        },
+        {
+          title: "操作",
+          key: "action",
+          width: 100,
+          align: "center",
+          className: "table-action",
+          render: (h, param) => {
+            let actions = [];
+            actions.push({
+              icon: "md-arrow-dropright-circle",
+              attrs: {
+                title: "查看"
+              },
+              action: () => {
+                this.toView(param.row);
+              }
+            });
+
+            return h("div", this.$tableIconAction(h, actions));
+          }
+        }
+      ],
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0
+    };
+  },
+  methods: {
+    visibleChange(visible) {
+      if (visible) {
+        this.toPage(1);
+      } else {
+        this.$emit("on-close");
+      }
+    },
+    toPage(page) {
+      this.current = page;
+      this.students = this.content.slice((page - 1) * this.size, this.size);
+    },
+    toView(row) {
+      window.open(
+        this.getRouterPath({
+          name: "StudentScore",
+          query: {
+            examNumber: row.examNumber
+          }
+        })
+      );
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    }
+  }
+};
+</script>

+ 32 - 0
src/modules/main/data.json

@@ -0,0 +1,32 @@
+[
+  {
+    "id": 1,
+    "workId": 1,
+    "checkItem": "PAPER_SIZE",
+    "paramValue": null,
+    "status": "FINISH",
+    "result": true,
+    "errorCount": 0,
+    "startTime": "2022-04-22 12:00:00",
+    "endTime": "2022-04-22 12:00:00",
+    "content": null
+  },
+  {
+    "id": 1,
+    "workId": 1,
+    "checkItem": "LEVEL_DIFF",
+    "paramValue": 2,
+    "status": "FINISH",
+    "result": false,
+    "errorCount": 1,
+    "startTime": "2022-04-22 12:00:00",
+    "endTime": "2022-04-22 12:00:00",
+    "content": [
+      {
+        "examNumber": "p;",
+        "studentName": "张三",
+        "errorMessage": "错误原因XXXX"
+      }
+    ]
+  }
+]

+ 4 - 0
src/plugins/mixins.js

@@ -13,6 +13,10 @@ export default {
       return url.indexOf("?") !== -1
         ? `${url}&${authorQuery}`
         : `${url}?${authorQuery}`;
+    },
+    getRouterPath(location) {
+      const { href } = this.$router.resolve(location);
+      return href;
     }
   }
 };

+ 9 - 0
src/routers/main.js

@@ -6,6 +6,7 @@ import ClientMonitor from "../modules/main/ClientMonitor";
 import StudentManage from "../modules/main/StudentManage";
 import QualityAnalysis from "../modules/main/QualityAnalysis";
 import StudentScore from "../modules/main/StudentScore";
+import CheckData from "../modules/main/CheckData";
 // client-set
 import ClientSet from "../modules/client-set/ClientSet";
 import ClientAccountSet from "../modules/client-set/ClientAccountSet";
@@ -173,6 +174,14 @@ const mainRoutes = [
     meta: {
       title: "成绩查询"
     }
+  },
+  {
+    path: "check-data",
+    name: "CheckData",
+    component: CheckData,
+    meta: {
+      title: "数据校验"
+    }
   }
 ];