| | |
| | | <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' |
| | | import {deepCOnfig} from '@/config/index.js' |
| | | |
| | | 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([]) |
| | |
| | | yAxis: { |
| | | type: 'value', |
| | | name: unit, |
| | | max: 40, |
| | | min: 0, |
| | | nameTextStyle: { |
| | | color: '#fff', |
| | | fontSize: '1rem' |
| | |
| | | }) |
| | | } |
| | | |
| | | // 监听页面大小变化,改变echarts的大小 |
| | | window.onresize = debounce(function () { |
| | | charts?.forEach(el => { |
| | | el.resize() |
| | | }) |
| | | }, 500, true) |
| | | |
| | | |
| | | // 全屏操作 |
| | | const handleFullScreen = () => { |
| | | graphicRef.value.requestFullscreen() |
| | |
| | | |
| | | // 获取报表数据 |
| | | 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 |
| | |
| | | <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> |
| | |
| | | v-model="showTime" |
| | | type="date" |
| | | placeholder="选择时间" |
| | | style="width: 15rem" |
| | | style="width: 12rem" |
| | | @change="getTime" |
| | | /> |
| | | <el-date-picker |
| | |
| | | type="week" |
| | | format="YYYY年 ww[周]" |
| | | placeholder="选择时间" |
| | | style="width: 15rem" |
| | | style="width: 12rem" |
| | | @change="getTime" |
| | | /> |
| | | <el-date-picker |
| | |
| | | v-model="showTime" |
| | | type="month" |
| | | placeholder="选择时间" |
| | | style="width: 15rem" |
| | | style="width: 12rem" |
| | | @change="getTime" |
| | | /> |
| | | <Quarter |
| | |
| | | placeholder="选择时间" |
| | | :default-value="showTime" |
| | | clearable |
| | | style="width: 15rem" |
| | | style="width: 12rem" |
| | | @change="getTime" |
| | | /> |
| | | <el-date-picker |
| | |
| | | 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> |
| | |
| | | border-radius: 8px; |
| | | |
| | | .charts { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |