Bladeren bron

新增考生

zhangjie 1 jaar geleden
bovenliggende
commit
246e7ac91c

+ 16 - 0
src/assets/styles/pages.scss

@@ -1422,3 +1422,19 @@
     padding: 20px;
   }
 }
+
+.quality-chart-dialog {
+  .el-dialog__footer {
+    display: none;
+  }
+  .chart-summary {
+    span {
+      display: inline-block;
+      vertical-align: middle;
+
+      &:not(:first-child) {
+        margin-left: 20px;
+      }
+    }
+  }
+}

+ 1 - 0
src/main.js

@@ -13,6 +13,7 @@ import ElementUI from "element-ui";
 import "element-ui/lib/theme-chalk/index.css";
 import "./assets/styles/index.scss";
 import "../card/assets/styles/module.scss";
+import "./plugins/VueCharts";
 
 Vue.use(ElementUI, { size: "small" });
 

+ 1 - 1
src/modules/mark/components/markDetail/MarkDetailQuality.vue

@@ -192,7 +192,7 @@ export default {
     },
     toViewLine() {
       if (!this.filter.groupNumber) {
-        this.$$message.error("请先选择评阅题目");
+        this.$message.error("请先选择评阅题目");
         return;
       }
       this.chartData = {

+ 47 - 45
src/modules/mark/components/markDetail/QualityChartDialog.vue

@@ -1,5 +1,6 @@
 <template>
   <el-dialog
+    class="quality-chart-dialog"
     :visible.sync="modalIsShow"
     title="给分曲线"
     top="10vh"
@@ -9,7 +10,7 @@
     append-to-body
     @opened="visibleChange"
   >
-    <p>
+    <p class="chart-summary">
       <span>全体平均</span>
       <span>最高分:{{ summary.max }}</span>
       <span>最低分:{{ summary.min }}</span>
@@ -66,6 +67,11 @@ export default {
       };
       const res = await markQualityChart(this.data);
       const datalist = res || [];
+      datalist.forEach((item) => {
+        item.avgScore = item.avgScore || 0;
+        item.minScore = item.minScore || 0;
+        item.maxScore = item.maxScore || 0;
+      });
       this.chartOption = this.getChartOption(datalist);
       this.summary = {
         avg: calcAvg(datalist.map((item) => item.avgScore)).toFixed(2),
@@ -82,10 +88,10 @@ export default {
           },
         },
         grid: {
-          top: "10%",
-          bottom: "20%",
-          left: "3%",
-          right: "3%",
+          top: 50,
+          bottom: 40,
+          left: 50,
+          right: 10,
         },
         legend: {
           data: ["最高分", "平均分", "最低分"],
@@ -98,50 +104,46 @@ export default {
             fontSize: 12,
           },
         },
-        xAxis: [
-          {
-            type: "category",
-            name: "评卷员",
-            data: dataList.map((item) => item.name),
-            axisLine: {
-              show: true,
-              lineStyle: {
-                color: "#C1CBDB",
-              },
-            },
-            splitLine: {
-              show: false,
-            },
-            axisTick: {
-              show: false,
-            },
-            axisLabel: {
-              show: false,
+        xAxis: {
+          type: "category",
+          data: dataList.map((item) => item.name),
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: "#C1CBDB",
             },
           },
-        ],
-        yAxis: [
-          {
-            type: "value",
-            name: "分值",
-            axisLine: {
-              show: false,
-            },
-            splitLine: {
-              show: true,
-              lineStyle: {
-                color: "#C1CBDB",
-              },
-            },
-            axisTick: {
-              show: false,
-            },
-            axisLabel: {
-              color: "#626A82",
-              fontSize: 12,
+          splitLine: {
+            show: false,
+          },
+          axisTick: {
+            show: true,
+          },
+          axisLabel: {
+            show: true,
+            color: "#333",
+            fontSize: 12,
+          },
+        },
+        yAxis: {
+          type: "value",
+          axisLine: {
+            show: false,
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: "#C1CBDB",
             },
           },
-        ],
+          axisTick: {
+            show: false,
+          },
+          axisLabel: {
+            color: "#333",
+            fontSize: 12,
+          },
+        },
         series: [
           {
             name: "最高分",

+ 9 - 0
src/modules/print/api.js

@@ -56,6 +56,15 @@ export const planBatchLinkPaper = (datas) => {
 export const planAllRelatePaperTypes = (datas) => {
   return $postParam("/api/admin/exam/print/list_relate_common_types", datas);
 };
+export const queryBusinessCoursePaperType = (datas) => {
+  return $postParam("/api/admin/exam/print/list_exam_detail_course", datas);
+};
+export const businessAddStudent = (datas) => {
+  return $post("/api/admin/exam/print/add_exam_student", datas);
+};
+export const businessDeleteStudent = (id) => {
+  return $postParam("/api/admin/exam/print/delete_exam_student", { id });
+};
 // business-data-detail
 export const businessDataDetailListPage = (datas) => {
   return $postParam("/api/admin/exam/print/data_detail", datas);

+ 227 - 0
src/modules/print/components/ModifyBusinessStudent.vue

@@ -0,0 +1,227 @@
+<template>
+  <el-dialog
+    class="modify-business-student"
+    :visible.sync="modalIsShow"
+    :title="title"
+    top="10vh"
+    width="550px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      label-width="100px"
+    >
+      <el-form-item prop="studentName" label="姓名:">
+        <el-input
+          v-model.trim="modalForm.studentName"
+          placeholder="请输入姓名"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="studentCode" label="学号:">
+        <el-input
+          v-model.trim="modalForm.studentCode"
+          placeholder="请输入学号"
+          clearable
+          :disabled="isEdit"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="examDetailCourseId" label="考场科目:">
+        <el-select
+          v-model="modalForm.examDetailCourseId"
+          placeholder="考场科目"
+          clearable
+          @change="courseChange"
+        >
+          <el-option
+            v-for="item in courses"
+            :key="item.examDetailCourseId"
+            :value="item.examDetailCourseId"
+            :label="item.courseName"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item prop="paperType" label="卷型:">
+        <el-select v-model="modalForm.paperType" placeholder="卷型" clearable>
+          <el-option
+            v-for="item in paperTypes"
+            :key="item"
+            :value="item"
+            :label="item"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item prop="college" label="学院:">
+        <el-input
+          v-model.trim="modalForm.college"
+          placeholder="请输入学院"
+          clearable
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="className" label="班级:">
+        <el-input
+          v-model.trim="modalForm.className"
+          placeholder="请输入班级"
+          clearable
+        ></el-input>
+      </el-form-item>
+    </el-form>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="submit"
+        >确认</el-button
+      >
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { businessAddStudent, queryBusinessCoursePaperType } from "../api";
+
+const initModalForm = {
+  examDetailCourseId: "",
+  paperType: "",
+  studentCode: "",
+  studentName: "",
+  college: "",
+  className: "",
+};
+
+export default {
+  name: "modify-course",
+  props: {
+    instance: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+  },
+  computed: {
+    isEdit() {
+      return !!this.instance.id;
+    },
+    title() {
+      return (this.isEdit ? "编辑" : "新增") + "考生";
+    },
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: { ...initModalForm },
+      rules: {
+        studentName: [
+          {
+            required: true,
+            message: "姓名不能超过30个字",
+            max: 30,
+            trigger: "change",
+          },
+        ],
+        studentCode: [
+          {
+            required: true,
+            pattern: /^[0-9a-zA-Z_-]{3,30}$/,
+            message: "学号只能由数字字母短横线组成,长度在3-30之间",
+            trigger: "change",
+          },
+        ],
+        examDetailCourseId: [
+          {
+            required: true,
+            message: "请选择考场科目",
+            trigger: "change",
+          },
+        ],
+        paperType: [
+          {
+            required: true,
+            message: "请选择卷型",
+            trigger: "change",
+          },
+        ],
+        college: [
+          {
+            required: true,
+            message: "学院不能超过30个字",
+            max: 30,
+            trigger: "change",
+          },
+        ],
+        className: [
+          {
+            required: true,
+            message: "班级不能超过30个字",
+            max: 30,
+            trigger: "change",
+          },
+        ],
+      },
+      courses: [],
+      paperTypes: [],
+    };
+  },
+  watch: {
+    "instance.examDetailId": {
+      immediate: true,
+      handler() {
+        this.getCourses();
+      },
+    },
+  },
+  methods: {
+    initData(val) {
+      this.modalForm = { ...initModalForm };
+    },
+    async getCourses() {
+      if (!this.instance.examDetailId) return;
+      const res = await queryBusinessCoursePaperType({
+        examDetailId: this.instance.examDetailId,
+      });
+      this.courses = res || [];
+    },
+    courseChange() {
+      this.paperTypes = [];
+      this.modalForm.paperType = "";
+      const curCourse = this.courses.find(
+        (item) => item.examDetailCourseId === this.modalForm.examDetailCourseId
+      );
+      if (!curCourse) return;
+      this.paperTypes = curCourse.paperTypes;
+    },
+    visibleChange() {
+      this.initData(this.instance);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+      let datas = { ...this.modalForm };
+      const data = await businessAddStudent(datas).catch(() => {
+        this.isSubmit = false;
+      });
+
+      if (!data) return;
+
+      this.isSubmit = false;
+      this.$message.success(this.title + "成功!");
+      this.$emit("modified");
+      this.cancel();
+    },
+  },
+};
+</script>

+ 38 - 3
src/modules/print/components/PreviewBusinessDetail.vue

@@ -64,6 +64,10 @@
       </div>
 
       <div class="part-box">
+        <div class="box-justify mb-2">
+          <el-button type="primary" @click="toPage(1)">查询</el-button>
+          <el-button type="primary" @click="toAdd">新增</el-button>
+        </div>
         <el-table border ref="TableList" :data="dataList">
           <el-table-column
             type="index"
@@ -81,7 +85,7 @@
           <el-table-column prop="examRoom" label="考场"> </el-table-column>
           <el-table-column prop="studentCode" label="学号"> </el-table-column>
           <el-table-column prop="studentName" label="姓名"> </el-table-column>
-          <el-table-column class-name="action-column" label="操作" width="80">
+          <el-table-column class-name="action-column" label="操作" width="120">
             <template slot-scope="scope">
               <el-button
                 class="btn-primary"
@@ -89,6 +93,12 @@
                 @click="toPreview(scope.row)"
                 >查看详情</el-button
               >
+              <el-button
+                class="btn-danger"
+                type="text"
+                @click="toDelete(scope.row)"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -115,12 +125,19 @@
       :instance="curRow"
       ref="PreviewBusinessStudentDetail"
     ></preview-business-student-detail>
+    <!-- ModifyBusinessStudent -->
+    <modify-business-student
+      ref="ModifyBusinessStudent"
+      :instance="curRow"
+      @modified="getList"
+    ></modify-business-student>
   </div>
 </template>
 
 <script>
-import { businessDataDetailListPageById } from "../api";
+import { businessDataDetailListPageById, businessDeleteStudent } from "../api";
 import PreviewBusinessStudentDetail from "./PreviewBusinessStudentDetail";
+import ModifyBusinessStudent from "./ModifyBusinessStudent.vue";
 
 const initModalForm = {
   id: "",
@@ -141,7 +158,7 @@ const initModalForm = {
 
 export default {
   name: "preview-business-detail",
-  components: { PreviewBusinessStudentDetail },
+  components: { PreviewBusinessStudentDetail, ModifyBusinessStudent },
   props: {
     instance: {
       type: Object,
@@ -182,6 +199,24 @@ export default {
       this.current = page;
       this.getList();
     },
+    toAdd() {
+      this.curRow = { examDetailId: this.instance.id };
+      this.$refs.ModifyBusinessStudent.open();
+    },
+    async toDelete(row) {
+      const confirm = await this.$confirm(
+        `确定要删除考生【${row.studentName}】吗?`,
+        "提示",
+        {
+          type: "warning",
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      await businessDeleteStudent(row.id);
+      this.$message.success("删除成功!");
+      this.deletePageLastItem();
+    },
     cancel() {
       this.modalIsShow = false;
     },

+ 2 - 0
src/plugins/VueCharts.js

@@ -19,6 +19,7 @@ import {
 
 // component
 import {
+  GridComponent,
   TitleComponent,
   LegendComponent,
   DataZoomComponent,
@@ -34,6 +35,7 @@ use([
   // ScatterChart,
   // RadarChart,
   BoxplotChart,
+  GridComponent,
   TitleComponent,
   LegendComponent,
   DataZoomComponent,