refactor: reorganize files
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user