修改工单: 右键 给角色分配权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m45s

This commit is contained in:
sexygoat
2026-02-26 10:06:11 +08:00
parent dccad819cf
commit 3570b062a1
7 changed files with 302 additions and 80 deletions

View File

@@ -19,7 +19,9 @@
@refresh="handleRefresh"
>
<template #left>
<ElButton @click="showDialog('add')" v-permission="'enterprise_customer:add'">新增企业客户</ElButton>
<ElButton @click="showDialog('add')" v-permission="'enterprise_customer:add'"
>新增企业客户</ElButton
>
</template>
</ArtTableHeader>
@@ -35,6 +37,7 @@
:marginTop="10"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@row-contextmenu="handleRowContextMenu"
>
<template #default>
<ElTableColumn v-for="col in columns" :key="col.prop || col.type" v-bind="col" />
@@ -455,11 +458,20 @@
{
prop: 'operation',
label: '操作',
width: 200,
width: 280,
fixed: 'right',
formatter: (row: EnterpriseItem) => {
const buttons = []
if (hasAuth('enterprise_customer:look_customer')) {
buttons.push(
h(ArtButtonTable, {
text: '账号列表',
onClick: () => viewCustomerAccounts(row)
})
)
}
if (hasAuth('enterprise_customer:card_authorization')) {
buttons.push(
h(ArtButtonTable, {
@@ -469,12 +481,8 @@
)
}
// 只要有编辑、账号列表、修改密码权限之一,就显示更多操作按钮
if (
hasAuth('enterprise_customer:edit') ||
hasAuth('enterprise_customer:look_customer') ||
hasAuth('enterprise_customer:update_pwd')
) {
// 只要有编辑、修改密码权限之一,就显示更多操作按钮
if (hasAuth('enterprise_customer:edit') || hasAuth('enterprise_customer:update_pwd')) {
buttons.push(
h(ArtButtonTable, {
text: '更多操作',
@@ -756,13 +764,6 @@
const enterpriseOperationMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = []
if (hasAuth('enterprise_customer:look_customer')) {
items.push({
key: 'accountList',
label: '账号列表'
})
}
if (hasAuth('enterprise_customer:edit')) {
items.push({
key: 'edit',
@@ -793,9 +794,6 @@
if (!currentOperatingEnterprise.value) return
switch (item.key) {
case 'accountList':
viewCustomerAccounts(currentOperatingEnterprise.value)
break
case 'edit':
showDialog('edit', currentOperatingEnterprise.value)
break
@@ -804,4 +802,12 @@
break
}
}
// 处理表格行右键菜单
const handleRowContextMenu = (row: EnterpriseItem, column: any, event: MouseEvent) => {
// 如果用户有编辑或修改密码权限,显示右键菜单
if (hasAuth('enterprise_customer:edit') || hasAuth('enterprise_customer:update_pwd')) {
showEnterpriseOperationMenu(event, row)
}
}
</script>