WANG 6 anos atrás
pai
commit
7702a9ed2d
1 arquivos alterados com 34 adições e 26 exclusões
  1. 34 26
      src/modules/examwork/view/examStudent.vue

+ 34 - 26
src/modules/examwork/view/examStudent.vue

@@ -166,7 +166,7 @@
           @close="closeAddingStudentDialog"
           title="考生信息页面"
           :visible.sync="addingStudentDialog"
-          width="60%"
+          width="650px"
         >
           <el-form
             :model="examStudentForm"
@@ -322,7 +322,7 @@
 
         <!-- 修改弹出窗口 -->
         <el-dialog
-          width="60%"
+          width="650px"
           @close="closeUpdateStudentDialog"
           title="考生信息页面"
           :visible.sync="updateStudentDialog"
@@ -796,31 +796,38 @@ import {
 } from "@/constants/constants.js";
 import { mapState } from "vuex";
 
+let _this = null;
+
+let validateStuCode = (rule, value, callback) => {
+  if (
+    _this.examStudentForm.studentCode &&
+    _this.examStudentForm.studentCode.length < 6
+  ) {
+    callback(new Error("学号至少6位"));
+  } else {
+    callback();
+  }
+};
+
+let validateIdentityNumber = (rule, value, callback) => {
+  if (
+    !_this.examStudentForm.identityNumber ||
+    _this.examStudentForm.identityNumber === ""
+  ) {
+    return callback(new Error("请输入身份证"));
+  }
+  if (
+    _this.examStudentForm.identityNumber &&
+    _this.examStudentForm.identityNumber.length < 6
+  ) {
+    callback(new Error("身份证至少6位"));
+  } else {
+    callback();
+  }
+};
+
 export default {
   data() {
-    var validateStuCode = (rule, value, callback) => {
-      if (
-        this.examStudentForm.studentCode &&
-        this.examStudentForm.studentCode.length < 6
-      ) {
-        callback(new Error("学号至少6位"));
-      } else {
-        callback();
-      }
-    };
-    var validateIdenNum = (rule, value, callback) => {
-      if (this.examStudentForm.identityNumber === "") {
-        return callback(new Error("请输入身份证"));
-      }
-      if (
-        this.examStudentForm.identityNumber &&
-        this.examStudentForm.identityNumber.length < 6
-      ) {
-        callback(new Error("身份证至少6位"));
-      } else {
-        callback();
-      }
-    };
     return {
       rolePrivileges: {
         search_examStudent: false,
@@ -942,7 +949,7 @@ export default {
         ],
         studentCode: [{ validator: validateStuCode, trigger: "blur" }],
         identityNumber: [
-          { required: true, validator: validateIdenNum, trigger: "blur" }
+          { validator: validateIdentityNumber, trigger: "blur" }
         ],
         courseId: [
           {
@@ -1677,6 +1684,7 @@ export default {
     }
   },
   created() {
+    _this = this;
     this.initPrivileges();
     this.init();
     this.uploadHeaders = {