Browse Source

#2843 C412 学生管理--导入名单,增加重编班级提示选项

XW 8 months ago
parent
commit
a405d8d5ef

+ 4 - 0
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -4635,6 +4635,10 @@ const LANG_EN_US = {
         idFormatWarning: 'Error:Student account format is a 4-12 digit number',
         gradeWarning: 'Warning: Error in grade',
         setNoErr: "Error: The seat number is duplicated with a student already imported in this class.",
+        rewriteList1: 'I want to reorganize the class list',
+        rewriteList2: '(The student associations in the relevant classes will be cleared and the class list will be reconfigured. The student accounts will not be deleted)',
+        rewriteList3: 'You will reorganize the class. The students with the original seat numbers will be reset to students with no associated classes',
+        rewriteList4: 'You have checked the reorganization class list. Students with duplicate seat numbers will be reset to students with no associated classes. Do you still want to continue importing?',
         downloadText: '(Download List Sample)',
         idRepErr: 'Account already exists, will overwrite the original account',
         stuYearErr: "Student's enrolled year data is incorrect",

+ 4 - 0
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -4633,6 +4633,10 @@ const LANG_ZH_CN = {
         idFormatWarning: '错误:学生账号格式为4-12位数字',
         gradeWarning: '警告:年级错误',
         setNoErr: "错误:座号与校内该班级已有学生重复",
+        rewriteList1: '我要重编班级名单',
+        rewriteList2: '(将清空相关班级内学生关联,再重新配置班级名单,不会删除学生账号)',
+        rewriteList3: '您将重编班级,原座号学生将重置为未关联班级学生',
+        rewriteList4: '您已勾选重编班级名单,重复座号的学生将重置为未关联班级学生,请问您仍要继续导入吗?',
         downloadText: '(下载名单模板)',
         idRepErr: '账号已存在,将覆盖原有账号',
         stuYearErr: '学生学级数据错误',

+ 4 - 0
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -4640,6 +4640,10 @@ const LANG_ZH_TW = {
         idFormatWarning: '錯誤:學生帳號格式為4-12位數字',
         gradeWarning: '警告:年級錯誤',
         setNoErr: "錯誤:座號與校內該班級已有學生重復",
+        rewriteList1: '我要重編班級名單',
+        rewriteList2: '(將清空相關班級內學生關聯,再重新配置班級名單,不會刪除學生帳號)',
+        rewriteList3: '您將重編班級,原座號學生將重設為未關聯班級學生',
+        rewriteList4: '您已勾選重編班級名單,重複座號的學生將重設為未關聯班級學生,請問您仍要繼續匯入嗎?',
         downloadText: '(下載名單模板)',
         idRepErr: '帳號已存在,將覆蓋原有帳號',
         stuYearErr: '學生學級數據錯誤',

+ 59 - 17
TEAMModelOS/ClientApp/src/view/student-account/import/StuImport.vue

@@ -52,6 +52,12 @@
           <p class="import-info" v-show="$store.state.config.srvAdr == 'China'">
             {{$t('stuAccount.sit16')}}
           </p>
+          <p class="import-info" style="margin-top: 10px;">
+            <Checkbox v-model="rewriteList">
+              <span>{{ $t('stuAccount.rewriteList1') }}</span>
+              <span>{{ $t('stuAccount.rewriteList2') }}</span>
+            </Checkbox>
+          </p>
         </div>
         <Upload multiple type="drag" action="" :before-upload="customUpload" style="margin-top:20px">
           <div class="file-area">
@@ -175,7 +181,12 @@
             <p v-show="excelValid.imeiErr.includes(row.id)" class="account-error-tips">{{$t('stuAccount.sit20') }}</p>
             <p v-show="excelValid.genderErr.includes(row.id)" class="account-error-tips">{{$t('stuAccount.sit21') }}</p>
             <!-- 与已有账号对比 -->
-            <p v-show="dataValid.noRep.includes(row.id)" class="account-error-tips">{{$t('stuAccount.setNoErr')}}</p>
+            <p v-show="dataValid.noRep.includes(row.id)" class="account-error-tips" :style="{'text-decoration': rewriteList ? 'line-through' : 'none'}">
+              {{ $t('stuAccount.setNoErr') }}
+              <Tooltip :content="$t('stuAccount.rewriteList3')" placement="left" v-show="rewriteList">
+                <Icon type="md-alert" />
+              </Tooltip>
+            </p>
             <p v-show="dataValid.idRep.includes(row.id)" class="account-warning-tips">{{$t('stuAccount.idRepErr') }}</p>
           </template>
         </Table>
@@ -195,6 +206,13 @@
           </Button>
         </div>
       </div>
+      <Modal v-model="importing" :title="$t('schoolBaseInfo.warmTips')" width="680" class="point-modal tree-upload-modal">
+        <div>{{ $t('stuAccount.sit27') }}</div>
+        <div slot="footer">
+          <Button type="text" @click="importAgain()">{{ $t('teachermgmt.impText4') }}</Button>
+          <Button type="primary" @click="doConfirm()">{{ $t('teachermgmt.impText7') }}</Button>
+        </div>
+      </Modal>
     </vuescroll>
   </div>
 </template>
@@ -244,11 +262,14 @@ export default {
       dataValid: {
         idRep: [], // id已存在
         noRep: [], // 座号重复
+        noStu: [], // 座号重复的原学生信息
       },
       tableData: [],
       tableTitle: [],
       tableLoading: false,
-      isTableCrt: false
+      isTableCrt: false,
+      rewriteList: false,
+      importing: false,
     }
   },
   computed: {
@@ -296,27 +317,27 @@ export default {
         this.$Message.error(this.$t('stuAccount.importTips12'))
         return
       }
-      if (this.dataValid?.noRep.length) {
+      if (this.dataValid?.noRep.length && !this.rewriteList) {
         this.$Message.error(this.$t('stuAccount.importTips12'))
         return
       }
-      console.log(this.tableData)
-      let hasNoGenderData = this.tableData.some(i => !i.gender)
-      if (hasNoGenderData) {
+      if(this.rewriteList) {
         this.$Modal.confirm({
           title: this.$t('schoolBaseInfo.warmTips'),
-          content: this.$t('stuAccount.sit27'),
+          content: this.$t('stuAccount.rewriteList4'),
           okText: this.$t('teachermgmt.impText7'),
           cancelText: this.$t('teachermgmt.impText4'),
           onOk: () => {
-            this.doConfirm()
+            let hasNoGenderData = this.tableData.some(i => !i.gender)
+            hasNoGenderData ? (this.importing = true) : this.doConfirm()
           },
           onCancel: () => {
             this.importAgain()
           }
         });
       } else {
-        this.doConfirm()
+        let hasNoGenderData = this.tableData.some(i => !i.gender)
+        hasNoGenderData ? (this.importing = true) : this.doConfirm()
       }
     },
     doConfirm() {
@@ -334,19 +355,32 @@ export default {
         delete item.classroom
         return item
       })
+      if(this.rewriteList) {
+        this.dataValid.noStu.forEach(item => {
+          item.no = null
+          item.pw = item.id
+        })
+      }
       let schoolCode = this.$store.state.userInfo.schoolCode
-      this.$api.stuAccount.ImportStudent(schoolCode, temp).then(
+      this.$api.stuAccount.ImportStudent(schoolCode, this.dataValid.noStu).then(
         (res) => {
           if (!res.error) {
-            this.$Message.info(this.$t('stuAccount.importOk'))
-            this.$store.commit('student/importStudents', temp)
-            this.checkUpdateClass(temp)
-            this.viewStatus = 'finish'
+            this.$api.stuAccount.ImportStudent(schoolCode, temp).then((resolve) => {
+              if (!resolve.error) {
+                this.$Message.info(this.$t('stuAccount.importOk'))
+                this.$store.commit('student/importStudents', temp)
+                this.checkUpdateClass(temp)
+                this.viewStatus = 'finish'
+              } else {
+                this.$Message.info(this.$t('stuAccount.importErr'))
+              }
+            }, (err) => {
+
+            })
           } else {
             this.$Message.info(this.$t('stuAccount.importErr'))
           }
-        },
-        (err) => {
+        }, (err) => {
 
         }
       ).finally(() => {
@@ -355,6 +389,7 @@ export default {
     },
     async importAgain() {
       this.viewStatus = 'tips'
+      this.importing = false
       this.initData()
     },
     initData() {
@@ -551,7 +586,10 @@ export default {
           let res = originStu.periodId == this.periodId && originStu.id != item.id && originStu.classNo == item.classId && originStu.classYear?.toString() == item.classYear && (item.no && originStu.no == item.no)
           return res
         })
-        if (s) this.dataValid.noRep.push(item.id)
+        if (s) {
+          this.dataValid.noRep.push(item.id)
+          this.dataValid.noStu.push(JSON.parse(JSON.stringify(s)))
+        }
       })
 
       //筛选已存在的账号
@@ -682,6 +720,7 @@ export default {
       this.dataValid = {
         idRep: [], // id已存在
         noRep: [], // 座号重复
+        noStu: [], // 座号重复的原学生信息
       }
     }
   },
@@ -858,4 +897,7 @@ export default {
 .excel-data-wrap .ivu-table td {
   background: none;
 }
+.account-error-tips .ivu-tooltip-inner {
+  max-width: none;
+}
 </style>