fetch(modify):完善按钮权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m25s

This commit is contained in:
sexygoat
2026-02-03 17:20:50 +08:00
parent de9753f42d
commit 192c6f1d26
22 changed files with 885 additions and 232 deletions

View File

@@ -17,7 +17,7 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')">新增账号</ElButton>
<ElButton @click="showDialog('add')" v-permission="'account:add'">新增账号</ElButton>
</template>
</ArtTableHeader>
@@ -117,6 +117,7 @@
import { ElMessageBox, ElMessage } from 'element-plus'
import type { FormRules } from 'element-plus'
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import { AccountService } from '@/api/modules/account'
import { RoleService } from '@/api/modules/role'
@@ -128,6 +129,8 @@
defineOptions({ name: 'Account' }) // 定义组件名称,用于 KeepAlive 缓存控制
const { hasAuth } = useAuth()
const dialogType = ref('add')
const dialogVisible = ref(false)
const roleDialogVisible = ref(false)
@@ -375,20 +378,36 @@
width: 200,
fixed: 'right',
formatter: (row: any) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showRoleDialog(row)
}),
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
}),
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAccount(row)
})
])
const buttons = []
if (hasAuth('account:patch_role')) {
buttons.push(
h(ArtButtonTable, {
icon: '&#xe72b;',
onClick: () => showRoleDialog(row)
})
)
}
if (hasAuth('account:edit')) {
buttons.push(
h(ArtButtonTable, {
type: 'edit',
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('account:delete')) {
buttons.push(
h(ArtButtonTable, {
type: 'delete',
onClick: () => deleteAccount(row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])