quanyawei
2024-06-18 6b7604951f61b7033cc643afe0e4ca67565a1a36
src/views/UVA/index.vue
@@ -3,74 +3,51 @@
    <el-container style="height: 100%">
      <el-aside
        width="300px"
        style="background-color: rgb(238, 241, 246); overflow-y: hidden"
        style="background-color: rgb(238, 241, 246); overflow: hidden"
      >
        <el-card class="box-card" style="width: 274px; margin: 13px auto">
          <div slot="header" class="clearfix">
            <div>
              <img
                style="float: left; width: 20px; margin: 15px 0 0 18px"
                src="../../assets/images/uav/calendar.png"
                alt=""
              />
              <span
                style="
                  display: inline-block;
                  float: left;
                  font-size: 16px;
                  margin-left: 10px;
                "
                >无人机飞行日期</span
              >
            </div>
          </div>
          <el-scrollbar
            v-if="asideData.dates.length > 0"
            style="height: 200px; overflow-x: hidden"
            class="text item"
          >
            <div
              v-for="(item, index) in asideData.dates"
              class="per-date"
              :class="{ active: asideData.activeKey === index }"
              @click="getTimeAreaData(item, index)"
              :key="index"
            >
              <img
                style="float: left; width: 14px; margin: 18px 0 0 0"
                src="../../assets/images/uav/calendar.png"
                alt=""
              />
              <span
                style="
                  display: inline-block;
                  float: left;
                  font-size: 14px;
                  margin-left: 15px;
                "
                >{{ item }}</span
              >
            </div>
          </el-scrollbar>
          <div v-else style="height: 180px; width: 274px; overflow-x: hidden">
            <div
              style="
                width: 272px;
                text-align: center;
                height: 180px;
                line-height: 140px;
                font-size: 14px;
                color: #5a5c60;
              "
            >
              无飞行记录
            </div>
          </div>
        </el-card>
        <div style="width: 274px; margin: 13px auto; border-radius: 8px">
        <div style="width: 274px; margin: 13px auto">
          <el-date-picker
            ref="datePick"
            v-model="datenum"
            :picker-options="pickerOptions"
            placeholder="选择日期"
            popper-class="jlpMySelectPopper"
            value-format="yyyy-MM-dd"
            style="width: 280px"
            @change="chooseDate"
            @blur="chooseDate1"
            @focus="chooseDate2"
          />
        </div>
        <div
          style="width: 274px; margin: 10px auto; border-radius: 8px"
          class="coll"
        >
          <!--accordion 手风琴模式-->
          <el-collapse
            v-show="shou1 === true"
            v-loading="loading"
          >
            <el-collapse-item
              style="text-indent: 2em; position: relative; padding-botton: 10px"
            >
              <template slot="title">
                <img
                  style="position: absolute; left: 18px"
                  src="../../assets/images/uav/uav.png"
                >
                <span
                  style="display: inline-block; position: absolute; left: 20px"
                >
                  该日期暂无无人机数据</span>
              </template>
            </el-collapse-item>
          </el-collapse>
          <el-collapse
            v-show="shou1 === false"
            ref="collapse"
            v-model="asideData.activeNames"
            v-loading="loading"
            accordion
            style="box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)"
            @change="handleChange"
@@ -79,26 +56,25 @@
              v-for="(item1, index) in asideData.uavTimeFly"
              :key="index"
              :name="index"
              style="text-indent: 2em; position: relative"
              style="text-indent: 2em; position: relative; padding-botton: 10px"
            >
              <template slot="title">
                <img
                  style="position: absolute; left: 18px"
                  src="../../assets/images/uav/uav.png"
                />
                >
                <span
                  style="display: inline-block; position: absolute; left: 20px"
                >
                  {{ item1.name }}</span
                >
                  {{ item1.name }}</span>
              </template>
              <el-scrollbar style="height: 200px; overflow-x: hidden">
                <div
                  v-for="(item, index) in item1.timeSlot"
                  :key="index"
                  class="per-date_area"
                  :class="{ activeArea: asideData.activeAreaKey === index }"
                  @click="getFlyData(item, index)"
                  :class="{ activeArea: asideData.activeKey === index }"
                  @click="getFlyData(item, index, item1.mac)"
                >
                  <div style="width: 100%; margin: 0 auto">
                    <span>{{
@@ -108,6 +84,7 @@
                    <span>{{
                      item.endTime.substr(11, item.startTime.length)
                    }}</span>
                    <span> ({{ item.total }}条) </span>
                  </div>
                </div>
              </el-scrollbar>
@@ -121,32 +98,312 @@
            position: fixed;
            z-index: 20;
            padding-left: 20px;
            height: 75px;
            line-height: 80px;
            height: 100px;
            width: 100%;
            font-size: 18px;
            font-weight: bold;
            background-color: rgba(192, 192, 192, 0.4);
          "
          class="dds"
        >
          <el-radio-group
            v-model="radioSeven"
            size="medium"
            @change="changeCode"
          >
            <el-radio-button label="PM2.5"></el-radio-button>
            <el-radio-button label="PM10"></el-radio-button>
            <el-radio-button label="SO2"></el-radio-button>
            <el-radio-button label="NO2"></el-radio-button>
            <el-radio-button label="CO"></el-radio-button>
            <el-radio-button label="03"></el-radio-button>
            <el-radio-button label="TVOC"></el-radio-button>
          </el-radio-group>
          <div class="numss">
            <el-radio-group
              v-if="selecttrue === 1"
              v-model="radioSeven"
              size="medium"
              style="margin-top: 10px; margin-left: 10px"
              @change="changeCode"
            >
              <el-radio-button label="PM2.5" />
              <el-radio-button label="PM10" />
              <el-radio-button label="SO2" />
              <el-radio-button label="NO2" />
              <el-radio-button label="CO" />
              <el-radio-button label="03" />
              <el-radio-button label="TVOC" />
            </el-radio-group>
            <div
              v-if="selecttrue === 2"
              class="Duo"
            >
              <div class="spantuu">
                <span>无人机飞行高度范围(米): </span>
                <el-input
                  ref="uvas"
                  v-model="tallone"
                  class="inputtu"
                />
                --
                <el-input
                  ref="uvas"
                  v-model="talltwo"
                  class="inputtu"
                />
              </div>
              <!-- <el-select v-model="Duovalue" placeholder="其他因子" class="slee">
                <el-option
                  v-for="item in optionsduo"
                  :key="item.code"
                  :label="item.name"
                  :value="item.name"
                >
                </el-option>
              </el-select> -->
              <div class="spantu">
                <span>图形边长(米): </span><el-input
                  ref="uvas"
                  v-model="uvasize"
                  class="inputtu"
                  clearable
                  placeholder="请输入内容"
                />
              </div>
              <el-select
                v-model="Duovalue"
                placeholder="其他因子"
                class="slee"
              >
                <el-option
                  v-for="item in optionsduo"
                  :key="item.code"
                  :label="item.name"
                  :value="item.name"
                />
              </el-select>
              <!-- <div class="spantuu">
                <span>无人机飞行高度范围(米): </span>
                <el-input
                  class="inputtu"
                  v-model="tallone"
                  ref="uvas"
                ></el-input>
                --
                <el-input
                  class="inputtu"
                  v-model="talltwo"
                  ref="uvas"
                ></el-input>
              </div> -->
            </div>
            <div
              v-if="selecttrue === 1"
              style="margin-left: 10px"
            >
              <el-button
                type="primary"
                style="margin-top: 10px"
                @click="gengD"
              >
                更多条件
              </el-button>
            </div>
            <div
              v-if="selecttrue === 2"
              style="margin-left: 10px; margin-top: 10px"
            >
              <el-button
                size="medium"
                type="primary"
                icon="el-icon-setting"
                @click="dialogFormVisible = true"
              >
                6参设定
              </el-button>
              <el-button
                class="gengD"
                @click="shou"
              >
                收起
              </el-button>
              <el-button
                type="primary"
                @click="selectDuo"
              >
                查询
              </el-button>
            </div>
          </div>
          <!-- <div class="Duo" v-if="selecttrue === 2">
            <el-select v-model="Duovalue" placeholder="其他因子" class="slee">
              <el-option
                v-for="item in optionsduo"
                :key="item.code"
                :label="item.name"
                :value="item.name"
              >
              </el-option>
            </el-select>
            <div class="spantu">
              <span>图形边长(米): </span
              ><el-input
                class="inputtu"
                v-model="uvasize"
                clearable
                placeholder="请输入内容"
                ref="uvas"
              ></el-input>
            </div>
            <div class="spantuu">
              <span>无人机飞行高度范围(米): </span>
              <el-input class="inputtu" v-model="tallone" ref="uvas"></el-input>
              --
              <el-input class="inputtu" v-model="talltwo" ref="uvas"></el-input>
            </div>
          </div> -->
        </div>
        <div v-if="noneData" class="noneData">当前时间没有飞行数据</div>
        <div id="map_container" v-loading="loading" />
        <!-- <div v-if="noneData" class="noneData">当前时间没有飞行数据</div> -->
        <div
          id="map_container"
          v-loading="loading1"
        />
        <div class="dataParameter">
          <dir class="item">
            <div
              v-for="(item, index) in temMergeDataList"
              v-show="index < 3"
              :key="index"
            >
              <p> {{ item.name }}:{{ item.value }}</p>
            </div>
          </dir>
          <div
            class="item1"
            style="margin-left: 10px;"
          >
            <div
              v-for="(item, index) in temMergeDataList"
              v-show="index > 2"
              :key="index"
            >
              <p> {{ item.name }}:{{ item.value }}</p>
            </div>
          </div>
        </div>
      </el-main>
    </el-container>
    <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="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>
        <el-descriptions-item label="CO | mg/m³">
          0.5
        </el-descriptions-item>
        <el-descriptions-item label="O3 | ug/m³">
          149
        </el-descriptions-item>
      </el-descriptions>
      <!-- <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>
      <el-table
        :data="sensorTableData"
        border
      >
        <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="请输入内容"
            />
            <!-- <span v-show="!scope.row.show">{{ scope.row.tab1 }}</span> -->
          </template>
        </el-table-column>
        <el-table-column label="二级">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.tab2"
              placeholder="请输入内容"
            />
          </template>
        </el-table-column>
        <el-table-column label="三级">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.tab3"
              placeholder="请输入内容"
            />
          </template>
        </el-table-column>
        <el-table-column label="四级">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.tab4"
              placeholder="请输入内容"
            />
          </template>
        </el-table-column>
        <el-table-column label="五级">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.tab5"
              placeholder="请输入内容"
            />
          </template>
        </el-table-column>
        <el-table-column label="六级">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.tab6"
              placeholder="请输入内容"
            />
          </template>
        </el-table-column>
      </el-table>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="dialogFormVisible = false">
          取 消
        </el-button>
        <el-button
          type="primary"
          @click="customLevel"
        >
          确 定
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>
@@ -154,6 +411,7 @@
import json from '@/assets/json/sensor.json'
import $ from 'jquery'
import '@/assets/icon/iconfont.css'
import moment from 'moment'
var GPS = {
  PI: 3.14159265358979324,
@@ -213,12 +471,20 @@
        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
      if (++i > 10000) {
        break
      }
    }
    return { lat: wgsLat, lon: wgsLon }
  },
@@ -272,8 +538,12 @@
    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
    if (s > 1) {
      s = 1
    }
    if (s < -1) {
      s = -1
    }
    var alpha = Math.acos(s)
    var distance = alpha * earthR
    return distance
@@ -339,18 +609,40 @@
export default {
  filters: {
    sensorFilter: function (value) {
      if (!value) return ''
      if (!value) {
        return ''
      }
      return json[value]
    },
  },
  data() {
  data () {
    return {
      dialogFormVisible: false,
      chosee: 1,
      shou1: true,
      zhanK1: 1,
      zhanK: 1,
      Duovalue: '',
      datenum: new Date(),
      // orderTime:[Date('2020-06-19'),Date('2021-06-19')]
      selecttrue: 1,
      pickerOptions: {
        cellClassName: (time) => {
          const timeDate = moment(time.getTime()).format('yyyy-MM-DD')
          if (this.timeNums.includes(timeDate)) {
            return 'dateArrClass' // 返回值设置的是我们添加的类名
          }
        },
      },
      tallone: 0,
      talltwo: 120,
      // 侧边栏数据
      asideData: {
        dates: [], // 存放date数组
        activeNames: [0],
        uavTimeFly: [], // 存放无人机信息以及飞行时间区间
        activeKey: 0,
        activeKey: -1,
        activeAreaKey: 0,
      },
      load: 1,
@@ -365,6 +657,7 @@
        { code: 'a05024', name: 'O3' },
        { code: 'a99054', name: 'TVOC' },
      ],
      valuetime: '2023-01-01',
      defautRadio: { code: 'a34004', name: 'PM2.5' },
      Layler: null, // 存放图层
      textMarkers: { code: '', markers: [] }, // 存放文本标注
@@ -377,7 +670,8 @@
      radioSeven: 'PM2.5',
      bdLon: null,
      bdLat: null,
      loading: true,
      loading: false,
      loading1: false,
      snesorParams: [
        'PM2.5',
        'PM10',
@@ -397,42 +691,15 @@
      radio1: null,
      viewOptions: ['平铺', '立体'],
      dateValue: [],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        },
        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 = ''
          if (maxDate) {
            this.timeOne = ''
          }
        },
        disabledDate: (time) => {
          if (this.timeOne) {
@@ -450,10 +717,30 @@
        },
      },
      sensorDate: null,
      noneData: false,
      noneData: true,
      defaultData: [],
      carMac: null,
      dialogFormVisible: false,
      optionsduo: [
        { code: 'a34004', name: 'PM2.5' },
        { code: 'a34002', name: 'PM10' },
        { code: 'a21026', name: 'SO2' },
        { code: 'a21004', name: 'NO2' },
        { code: 'a21005', name: 'CO' },
        { code: 'a05024', name: 'O3' },
        { code: 'a99054', name: 'TVOC' },
        {
          code: 'a01006',
          name: '气压',
        },
        {
          code: 'a01001',
          name: '温度',
        },
        {
          code: 'a01002',
          name: '湿度',
        },
      ],
      sensorTableData: [
        {
          sensorName: 'PM2.5',
@@ -535,6 +822,19 @@
          tab5: '20000',
          tab6: '50000',
        },
        {
          sensorName: '气压',
          unit: 'hpa',
        },
        {
          sensorName: '湿度',
          unit: '%',
        },
        {
          sensorName: '温度',
          unit: '℃',
        },
      ],
      carWs: null,
      map: null,
@@ -573,18 +873,101 @@
      endTime: '',
      dataDate: '',
      sensorTime: [],
      uvasize: 20,
      timeValue: [
        new Date(2020, 1, 1, 0, 0, 0),
        new Date(2022, 12, 31, 23, 59, 59),
      ],
      timeNums: [],
      batchs: '',
      macs: '',
      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: '150',
          tab2: '500',
          tab3: '650',
          tab4: '800',
          tab5: '',
          tab6: '',
        },
        {
          sensorName: 'NO2',
          unit: 'ug/m³',
          tab1: '100',
          tab2: '200',
          tab3: '700',
          tab4: '1200',
          tab5: '2340',
          tab6: '3090',
        },
        {
          sensorName: 'CO',
          unit: 'mg/m³',
          tab1: '5',
          tab2: '10',
          tab3: '35',
          tab4: '60',
          tab5: '90',
          tab6: '120',
        },
        {
          sensorName: 'O3',
          unit: 'ug/m³',
          tab1: '160',
          tab2: '200',
          tab3: '300',
          tab4: '400',
          tab5: '800',
          tab6: '1000',
        },
        {
          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',
        },
      ],
      temMergeDataList: []
    }
  },
  mounted() {
    // this.getDate()
    // this.flyData()
  },
  watch: {
    dataTypeValue(n, o) {
    dataTypeValue (n, o) {
      if (this.dataTypeValue === 'webSocket') {
        this.dateValue = []
        this.historyView = false
@@ -595,26 +978,152 @@
        this.webSocketView = false
      }
    },
    dateValue(n, o) {
    dateValue (n, o) {
      if (n === null) {
        this.dateValue = []
      }
    },
    viewKey(n, o) {
    viewKey (n, o) {
      // console.log(n)
    },
    deep: true,
    immediate: true,
  },
  created() {
  mounted () {
    this.$nextTick(() => {
      this.initStart()
    })
    // this.$refs.datePick.focus()
    // this.getDate()
    // this.flyData()
  },
  created () {
    this.newTime(this.timeValue)
    this.newDate()
    this.getDate()
    // this.$watch('carMac', () => {
    // })
    // this.getFlyData()
  },
  methods: {
    newTime2(timeArr) {
    customLevel () {
      this.selectDuo()
      this.dialogFormVisible = false
    },
    selectDuo () {
      // console.log(2115);
      if (this.chosee === 1) {
        this.$message.warning('请先在左侧选择无人机时间')
        return
      } else {
        // console.log('132123');
        this.loading1 = true
      }
      if (this.view) {
        this.view.removeAllLayers()
        this.map.clearOverlays()
      }
      this.$request({
        // url: '/uav/queryDataByBatch',
        url: '/uav/getUav',
        // url: '/uav/test',
        method: 'post',
        data: {
          batch: this.batchs,
          uvasize: this.uvasize,
          mac: this.macs,
          height1: this.tallone,
          height2: this.talltwo,
          // batch: '2023-06-16 16:21:21',
        },
      }).then((res) => {
        // console.log(res)
        this.carData = []
        if (res.data === 'null') {
          this.noneData = true
          return
        }
        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])
        }
        if (this.Duovalue != '') {
          this.radioSeven = ''
        }
        this.changeCode(this.Duovalue)
        this.initStart(this.carData)
      })
    },
    chooseDate () {
      // this.$refs.datePick.focus() // 选择日期后依旧触发焦点
      this.getTimeAreaData(this.datenum)
      $('.coll').css('margin-top', '350px')
    },
    chooseDate2 () {
      // this.$refs.datePick.focus() // 选择日期后依旧触发焦点
      // this.getTimeAreaData(this.datenum)
      $('.coll').css('margin-top', '350px')
    },
    chooseDate1 () {
      $('.coll').css('margin-top', '10px')
      // this.$refs.datePick.focus() // 选择日期后依旧触发焦点
    },
    gengD () {
      // if (this.zhanK === 1) {
      //   this.$message.warning('请先在左侧选择无人机和时间')
      //   return
      // }
      this.selecttrue = 2
      $('.numss').css({ width: '1050px' })
    },
    shou () {
      this.selecttrue = 1
      $('.numss').css({ width: '700px' })
    },
    parseTime (time, cFormat) {
      if (arguments.length === 0 || !time) {
        return null
      }
      const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
      let date
      if (typeof time === 'object') {
        date = time
      } else {
        if (typeof time === 'string') {
          if (/^[0-9]+$/.test(time)) {
            time = parseInt(time)
          } else {
            time = time.replace(new RegExp(/-/gm), '/')
          }
        }
        if (typeof time === 'number' && time.toString().length === 10) {
          time = time * 1000
        }
        date = new Date(time)
      }
      const formatObj = {
        y: date.getFullYear(),
        m: date.getMonth() + 1,
        d: date.getDate(),
        h: date.getHours(),
        i: date.getMinutes(),
        s: date.getSeconds(),
        a: date.getDay(),
      }
      const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
        const value = formatObj[key]
        if (key === 'a') {
          return ['日', '一', '二', '三', '四', '五', '六'][value]
        }
        return value.toString().padStart(2, '0')
      })
      return time_str
    },
    newTime2 (timeArr) {
      var arr = []
      timeArr.map((v) => {
        var date = new Date(v)
@@ -633,18 +1142,12 @@
      })
      return arr
    },
    // 点击列表切换走航车数据
    changeCarData(e) {
      this.carMac = e
      this.getStart()
    },
    // 请求走航车列表数据
    // 进行经纬度转换为距离的计算
    Rad(d) {
    Rad (d) {
      return (d * Math.PI) / 180.0 // 经纬度转换成三角函数中度分表形式。
    },
    // 计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
    GetDistance(lat1, lng1, lat2, lng2) {
    GetDistance (lat1, lng1, lat2, lng2) {
      var radLat1 = this.Rad(lat1)
      var radLat2 = this.Rad(lat2)
      var a = radLat1 - radLat2
@@ -665,7 +1168,7 @@
      return s
    },
    // 日期格式化
    newDate() {
    newDate () {
      var aData = new Date()
      var month =
        aData.getMonth() < 9
@@ -675,7 +1178,7 @@
      this.sensorDate = aData.getFullYear() + '-' + month + '-' + date
    },
    // 时间格式化
    newTime(timeArr) {
    newTime (timeArr) {
      let str = ''
      let str2 = ''
      this.sensorTime = []
@@ -691,7 +1194,7 @@
      })
    },
    // 修改时间
    dateChange(e) {
    dateChange (e) {
      if (e === null) {
        this.sensorDate = []
      } else {
@@ -703,13 +1206,12 @@
        }
        this.dataType = 'history'
        // this.map = null
        this.getStart()
      }
    },
    // 获取无人机以及时间区间
    getTimeAreaData(item, index) {
      this.asideData.activeAreaKey = -1
      this.asideData.activeKey = index
    getTimeAreaData (item) {
      // this.asideData.uavTimeFly = []
      this.loading = true
      this.$request({
        url: 'uav/queryTimeSlot',
        method: 'get',
@@ -718,65 +1220,84 @@
          date: item,
        },
      }).then((res) => {
        console.log(res.data.vos.length, 'res.data.vos')
        if(res.data.vos.length==0){
        // console.log(res, 'res.data.vos')
        if (res.code === -47) {
          this.noneData = true
          this.loading = false
          return false
        }else{
          // this.asideData.uavTimeFly=res.message
          this.shou1 = true
        } else {
          this.shou1 = false
          this.asideData.uavTimeFly = res.data.vos
        }
        this.loading = false
        // if (res.code === 0) {
        //   this.asideData.uavTimeFly = res.data.vos
        // }
      })
    },
    // 折叠面板监听
    handleChange(val) {
    handleChange (val) {
      // console.log(val, 222)
    },
    // 经纬度转换为三维坐标系下的 XY 坐标 map.lngLatToGeodeticCoord
    // 选中radio
    selectRedio(item) {
    selectRedio (item) {
      this.map.remove(this.textMarkers.markers)
      this.textMarkers.markers = []
      this.map.remove(this.Layler)
      this.addLayers(item)
    },
    // 初始化地图
    getFlyData(item, index) {
      console.log(index, 'index')
      console.log(item.batch)
    getFlyData (item, index, mac) {
      // for (var i = 0; i < this.xie.date.length; i++) {
      //   this.xie.date[i].flyLat = this.xie.date[i].flyLat + ' °'.toString()
      //   this.xie.date[i].flyLon = this.xie.date[i].flyLon + ' °'.toString()
      //   this.xie.date[i].a34004 = this.xie.date[i].a34004
      //   this.carData.push(this.xie.date[i])
      // }
      // this.initStart(this.carData)
      this.loading1 = true
      this.asideData.activeKey = index
      this.chosee = 2
      this.batchs = item.batch
      this.macs = mac
      this.noneData = false
      if (this.view) {
        this.view.removeAllLayers()
        this.map.clearOverlays()
      }
      this.$request({
        url: '/uav/queryDataByBatch',
        method: 'get',
        params: {
        // url: '/uav/queryDataByBatch',
        // url: '/uav/test',
        url: '/uav/getUav',
        method: 'post',
        data: {
          batch: item.batch,
          uvasize: this.uvasize,
          height1: this.tallone,
          height2: this.talltwo,
          mac: mac,
          // batch: '2023-06-16 16:21:21',
        },
      }).then((res) => {
        console.log(res)
        // console.log(res)
        this.carData = []
        if (res.data === 'null') {
          this.noneData = true
          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)
        this.zhanK = 2
      })
    },
    // 获取组织下存在飞行记录的日期
    getDate() {
    getDate () {
      this.$request({
        url: '/uav/queryDate',
        method: 'get',
@@ -785,25 +1306,100 @@
        },
      }).then((res) => {
        this.asideData.dates = JSON.parse(JSON.stringify(res.data.datesStr))
        this.timeNums = this.asideData.dates
        if (this.asideData.dates.length > 0) {
          this.getTimeAreaData(this.asideData.dates[0], 0)
          setTimeout(() => {
            if (this.asideData.uavTimeFly[0].timeSlot) {
              // console.log(
              //   this.asideData.uavTimeFly[0].timeSlot,
              //   'this.asideData.uavTimeFly[0].timeSlot[0]'
              // )
              this.getFlyData(this.asideData.uavTimeFly[0].timeSlot[0], 0)
            }
          }, 500)
          this.getTimeAreaData(this.datenum, 0)
          // this.datenum = this.asideData.dates[0]
          // setTimeout(() => {
          //   if (this.asideData.uavTimeFly[0].timeSlot) {
          //     console.log(
          //       this.asideData.uavTimeFly[0].timeSlot,
          //       'this.asideData.uavTimeFly[0].timeSlot'
          //     )
          //     // console.log(
          //     //   this.asideData.uavTimeFly[0].timeSlot,
          //     //   'this.asideData.uavTimeFly[0].timeSlot[0]'
          //     // )
          //     this.getFlyData(this.asideData.uavTimeFly[0].timeSlot[0], 0, mac)
          //   }
          // }, 500)
        }
      })
    },
    initStart(res) {
      // console.log(res,'res');
    initDataParams (res) {
      let options = {TemMergeAvg: '合并范围均值', TemMergedHighest: '合并范围最高值', TemMergedLowest: '合并范围最低值', TemNotMergedAvg: '未合并范围均值', TemNotMergedHighest: '未合并范围最高值', TemNotMergedLowest: '未合并范围最低值'}
      let optionKeys = Object.keys(options)
      this.temMergeDataList = optionKeys.reduce((acc, key) => {
        // 使用正则表达式匹配data对象的键
        let regex = new RegExp(key, 'i')
        let matchedDataKey = Object.keys(res).find(k => regex.test(k))
        if (matchedDataKey) {
          acc.push({
            name: options[key],
            value: res[matchedDataKey]
          })
        }
        return acc
      }, [])
      console.log(this.temMergeDataList)
    },
    initStart (res) {
      console.log('res', res)
      this.abc += 1
      const that = this
      if (res) this.initDataParams(res[0])
      if (!res) {
        that.map = new BMapGL.Map('map_container')
        console.log('BMapGL', BMapGL)
        console.log('BMapGL', BMapGL)
        console.log('window', window.BMapGL)
        that.map.enableScrollWheelZoom(true) // 开启鼠标滚轮,地图可以进行放大、缩小s
        that.map.setMapType(BMAP_EARTH_MAP) // 设置地图类型为地球模式
        that.map.setDisplayOptions({
          street: false, // 是否显示路网(只对卫星图和地球模式有效)
        })
        that.map.setHeading(0) // 设置旋转角度
        if (that.viewKey === '2D') {
          that.map.setTilt(0) // 地图倾斜
        } else {
          that.map.setTilt(52)
        }
        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',
              },
            },
          ],
        })
        showNoPoints()
        this.loading1 = false
        return
      }
      if (this.dataType === 'history') {
@@ -815,98 +1411,96 @@
      // console.log('这是snesor获取得值')
      // console.log(this.responseJSON)
      var trackPoints = []
      this.loading = false
      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
            }
            lng = GPS.gcj_encrypt(lat, lng).lon
            lat = GPS.gcj_encrypt(lat, lng).lat
            lng = GPS.bd_encrypt(lat, lng).lon
            lat = GPS.bd_encrypt(lat, lng).lat
            // lng = GPS.gcj_encrypt(lat, lng).lon
            // lat = GPS.gcj_encrypt(lat, lng).lat
            // lng = GPS.bd_encrypt(lat, lng).lon
            // lat = GPS.bd_encrypt(lat, lng).lat
            // lng = GPS.bd_decrypt(lat, lng).lon
            // lat = GPS.bd_decrypt(lat, lng).lat
            var point = new BMapGL.Point(lng, lat)
            point.a34004 = parseInt(value.a34004)
            point.a34002 = parseInt(value.a34002)
            point.a21026 = parseInt(value.a21026)
            point.a21004 = parseInt(value.a21004)
            point.a01006 = parseInt(value.a01006)
            point.a01001 = parseInt(value.a01001)
            point.a01002 = parseInt(value.a01002)
            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' ||
                that.carMac === 'p5dnd7a0243625')
            ) {
              point.dustld = 100
            } else {
              point.dustld = value.dustld - 0
            }
            // point.dustld = value.dustld - 0
            point.dustld = value.dustld - 0
            trackPoints.push(point)
          }
        })
        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) {
          that.map = new BMapGL.Map('map_container')
        }
        that.map.enableScrollWheelZoom(true) // 开启鼠标滚轮,地图可以进行放大、缩小
        that.map.setMapType(BMAP_EARTH_MAP) // 设置地图类型为地球模式
        that.map.setDisplayOptions({
          street: false, // 是否显示路网(只对卫星图和地球模式有效)
        })
        that.map.setHeading(20) // 设置旋转角度
        if (that.viewKey === '2D') {
          that.map.setTilt(0) // 地图倾斜
        } else {
          that.map.setTilt(52)
        }
        // if (!that.showPoints) {
        //   console.log(111)
        //   that.map = new window.BMapGL.Map('map_container')
        // }
        // that.map.enableScrollWheelZoom(true) // 开启鼠标滚轮,地图可以进行放大、缩小s
        // that.map.setMapType(BMAP_EARTH_MAP) // 设置地图类型为地球模式
        // that.map.setDisplayOptions({
        //   street: false, // 是否显示路网(只对卫星图和地球模式有效)
        // })
        // that.map.setHeading(20) // 设置旋转角度
        // if (that.viewKey === '2D') {
        //   that.map.setTilt(0) // 地图倾斜
        // } else {
        //   that.map.setTilt(52)
        // }
        // 使用百度地图v3.0接口,在设置地图
        // 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控件
        // that.map.addControl(new window.BMapGL.NavigationControl3D()) // 添加3d控件
        if (this.responseJSON.length === 0) {
          showNoPoints()
        }
        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')
          that.map.centerAndZoom(that.centerPoint, that.mapZoom)
          that.view = new mapvgl.View({
            map: that.map,
          })
          that.firstPlayFlag = false
          that.loading1 = false
        } else {
          console.log(that.mapZoom, that.centerPoint, '2')
          this.view.removeAllLayers()
          this.map.clearOverlays()
          that.map.centerAndZoom(that.centerPoint, that.mapZoom)
          that.view = new mapvgl.View({
            map: that.map,
          })
          that.loading1 = false
          // that.map.centerAndZoom(that.centerPoint, 18)
        }
      }
@@ -914,7 +1508,7 @@
      // draw(that.sensor, that.viewType, that.carMac)
      // drawLine()// 轨迹(绘制带折线箭头)
      // drawStartAndEnd() // 起点和终点标注
      function draw(sensor, type, carMac) {
      function draw (sensor, type, carMac) {
        var levels = getGrading(sensor, type, carMac)
        $.each(levels, function (index, value) {
          var color = value.color
@@ -942,7 +1536,7 @@
      }
      // 画方块,上色,添加文字
      function drawPolygon(sensor) {
      function drawPolygon (sensor) {
        $.each(that.showPoints, function (item, point) {
          var sw = getPoint(225, point.lng, point.lat, that.distance)
          var ne = getPoint(45, point.lng, point.lat, that.distance)
@@ -957,10 +1551,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)
@@ -970,7 +1566,7 @@
      }
      // 起点和终点标注
      function drawStartAndEnd() {
      function drawStartAndEnd () {
        var startIcon = new BMapGL.Icon(
          require('@/assets/images/start.png'),
          new BMapGL.Size(48, 48)
@@ -995,7 +1591,7 @@
      }
      // 绘制带箭头折线
      function drawLine() {
      function drawLine () {
        var data = []
        var points = []
        $.each(trackPoints, function (index, value) {
@@ -1022,7 +1618,7 @@
      }
      // 格子间隔>=size的放进points
      function getShowPoints(size) {
      function getShowPoints (size) {
        var points = []
        points.push(trackPoints[0])
        for (var i = 1; i < trackPoints.length; i++) {
@@ -1035,16 +1631,18 @@
              flag = false
            }
          }
          if (flag) {
            points.push(point1)
            console.log(points,'points');
          }
          points.push(point1)
          // console.log(points, 'image.png')
          // if (flag) {
          //   points.push(point1)
          //   console.log(points, 'points')
          // }
        }
        return points
      }
      // 根据中心,角度,距离,找点
      function getPoint(angle, lng, lat, distance) {
      function getPoint (angle, lng, lat, distance) {
        var EARTH_RADIUS = 6378137 // 地球的半径,m
        // 将距离转换成经度的计算公式
        var ra = distance / EARTH_RADIUS
@@ -1069,7 +1667,7 @@
        return new BMapGL.Point(lng, lat)
      }
      function getGrading(sensor, type, carMac) {
      function getGrading (sensor, type, carMac) {
        var levels = []
        var level0 = {}
        var level1 = {}
@@ -1097,7 +1695,7 @@
        $.each(that.showPoints, function (index, value) {
          var sw = getPoint(225, value.lng, value.lat, that.distance)
          var ne = getPoint(45, value.lng, value.lat, that.distance)
          var ne = getPoint(45, value.lng, value.lat, 30)
          var polygon = []
          var point1 = []
          var point2 = []
@@ -1217,7 +1815,7 @@
        levels.push(level0, level1, level2, level3, level4, level5, level6)
        return levels
      }
      function getColorAndLevel(senosor, data) {
      function getColorAndLevel (senosor, data) {
        var levelData = that.sensorTableData
        var colorAndLevel = {}
        var color
@@ -1370,6 +1968,24 @@
              level = 6
            }
            break
          case 'a01006':
            if (data) {
              color = '#00e400'
              level = 1
            }
            break
          case 'a01001':
            if (data) {
              color = '#00e400'
              level = 1
            }
            break
          case 'a01002':
            if (data) {
              color = '#00e400'
              level = 1
            }
            break
          case 'dustld':
            if (data < levelData[7].tab1) {
              color = '#00e400'
@@ -1398,7 +2014,7 @@
      }
      // point上添加label文本
      function setLabelStyle(content, point) {
      function setLabelStyle (content, point) {
        var label = new BMapGL.Label(
          "<span class='my-maptip'>" + content + '<br /><span>', // 为lable填写内容
          {
@@ -1425,7 +2041,7 @@
      }
      // 无数据时,缩放至该中心
      function showNoPoints() {
      function showNoPoints () {
        that.map.centerAndZoom('苏州市', 17)
        setTimeout(function () {
          document.getElementById('cpm').style.display = 'block'
@@ -1444,7 +2060,7 @@
      })
      // var that = this
      function clickChange() {
      function clickChange () {
        $('.carTop').on('click', () => {
          // console.log('点击了')
          that.view.removeAllLayers()
@@ -1474,7 +2090,7 @@
        clickChange()
      }
    },
    changeCode(value) {
    changeCode (value) {
      switch (value) {
        case 'PM2.5':
          this.sensorKey = 'a34004'
@@ -1497,26 +2113,41 @@
        case 'TVOC':
          this.sensorKey = 'a99054'
          break
        case '湿度':
          this.sensorKey = 'a01002'
          break
        case '温度':
          this.sensorKey = 'a01001'
          break
        case '气压':
          this.sensorKey = 'a01006'
          break
        case 'dustld':
          this.sensorKey = 'dustld'
          break
      }
      this.initStart(this.carData)
    },
    changeCode1(index) {
      this.changeColor1 = index
      if (index === 0) {
        this.viewKey = '2D'
      } else {
        this.viewKey = '3D'
      }
      this.getStart()
    },
  },
}
</script>
<style  lang="scss" scoped>
.main-container {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-flow: column;
  flex-flow: column;
  min-height: 100%;
  -webkit-transition: margin-left 0.28s;
  transition: margin-left 0.28s;
  margin-left: 210px;
  position: relative;
  height: 100%;
}
/deep/.BMap_cpyCtrl {
  display: none;
}
@@ -1546,12 +2177,6 @@
  z-index: 10;
}
/deep/ .el-input__inner {
  height: 40px;
}
/deep/ .el-picker-panel__body {
  width: 280px;
}
.el-main {
  padding: 0;
  width: 100%;
@@ -1576,6 +2201,7 @@
  height: 38px;
  border-radius: 0;
  width: 80px;
  line-height: 0.5;
}
.per-date {
  height: 50px;
@@ -1613,6 +2239,7 @@
}
.activeArea {
  background-color: #f5f7fa;
  color: rgb(36, 36, 36);
}
/*文本样式*/
.textShow {
@@ -1640,6 +2267,12 @@
.per-text-data:nth-last-child(1) {
  padding-bottom: 8px;
}
.el-collapse {
  border-top: 1px solid #ebeef5;
  border-bottom: 1px solid #ebeef5;
  width: 280px;
}
/deep/.el-scrollbar__wrap {
  overflow-x: hidden;
  //overflow-y: hidden;
@@ -1686,4 +2319,110 @@
  font-size: 14px;
  font-family: '微软雅黑';
}
/deep/.inputNum {
  width: 4% !important;
}
.numss {
  width: 700px;
  background-color: white;
  margin-top: 17px;
  display: flex;
  height: 60px;
}
/deep/.el-select {
  width: 8% !important;
}
.Duo {
  display: flex;
  overflow: hidden;
  background-color: white;
  width: 750px;
  padding-left: 10px;
}
.spantu {
  width: 190px;
  // margin-top: 10px;
  // margin-left: 20px;
  // background-color: white;
  // height: 40px;
  display: flex;
  margin-left: 10px;
  line-height: 60px;
  font-weight: 5px;
  color: #696b6f;
  .inputtu {
    width: 40%;
    margin-left: 5px;
  }
}
.slee {
  line-height: 60px;
  width: 100px;
  margin-left: 25px;
}
.spantuu {
  width: 400px;
  line-height: 60px;
  color: #696b6f;
  .inputtu {
    width: 20%;
  }
}
.BMap_cpyCtrl {
  display: none;
}
.anchorBL {
  display: none;
}
.el-collapse-item__arrow.is-active {
  -webkit-transform: rotate(90deg);
  transform: rotate(90deg);
  position: absolute;
  top: -3px;
  right: -3px;
}
/* 解决自定义滚动条 x 轴显示问题 */
.el-scrollbar__wrap {
  overflow-x: hidden;
}
.dataParameter{
  background-color: rgba(192, 192, 192, 0.4);
  position: absolute;
  bottom: 0px;
  padding: 10px;
  color: #000;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  .item{
    margin: 0px;
    padding: 0px;
  }
}
</style>
<style >
.jlpMySelectPopper.el-picker-panel {
  width: 280px;
  height: 330px;
}
.jlpMySelectPopper.el-date-picker table {
  width: 88%;
}
.dateArrClass {
  position: relative;
}
.dateArrClass > div ::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 23px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  z-index: 999;
  background-color: #f40;
}
</style>