feat : 对接用电量/省电量数据及新增用电量echarts图表模块

This commit is contained in:
2024-02-28 22:18:55 +08:00
parent a8b5e2c26f
commit 9afde77c00
9 changed files with 378 additions and 122 deletions

View File

@@ -33,8 +33,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"/>
<choose-time v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
<time-range-btn
:buttonList="timeList"
v-model="selectTimeButton"
@@ -56,13 +56,13 @@ import {getEchartsInfo} from "@/api/largeScreen";
import ChooseTime from "@/components/chooseTime/index.vue"
import ChooseMonth from "@/components/chooseMonth/index.vue"
const dayValue = ref('');
const monthValue = ref('');
let myEcharts = reactive({});
const props = defineProps({
list: Array,
airData: Array
});
const chooseDayRef = ref();
const chooseMonthRef = ref();
const windSpeed = ref(0)
const windDirection = ref(0)
const loadingText = ref('加载中...')
@@ -97,11 +97,9 @@ watch(() => props.airData, (now) => {
}
}, {deep: true});
const daySelect = (val) => {
dayValue.value = val
getChartInfo(openDialogId.value, 'day',val)
}
const monthSelect = (val) => {
monthValue.value = val
getChartInfo(openDialogId.value, 'month',val)
}
const getChartInfo = (equipmentId, type = 'day',time='') => {
@@ -123,6 +121,14 @@ const getChartInfo = (equipmentId, type = 'day',time='') => {
}
const handleOpenChart = (id, type) => {
selectTimeButton.value = 2
nextTick(()=>{
if(chooseMonthRef.value){
chooseMonthRef.value.clearData()
}
if(chooseDayRef.value){
chooseDayRef.value.clearData()
}
})
if (type === 'air') {
dialogTitle.value = id.name
openDialogId.value = id.equipmentId
@@ -136,6 +142,7 @@ const handleOpenChart = (id, type) => {
openDialogId.value = id
getChartInfo(id, 'day')
}
}
const changeDate = (index) => {
switch (index) {
@@ -148,8 +155,6 @@ const changeDate = (index) => {
}
}
const timeSelect = (index) => {
dayValue.value = ''
monthValue.value = ''
getChartInfo(openDialogId.value, changeDate(index))
};