refactor: reorganize files

This commit is contained in:
yangsy
2025-11-20 10:58:19 +08:00
parent cbb51aa501
commit c5c363d32c
120 changed files with 606 additions and 690 deletions

View File

@@ -1,9 +1,8 @@
<script setup lang="ts">
import type { Station } from '@/apis/domains';
import type { LineDevices } from '@/composables/query';
import { DeviceType } from '@/enums/device-type';
import { computed, toRefs } from 'vue';
import type { LineDevices, Station } from '@/apis';
import { DeviceType } from '@/enums';
import { NCard, NGrid, NGi, NStatistic, NSpace, NButton } from 'naive-ui';
import { computed, toRefs } from 'vue';
const props = defineProps<{
stationList: Station[];
@@ -25,7 +24,7 @@ const onlineDeviceCount = computed(() => {
if (station.online) {
const stationDevices = lineDevices.value[station.code];
Object.values(DeviceType).forEach((deviceType) => {
const onlineDeviceList = stationDevices?.[deviceType].filter((device) => device.deviceStatus === '10') ?? [];
const onlineDeviceList = stationDevices?.[deviceType]?.filter((device) => device.deviceStatus === '10') ?? [];
count += onlineDeviceList.length;
});
}
@@ -39,7 +38,7 @@ const offlineDeviceCount = computed(() => {
if (station.online) {
const stationDevices = lineDevices.value[station.code];
Object.values(DeviceType).forEach((deviceType) => {
const offlineDeviceList = stationDevices?.[deviceType].filter((device) => device.deviceStatus === '20') ?? [];
const offlineDeviceList = stationDevices?.[deviceType]?.filter((device) => device.deviceStatus === '20') ?? [];
count += offlineDeviceList.length;
});
}