|
|
|
@ -30,8 +30,8 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center" width="300"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="editStudent(scope.row,true)">查看</el-button> |
|
|
|
|
<el-button type="text" @click="editStudent(scope.row,false)">编辑</el-button> |
|
|
|
|
<el-button type="text" @click="editStudent(scope.row,true,true)">查看</el-button> |
|
|
|
|
<el-button type="text" @click="editStudent(scope.row,false,false)">编辑</el-button> |
|
|
|
|
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button> |
|
|
|
|
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> |
|
|
|
|
<el-switch |
|
|
|
@ -50,9 +50,17 @@ |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看学生' : (isAdd ? '新增学生' : '编辑学生')" :visible.sync="studentVisible" |
|
|
|
|
<el-dialog :title="isRepeat ? '查看学生' : (isAdd ? '新增学生' : '编辑学生')" :visible.sync="studentVisible" |
|
|
|
|
width="30%" center @close="closeStudent" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" :disabled="isDetail" label-width="100px"> |
|
|
|
|
<el-form-item prop="schoolAppellationId" label="所在院校"> |
|
|
|
|
<el-select v-model="form.schoolAppellationId" placeholder="默认为当前院校(可修改)" filterable @change="worknumberChange"> |
|
|
|
|
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="workNumber" label="学生学号"> |
|
|
|
|
<el-input v-model="form.workNumber" placeholder="请输入学生学号" @change="worknumberChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
|
<el-input v-model="form.account" placeholder="请输入学生账号" @change="accountChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
@ -62,25 +70,17 @@ |
|
|
|
|
<el-form-item prop="roleId" label="账号角色"> |
|
|
|
|
学生 |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="workNumber" label="学生学号"> |
|
|
|
|
<el-input v-model="form.workNumber" placeholder="" @change="worknumberChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
|
<el-input v-model="form.phone" placeholder="可用于登录平台,以及找回密码" maxlength="11"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
|
<el-input v-model="form.email" placeholder="可用于登录平台,以及找回密码"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="schoolAppellationId" label="所在院校"> |
|
|
|
|
<el-select v-model="form.schoolAppellationId" placeholder="默认为当前院校(可修改)" filterable @change="worknumberChange"> |
|
|
|
|
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="uniqueIdentificationAccount" label="唯一标识"> |
|
|
|
|
<el-input disabled v-model="form.uniqueIdentificationAccount"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isRepeat"> |
|
|
|
|
<el-button @click="studentVisible = false">取消</el-button> |
|
|
|
|
<el-button type="primary" @click="saveData">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
@ -146,6 +146,7 @@ export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
isDetail: false, |
|
|
|
|
isRepeat: false, |
|
|
|
|
keyword: '', |
|
|
|
|
schoolId: 2105, |
|
|
|
|
classId: this.$route.query.classId, |
|
|
|
@ -213,7 +214,6 @@ export default { |
|
|
|
|
phoneRepeat: false, |
|
|
|
|
workNumberRepeat: false, |
|
|
|
|
originalWorkNumber: '', |
|
|
|
|
isDetail: false, |
|
|
|
|
resetVisible: false, |
|
|
|
|
passwordVisible: false, |
|
|
|
|
passwordForm: { |
|
|
|
@ -236,7 +236,7 @@ export default { |
|
|
|
|
this.getSchoolData() |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function(val) { |
|
|
|
|
keyword (val) { |
|
|
|
|
this.getData() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -245,8 +245,8 @@ export default { |
|
|
|
|
let data = { |
|
|
|
|
classId: this.classId, |
|
|
|
|
searchContent: this.encodeString(this.keyword), |
|
|
|
|
page: this.pageNo, |
|
|
|
|
size: this.pageSize |
|
|
|
|
current: this.pageNo, |
|
|
|
|
pageSize: this.pageSize |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.queryStudentList,data).then(res => { |
|
|
|
|
this.studentData = res.data.list |
|
|
|
@ -257,9 +257,9 @@ export default { |
|
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
if(this.accountReapeat) return this.$message.warning(this.accountMsg) |
|
|
|
|
if(this.workNumberRepeat) return this.$message.warning('该学生学号已存在') |
|
|
|
|
if(this.phoneRepeat) return this.$message.warning('该手机号已存在') |
|
|
|
|
if(this.form.studentId) { |
|
|
|
|
// if(this.workNumberRepeat) return this.$message.warning('该学生学号已存在') |
|
|
|
|
// if(this.phoneRepeat) return this.$message.warning('该手机号已存在') |
|
|
|
|
if(!this.isAdd) { |
|
|
|
|
this.form.classId = this.classId |
|
|
|
|
this.$put(this.api.updateStudent,this.form).then(res => { |
|
|
|
|
if(res.errmessage == 'success') { |
|
|
|
@ -272,15 +272,17 @@ export default { |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}else{ |
|
|
|
|
this.form.classId = this.classId |
|
|
|
|
if(this.form.uniqueIdentificationAccount == ''){ |
|
|
|
|
this.form.uniqueIdentificationAccount = new Date().getTime() |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.addStudentToClass,this.form).then(res => { |
|
|
|
|
if(res.errmessage == 'success') { |
|
|
|
|
// if(res.errmessage == 'success') { |
|
|
|
|
this.$message.success('提交成功!'); |
|
|
|
|
this.studentVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}else{ |
|
|
|
|
this.$message.error(res.message); |
|
|
|
|
} |
|
|
|
|
// }else{ |
|
|
|
|
// this.$message.error(res.message); |
|
|
|
|
// } |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
@ -308,16 +310,21 @@ export default { |
|
|
|
|
}, |
|
|
|
|
async worknumberChange(){ |
|
|
|
|
// if(this.form.workNumber !== this.originalWorkNumber){ |
|
|
|
|
let res = await this.$get(this.api.queryWorkNumberIsExist, { |
|
|
|
|
let res = await this.$get(this.api.queryStudentMessage, { |
|
|
|
|
workNumber: this.encodeString(this.form.workNumber), |
|
|
|
|
schoolAppellationId: this.form.schoolAppellationId |
|
|
|
|
}); |
|
|
|
|
if(res.status != 200){ |
|
|
|
|
this.$message.warning('该学生学号已存在'); |
|
|
|
|
this.workNumberRepeat = true |
|
|
|
|
if(res.data){ |
|
|
|
|
this.form = res.data |
|
|
|
|
this.isDetail = true |
|
|
|
|
}else{ |
|
|
|
|
this.workNumberRepeat = false |
|
|
|
|
this.isDetail = false |
|
|
|
|
} |
|
|
|
|
// if(res.status != 200){ |
|
|
|
|
// this.workNumberRepeat = true |
|
|
|
|
// }else{ |
|
|
|
|
// this.workNumberRepeat = false |
|
|
|
|
// } |
|
|
|
|
// }else{ |
|
|
|
|
// this.workNumberRepeat = false |
|
|
|
|
// } |
|
|
|
@ -325,7 +332,7 @@ export default { |
|
|
|
|
async phoneChange(){ |
|
|
|
|
let res = await this.$get(this.api.queryPhone, { phone: this.form.phone }); |
|
|
|
|
if(res.message.length != 0){ |
|
|
|
|
this.$message.warning('该手机号已存在'); |
|
|
|
|
// this.$message.warning('该手机号已存在'); |
|
|
|
|
this.phoneRepeat = true |
|
|
|
|
}else{ |
|
|
|
|
this.phoneRepeat = false |
|
|
|
@ -377,9 +384,10 @@ export default { |
|
|
|
|
this.isAdd = true |
|
|
|
|
this.studentVisible = true |
|
|
|
|
}, |
|
|
|
|
editStudent(row,isDetail){ |
|
|
|
|
editStudent(row,isDetail,isRepeat){ |
|
|
|
|
this.isAdd = false |
|
|
|
|
this.isDetail = isDetail |
|
|
|
|
this.isRepeat = isRepeat |
|
|
|
|
this.studentVisible = true |
|
|
|
|
this.form = Object.assign({},row) |
|
|
|
|
this.originalWorkNumber = row.workNumber |
|
|
|
|