yichenxi
2022-12-12 936633659148e800a8d09322a9f1e646104010a7
src/views/charts/index.vue
@@ -168,7 +168,6 @@
      }
      // 设备更新后,重新获取因子数据
      this.getSensor()
      console.log(this.newMac1)
    },
    // 监听dataType的数据更新
    select1(nv, ov) {
@@ -267,13 +266,23 @@
      })
        .then((res) => {
          // console.log('获得时间对应因子数据')
          console.log(res)
          const data = res.data
          let lockLength = 0
          for (let i = 0; i < data.length; i++) {
            for (let j = 0; j < data[i].deviceData.length; j++) {
              // console.log(data[i].deviceData);
              if (res.data[0].deviceData.length == 1) {
              if (res.data[0].deviceData.length === 1) {
                if (lockLength < data[i].deviceData.length) {
                  newLineChartData.series.push({
                    data: [],
                    name: '',
                    type: 'line',
                    label: {
                      show: true,
                      position: 'top',
                    },
                  })
                }
              } else if (lockLength < data[i].deviceData.length) {
                newLineChartData.series.push({
                  data: [],
                  name: '',
@@ -295,6 +304,9 @@
              newLineChartData.series[j].data.push(
                data[i].deviceData[j].sensorValue
              )
            }
            newLineChartData.xAxis.push(data[i].time)
          }