删除监测点列表的缓存

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

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<!--指标拟合图 --> <!--指标拟合图 -->
<TableHeader datePicker @selectChange="selectChange" v-if="fullscreen"> <TableHeader datePicker @selectChange="selectChange" v-if="fullscreen">
<template v-slot:select> <template v-slot:select>
<el-form-item label="监测点"> <el-form-item label="监测点">
<el-select v-model="tableStore.table.params.lineId" placeholder="请选择监测点" clearable> <el-select v-model="tableStore.table.params.lineId" placeholder="请选择监测点" clearable>
@@ -19,7 +19,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="统计类型"> <el-form-item label="统计类型">
<el-select style="min-width: 120px !important" placeholder="请选择" v-model="tableStore.table.params.valueType"> <el-select
style="min-width: 120px !important"
placeholder="请选择"
v-model="tableStore.table.params.valueType"
>
<el-option value="max" label="最大值"></el-option> <el-option value="max" label="最大值"></el-option>
<el-option value="min" label="最小值"></el-option> <el-option value="min" label="最小值"></el-option>
<el-option value="avg" label="平均值"></el-option> <el-option value="avg" label="平均值"></el-option>
@@ -32,8 +36,8 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div v-if="shouldShowHarmonicCount()" style="display: flex;color: var(--el-text-color-regular);"> <div v-if="shouldShowHarmonicCount()" style="display: flex; color: var(--el-text-color-regular)">
<span style="width: 160px;">{{ getHarmonicTypeName() }}谐波次数</span> <span style="width: 160px">{{ getHarmonicTypeName() }}谐波次数</span>
<el-select <el-select
v-model="tableStore.table.params.harmonicCount" v-model="tableStore.table.params.harmonicCount"
placeholder="请选择谐波次数" placeholder="请选择谐波次数"
@@ -94,7 +98,6 @@ const showEchart = ref(true)
const chartsList = ref<any>([]) const chartsList = ref<any>([])
// 计算是否全屏展示 // 计算是否全屏展示
const fullscreen = computed(() => { const fullscreen = computed(() => {
const w = Number(prop.w) const w = Number(prop.w)
@@ -122,13 +125,10 @@ const indicatorList = ref()
const initLineList = async () => { const initLineList = async () => {
cslineList({}).then(res => { cslineList({}).then(res => {
lineList.value = res.data lineList.value = res.data
if (lineList.value && lineList.value.length > 0) { tableStore.table.params.lineId = lineList.value[0].lineId
tableStore.table.params.lineId = lineList.value[0].lineId
}
}) })
} }
const echartList = ref() const echartList = ref()
const headerHeight = ref(57) const headerHeight = ref(57)
@@ -143,7 +143,6 @@ const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
} }
const setEchart = () => { const setEchart = () => {
// 获取当前选择的功率和指标名称 // 获取当前选择的功率和指标名称
const powerName = powerList.value?.find((item: any) => item.id === tableStore.table.params.power)?.name || '功率' const powerName = powerList.value?.find((item: any) => item.id === tableStore.table.params.power)?.name || '功率'
const indicatorName = const indicatorName =
@@ -257,7 +256,7 @@ const setEchart = () => {
} catch (error) { } catch (error) {
console.error('处理图表数据时出错:', error) console.error('处理图表数据时出错:', error)
showEchart.value = false showEchart.value = false
} }
} }
const initCode = () => { const initCode = () => {
@@ -395,7 +394,6 @@ watch(
onMounted(() => { onMounted(() => {
initLineList().then(() => { initLineList().then(() => {
// 确保 lineList 加载完成后再初始化其他数据
initCode() initCode()
}) })
}) })

View File

@@ -71,7 +71,6 @@ import { queryActivatePage, queryByPagePath } from '@/api/system-boot/csstatisti
import RoutingConfig from '@/views/pqs/cockpit/homePage/components/routingConfig.vue' import RoutingConfig from '@/views/pqs/cockpit/homePage/components/routingConfig.vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache' import { useTimeCacheStore } from '@/stores/timeCache'
import {cslineList} from '@/api/harmonic-boot/cockpit/cockpit'
const { push } = useRouter() const { push } = useRouter()
const datePickerRef = ref() const datePickerRef = ref()
const router = useRouter() const router = useRouter()
@@ -247,17 +246,10 @@ const handleDatePickerChange = (value: any) => {
} }
} }
// 监测点列表
const initCSlineList = async () => {
const res = await cslineList({})
window.localStorage.setItem('lineIdList', JSON.stringify(res.data))
}
// 生命周期钩子 // 生命周期钩子
onMounted(() => { onMounted(() => {
// initRowHeight() // initRowHeight()
fetchLayoutData() fetchLayoutData()
initCSlineList()
// 添加窗口大小变化监听器 // 添加窗口大小变化监听器
window.addEventListener('resize', handleResize) window.addEventListener('resize', handleResize)