From 3570b062a1aa898362cd071301a6ab4204484ecd Mon Sep 17 00:00:00 2001
From: sexygoat <1538832180@qq.com>
Date: Thu, 26 Feb 2026 10:06:11 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=8D=95:=20?=
=?UTF-8?q?=E5=8F=B3=E9=94=AE=20=E7=BB=99=E8=A7=92=E8=89=B2=E5=88=86?=
=?UTF-8?q?=E9=85=8D=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/core/tables/ArtTable.vue | 7 +
.../enterprise-customer/index.vue | 42 ++--
.../asset-management/device-list/index.vue | 61 +++--
.../iot-card-management/index.vue | 48 ++--
.../order-management/order-list/index.vue | 4 +-
src/views/product/shop/index.vue | 12 +
src/views/system/role/index.vue | 208 ++++++++++++++++--
7 files changed, 302 insertions(+), 80 deletions(-)
diff --git a/src/components/core/tables/ArtTable.vue b/src/components/core/tables/ArtTable.vue
index 0d69979..dcca5ef 100644
--- a/src/components/core/tables/ArtTable.vue
+++ b/src/components/core/tables/ArtTable.vue
@@ -28,6 +28,7 @@
fontWeight: '500'
}"
@row-click="handleRowClick"
+ @row-contextmenu="handleRowContextmenu"
@selection-change="handleSelectionChange"
>
@@ -174,6 +175,7 @@
'update:currentPage',
'update:pageSize',
'row-click',
+ 'row-contextmenu',
'size-change',
'current-change',
'selection-change'
@@ -274,6 +276,11 @@
emit('row-click', row, column, event)
}
+ // 行右键事件
+ const handleRowContextmenu = (row: any, column: any, event: any) => {
+ emit('row-contextmenu', row, column, event)
+ }
+
// 选择变化事件
const handleSelectionChange = (selection: any) => {
emit('selection-change', selection)
diff --git a/src/views/account-management/enterprise-customer/index.vue b/src/views/account-management/enterprise-customer/index.vue
index 92c174f..bcaeedb 100644
--- a/src/views/account-management/enterprise-customer/index.vue
+++ b/src/views/account-management/enterprise-customer/index.vue
@@ -19,7 +19,9 @@
@refresh="handleRefresh"
>
- 新增企业客户
+ 新增企业客户
@@ -35,6 +37,7 @@
:marginTop="10"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
+ @row-contextmenu="handleRowContextMenu"
>
@@ -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)
+ }
+ }
diff --git a/src/views/asset-management/device-list/index.vue b/src/views/asset-management/device-list/index.vue
index f67bfaa..d145e23 100644
--- a/src/views/asset-management/device-list/index.vue
+++ b/src/views/asset-management/device-list/index.vue
@@ -56,6 +56,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@selection-change="handleSelectionChange"
+ @row-contextmenu="handleRowContextMenu"
>
@@ -1073,32 +1074,18 @@
{
prop: 'operation',
label: '操作',
- width: 200,
+ width: 120,
fixed: 'right',
formatter: (row: Device) => {
- const buttons = []
-
- if (hasAuth('devices:look_binding')) {
- buttons.push(
- h(ArtButtonTable, {
- text: '查看卡片',
- onClick: () => handleViewCards(row)
- })
- )
- }
-
// Show "更多操作" only if user has at least one operation permission
- const hasAnyOperationPermission = hasAuth('devices:delete')
+ const hasAnyOperationPermission = hasAuth('devices:delete') || hasAuth('devices:look_binding')
if (hasAnyOperationPermission) {
- buttons.push(
- h(ArtButtonTable, {
- text: '更多操作',
- onContextmenu: (e: MouseEvent) => showDeviceOperationMenu(e, row.device_no)
- })
- )
+ return h(ArtButtonTable, {
+ text: '更多操作',
+ onContextmenu: (e: MouseEvent) => showDeviceOperationMenu(e, row.device_no)
+ })
}
-
- return h('div', { style: 'display: flex; gap: 0; align-items: center;' }, buttons)
+ return null
}
}
])
@@ -1432,6 +1419,9 @@
// 设备操作路由
const handleDeviceOperation = (command: string, deviceNo: string) => {
switch (command) {
+ case 'view-cards':
+ handleViewCardsByDeviceNo(deviceNo)
+ break
case 'reboot':
handleRebootDevice(deviceNo)
break
@@ -1453,6 +1443,16 @@
}
}
+ // 通过设备号查看卡片
+ const handleViewCardsByDeviceNo = (deviceNo: string) => {
+ const device = deviceList.value.find(d => d.device_no === deviceNo)
+ if (device) {
+ handleViewCards(device)
+ } else {
+ ElMessage.error('未找到该设备')
+ }
+ }
+
// 通过设备号删除设备
const handleDeleteDeviceByNo = async (deviceNo: string) => {
// 先根据设备号找到设备对象
@@ -1628,7 +1628,17 @@
// 设备操作菜单项配置
const deviceOperationMenuItems = computed((): MenuItemType[] => {
- const items: MenuItemType[] = [
+ const items: MenuItemType[] = []
+
+ // 添加查看卡片到菜单最前面
+ if (hasAuth('devices:look_binding')) {
+ items.push({
+ key: 'view-cards',
+ label: '查看卡片'
+ })
+ }
+
+ items.push(
{
key: 'reboot',
label: '重启设备'
@@ -1649,7 +1659,7 @@
key: 'set-wifi',
label: '设置WiFi'
}
- ]
+ )
if (hasAuth('devices:delete')) {
items.push({
@@ -1676,6 +1686,11 @@
handleDeviceOperation(item.key, deviceNo)
}
+
+ // 处理表格行右键菜单
+ const handleRowContextMenu = (row: Device, column: any, event: MouseEvent) => {
+ showDeviceOperationMenu(event, row.device_no)
+ }