ke_junjie
2025-06-04 bb6e2230bb8ded3c5546bc4e4c282ee343754475
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<template>
  <div class="width">
    <p class="colorfff fontsiez1rem padding10">{{ navobj.titel }}</p>
    <div class="width flex justify-around">
      <div
        class="colorfff borderdashed borderradius padding1016"
        v-for="(item, index) in navobj.list"
        :key="index + 'navobj'"
      >
        <p class="margin4auto">{{ item.titel }}</p>
        <count-to :startVal="0" :endVal="item.value" :duration="3000"></count-to>
      </div>
    </div>
  </div>
</template>
 
<script>
import countTo from 'vue-count-to';
import { GetStorageOverviewData } from '@/api/Didproject';
export default {
  data() {
    return {
      startVal: 0,
      cleartime: null
    };
  },
  props: {
    navobj: {
      type: Object,
      default: () => {}
    }
  },
  components: { countTo },
  mounted() {
    this.GetStorageOverviewData();
    this.cleartime = setInterval(() => {
      this.GetStorageOverviewData();
    }, 60000);
  },
  methods: {
    //立库总览和制件总览
    GetStorageOverviewData() {
      // no 编号;title 标题;value 数量
      GetStorageOverviewData().then(res => {
        let data = res.data || [];
        this.navobj.list.forEach(item => {
          data.forEach(element => {
            if (item.titel == element.titel) {
              item.value = element.value;
            }
          });
        });
      });
    }
  },
  beforeDestroy() {
    if (this.cleartime) {
      clearInterval(this.cleartime);
      this.cleartime = null;
    }
  }
};
</script>
 
<style></style>