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="'shop:add'">新增店铺</ElButton>
</template>
</ArtTableHeader>
@@ -310,6 +310,7 @@
} 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 ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
@@ -323,6 +324,8 @@
defineOptions({ name: 'Shop' })
const { hasAuth } = useAuth()
const dialogType = ref('add')
const dialogVisible = ref(false)
const customerAccountDialogVisible = ref(false)
@@ -606,16 +609,28 @@
width: 200,
fixed: 'right',
formatter: (row: ShopResponse) => {
return h('div', { style: 'display: flex; gap: 8px;' }, [
h(ArtButtonTable, {
text: '查看客户',
onClick: () => viewCustomerAccounts(row)
}),
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showShopOperationMenu(e, row)
})
])
const buttons = []
if (hasAuth('shop:look_customer')) {
buttons.push(
h(ArtButtonTable, {
text: '查看客户',
onClick: () => viewCustomerAccounts(row)
})
)
}
// 只要有编辑或删除权限之一,就显示更多操作按钮
if (hasAuth('shop:edit') || hasAuth('shop:delete')) {
buttons.push(
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showShopOperationMenu(e, row)
})
)
}
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
}
}
])
@@ -874,20 +889,30 @@
}
// 店铺操作菜单项配置
const shopOperationMenuItems = computed((): MenuItemType[] => [
{
const shopOperationMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = []
items.push({
key: 'defaultRoles',
label: '默认角色'
},
{
key: 'edit',
label: '编辑'
},
{
key: 'delete',
label: '删除'
})
if (hasAuth('shop:edit')) {
items.push({
key: 'edit',
label: '编辑'
})
}
])
if (hasAuth('shop:delete')) {
items.push({
key: 'delete',
label: '删除'
})
}
return items
})
// 显示店铺操作右键菜单
const showShopOperationMenu = (e: MouseEvent, row: ShopResponse) => {