监测点框位置,tab切换缓存
This commit is contained in:
@@ -235,6 +235,9 @@ const tableStore = new TableStore({
|
||||
allData.value = tableStore.table.data || []
|
||||
tableStore.table.total = updateTotal.value
|
||||
tableStore.table.data = currentPageData.value
|
||||
},
|
||||
resetCallback: () => {
|
||||
clearQueryParams()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -326,8 +329,23 @@ onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', debouncedCalculateTableHeight)
|
||||
})
|
||||
|
||||
|
||||
const clearQueryParams = () => {
|
||||
// 将区域恢复成第一层
|
||||
if (areOptions && areOptions.length > 0) {
|
||||
selectedArea.value = areOptions[0].id
|
||||
tableStore.table.params.id = areOptions[0].id
|
||||
}
|
||||
|
||||
// 清空搜索关键词
|
||||
searchKeyword.value = ''
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
refresh: () => {
|
||||
// 清空查询参数
|
||||
clearQueryParams()
|
||||
tableHeaderRef.value.setTheDate(3)
|
||||
tableStore.index()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<el-dialog
|
||||
v-model="detailDialogVisible"
|
||||
:title="detailDialogTitle"
|
||||
width="80%"
|
||||
|
||||
>
|
||||
<div v-loading="detailLoading">
|
||||
<div style="margin-bottom: 10px; text-align: right;">
|
||||
@@ -329,6 +329,9 @@ const tableStore = new TableStore({
|
||||
allData.value = expandedData;
|
||||
tableStore.table.total = updateTotal.value;
|
||||
tableStore.table.data = currentPageData.value;
|
||||
},
|
||||
resetCallback: () => {
|
||||
clearQueryParams()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -437,8 +440,21 @@ onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', debouncedCalculateTableHeight)
|
||||
})
|
||||
|
||||
const clearQueryParams = () => {
|
||||
// 将区域恢复成第一层
|
||||
if (areOptions && areOptions.length > 0) {
|
||||
selectedArea.value = areOptions[0].id
|
||||
tableStore.table.params.id = areOptions[0].id
|
||||
}
|
||||
|
||||
// 清空搜索关键词
|
||||
searchKeyword.value = ''
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
refresh: () => {
|
||||
clearQueryParams()
|
||||
tableHeaderRef.value.setTheDate(3)
|
||||
tableStore.index()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<MonitoringPointTab
|
||||
ref="monitoringPointTabRef"
|
||||
:active="activeTab === 'pollutionReport'"
|
||||
@initialized="handleTabInitialized"
|
||||
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<SubstationTab
|
||||
ref="substationTabRef"
|
||||
:active="activeTab === 'anotherReport'"
|
||||
@initialized="handleTabInitialized"
|
||||
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -25,26 +25,25 @@ import { ref } from 'vue'
|
||||
import MonitoringPointTab from './MonitoringPointTab.vue'
|
||||
import SubstationTab from './SubstationTab.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/qydetailedAnalysis/pollutionReport'
|
||||
})
|
||||
|
||||
const activeTab = ref('pollutionReport')
|
||||
const monitoringPointTabRef = ref()
|
||||
const substationTabRef = ref()
|
||||
const tabInitialized = ref({
|
||||
pollutionReport: false,
|
||||
anotherReport: false
|
||||
})
|
||||
|
||||
|
||||
const handleTabChange = (tabName: string) => {
|
||||
if (!tabInitialized.value[tabName]) {
|
||||
if (tabName === 'pollutionReport' && monitoringPointTabRef.value) {
|
||||
|
||||
monitoringPointTabRef.value.refresh()
|
||||
} else if (tabName === 'anotherReport' && substationTabRef.value) {
|
||||
substationTabRef.value.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const handleTabInitialized = (tabName: string) => {
|
||||
tabInitialized.value[tabName] = true
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user