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