|
|
@ -317,25 +317,19 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
getStaffDetail(accountId) { // 获取员工详情 |
|
|
|
getStaffDetail(accountId) { // 获取员工详情 |
|
|
|
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => { |
|
|
|
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => { |
|
|
|
let { data, status} = res; |
|
|
|
let { data } = res; |
|
|
|
if (status === 200) { |
|
|
|
this.teacherForm = data; |
|
|
|
this.teacherForm = data; |
|
|
|
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); |
|
|
|
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); |
|
|
|
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { |
|
|
|
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { |
|
|
|
i.cascaderValue = [i.staffArchitectureId, i.gradeId] |
|
|
|
i.cascaderValue = [i.staffArchitectureId, i.gradeId] |
|
|
|
return i; |
|
|
|
return i; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
}).catch(res => {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
resetPassword(row) { // 重置密码 |
|
|
|
resetPassword(row) { // 重置密码 |
|
|
|
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { |
|
|
|
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { |
|
|
|
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { |
|
|
|
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
util.successMsg("重置成功"); |
|
|
|
util.successMsg("重置成功"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
util.errorMsg(res.message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}).catch(() => { |
|
|
|
}).catch(() => { |
|
|
@ -355,7 +349,7 @@ export default { |
|
|
|
this.majorList = this.$refs.getSelectData.majorList; |
|
|
|
this.majorList = this.$refs.getSelectData.majorList; |
|
|
|
this.getStaffDetail(row.accountId); |
|
|
|
this.getStaffDetail(row.accountId); |
|
|
|
}, |
|
|
|
}, |
|
|
|
async accountChange() { // 切换账号 |
|
|
|
accountChange() { // 切换账号 |
|
|
|
if (this.teacherForm.account) { |
|
|
|
if (this.teacherForm.account) { |
|
|
|
let url = ""; |
|
|
|
let url = ""; |
|
|
|
if (this.isAdd) { |
|
|
|
if (this.isAdd) { |
|
|
@ -363,16 +357,16 @@ export default { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`; |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`; |
|
|
|
} |
|
|
|
} |
|
|
|
let res = await this.$post(url); |
|
|
|
this.$post(url).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
if (res.status === 200) { |
|
|
|
this.accountReapeat = false; |
|
|
|
this.accountReapeat = false; |
|
|
|
} else { |
|
|
|
} |
|
|
|
util.warningMsg("该账号已存在"); |
|
|
|
}).catch( err => { |
|
|
|
this.accountReapeat = true; |
|
|
|
this.accountReapeat = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
async workNumberChange() { // 切换工号 |
|
|
|
workNumberChange() { // 切换工号 |
|
|
|
if (this.teacherForm.workNumber) { |
|
|
|
if (this.teacherForm.workNumber) { |
|
|
|
let url = ""; |
|
|
|
let url = ""; |
|
|
|
if (this.isAdd) { |
|
|
|
if (this.isAdd) { |
|
|
@ -380,16 +374,16 @@ export default { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`; |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`; |
|
|
|
} |
|
|
|
} |
|
|
|
let res = await this.$post(url); |
|
|
|
this.$post(url).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
if (res.status === 200) { |
|
|
|
this.workNumberReapeat = false; |
|
|
|
this.workNumberReapeat = false; |
|
|
|
} else { |
|
|
|
} |
|
|
|
util.warningMsg("该员工工号已存在"); |
|
|
|
}).catch( err => { |
|
|
|
this.workNumberReapeat = true; |
|
|
|
this.workNumberReapeat = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
async phoneChange() { // 切换手机号 |
|
|
|
phoneChange() { // 切换手机号 |
|
|
|
let regex = /^1[3456789]\d{9}$/; |
|
|
|
let regex = /^1[3456789]\d{9}$/; |
|
|
|
if (regex.test(this.teacherForm.phone)) { |
|
|
|
if (regex.test(this.teacherForm.phone)) { |
|
|
|
let url = ""; |
|
|
|
let url = ""; |
|
|
@ -398,16 +392,16 @@ export default { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`; |
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`; |
|
|
|
} |
|
|
|
} |
|
|
|
let res = await this.$post(url); |
|
|
|
this.$post(url).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
if (res.status === 200) { |
|
|
|
this.phoneRepeat = false; |
|
|
|
this.phoneRepeat = false; |
|
|
|
} else { |
|
|
|
} |
|
|
|
util.warningMsg("该手机号已存在"); |
|
|
|
}).catch( err => { |
|
|
|
this.phoneRepeat = true; |
|
|
|
this.phoneRepeat = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
async emailChange() { // 切换邮箱 |
|
|
|
emailChange() { // 切换邮箱 |
|
|
|
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; |
|
|
|
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; |
|
|
|
if (regex.test(this.teacherForm.email)) { |
|
|
|
if (regex.test(this.teacherForm.email)) { |
|
|
|
let url = ""; |
|
|
|
let url = ""; |
|
|
@ -416,13 +410,13 @@ export default { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`; |
|
|
|
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`; |
|
|
|
} |
|
|
|
} |
|
|
|
let res = await this.$post(url); |
|
|
|
this.$post(url).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
if (res.status === 200) { |
|
|
|
this.emailRepeat = false; |
|
|
|
this.emailRepeat = false; |
|
|
|
} else { |
|
|
|
} |
|
|
|
util.warningMsg("该邮箱已存在"); |
|
|
|
}).catch( err => { |
|
|
|
this.emailRepeat = true; |
|
|
|
this.emailRepeat = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
roleChange(value) { // 处理切换角色 |
|
|
|
roleChange(value) { // 处理切换角色 |
|
|
@ -484,23 +478,15 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.teacherForm.accountId) { |
|
|
|
if (this.teacherForm.accountId) { |
|
|
|
this.$post(this.api.modifyStaff, data).then(res => { |
|
|
|
this.$post(this.api.modifyStaff, data).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
util.successMsg("编辑成功"); |
|
|
|
util.successMsg("编辑成功"); |
|
|
|
this.closeTeacher(); |
|
|
|
this.closeTeacher(); |
|
|
|
this.getData(); |
|
|
|
this.getData(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
util.errorMsg(res.message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
}).catch(res => {}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$post(this.api.saveStaff, data).then(res => { |
|
|
|
this.$post(this.api.saveStaff, data).then(res => { |
|
|
|
if (res.status === 200) { |
|
|
|
util.successMsg("添加成功"); |
|
|
|
util.successMsg("添加成功"); |
|
|
|
this.closeTeacher(); |
|
|
|
this.closeTeacher(); |
|
|
|
this.getData(); |
|
|
|
this.getData(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
util.errorMsg(res.message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
}).catch(res => {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|