This commit is contained in:
2026-01-28 11:14:55 +08:00
parent ff5e7abc6a
commit fa7e748e1c
3 changed files with 17 additions and 12 deletions

View File

@@ -94,14 +94,14 @@ interface Props {
api: any;
hideTree?: boolean;
templateId: any;
defaultExpandedKeys?: any;
defaultProjectId?: any;
}
const props = withDefaults(defineProps<Props>(), {
api: null,
hideTree: false,
templateId: 0,
defaultExpandedKeys: [],
defaultProjectId: '',
});
const emit = defineEmits(['choseNode', 'updateNav', 'search', 'viewTypeChange']);
@@ -111,7 +111,8 @@ const navList = ref<any>([]);
const visible = ref(true);
const viewType = ref('1'); // 1文件模式 2作业模式
const loading = ref(false);
if (props.defaultExpandedKeys.length > 0) {
if (props.defaultProjectId) {
localStorage.setItem('DATA_OVERVIEW_NAV_LIST', '[]');
}
@@ -133,22 +134,26 @@ watch(
originalName: item.originalName,
};
});
localStorage.setItem('DATA_OVERVIEW_NAV_LIST', JSON.stringify(data));
if (props.defaultProjectId) {
localStorage.setItem('DATA_OVERVIEW_NAV_LIST', '[]');
} else {
localStorage.setItem('DATA_OVERVIEW_NAV_LIST', JSON.stringify(data));
}
},
{ deep: true }
);
let navListStorageData: any = JSON.parse(localStorage.getItem('DATA_OVERVIEW_NAV_LIST') || '[]');
const openDefaultExpandedFun = (baseData: any) => {
if (navListStorageData.length > 0 || props.defaultExpandedKeys.length > 0) {
if (navListStorageData.length > 0 || props.defaultProjectId) {
// 1s后打开默认节点
setTimeout(() => {
if (baseData.length > 0 && props.defaultExpandedKeys.length > 0) {
if (baseData.length > 0 && props.defaultProjectId) {
// 来自数据总览的匹配id来自项目列表的匹配relatedResourceUuid
const projectData = baseData.find(
(item: any) =>
item.id === props.defaultExpandedKeys[0] ||
item.relatedResourceUuid === props.defaultExpandedKeys[0]
item.id === props.defaultProjectId ||
item.relatedResourceUuid === props.defaultProjectId
);
navListStorageData = projectData ? [projectData] : [];
}

View File

@@ -8,7 +8,7 @@
:params="{
dimensionTemplateId: currentDimension,
}"
:defaultExpandedKeys="defaultExpandedKeys"
:defaultProjectId="defaultProjectId"
:hideTree="hideTree"
@choseNode="choseNodeFun"
@search="searchShow = true"
@@ -310,13 +310,13 @@ import emitter from '@/utils/eventBus';
interface Props {
hideAddBtn?: boolean;
hideTree?: boolean;
defaultExpandedKeys?: any;
defaultProjectId?: any;
}
withDefaults(defineProps<Props>(), {
hideAddBtn: false,
hideTree: false,
defaultExpandedKeys: [],
defaultProjectId: '',
});
const route = useRoute();

View File

@@ -137,7 +137,7 @@
<el-tab-pane label="文件数据" name="projectData">
<DataOverView
v-if="displayedTabs.includes('projectData') && projectUuid"
:defaultExpandedKeys="[projectUuid]"
:defaultProjectId="projectUuid"
hideAddBtn
hideTree
/>