删除监测点列表的缓存

This commit is contained in:
stt
2025-11-24 15:12:24 +08:00
parent 704f735744
commit e603ba9f8c
3 changed files with 36 additions and 35 deletions

View File

@@ -5,7 +5,12 @@
<template v-slot:select>
<el-form-item label="监测点">
<el-select size="small" v-model="tableStore.table.params.lineId">
<el-option v-for="item in options" :key="item.lineId" :label="item.name" :value="item.lineId" />
<el-option
v-for="item in lineList"
:key="item.lineId"
:label="item.name"
:value="item.lineId"
/>
</el-select>
</el-form-item>
</template>
@@ -35,9 +40,7 @@ import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import TableHeader from '@/components/table/header/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
import { limitProbabilityData } from '@/api/harmonic-boot/cockpit/cockpit'
import { limitProbabilityData, cslineList } from '@/api/harmonic-boot/cockpit/cockpit'
const prop = defineProps({
w: { type: [String, Number] },
@@ -48,13 +51,12 @@ const prop = defineProps({
timeValue: { type: Object }
})
const options = ref(JSON.parse(window.localStorage.getItem('lineIdList') || '[]'))
// const options = ref(JSON.parse(window.localStorage.getItem('lineIdList') || '[]'))
const lineList = ref()
const headerHeight = ref(57)
const route = useRoute()
const timeCacheStore = useTimeCacheStore()
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
@@ -77,17 +79,25 @@ const fullscreen = computed(() => {
}
})
const echartList = ref()
const echartList1 = ref()
const probabilityData = ref()
const initLineList = async () => {
cslineList({}).then(res => {
lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId
tableStore.index()
})
}
// 越限程度概率分布
const initProbabilityData = () => {
if (!tableStore.table.params.lineId && options.value?.length > 0) {
tableStore.table.params.lineId = options.value[0].lineId
// 只有当 lineList 已加载且有数据时才设置默认 lineId
if (!tableStore.table.params.lineId && lineList.value && lineList.value.length > 0) {
tableStore.table.params.lineId = lineList.value[0].lineId
}
const params = {
searchBeginTime: tableStore.table.params.searchBeginTime || prop.timeValue?.[0],
@@ -164,7 +174,7 @@ const initProbabilityData = () => {
show: false, // 设置为 false 隐藏右侧颜色条
min: 0,
// max: 100,
max: zAxisMax, // 使用计算出的最大值加5
max: zAxisMax, // 使用计算出的最大值加5
inRange: {
color: ['#313695', '#00BB00', '#ff8000', '#d73027', '#a50026']
}
@@ -394,8 +404,9 @@ const tableStore: any = new TableStore({
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime || prop.timeValue?.[1]
if (!tableStore.table.params.lineId && options.value?.length > 0) {
tableStore.table.params.lineId = options.value[0].lineId
// 只有当 lineList 已加载且有数据时才设置默认 lineId
if (!tableStore.table.params.lineId && lineList.value && lineList.value.length > 0) {
tableStore.table.params.lineId = lineList.value[0].lineId
}
},
loadCallback: () => {
@@ -441,7 +452,7 @@ const tableStore: any = new TableStore({
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
initLineList()
})
watch(
() => prop.timeKey,