feat : 新增图表多日期选择功能

This commit is contained in:
2024-03-13 17:20:20 +08:00
parent 499de290ab
commit d915fd378c
10 changed files with 292 additions and 59 deletions

View File

@@ -53,7 +53,7 @@ import WindPressureItem from "./childComps/WindPressureItem.vue";
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
import * as echarts from 'echarts';
import {getEchartsInfo} from "@/api/largeScreen";
import ChooseDay from "@/components/chooseDay/index.vue"
import ChooseDay from "@/components/chooseDates/index.vue"
import ChooseMonth from "@/components/chooseMonth/index.vue"
import elementResizeDetectorMaker from "element-resize-detector";
import CsvExportor from "csv-exportor";
@@ -120,7 +120,11 @@ const handleExport = () => {
}
} else if (selectTimeButton.value === 2) {
if (clickDay.value) {
time = clickDay.value
if (clickDay.value[1]) {
time = clickDay.value.map(item => item).join('到')
} else {
time = clickDay.value
}
} else {
time = getNowFormatDate(true)
}
@@ -161,11 +165,19 @@ const shrinkScreen = () => {
})
}
const daySelect = (val) => {
clickDay.value = val
if (isFullScreen.value) {
getWindInfo(windSortId.value, 'day', val)
} else {
getWindInfo(windSortId.value, 'day', val, true)
if (val) {
clickDay.value = val
if (isFullScreen.value) {
getWindInfo(windSortId.value, 'day', '','', val[0], val[1])
} else {
getWindInfo(windSortId.value, 'day', '', true, val[0], val[1])
}
}else {
if (isFullScreen.value) {
getWindInfo(windSortId.value, 'day', '')
} else {
getWindInfo(windSortId.value, 'day', '', true)
}
}
}
const monthSelect = (val) => {
@@ -176,7 +188,7 @@ const monthSelect = (val) => {
getWindInfo(windSortId.value, 'month', val, true)
}
}
const getWindInfo = (equipmentId, type = 'day', time = '', flag) => {
const getWindInfo = (equipmentId, type = 'day', time = '', flag, startTime, endTime) => {
isVisited.value = true
showLoading.value = true
nextTick(() => {
@@ -189,7 +201,7 @@ const getWindInfo = (equipmentId, type = 'day', time = '', flag) => {
}
}
})
getEchartsInfo(equipmentId, time, type).then(res => {
getEchartsInfo(equipmentId, time, type, startTime, endTime).then(res => {
if (res?.code === 1000) {
showLoading.value = false
chartData = res.data