Browse Source

用户管理增加关联部门信息,用于居民端跳转工作端和数据端关联账号使用

feature/syp_points
liuchuang 5 years ago
parent
commit
72a46953e8
  1. 34
      src/views/modules/sys/user-add-or-update.vue

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

@ -35,6 +35,28 @@
:readonly="true" :readonly="true"
:placeholder="$t('user.deptName')"></el-input> :placeholder="$t('user.deptName')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="relationDeptName"
label="关联部门"
class="dept-list">
<el-popover v-model="relationDeptListVisible"
ref="relationDeptListPopover"
placement="bottom-start"
trigger="click">
<el-tree :data="relationDeptList"
:props="{ label: 'name', children: 'children' }"
node-key="id"
ref="relationDeptListTree"
:highlight-current="true"
:expand-on-click-node="false"
accordion
@current-change="relationDeptListTreeCurrentChangeHandle">
</el-tree>
</el-popover>
<el-input v-model="dataForm.relationDeptName"
v-popover:relationDeptListPopover
:readonly="true"
placeholder="关联部门"></el-input>
</el-form-item>
<el-form-item label="用户类型" <el-form-item label="用户类型"
prop="userTagKey"> prop="userTagKey">
<el-select v-model="dataForm.userTagKey" <el-select v-model="dataForm.userTagKey"
@ -120,7 +142,9 @@ export default {
return { return {
visible: false, visible: false,
deptList: [], deptList: [],
relationDeptList: [],
deptListVisible: false, deptListVisible: false,
relationDeptListVisible: false,
roleList: [], roleList: [],
roleIdListDefault: [], roleIdListDefault: [],
dataForm: { dataForm: {
@ -128,6 +152,8 @@ export default {
username: '', username: '',
deptId: '0', deptId: '0',
deptName: '', deptName: '',
relationDeptId: '',
relationDeptName: '',
password: '', password: '',
comfirmPassword: '', comfirmPassword: '',
realName: '', realName: '',
@ -224,6 +250,7 @@ export default {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.deptList = res.data this.deptList = res.data
this.relationDeptList = res.data
}).catch(() => { }) }).catch(() => { })
}, },
// //
@ -256,6 +283,7 @@ export default {
roleIdList: [] roleIdList: []
} }
this.$refs.deptListTree.setCurrentKey(this.dataForm.deptId) this.$refs.deptListTree.setCurrentKey(this.dataForm.deptId)
this.$refs.relationDeptListTree.setCurrentKey(this.dataForm.relationDeptId)
// , // ,
for (var i = 0; i < res.data.roleIdList.length; i++) { for (var i = 0; i < res.data.roleIdList.length; i++) {
if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) { if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) {
@ -272,6 +300,12 @@ export default {
this.dataForm.deptName = data.name this.dataForm.deptName = data.name
this.deptListVisible = false this.deptListVisible = false
}, },
// ,
relationDeptListTreeCurrentChangeHandle (data, node) {
this.dataForm.relationDeptId = data.id
this.dataForm.relationDeptName = data.name
this.relationDeptListVisible = false
},
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {

Loading…
Cancel
Save