quanyawei
2024-06-17 afb9e7c8c9865be6a73d19e35819b5aa6b8afbdd
fix: bug修改
2 files modified
30 ■■■■ changed files
src/components/Wind/Map.vue 26 ●●●● patch | view | raw | blame | history
src/router/dynamicRouter.js 4 ●●● patch | view | raw | blame | history
src/components/Wind/Map.vue
@@ -37,6 +37,7 @@
            :clearable="false"
            :editable="false"
            type="datetime"
            :picker-options="pickerOptions"
            placeholder="选择日期时间"
            @change="changeData"
          />
@@ -408,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'],
@@ -530,7 +536,8 @@
      clickmac: '',
      childerItem: {},
      farterItem: {},
      indexsLaber: 0
      indexsLaber: 0,
      time: new Date()
    }
  },
  computed: {
@@ -593,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) // 昨天日期
@@ -685,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) {
@@ -718,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) {
@@ -1982,8 +1991,19 @@
      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()
    },
    // 更改不同的值区间
src/router/dynamicRouter.js
@@ -294,7 +294,8 @@
  const routersMenu = JSON.parse(store.state.user.menus)
  // 路由分两块,左侧列表, 最右侧员工下拉菜单
  console.log('routersMenu', routersMenu)
  const currentRoutes = router.options.routes
  let currentRoutes = []
  currentRoutes = router.options.routes
  if (routersMenu.length > 0) {
    routersMenu.forEach(item => {
      if (item.url === 'dropDown') {
@@ -352,5 +353,6 @@
    // }
    // currentRoutes.splice(currentRoutes.length, 0, notFound)
  }
  console.log('currentRoutes', currentRoutes)
  router.addRoutes(currentRoutes)
}