refactor: reorganize files
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmCameraResultVO } from '@/apis/models';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmCamera: NdmCameraResultVO;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDecoderResultVO } from '@/apis/models';
|
||||
import type { NdmDecoderResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmDecoder: NdmDecoderResultVO;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, PageParams } from '@/apis/models';
|
||||
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderFaultDescriptionCell, renderFaultLevelCell } from '@/components/helper';
|
||||
import { postNdmDeviceAlarmLogPage, type NdmDeviceAlarmLogResultVO, type NdmDeviceResultVO, type PageParams } from '@/apis';
|
||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderFaultDescriptionCell, renderFaultLevelCell } from '@/components';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { NCard, NDataTable, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
|
||||
import { h } from 'vue';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceResultVO, NdmIcmpLogResultVO, NdmIcmpLogVO, PageParams, PageResult } from '@/apis/models';
|
||||
import { postIcmpLogPage } from '@/apis/requests';
|
||||
import { formatDuration } from '@/utils/format-duration';
|
||||
import { postIcmpLogPage, type NdmDeviceResultVO, type NdmIcmpLogResultVO, type NdmIcmpLogVO, type PageParams, type PageResult } from '@/apis';
|
||||
import { formatDuration } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { NCard, NPagination, NScrollbar, NTimeline, NTimelineItem, type DatePickerProps, type PaginationProps, type TimelineItemProps } from 'naive-ui';
|
||||
|
||||
@@ -6,8 +6,8 @@ function getValueByFieldPath(record: Record<string, any>, fieldPath?: string) {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceResultVO, NdmSnmpLogResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import type { NdmDeviceResultVO, NdmSnmpLogResultVO, PageParams } from '@/apis';
|
||||
import { postSnmpLogPage } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { destr } from 'destr';
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
export { default as CameraHistoryDiagCard } from './camera-history-diag-card.vue';
|
||||
export { default as DecoderHistoryDiagCard } from './decoder-history-diag-card.vue';
|
||||
export { default as DeviceAlarmHistoryDiagCard } from './device-alarm-history-diag-card.vue';
|
||||
export { default as DeviceStatusHistoryDiagCard } from './device-status-history-diag-card.vue';
|
||||
export { default as DeviceUsageHistoryDiagCard } from './device-usage-history-diag-card.vue';
|
||||
export { default as KeyboardHistoryDiagCard } from './keyboard-history-diag-card.vue';
|
||||
export { default as NvrDiskHealthHistoryDiagCard } from './nvr-disk-health-history-diag-card.vue';
|
||||
export { default as NvrHistoryDiagCard } from './nvr-history-diag-card.vue';
|
||||
export { default as SecurityBoxHistoryDiagCard } from './security-box-history-diag-card.vue';
|
||||
export { default as SecurityBoxRuntimeHistoryDiagCard } from './security-box-runtime-history-diag-card.vue';
|
||||
export { default as ServerHistoryDiagCard } from './server-history-diag-card.vue';
|
||||
export { default as SwitchHistoryDiagCard } from './switch-history-diag-card.vue';
|
||||
export { default as SwitchPortHistoryDiagCard } from './switch-port-history-diag-card.vue';
|
||||
@@ -1,11 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmKeyboardResultVO } from '@/apis/models';
|
||||
import type { NdmKeyboardResultVO } from '@/apis';
|
||||
import { DeviceStatusHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmKeyboard: NdmKeyboardResultVO;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrDiagInfo } from '@/apis/domains';
|
||||
import type { NdmNvrResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import { postSnmpLogPage, type NdmNvrDiagInfo, type NdmNvrResultVO, type PageParams } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { destr } from 'destr';
|
||||
@@ -90,12 +88,12 @@ const { mutate: getDeviceSnmpLogList, isPending } = useMutation({
|
||||
const diagInfo = destr<NdmNvrDiagInfo>(diagInfoJsonString);
|
||||
if (!diagInfo) return {};
|
||||
if (typeof diagInfo !== 'object') return {};
|
||||
const healthDiskCount = diagInfo.info.diskHealth.filter((health) => health === 0).length;
|
||||
const totalDiskCount = diagInfo.info.diskHealth.length;
|
||||
const healthDiskCount = diagInfo.info?.diskHealth?.filter((health) => health === 0).length ?? 0;
|
||||
const totalDiskCount = diagInfo.info?.diskHealth?.length ?? 0;
|
||||
return {
|
||||
createdTime: record.createdTime,
|
||||
diskHealthRatio: `${healthDiskCount}/${totalDiskCount}`,
|
||||
diskHealth: diagInfo.info.diskHealth,
|
||||
diskHealth: diagInfo.info?.diskHealth ?? [],
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrResultVO } from '@/apis/models';
|
||||
import { isNvrCluster } from '@/components/helper';
|
||||
import type { NdmNvrResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard, isNvrCluster, NvrDiskHealthHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
import NvrDiskHealthHistoryDiagCard from './nvr-disk-health-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmNvr: NdmNvrResultVO;
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis/models';
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard, SecurityBoxRuntimeHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
import SecurityBoxRuntimeHistoryDiagCard from './security-box-runtime-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmSecurityBox: NdmSecurityBoxResultVO;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxCircuit, NdmSecurityBoxDiagInfo } from '@/apis/domains';
|
||||
import type { NdmSecurityBoxResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import { postSnmpLogPage, type NdmSecurityBoxCircuit, type NdmSecurityBoxDiagInfo, type NdmSecurityBoxResultVO, type PageParams } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import destr from 'destr';
|
||||
@@ -63,7 +61,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'temperature',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return boxInfo.temperature;
|
||||
},
|
||||
@@ -73,7 +71,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'humidity',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return boxInfo.humidity;
|
||||
},
|
||||
@@ -83,9 +81,9 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'fanSpeeds',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return h('pre', {}, { default: () => boxInfo.fanSpeeds.join('\n') });
|
||||
return h('pre', {}, { default: () => boxInfo.fanSpeeds?.join('\n') ?? '' });
|
||||
},
|
||||
},
|
||||
// { title: '开关状态', key: 'switches' },
|
||||
@@ -94,7 +92,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'circuits',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return h(
|
||||
NButton,
|
||||
@@ -103,7 +101,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
type: 'info',
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
modalTableData.value = boxInfo.circuits.map((circuit, index) => ({ ...circuit, number: index + 1 }));
|
||||
modalTableData.value = boxInfo.circuits?.map((circuit, index) => ({ ...circuit, number: index + 1 })) ?? [];
|
||||
modalShow.value = true;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmServerResultVO } from '@/apis/models';
|
||||
import type { NdmServerResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmServer: NdmServerResultVO;
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSwitchResultVO } from '@/apis/models';
|
||||
import type { NdmSwitchResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard, SwitchPortHistoryDiagCard } from '@/components';
|
||||
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';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
import SwitchPortHistoryDiagCard from './switch-port-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmSwitch: NdmSwitchResultVO;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSwitchDiagInfo, NdmSwitchPortInfo } from '@/apis/domains';
|
||||
import type { NdmSwitchResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import { getPortStatusVal, transformPortSpeed } from '@/components/helper';
|
||||
import { postSnmpLogPage, type NdmSwitchDiagInfo, type NdmSwitchPortInfo, type NdmSwitchResultVO, type PageParams } from '@/apis';
|
||||
import { getPortStatusVal, transformPortSpeed } from '@/components';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import destr from 'destr';
|
||||
@@ -66,8 +64,8 @@ const tableColumns: DataTableColumns<SwitchPortRowData> = [
|
||||
render(rowData) {
|
||||
const { diagInfo } = rowData;
|
||||
const { info } = diagInfo;
|
||||
const { overFlowPorts } = info;
|
||||
return h('pre', {}, { default: () => overFlowPorts.join('\n') });
|
||||
const { overFlowPorts } = info ?? {};
|
||||
return h('pre', {}, { default: () => overFlowPorts?.join('\n') ?? '' });
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -84,7 +82,7 @@ const tableColumns: DataTableColumns<SwitchPortRowData> = [
|
||||
if (!diagInfo) return;
|
||||
modalShow.value = true;
|
||||
console.log('查看', diagInfo);
|
||||
modalTableData.value = diagInfo.info.portInfoList;
|
||||
modalTableData.value = diagInfo.info?.portInfoList ?? [];
|
||||
},
|
||||
},
|
||||
{ default: () => '查看' },
|
||||
|
||||
Reference in New Issue
Block a user