|
@@ -76,6 +76,7 @@
|
|
|
<p :class="(excelValid.reaptIds.length == 0 || excelValid.reaptIds.indexOf(row.id) == -1) ? 'account-success-tips':'account-warning-tips'">{{(excelValid.reaptIds.length == 0 || excelValid.reaptIds.indexOf(row.id) == -1)?"": $t('stuAccount.idWarning') }}</p>
|
|
|
<p :class="row.seatRepeat? 'account-error-tips':''">{{row.seatRepeat ? $t('stuAccount.setNoErr'):"" }}</p>
|
|
|
<p :class="(excelValid.gradeIds.length == 0 || excelValid.gradeIds.indexOf(row.id) == -1) ? 'account-success-tips':'account-warning-tips'">{{(excelValid.gradeIds.length == 0 || excelValid.gradeIds.indexOf(row.id) == -1)?"": $t('stuAccount.gradeWarning') }}</p>
|
|
|
+ <p :class="(excelValid.idErr.length == 0 || !excelValid.idErr.includes(row.id)) ? 'account-success-tips':'account-error-tips'">{{(excelValid.idErr.length == 0 || !excelValid.idErr.includes(row.id))?"": $t('stuAccount.idFormatWarning') }}</p>
|
|
|
|
|
|
</template>
|
|
|
</Table>
|
|
@@ -113,7 +114,8 @@ export default {
|
|
|
fieldIds: [],
|
|
|
noReaptIds: [],
|
|
|
reaptIds: [],
|
|
|
- gradeIds: []
|
|
|
+ gradeIds: [],
|
|
|
+ idErr: [] //id格式不对
|
|
|
},
|
|
|
totalNum: 0,
|
|
|
seatRepeatNum: 0,
|
|
@@ -175,11 +177,10 @@ export default {
|
|
|
},
|
|
|
rowClassName(row, index) {
|
|
|
let className = ''
|
|
|
-
|
|
|
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) {
|
|
|
+ if (!(this.repeatAccounts.length == 0 || this.repeatAccounts.indexOf(row.id) == -1) || row.seatRepeat || this.excelValid.idErr.includes(row.id)) {
|
|
|
className = className + 'account-error-row-bg '
|
|
|
}
|
|
|
if (row.classId == '' || row.classId == null || row.no == '' || row.no == null) {
|
|
@@ -257,8 +258,6 @@ export default {
|
|
|
if (flag) {
|
|
|
// 处理表格导入数据类型
|
|
|
this.tableData = results.filter(item => {
|
|
|
- // let arr = item.id.split('#') //账号id不用#
|
|
|
- // if (arr.length == 2) {
|
|
|
for (let i of this.systemColumn) {
|
|
|
if (i != 'no') {
|
|
|
if (typeof item[i] === 'number') {
|
|
@@ -272,9 +271,6 @@ export default {
|
|
|
// item.pw = item.id
|
|
|
}
|
|
|
}
|
|
|
- // } else {
|
|
|
- // item._disabled = true
|
|
|
- // }
|
|
|
return item
|
|
|
})
|
|
|
|
|
@@ -293,13 +289,30 @@ export default {
|
|
|
// 取出Excel重複的班級
|
|
|
let classIds = []
|
|
|
this.tableData.forEach((item) => {
|
|
|
- if (classIds.indexOf(item.classId) < 0) { classIds.push(item.classId) }
|
|
|
+ // if (classIds.indexOf(item.classId) < 0) { classIds.push(item.classId) }
|
|
|
+ // 班级结构调整后判断班级唯一不能只是classId还需要搭配classYear
|
|
|
+ if (classIds.length) {
|
|
|
+ let res = classIds.find(classItem => {
|
|
|
+ return classItem.classId == item.classId && classItem.classYear == item.classYear
|
|
|
+ })
|
|
|
+ if (!res) {
|
|
|
+ classIds.push({
|
|
|
+ classId: item.classId,
|
|
|
+ classYear: item.classYear
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ classIds.push({
|
|
|
+ classId: item.classId,
|
|
|
+ classYear: item.classYear
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
// 先篩選出會被修改的學生
|
|
|
let updStuds = []
|
|
|
- classIds.forEach((id) => {
|
|
|
+ classIds.forEach((classItem) => {
|
|
|
let stud = this.students.filter((studInfo) => {
|
|
|
- return (id == studInfo.classNo)
|
|
|
+ return (classItem.classId == studInfo.classNo && classItem.classYear == studInfo.classYear)
|
|
|
})
|
|
|
|
|
|
updStuds.push(...stud)
|
|
@@ -406,15 +419,16 @@ export default {
|
|
|
this.file = null
|
|
|
this.tableData = []
|
|
|
this.tableTitle = [
|
|
|
- {
|
|
|
- type: 'selection',
|
|
|
- width: 80,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // type: 'selection',
|
|
|
+ // width: 80,
|
|
|
+ // align: 'center'
|
|
|
+ // },
|
|
|
{
|
|
|
title: this.$t('stuAccount.seatNo'),
|
|
|
key: 'no',
|
|
|
- width: 80
|
|
|
+ width: 80,
|
|
|
+ align:'center'
|
|
|
},
|
|
|
{
|
|
|
title: this.$t('stuAccount.account'),
|
|
@@ -429,7 +443,7 @@ export default {
|
|
|
key: 'name'
|
|
|
},
|
|
|
{
|
|
|
- title: '学级',
|
|
|
+ title: this.$t('stuAccount.academicYear'),
|
|
|
key: 'stuYear'
|
|
|
},
|
|
|
{
|
|
@@ -437,14 +451,14 @@ export default {
|
|
|
key: 'className'
|
|
|
},
|
|
|
{
|
|
|
- title: '年级',
|
|
|
+ title: this.$t('stuAccount.grade'),
|
|
|
slot: 'classYear'
|
|
|
},
|
|
|
{
|
|
|
title: this.$t('stuAccount.classroomCode'),
|
|
|
- key: 'classId'
|
|
|
+ key: 'classId',
|
|
|
+ align:'center'
|
|
|
},
|
|
|
-
|
|
|
{
|
|
|
title: this.$t('stuAccount.abnormalStatus'),
|
|
|
slot: 'status'
|
|
@@ -455,6 +469,7 @@ export default {
|
|
|
let _this = this
|
|
|
var excelData = data
|
|
|
let validFalg = false
|
|
|
+ let zg = /^[0-9]+$/
|
|
|
// 先歸零
|
|
|
this.errNumReset()
|
|
|
excelData.forEach((item, index, array) => {
|
|
@@ -475,6 +490,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //ID格式检查(只能包含数字)
|
|
|
+ if (!zg.test(item.id)) {
|
|
|
+ _this.excelValid.idErr.push(item.id)
|
|
|
+ }
|
|
|
+
|
|
|
// ID 重複
|
|
|
let repID = array.filter((i, key) => {
|
|
|
return i.id == item.id && index != key
|
|
@@ -543,9 +563,9 @@ export default {
|
|
|
mounted() {
|
|
|
},
|
|
|
watch: {
|
|
|
- period:{
|
|
|
- handler(n,o){
|
|
|
- this.tableData.forEach(item=>{
|
|
|
+ period: {
|
|
|
+ handler(n, o) {
|
|
|
+ this.tableData.forEach(item => {
|
|
|
item.periodId = this.period
|
|
|
})
|
|
|
}
|