易晨曦提交1、监测因子趋势页面修改时间控件
2、监测因子对比修改echarts显示
1 files added
9 files modified
1568 ■■■■■ changed files
src/components/Echarts/LineChart.vue 100 ●●●●● patch | view | raw | blame | history
src/components/Echarts/LineChart2.vue 191 ●●●●● patch | view | raw | blame | history
src/components/Echarts/LineChartSpe.vue 97 ●●●●● patch | view | raw | blame | history
src/components/Form/HourPicker.vue 18 ●●●● patch | view | raw | blame | history
src/components/Form/HourPicker1.vue 55 ●●●●● patch | view | raw | blame | history
src/utils/request.js 4 ●●●● patch | view | raw | blame | history
src/views/Equipment/index.vue 57 ●●●●● patch | view | raw | blame | history
src/views/car/index.vue 790 ●●●● patch | view | raw | blame | history
src/views/charts/index.vue 13 ●●●● patch | view | raw | blame | history
src/views/contrast/index.vue 243 ●●●●● patch | view | raw | blame | history
src/components/Echarts/LineChart.vue
@@ -1,5 +1,8 @@
<template>
  <!-- <div> -->
  <!-- <div>1111111111111111111111111111111111111111</div> -->
  <div :class="className" :style="{ height: height, width: width }" />
  <!-- </div> -->
</template>
<script>
@@ -13,28 +16,28 @@
  props: {
    className: {
      type: String,
      default: 'chart',
      default: 'chart'
    },
    width: {
      type: String,
      default: '100%',
      default: '100%'
    },
    height: {
      type: String,
      default: '350px',
      default: '350px'
    },
    autoResize: {
      type: Boolean,
      default: true,
      default: true
    },
    chartData: {
      type: Object,
      required: true,
      required: true
    },
    interval: {
      type: Number,
      default: 1,
    },
      default: 1
    }
    // xdata: {
    //   type: Array,
    //   required: true
@@ -42,7 +45,7 @@
  },
  data() {
    return {
      chart: null,
      chart: null
    }
  },
  watch: {
@@ -50,8 +53,8 @@
      deep: true,
      handler(val) {
        this.setOptions(val)
      },
    },
      }
    }
    // xdata: {
    //   deep: true,
    //   handler(val) {
@@ -74,36 +77,26 @@
    this.chart = null
  },
  methods: {
    initChart() {
      this.chart = echarts.init(this.$el, 'macarons')
      this.setOptions(this.chartData)
    },
    setOptions(val) {
      function fontSize(res){
        let clientWidth = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
        if (!clientWidth) return;
        let fontSize = 100 * (clientWidth / 1920);
        return res*fontSize;
    }
      // console.log('组件设置的数据')
      console.log(val)
      this.chart.setOption(
        {
      // console.log(val)
      this.chart.setOption({
          title: {
            text: val.text,
            textStyle: {
              color: '#000000',
            },
            color: '#000000'
          }
          },
          xAxis: {
            data: val.xAxis.slice(0, 24),
          data: val.xAxis,
            boundaryGap: false,
            axisTick: {
              show: false,
            },
            show: false
          }
            // axisTick: { // 决定是否显示坐标刻度
            //   alignWithLabel: true,
            //   show: true
@@ -120,24 +113,25 @@
          grid: {
            left: '5%',
            right: '5%',
            top:'5%',
          bottom: '20%',
          top: '10%',
            containLabel: true,
            height:fontSize(3.3),
          x: 120
          },
          toolbox: {
            feature: {
              dataZoom: {
                yAxisIndex: 'none',
              yAxisIndex: 'none'
              },
              restore: {},
              saveAsImage: {},
            },
            saveAsImage: {}
          }
          },
          tooltip: {
            trigger: 'axis',
            position: function (pt) {
              return [pt[0], '10%']
            },
          }
          },
          // tooltip: {
          //   trigger: 'axis',
@@ -148,8 +142,8 @@
          // },
          yAxis: {
            axisTick: {
              show: false, // 轴线刻度
            },
            show: false // 轴线刻度
          }
            // axisLine: {
            //   lineStyle: {
            //     color: '#000000'
@@ -159,29 +153,18 @@
          legend: {
            data: val.title,
            tooltip: {
              show: true,
            show: true
          }
            },
            textStyle:{
              fontSize:fontSize(0.12)
            },
            widht:'auto',
            height:'auto',
            top: fontSize(4.6),
          },
          dataZoom: [
            {
        dataZoom: [{
              type: 'inside',
              start: 0,
              end: 100,
            },
            {
          end: 100
        }, {
              start: 0,
              end: 20,
              bottom: fontSize(4.4),
              height: fontSize(0.5),
            },
          ],
          series: val.series,
          end: 10
        }],
        series: val.series
          // [{
          //   name: JSON.parse(JSON.stringify(val.title)),
          //   itemStyle: {
@@ -206,11 +189,8 @@
          //     }
          //   }
          // }]
        },
        true
      )
      window.onresize = this.chart.resize;
    },
  },
      }, true)
    }
  }
}
</script>
src/components/Echarts/LineChart2.vue
New file
@@ -0,0 +1,191 @@
<template>
  <div :class="className" :style="{ height: height, width: width }" />
</template>
<script>
// import echarts from 'echarts'
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
  mixins: [resize],
  props: {
    className: {
      type: String,
      default: 'chart',
    },
    width: {
      type: String,
      default: '100%',
    },
    height: {
      type: String,
      default: '350px',
    },
    autoResize: {
      type: Boolean,
      default: true,
    },
    chartData: {
      type: Object,
      required: true,
    },
    interval: {
      type: Number,
      default: 1,
    },
    // xdata: {
    //   type: Array,
    //   required: true
    // }
  },
  data() {
    return {
      chart: null,
    }
  },
  watch: {
    chartData: {
      deep: true,
      handler(val) {
        this.setOptions(val)
      },
    },
    // xdata: {
    //   deep: true,
    //   handler(val) {
    //     console.log(val)
    //     this.setOptions(val)
    //     console.log('执行成功')
    //   }
    // }
  },
  mounted() {
    this.$nextTick(() => {
      this.initChart()
    })
  },
  beforeDestroy() {
    if (!this.chart) {
      return
    }
    this.chart.dispose()
    this.chart = null
  },
  methods: {
    initChart() {
      this.chart = echarts.init(this.$el, 'macarons')
      this.setOptions(this.chartData)
    },
    setOptions(val) {
      function fontSize(res) {
        let clientWidth =
          window.innerWidth ||
          document.documentElement.clientWidth ||
          document.body.clientWidth
        if (!clientWidth) return
        let fontSize = 100 * (clientWidth / 1920)
        return res * fontSize
      }
      // console.log('组件设置的数据')
      console.log(val, 'eee')
      this.chart.setOption(
        {
          title: {
            text: val.text,
            textStyle: {
              color: '#000000',
            },
          },
          xAxis: {
            data: val.xAxis,
            boundaryGap: false,
            axisTick: {
              show: false,
            },
            // axisTick: { // 决定是否显示坐标刻度
            //   alignWithLabel: true,
            //   show: true
            // },
            // axisLine: {
            //   lineStyle: {
            //     color: '#000000'
            //   }
            // },
            // axisLabel: {
            //   interval: this.interval
            // }
          },
          grid: {
            left: '5%',
            right: '5%',
            top: '5%',
            containLabel: true,
            height: fontSize(4.3),
          },
          toolbox: {
            feature: {
              dataZoom: {
                yAxisIndex: 'none',
              },
              restore: {},
              saveAsImage: {},
            },
          },
          tooltip: {
            trigger: 'axis',
            position: function (pt) {
              return [pt[1], '-14%']
            },
            textStyle: {
              fontSize: fontSize(0.117), // 字体大小
            },
          },
          yAxis: {
            axisTick: {
              show: false, // 轴线刻度
            },
            // axisLine: {
            //   lineStyle: {
            //     color: '#000000'
            //   }
            // }
          },
          legend: {
            data: val.title,
            tooltip: {
              show: true,
            },
            textStyle: {
              fontSize: fontSize(0.15),
            },
            widht: 'auto',
            height: 'auto',
            top: fontSize(5.5),
          },
          dataZoom: [
            {
              type: 'inside',
              start: 0,
              end: 100,
            },
            {
              start: 0,
              end: 20,
              bottom: fontSize(3.3),
              height: fontSize(0.5),
            },
          ],
          series: val.series,
        },
        true
      )
      window.onresize = this.chart.resize
    },
  },
}
</script>
src/components/Echarts/LineChartSpe.vue
@@ -15,24 +15,24 @@
  props: {
    className: {
      type: String,
      default: 'chart'
      default: 'chart',
    },
    width: {
      type: String,
      default: '100%'
      default: '100%',
    },
    height: {
      type: String,
      default: '350px'
      default: '350px',
    },
    autoResize: {
      type: Boolean,
      default: true
      default: true,
    },
    chartData: {
      type: Object,
      required: true
    }
      required: true,
    },
    // xdata: {
    //   type: Array,
    //   required: true
@@ -40,16 +40,19 @@
  },
  data() {
    return {
      chart: null
      chart: null,
    }
  },
  watch: {
    chartData: {
      deep: true,
      handler(val) {
        console.log(val,'wath');
        this.setOptions(val)
      }
    }
      },
      deep: true,
    },
  },
  mounted() {
    this.$nextTick(() => {
@@ -69,30 +72,41 @@
      this.setOptions(this.chartData)
    },
    setOptions(val) {
      console.log(val);
      this.chart.setOption({
      console.log(val.series,'123');
      function fontSize(res) {
        let clientWidth =
          window.innerWidth ||
          document.documentElement.clientWidth ||
          document.body.clientWidth
        if (!clientWidth) return
        let fontSize = 100 * (clientWidth / 1920)
        return res * fontSize
      }
      this.chart.setOption(
        {
        xAxis: {
          data: val.xAxis,
          boundaryGap: false,
          axisTick: {
            show: false
          }
              show: false,
            },
        },
        grid: {
          left: 10,
          right: 10,
          bottom: 20,
          top: 30,
          containLabel: true
            height: fontSize(3.5),
            containLabel: true,
        },
        toolbox: {
          feature: {
            dataZoom: {
              yAxisIndex: 'none'
                yAxisIndex: 'none',
            },
            restore: {},
            saveAsImage: {}
          }
              saveAsImage: {},
            },
        },
        // tooltip: {
        //   trigger: 'axis',
@@ -106,22 +120,19 @@
            return [pt[0], '10%']
          },
          formatter(params) {
              console.log(params,'ssss');
              let data=[]
            for (let i = 0; i < params.length; i++) {
              return params[i].seriesName + ':' + '&nbsp;&nbsp;' + params[i].data.data0
                data+=params[i].seriesName + '&nbsp:' +'&nbsp&nbsp'+params[i].value+ '<br/>'
            }
          }
            return data
        },
        // tooltip: {
        //   trigger: 'axis',
        //   axisPointer: {
        //     type: 'cross'
        //   },
        //   padding: [5, 10]
        // },
          },
        yAxis: {
          axisLabel: {
            show: false
          }
              show: false,
            },
        },
        legend: {
          icon: 'circle',
@@ -129,17 +140,23 @@
          // textStyle: {
          //   fontSize: 18
          // },
          data: val.title
            data: val.title,
        },
        dataZoom: [{
          dataZoom: [
            {
          type: 'inside',
          start: 0,
          end: 100
        }, {
              end: 100,
            },
            {
          start: 0,
          end: 10
        }],
        series: val.series
              end: 10,
              top:fontSize(4),
              height: fontSize(0.4),
            },
          ],
          series: val.series,
        // [{
        //   name: JSON.parse(JSON.stringify(val.title)),
        //   itemStyle: {
@@ -164,8 +181,10 @@
        //     }
        //   }
        // }]
      }, true)
    }
  }
        },
        true
      )
    },
  },
}
</script>
src/components/Form/HourPicker.vue
@@ -32,24 +32,10 @@
    return {
      // newValue1: ''
      value1: '',
      timeOne: '',
      pickerOptions: {
        onPick: ({ maxDate, minDate }) => {
          // 最大时间  最小时间
          this.timeOne = minDate.getTime() // 当选一个日期时 就是最小日期
          // // 如何你选择了两个日期了,就把那个变量置空
          if (maxDate) this.timeOne = ''
        },
        disabledDate: time => {
          if (this.timeOne) {
            const WEEK = 6 * 24 * 3600 * 1000 // 这里乘以6相当于 限制7天以内
            const minTime = this.timeOne  // 七天之前
            const maxTime = this.timeOne + WEEK // 七天之后
            return time.getTime() < minTime || time.getTime() > maxTime || time.getTime() > new Date()
          } else {
        disabledDate: (time) => {
            return time.getTime() > new Date()
          }
        }
        },
      },
    }
  },
src/components/Form/HourPicker1.vue
@@ -5,17 +5,16 @@
    placeholder="选择日期"
    value-format="yyyy-MM-dd"
  /> -->
  <el-time-picker
    is-range
  <el-date-picker
    v-model="value1"
    type="datetimerange"
    range-separator="至"
    start-placeholder="开始时间"
    end-placeholder="结束时间"
    placeholder="选择时间范围"
     size="inputSize"
    start-placeholder="开始日期"
    value-format="yyyy-MM-dd HH"
    end-placeholder="结束日期"
    :picker-options="pickerOptions"
  >
  </el-time-picker>
  </el-date-picker>
</template>
<script>
@@ -26,13 +25,33 @@
// import 引入的组件需要注入到对象中才能使用
  components: {},
  props: {
    value1: String
    // value1: String
  },
  data() {
    // 这里存放数据
    return {
      // newValue1: ''
      newValue1: ''
      value1: '',
      timeOne: '',
      pickerOptions: {
        onPick: ({ maxDate, minDate }) => {
          // 最大时间  最小时间
          this.timeOne = minDate.getTime() // 当选一个日期时 就是最小日期
          // // 如何你选择了两个日期了,就把那个变量置空
        },
        disabledDate: time => {
          if (this.timeOne) {
            const WEEK = 7 * 24 * 3600 * 1000 -1 // 这里乘以6相当于 限制7天以内
            const minTime = this.timeOne  // 七天之前
            const maxTime = this.timeOne + WEEK // 七天之后
            return time.getTime() < minTime || time.getTime() > maxTime || time.getTime() > new Date()
          } else {
            return time.getTime() > new Date()
          }
        }
      },
    }
  },
  // 计算属性 类似于data概念
@@ -40,18 +59,15 @@
  // 监控data中的数据变化
  watch: {
    value1(nv, ov) {
      this.newValue1 = nv
      // this.newValue1 = nv
      this.sendPicker()
    }
    },
  },
  // 生命周期 - 创建完成(可以访问当前 this 实例)
  created() {
  },
  created() {},
  // 生命周期 - 挂载完成(可以访问 DOM 元素)
  mounted() {
  mounted() {},
  },
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
@@ -62,11 +78,10 @@
  // 方法集合
  methods: {
    sendPicker() {
      this.$emit('sendPickerChild', this.newValue1)
    }
  } // 如果页面有keep-alive缓存功能,这个函数会触发
      this.$emit('sendPickerChild', this.value1)
    },
  }, // 如果页面有keep-alive缓存功能,这个函数会触发
}
</script>
<style scoped>
</style>
src/utils/request.js
@@ -2,10 +2,6 @@
import { MessageBox, Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
// const baseUrl = 'http://47.99.64.149:8081/'
const baseUrl = 'http://192.168.0.42:8081/' // lzj
// const baseUrl = 'http://192.168.0.33:8081/' // yy
src/views/Equipment/index.vue
@@ -5,25 +5,30 @@
        <div class="timee">
          {{ time }}
        </div>
        <div style="margin-left: 20px; margin-top: -12px">
        <div style="margin-left: 1.5rem; margin-top:-1.1rem">
          <span>设备和站点:</span>
          <el-cascader
           v-model="newMac"
            :options="options"
            :props="props"
            collapse-tags
            clearable
            @change="changeYz"
            placeholder="选择设备"
            style="width: 25rem"
          ></el-cascader>
        </div>
        <div style="margin-left: 20px; margin-top: -12px">
        <div style="margin-left: 1.5rem; margin-top: -12px">
          <span>选择因子:</span>
          <el-cascader
            :options="options"
            :options="newSensor"
            :props="props"
            collapse-tags
            clearable
            @change="res"
          ></el-cascader>
        </div>
        <div style="margin-left: 20px; margin-top: -12px">
        <div style="margin-left: 1.5rem; margin-top: -12px">
          <el-button type="primary">查询</el-button>
        </div>
      </div>
@@ -46,14 +51,31 @@
      props: { multiple: true },
      defaultData: [],
      options: [],
      newSensor:[],
      newMac:'',
      newMac1:[]
    }
  },
  // 计算属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  watch: {
     newMac(newVal, oldval) {
      this.newMac1 = []
      for (let i = 0; i < newVal.length; i++) {
        // console.log(newVal[i], 111)
        this.newMac1.push(newVal[i][1][1])
      }
      // 设备更新后,重新获取因子数据
      this.getSensor()
      console.log(this.newMac1)
    },
  },
  //方法集合
  methods: {
    res(res){
      console.log(res.toString());
    },
    getData() {
      this.$request({
        url: '/monitorPoint/queryMonitorPoints',
@@ -85,6 +107,30 @@
          console.log(error)
        })
    },
    changeYz(){
      console.log(11111);
      this.getSensor();
    },
     getSensor() {
      this.$request({
        url: '/deviceInfo/getMacSensors',
        method: 'post',
        data: {
          macs: this.newMac1,
        },
      })
        .then((result) => {
          console.log(result);
          var sensor = result.data
          for (var i in sensor) {
            this.newSensor.push({ value: i, label: sensor[i] })
          }
        })
        .catch((err) => {
          console.log(err)
        })
    },
  },
  //生命周期 - 创建完成(可以访问当前 this 实例)
  created() {
@@ -104,4 +150,5 @@
}
</script>
<style scoped>
</style>
src/views/car/index.vue
@@ -1,25 +1,42 @@
<template>
  <div class="main_body">
    <el-container
      style="height: 100%"
    >
    <el-container style="height: 100%">
      <el-aside
        v-if="this.$store.state.aside"
        width="300px"
        style="background-color: rgb(238, 241, 246);padding-top:10px"
      >
        <span style="font-size:13px;padding-left:10px;font-weight:500;color:rgb(64, 158, 255)">走航车设备</span>
        <span
          style="
            font-size: 13px;
            padding-left: 10px;
            font-weight: 500;
            color: rgb(64, 158, 255);
          "
          >走航车设备</span
        >
        <el-menu style="margin-top:10px">
          <el-menu-item
            v-for="(item,index) in defaultData"
            :key="index"
            style="display: flex;justify-content: space-between;align-items: center;padding-right: 0;border-bottom:1px solid #eee"
            style="
              display: flex;
              justify-content: space-between;
              align-items: center;
              padding-right: 0;
              border-bottom: 1px solid #eee;
            "
            :index="(index+1 + '-' + index + 1).toString()"
            @click="changeCarData(item)"
          >
            <span>{{ item.name }}</span>
            <i
                style="vertical-align: -2.5px;font-size: 20px;margin-right:10px;margin-left:auto"
              style="
                vertical-align: -2.5px;
                font-size: 20px;
                margin-right: 10px;
                margin-left: auto;
              "
                class="iconfont iconfaxianzuobiao"
                @click="deviceDetail(item.mac,null,item,0)"
            />
@@ -27,10 +44,17 @@
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-dialog> </el-dialog>
      <el-container style="position: relative">
        <div class="carTop">
          <span style="float:left;margin: 1px 10px 0 0;">
            <el-button size="medium" type="primary" icon="el-icon-setting" @click="dialogFormVisible = true">6参设定</el-button>
          <span style="float: left; margin: 1px 10px 0 0">
            <el-button
              size="medium"
              type="primary"
              icon="el-icon-setting"
              @click="dialogFormVisible = true"
              >6参设定</el-button
            >
          </span>
          <span
            v-for="(item, index) in snesorParams"
@@ -48,8 +72,10 @@
            @click="changeCode1(index)"
          >{{ item }}
          </span>
          <span v-if="webSocketView" style="float:right;margin: 2px 10px 0 0;">
            <el-button size="medium" type="primary" @click="wsStart()">开启实时</el-button>
          <span v-if="webSocketView" style="float: right; margin: 2px 10px 0 0">
            <el-button size="medium" type="primary" @click="wsStart()"
              >开启实时</el-button
            >
          </span>
<!--           <el-date-picker
            v-if="historyView"
@@ -63,29 +89,49 @@
            @change="dateChange"
          />-->
          <!-- 选择时间段 -->
          <el-time-picker
              :disabled="isDisTime"
              style="float:right;width: 210px"
              is-range
              v-model="timeValue"
              @blur="blurChange"
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              placeholder="选择时间范围">
          </el-time-picker>
          <!--          <el-time-picker-->
          <!--              :disabled="isDisTime"-->
          <!--              style="float:right;width: 210px"-->
          <!--              is-range-->
          <!--              v-model="timeValue"-->
          <!--              @blur="blurChange"-->
          <!--              range-separator="至"-->
          <!--              start-placeholder="开始时间"-->
          <!--              end-placeholder="结束时间"-->
          <!--              placeholder="选择时间范围">-->
          <!--          </el-time-picker>-->
          <!-- 历史日期选择下拉框 -->
          <el-select v-if="historyView" v-model="dateValue" placeholder="选择日期" style="float:right;line-height:40px;margin-right:10px;width:140px" @change="dateChange">
            <el-option
              v-for="item in isDataList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              @click.native="dataChangeClick"
            />
          </el-select>
          <!--          <el-select v-if="historyView" v-model="dateValue" placeholder="选择日期" style="float:right;line-height:40px;margin-right:10px;width:140px" @change="dateChange">-->
          <!--            <el-option-->
          <!--              v-for="item in isDataList"-->
          <!--              :key="item.value"-->
          <!--              :label="item.label"-->
          <!--              :value="item.value"-->
          <!--              @click.native="dataChangeClick"-->
          <!--            />-->
          <!--          </el-select>-->
          <el-date-picker
            style="float: right; margin-right: 10px"
            @change="dateChange"
            v-model="dateValue"
            type="datetimerange"
            :picker-options="threeOptions"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </el-date-picker>
          <!-- 历史/实时切换下拉框 -->
          <el-select v-model="dataTypeValue" placeholder="数据类型" style="float:right;line-height:40px;margin-right:10px;width:103px">
          <el-select
            v-model="dataTypeValue"
            placeholder="数据类型"
            style="
              float: right;
              line-height: 40px;
              margin-right: 10px;
              width: 103px;
            "
          >
            <el-option
              v-for="item in dataTypeList"
              :key="item.value"
@@ -95,7 +141,8 @@
          </el-select>
        </div>
        <div v-if="noneData" class="noneData">当前时间没有走航数据</div>
        <div id="map_container" v-loading="loading" /> <!-- 百度地图 -->
        <div id="map_container" v-loading="loading" />
        <!-- 百度地图 -->
      </el-container>
    </el-container>
    <!-- <div id="selectSenor">
@@ -112,7 +159,12 @@
    <!-- 6参设定弹窗 -->
    <el-dialog title="6参设定" :visible.sync="dialogFormVisible" width="1000px">
      <el-descriptions title="国控6参" :column="3" border>
        <el-descriptions-item label="PM2.5 | ug/m³" label-class-name="my-label" content-class-name="my-content">22</el-descriptions-item>
        <el-descriptions-item
          label="PM2.5 | ug/m³"
          label-class-name="my-label"
          content-class-name="my-content"
          >22</el-descriptions-item
        >
        <el-descriptions-item label="PM10 | ug/m³">34</el-descriptions-item>
        <el-descriptions-item label="SO2 | ug/m³">4</el-descriptions-item>
        <el-descriptions-item label="NO2 | ug/m³">16</el-descriptions-item>
@@ -122,18 +174,20 @@
      <!-- <el-descriptions title="设备标准值"  border>
      </el-descriptions> -->
      <div
        style="font-size: 16px;font-weight: 700;margin:10px 0 20px 0;font-size: 16px;
    font-weight: 700;color: #303133;"
      >设备标准值</div>
        style="
          font-size: 16px;
          font-weight: 700;
          margin: 10px 0 20px 0;
          font-size: 16px;
          font-weight: 700;
          color: #303133;
        "
      >
        设备标准值
      </div>
      <el-table :data="sensorTableData" border>
        <el-table-column
          prop="sensorName"
          label="名称"
        />
        <el-table-column
          prop="unit"
          label="单位"
        />
        <el-table-column prop="sensorName" label="名称" />
        <el-table-column prop="unit" label="单位" />
        <el-table-column label="一级">
          <template slot-scope="scope">
            <el-input v-model="scope.row.tab1" placeholder="请输入内容" />
@@ -176,99 +230,123 @@
<script>
import $ from 'jquery'
import '@/assets/icon/iconfont.css'
import requestObj from '@/utils/request'
var GPS = {
  PI: 3.14159265358979324,
  x_pi: 3.14159265358979324 * 3000.0 / 180.0,
  x_pi: (3.14159265358979324 * 3000.0) / 180.0,
  delta: function(lat, lon) {
    var a = 6378245.0 //  a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
    var ee = 0.00669342162296594323 //  ee: 椭球的偏心率。
    var dLat = this.transformLat(lon - 105.0, lat - 35.0)
    var dLon = this.transformLon(lon - 105.0, lat - 35.0)
    var radLat = lat / 180.0 * this.PI
    var radLat = (lat / 180.0) * this.PI
    var magic = Math.sin(radLat)
    magic = 1 - ee * magic * magic
    var sqrtMagic = Math.sqrt(magic)
    dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * this.PI)
    dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * this.PI)
    return { 'lat': dLat, 'lon': dLon }
    dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * this.PI)
    dLon = (dLon * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * this.PI)
    return { lat: dLat, lon: dLon }
  },
  // WGS-84 to GCJ-02
  gcj_encrypt: function(wgsLat, wgsLon) {
    if (this.outOfChina(wgsLat, wgsLon)) { return { 'lat': wgsLat, 'lon': wgsLon } }
    if (this.outOfChina(wgsLat, wgsLon)) {
      return { lat: wgsLat, lon: wgsLon }
    }
    var d = this.delta(wgsLat, wgsLon)
    return { 'lat': wgsLat + d.lat, 'lon': wgsLon + d.lon }
    return { lat: wgsLat + d.lat, lon: wgsLon + d.lon }
  },
  // GCJ-02 to WGS-84
  gcj_decrypt: function(gcjLat, gcjLon) {
    if (this.outOfChina(gcjLat, gcjLon)) { return { 'lat': gcjLat, 'lon': gcjLon } }
    if (this.outOfChina(gcjLat, gcjLon)) {
      return { lat: gcjLat, lon: gcjLon }
    }
    var d = this.delta(gcjLat, gcjLon)
    return { 'lat': gcjLat - d.lat, 'lon': gcjLon - d.lon }
    return { lat: gcjLat - d.lat, lon: gcjLon - d.lon }
  },
  // GCJ-02 to WGS-84 exactly
  gcj_decrypt_exact: function(gcjLat, gcjLon) {
    var initDelta = 0.01
    var threshold = 0.000000001
    var dLat = initDelta; var dLon = initDelta
    var mLat = gcjLat - dLat; var mLon = gcjLon - dLon
    var pLat = gcjLat + dLat; var pLon = gcjLon + dLon
    var wgsLat; var wgsLon; var i = 0
    var dLat = initDelta
    var dLon = initDelta
    var mLat = gcjLat - dLat
    var mLon = gcjLon - dLon
    var pLat = gcjLat + dLat
    var pLon = gcjLon + dLon
    var wgsLat
    var wgsLon
    var i = 0
    while (1) {
      wgsLat = (mLat + pLat) / 2
      wgsLon = (mLon + pLon) / 2
      var tmp = this.gcj_encrypt(wgsLat, wgsLon)
      dLat = tmp.lat - gcjLat
      dLon = tmp.lon - gcjLon
      if ((Math.abs(dLat) < threshold) && (Math.abs(dLon) < threshold)) { break }
      if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
        break
      }
      if (dLat > 0) pLat = wgsLat; else mLat = wgsLat
      if (dLon > 0) pLon = wgsLon; else mLon = wgsLon
      if (dLat > 0) pLat = wgsLat
      else mLat = wgsLat
      if (dLon > 0) pLon = wgsLon
      else mLon = wgsLon
      if (++i > 10000) break
    }
    return { 'lat': wgsLat, 'lon': wgsLon }
    return { lat: wgsLat, lon: wgsLon }
  },
  // GCJ-02 to BD-09
  bd_encrypt: function(gcjLat, gcjLon) {
    var x = gcjLon; var y = gcjLat
    var x = gcjLon
    var y = gcjLat
    var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * this.x_pi)
    var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * this.x_pi)
    this.bdLon = z * Math.cos(theta) + 0.0065
    this.bdLat = z * Math.sin(theta) + 0.006
    return { 'lat': this.bdLat, 'lon': this.bdLon }
    return { lat: this.bdLat, lon: this.bdLon }
  },
  // BD-09 to GCJ-02
  bd_decrypt: function(bdLat, bdLon) {
    var x = bdLon - 0.0065; var y = bdLat - 0.006
    var x = bdLon - 0.0065
    var y = bdLat - 0.006
    var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * this.x_pi)
    var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * this.x_pi)
    var gcjLon = z * Math.cos(theta)
    var gcjLat = z * Math.sin(theta)
    return { 'lat': gcjLat, 'lon': gcjLon }
    return { lat: gcjLat, lon: gcjLon }
  },
  // WGS-84 to Web mercator
  // mercatorLat -> y mercatorLon -> x
  mercator_encrypt: function(wgsLat, wgsLon) {
    var x = wgsLon * 20037508.34 / 180.0
    var y = Math.log(Math.tan((90.0 + wgsLat) * this.PI / 360.0)) / (this.PI / 180.0)
    y = y * 20037508.34 / 180.0
    return { 'lat': y, 'lon': x }
    var x = (wgsLon * 20037508.34) / 180.0
    var y =
      Math.log(Math.tan(((90.0 + wgsLat) * this.PI) / 360.0)) /
      (this.PI / 180.0)
    y = (y * 20037508.34) / 180.0
    return { lat: y, lon: x }
  },
  // Web mercator to WGS-84
  // mercatorLat -> y mercatorLon -> x
  mercator_decrypt: function(mercatorLat, mercatorLon) {
    var x = mercatorLon / 20037508.34 * 180.0
    var y = mercatorLat / 20037508.34 * 180.0
    y = 180 / this.PI * (2 * Math.atan(Math.exp(y * this.PI / 180.0)) - this.PI / 2)
    return { 'lat': y, 'lon': x }
    var x = (mercatorLon / 20037508.34) * 180.0
    var y = (mercatorLat / 20037508.34) * 180.0
    y =
      (180 / this.PI) *
      (2 * Math.atan(Math.exp((y * this.PI) / 180.0)) - this.PI / 2)
    return { lat: y, lon: x }
  },
  // two point's distance
  distance: function(latA, lonA, latB, lonB) {
    var earthR = 6371000.0
    var x = Math.cos(latA * this.PI / 180.0) * Math.cos(latB * this.PI / 180.0) * Math.cos((lonA - lonB) * this.PI / 180)
    var y = Math.sin(latA * this.PI / 180.0) * Math.sin(latB * this.PI / 180.0)
    var x =
      Math.cos((latA * this.PI) / 180.0) *
      Math.cos((latB * this.PI) / 180.0) *
      Math.cos(((lonA - lonB) * this.PI) / 180)
    var y =
      Math.sin((latA * this.PI) / 180.0) * Math.sin((latB * this.PI) / 180.0)
    var s = x + y
    if (s > 1) s = 1
    if (s < -1) s = -1
@@ -277,24 +355,62 @@
    return distance
  },
  outOfChina: function(lat, lon) {
    if (lon < 72.004 || lon > 137.8347) { return true }
    if (lat < 0.8293 || lat > 55.8271) { return true }
    if (lon < 72.004 || lon > 137.8347) {
      return true
    }
    if (lat < 0.8293 || lat > 55.8271) {
      return true
    }
    return false
  },
  transformLat: function(x, y) {
    var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
    ret += (20.0 * Math.sin(6.0 * x * this.PI) + 20.0 * Math.sin(2.0 * x * this.PI)) * 2.0 / 3.0
    ret += (20.0 * Math.sin(y * this.PI) + 40.0 * Math.sin(y / 3.0 * this.PI)) * 2.0 / 3.0
    ret += (160.0 * Math.sin(y / 12.0 * this.PI) + 320 * Math.sin(y * this.PI / 30.0)) * 2.0 / 3.0
    var ret =
      -100.0 +
      2.0 * x +
      3.0 * y +
      0.2 * y * y +
      0.1 * x * y +
      0.2 * Math.sqrt(Math.abs(x))
    ret +=
      ((20.0 * Math.sin(6.0 * x * this.PI) +
        20.0 * Math.sin(2.0 * x * this.PI)) *
        2.0) /
      3.0
    ret +=
      ((20.0 * Math.sin(y * this.PI) + 40.0 * Math.sin((y / 3.0) * this.PI)) *
        2.0) /
      3.0
    ret +=
      ((160.0 * Math.sin((y / 12.0) * this.PI) +
        320 * Math.sin((y * this.PI) / 30.0)) *
        2.0) /
      3.0
    return ret
  },
  transformLon: function(x, y) {
    var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
    ret += (20.0 * Math.sin(6.0 * x * this.PI) + 20.0 * Math.sin(2.0 * x * this.PI)) * 2.0 / 3.0
    ret += (20.0 * Math.sin(x * this.PI) + 40.0 * Math.sin(x / 3.0 * this.PI)) * 2.0 / 3.0
    ret += (150.0 * Math.sin(x / 12.0 * this.PI) + 300.0 * Math.sin(x / 30.0 * this.PI)) * 2.0 / 3.0
    var ret =
      300.0 +
      x +
      2.0 * y +
      0.1 * x * x +
      0.1 * x * y +
      0.1 * Math.sqrt(Math.abs(x))
    ret +=
      ((20.0 * Math.sin(6.0 * x * this.PI) +
        20.0 * Math.sin(2.0 * x * this.PI)) *
        2.0) /
      3.0
    ret +=
      ((20.0 * Math.sin(x * this.PI) + 40.0 * Math.sin((x / 3.0) * this.PI)) *
        2.0) /
      3.0
    ret +=
      ((150.0 * Math.sin((x / 12.0) * this.PI) +
        300.0 * Math.sin((x / 30.0) * this.PI)) *
        2.0) /
      3.0
    return ret
  }
  },
}
export default {
  data() {
@@ -310,7 +426,7 @@
        'CO',
        'O3',
        'TVOC',
        '尘负荷'
        '尘负荷',
      ],
      changeColor: 0,
      changeColor1: 0,
@@ -319,35 +435,59 @@
      dataType: 'history',
      responseJSON: null,
      radio1: null,
      viewOptions: [
        '平铺',
        '立体'
      ],
      dateValue: null,
      viewOptions: ['平铺', '立体'],
      dateValue: [],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        },
        shortcuts: [{
        shortcuts: [
          {
          text: '今天',
          onClick(picker) {
            picker.$emit('pick', new Date())
          }
        }, {
            },
          },
          {
          text: '昨天',
          onClick(picker) {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24)
            picker.$emit('pick', date)
          }
        }, {
            },
          },
          {
          text: '一周前',
          onClick(picker) {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
            picker.$emit('pick', date)
            },
          },
        ],
      },
      timeOne: '',
      threeOptions: {
        onPick: ({ maxDate, minDate }) => {
          // 最大时间 最小时间
          this.timeOne = minDate.getTime() // 当选一个日期时 就是最小日期
          // 如何你选择了两个日期了,就把那个变量置空
          if (maxDate) this.timeOne = ''
        },
        disabledDate: (time) => {
          if (this.timeOne) {
            const WEEK = 3 * 24 * 3600 * 1000 - 1 // 这里乘以3再减去1相当于 限制3天以内
            const minTime = this.timeOne // 三天之前
            const maxTime = this.timeOne + WEEK // 三天之后
            return (
              time.getTime() < minTime ||
              time.getTime() > maxTime ||
              time.getTime() > new Date()
            )
          } else {
            return time.getTime() > new Date()
          }
        }]
        },
      },
      sensorDate: null,
      noneData: false,
@@ -355,14 +495,86 @@
      carMac: null,
      dialogFormVisible: false,
      sensorTableData: [
        { sensorName: 'PM2.5', unit: 'ug/m³', tab1: '35', tab2: '75', tab3: '115', tab4: '150', tab5: '250', tab6: '350' },
        { sensorName: 'PM10', unit: 'ug/m³', tab1: '50', tab2: '150', tab3: '250', tab4: '350', tab5: '420', tab6: '500' },
        { sensorName: 'SO2', unit: 'ug/m³', tab1: '50', tab2: '150', tab3: '475', tab4: '800', tab5: '1600', tab6: '2100' },
        { sensorName: 'NO2', unit: 'ug/m³', tab1: '40', tab2: '80', tab3: '180', tab4: '280', tab5: '565', tab6: '750' },
        { sensorName: 'CO', unit: 'mg/m³', tab1: '2', tab2: '4', tab3: '14', tab4: '24', tab5: '36', tab6: '48' },
        { sensorName: 'O3', unit: 'ug/m³', tab1: '100', tab2: '160', tab3: '215', tab4: '265', tab5: '800', tab6: '800' },
        { sensorName: 'TVOC', unit: 'mg/m³', tab1: '0.1', tab2: '0.3', tab3: '0.5', tab4: '0.7', tab5: '0.9', tab6: '1' },
        { sensorName: '尘负荷', unit: 'ug/m³', tab1: '300', tab2: '500', tab3: '1000', tab4: '10000', tab5: '20000', tab6: '50000' }
        {
          sensorName: 'PM2.5',
          unit: 'ug/m³',
          tab1: '35',
          tab2: '75',
          tab3: '115',
          tab4: '150',
          tab5: '250',
          tab6: '350',
        },
        {
          sensorName: 'PM10',
          unit: 'ug/m³',
          tab1: '50',
          tab2: '150',
          tab3: '250',
          tab4: '350',
          tab5: '420',
          tab6: '500',
        },
        {
          sensorName: 'SO2',
          unit: 'ug/m³',
          tab1: '50',
          tab2: '150',
          tab3: '475',
          tab4: '800',
          tab5: '1600',
          tab6: '2100',
        },
        {
          sensorName: 'NO2',
          unit: 'ug/m³',
          tab1: '40',
          tab2: '80',
          tab3: '180',
          tab4: '280',
          tab5: '565',
          tab6: '750',
        },
        {
          sensorName: 'CO',
          unit: 'mg/m³',
          tab1: '2',
          tab2: '4',
          tab3: '14',
          tab4: '24',
          tab5: '36',
          tab6: '48',
        },
        {
          sensorName: 'O3',
          unit: 'ug/m³',
          tab1: '100',
          tab2: '160',
          tab3: '215',
          tab4: '265',
          tab5: '800',
          tab6: '800',
        },
        {
          sensorName: 'TVOC',
          unit: 'mg/m³',
          tab1: '0.1',
          tab2: '0.3',
          tab3: '0.5',
          tab4: '0.7',
          tab5: '0.9',
          tab6: '1',
        },
        {
          sensorName: '尘负荷',
          unit: 'ug/m³',
          tab1: '300',
          tab2: '500',
          tab3: '1000',
          tab4: '10000',
          tab5: '20000',
          tab6: '50000',
        },
      ],
      carWs: null,
      map: null,
@@ -379,13 +591,16 @@
      firstPlayFlag: true,
      firstWsFlag: true,
      msgTemp: [],
      dataTypeList: [{
      dataTypeList: [
        {
        value: 'history',
        label: '历史数据'
      }, {
          label: '历史数据',
        },
        {
        value: 'webSocket',
        label: '实时数据'
      }],
          label: '实时数据',
        },
      ],
      dataTypeValue: 'history',
      historyView: true,
      webSocketView: false,
@@ -398,24 +613,34 @@
      endTime: '',
      dataDate: '',
      sensorTime: [],
      timeValue: [new Date(2020, 1, 1, 0, 0, 0), new Date(2022, 12, 31, 23, 59, 59)]
      timeValue: [
        new Date(2020, 1, 1, 0, 0, 0),
        new Date(2022, 12, 31, 23, 59, 59),
      ],
    }
  },
  watch: {
    dataTypeValue(n, o) {
      if (this.dataTypeValue === 'webSocket') {
        this.dateValue = null
        this.dateValue = []
        this.historyView = false
        this.webSocketView = true
      } else {
        this.dateValue = null
        this.dateValue = []
        this.historyView = true
        this.webSocketView = false
      }
    },
    dateValue(n, o) {
      if (n === null) {
        this.dateValue = []
      }
    },
    viewKey(n, o) {
      // console.log(n)
    }
    },
    deep: true,
    immediate: true,
    // timeValue: {
    //   handler(newVal, oldVal) {
    //     this.sensorTime = this.newTime()
@@ -445,17 +670,36 @@
    }
    // })
  },
  beforeDestroy() {
  },
  beforeDestroy() {},
  created() {
    this.newTime(this.timeValue)
    this.newDate()
    this.getCarData()
    this.$watch('carMac', () => {
      this.getMacDate()
    })
    // this.$watch('carMac', () => {
    //   this.getMacDate()
    // })
  },
  methods: {
    // 时间处理函数
    newTime2(timeArr) {
      var arr = []
      timeArr.map((v) => {
        var date = new Date(v)
        var y = date.getFullYear()
        var m = date.getMonth() + 1
        m = m < 10 ? '0' + m : m
        var d = date.getDate()
        d = d < 10 ? '0' + d : d
        var h = date.getHours()
        h = h < 10 ? '0' + h : h
        var minute = date.getMinutes()
        minute = minute < 10 ? '0' + minute : minute
        var s = date.getSeconds()
        s = s < 10 ? '0' + s : s
        arr.push(y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s)
      })
      return arr
    },
    // 跳转设备详情页
    deviceDetail(mac, item, items, indexs) {
      // console.log('这是传输过去的值')
@@ -472,7 +716,7 @@
          device: items,
          macName: mac,
          indexs: indexs,
          items: [items.latitude, items.longitude]
          items: [items.latitude, items.longitude],
        },
        query: {
          monitorPointInfo: JSON.stringify(item),
@@ -480,8 +724,8 @@
          macName: mac,
          indexs: indexs,
          items: [items.latitude, items.longitude],
          equipment: 'car'
        }
          equipment: 'car',
        },
      })
    },
    // 6参设定方法
@@ -498,13 +742,13 @@
    getCarData() {
      this.$request({
        url: '/cruiser/selectCruisers',
        method: 'get'
        method: 'get',
      })
        .then(res => {
        .then((res) => {
          this.defaultData = res.data
          this.carMac = res.data[0].mac
        })
        .catch(err => {
        .catch((err) => {
          console.log(err)
        })
    },
@@ -515,27 +759,27 @@
        url: '/cruiser/getDates',
        method: 'get',
        params: {
          mac: this.carMac
        }
          mac: this.carMac,
        },
      })
        .then(res => {
        .then((res) => {
          for (let i = 0; i < res.data.length; i++) {
            // this.isDataList[i].value = res.data.data[i]
            // this.isDataList[i].label = res.data.data[i]
            // this.isDataList[i] = { value: res.data.data[i], label: res.data.data[i] }
            this.isDataList.push({
              value: res.data[i],
              label: res.data[i]
              label: res.data[i],
            })
          }
        })
        .catch(err => {
        .catch((err) => {
          console.log(err)
        })
    },
    // 进行经纬度转换为距离的计算
    Rad(d) {
      return d * Math.PI / 180.0// 经纬度转换成三角函数中度分表形式。
      return (d * Math.PI) / 180.0 // 经纬度转换成三角函数中度分表形式。
    },
    // 计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
    GetDistance(lat1, lng1, lat2, lng2) {
@@ -543,8 +787,16 @@
      var radLat2 = this.Rad(lat2)
      var a = radLat1 - radLat2
      var b = this.Rad(lng1) - this.Rad(lng2)
      var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
        Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)))
      var s =
        2 *
        Math.asin(
          Math.sqrt(
            Math.pow(Math.sin(a / 2), 2) +
              Math.cos(radLat1) *
                Math.cos(radLat2) *
                Math.pow(Math.sin(b / 2), 2)
          )
        )
      s = s * 6378.137 // EARTH_RADIUS;
      s = Math.round(s * 10000) / 10000 // 输出为公里
      // s=s.toFixed(4);
@@ -553,7 +805,10 @@
    // 日期格式化
    newDate() {
      var aData = new Date()
      var month = aData.getMonth() < 9 ? '0' + (aData.getMonth() + 1) : aData.getMonth() + 1
      var month =
        aData.getMonth() < 9
          ? '0' + (aData.getMonth() + 1)
          : aData.getMonth() + 1
      var date = aData.getDate() <= 9 ? '0' + aData.getDate() : aData.getDate()
      this.sensorDate = aData.getFullYear() + '-' + month + '-' + date
    },
@@ -562,31 +817,23 @@
      let str = ''
      let str2 = ''
      this.sensorTime = []
      timeArr.map(v => {
      timeArr.map((v) => {
        v = JSON.stringify(v)
        str2 = v.substr(12, 8).split(':')
        str2[0] = (str2[0] - 0 + 8) % 24 < 9 ? '0' + (str2[0] - 0 + 8) % 24 : (str2[0] - 0 + 8) % 24
        str2[0] =
          (str2[0] - 0 + 8) % 24 < 9
            ? '0' + ((str2[0] - 0 + 8) % 24)
            : (str2[0] - 0 + 8) % 24
        str = str2.join(':')
        this.sensorTime.push(str)
      })
    },
    // 数据类型
    dateChange(e) {
      this.sensorDate = e;
      // if (this.view) {
      //   this.view.removeAllLayers()
      //   this.map.clearOverlays()
      //   // console.log('清除图层')
      // }
      // this.dataType = 'history'
      // // this.map = null
      // this.getStart()
    },
    // 日期选择点击事件
    dataChangeClick(e) {
      if (!this.isDisTime) {
        // 更改时间格式
        this.newTime(this.timeValue)
      if (e === null) {
        this.sensorDate = []
      } else {
        this.sensorDate = this.newTime2(e)
        if (this.view) {
          this.view.removeAllLayers()
          this.map.clearOverlays()
@@ -596,8 +843,25 @@
        // this.map = null
        this.getStart()
      }
      this.isDisTime = false
    },
    // 日期选择点击事件
    // dataChangeClick(e) {
    //   if (!this.isDisTime) {
    //     // 更改时间格式
    //     if (this.dateValue.length <= 1) {
    //       this.newTime(this.timeValue)
    //     }
    //     if (this.view) {
    //       this.view.removeAllLayers()
    //       this.map.clearOverlays()
    //       // console.log('清除图层')
    //     }
    //     this.dataType = 'history'
    //     // this.map = null
    //     this.getStart()
    //   }
    //   this.isDisTime = false
    // },
    // 时间选框失去焦点
    blurChange() {
      // 更改时间格式
@@ -625,6 +889,7 @@
      }
      that.dataType = 'webSocket'
      // 拼写URL
      // const baseUrl = `${requestObj.baseUrl}`
      var socketUrl = 'cruiserWebsocket/' + this.carMac
      // 替换http为WS
      socketUrl = socketUrl.replace('https', 'ws').replace('http', 'ws')
@@ -643,7 +908,12 @@
        if (that.msgTemp.length < 2) {
          that.msgTemp.push({ lat: lat, lon: lon })
        }     
        var distance = that.GetDistance(that.msgTemp[0].lat, that.msgTemp[0].lon, that.msgTemp[1].lat, that.msgTemp[1].lon)
        var distance = that.GetDistance(
          that.msgTemp[0].lat,
          that.msgTemp[0].lon,
          that.msgTemp[1].lat,
          that.msgTemp[1].lon
        )
        if (distance >= 0.05) {
          that.msgTemp.shift()
          that.msgTemp.push({ lat: lat, lon: lon })
@@ -652,7 +922,6 @@
          that.msgTemp.pop()
        }
      }
    },
    // 走航车轨迹数据
    getStart() {
@@ -664,18 +933,16 @@
        this.view.removeAllLayers()
        this.map.clearOverlays()
      }
      var time1 = this.sensorDate + ' ' + this.sensorTime[0]
      var time2 = this.sensorDate + ' ' + this.sensorTime[1]
      this.$request({
        url: '/cruiser/cruiserTrajectory',
        method: 'get',
        params: {
          mac: this.carMac,
          time1,
          time2
        }
      }).then(res => {
        console.log(res);
          time1: this.sensorDate[0],
          time2: this.sensorDate[1],
        },
      }).then((res) => {
        if (!res.data.length) {
          this.noneData = true
          this.loading = false
@@ -705,13 +972,16 @@
      this.loading = false
      if (this.responseJSON.length > 0) {
        this.noneData = false
        console.log(that.carMac, 'mac')
        $.each(this.responseJSON, (item, value) => {
          if (typeof (value.flylon) === 'undefined') {
          if (typeof value.flylon === 'undefined') {
            showNoPoints()
          } else {
            var lng = parseFloat(value.flylon.substr(0, value.flylon.length - 1))
            var lat = parseFloat(value.flylat.substr(0, value.flylat.length - 1))
            var lng = parseFloat(
              value.flylon.substr(0, value.flylon.length - 1)
            )
            var lat = parseFloat(
              value.flylat.substr(0, value.flylat.length - 1)
            )
            if (lng < 70 || lng > 150 || lat > 60 || lat < 20) {
              return true
            }
@@ -719,7 +989,7 @@
            lat = GPS.gcj_encrypt(lat, lng).lat
            lng = GPS.bd_encrypt(lat, lng).lon
            lat = GPS.bd_encrypt(lat, lng).lat
            var point = new BMapGL.Point(lng, lat);
            var point = new BMapGL.Point(lng, lat)
            point.a34004 = parseInt(value.a34004)
            point.a34002 = parseInt(value.a34002)
            point.a21026 = parseInt(value.a21026)
@@ -727,7 +997,12 @@
            point.a21005 = parseFloat(value.a21005).toFixed(3)
            point.a05024 = parseInt(value.a05024)
            point.a99054 = parseFloat(value.a99054).toFixed(3)
            if (value.dustld - 0 !== 0 && value.dustld - 0 < 100 && that.carMac === 'p5dnd7a0243622') {
            if (
              value.dustld - 0 !== 0 &&
              value.dustld - 0 < 100 &&
              (that.carMac === 'p5dnd7a0243622' ||
                that.carMac === 'p5dnd7a0243625')
            ) {
              point.dustld = 100
            } else {
              point.dustld = value.dustld - 0
@@ -739,7 +1014,7 @@
        that.sensor = this.sensorKey
        that.viewType = this.viewKey
        that.size = 50
        that.distance = that.size / 2 / Math.sin(1 * Math.PI / 4)
        that.distance = that.size / 2 / Math.sin((1 * Math.PI) / 4)
        // 已有地图,避免再次请求
        if (!that.showPoints) {
          that.map = new BMapGL.Map('map_container')
@@ -751,10 +1026,11 @@
        } else {
          that.map.setTilt(52)
        }
        that.map.setDisplayOptions({ // 设置天空颜色
        that.map.setDisplayOptions({
          // 设置天空颜色
          skyColors: ['rgba(186, 0, 255, 0)', 'rgba(186, 0, 255, 0.2)'], // 天空颜色
          building: false, // 不显示建筑物
          poiText: true// 显示poi文字
          poiText: true, // 显示poi文字
        })
        that.map.addControl(new BMapGL.NavigationControl3D())// 添加3d控件
        if (this.responseJSON.length === 0) {
@@ -767,7 +1043,7 @@
        if (that.firstPlayFlag) {
              that.map.centerAndZoom(that.centerPoint, that.mapZoom)
          that.view = new mapvgl.View({
            map: that.map
            map: that.map,
          })
          that.firstPlayFlag = false
        } else {
@@ -793,7 +1069,10 @@
              selectedIndex: -1, // 选中项
              selectedColor: '#ee1111', // 选中项颜色 
              autoSelect: true, // 根据鼠标位置来自动设置选中项
              riseTime: 1800 // 楼块初始化升起时间
              riseTime: 1800, // 楼块初始化升起时间
              onClick: (e) => {
                console.log(e)
              },
            })
            that.shapeLayer.setData(data)
            that.view.addLayer(that.shapeLayer)
@@ -815,12 +1094,15 @@
          var data = point[sensor]
          // 根据因子浓度变换方块颜色   
          color = getColorAndLevel(sensor, data).color
          var polygon = new BMapGL.Polygon([
          var polygon = new BMapGL.Polygon(
            [
            new BMapGL.Point(sw.lng, sw.lat), // 左下角
            new BMapGL.Point(ne.lng, sw.lat), // 左上角
            new BMapGL.Point(ne.lng, ne.lat), // 右上角
            new BMapGL.Point(sw.lng, ne.lat)// 右下角
          ], { strokeWeight: 0.5, strokeOpacity: 0.0, fillColor: color })
              new BMapGL.Point(sw.lng, ne.lat), // 右下角
            ],
            { strokeWeight: 0.5, strokeOpacity: 0.0, fillColor: color }
          )
          that.map.addOverlay(polygon)
          // 方块内添加label文本
          setLabelStyle(data, point)
@@ -829,14 +1111,26 @@
      // 起点和终点标注
      function drawStartAndEnd() {
        var startIcon = new BMapGL.Icon(require('@/assets/images/start.png'), new BMapGL.Size(48, 48))
        var startMark = new BMapGL.Marker(that.showPoints[0], { icon: startIcon, offset: new BMapGL.Size(0, -20) })
        that.map.addOverlay(startMark)
        var endIcon = new BMapGL.Icon(require('@/assets/images/end.png'), new BMapGL.Size(48, 48))
        var endMark = new BMapGL.Marker(that.showPoints[that.showPoints.length - 1], {
          icon: endIcon,
          offset: new BMapGL.Size(0, -20)
        var startIcon = new BMapGL.Icon(
          require('@/assets/images/start.png'),
          new BMapGL.Size(48, 48)
        )
        var startMark = new BMapGL.Marker(that.showPoints[0], {
          icon: startIcon,
          offset: new BMapGL.Size(0, -20),
        })
        that.map.addOverlay(startMark)
        var endIcon = new BMapGL.Icon(
          require('@/assets/images/end.png'),
          new BMapGL.Size(48, 48)
        )
        var endMark = new BMapGL.Marker(
          that.showPoints[that.showPoints.length - 1],
          {
            icon: endIcon,
            offset: new BMapGL.Size(0, -20),
          }
        )
        that.map.addOverlay(endMark)
      }
@@ -852,8 +1146,8 @@
        data.push({
          geometry: {
            type: '"LineString"',
            coordinates: [points]
          }
            coordinates: [points],
          },
        })
        var lineLayer = new mapvgl.LineLayer({
          color: 'red',
@@ -861,7 +1155,7 @@
          animation: true,
          duration: 10, // 循环时间2s
          trailLength: 0.1, // 拖尾长度占间隔的0.4
          interval: 0.3 // 粒子长度占线整体长度的0.2
          interval: 0.3, // 粒子长度占线整体长度的0.2
        })
        that.view.addLayer(lineLayer)
        lineLayer.setData(data)
@@ -885,6 +1179,7 @@
            points.push(point1)
          }
        }
        return points
      }
@@ -894,14 +1189,23 @@
        // 将距离转换成经度的计算公式
        var ra = distance / EARTH_RADIUS
        // 转换为radian,否则结果会不正确
        angle = angle / 180 * Math.PI
        lng = lng / 180 * Math.PI
        lat = lat / 180 * Math.PI
        lng = lng + Math.atan2(Math.sin(angle) * Math.sin(ra) * Math.cos(lat), Math.cos(ra) - Math.sin(lat) * Math.sin(lat))
        lat = Math.asin(Math.sin(lat) * Math.cos(ra) + Math.cos(lat) * Math.sin(ra) * Math.cos(angle))
        angle = (angle / 180) * Math.PI
        lng = (lng / 180) * Math.PI
        lat = (lat / 180) * Math.PI
        lng =
          lng +
          Math.atan2(
            Math.sin(angle) * Math.sin(ra) * Math.cos(lat),
            Math.cos(ra) - Math.sin(lat) * Math.sin(lat)
          )
        lat = Math.asin(
          Math.sin(lat) * Math.cos(ra) +
            Math.cos(lat) * Math.sin(ra) * Math.cos(angle)
        )
        // 转为正常的10进制经纬度
        lng = lng * 180 / Math.PI
        lat = lat * 180 / Math.PI
        lng = (lng * 180) / Math.PI
        lat = (lat * 180) / Math.PI
        console.log(lng, lat)
        return new BMapGL.Point(lng, lat)
      }
@@ -968,77 +1272,77 @@
              data0.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
            case 1:
              data1.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
            case 2:
              data2.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
            case 3:
              data3.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
            case 4:
              data4.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
            case 5:
              data5.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
            case 6:
              data6.push({
                geometry: {
                  type: 'Polygon',
                  coordinates: [polygon]
                  coordinates: [polygon],
                },
                properties: {
                  height: height
                }
                  height: height,
                },
              })
              break
          }
@@ -1235,13 +1539,14 @@
      // point上添加label文本
      function setLabelStyle(content, point) {
        var label = new BMapGL.Label("<span class='my-maptip'>" + content + '<br /><span>', // 为lable填写内容
        var label = new BMapGL.Label(
          "<span class='my-maptip'>" + content + '<br /><span>', // 为lable填写内容
          {
            offset: new BMapGL.Size(-8, -10), // label的偏移量,为了让label的中心显示在点上
            position: point
            position: point,
          }
        )// label的位置
        var offsetSize = new BMapGL.Size(0, 0)
        var size = '10px'
        if (that.map.getZoom() <= 15.5) {
@@ -1254,7 +1559,7 @@
          lineHeight: '20px',
          fontFamily: '微软雅黑',
          backgroundColor: '0.05',
          fontWeight: 'bold'
          fontWeight: 'bold',
        }
        label.setStyle(labelStyle)
        that.map.addOverlay(label)
@@ -1274,7 +1579,9 @@
        // 这里根据缩放显示和隐藏文本
        var zoom = that.map.getZoom()
        $('span.my-maptip').parent()[zoom <= 15.5 ? 'hide' : 'show']()
        $('span.my-maptip').parent().css('font-size', 30 - zoom)
        $('span.my-maptip')
          .parent()
          .css('font-size', 30 - zoom)
      })
      // var that = this
@@ -1311,28 +1618,36 @@
      this.changeColor = index
      // var pr = ''
      switch (index) {
        case 0: this.sensorKey = 'a34004'
        case 0:
          this.sensorKey = 'a34004'
          // this.bg = require('@/assets/images/tl_PM10.png')
          break
        case 1: this.sensorKey = 'a34002'
        case 1:
          this.sensorKey = 'a34002'
          // this.bg = require('@/assets/images/tl_PM2.5.png')
          break
        case 2: this.sensorKey = 'a21026'
        case 2:
          this.sensorKey = 'a21026'
          // this.bg = require('@/assets/images/tl_SO2.png')
          break
        case 3: this.sensorKey = 'a21004'
        case 3:
          this.sensorKey = 'a21004'
          // this.bg = require('@/assets/images/tl_NO2.png')
          break
        case 4: this.sensorKey = 'a21005'
        case 4:
          this.sensorKey = 'a21005'
          // this.bg = require('@/assets/images/tl_CO.png')
          break
        case 5: this.sensorKey = 'a05024'
        case 5:
          this.sensorKey = 'a05024'
          // this.bg = require('@/assets/images/tl_O3.png')
          break
        case 6: this.sensorKey = 'a99054'
        case 6:
          this.sensorKey = 'a99054'
          // this.bg = require('@/assets/images/tl_TVOCNew.png')
          break
        case 7: this.sensorKey = 'dustld'
        case 7:
          this.sensorKey = 'dustld'
          // this.bg = require('@/assets/images/tl_TVOCNew.png')
          break
      }
@@ -1346,8 +1661,8 @@
        this.viewKey = '3D'
      }
      this.getStart()
    }
  }
    },
  },
}
</script>
<style lang="less" scoped>
@@ -1360,7 +1675,7 @@
    margin: 0;
    z-index: 0;
    font-size: 14px;
    font-family: "微软雅黑";
  font-family: '微软雅黑';
}
.main_body {
@@ -1383,7 +1698,7 @@
    margin-top: -50px;
    z-index: 11;
    color: #000000;
    border: 2px solid #FF7F50;
  border: 2px solid #ff7f50;
    font-size: 28px;
    line-height: 100px;
    text-align: center;
@@ -1454,7 +1769,8 @@
  background: rgba(204, 204, 204, 0.5);
  box-shadow: 1px 1px 5px #666;
}
.carTop > .left,.right {
.carTop > .left,
.right {
  padding: 5px 10px;
  border: 1px solid #aaa;
  border-right: none;
@@ -1465,10 +1781,12 @@
  margin-top: 4px;
  -webkit-transform-origin-x: 0;
}
.carTop  .left:nth-child(1),.carTop  .right:nth-child(1) {
.carTop .left:nth-child(1),
.carTop .right:nth-child(1) {
  border-radius: 5px 0 0 5px;
}
.carTop  .left:nth-last-child(2),.carTop  .right:nth-child(2) {
.carTop .left:nth-last-child(2),
.carTop .right:nth-child(2) {
  border-radius: 0 5px 5px 0;
  border-right: 1px solid #aaa;
}
@@ -1484,7 +1802,8 @@
    }
  }
}
.carTop > .left:hover,.right:hover {
.carTop > .left:hover,
.right:hover {
  background: rgb(64, 158, 255);
  color: #fff;
}
@@ -1514,3 +1833,4 @@
  width: 15%;
}
</style>
src/views/charts/index.vue
@@ -65,7 +65,7 @@
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
// 例如:import《组件名称》from'《组件路径》';
import LineChart from '@/components/Echarts/LineChart'
import LineChart from '@/components/Echarts/LineChart2'
import DatePicker from '@/components/Form/DatePicker'
import MouthPicker from '@/components/Form/MouthPicker'
import HourPicker from '@/components/Form/HourPicker'
@@ -272,6 +272,7 @@
          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 (lockLength < data[i].deviceData.length) {
                newLineChartData.series.push({
@@ -284,8 +285,7 @@
                  },
                })
             }
             }
             else if (lockLength < data[i].deviceData.length) {
              } else if (lockLength < data[i].deviceData.length) {
                newLineChartData.series.push({
                  data: [],
                  name: '',
@@ -295,16 +295,17 @@
                    position: 'top',
                  },
                })
              }
                newLineChartData.series[j].name = data[i].deviceData[j].name
                newLineChartData.title.push(data[i].deviceData[j].name)
              }
              lockLength++
              newLineChartData.series[j].data.push(
                data[i].deviceData[j].sensorValue
              )
            }
            newLineChartData.xAxis.push(data[i].time)
          }
          // newLineChartData.title = this.value
src/views/contrast/index.vue
@@ -1,12 +1,12 @@
+<template>
  <div style="width:100%">
  <div style="width: 100%; height: 100%">
    <div class="topSelect">
      <el-cascader
        v-model="newMac"
        :options="options"
        clearable
        placeholder="选择设备"
        style="width: 354px;"
        style="width: 354px"
      />
      <el-cascader
        v-model="value"
@@ -31,7 +31,11 @@
        <!-- <el-radio-button label="年报" />
        <el-radio-button label="自定义" /> -->
      <!-- </el-radio-group>  -->
       <el-select v-model="radio1" placeholder="请选择" style="margin-left:20px">
      <el-select
        v-model="radio1"
        placeholder="请选择"
        style="margin-left: 20px"
      >
        <el-option
          v-for="item in options1"
          :key="item.value"
@@ -40,7 +44,12 @@
        >
        </el-option>
      </el-select>
      <component :is="dataType" class="select11" style="padding-left:0;margin-left:20px;width:160px" @sendPickerChild="showPickerChild" />
      <component
        :is="dataType"
        class="select11"
        style="padding-left: 0; margin-left: 20px; width: 160px"
        @sendPickerChild="showPickerChild"
      />
      <!--查询按钮-->
      <el-button @click="selectData" class="btn1">查询</el-button>
    </div>
@@ -48,7 +57,7 @@
      <div style="position:absolute">(单位:ug/m³)</div>
      <div style="text-align: center;width: 100%;">{{ newData }}·{{ newMac?newMac[0]:'' }}·{{ newMac?newMac[newMac.length - 1][0]:'' }}·{{ value |sensorFilter }}·趋势图</div>
    </div> -->
    <LineChart :chart-data="lineChartData" />
    <LineChart :chart-data="lineChartData"  style="height: 23rem"/>
  </div>
</template>
@@ -62,24 +71,24 @@
import HourPicker from '@/components/Form/HourPicker'
import CustomPicker from '@/components/Form/CustomPicker'
import json from '@/assets/json/sensor.json'
import HourPicker1 from '@/components/Form/HourPicker1'
const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
    actualData: [120, 82, 91, 154, 162, 140, 145],
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
    actualData: [180, 160, 151, 106, 145, 150, 130],
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
    actualData: [120, 90, 100, 138, 142, 130, 130],
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
    actualData: [120, 82, 91, 154, 162, 140, 130],
  },
}
export default {
// import 引入的组件需要注入到对象中才能使用props
@@ -88,13 +97,14 @@
    DatePicker,
    MouthPicker,
    HourPicker,
    CustomPicker
    CustomPicker,
    HourPicker1,
  },
  filters: {
    sensorFilter: function(value) {
      if (!value) return ''
      return json[value]
    }
    },
  },
  props: {
    // defaultData: Array
@@ -118,7 +128,7 @@
      newLineChartData: {
        series: [],
        xAxis: [],
        title: ''
        title: '',
      },
      newData: '',
      defaultData: [],
@@ -126,16 +136,19 @@
      chartSensorName: '',
      middleData: [],
       options1:[
        {
          label: '小时报',
          value: '小时报',
        },
         {
          label:'日报',
          value:'日报'
        }
        , {
          value: '日报',
        },
        {
          label:'月报',
          value:'月报'
        }
      ]
          value: '月报',
        },
      ],
    }
  },
  // 计算属性 类似于data概念
@@ -165,7 +178,10 @@
        this.unit = 0
      } else if (nv === '月报') {
        this.dataType = 'DatePicker'
        this.unit = 1
        this.unit = 3
      } else if (nv === '小时报') {
        this.dataType = 'HourPicker1'
        this.unit = 0
      }
      // else if (nv === '年报') {
      //   this.dataType = 'MouthPicker'
@@ -174,16 +190,14 @@
      //   this.dataType = 'CustomPicker'
      //   this.unit = 'hour'
      // }
    }
    },
  },
  // 生命周期 - 创建完成(可以访问当前 this 实例)
  created() {
    this.getData()
  },
  // 生命周期 - 挂载完成(可以访问 DOM 元素)
  mounted() {
  },
  mounted() {},
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
@@ -199,18 +213,27 @@
        url: '/monitorPoint/queryMonitorPoints',
        method: 'get',
        params: {
          organizationId: this.$store.state.orgId
        }
          organizationId: this.$store.state.orgId,
        },
      })
        .then((res) => {
          // console.log('这是index页面左侧设备数据')
          // console.log(res)
          this.defaultData = res.data.monitorPoints
          for (let i = 0; i < this.defaultData.length; i++) {
            this.options.push({ value: this.defaultData[i].name, label: this.defaultData[i].name })
            this.options.push({
              value: this.defaultData[i].name,
              label: this.defaultData[i].name,
            })
            this.options[i].children = []
            for (let j = 0; j < this.defaultData[i].devices.length; j++) {
              this.options[i].children.push({ value: [this.defaultData[i].devices[j].name, this.defaultData[i].devices[j].mac], label: this.defaultData[i].devices[j].name })
              this.options[i].children.push({
                value: [
                  this.defaultData[i].devices[j].name,
                  this.defaultData[i].devices[j].mac,
                ],
                label: this.defaultData[i].devices[j].name,
              })
            }
          }
        })
@@ -227,9 +250,10 @@
        url: '/deviceInfo/getMacSensors',
        method: 'post',
        data: {
          macs: this.newMac1
        }
      }).then((res) => {
          macs: this.newMac1,
        },
      })
        .then((res) => {
        // console.log(res)
        this.newSensor = []
        var sensor = res.data
@@ -239,7 +263,8 @@
          // this.newSensor[i].value = sensor.i
          // this.newSensor[i].name = sensor[i]
        }
      }).catch((err) => {
        })
        .catch((err) => {
        console.log(err)
      })
    },
@@ -248,85 +273,115 @@
      var newLineChartData = {
        series: [],
        xAxis: [],
        title: []
        title: [],
      }
      this.newXData = []
      this.$request({ // dataDisplay/sensorComparisonDisplayV2
      this.$request({
        // dataDisplay/sensorComparisonDisplayV2
        url: '/dataDisplay/sensorComparisonDisplayV2',
        method: 'post',
        data: {
          mac: this.newMac1[0],
          sensorCodes: this.value1,
          reportType: this.unit,
          times: this.newData
        }
      }).then((res) => {
          times: this.newData,
        },
      })
        .then((res) => {
        // console.log('获得时间对应因子数据')
        console.log(res, 111)
        this.middleData = JSON.parse(JSON.stringify(res.data))
        const data = res.data
        // 无量纲算法
        // 遍历因子数组
        for (let i = 0; i < data.length; i++) {
          // 使用因子名称过滤替换方法
          data[i].name = this.$options.filters.sensorFilter(data[i].sensorCode)
          // data[i].name = data[i].sensorCode
          var tempArray = []
          for (let j = 0; j < data[i].timeValueList.length; j++) {
            tempArray.push(data[i].timeValueList[j].value)
            data[i].name = this.$options.filters.sensorFilter(
              data[i].sensorCode
            )
          }
          data[i].MaxValue = this.getMaxValue(tempArray)
          data[i].sort = i
          for (let i = 0; i < data[0].timeValueList.length; i++) {
            newLineChartData.xAxis.push(data[0].timeValueList[i].time)
        }
        // 大数组MaxValue降序方法
        data.sort(this.compare('MaxValue', false))
        // 用1除以选择因子的数量
        var step = Math.floor((1 / data.length) * 100) / 100
        data[0].Factor = 1
        // 以降序排的数组,第一个为基准值,从第二个开始计算
        for (let i = 1; i < data.length; i++) {
          // 拿到最大值
          var supposemMaxValue = data[0].MaxValue - i * step * data[0].MaxValue
          if (data[i].MaxValue < supposemMaxValue) {
            data[i].Factor = supposemMaxValue / data[i].MaxValue
          for (var i = 0; i < data.length; i++) {
             newLineChartData.series.push({ data: [], name: '', type: 'line' })
            newLineChartData.series[i].name = data[i].name
            newLineChartData.title.push(data[i].name);
            console.log(newLineChartData.series[i].name);
            for (var j = 0; j < data[i].timeValueList.length; j++) {
             newLineChartData.series[i].data.push(data[i].timeValueList[j].value)
          }
        }
        // 大数组sort升序方法
        data.sort(this.compare('sort', true))
        // 给折线图数据添加遍历
          this.lineChartData = newLineChartData
        
          // this.middleData = JSON.parse(JSON.stringify(res.data))
          // const data = res.data
          // // 无量纲算法
          // // 遍历因子数组
          // for (let i = 0; i < data.length; i++) {
          //   // 使用因子名称过滤替换方法
          //   data[i].name = this.$options.filters.sensorFilter(
          //     data[i].sensorCode
          //   )
          //   // data[i].name = data[i].sensorCode
          //   var tempArray = []
          //   for (let j = 0; j < data[i].timeValueList.length; j++) {
          //     tempArray.push(data[i].timeValueList[j].value)
          //   }
          //   data[i].MaxValue = this.getMaxValue(tempArray)
          //   data[i].sort = i
          // }
          // // 大数组MaxValue降序方法
          // data.sort(this.compare('MaxValue', false))
          // // 用1除以选择因子的数量
          // var step = Math.floor((1 / data.length) * 100) / 100
          // data[0].Factor = 1
          // // 以降序排的数组,第一个为基准值,从第二个开始计算
          // for (let i = 1; i < data.length; i++) {
          //   // 拿到最大值
          //   var supposemMaxValue =
          //     data[0].MaxValue - i * step * data[0].MaxValue
          //   if (data[i].MaxValue < supposemMaxValue) {
          //     data[i].Factor = supposemMaxValue / data[i].MaxValue
          //   }
          // }
          // // 大数组sort升序方法
          // data.sort(this.compare('sort', true))
          // // 给折线图数据添加遍历
          // // for (let i = 0; i < data.length; i++) {
          // //   newLineChartData.series.push({ data: [], name: '', type: 'line' })
          // //   newLineChartData.series[i].name = data[i].name
          // //   newLineChartData.title.push(data[i].name)
          // //   for (let j = 0; j < data[i].timeValueList.length; j++) {
          // //     data[i].timeValueList[j].value = data[i].timeValueList[j].value * data[i].Factor
          // //     newLineChartData.series[i].data.push(data[i].timeValueList[j].value)
          // //   }
          // // }
        // for (let i = 0; i < data.length; i++) {
        //   newLineChartData.series.push({ data: [], name: '', type: 'line' })
        //   newLineChartData.series[i].name = data[i].name
        //   newLineChartData.title.push(data[i].name)
        //   for (let j = 0; j < data[i].timeValueList.length; j++) {
        //     data[i].timeValueList[j].value = data[i].timeValueList[j].value * data[i].Factor
        //     newLineChartData.series[i].data.push(data[i].timeValueList[j].value)
          //     // console.log(data);
          //     data[i].timeValueList[j].value =
          //       data[i].timeValueList[j].value * data[i].Factor
          //     newLineChartData.series[i].data.push({ value: 0, data0: 0 })
          //     newLineChartData.series[i].data[j].value =
          //       data[i].timeValueList[j].value
        //   }
        // }
        for (let i = 0; i < data.length; i++) {
          newLineChartData.series.push({ data: [], name: '', type: 'line' })
          newLineChartData.series[i].name = data[i].name
          newLineChartData.title.push(data[i].name)
          for (let j = 0; j < data[i].timeValueList.length; j++) {
            // console.log(data);
            data[i].timeValueList[j].value = data[i].timeValueList[j].value * data[i].Factor
            newLineChartData.series[i].data.push({ value: 0, data0: 0 })
            newLineChartData.series[i].data[j].value = data[i].timeValueList[j].value
          }
        }
        for (let i = 0; i < data[0].timeValueList.length; i++) {
          newLineChartData.xAxis.push(data[0].timeValueList[i].time)
        }
        // 给图表tooltip赋值原始数据
        for (let i = 0; i < this.middleData.length; i++) {
          for (let j = 0; j < this.middleData[i].timeValueList.length; j++) {
            newLineChartData.series[i].data[j].data0 = this.middleData[i].timeValueList[j].value
          }
        }
        this.lineChartData = newLineChartData
          // for (let i = 0; i < data[0].timeValueList.length; i++) {
          //   newLineChartData.xAxis.push(data[0].timeValueList[i].time)
          // }
          // // 给图表tooltip赋值原始数据
          // for (let i = 0; i < this.middleData.length; i++) {
          //   console.log(i);
          //   for (let j = 0; j < this.middleData[i].timeValueList.length; j++) {
          //     newLineChartData.series[i].data[j].data0 =
          //       this.middleData[i].timeValueList[j].value
          //   }
          // }
          // this.lineChartData = newLineChartData
        // console.log(newLineChartData.series[0].name);
      }).catch((err) => {
        })
        .catch((err) => {
        console.log(err)
      })
    },
@@ -435,9 +490,11 @@
    },
    // 过滤图表因子名称
    filterSensorName() {
      this.chartSensorName = this.$options.filters.sensorFilter(this.chartSensorKey[0].sensorCode)
    }
  } // 如果页面有keep-alive缓存功能,这个函数会触发
      this.chartSensorName = this.$options.filters.sensorFilter(
        this.chartSensorKey[0].sensorCode
      )
    },
  }, // 如果页面有keep-alive缓存功能,这个函数会触发
}
</script>
<style scoped lang="scss">
@@ -465,9 +522,9 @@
  height: 40px;
}
.select11{
  width: 20% !important
  width: 20% !important;
}
/deep/.el-date-editor .el-range-separator{
  width: 11%
  width: 11%;
}
</style>