fix : 修复bug

This commit is contained in:
2024-03-14 17:49:16 +08:00
parent e020ae5b66
commit 3062cf263d
3 changed files with 75 additions and 50 deletions

View File

@@ -69,9 +69,11 @@ import elementResizeDetectorMaker from "element-resize-detector";
import {getNowFormatDate} from "@/utils/date.js";
import CsvExportor from "csv-exportor";
let myEcharts = reactive({});
const props = defineProps({
list: Array,
windSpeed: Array,
airData: Array
});
const isFullScreen = ref(false);
@@ -97,9 +99,17 @@ const isWindSpeedVisited = ref(false);
const showSpeedLoading = ref(false)
const clickMonth = ref('')
const clickDay = ref('')
watch(() => props.windSpeed, (now) => {
now.forEach(newItem => {
windSpeed.value = newItem.value
})
})
watch(() => props.list, (now) => {
airList.value?.forEach(item => {
now.forEach(newItem => {
if (newItem.equipmentId === 11) {//风向传感器
windDirection.value = newItem.value
}
if (item.equipmentId === newItem.equipmentId) {
item.value = newItem.value
}
@@ -128,13 +138,13 @@ watch(() => props.airData, (now) => {
//导出csv
const handleExport = () => {
let clickUnit = ''
if(dialogTitle.value==='风速'){
clickUnit=windSpeedUnit.value
}else if(dialogTitle.value==='风向'){
clickUnit=windDirectionUnit.value
}else {
if (dialogTitle.value === '风速') {
clickUnit = windSpeedUnit.value
} else if (dialogTitle.value === '风向') {
clickUnit = windDirectionUnit.value
} else {
airList.value.forEach(item => {
if (item.name=== dialogTitle.value) {
if (item.name === dialogTitle.value) {
clickUnit = item.unit
}
})
@@ -181,19 +191,19 @@ const daySelect = (val) => {
getChartInfo(openDialogId.value, 'day', '', true, val[0], val[1])
}
} else {
if (isFullScreen.value) {
getChartInfo(openDialogId.value, 'day', '')
} else {
getChartInfo(openDialogId.value, 'day', '', true)
if (isFullScreen.value) {
getChartInfo(openDialogId.value, 'day', '')
} else {
getChartInfo(openDialogId.value, 'day', '', true)
}
}
}
}
const monthSelect = (val) => {
clickMonth.value = val
if (isFullScreen.value) {
getChartInfo(openDialogId.value, 'month', val)
} else {
getChartInfo(openDialogId.value, 'month', val,true)
getChartInfo(openDialogId.value, 'month', val, true)
}
}
//放大弹窗
@@ -223,7 +233,7 @@ const shrinkScreen = () => {
myEcharts.resize();
nextTick(() => {
isFullScreen.value = true
initChart(chartData.dates, chartData.values,dataZoomTop)
initChart(chartData.dates, chartData.values, dataZoomTop)
})
}
const getChartInfo = (equipmentId, type = 'day', time = '', flag, startTime, endTime) => {
@@ -241,7 +251,7 @@ const getChartInfo = (equipmentId, type = 'day', time = '', flag, startTime, end
getEchartsInfo(equipmentId, time, type, startTime, endTime).then(res => {
if (res?.code === 1000) {
showSpeedLoading.value = false
chartData=res.data
chartData = res.data
nextTick(() => {
if (flag) {
const fanChart = document.getElementById('containerWind')
@@ -251,7 +261,7 @@ const getChartInfo = (equipmentId, type = 'day', time = '', flag, startTime, end
myEcharts.resize();
});
if (!isFullScreen.value) {
initChart(res.data.dates, res.data.values,'93%')
initChart(res.data.dates, res.data.values, '93%')
}
} else {
shrinkScreen()
@@ -268,8 +278,8 @@ const getChartInfo = (equipmentId, type = 'day', time = '', flag, startTime, end
const handleOpenChart = (id, type) => {
selectTimeButton.value = 2
isWindSpeedVisited.value = true
clickMonth.value=''
clickDay.value=''
clickMonth.value = ''
clickDay.value = ''
nextTick(() => {
if (chooseMonthRef.value) {
chooseMonthRef.value.clearData()
@@ -282,7 +292,7 @@ const handleOpenChart = (id, type) => {
if (type === 'air') {
dialogTitle.value = id.name
openDialogId.value = id.equipmentId
getChartInfo(id.equipmentId, 'day','',true)
getChartInfo(id.equipmentId, 'day', '', true)
} else {
if (id === "windDirection") {
dialogTitle.value = '风向'
@@ -290,7 +300,7 @@ const handleOpenChart = (id, type) => {
dialogTitle.value = '风速'
}
openDialogId.value = type
getChartInfo(type, 'day','',true)
getChartInfo(type, 'day', '', true)
}
}
const changeDate = (index) => {
@@ -307,7 +317,7 @@ const timeSelect = (index) => {
if (isFullScreen.value) {
getChartInfo(openDialogId.value, changeDate(index))
} else {
getChartInfo(openDialogId.value, changeDate(index),'',true)
getChartInfo(openDialogId.value, changeDate(index), '', true)
}
};
@@ -357,7 +367,7 @@ const getAirInfo = (now) => {
airList.value = airArr
}
}
const initChart = (type, values,top) => {
const initChart = (type, values, top) => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById('containerWind'));
//5.传入数据
@@ -514,6 +524,7 @@ const initChart = (type, values,top) => {
.input-fan {
cursor: pointer;
padding-right: 20px;
&:hover {
//width: 230px;
padding-left: 20px;
@@ -538,6 +549,7 @@ const initChart = (type, values,top) => {
.input-fan {
//margin: 0 26px;
padding-right: 20px;
&:hover {
//width: 230px;
background: #2E5589;