quanyawei
2023-11-30 5742084716693ffe8ca813b0c3765a603f99220f
fix:数值修改
1 files modified
310 ■■■■■ changed files
src/views/car/index.vue 310 ●●●●● patch | view | raw | blame | history
src/views/car/index.vue
@@ -1,45 +1,28 @@
<template>
  <div class="main_body">
    <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="
      <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>
        <el-menu style="margin-top: 10px">
          <el-menu-item
            v-for="(item, index) in defaultData"
            :key="index"
            style="
          <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;
            "
            :index="(index + 1 + '-' + index + 1).toString()"
            @click="changeCarData(item)"
          >
            " :index="(index + 1 + '-' + index + 1).toString()" @click="changeCarData(item)">
            <span>{{ item.name }}</span>
            <i
              style="
            <i style="
                vertical-align: -2.5px;
                font-size: 20px;
                margin-right: 10px;
                margin-left: auto;
              "
              class="iconfont iconfaxianzuobiao"
              @click="deviceDetail(item.mac, null, item, 0)"
            />
              " class="iconfont iconfaxianzuobiao" @click="deviceDetail(item.mac, null, item, 0)" />
            <!--            @click="deviceDetail('p5dnd7a0245390',null,item,0)"-->
          </el-menu-item>
        </el-menu>
@@ -48,34 +31,14 @@
      <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
            >
            <el-button size="medium" type="primary" icon="el-icon-setting" @click="dialogFormVisible = true">6参设定</el-button>
          </span>
          <span
            v-for="(item, index) in snesorParams"
            :key="index"
            class="left"
            :class="{ click: changeColor == index }"
            @click="changeCode(index)"
            >{{ item }}
          <span v-for="(item, index) in snesorParams" :key="index" class="left" :class="{ click: changeColor == index }" @click="changeCode(index)">{{ item }}
          </span>
          <span
            v-for="(item, index) in viewOptions"
            :key="index + '-only'"
            class="right"
            :class="{ click: changeColor1 == index }"
            @click="changeCode1(index)"
            >{{ item }}
          <span v-for="(item, index) in viewOptions" :key="index + '-only'" class="right" :class="{ click: changeColor1 == index }" @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
            >
            <el-button size="medium" type="primary" @click="wsStart()">开启实时</el-button>
          </span>
          <!--           <el-date-picker
                      v-if="historyView"
@@ -111,35 +74,13 @@
          <!--            />-->
          <!--          </el-select>-->
          <el-button
            type="primary"
            size="small"
            style="margin-left: 1.5rem"
            @click="insertL"
            >添加</el-button
          >
          <el-input
            placeholder="请输入内容"
            v-model="inputnum"
            class="inputNum"
            clearable
          >
          <el-button type="primary" size="small" style="margin-left: 1.5rem" @click="insertL">添加</el-button>
          <el-input placeholder="请输入内容" v-model="inputnum" class="inputNum" clearable>
          </el-input>
          <div class="insLu">
            <el-upload
              class="upload-demo"
              ref="upload"
              action=""
              :on-change="handleChange"
              :on-remove="handleRemove"
              :file-list="fileList"
              :auto-upload="false"
              :limit="1"
            >
              <el-button slot="trigger" size="small" type="primary"
                >选取文件</el-button
              >
            <el-upload class="upload-demo" ref="upload" action="" :on-change="handleChange" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false" :limit="1">
              <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
              <div slot="tip" class="el-upload__tip" style="color: red">
                上传走航轨迹图片(可选可不选)
              </div>
@@ -177,11 +118,7 @@
              </el-table-column>
            </el-table>
            <div style="display: flex">
              <span class="statspan">路段名称:</span
              ><el-input
                v-model="Lname"
                style="width: 12rem; margin-left: 1.7rem"
              ></el-input>
              <span class="statspan">路段名称:</span><el-input v-model="Lname" style="width: 12rem; margin-left: 1.7rem"></el-input>
            </div>
            <div style="display: flex; margin-left: 4rem">
              <el-button type="primary" @click="insLuDuan">保存</el-button>
@@ -189,34 +126,16 @@
              <el-button @click="qnull">清空</el-button>
            </div>
          </div>
          <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 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="
          <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"
              :label="item.label"
              :value="item.value"
            />
            ">
            <el-option v-for="item in dataTypeList" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </div>
        <div v-if="noneData" class="noneData">当前时间没有走航数据</div>
@@ -238,12 +157,7 @@
    <!-- 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>
@@ -252,16 +166,14 @@
      </el-descriptions>
      <!-- <el-descriptions title="设备标准值"  border>
      </el-descriptions> -->
      <div
        style="
      <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>
@@ -490,7 +402,7 @@
        2.0) /
      3.0
    return ret
  },
  }
}
export default {
  components: { index },
@@ -512,7 +424,7 @@
        'CO',
        'O3',
        'TVOC',
        '尘负荷',
        '尘负荷'
      ],
      changeColor: 0,
      changeColor1: 0,
@@ -532,7 +444,7 @@
            text: '今天',
            onClick(picker) {
              picker.$emit('pick', new Date())
            },
            }
          },
          {
            text: '昨天',
@@ -540,7 +452,7 @@
              const date = new Date()
              date.setTime(date.getTime() - 3600 * 1000 * 24)
              picker.$emit('pick', date)
            },
            }
          },
          {
            text: '一周前',
@@ -548,9 +460,9 @@
              const date = new Date()
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', date)
            },
          },
        ],
            }
          }
        ]
      },
      timeOne: '',
      threeOptions: {
@@ -560,7 +472,7 @@
          // 如何你选择了两个日期了,就把那个变量置空
          if (maxDate) this.timeOne = ''
        },
        disabledDate: (time) => {
        disabledDate: time => {
          if (this.timeOne) {
            const WEEK = 3 * 24 * 3600 * 1000 - 1 // 这里乘以3再减去1相当于 限制3天以内
            const minTime = this.timeOne // 三天之前
@@ -573,7 +485,7 @@
          } else {
            return time.getTime() > new Date()
          }
        },
        }
      },
      timeOne: '',
      threeOptions: {
@@ -583,7 +495,7 @@
          // 如何你选择了两个日期了,就把那个变量置空
          if (maxDate) this.timeOne = ''
        },
        disabledDate: (time) => {
        disabledDate: time => {
          if (this.timeOne) {
            const WEEK = 3 * 24 * 3600 * 1000 - 1 // 这里乘以3再减去1相当于 限制3天以内
            const minTime = this.timeOne // 三天之前
@@ -596,7 +508,7 @@
          } else {
            return time.getTime() > new Date()
          }
        },
        }
      },
      sensorDate: null,
      noneData: false,
@@ -612,7 +524,7 @@
          tab3: '115',
          tab4: '150',
          tab5: '250',
          tab6: '350',
          tab6: '350'
        },
        {
          sensorName: 'PM10',
@@ -622,7 +534,7 @@
          tab3: '250',
          tab4: '350',
          tab5: '420',
          tab6: '500',
          tab6: '500'
        },
        {
          sensorName: 'SO2',
@@ -632,7 +544,7 @@
          tab3: '650',
          tab4: '800',
          tab5: '',
          tab6: '',
          tab6: ''
        },
        {
          sensorName: 'NO2',
@@ -642,7 +554,7 @@
          tab3: '700',
          tab4: '1200',
          tab5: '2340',
          tab6: '3090',
          tab6: '3090'
        },
        {
          sensorName: 'CO',
@@ -652,7 +564,7 @@
          tab3: '35',
          tab4: '60',
          tab5: '90',
          tab6: '120',
          tab6: '120'
        },
        {
          sensorName: 'O3',
@@ -662,7 +574,7 @@
          tab3: '300',
          tab4: '400',
          tab5: '800',
          tab6: '1000',
          tab6: '1000'
        },
        {
          sensorName: 'TVOC',
@@ -672,7 +584,7 @@
          tab3: '0.5',
          tab4: '0.7',
          tab5: '0.9',
          tab6: '1',
          tab6: '1'
        },
        {
          sensorName: '尘负荷',
@@ -682,8 +594,8 @@
          tab3: '1000',
          tab4: '10000',
          tab5: '20000',
          tab6: '50000',
        },
          tab6: '50000'
        }
      ],
      carWs: null,
      map: null,
@@ -703,12 +615,12 @@
      dataTypeList: [
        {
          value: 'history',
          label: '历史数据',
          label: '历史数据'
        },
        {
          value: 'webSocket',
          label: '实时数据',
        },
          label: '实时数据'
        }
      ],
      dataTypeValue: 'history',
      historyView: true,
@@ -728,8 +640,8 @@
      endL: '',
      timeValue: [
        new Date(2020, 1, 1, 0, 0, 0),
        new Date(2022, 12, 31, 23, 59, 59),
      ],
        new Date(2022, 12, 31, 23, 59, 59)
      ]
    }
  },
  watch: {
@@ -753,7 +665,7 @@
      // console.log(n)
    },
    deep: true,
    immediate: true,
    immediate: true
    // timeValue: {
    //   handler(newVal, oldVal) {
    //     this.sensorTime = this.newTime()
@@ -826,14 +738,14 @@
      if (this.Lname == '') {
        this.$message({
          message: '请输入路段名',
          type: 'warning',
          type: 'warning'
        })
        return false
      }
      if (this.tableData.length === 0) {
        this.$message({
          message: '请点击时间',
          type: 'warning',
          type: 'warning'
        })
        // console.log(1);
        return false
@@ -861,20 +773,20 @@
      formData.append(`time3`, times[0])
      formData.append(`time4`, times[1])
      formData.append(`mac`, this.carMac)
      this.fileList.map((v) => {
      this.fileList.map(v => {
        formData.append(`files`, v.raw)
      })
      this.$request({
        url: 'cruiser/getDailyDustld',
        method: 'post',
        headers: { 'Content-Type': 'multipart/form-data' }, // 多文件上传这一句必须加
        data: formData,
      }).then((res) => {
        data: formData
      }).then(res => {
        console.log(res)
        if (res.code === 0) {
          this.$message({
            message: '添加路段成功',
            type: 'success',
            type: 'success'
          })
          this.tableData = []
          this.Lname = ''
@@ -899,7 +811,7 @@
    // 时间处理函数
    newTime2(timeArr) {
      var arr = []
      timeArr.map((v) => {
      timeArr.map(v => {
        var date = new Date(v)
        var y = date.getFullYear()
        var m = date.getMonth() + 1
@@ -932,7 +844,7 @@
          device: items,
          macName: mac,
          indexs: indexs,
          items: [items.latitude, items.longitude],
          items: [items.latitude, items.longitude]
        },
        query: {
          monitorPointInfo: JSON.stringify(item),
@@ -940,8 +852,8 @@
          macName: mac,
          indexs: indexs,
          items: [items.latitude, items.longitude],
          equipment: 'car',
        },
          equipment: 'car'
        }
      })
    },
    // 6参设定方法
@@ -958,13 +870,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)
        })
    },
@@ -975,21 +887,21 @@
        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)
        })
    },
@@ -1033,7 +945,7 @@
      let str = ''
      let str2 = ''
      this.sensorTime = []
      timeArr.map((v) => {
      timeArr.map(v => {
        v = JSON.stringify(v)
        str2 = v.substr(12, 8).split(':')
        str2[0] =
@@ -1159,9 +1071,9 @@
          time1: this.sensorDate[0],
          time2: this.sensorDate[1],
          type: this.sensorKey,
          range: this.inputnum,
        },
      }).then((res) => {
          range: this.inputnum
        }
      }).then(res => {
        // console.log(res)
        if (!res.data.length) {
          this.noneData = true
@@ -1261,15 +1173,15 @@
              point.a05024 = parseInt(value.a05024)
              point.a99054 = parseFloat(value.a99054).toFixed(3)
              if (value.dustld - 0 >= 0 && value.dustld - 0 < 40) {
                point.dustld = value.dustld - 0 + 170
                point.dustld = value.dustld - 0 // + 170
              } else if (value.dustld - 0 >= 40 && value.dustld - 0 < 60) {
                point.dustld = value.dustld - 0 + 130
                point.dustld = value.dustld - 0 // + 130
              } else if (value.dustld - 0 >= 60 && value.dustld - 0 < 100) {
                point.dustld = value.dustld - 0 + 110
                point.dustld = value.dustld - 0 // + 110
              } else if (value.dustld - 0 >= 100 && value.dustld - 0 < 150) {
                point.dustld = value.dustld - 0 + 70
                point.dustld = value.dustld - 0 // + 70
              } else if (value.dustld - 0 >= 150 && value.dustld - 0 < 180) {
                point.dustld = value.dustld - 0 + 30
                point.dustld = value.dustld - 0 // + 30
              } else {
                point.dustld = value.dustld - 0
              }
@@ -1298,7 +1210,7 @@
          // 设置天空颜色
          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) {
@@ -1311,7 +1223,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 {
@@ -1338,7 +1250,7 @@
              selectedColor: '#ee1111', // 选中项颜色
              autoSelect: true, // 根据鼠标位置来自动设置选中项
              riseTime: 1800, // 楼块初始化升起时间
              onClick: (e) => {},
              onClick: e => {}
            })
            that.shapeLayer.setData(data)
            that.view.addLayer(that.shapeLayer)
@@ -1365,7 +1277,7 @@
              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), // 右下角
              new BMapGL.Point(sw.lng, ne.lat) // 右下角
            ],
            { strokeWeight: 0.5, strokeOpacity: 0.0, fillColor: color }
          )
@@ -1383,7 +1295,7 @@
        )
        var startMark = new BMapGL.Marker(that.showPoints[0], {
          icon: startIcon,
          offset: new BMapGL.Size(0, -20),
          offset: new BMapGL.Size(0, -20)
        })
        that.map.addOverlay(startMark)
        var endIcon = new BMapGL.Icon(
@@ -1394,7 +1306,7 @@
          that.showPoints[that.showPoints.length - 1],
          {
            icon: endIcon,
            offset: new BMapGL.Size(0, -20),
            offset: new BMapGL.Size(0, -20)
          }
        )
        that.map.addOverlay(endMark)
@@ -1412,8 +1324,8 @@
        data.push({
          geometry: {
            type: '"LineString"',
            coordinates: [points],
          },
            coordinates: [points]
          }
        })
        var lineLayer = new mapvgl.LineLayer({
          color: 'red',
@@ -1421,7 +1333,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)
@@ -1541,77 +1453,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
          }
@@ -1812,7 +1724,7 @@
          `<span class="my-maptip" data-times="${point.times}">${content}<span>`, // 为lable填写内容
          {
            offset: new BMapGL.Size(-8, -10), // label的偏移量,为了让label的中心显示在点上
            position: point,
            position: point
          }
        )
        // label的位置
@@ -1830,9 +1742,9 @@
          lineHeight: '20px',
          fontFamily: '微软雅黑',
          backgroundColor: '0.05',
          fontWeight: 'bold',
          fontWeight: 'bold'
        }
        label.addEventListener('click', (e) => {
        label.addEventListener('click', e => {
          // console.log(e)
          // var ps = e.target.latLng.lat
          // var ps1 = e.target.latLng.lng
@@ -1979,8 +1891,8 @@
        this.viewKey = '3D'
      }
      this.getStart()
    },
  },
    }
  }
}
</script>
<style lang="less" scoped>