优化用户新增的角色选择

pull/1/head
面包骑士 2024-09-23 10:20:40 +08:00
parent 57ce2e523c
commit 8827e1bbff
1 changed files with 10 additions and 9 deletions

View File

@ -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() {