diff --git a/src/components/content/airInfo/AirInfo.vue b/src/components/content/airInfo/AirInfo.vue index ddae14e..a748cc0 100644 --- a/src/components/content/airInfo/AirInfo.vue +++ b/src/components/content/airInfo/AirInfo.vue @@ -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; diff --git a/src/components/content/fanInfo/FanInfo.vue b/src/components/content/fanInfo/FanInfo.vue index d3ea108..47711cd 100644 --- a/src/components/content/fanInfo/FanInfo.vue +++ b/src/components/content/fanInfo/FanInfo.vue @@ -22,17 +22,16 @@
启动
停止
+
@@ -197,21 +196,22 @@ watch(() => props.fanData, (now) => { watch(() => props.list, (now) => { socketData.value?.forEach(item => { now.forEach(newItem => { - if (item.equipmentId === newItem.equipmentId) { - if (newItem.frequencyFeedback) { - item.frequencySetting = newItem.frequencySetting - item.frequencyFeedback = newItem.frequencyFeedback - } + if (item.equipmentId === newItem.equipmentId) { + if (newItem.hasOwnProperty('frequencyFeedback')) { + item.frequencySetting = newItem.frequencySetting + item.frequencyFeedback = newItem.frequencyFeedback + } else if (newItem.hasOwnProperty('running')) { + item.running = newItem.running + item.breakdown = newItem.breakdown + item.autoMode = newItem.autoMode + } } }) }) transducerData.value.forEach(item => { now.forEach(newItem => { if (item.equipmentId === newItem.equipmentId) { - if (newItem.frequencyFeedback) { - item.frequencySetting = newItem.frequencySetting - item.frequencyFeedback = newItem.frequencyFeedback - } else if (newItem.phaseCurrentA) { + if (newItem.hasOwnProperty('phaseCurrentA')) { item.valueA = newItem.phaseCurrentA item.valueB = newItem.phaseCurrentB item.valueC = newItem.phaseCurrentC @@ -353,21 +353,21 @@ const packageData = (item, type, flag) => { } //启动/停止 const editOperate = (item, flag, type) => { - ElMessageBox.confirm(`确认${type}${changeNum(item)}号风机吗?`, '系统提示', { - type: 'warning', - closeOnClickModal: false - }).then(() => { - const data = packageData(item, flag) - editFrequencyOperationSwitch(data).then(res => { - if (res.code === 1000) { - ElMessage.success(res.msg) - } else { - ElMessage.error(res.msg) - } - }) - }).catch(() => { - item.running = !item.running - }); + // ElMessageBox.confirm(`确认${type}${changeNum(item)}号风机吗?`, '系统提示', { + // type: 'warning', + // closeOnClickModal: false + // }).then(() => { + // const data = packageData(item, flag) + // editFrequencyOperationSwitch(data).then(res => { + // if (res.code === 1000) { + // ElMessage.success(res.msg) + // } else { + // ElMessage.error(res.msg) + // } + // }) + // }).catch(() => { + // item.running = !item.running + // }); } const changeFrequency = (item) => { @@ -394,11 +394,21 @@ const changeModel = (item) => { } else { flag = '手动' } + let number = 0 + if (item.equipmentType === "frequency1") { + number = 1 + } else if (item.equipmentType === "frequency2") { + number = 2 + } ElMessageBox.confirm(`确认修改${changeNum(item)}号风机的模式为${flag}模式吗?`, '系统提示', { type: 'warning', closeOnClickModal: false }).then(() => { - const data = packageData(item, item.autoMode) + const data = { + number: number, + state: item.autoMode?1:0, + tunnelId: props.tunnelId, + } editFrequencyModelSwitch(data).then(res => { if (res.code === 1000) { ElMessage.success(res.msg) @@ -1040,7 +1050,7 @@ input[type="number"] { & > div { flex: 1; text-align: center; - cursor: pointer; + //cursor: pointer; } } } diff --git a/src/views/tunnel/index.vue b/src/views/tunnel/index.vue index e793a60..ed36f09 100644 --- a/src/views/tunnel/index.vue +++ b/src/views/tunnel/index.vue @@ -52,7 +52,7 @@ :close-on-click-modal="false" :close-on-press-escape="false"> - + @@ -249,6 +249,7 @@ const socketData = reactive({ leftData: [], windPressure: [], sensor: [], + windSpeed: [], }); let tunnelLen = computed(() => tunnelLength); const queryParams = reactive({ @@ -581,6 +582,8 @@ const initWebSocket = () => { socketData.windPressure = data; } else if (item.typeKey === "sensor") { socketData.sensor = data; + }else if (item.typeKey === "windSpeed") { + socketData.windSpeed = data; } }); }