refactor: extract isNvrCluster

This commit is contained in:
yangsy
2025-11-10 20:38:40 +08:00
parent 19297c2870
commit 8f3c8b7992
5 changed files with 15 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { NdmNvrResultVO } from '@/apis/models';
import { isNvrCluster } from '@/components/helper';
import dayjs from 'dayjs';
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
@@ -66,12 +67,11 @@ onMounted(() => {
});
const diagCards = computed<SelectOption[]>(() => {
const isCluster = (maybeNvrCluster: NdmNvrResultVO) => !!maybeNvrCluster.clusterList?.trim() && maybeNvrCluster.clusterList !== maybeNvrCluster.ipAddress;
const baseOptions: SelectOption[] = [
{ label: '设备状态', value: 'status' },
{ label: '设备告警', value: 'alarm' },
];
if (!isCluster(ndmNvr.value)) {
if (!isNvrCluster(ndmNvr.value)) {
baseOptions.push({ label: '硬件使用率', value: 'usage' }, { label: '硬盘健康', value: 'health' });
}
return baseOptions;