refactor(vimp): 提取资源面板为独立组件并添加pinia存储

- 将原内嵌的资源标签页逻辑提取为独立组件
- 新增专用pinia存储管理资源面板的折叠和搜索状态
- 统一折叠展开与搜索交互的逻辑实现
This commit is contained in:
yangsy
2026-05-28 16:23:42 +08:00
parent 013d21d79d
commit 6d63f1e301
3 changed files with 84 additions and 28 deletions
+20 -4
View File
@@ -1,12 +1,28 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';
export interface ResourcePanelSearchInput {
enabled: boolean; // 是否启用搜索输入框 (只有在资源面板展开且选择摄像机或警报器时才启用)
show: boolean; // 是否显示搜索输入框 (只有当enabled为true时才允许控制显示)
value: string; // 搜索输入框的值
}
export const useResourcePanelStore = defineStore('vimp-resource-panel', () => {
const showSearch = ref<boolean>(false);
const searchText = ref<string>('');
const collapsed = ref<boolean>(false);
const searchInput = ref<ResourcePanelSearchInput>({
enabled: false,
show: false,
value: '',
});
const toggleCollapsed = () => {
collapsed.value = !collapsed.value;
};
return {
showSearch,
searchText,
collapsed,
searchInput,
toggleCollapsed,
};
});