解析模板

This commit is contained in:
cwchen 2025-11-27 14:54:08 +08:00
parent 7dfa5ed0a7
commit 8e1e74067d
2 changed files with 45 additions and 7 deletions

View File

@ -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)

View File

@ -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) {