fetch(modify):完善按钮权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m25s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m25s
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
@refresh="handleRefresh"
|
||||
>
|
||||
<template #left>
|
||||
<ElButton @click="showDialog('add')">新增权限</ElButton>
|
||||
<ElButton @click="showDialog('add')" v-permission="'permission:add'">新增权限</ElButton>
|
||||
</template>
|
||||
</ArtTableHeader>
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
import type { CreatePermissionParams, PermissionTreeNode } from '@/types/api'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
|
||||
import {
|
||||
PermissionType,
|
||||
@@ -138,6 +139,8 @@
|
||||
|
||||
defineOptions({ name: 'Permission' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
perm_name: '',
|
||||
@@ -299,16 +302,27 @@
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
formatter: (row: PermissionTreeNode) => {
|
||||
return h('div', { style: 'display: flex; gap: 8px;' }, [
|
||||
h(ArtButtonTable, {
|
||||
type: 'edit',
|
||||
onClick: () => showDialog('edit', row)
|
||||
}),
|
||||
h(ArtButtonTable, {
|
||||
type: 'delete',
|
||||
onClick: () => deletePermission(row)
|
||||
})
|
||||
])
|
||||
const buttons = []
|
||||
|
||||
if (hasAuth('permission:edit')) {
|
||||
buttons.push(
|
||||
h(ArtButtonTable, {
|
||||
type: 'edit',
|
||||
onClick: () => showDialog('edit', row)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (hasAuth('permission:delete')) {
|
||||
buttons.push(
|
||||
h(ArtButtonTable, {
|
||||
type: 'delete',
|
||||
onClick: () => deletePermission(row)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user