Browse Source

报考数据-批量考试登记-选择学员修改逻辑

Tang 3 years ago
parent
commit
fe74c1ce05

+ 9 - 0
src/newApi/applicationData.js

@@ -137,4 +137,13 @@ export default {
             data
         })
     },
+    //导入前检查身份证是否存在
+    inquiresystemsubscribecheckIdCardData(data) {
+        return request({
+            url: '/system/subscribe/checkIdCardData',
+            method: 'post',
+            data
+        })
+    },
+    
 }

+ 36 - 3
src/views/education/examManagement/applicationData/bulkImportPlan/newRegister.vue

@@ -347,12 +347,45 @@ export default {
         });
     },
     advanced() {
+      if (!this.formData.applyId || !this.formData.applySiteAddress) {
+        this.$message.warning("请先选择考试计划和考试地点");
+        return;
+      }
       this.dialogPLS = true;
       this.idcordList = this.formData.idCards;
     },
     submitChecksPals() {
-      this.formData.idCards = this.idcordList;
-      this.dialogPLS = false;
+      if (this.idcordList) {
+        let as = this.idcordList.split("\n") || [];
+        let newArr = [];
+        var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
+        for (let i = 0; i < as.length; i++) {
+          if (newArr.indexOf(as[i]) === -1 && reg.test(as[i])) {
+            newArr.push(as[i]);
+          }
+        }
+        if (newArr.length) {
+          let idCardObj = newArr.map((item) => {
+            return { idCard: item };
+          });
+          let data = {
+            applyId: this.formData.applyId,
+            applySiteAddress: this.formData.applySiteAddress,
+            list: idCardObj,
+          };
+          this.$api.inquiresystemsubscribecheckIdCardData(data).then((res) => {
+            this.formData.idCards = newArr.join("\n");
+            this.dialogPLS = false;
+          });
+        } else {
+          this.idcordList = ''
+          this.$message.warning("已删除重复身份证号码和无效身份证号码,请重新输入有效身份证号码")
+          return
+        }
+      } else {
+        this.formData.idCards = this.idcordList;
+        this.dialogPLS = false;
+      }
     },
     /**
      * 窗口下载模板
@@ -376,7 +409,7 @@ export default {
       let formData = new FormData();
       formData.append("file", file);
       this.$api
-        .inquiresystemsubscribeimportIdsDataFilter(formData)
+        .editsystemimportIdsData(formData)
         .then((res) => {
           if (!res.data.length) {
             this.$message.warning("未检测到上传学员数据,请检查上传文件");