fuliqi
2024-11-05 c79a020be41892e60021c2a750ea2976dd20f2f3
src/views/screen/index.vue
@@ -71,10 +71,10 @@
              />
              <ul>
                <li v-for="(item, index) in facilityData.video" :key="index">
                  <div class="value">
                  <div style="font-size: 14px" class="value">
                    <animate-number from="0" :to="item.value" :key="item.value"></animate-number>
                  </div>
                  <div class="title">{{ item.title }}</div>
                  <div style="font-size: 14px" class="title">{{ item.title }}</div>
                </li>
              </ul>
            </div>
@@ -86,8 +86,8 @@
              <ul>
                <li v-for="(item, index) in facilityData.car" :key="index">
<!--                  <div class="value">{{ item.value ? item.value : "-" }}</div>-->
                  <div class="value"><animate-number from="0" :to="item.value" :key="item.value"></animate-number></div>
                  <div class="title">{{ item.title }}</div>
                  <div style="font-size: 14px" class="value"><animate-number from="0" :to="item.value" :key="item.value"></animate-number></div>
                  <div style="font-size: 14px" class="title">{{ item.title }}</div>
                </li>
              </ul>
            </div>
@@ -102,8 +102,8 @@
                  :key="index"
                >
<!--                  <div class="value">{{ item.value ? item.value : "-" }}</div>-->
                  <div class="value"><animate-number from="0" :to="item.value" :key="item.value"></animate-number></div>
                  <div class="title">{{ item.title }}</div>
                  <div style="font-size: 14px" class="value"><animate-number from="0" :to="item.value" :key="item.value"></animate-number></div>
                  <div style="font-size: 14px" class="title">{{ item.title }}</div>
                </li>
              </ul>
            </div>
@@ -213,6 +213,7 @@
    return {
      deptList: [],
      deptId: '',
      intervalId: null, // 用于存储定时器的ID
      carList: [],
      videoList: [],
      faceList: [],
@@ -220,49 +221,49 @@
      workOrderRegion: [],
      platformData: null,
      scoreData: {
          自流井区: [
            {
              value: 0,
              name: '得分'
            }
          ],
          高新区: [
            {
              value: 0,
              name: '得分'
            }
          ],
          大安区: [
            {
              value: 0,
              name: '得分'
            }
          ],
          沿滩区: [
            {
              value: 0,
              name: '得分'
            }
          ],
          贡井区: [
            {
              value: 0,
              name: '得分'
            }
          ],
          荣县: [
            {
              value: 0,
              name: '得分'
            }
          ],
          富顺县: [
            {
              value: 0,
              name: '得分'
            }
          ]
        },
        自流井区: [
          {
            value: 0,
            name: '得分'
          }
        ],
        高新区: [
          {
            value: 0,
            name: '得分'
          }
        ],
        大安区: [
          {
            value: 0,
            name: '得分'
          }
        ],
        沿滩区: [
          {
            value: 0,
            name: '得分'
          }
        ],
        贡井区: [
          {
            value: 0,
            name: '得分'
          }
        ],
        荣县: [
          {
            value: 0,
            name: '得分'
          }
        ],
        富顺县: [
          {
            value: 0,
            name: '得分'
          }
        ]
      },
      // 设备数据
      facilityData: {
        video: [],
@@ -308,8 +309,16 @@
      })
      .catch((err) => {
      });
    // 查询数据
    this.getData();
    // 查询数据
    this.intervalId = setInterval(this.getData,  3600000); //一小时一次
  },
  beforeDestroy() {
    // 组件销毁前清除定时器,防止内存泄漏
    if (this.intervalId) {
      clearInterval(this.intervalId);
      this.intervalId = null;
    }
  },
  methods: {
    getDeptId(deptName) {
@@ -366,7 +375,7 @@
        });
      checkScore(this.activerBtnType, this.deptId)
        .then((res) => {
          if(res.data && Object.keys(res.data).length > 0){
          if (res.data && Object.keys(res.data).length > 0) {
            this.scoreData = res.data;
          }
        })
@@ -374,7 +383,7 @@
        });
      getPlatform(this.activerBtnType, this.deptId)
        .then((res) => {
          if(res.data && Object.keys(res.data).length > 0){
          if (res.data && Object.keys(res.data).length > 0) {
            this.platformData = res.data;
          }
        })
@@ -1118,6 +1127,7 @@
              list-style-type: none;
              border-bottom: 1px dashed #223654;
              margin: 7px 0;
              li {
                width: 25%;
                text-align: center;