|
@@ -59,14 +59,14 @@
|
|
|
<p>{{(row.password == '' || row.password == null)? '— —' : row.password.value+''}}</p>
|
|
|
</template>
|
|
|
<template slot-scope="{ row,index }" slot="status">
|
|
|
- <p :class="(repeatAccounts.length == 0 || repeatAccounts.indexOf(row.account) == -1) ? 'account-success-tips':'account-error-tips'">{{(repeatAccounts.length == 0 || repeatAccounts.indexOf(row.account) == -1)?"":"错误:账号重复!" }}</p>
|
|
|
+ <p :class="(repeatAccounts.length == 0 || repeatAccounts.indexOf(row.studentId) == -1) ? 'account-success-tips':'account-error-tips'">{{(repeatAccounts.length == 0 || repeatAccounts.indexOf(row.studentId) == -1)?"":"错误:账号重复或已存在学校里!" }}</p>
|
|
|
<p :class="(row.classroomCode == '' || row.classroomCode == null) ? 'account-warning-tips':''">{{(row.classroomCode == '' || row.classroomCode == null)?"警告 :未找到指定班级":"" }}</p>
|
|
|
- <p :class="row.seatRepeat? 'account-error-tips':''">{{row.seatRepeat ? "错误:座位号重复":"" }}</p>
|
|
|
+ <p :class="row.seatRepeat? 'account-error-tips':''">{{row.seatRepeat ? "错误:座位号重复或已存在於校內":"" }}</p>
|
|
|
<p :class="(row.seatNo == '' || row.seatNo == null) ? 'account-warning-tips':''">{{(row.seatNo == '' || row.seatNo == null)?"警告 :沒有座號":"" }}</p>
|
|
|
+
|
|
|
</template>
|
|
|
</Table>
|
|
|
<p style="margin-top:15px;">{{$t('stuAccount.passwordTips')}}</p>
|
|
|
- {{'isError: ' + isError }}
|
|
|
<Button class="confirm-btn" :class=" isError == 0 ?'confirm-btn-active':'' " :loading="uploadLoading" @click="saveFileData">
|
|
|
{{$t('stuAccount.submitList')}}
|
|
|
</Button>
|
|
@@ -75,6 +75,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import excel from '../../utils/excel'
|
|
|
+ import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
props: {
|
|
|
isShow: {
|
|
@@ -97,6 +98,7 @@
|
|
|
existNum: 0,
|
|
|
repeatAccounts: [],
|
|
|
noClassroomNum: 0,
|
|
|
+ noSeatNoNum: 0,
|
|
|
uploadLoading: false,
|
|
|
progressPercent: 0,
|
|
|
showProgress: false,
|
|
@@ -120,8 +122,10 @@
|
|
|
components: {
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ students: 'schoolBaseInfo/getStudent', // 學生List
|
|
|
+ }),
|
|
|
isError() {
|
|
|
- console.log(this.noSeatNoNum, 'this.seatRepeatNum + this.repeatNum + this.existNum + this.noClassroomNum + this.noSeatNoNum')
|
|
|
return this.seatRepeatNum + this.repeatNum + this.existNum + this.noClassroomNum + this.noSeatNoNum
|
|
|
},
|
|
|
show: {
|
|
@@ -131,7 +135,6 @@
|
|
|
set(value) {
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
watch: {
|
|
|
},
|
|
@@ -238,11 +241,19 @@
|
|
|
}
|
|
|
return item
|
|
|
})
|
|
|
+
|
|
|
+ // 現在的學生List
|
|
|
+ let studIDs = this.students.map(item => { return item.id })
|
|
|
+
|
|
|
// 计算重复账号数量和重复账号,过滤重复账号
|
|
|
this.totalNum = this.tableData.length
|
|
|
+ // 取得Excel 全部的ID
|
|
|
let accounts = this.tableData.map(item => { return item.studentId })
|
|
|
- this.repeatAccounts = accounts.filter((item, index, self) => self.indexOf(item) != index)
|
|
|
+ // 合併
|
|
|
+ let cocatIds = studIDs.concat(accounts);
|
|
|
+ this.repeatAccounts = cocatIds.filter((item, index, self) => self.indexOf(item) != index)
|
|
|
this.repeatAccounts = this.repeatAccounts.filter((item, index, self) => self.indexOf(item) === index)
|
|
|
+
|
|
|
// 直接过滤重复账号
|
|
|
// this.tableData = this.tableData.filter((item, index, self) => {
|
|
|
// if (accounts.indexOf(item.account) === index) {
|
|
@@ -253,8 +264,10 @@
|
|
|
// });
|
|
|
accounts = accounts.filter((item, index, self) => self.indexOf(item) === index)
|
|
|
this.repeatNum = this.totalNum - accounts.length + this.repeatAccounts.length
|
|
|
+
|
|
|
// 根据班级Code GroupBy,判断班级座位号是否重复
|
|
|
let classStu = this.groupBy(this.tableData, 'classroomCode')
|
|
|
+
|
|
|
for (let item of classStu) {
|
|
|
let seatNoArr = item.map(item => { return item.seatNo })
|
|
|
for (let index in item) {
|
|
@@ -275,10 +288,8 @@
|
|
|
let noRoom = this.tableData.filter(item => { return (item.classroomCode == '' || item.classroomCode == null) })
|
|
|
this.noClassroomNum = noRoom.length
|
|
|
|
|
|
- // 筛选沒有有座號
|
|
|
+ // 筛选沒有座號
|
|
|
let noSeatNo = this.tableData.filter(item => { return (item.seatNo == '' || item.seatNo == null) })
|
|
|
- console.log(noSeatNo, 'noSeatNo')
|
|
|
- console.log(noSeatNo.length)
|
|
|
this.noSeatNoNum = noSeatNo.length
|
|
|
|
|
|
//整理TtableData
|
|
@@ -292,6 +303,17 @@
|
|
|
return item
|
|
|
})
|
|
|
|
|
|
+ // 檢查與現在的學生名單同教室裡是否有重複座號
|
|
|
+ this.tableData.forEach( (item) => {
|
|
|
+ let studdd = this.students.filter( (studInfo) => {
|
|
|
+ return (item.classroomCode == studInfo.classId && item.seatNo == studInfo.no)
|
|
|
+ })
|
|
|
+ if(studdd.length > 0) {
|
|
|
+ item.seatRepeat = true
|
|
|
+ this.seatRepeatNum++
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
this.$Message.info(this.$t('stuAccount.importTips11'))
|
|
|
this.tableLoading = false
|
|
|
} else {
|
|
@@ -428,15 +450,11 @@
|
|
|
},
|
|
|
created() {
|
|
|
this.initData()
|
|
|
- console.log(this.academicYear, 'academicYear')
|
|
|
},
|
|
|
mounted() {
|
|
|
-
|
|
|
},
|
|
|
watch: {
|
|
|
- academicYear: function(newVal, oldVal){
|
|
|
- console.log(newVal)
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|