diff --git a/src/views/modules/sys/user-add-or-update.vue b/src/views/modules/sys/user-add-or-update.vue index bdafb95..dfd21dd 100644 --- a/src/views/modules/sys/user-add-or-update.vue +++ b/src/views/modules/sys/user-add-or-update.vue @@ -83,6 +83,15 @@ + +
+ + 点击绑定 + 清空 +
+
@@ -157,7 +166,17 @@ export default { status: 1, verifyFlag: '0', verifyMobile: '', - userTagKey: '' + userTagKey: '', + wgyInfo: { + id: '', + sysUserId: '', + staffId: '', + staffName: '', + mobile: '', + agencyId: '', + agencyAllName: '', + customerId: '' + } }, verifyMobileList: [], userTagDictList: [] @@ -239,6 +258,33 @@ export default { }) this.getUserTagDicList() }, + // 根据手机号获取产品工作人员信息 + relationEpmetStaffUser (mobile) { + if (mobile === '') { + return this.$message.warning('请先填写手机号') + } + this.$http.get(`/sys/sysepmetuserrelation/getstaffuser/${mobile}`).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.dataForm.wgyInfo = { + ...this.dataForm.wgyInfo, + ...res.data + } + if (res.data.staffId === '') { + return this.$message.warning('未匹配到当前手机号绑定网格员') + } + }).catch(() => { }) + }, + // 清空已绑定的产品工作人员信息 + unbindEpmetUser () { + this.dataForm.wgyInfo.staffId = '' + this.dataForm.wgyInfo.staffName = '' + this.dataForm.wgyInfo.mobile = '' + this.dataForm.wgyInfo.agencyId = '' + this.dataForm.wgyInfo.agencyAllName = '' + this.dataForm.wgyInfo.customerId = '' + }, // 获取部门列表 getDeptList () { return this.$http.get('/sys/dept/list').then(({ data: res }) => { @@ -324,6 +370,10 @@ export default { if (this.dataForm.verifyFlag === '0') { this.dataForm.verifyMobile = '' } + // 判断当前用户手机号是否与网格员手机号匹配 + if (this.dataForm.wgyInfo.mobile !== '' && this.dataForm.mobile !== this.dataForm.wgyInfo.mobile) { + return this.$message.error('当前手机号与网格员信息不匹配,请重新绑定') + } this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', { ...this.dataForm, roleIdList: [