|
|
|
@ -88,8 +88,8 @@ |
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看账号' : (form.userId ? '编辑账号' : '新增账号')" :visible.sync="userVisible" width="576px" @close="closeUser" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="110px" label-suffix=":" :disabled="isDetail"> |
|
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
|
<el-input v-model="form.account" ref="account" placeholder="请输入账号" @change="accountChange"></el-input> |
|
|
|
|
<el-form-item prop="workNumber" label="工号/学号"> |
|
|
|
|
<el-input v-model="form.workNumber" placeholder="请输入工号/学号" @change="workNumberChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="userName" label="用户姓名"> |
|
|
|
|
<el-input v-model="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
@ -109,9 +109,6 @@ |
|
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
|
<el-input v-model="form.email" placeholder="请输入邮箱" @change="emailChange"></el-input> |
|
|
|
|
</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" maxlength="11" @change="phoneChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
@ -203,12 +200,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
account: [ |
|
|
|
|
{ required: true, message: '请输入职工账号', trigger: 'blur' }, |
|
|
|
|
{ |
|
|
|
|
pattern: /^[A-Za-z0-9]+$/, |
|
|
|
|
message: '请输入正确的账号', |
|
|
|
|
trigger: 'blur' |
|
|
|
|
} |
|
|
|
|
{ required: true, message: '请输入职工账号', trigger: 'blur' } |
|
|
|
|
], |
|
|
|
|
userName: [ |
|
|
|
|
{ required: true, message: '请输入用户姓名', trigger: 'blur' } |
|
|
|
@ -250,7 +242,6 @@ export default { |
|
|
|
|
workNumberRepeat: false, |
|
|
|
|
phoneRepeat: false, |
|
|
|
|
emailRepeat: false, |
|
|
|
|
originalAccount: '', |
|
|
|
|
originalWorkNumber: '', |
|
|
|
|
originalPhone: '', |
|
|
|
|
originalEmail: '', |
|
|
|
@ -304,10 +295,11 @@ export default { |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
platformId: Setting.platformId, |
|
|
|
|
roleId: this.role, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.pageList.records |
|
|
|
|
this.total = res.pageList.total |
|
|
|
|
if(!this.listData.length && this.total){ |
|
|
|
|
}).then(({ pageList }) => { |
|
|
|
|
const { records, total } = pageList |
|
|
|
|
this.listData = records |
|
|
|
|
this.total = total |
|
|
|
|
if(!records.length && total){ |
|
|
|
|
this.page-- |
|
|
|
|
this.getData() |
|
|
|
|
} |
|
|
|
@ -341,28 +333,24 @@ export default { |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
accountChange(){ |
|
|
|
|
if(this.form.account && this.form.account !== this.originalAccount){ |
|
|
|
|
// type: 0:教师端,1:学生端,2:无端 |
|
|
|
|
this.$post(`${this.api.checkAccount}?account=${this.form.account}&type=2&platformId=${Setting.platformId}${this.form.accountId ? '&accountId=' + this.form.accountId : ''}`).then(res => { |
|
|
|
|
this.accountRepeat = false |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.accountRepeat = true |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.accountRepeat = false |
|
|
|
|
} |
|
|
|
|
// 组合账号 |
|
|
|
|
renderAccount() { |
|
|
|
|
const form = this.form |
|
|
|
|
// 平台id-端id-schoolId-workNumber组成账号 |
|
|
|
|
form.account = `${Setting.platformId}-2-${this.schoolId}-${form.workNumber}` |
|
|
|
|
}, |
|
|
|
|
workNumberChange(){ |
|
|
|
|
if(this.form.workNumber && this.form.workNumber !== this.originalWorkNumber){ |
|
|
|
|
this.$post(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2&platformId=${Setting.platformId}`).then(res => { |
|
|
|
|
this.workNumberRepeat = false |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.workNumberRepeat = true |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.workNumberRepeat = false |
|
|
|
|
} |
|
|
|
|
if(this.form.workNumber && this.form.workNumber !== this.originalWorkNumber){ |
|
|
|
|
this.$post(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2&platformId=${Setting.platformId}`).then(res => { |
|
|
|
|
this.workNumberRepeat = false |
|
|
|
|
this.renderAccount() |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.workNumberRepeat = true |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.workNumberRepeat = false |
|
|
|
|
this.renderAccount() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
phoneChange(){ |
|
|
|
|
if(this.form.phone && this.form.phone !== this.originalPhone){ |
|
|
|
@ -390,7 +378,6 @@ export default { |
|
|
|
|
this.$refs.form.resetFields() |
|
|
|
|
this.form.userId = '' |
|
|
|
|
this.form.accountId = '' |
|
|
|
|
this.originalAccount = '' |
|
|
|
|
this.originalWorkNumber = '' |
|
|
|
|
this.accountRepeat = false |
|
|
|
|
this.workNumberRepeat = false |
|
|
|
@ -418,7 +405,6 @@ export default { |
|
|
|
|
password: '' |
|
|
|
|
} |
|
|
|
|
// 先保存该用户的账号工号等信息,判重的时候如果判断到修改的字段跟这里保存的值一样,则不调判重的接口 |
|
|
|
|
this.originalAccount = data.account |
|
|
|
|
this.originalWorkNumber = data.workNumber |
|
|
|
|
this.originalPhone = data.phone |
|
|
|
|
this.originalEmail = data.email |
|
|
|
|