refactor(vimp): 重构模块结构,优化代码组织
- 将设备中心查询逻辑从API层抽取至composables目录,封装为useDeviceCenterQuery组合式函数 - 拆分camera、alarm的状态管理为独立store文件,新增资源面板搜索状态store - 更新相关组件的依赖导入路径,清理冗余导出并调整导出列表
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
export * from './client';
|
||||
export * from './model';
|
||||
export * from './query';
|
||||
export * from './request';
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from './device-center-query';
|
||||
@@ -3,7 +3,7 @@ import { NTabPane, NTabs, NTree, type TreeOverrideNodeClickBehavior, type TreePr
|
||||
import { h, type CSSProperties } from 'vue';
|
||||
import { useAlarmStore } from '../stores';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useDeviceCenterQuery } from '../apis';
|
||||
import { useDeviceCenterQuery } from '../composables';
|
||||
import { isAlarmNode, isAlarmSiteNode, isAlarmAreaNode } from '../types';
|
||||
|
||||
const { isLoading } = useDeviceCenterQuery();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { NTabPane, NTabs, NTree, type TreeOverrideNodeClickBehavior, type TreePr
|
||||
import { h, type CSSProperties } from 'vue';
|
||||
import { useCameraStore } from '../stores';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useDeviceCenterQuery } from '../apis';
|
||||
import { useDeviceCenterQuery } from '../composables';
|
||||
import { isCameraNode, isCameraSiteNode, isCameraAreaNode } from '../types';
|
||||
|
||||
const { isLoading } = useDeviceCenterQuery();
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './query';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './use-device-center-query';
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import { useQuery } from '@tanstack/vue-query';
|
||||
import { computed } from 'vue';
|
||||
import { catalogChannelApi, catalogAllDeviceApi } from '../request';
|
||||
import { catalogChannelApi, catalogAllDeviceApi } from '../../apis/request';
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
import type { CodeArea, CodeLines, CodeSites } from '../../types';
|
||||
import { useCameraStore, useAlarmStore } from '../../stores';
|
||||
import type { VimpChannel } from '../model';
|
||||
import type { VimpChannel } from '../../apis/model';
|
||||
|
||||
export const useDeviceCenterQuery = () => {
|
||||
const cameraStore = useCameraStore();
|
||||
@@ -14,7 +14,7 @@ interface BuildLineTabPanesParams {
|
||||
codeTrainAreas: CodeArea[];
|
||||
}
|
||||
|
||||
export const useAlarmStore = defineStore('vimp-alarm', () => {
|
||||
export const useAlarmStore = defineStore('vimp-alarm-store', () => {
|
||||
const lineTabPanes = ref<AlarmLineTabPane[]>([]);
|
||||
|
||||
const buildLineTabPanes = (params: BuildLineTabPanesParams) => {
|
||||
@@ -14,7 +14,7 @@ interface BuildLineTabPanesParams {
|
||||
codeTrainAreas: CodeArea[];
|
||||
}
|
||||
|
||||
export const useCameraStore = defineStore('vimp-camera', () => {
|
||||
export const useCameraStore = defineStore('vimp-camera-store', () => {
|
||||
const lineTabPanes = ref<CameraLineTabPane[]>([]);
|
||||
|
||||
const buildLineTabPanes = (params: BuildLineTabPanesParams) => {
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './camera-store';
|
||||
export * from './alarm-store';
|
||||
export * from './alarm';
|
||||
export * from './camera';
|
||||
export * from './resource-panel';
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export const useResourcePanelStore = defineStore('vimp-resource-panel', () => {
|
||||
const showSearch = ref<boolean>(false);
|
||||
const searchText = ref<string>('');
|
||||
|
||||
return {
|
||||
showSearch,
|
||||
searchText,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user