优化用户新增的角色选择

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" <treeselect v-model="form.deptId" :options="deptOptions"
:show-count="true" :show-count="true"
placeholder="请选择归属部门" placeholder="请选择归属部门"
@change="checkRole()"/> @input="checkRole"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -414,6 +414,8 @@ export default {
dateRange: [], dateRange: [],
// //
postOptions: [], postOptions: [],
//
deptListAll: [],
// //
roleOptions: [], roleOptions: [],
roleListAll: [], roleListAll: [],
@ -515,10 +517,12 @@ export default {
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getDeptTree() { getDeptTree() {
listDept(this.queryParams).then(response => { listDept(this.queryParams).then(response => {
this.deptListAll = response.data
const deptList = response.data.map(dept => { const deptList = response.data.map(dept => {
return { return {
id: dept.deptId, id: dept.deptId,
label: dept.deptName, label: dept.deptName,
firmCode: dept.firmCode,
parentId: dept.parentId, parentId: dept.parentId,
children: null children: null
} }
@ -572,19 +576,16 @@ export default {
this.resetForm("form"); this.resetForm("form");
}, },
// //
checkRole() { checkRole(vuler) {
console.log(this.roleOptions)
console.log(this.roleListAll)
let firmCode = '' let firmCode = ''
this.roleListAll.forEach(item => { this.deptListAll.forEach(item => {
if (this.form.deptId === item.deptId) { if (item.deptId == vuler){
firmCode = item.firmCode; firmCode = item.firmCode
} }
}) })
console.log(firmCode)
this.roleOptions = this.roleListAll.filter(item => item.firmCode === firmCode); this.roleOptions = this.roleListAll.filter(item => item.firmCode === firmCode);
console.log(firmCode)
console.log(this.roleOptions) console.log(this.roleOptions)
console.log(this.roleListAll)
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {