refactor(vimp): 重命名设备查询为通道查询并更新相关引用
- 新增 vimp 常量文件,定义查询键 VIMP_CHANNELS_QUERY_KEY - 重命名设备中心查询组合式函数为通道查询组合式函数 - 更新 alarm-tree.vue 和 camera-tree.vue 中的查询调用 - 优化通道数据排序与存储更新流程
This commit is contained in:
@@ -3,11 +3,11 @@ import { NIcon, NTabPane, NTabs, NTree, type TreeOverrideNodeClickBehavior, type
|
||||
import { h, type CSSProperties } from 'vue';
|
||||
import { useAlarmStore, useResourcePanelStore } from '../stores';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useDeviceCenterQuery } from '../composables';
|
||||
import { useChannelsQuery } from '../composables';
|
||||
import { isAlarmNode, isAlarmSiteNode, isAlarmAreaNode } from '../types';
|
||||
import { SirenIcon } from 'lucide-vue-next';
|
||||
|
||||
const { isLoading } = useDeviceCenterQuery();
|
||||
const { isLoading } = useChannelsQuery();
|
||||
|
||||
const alarmStore = useAlarmStore();
|
||||
const { lineTabPanes } = storeToRefs(alarmStore);
|
||||
|
||||
@@ -3,13 +3,13 @@ import { NIcon, NTabPane, NTabs, NTree, type TreeOverrideNodeClickBehavior, type
|
||||
import { h, type CSSProperties } from 'vue';
|
||||
import { useCameraStore, useResourcePanelStore } from '../stores';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useDeviceCenterQuery } from '../composables';
|
||||
import { useChannelsQuery } from '../composables';
|
||||
import { isCameraNode, isCameraSiteNode, isCameraAreaNode } from '../types';
|
||||
import PtzCamera from './icon/ptz-camera.vue';
|
||||
import HemiPtzCamera from './icon/hemi-ptz-camera.vue';
|
||||
import BulletCamera from './icon/bullet-camera.vue';
|
||||
|
||||
const { isLoading } = useDeviceCenterQuery();
|
||||
const { isLoading } = useChannelsQuery();
|
||||
|
||||
const cameraStore = useCameraStore();
|
||||
const { lineTabPanes } = storeToRefs(cameraStore);
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from './use-device-center-query';
|
||||
export * from './use-channels-query';
|
||||
|
||||
+3
-2
@@ -5,6 +5,7 @@ import axios from 'axios';
|
||||
import { compileCodeAreas, type CodeArea, type CodeLines, type CodeSites } from '../../types';
|
||||
import { useCameraStore, useAlarmStore } from '../../stores';
|
||||
import { catalogAllDeviceApi, catalogChannelApi, type VimpChannel, type VimpSite } from '../../apis';
|
||||
import { VIMP_CHANNELS_QUERY_KEY } from '../../constants';
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
headers: {
|
||||
@@ -44,12 +45,12 @@ const sortChannelsMapByCode = (siteCodeToChannelsMap: Map<string, VimpChannel[]>
|
||||
}
|
||||
};
|
||||
|
||||
export const useDeviceCenterQuery = () => {
|
||||
export const useChannelsQuery = () => {
|
||||
const cameraStore = useCameraStore();
|
||||
const alarmStore = useAlarmStore();
|
||||
|
||||
return useQuery({
|
||||
queryKey: computed(() => ['vimp-device']),
|
||||
queryKey: computed(() => [VIMP_CHANNELS_QUERY_KEY]),
|
||||
refetchInterval: 10 * 1000,
|
||||
refetchOnWindowFocus: false,
|
||||
queryFn: async ({ signal }) => {
|
||||
@@ -0,0 +1 @@
|
||||
export * from './query';
|
||||
@@ -0,0 +1 @@
|
||||
export const VIMP_CHANNELS_QUERY_KEY = 'vimp-channels';
|
||||
Reference in New Issue
Block a user