马宇豪
2024-04-10 4076c14a8eac96cd716522f2cb15dcda0eb4fcef
src/views/bigScreen/components/screen.vue
@@ -863,10 +863,7 @@
                  let newArr = JSON.parse(JSON.stringify(state.gasData))
                  if(Array.isArray(newArr)){
                    state.gasTotal = newArr.length
                  }else{
                    state.gasTotal = 0
                  }
                  const weather = newArr.map((item)=>{
                    const weather = newArr.map((item)=>{
                      return {
                        time: item.dataReceivingTime?item.dataReceivingTime.slice(11,19):'--',
                        temp: item.temp?item.temp:'--',
@@ -875,8 +872,12 @@
                        windDirection: item.windDirection?item.windDirection:'--',
                        pressure: item.pressure?item.pressure:'--'
                      }
                  })
                  state.weatherData = [...weather].reverse().slice(0, 4);
                    })
                    state.weatherData = [...weather].reverse().slice(0, 4);
                  }else{
                    // state.gasTotal = 0
                    getGasNdData()
                  }
                  for(let key in newArr[0]){
                    if(newArr[0][key] == state.gasSearch && key.indexOf("gasName") !== -1){
                      gasNum = key.substring(7)
@@ -901,7 +902,6 @@
                  }else{
                    state.tlTotal = 0
                  }
                  console.log(state.gasTotal,'获取结束')
                  const gasTime = newArr.map(i=>i.dataReceivingTime?.slice(11,19))
                  const gasTlTime = [...new Set(gasTime)]
                  let areaData = state.areaOptions.map((item)=>{
@@ -945,7 +945,9 @@
              }
              state.socket.onclose=()=>{
                console.log("socket已经关闭")
                getGasNdData()
                getGasTlData()
                getWindData()
              }
            }
        }