quanyawei
2024-06-17 afb9e7c8c9865be6a73d19e35819b5aa6b8afbdd
src/components/Wind/Map.vue
@@ -28,7 +28,20 @@
          alt=""
          @click="turnState"
        >
        <span class="text_Time">{{ dateFormat }}</span>
        <span class="text_Time">
          <el-date-picker
            v-model="selectData"
            popper-class="tpc"
            value-format="yyyy-MM-dd HH"
            format="yyyy-MM-dd HH"
            :clearable="false"
            :editable="false"
            type="datetime"
            :picker-options="pickerOptions"
            placeholder="选择日期时间"
            @change="changeData"
          />
        </span>
        <img
          class="drop-icon"
          :src="turnImg"
@@ -396,6 +409,11 @@
      timerKey: '', // 用于重新渲染子组件
      map: null,
      code: [],
      pickerOptions: {
        disabledDate: (time) => {
          return time.getTime() > Date.now() - 1 * 24 * 3600 * 1000
        },
      },
      latlng: [],
      noneData: false,
      params: ['PM10', 'PM2.5', 'SO2', 'NO2', 'CO', 'O3', 'TVOC'],
@@ -432,7 +450,7 @@
      // 总条数,根据接口获取数据长度(注意:这里不能为空)
      totalCount: 0,
      // 个数选择器(可修改)
      pageSizes: [10, 20, 30, 40],
      pageSizes: [10, 50, 100, 200],
      // 默认每页显示的条数(可修改)
      PageSize: 20,
      factorOptions: [
@@ -507,6 +525,7 @@
      turnImg: require('@/assets/images/regionalOverview/dropDown.png'),
      showOrHidden: true,
      dateFormat: '',
      selectData: new Date(),
      alarmTableVisible: false,
      chooseTimeInfo: false, // 是否选择了时间点
      chooseTime: false,
@@ -517,7 +536,8 @@
      clickmac: '',
      childerItem: {},
      farterItem: {},
      indexsLaber: 0
      indexsLaber: 0,
      time: new Date()
    }
  },
  computed: {
@@ -580,10 +600,10 @@
  methods: {
    // 拿到某天的日期和星期
    getDayXQ (day) {
      var days = new Date().getDay() // 星期
      var days = new Date().getDay() // 星期 // 星期
      var rq = '' // 日期
      if (day === 'today') {
        rq = this.newData(0)
        rq = this.newData(0) // 今天日期
      } else if (day === 'yesterday') {
        days = (days + 7 - 1) % 7
        rq = this.newData(-1) // 昨天日期
@@ -672,6 +692,7 @@
              inText2.innerHTML = times + ':00'
              this.chooseTimeInfo = true // 选择时间点
              this.chooseTime = true // 选择时间点
              console.log('times', times)
              if ((i + 1) / 24 < 1) {
                this.nyr = this.newData(-2, 'nyr') + ' ' + times + ':00'
              } else if ((i + 1) / 24 < 2 && (i + 1) / 24 >= 1) {
@@ -705,6 +726,7 @@
              inText2.innerHTML = times + ':00'
              this.chooseTimeInfo = true // 选择时间点
              this.chooseTime = true // 选择时间点
              console.log('times', times)
              if (i / 24 < 1) {
                this.nyr = this.newData(-2, 'nyr') + ' ' + times + ':00'
              } else if (i / 24 < 2 && i / 24 >= 1) {
@@ -1968,6 +1990,22 @@
      // })
      window.map = map
    },
    changeData (val) {
      console.log(val)
      this.nyr = val + ':00'
      const date = new Date(this.nyr.replace(/(\d{4}-\d{2}-\d{2}) (\d{2})(?!\d)/, '$1 $2:00'))
      console.log(date)
      this.chooseTime = true
      // var p1 = document.querySelector('.p1')
      // var p2 = document.querySelector('.p2')
      // var p3 = document.querySelector('.p3')
      // this.time = date
      // p3.innerHTML = this.getDayXQ('today')
      // p2.innerHTML = this.getDayXQ('yesterday')
      // p1.innerHTML = this.getDayXQ('beforeYea')
      this.initData()
    },
    // 更改不同的值区间
    change (index) {
      this.changeColor = index
@@ -2437,11 +2475,36 @@
  margin-top: 9px;
  margin-left: 10px;
}
.text_Time {
  float: left;
  margin-left: 37px;
  .el-date-editor{
    width: 145px!important;
    .el-input__prefix{
      display: none!important;
    }
    .el-input__inner{
      cursor: pointer;
      font-size: 18px;
      color: #fff;
      padding: 0px!important;
      border: none;
      background: inherit;
    }
  }
}
.tpc{
  left: unset!important;
  right: 60px;
}
.tpc .el-time-spinner__wrapper {
  width:100% !important;
}
.tpc .el-scrollbar:nth-of-type(2) {
  display: none !important;
}
.my-div-icon {
  font-size: 14px;
  text-align: center;