refactor: 针对录像机集群的告警记录的故障描述,添加【查看】按钮
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, PageParams } from '@/apis/models';
|
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, NdmNvrResultVO, PageParams } from '@/apis/models';
|
||||||
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||||
|
import { DeviceType, getDeviceTypeVal } from '@/enums/device-type';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { NCard, NDataTable, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
|
import { NButton, NCard, NDataTable, NPopover, NScrollbar, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
|
||||||
import { h } from 'vue';
|
import { h } from 'vue';
|
||||||
import { reactive, ref, toRefs } from 'vue';
|
import { reactive, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
@@ -27,7 +28,58 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
|
|||||||
{ title: '告警类型', key: 'alarmType', align: 'center' },
|
{ title: '告警类型', key: 'alarmType', align: 'center' },
|
||||||
{ title: '故障级别', key: 'faultLevel', align: 'center' },
|
{ title: '故障级别', key: 'faultLevel', align: 'center' },
|
||||||
{ title: '故障编码', key: 'faultCode', align: 'center' },
|
{ title: '故障编码', key: 'faultCode', align: 'center' },
|
||||||
{ title: '故障描述', key: 'faultDescription' },
|
{
|
||||||
|
title: '故障描述',
|
||||||
|
key: 'faultDescription',
|
||||||
|
render: (rowData) => {
|
||||||
|
const isNvrCluster = (ndmDevice: NdmDeviceResultVO) => {
|
||||||
|
const isNvr = getDeviceTypeVal(ndmDevice.deviceType) === DeviceType.Nvr;
|
||||||
|
if (!isNvr) return false;
|
||||||
|
const maybeNvrCluster = ndmDevice as NdmNvrResultVO;
|
||||||
|
return !!maybeNvrCluster.clusterList?.trim() && maybeNvrCluster.clusterList !== maybeNvrCluster.ipAddress;
|
||||||
|
};
|
||||||
|
if (!isNvrCluster(ndmDevice.value)) {
|
||||||
|
return rowData.faultDescription;
|
||||||
|
}
|
||||||
|
return h(
|
||||||
|
NPopover,
|
||||||
|
{
|
||||||
|
trigger: 'click',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
trigger: () => {
|
||||||
|
return h(
|
||||||
|
NButton,
|
||||||
|
{
|
||||||
|
text: true,
|
||||||
|
type: 'info',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => '查看',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
default: () => {
|
||||||
|
return h(
|
||||||
|
// 'pre',
|
||||||
|
NScrollbar,
|
||||||
|
{
|
||||||
|
style: {
|
||||||
|
width: '800px',
|
||||||
|
'max-height': '400px',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => {
|
||||||
|
return h('pre', {}, { default: () => rowData.faultDescription?.split('; ').join('\n') ?? '' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '是否恢复',
|
title: '是否恢复',
|
||||||
key: 'alarmCategory',
|
key: 'alarmCategory',
|
||||||
|
|||||||
Reference in New Issue
Block a user