refactor: reorganize files
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { postNdmDeviceAlarmLogPage, type Station, type StationAlarmCounts } from '@/apis';
|
||||
import { pageDeviceAlarmLogApi, type Station, type StationAlarmCounts } from '@/apis';
|
||||
import { LINE_ALARMS_QUERY_KEY } from '@/constants';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums';
|
||||
import { useLineAlarmsStore, useQueryControlStore, useStationStore } from '@/stores';
|
||||
@@ -66,8 +66,7 @@ function useStationAlarmCountsMutation() {
|
||||
const now = dayjs();
|
||||
const todayStart = now.startOf('date').valueOf();
|
||||
const todayEnd = now.endOf('date').valueOf();
|
||||
const { records: alarmList, total } = await postNdmDeviceAlarmLogPage(
|
||||
station.code,
|
||||
const { records: alarmList, total } = await pageDeviceAlarmLogApi(
|
||||
{
|
||||
model: {
|
||||
stationCode: station.code,
|
||||
@@ -81,7 +80,10 @@ function useStationAlarmCountsMutation() {
|
||||
sort: 'id',
|
||||
order: 'descending',
|
||||
},
|
||||
signal,
|
||||
{
|
||||
stationCode: station.code,
|
||||
signal,
|
||||
},
|
||||
);
|
||||
for (const alarm of alarmList) {
|
||||
const deviceTypeVal = tryGetDeviceTypeVal(alarm.deviceType);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { batchVerify, ndmVerify, type Station } from '@/apis';
|
||||
import { batchVerifyApi, verifyApi, type Station } from '@/apis';
|
||||
import { STATION_LIST_QUERY_KEY } from '@/constants';
|
||||
import { useQueryControlStore, useStationStore } from '@/stores';
|
||||
import { getAppEnvConfig } from '@/utils';
|
||||
@@ -48,14 +48,14 @@ function useStationListMutation() {
|
||||
}));
|
||||
if (stationVerifyMode.value === 'concurrent') {
|
||||
// 方案一:并发ping所有station
|
||||
const stationPingResultList = await Promise.allSettled(stations.map((station) => ndmVerify(station.code, signal)));
|
||||
const stationPingResultList = await Promise.allSettled(stations.map((station) => verifyApi({ stationCode: station.code, signal })));
|
||||
stationPingResultList.forEach((pingResult, index) => {
|
||||
stations[index].online = pingResult.status === 'fulfilled';
|
||||
});
|
||||
return stations;
|
||||
} else {
|
||||
// 方案二:调用批量verify接口
|
||||
const verifyList = await batchVerify(signal);
|
||||
const verifyList = await batchVerifyApi({ signal });
|
||||
return stations.map((station) => {
|
||||
return {
|
||||
...station,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { VersionInfo } from '@/apis';
|
||||
import { type VersionInfo } from '@/apis';
|
||||
import { useQuery } from '@tanstack/vue-query';
|
||||
import axios from 'axios';
|
||||
import { useThemeVars } from 'naive-ui';
|
||||
@@ -11,11 +11,11 @@ export function useVersionCheckQuery() {
|
||||
|
||||
const { data: remoteVersionInfo, dataUpdatedAt } = useQuery({
|
||||
queryKey: ['version-check'],
|
||||
refetchInterval: 10 * 1000,
|
||||
queryFn: async () => {
|
||||
const { data } = await axios.get<VersionInfo>(`/manifest.json?t=${Date.now()}`);
|
||||
return data;
|
||||
},
|
||||
refetchInterval: 10 * 1000,
|
||||
});
|
||||
|
||||
watch(dataUpdatedAt, () => {
|
||||
|
||||
Reference in New Issue
Block a user