refactor: 检测目前所有菜单权限

This commit is contained in:
猿小天
2023-11-24 15:12:46 +08:00
parent fb8b0a5ac6
commit c763333024
22 changed files with 852 additions and 1299 deletions

View File

@@ -3,7 +3,7 @@ import { dict, useCompute, PageQuery, AddReq, DelReq, EditReq, CrudExpose, CrudO
import tableSelector from '/@/components/tableSelector/index.vue';
import {shallowRef, computed, ref, inject} from 'vue';
import manyToMany from '/@/components/manyToMany/index.vue';
import {auth} from '/@/utils/authFunction'
const { compute } = useCompute();
interface CreateCrudOptionsTypes {
@@ -36,8 +36,6 @@ export const createCrudOptions = function ({ crudExpose, tabActivted }: { crudEx
return tabActivted.value === 'receive';
});
//权限判定
const hasPermissions = inject("$hasPermissions")
return {
crudOptions: {
@@ -51,7 +49,7 @@ export const createCrudOptions = function ({ crudExpose, tabActivted }: { crudEx
buttons:{
add:{
show:computed(() =>{
return tabActivted.value !== 'receive'
return tabActivted.value !== 'receive' && auth('messageCenter:Create');
})
},
}
@@ -67,7 +65,7 @@ export const createCrudOptions = function ({ crudExpose, tabActivted }: { crudEx
text:"查看",
type:'text',
iconRight:'View',
show:hasPermissions("messageCenter:Search"),
show:auth("messageCenter:Search"),
click({ index, row }) {
crudExpose.openView({ index, row });
if (tabActivted.value === 'receive') {
@@ -79,7 +77,7 @@ export const createCrudOptions = function ({ crudExpose, tabActivted }: { crudEx
remove: {
iconRight: 'Delete',
type: 'text',
show:hasPermissions('messageCenter:Delete')
show:auth('messageCenter:Delete')
},
},
},