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

@@ -21,13 +21,23 @@
type="primary"
@click="handleBatchAllocate"
:disabled="!selectedDevices.length"
v-permission="'devices:batch_allocation'"
>
批量分配
</ElButton>
<ElButton @click="handleBatchRecall" :disabled="!selectedDevices.length">
<ElButton
@click="handleBatchRecall"
:disabled="!selectedDevices.length"
v-permission="'devices:batch_recycle'"
>
批量回收
</ElButton>
<ElButton type="info" @click="handleBatchSetSeries" :disabled="!selectedDevices.length">
<ElButton
type="info"
@click="handleBatchSetSeries"
:disabled="!selectedDevices.length"
v-permission="'devices:batch_setting'"
>
批量设置套餐系列
</ElButton>
</template>
@@ -546,6 +556,7 @@
} 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 ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
@@ -555,6 +566,7 @@
defineOptions({ name: 'DeviceList' })
const { hasAuth } = useAuth()
const router = useRouter()
const loading = ref(false)
const allocateLoading = ref(false)
@@ -1064,16 +1076,29 @@
width: 200,
fixed: 'right',
formatter: (row: Device) => {
return h('div', { style: 'display: flex; gap: 0; align-items: center;' }, [
h(ArtButtonTable, {
text: '查看卡片',
onClick: () => handleViewCards(row)
}),
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showDeviceOperationMenu(e, row.device_no)
})
])
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')
if (hasAnyOperationPermission) {
buttons.push(
h(ArtButtonTable, {
text: '更多操作',
onContextmenu: (e: MouseEvent) => showDeviceOperationMenu(e, row.device_no)
})
)
}
return h('div', { style: 'display: flex; gap: 0; align-items: center;' }, buttons)
}
}
])
@@ -1602,32 +1627,39 @@
}
// 设备操作菜单项配置
const deviceOperationMenuItems = computed((): MenuItemType[] => [
{
key: 'reboot',
label: '重启设备'
},
{
key: 'reset',
label: '恢复出厂'
},
{
key: 'speed-limit',
label: '设置限速'
},
{
key: 'switch-card',
label: '切换SIM卡'
},
{
key: 'set-wifi',
label: '设置WiFi'
},
{
key: 'delete',
label: '删除设备'
const deviceOperationMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = [
{
key: 'reboot',
label: '重启设备'
},
{
key: 'reset',
label: '恢复出厂'
},
{
key: 'speed-limit',
label: '设置限速'
},
{
key: 'switch-card',
label: '切换SIM卡'
},
{
key: 'set-wifi',
label: '设置WiFi'
}
]
if (hasAuth('devices:delete')) {
items.push({
key: 'delete',
label: '删除设备'
})
}
])
return items
})
// 显示设备操作菜单
const showDeviceOperationMenu = (e: MouseEvent, deviceNo: string) => {