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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
  <!-- 立库总览 -->
  <div id="statelibrary" class="global-content backgroundrgb">
    <h3 class="text-center colorfff fontsize2rem absolute transformtopleft12" style="font-size: 80px">立库总览</h3>
    <div
      class="
        width80
        padding10
        borderradius
        margintopbot
        absolute
        transformtopleft
        flex flex-wrap
        justify-around
        align-center
      "
    >
      <div
        class="didproject-title width45 flex justify-around align-center borderdashed borderradius overflow pointer"
        v-for="(item, index) in titlelist"
        :style="'margin-top:' + item.margin"
        :key="index"
      >
        <div class="heigth padding10 overflow">
          <p class="text-center fontweight600 colorfff margin-top15" style="font-size: 50px">
            <countTo :startVal="startVal" :endVal="item.mun" :duration="3000"></countTo>
          </p>
          <p class="color409EFF" style="font-size: 50px">{{ item.titel }}</p>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import countTo from 'vue-count-to';
import { GetStorageOverviewData } from '@/api/Didproject';
export default {
  data() {
    return {
      startVal: 0,
      titlelist: [
        {
          titel: '库位总数',
          mun: 0,
          color: '#40C9C6'
        },
        {
          titel: '有货库位',
          mun: 0,
          color: '#F4516C'
        },
        {
          titel: '带件器具',
          mun: 0,
          color: '#36A3F7',
          margin: '1%'
        },
        {
          titel: '空器具数',
          mun: 0,
          color: '#34BFA3',
          margin: '1%'
        }
        // {
        //   titel: '制件总数',
        //   mun: 1,
        //   color: '#ffc637'
        // }
      ],
      cleartime: null
    };
  },
  components: { countTo },
  computed: {},
  mounted() {
    this.GetStorageOverviewData();
    this.cleartime = setInterval(() => {
      this.GetStorageOverviewData();
    }, 60000);
  },
  methods: {
    //跳转
    linkto() {
      const { href } = this.$router.resolve({
        path: '/statelibrary'
      });
      window.open(href, '_blank');
    },
    //立库总览和制件总览
    GetStorageOverviewData() {
      // no 编号;title 标题;value 数量
      GetStorageOverviewData().then(res => {
        let data = res.data || [];
        this.titlelist.forEach(item => {
          data.forEach(element => {
            if (item.titel == element.titel) {
              item.mun = element.value;
            }
          });
        });
      });
    }
  },
  beforeDestroy() {
    if (this.cleartime) {
      clearInterval(this.cleartime);
      this.cleartime = null;
    }
  }
};
</script>
 
<style lang="scss" scoped>
#statelibrary {
}
</style>