From 92e4c0f5deeba69d52603da02bea2ab7836bb9f6 Mon Sep 17 00:00:00 2001 From: web <candymxq888@outlook.com> Date: 星期一, 05 五月 2025 17:21:08 +0800 Subject: [PATCH] fix:修改水温深度选择 --- src/views/screen/temperature/graphic/index.vue | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/views/screen/temperature/graphic/index.vue b/src/views/screen/temperature/graphic/index.vue index 235ce02..4cd23a9 100644 --- a/src/views/screen/temperature/graphic/index.vue +++ b/src/views/screen/temperature/graphic/index.vue @@ -1,17 +1,31 @@ <script setup> -import {ref, onMounted, watch} from "vue"; +import {ref, onMounted} from "vue"; import * as echarts from 'echarts/core'; import {getTemperaturePointList} from '@/api/screen/index.js' import Quarter from "@/components/Quarter"; import moment from "moment"; import { getGraphicData } from '@/api/screen/graphic/index.js' +import { debounce } from '@/utils/tool.js' +const deepCOnfig = [ + { label: '10米', value: 10 }, + { label: '20米', value: 20 }, + { label: '30米', value: 30 }, + { label: '40米', value: 40 }, + { label: '50米', value: 50 }, + { label: '60米', value: 60 }, + { label: '70米', value: 70 }, + { label: '80米', value: 80 }, + { label: '90米', value: 90 }, + { label: '100米', value: 100 }, +] const menuList = ref([]) const timeType = ref(1) //时间类型 1日 2周 3月 4季 5年 const showTime = ref(moment().format('YYYY-MM-DD')); //展示时间 const timeValue = ref(moment().format('YYYY-MM-DD')) //处理后得时间 const searchVal = ref() +const tempDeep = ref(50) const graphicRef = ref(null) const chartsRef = ref([]) //动态生成图表ref const chartData = ref([]) @@ -76,8 +90,6 @@ yAxis: { type: 'value', name: unit, - max: 40, - min: 0, nameTextStyle: { color: '#fff', fontSize: '1rem' @@ -163,6 +175,14 @@ }) } +// 监听页面大小变化,改变echarts的大小 +window.onresize = debounce(function () { + charts?.forEach(el => { + el.resize() + }) +}, 500, true) + + // 全屏操作 const handleFullScreen = () => { graphicRef.value.requestFullscreen() @@ -225,11 +245,13 @@ // 获取报表数据 const getChartData = (point = '') => { + chartData.value = []; //先赋值为空,强制元素重载 const data = { type: timeType.value, pointId: point, pointName: searchVal.value, dataTime: timeValue.value, + waterLevel: tempDeep.value } getGraphicData(data).then(async res => { chartData.value = res.data @@ -270,7 +292,7 @@ <div class="graphic-info"> <div class="graphic-tool"> <div class="tool-l"> - <div class="name">类型</div> + <div class="name">时间类型</div> <el-button-group class="ml-4"> <el-button :type="timeType === 1 ? 'primary' : ''" @click="changeType(1)">日 </el-button> @@ -288,7 +310,7 @@ v-model="showTime" type="date" placeholder="选择时间" - style="width: 15rem" + style="width: 12rem" @change="getTime" /> <el-date-picker @@ -297,7 +319,7 @@ type="week" format="YYYY年 ww[周]" placeholder="选择时间" - style="width: 15rem" + style="width: 12rem" @change="getTime" /> <el-date-picker @@ -305,7 +327,7 @@ v-model="showTime" type="month" placeholder="选择时间" - style="width: 15rem" + style="width: 12rem" @change="getTime" /> <Quarter @@ -313,7 +335,7 @@ placeholder="选择时间" :default-value="showTime" clearable - style="width: 15rem" + style="width: 12rem" @change="getTime" /> <el-date-picker @@ -321,9 +343,18 @@ v-model="showTime" type="year" placeholder="选择时间" - style="width: 15rem" + style="width: 12rem" @change="getTime" /> + <div class="name">深度</div> + <el-select v-model="tempDeep" style="width: 10rem"> + <el-option + v-for="item in deepCOnfig" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> <el-input v-model="searchVal" style="width: 15rem" clearable placeholder="请输入监测点名称"/> <el-button @click="() => getChartData()"> <el-icon> @@ -448,6 +479,7 @@ border-radius: 8px; .charts { + width: 100%; height: 100%; } } -- Gitblit v1.9.3