fix 完善用户操作权限

This commit is contained in:
yxh 2023-04-22 14:58:52 +08:00
parent 232e578a6b
commit 0f84ec41ea
3 changed files with 21 additions and 6 deletions

View File

@ -34,7 +34,7 @@ app.component('pagination', pagination)
app.use(pinia)
.use(uploader)
.use(router)
.use(ElementPlus, { i18n: i18n.global.t })
.use(ElementPlus)
.use(i18n)
.use(VueGridLayout)
.use(VueUeditorWrap)

View File

@ -89,6 +89,7 @@ interface RoleState {
menuProps: {
children: string;
label: string;
disabled: string;
};
rules: object;
}
@ -108,7 +109,7 @@ export default defineComponent({
status: 1,
listOrder: 0,
remark: '',
menuIds:[]
menuIds:[],
},
//
rules: {
@ -123,6 +124,7 @@ export default defineComponent({
menuProps: {
children: 'children',
label: 'title',
disabled:'disabled'
},
});
//
@ -182,7 +184,12 @@ export default defineComponent({
//
const getMenuData = () => {
getRoleParams().then((res:any)=>{
state.menuData = proxy.handleTree(res.data.menu, "id","pid");
const menus = res.data.menu??[]
const accessMenus = res.data.accessMenus??[]
menus.map((item:any)=>{
item.disabled = !accessMenus.includes(item.id)
})
state.menuData = proxy.handleTree(menus, "id","pid");
})
};
const resetForm = ()=>{
@ -195,7 +202,7 @@ export default defineComponent({
status: 1,
listOrder: 0,
remark: '',
menuIds:[]
menuIds:[],
}
};
/** 树权限(展开/折叠)*/

View File

@ -25,7 +25,8 @@
v-for="role in roleList"
:key="'role-'+role.id"
:label="role.name"
:value="role.id">
:value="role.id"
:disabled="role.disabled">
</el-option>
</el-select>
</el-form-item>
@ -245,7 +246,14 @@ export default defineComponent({
const initTableData = () => {
//
getParams().then((res:any)=>{
roleList.value = res.data.roleList??[];
const roles = res.data.roleList??[];
const roleAccess = res.data.roleAccess??[];
roles.map((item:any)=>{
if(!roleAccess.includes(item.id)){
item.disabled = true
}
})
roleList.value = roles
postList.value = res.data.posts??[];
});
};