From 9f59eb9f5854aa08282b55ad07126c1dc609acc5 Mon Sep 17 00:00:00 2001 From: yangsy Date: Tue, 13 Jan 2026 13:23:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E5=A4=87=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=9D=BF=E5=9D=97=E7=9A=84=E4=BA=A4=E4=BA=92=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/use-alarm-action-column.ts | 51 ++++++++++--------- src/pages/alarm-ignore-page.vue | 31 ++++++++--- src/pages/alarm-log-page.vue | 29 ++++++++--- 3 files changed, 73 insertions(+), 38 deletions(-) diff --git a/src/composables/alarm/use-alarm-action-column.ts b/src/composables/alarm/use-alarm-action-column.ts index 57885a5..4396dd7 100644 --- a/src/composables/alarm/use-alarm-action-column.ts +++ b/src/composables/alarm/use-alarm-action-column.ts @@ -1,11 +1,14 @@ +import { usePermission } from '../permission'; import { deleteCameraIgnoreApi, pageCameraIgnoreApi, saveCameraIgnoreApi, updateDeviceAlarmLogApi, type NdmDeviceAlarmLogResultVO } from '@/apis'; -import { DEVICE_TYPE_LITERALS, tryGetDeviceType } from '@/enums'; +import { DEVICE_TYPE_LITERALS, PERMISSION_TYPE_LITERALS, tryGetDeviceType } from '@/enums'; import { parseErrorFeedback } from '@/utils'; import { useMutation } from '@tanstack/vue-query'; import { NButton, NFlex, NPopconfirm, type DataTableColumn, type DataTableRowData } from 'naive-ui'; import { h, type Ref } from 'vue'; export const useAlarmActionColumn = (tableData: Ref) => { + const { hasPermission } = usePermission(); + const { mutate: confirmAlarm } = useMutation({ mutationFn: async (params: { id: string | null }) => { const { id } = params; @@ -115,28 +118,30 @@ export const useAlarmActionColumn = (tableData: Ref) => { default: () => '确认告警?', }, ), - tryGetDeviceType(rowData.deviceType) === DEVICE_TYPE_LITERALS.ndmCamera && [ - h( - NPopconfirm, - { - onPositiveClick: () => ignoreCamera({ id }), - }, - { - trigger: () => h(NButton, { tertiary: true, type: 'info', size: 'tiny' }, { default: () => '忽略' }), - default: () => '忽略设备?', - }, - ), - // h( - // NPopconfirm, - // { - // onPositiveClick: () => noticeCamera({ id }), - // }, - // { - // trigger: () => h(NButton, { text: true, type: 'info', size: 'small' }, { icon: () => h(EyeOutlined) }), - // default: () => '取消忽略设备?', - // }, - // ), - ], + tryGetDeviceType(rowData.deviceType) === DEVICE_TYPE_LITERALS.ndmCamera && + rowData.stationCode && + hasPermission(rowData.stationCode, PERMISSION_TYPE_LITERALS.OPERATION) && [ + h( + NPopconfirm, + { + onPositiveClick: () => ignoreCamera({ id }), + }, + { + trigger: () => h(NButton, { tertiary: true, type: 'info', size: 'tiny' }, { default: () => '忽略' }), + default: () => '忽略设备?', + }, + ), + // h( + // NPopconfirm, + // { + // onPositiveClick: () => noticeCamera({ id }), + // }, + // { + // trigger: () => h(NButton, { text: true, type: 'info', size: 'small' }, { icon: () => h(EyeOutlined) }), + // default: () => '取消忽略设备?', + // }, + // ), + ], ], }, ); diff --git a/src/pages/alarm-ignore-page.vue b/src/pages/alarm-ignore-page.vue index 1b647f5..8619929 100644 --- a/src/pages/alarm-ignore-page.vue +++ b/src/pages/alarm-ignore-page.vue @@ -16,8 +16,9 @@ const NDM_TYPES: Record = {