diff --git a/src/components/device/device-card/components/current-diag/nvr-record-check-card.vue b/src/components/device/device-card/components/current-diag/nvr-record-check-card.vue index d06a40d..8520392 100644 --- a/src/components/device/device-card/components/current-diag/nvr-record-check-card.vue +++ b/src/components/device/device-card/components/current-diag/nvr-record-check-card.vue @@ -92,6 +92,8 @@ const abortController = ref(new AbortController()); const NVR_RECORD_CHECK_KEY = 'nvr-record-check-query'; +const deviceUniqueKey = computed(() => [station.value.code, ndmDevice.value.id]); + const DAY_OFFSET = 90; const { @@ -99,7 +101,7 @@ const { isFetching: loading, refetch: refetchRecordChecks, } = useQuery({ - queryKey: computed(() => [NVR_RECORD_CHECK_KEY, ndmDevice.value.id, ndmDevice.value.lastDiagTime]), + queryKey: computed(() => [NVR_RECORD_CHECK_KEY, deviceUniqueKey.value, ndmDevice.value.lastDiagTime]), enabled: computed(() => activeRequests.value), refetchInterval: 30 * 1000, gcTime: 0, @@ -408,13 +410,13 @@ const ndmRecordChecksPaged = computed(() => { return ndmRecordChecksFiltered.value.slice(startIndex, endIndex); }); -// 当设备ID、最后诊断时间或筛选类型变化时,重置分页为第一页 -watch([() => ndmDevice.value.id, () => ndmDevice.value.lastDiagTime, filterType, searchInputDebounced], () => { +// 当车站号、设备IP、最后诊断时间或筛选类型变化时,重置分页为第一页 +watch([() => station.value.code, () => ndmDevice.value.ipAddress, () => ndmDevice.value.lastDiagTime, filterType, searchInputDebounced], () => { page.value = 1; }); -// 当设备ID变化时,重置搜索内容,并将筛选类型重置为「全部」 -watch([() => ndmDevice.value.id], () => { +// 当车站号、设备IP变化时,重置搜索内容,并将筛选类型重置为「全部」 +watch([() => station.value.code, () => ndmDevice.value.ipAddress], () => { searchInput.value = ''; filterType.value = 'all'; }); diff --git a/src/components/device/device-card/ndm-server/server-alive.vue b/src/components/device/device-card/ndm-server/server-alive.vue index 32dd769..9348674 100644 --- a/src/components/device/device-card/ndm-server/server-alive.vue +++ b/src/components/device/device-card/ndm-server/server-alive.vue @@ -23,8 +23,11 @@ const deviceType = computed(() => tryGetDeviceType(ndmDevice.value.deviceType)); const MEDIA_SERVER_ALIVE_QUERY_KEY = 'media-server-alive-query'; const VIDEO_SERVER_ALIVE_QUERY_KEY = 'video-server-alive-query'; + +const deviceUniqueKey = computed(() => [station.value.code, ndmDevice.value.id]); + const { data: isMediaServerAlive } = useQuery({ - queryKey: computed(() => [MEDIA_SERVER_ALIVE_QUERY_KEY, ndmDevice.value.id, ndmDevice.value.lastDiagTime]), + queryKey: computed(() => [MEDIA_SERVER_ALIVE_QUERY_KEY, deviceUniqueKey.value, ndmDevice.value.lastDiagTime]), enabled: computed(() => activeRequests.value && deviceType.value === DEVICE_TYPE_LITERALS.ndmMediaServer), refetchInterval: 30 * 1000, gcTime: 0, @@ -34,7 +37,7 @@ const { data: isMediaServerAlive } = useQuery({ }, }); const { data: isSipServerAlive } = useQuery({ - queryKey: computed(() => [VIDEO_SERVER_ALIVE_QUERY_KEY, ndmDevice.value.id, ndmDevice.value.lastDiagTime]), + queryKey: computed(() => [VIDEO_SERVER_ALIVE_QUERY_KEY, deviceUniqueKey.value, ndmDevice.value.lastDiagTime]), enabled: computed(() => activeRequests.value && deviceType.value === DEVICE_TYPE_LITERALS.ndmVideoServer), refetchInterval: 30 * 1000, gcTime: 0, diff --git a/src/components/device/device-card/ndm-server/server-stream-push.vue b/src/components/device/device-card/ndm-server/server-stream-push.vue index 2dcd648..b00c950 100644 --- a/src/components/device/device-card/ndm-server/server-stream-push.vue +++ b/src/components/device/device-card/ndm-server/server-stream-push.vue @@ -25,8 +25,10 @@ const showCard = computed(() => deviceType.value === DEVICE_TYPE_LITERALS.ndmMed const SERVER_STREAM_PUSH_KEY = 'server-stream-push-query'; +const deviceUniqueKey = computed(() => [station.value.code, ndmDevice.value.id]); + const { data: streamPushes } = useQuery({ - queryKey: computed(() => [SERVER_STREAM_PUSH_KEY, ndmDevice.value.id, ndmDevice.value.lastDiagTime]), + queryKey: computed(() => [SERVER_STREAM_PUSH_KEY, deviceUniqueKey.value, ndmDevice.value.lastDiagTime]), enabled: computed(() => activeRequests.value && showCard.value), refetchInterval: 30 * 1000, gcTime: 0,