Browse Source

项目端用户绑定网格员功能 init

origin/feature/monitoring
liuchuang 4 years ago
parent
commit
56f885d9b8
  1. 52
      src/views/modules/sys/user-add-or-update.vue

52
src/views/modules/sys/user-add-or-update.vue

@ -83,6 +83,15 @@
<el-input v-model="dataForm.mobile" <el-input v-model="dataForm.mobile"
:placeholder="$t('user.mobile')"></el-input> :placeholder="$t('user.mobile')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="staffName"
label="关联网格员">
<div>
<el-input style="width: 70%" v-model="dataForm.wgyInfo.staffName" readonly
placeholder="绑定网格员"></el-input>
<el-button type="text" @click="relationEpmetStaffUser(dataForm.mobile)">点击绑定</el-button>
<el-button type="text" @click="unbindEpmetUser()">清空</el-button>
</div>
</el-form-item>
<el-form-item prop="roleIdList" <el-form-item prop="roleIdList"
:label="$t('user.roleIdList')" :label="$t('user.roleIdList')"
class="role-list"> class="role-list">
@ -157,7 +166,17 @@ export default {
status: 1, status: 1,
verifyFlag: '0', verifyFlag: '0',
verifyMobile: '', verifyMobile: '',
userTagKey: '' userTagKey: '',
wgyInfo: {
id: '',
sysUserId: '',
staffId: '',
staffName: '',
mobile: '',
agencyId: '',
agencyAllName: '',
customerId: ''
}
}, },
verifyMobileList: [], verifyMobileList: [],
userTagDictList: [] userTagDictList: []
@ -239,6 +258,33 @@ export default {
}) })
this.getUserTagDicList() 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 () { getDeptList () {
return this.$http.get('/sys/dept/list').then(({ data: res }) => { return this.$http.get('/sys/dept/list').then(({ data: res }) => {
@ -324,6 +370,10 @@ export default {
if (this.dataForm.verifyFlag === '0') { if (this.dataForm.verifyFlag === '0') {
this.dataForm.verifyMobile = '' 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.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
...this.dataForm, ...this.dataForm,
roleIdList: [ roleIdList: [

Loading…
Cancel
Save