guoshipeng
2023-07-14 c35aa34b96200a2bbacbc4697fa260f427acd4bd
src/views/UVA/index.vue
@@ -21,7 +21,7 @@
                  margin-left: 10px;
                "
                >无人机飞行日期</span
              >zzzz
              >
            </div>
          </div>
          <el-scrollbar
@@ -142,6 +142,13 @@
            <el-radio-button label="03"></el-radio-button>
            <el-radio-button label="TVOC"></el-radio-button>
          </el-radio-group>
          <el-input
            placeholder="请输入内容"
            v-model="uvasize"
            class="inputNum"
            clearable
          >
          </el-input>
        </div>
        <div v-if="noneData" class="noneData">当前时间没有飞行数据</div>
        <div id="map_container" v-loading="loading" />
@@ -551,6 +558,92 @@
      firstPlayFlag: true,
      firstWsFlag: true,
      msgTemp: [],
      luvalue: {
        nnn: [
          // {
          //   value:
          //     '{"flylon":"123.43845599999999 °","flylat":"41.69658300039269 °","a34004":"8 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69568400039269 °","a34004":"7 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69523400039269 °","a34004":"6 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69478400039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69433500039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69388500039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.692986000392686 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69343500039268 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69478400039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69523400039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69568400039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69568400039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43905875000087 °","flylat":"41.69658300039335 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.69253600039269 °","a34004":"65 mg/m³"}',
          // },
          // {
          //   value:
          //     '{"flylon":"123.43725199999999 °","flylat":"41.692986000392686 °","a34004":"65 mg/m³"}',
          // },
          {
            value:
              '{"flylon":"123.4369507 °","flylat":"41.6968079 °","a34004":"65 mg/m³"}',
          },
          {
            value:
              '{"flylon":"123.4369507 °","flylat":"41.6991119 °","a34004":"65 mg/m³"}',
          },
          {
            value:
              '{"flylon":"123.431427 °","flylat":"41.6968079 °","a34004":"65 mg/m³"}',
          },
          {
            value:
              '{"flylon":"123.431427 °","flylat":"41.6991119 °","a34004":"65 mg/m³"}',
          },
          {
            value:
              '{"flylon":"123.4334869 °","flylat":"41.6990967 °","a34004":"70 mg/m³"}',
          },
        ],
        nums: 5,
      },
      dataTypeList: [
        {
          value: 'history',
@@ -573,6 +666,7 @@
      endTime: '',
      dataDate: '',
      sensorTime: [],
      uvasize: 50,
      timeValue: [
        new Date(2020, 1, 1, 0, 0, 0),
        new Date(2022, 12, 31, 23, 59, 59),
@@ -612,6 +706,20 @@
    this.getDate()
    // this.$watch('carMac', () => {
    // })
    // var c = {}
    // var cc = []
    // for (var i = 0; i < this.luvalue.nnn.length; i++) {
    //   this.luvalue.nnn[i].value = JSON.parse(this.luvalue.nnn[i].value)
    //   cc.push(this.luvalue.nnn[i].value)
    //   console.log(cc)
    //   for (let item of cc) {
    //     console.log(item)
    //   }
    // for (var j = 0; j < this.luvalue.nnn[i].value.length; j++) {
    //   console.log(j)
    //   console.log(parseFloat(this.luvalue.nnn[i].value.flylat))
    // c.push(parseFloat(this.luvalue.nnn[i].value[j].flylat)+0.00048)
    // }
  },
  methods: {
    newTime2(timeArr) {
@@ -719,11 +827,11 @@
        },
      }).then((res) => {
        console.log(res.data.vos.length, 'res.data.vos')
        if(res.data.vos.length==0){
        if (res.data.vos.length == 0) {
          this.noneData = true
          this.loading = false
          return false
        }else{
        } else {
          this.asideData.uavTimeFly = res.data.vos
        }
        // if (res.code === 0) {
@@ -753,10 +861,12 @@
        this.map.clearOverlays()
      }
      this.$request({
        url: '/uav/queryDataByBatch',
        // url: '/uav/queryDataByBatch',
        url: '/uav/test',
        method: 'get',
        params: {
          batch: item.batch,
          // batch: item.batch,
          uvasize: this.uvasize,
          // batch: '2023-06-16 16:21:21',
        },
      }).then((res) => {
@@ -767,12 +877,28 @@
          this.loading = false
          return
        }
        if (res.data.vos.length) {
          for (var i = 0; i < res.data.vos.length; i++) {
            this.carData.push(JSON.parse(res.data.vos[i].value))
          }
          this.initStart(this.carData)
        for (var i = 0; i < res.data.length; i++) {
          res.data[i].flyLat = res.data[i].flyLat + ' °'.toString()
          res.data[i].flyLon = res.data[i].flyLon + ' °'.toString()
          res.data[i].a34004 = Math.floor(Math.random() * 100 + 1)
          this.carData.push(res.data[i])
        }
        this.initStart(this.carData)
        // if (res.data.vos.length) {
        //   // for (var i = 0; i < this.luvalue.nums; i++) {
        //   //   this.carData.push(JSON.parse(this.luvalue.nnn[i].value))
        //   // }
        //   //  for (var i = 0; i < res.data.vos.length; i++) {
        //   //   this.carData.push(JSON.parse(res.data.vos[i].value))
        //   // }
        //   // this.carData.push(
        //   //   JSON.parse(
        //   //     '{"flylon":"123.516289 °","flylat":"41.738213 °","a21005":"0.045 mg/m³","a21004":"39 ug/m³","a21026":"8 ug/m³","flyhig":"1.4 m","a34002":"86 ug/m³","a99054":"0.008 mg/m³","a05024":"51 ug/m³","a34004":"64 ug/m³"}'
        //   //   )
        //   // )
        //   this.initStart(this.carData)
        // }
      })
    },
    // 获取组织下存在飞行记录的日期
@@ -800,7 +926,7 @@
      })
    },
    initStart(res) {
      // console.log(res,'res');
      console.log(res, 'res')
      this.abc += 1
      const that = this
      if (!res) {
@@ -819,14 +945,14 @@
      if (this.responseJSON.length > 0) {
        this.noneData = false
        $.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)
              value.flyLon.substr(0, value.flyLon.length - 1)
            )
            var lat = parseFloat(
              value.flylat.substr(0, value.flylat.length - 1)
              value.flyLat.substr(0, value.flyLat.length - 1)
            )
            if (lng < 70 || lng > 150 || lat > 60 || lat < 20) {
              return true
@@ -859,7 +985,7 @@
        })
        that.sensor = this.sensorKey
        that.viewType = this.viewKey
        that.size = 10
        that.size = this.uvasize
        that.distance = that.size / 2 / Math.sin((1 * Math.PI) / 4)
        // 已有地图,避免再次请求
        if (!that.showPoints) {
@@ -876,11 +1002,46 @@
        } else {
          that.map.setTilt(52)
        }
        // 使用百度地图v3.0接口,在设置地图
        that.map.setMapStyleV2({
          styleJson: [
            {
              featureType: 'road',
              elementType: 'all',
              stylers: {
                color: '#ffffff',
                visibility: 'off',
              },
            },
            {
              featureType: 'building',
              elementType: 'all',
              stylers: {
                visibility: 'off',
              },
            },
            {
              featureType: 'poilabel',
              elementType: 'all',
              stylers: {
                visibility: 'off',
              },
            },
            {
              featureType: 'manmade',
              elementType: 'all',
              stylers: {
                visibility: 'off',
              },
            },
          ],
        })
        // that.map.setDisplayOptions({
        //   // 设置天空颜色
        //   skyColors: ['rgba(186, 0, 255, 0)', 'rgba(186, 0, 255, 0.2)'], // 天空颜色
        //   building: false, // 不显示建筑物
        //   poiText: true, // 显示poi文字
        //   // skyColors: ['rgba(186, 0, 255, 0)', 'rgba(186, 0, 255, 0.2)'], // 天空颜色
        //   building: true, // 不显示建筑物
        //   poiText: false, // 显示poi文字
        // })
        // that.map.addControl(new BMapGL.NavigationControl3D()) // 添加3d控件
        if (this.responseJSON.length === 0) {
@@ -888,9 +1049,9 @@
        }
        that.showPoints = getShowPoints(that.size)
        that.viewport = that.map.getViewport(eval(that.showPoints))
        console.log(eval(that.showPoints), 'eval(that.showPoints)') // 此方法仅返回视野信息(中心点坐标,缩放),不会将新的中心点和级别做用到当前地图上
        // console.log(eval(that.showPoints), 'eval(that.showPoints)') // 此方法仅返回视野信息(中心点坐标,缩放),不会将新的中心点和级别做用到当前地图上
        that.mapZoom = that.viewport.zoom
        console.log(that.mapZoom, 'that.mapZoom')
        // console.log(that.mapZoom, 'that.mapZoom')
        that.centerPoint = that.viewport.center
        if (that.firstPlayFlag) {
          console.log(that.mapZoom, that.centerPoint, '1')
@@ -957,10 +1118,12 @@
              new BMapGL.Point(sw.lng, ne.lat), // 右下角
            ],
            {
              strokeWeight: 0.5,
              strokeOpacity: 0.0,
              fillColor: color,
              fillOpacity: 1,
              strokeWeight: 0.1, //边框线的宽度,以像素为单位
              // strokeOpacity: 0.0, //边线的透明度
              fillColor: color, //是否需要填充色
              fillOpacity: 0.8, //填充色的透明度,0~1之间
              strokeColor: 'black', //边框线的颜色
              strokeStyle: 'solid', //边线的样式,solid或dashed。
            }
          )
          that.map.addOverlay(polygon)
@@ -1035,10 +1198,11 @@
              flag = false
            }
          }
          if (flag) {
            points.push(point1)
            console.log(points,'points');
          }
          points.push(point1)
          // if (flag) {
          //   points.push(point1)
          //   console.log(points, 'points')
          // }
        }
        return points
      }
@@ -1686,5 +1850,7 @@
  font-size: 14px;
  font-family: '微软雅黑';
}
</style>
/deep/.inputNum {
  width: 5% !important;
}
</style>