优化用户新增的角色选择
parent
57ce2e523c
commit
8827e1bbff
|
@ -232,7 +232,7 @@
|
|||
<treeselect v-model="form.deptId" :options="deptOptions"
|
||||
:show-count="true"
|
||||
placeholder="请选择归属部门"
|
||||
@change="checkRole()"/>
|
||||
@input="checkRole"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -414,6 +414,8 @@ export default {
|
|||
dateRange: [],
|
||||
// 岗位选项
|
||||
postOptions: [],
|
||||
// 所有部门
|
||||
deptListAll: [],
|
||||
// 角色选项
|
||||
roleOptions: [],
|
||||
roleListAll: [],
|
||||
|
@ -515,10 +517,12 @@ export default {
|
|||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
listDept(this.queryParams).then(response => {
|
||||
this.deptListAll = response.data
|
||||
const deptList = response.data.map(dept => {
|
||||
return {
|
||||
id: dept.deptId,
|
||||
label: dept.deptName,
|
||||
firmCode: dept.firmCode,
|
||||
parentId: dept.parentId,
|
||||
children: null
|
||||
}
|
||||
|
@ -572,19 +576,16 @@ export default {
|
|||
this.resetForm("form");
|
||||
},
|
||||
// 选择部门筛选角色
|
||||
checkRole() {
|
||||
console.log(this.roleOptions)
|
||||
console.log(this.roleListAll)
|
||||
checkRole(vuler) {
|
||||
let firmCode = ''
|
||||
this.roleListAll.forEach(item => {
|
||||
if (this.form.deptId === item.deptId) {
|
||||
firmCode = item.firmCode;
|
||||
this.deptListAll.forEach(item => {
|
||||
if (item.deptId == vuler){
|
||||
firmCode = item.firmCode
|
||||
}
|
||||
})
|
||||
console.log(firmCode)
|
||||
this.roleOptions = this.roleListAll.filter(item => item.firmCode === firmCode);
|
||||
console.log(firmCode)
|
||||
console.log(this.roleOptions)
|
||||
console.log(this.roleListAll)
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
|
|
Loading…
Reference in New Issue