Browse Source

close #785 学生导入数据验证

liqk 3 năm trước cách đây
mục cha
commit
0c016db4fe

+ 2 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/stuAccount.js

@@ -102,6 +102,8 @@ export default {
   idRepErr: '账号已存在,将覆盖原有账号',
   stuYearErr: '学生学级数据错误',
   classYearErr: '班级年级错误',
+  noFormatErr: '座号格式错误',
+  classFormatErr: '班级格式错误',
   importOk: '导入成功',
   
   // Authorization.vue

+ 0 - 26
TEAMModelOS/ClientApp/src/view/student-account/stuMgt/IImportStudent.less

@@ -1,40 +1,14 @@
-.import-student .ivu-modal-content {
-    // background-color: #383838 !important;
-    height: 750px;
-}
-
-.import-student .ivu-modal-header {
-    border-color: var(--border-color);
-    // background-color: #383838;
-}
-
-.import-student .ivu-modal-footer {
-    border: none;
-}
 
 .import-student .content {
     text-align: center;
 }
 
-.import-student .ivu-modal-mask {
-    background-color: rgba(20,20,20,.7);
-}
-
-.import-student .ivu-upload-list-file {
-    display: none;
-}
-
 .import-student .ivu-table,.import-student td.ivu-table-column-center, .import-student th.ivu-table-column-center {
     // background: none;
     color: var(--second-text-color);
     border-bottom: 1px solid var(--border-color);
 }
 .ivu-table .account-error-row-bg {
-    /*background: -webkit-linear-gradient(left, #383838, #442F2E); 
-    background: -o-linear-gradient(right, #383838, #442F2E); 
-    background: -moz-linear-gradient(right, #383838, #442F2E); 
-    background: linear-gradient(to right,#383838, #442F2E);*/
-    // background: #442F2E;
     background: rgb(204, 150, 150);
 }
 .ivu-table .account-warning-row-bg {

+ 16 - 6
TEAMModelOS/ClientApp/src/view/student-account/stuMgt/ImportStudent.vue

@@ -83,10 +83,12 @@
                     <p v-show="excelValid.idRep.includes(row.id)" class="account-warning-tips">{{$t('stuAccount.idRepErr') }}</p>
                     <p v-show="excelValid.stuYear.includes(row.id)" class="account-error-tips">{{$t('stuAccount.stuYearErr') }}</p>
                     <p v-show="excelValid.classYear.includes(row.id)" class="account-error-tips">{{$t('stuAccount.classYearErr') }}</p>
+                    <p v-show="excelValid.noErr.includes(row.id)" class="account-error-tips">11{{$t('stuAccount.noFormatErr') }}</p>
+                    <p v-show="excelValid.classErr.includes(row.id)" class="account-error-tips">22{{$t('stuAccount.classFormatErr') }}</p>
                 </template>
             </Table>
             <p style="margin-top:15px;">{{$t('stuAccount.passwordTips')}}</p>
-            <Button class="confirm-btn" :disabled="!!excelValid.idErr.length || !!excelValid.classYear.length || !!excelValid.stuYear.length" :loading="uploadLoading" @click="saveFileData">
+            <Button class="confirm-btn" :disabled="!!excelValid.idErr.length || !!excelValid.classYear.length || !!excelValid.stuYear.length || !!excelValid.noErr.length || !!excelValid.classErr.length" :loading="uploadLoading" @click="saveFileData">
                 {{$t('stuAccount.submitList')}}
             </Button>
         </div>
@@ -124,7 +126,8 @@ export default {
                 classYear: [],
                 idErr: [], //id格式不对
                 idRep: [], // id已存在
-
+                noErr:[],
+                classErr:[]
             },
             totalNum: 0,
             seatRepeatNum: 0,
@@ -205,10 +208,10 @@ export default {
             if (this.excelValid.fieldIds.indexOf(row.id) >= 0 || this.excelValid.noReaptIds.indexOf(row.id) >= 0 || this.excelValid.reaptIds.indexOf(row.id) >= 0 || this.excelValid.gradeIds.indexOf(row.id) >= 0) {
                 className = className + 'account-warning-row-bg'
             } else {
-                if (!(this.repeatAccounts.length == 0 || this.repeatAccounts.indexOf(row.id) == -1) || row.seatRepeat || this.excelValid.idErr.includes(row.id) || this.excelValid.classYear.includes(row.id) || this.excelValid.stuYear.includes(row.id)) {
+                if (this.repeatAccounts.includes(row.id) || row.seatRepeat || this.excelValid.idErr.includes(row.id) || this.excelValid.classYear.includes(row.id) || this.excelValid.stuYear.includes(row.id) || this.excelValid.noErr.includes(row.id) || this.excelValid.classErr.includes(row.id)) {
                     className = className + 'account-error-row-bg '
                 }
-                if (row.classId == '' || row.classId == null || row.no == '' || row.no == null) {
+                if (!row.classId || !row.no) {
                     className = className + 'account-warning-row-bg'
                 }
             }
@@ -353,7 +356,6 @@ export default {
                 let stud = this.students.filter((studInfo) => {
                     return (classItem.classId == studInfo.classNo && classItem.classYear == studInfo.classYear)
                 })
-
                 updStuds.push(...stud)
             })
 
@@ -546,7 +548,7 @@ export default {
                             _this.seatRepeatNum++
                         }
                     }
-                    //验证入学年学级是否合法
+                    //验证入学年学级是否合法
                     if (!yearZG.test(item.stuYear)) {
                         _this.excelValid.stuYear.push(item.id)
                     }
@@ -558,6 +560,14 @@ export default {
                     if (!idZG.test(item.id)) {
                         _this.excelValid.idErr.push(item.id)
                     }
+                    //no格式检查(只能包含数字)
+                    if (!idZG.test(item.no)) {
+                        _this.excelValid.noErr.push(item.id)
+                    }
+                    //classid格式检查(只能包含数字)
+                    if (!idZG.test(item.classId)) {
+                        _this.excelValid.classErr.push(item.id)
+                    }
 
                     // 导入数据中 ID 重複
                     let repID = array.filter((i, key) => {