|
|
@ -42,14 +42,14 @@ |
|
|
|
:total="total"></el-pagination> |
|
|
|
:total="total"></el-pagination> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-drawer :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '专家'" :visible.sync="expertVisible" |
|
|
|
<el-drawer :title="isDetail ? '查看' : (!isAdd ? '编辑' : '新增') + '专家'" :visible.sync="expertVisible" size="580px" |
|
|
|
size="580px" class="dialog" :wrapperClosable="false" custom-class="expert-dia" @close="closeExpert"> |
|
|
|
class="dialog" :wrapperClosable="false" custom-class="expert-dia" @close="closeExpert"> |
|
|
|
<el-form class="overflow" ref="form" :model="form" :rules="rules" label-width="120px" :disabled="isDetail"> |
|
|
|
<el-form class="overflow" ref="form" :model="form" :rules="rules" label-width="120px" :disabled="isDetail"> |
|
|
|
<el-form-item prop="userName" label="姓名"> |
|
|
|
<el-form-item prop="userName" label="姓名"> |
|
|
|
<el-input v-model.trim="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
<el-input v-model.trim="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input> |
|
|
|
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item prop="password" label="登录密码"> |
|
|
|
<!-- <el-form-item prop="password" label="登录密码"> |
|
|
|
<el-input type="password" v-model.trim="form.password" placeholder="为空则默认密码:手机号码后六位" show-password></el-input> |
|
|
|
<el-input type="password" v-model.trim="form.password" placeholder="为空则默认密码:手机号码后六位" show-password></el-input> |
|
|
@ -104,7 +104,6 @@ export default { |
|
|
|
if (value) { |
|
|
|
if (value) { |
|
|
|
const pattern = /^1[3456789]\d{9}$/ |
|
|
|
const pattern = /^1[3456789]\d{9}$/ |
|
|
|
if (pattern.test(value)) { |
|
|
|
if (pattern.test(value)) { |
|
|
|
// this.phoneChange() |
|
|
|
|
|
|
|
callback() |
|
|
|
callback() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
callback(new Error('请输入正确手机号格式')) |
|
|
|
callback(new Error('请输入正确手机号格式')) |
|
|
@ -145,6 +144,7 @@ export default { |
|
|
|
universityFrom: '', |
|
|
|
universityFrom: '', |
|
|
|
sex: 1, |
|
|
|
sex: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
originForm: {}, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
|
userName: [ |
|
|
|
userName: [ |
|
|
|
{ required: true, message: '请输入姓名', trigger: "blur" } |
|
|
|
{ required: true, message: '请输入姓名', trigger: "blur" } |
|
|
@ -156,6 +156,9 @@ export default { |
|
|
|
{ validator: emailPass, trigger: 'blur' } |
|
|
|
{ validator: emailPass, trigger: 'blur' } |
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
isAdd: true, |
|
|
|
|
|
|
|
origiPhone: '', |
|
|
|
|
|
|
|
phoneReapeat: false, |
|
|
|
educations: [ |
|
|
|
educations: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
id: 1, |
|
|
|
id: 1, |
|
|
@ -205,6 +208,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
mounted () { |
|
|
|
|
|
|
|
this.originForm = JSON.parse(JSON.stringify(this.form)) |
|
|
|
this.getList() |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
@ -260,6 +264,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 添加员工 |
|
|
|
// 添加员工 |
|
|
|
add () { |
|
|
|
add () { |
|
|
|
|
|
|
|
this.isAdd = true |
|
|
|
this.expertVisible = true |
|
|
|
this.expertVisible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.form.clearValidate() |
|
|
|
this.$refs.form.clearValidate() |
|
|
@ -297,10 +302,45 @@ export default { |
|
|
|
// 编辑/查看 |
|
|
|
// 编辑/查看 |
|
|
|
async queryExpert (row, isDetail) { |
|
|
|
async queryExpert (row, isDetail) { |
|
|
|
this.isDetail = isDetail |
|
|
|
this.isDetail = isDetail |
|
|
|
|
|
|
|
this.isAdd = false |
|
|
|
this.expertVisible = true |
|
|
|
this.expertVisible = true |
|
|
|
const { data } = await this.$get(`${this.api.expertDetail}?accountId=${row.accountId}`) |
|
|
|
const { data } = await this.$get(`${this.api.expertDetail}?accountId=${row.accountId}`) |
|
|
|
|
|
|
|
this.origiPhone = data.phone |
|
|
|
this.form = data |
|
|
|
this.form = data |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 手机号输入回调 |
|
|
|
|
|
|
|
async phoneChange () { |
|
|
|
|
|
|
|
const { form, isAdd, origiPhone: origin } = this |
|
|
|
|
|
|
|
const { phone, userName } = form |
|
|
|
|
|
|
|
if (phone && /^1[3456789]\d{9}$/.test(phone)) { |
|
|
|
|
|
|
|
// 编辑的时候,修改后的手机号跟原手机号相同则不用判重 |
|
|
|
|
|
|
|
if (origin === phone && !isAdd) { |
|
|
|
|
|
|
|
this.phoneReapeat = false |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const { data } = await this.$get(this.api.searchForExpertByPhone, { |
|
|
|
|
|
|
|
phone, |
|
|
|
|
|
|
|
accountId: form.accountId |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (data) { |
|
|
|
|
|
|
|
if (isAdd) { |
|
|
|
|
|
|
|
this.form = data |
|
|
|
|
|
|
|
this.$refs.form.clearValidate() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Util.errorMsg('该手机号已存在!') |
|
|
|
|
|
|
|
this.phoneReapeat = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (isAdd) { |
|
|
|
|
|
|
|
// 如果该学号没有对应的专家,则清空所有信息,除了姓名手机号 |
|
|
|
|
|
|
|
this.form = JSON.parse(JSON.stringify(this.originForm)) |
|
|
|
|
|
|
|
this.form.phone = phone |
|
|
|
|
|
|
|
this.form.userName = userName |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.phoneReapeat = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
submitExpert () { |
|
|
|
submitExpert () { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
@ -308,6 +348,7 @@ export default { |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
this.submiting = true |
|
|
|
this.submiting = true |
|
|
|
const form = JSON.parse(JSON.stringify(this.form)) |
|
|
|
const form = JSON.parse(JSON.stringify(this.form)) |
|
|
|
|
|
|
|
if (this.phoneReapeat) return Util.warningMsg('该手机号已存在!') |
|
|
|
if (form.accountId) { |
|
|
|
if (form.accountId) { |
|
|
|
this.$post(this.api.modifyExpert, form).then(res => { |
|
|
|
this.$post(this.api.modifyExpert, form).then(res => { |
|
|
|
Util.successMsg("编辑成功!") |
|
|
|
Util.successMsg("编辑成功!") |
|
|
|