From 07739421e8fb5dd6a8412f2df2ec252a406d11ba Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Mon, 4 Mar 2024 17:29:06 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/content/usedEle/UsedEle.vue | 70 +++++++++++++--------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/src/components/content/usedEle/UsedEle.vue b/src/components/content/usedEle/UsedEle.vue index 8582815..18a5b49 100644 --- a/src/components/content/usedEle/UsedEle.vue +++ b/src/components/content/usedEle/UsedEle.vue @@ -67,7 +67,7 @@
- + ); watch(() => props.eleData, (now) => { if (now) { - let fanObj={} - now.frequencyChangerList.forEach(item=>{ - fanObj={ + let fanObj = {} + now.frequencyChangerList.forEach(item => { + fanObj = { value: item.equipmentId, - label:changeNum(item.equipmentId) + label: changeNum(item.equipmentId) } fanList.value.push(fanObj) }) @@ -154,7 +155,7 @@ const setValueA = () => { if (electricityConsumptionMonthly.value === 0 || length.value === null) { valueA.value.style.height = `0px`; } - let width = (electricityConsumptionMonthly.value * length.value?.offsetHeight) /40000; + let width = (electricityConsumptionMonthly.value * length.value?.offsetHeight) / 40000; valueA.value.style.height = `${width}px`; } const setValueB = () => { @@ -171,7 +172,7 @@ const getBasicData = (data) => { const monthSelect = (val) => { monthValue.value = val - getFanInfo(openEquipmentId.value, 'month',val) + getFanInfo(openEquipmentId.value, 'month', val) } const changeDate = (index) => { switch (index) { @@ -182,12 +183,12 @@ const changeDate = (index) => { } } const timeSelect = (index) => { - monthValue.value='' + monthValue.value = '' getFanInfo(openEquipmentId.value, changeDate(index)) }; const changeFanData = (val) => { - selectTimeButton.value=1 - openEquipmentId.value=val + selectTimeButton.value = 1 + openEquipmentId.value = val getFanInfo(val, 'month', monthValue.value) } const getFanInfo = (equipmentId, type = 'month', time = '') => { @@ -196,10 +197,10 @@ const getFanInfo = (equipmentId, type = 'month', time = '') => { getEleEchartsInfo(equipmentId, time, type).then(res => { if (res?.code === 1000) { showLoading.value = false - totalElectricityConsumption.value=res.data.totalElectricityConsumption - saveElectricity.value=res.data.saveElectricity + totalElectricityConsumption.value = res.data.totalElectricityConsumption + saveElectricity.value = res.data.saveElectricity nextTick(() => { - initChart(res.data.dates,res.data.consumptionValues,res.data.saveElectricityValues) + initChart(res.data.dates, res.data.consumptionValues, res.data.saveElectricityValues) }) } }) @@ -208,11 +209,11 @@ const getFanInfo = (equipmentId, type = 'month', time = '') => { }) } const handleOpenChart = () => { - selectTimeButton.value=1 + selectTimeButton.value = 1 isVisited.value = true - openEquipmentId.value=fanList.value[0].value - chooseChartFan.value=fanList.value[0].value - nextTick(()=>{ + openEquipmentId.value = fanList.value[0].value + chooseChartFan.value = fanList.value[0].value + nextTick(() => { chooseMonthRef.value.clearData() }) getFanInfo(openEquipmentId.value, 'month') @@ -289,7 +290,7 @@ const initChart = (type, valueA, valueB) => { xAxis: { type: 'category', // data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'], - data:type, + data: type, axisLabel: { textStyle: { fontSize: 45, @@ -333,13 +334,16 @@ const initChart = (type, valueA, valueB) => {