解析模板
This commit is contained in:
parent
7dfa5ed0a7
commit
8e1e74067d
|
|
@ -214,7 +214,7 @@ export default {
|
||||||
proId: decryptWithSM4(this.$route.query.proId),
|
proId: decryptWithSM4(this.$route.query.proId),
|
||||||
bidId: decryptWithSM4(this.$route.query.bidId),
|
bidId: decryptWithSM4(this.$route.query.bidId),
|
||||||
activeMainTab: 'project',
|
activeMainTab: 'project',
|
||||||
defaultSubTab: 'response',
|
defaultSubTab: '', // 初始为空,由 AnalysisResultPanel 组件自动获取第一个子标签
|
||||||
analysisData: {},
|
analysisData: {},
|
||||||
tenderDocumentUrl: '',
|
tenderDocumentUrl: '',
|
||||||
tenderDocumentTitle: '',
|
tenderDocumentTitle: '',
|
||||||
|
|
@ -348,7 +348,16 @@ export default {
|
||||||
},
|
},
|
||||||
handleMainTabClick(tab) {
|
handleMainTabClick(tab) {
|
||||||
this.activeMainTab = tab.name
|
this.activeMainTab = tab.name
|
||||||
this.handleMainTabChange(tab.name, '')
|
// 获取当前主标签的第一个子标签
|
||||||
|
const currentMainTab = this.mainTabs.find(t => t.name === tab.name)
|
||||||
|
const firstSubTab = currentMainTab && currentMainTab.subTabs && currentMainTab.subTabs.length > 0
|
||||||
|
? currentMainTab.subTabs[0].name
|
||||||
|
: ''
|
||||||
|
// 强制更新 defaultSubTab,确保子标签切换
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.defaultSubTab = firstSubTab
|
||||||
|
})
|
||||||
|
this.handleMainTabChange(tab.name, firstSubTab)
|
||||||
},
|
},
|
||||||
handleMainTabChange(mainTab, subTab) {
|
handleMainTabChange(mainTab, subTab) {
|
||||||
console.log('主标签切换:', mainTab, subTab)
|
console.log('主标签切换:', mainTab, subTab)
|
||||||
|
|
|
||||||
|
|
@ -151,22 +151,51 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
// 初始化时,如果 defaultSubTab 为空,获取第一个子标签
|
||||||
|
const initialSubTab = this.defaultSubTab || this.getDefaultSubTab(this.defaultMainTab)
|
||||||
return {
|
return {
|
||||||
activeMainTab: this.defaultMainTab,
|
activeMainTab: this.defaultMainTab,
|
||||||
activeSubTab: this.defaultSubTab || this.getDefaultSubTab(this.defaultMainTab),
|
activeSubTab: initialSubTab,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
defaultMainTab(newVal) {
|
defaultMainTab(newVal, oldVal) {
|
||||||
|
if (newVal !== oldVal) {
|
||||||
this.activeMainTab = newVal
|
this.activeMainTab = newVal
|
||||||
this.activeSubTab = this.getDefaultSubTab(newVal)
|
// 切换主标签时,总是获取第一个子标签
|
||||||
|
const firstSubTab = this.getDefaultSubTab(newVal)
|
||||||
|
if (firstSubTab) {
|
||||||
|
this.activeSubTab = firstSubTab
|
||||||
|
} else {
|
||||||
|
this.activeSubTab = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaultSubTab(newVal, oldVal) {
|
||||||
|
// 当 defaultSubTab 变化时,更新 activeSubTab
|
||||||
|
if (newVal && newVal !== oldVal) {
|
||||||
|
this.activeSubTab = newVal
|
||||||
|
} else if (!newVal) {
|
||||||
|
// 如果为空,获取当前主标签的第一个子标签
|
||||||
|
this.activeSubTab = this.getDefaultSubTab(this.activeMainTab)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hideMainTabs(newVal) {
|
hideMainTabs(newVal) {
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
// 当隐藏主标签时,确保子标签正确初始化
|
// 当隐藏主标签时,确保子标签正确初始化
|
||||||
|
if (!this.defaultSubTab) {
|
||||||
this.activeSubTab = this.getDefaultSubTab(this.defaultMainTab)
|
this.activeSubTab = this.getDefaultSubTab(this.defaultMainTab)
|
||||||
|
} else {
|
||||||
|
this.activeSubTab = this.defaultSubTab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 初始化时,如果 activeSubTab 为空,确保获取第一个子标签
|
||||||
|
if (!this.activeSubTab) {
|
||||||
|
this.activeSubTab = this.getDefaultSubTab(this.activeMainTab)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleMainTabClick(tab) {
|
handleMainTabClick(tab) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue