feat : 新增echarts中指定日期展示及细节优化

This commit is contained in:
2024-02-28 18:08:44 +08:00
parent 59aa2a92d1
commit ea4f72780f
19 changed files with 810 additions and 438 deletions

View File

@@ -23,6 +23,8 @@
<div style="width: 1px;"></div>
</div>
<div class="time-select">
<choose-time v-if="selectTimeButton===2" :time="dayValue" @select="daySelect"/>
<choose-month v-if="selectTimeButton===1" :time="monthValue" @select="monthSelect"/>
<time-range-btn
:buttonList="timeList"
v-model="selectTimeButton"
@@ -41,12 +43,16 @@ import WindPressureItem from "./childComps/WindPressureItem.vue";
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
import * as echarts from 'echarts';
import {getEchartsInfo} from "@/api/largeScreen";
import ChooseTime from "@/components/ChooseTime/index.vue"
import ChooseMonth from "@/components/ChooseMonth/index.vue"
const props = defineProps({
list: Array,
winData: Array,
loading: Number,
});
const dayValue = ref('');
const monthValue = ref('');
const windSort = ref(1)
const windSortId = ref(1)
const timeList = ref(["年", "月", "日"]);
@@ -68,11 +74,18 @@ watch(() => props.list, (now) => {
watch(() => props.winData, (now) => {
getScreenInfo(now.windPressureSensorList)
}, {deep: true});
const getWindInfo = (equipmentId, type = 'day') => {
const daySelect = (val) => {
dayValue.value = val
getWindInfo(windSortId.value, 'day', val)
}
const monthSelect = (val) => {
monthValue.value = val
getWindInfo(windSortId.value, 'month', val)
}
const getWindInfo = (equipmentId, type = 'day', time = '') => {
isVisited.value = true
showLoading.value = true
getEchartsInfo(equipmentId, type).then(res => {
getEchartsInfo(equipmentId, time, type).then(res => {
if (res?.code === 1000) {
showLoading.value = false
nextTick(() => {
@@ -88,14 +101,20 @@ const handleOpenChart = (item) => {
windSort.value = item.equipmentName
windSortId.value = item.equipmentId
}
const timeSelect = (index) => {
if (index === 0) {
getWindInfo(windSortId.value, 'years')
} else if (index === 1) {
getWindInfo(windSortId.value, 'month')
} else if (index === 2) {
getWindInfo(windSortId.value, 'day')
const changeDate = (index) => {
switch (index) {
case 0:
return 'years'
case 1:
return 'month'
case 2:
return 'day'
}
}
const timeSelect = (index) => {
dayValue.value = ''
monthValue.value = ''
getWindInfo(windSortId.value, changeDate(index))
};
const getScreenInfo = (now) => {
let windPressureObj = {}