diff --git a/src/components/station-card.vue b/src/components/station-card.vue new file mode 100644 index 0000000..a81a377 --- /dev/null +++ b/src/components/station-card.vue @@ -0,0 +1,54 @@ + + + + + + + + + + {{ online ? '在线' : '离线' }} + + + + + + + + 台 + + + + + + + 条 + + + + + + + + + diff --git a/src/composables/query/use-station-list-query.ts b/src/composables/query/use-station-list-query.ts new file mode 100644 index 0000000..a5306ea --- /dev/null +++ b/src/composables/query/use-station-list-query.ts @@ -0,0 +1,33 @@ +import type { Station } from '@/apis/domains'; +import { ndmVerify } from '@/apis/requests'; +import { useQuery } from '@tanstack/vue-query'; +import { useStationStore } from '@/stores/station'; +import axios from 'axios'; +import dayjs from 'dayjs'; +import { storeToRefs } from 'pinia'; + +export function useStationListQuery() { + const stationStore = useStationStore(); + const { stationList } = storeToRefs(stationStore); + useQuery({ + queryKey: ['station-list'], + queryFn: async () => { + const { data: ndmStationList } = await axios.get<{ code: string; name: string }[]>(`/minio/ndm/ndm-stations.json?_t=${dayjs().unix()}`); + + stationList.value = ndmStationList.map((record) => ({ + code: record.code ?? '', + name: record.name ?? '', + online: false, + })); + + const pingResultList = await Promise.allSettled(stationList.value.map((station) => ndmVerify(station.code))); + + stationList.value = stationList.value.map((station, index) => ({ + ...station, + online: pingResultList[index].status === 'fulfilled', + })); + + return stationList.value; + }, + }); +} diff --git a/src/pages/alarm-page.vue b/src/pages/alarm-page.vue new file mode 100644 index 0000000..25a8705 --- /dev/null +++ b/src/pages/alarm-page.vue @@ -0,0 +1,7 @@ + + + + alarm + + + diff --git a/src/pages/dashboard-page.vue b/src/pages/dashboard-page.vue new file mode 100644 index 0000000..5620871 --- /dev/null +++ b/src/pages/dashboard-page.vue @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/src/pages/device-page.vue b/src/pages/device-page.vue new file mode 100644 index 0000000..fc884c4 --- /dev/null +++ b/src/pages/device-page.vue @@ -0,0 +1,7 @@ + + + + device + + + diff --git a/src/pages/log-page.vue b/src/pages/log-page.vue new file mode 100644 index 0000000..7edc285 --- /dev/null +++ b/src/pages/log-page.vue @@ -0,0 +1,7 @@ + + + + log + + + diff --git a/src/pages/login-page.vue b/src/pages/login-page.vue new file mode 100644 index 0000000..a8f6495 --- /dev/null +++ b/src/pages/login-page.vue @@ -0,0 +1,101 @@ + + + + + + + + + 网络设备管理平台 + 登录 + + + + + + + + + login(formData)"> 登录 + + + + + + + diff --git a/src/pages/not-found-page.vue b/src/pages/not-found-page.vue new file mode 100644 index 0000000..8f097ba --- /dev/null +++ b/src/pages/not-found-page.vue @@ -0,0 +1,20 @@ + + + + + + 返回 + + + + + diff --git a/src/pages/statistics-page.vue b/src/pages/statistics-page.vue new file mode 100644 index 0000000..1683e02 --- /dev/null +++ b/src/pages/statistics-page.vue @@ -0,0 +1,7 @@ + + + + statistics + + +