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
118
119
120
121
122
123
124
125
126
127
128
129
130
<template>
  <!-- 制件总览 -->
  <div id="workpiece" class="global-content">
    <el-button statelibrary="absolute right zindex" type="primary" size="mini" @click="linkto">跳转</el-button>
    <h3 class="text-center color636972" style="font-size: 40px">制件总览</h3>
    <div class="width96 padding10 borderradius margintopbot flex flex-wrap justify-between align-center">
      <div
        class="didproject-title width45 flex justify-around align-center borderdashed borderradius overflow pointer"
        v-for="(item, index) in titlelist"
        :key="index"
        :style="'margin-top:' + item.margin"
      >
        <div class="heigth padding10 overflow">
          <p class="text-center fontsize2rem fontweight600 color409EFF margin-top15" style="font-size: 40px">
            <countTo :startVal="startVal" :endVal="item.mun" :duration="3000"></countTo>
          </p>
          <p class="fontsiez1rem" style="font-size: 40px">{{ item.titel }}</p>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import countTo from 'vue-count-to';
import { GetHomeNumData } from '@/api/Didproject';
import { GetStorageOverviewData } from '@/api/Didproject';
import { ItemStorage } from '@/api/materials';
export default {
  data() {
    return {
      startVal: 0,
      titlelist: [
        {
          titel: '制件总数',
          name: '制件总数',
          mun: 0,
          color: '#ffc637'
        },
        {
          titel: '制件种类',
          name: '制件种类',
          mun: 0,
          color: '#40C9C6'
        },
        {
          titel: '今日入库',
          name: '今日入库零件数',
          mun: 0,
          color: '#F4516C',
          margin: '1%'
        },
        {
          titel: '今日出库',
          name: '今日出库零件数',
          mun: 0,
          color: '#36A3F7',
          margin: '1%'
        }
      ],
      cleartime: null,
      list: []
    };
  },
  components: { countTo },
  computed: {},
  mounted() {
    this.GetHomeNumData();
    this.cleartime = setInterval(() => {
      this.GetHomeNumData();
    }, 60000);
  },
  methods: {
    //跳转
    linkto() {
      const { href } = this.$router.resolve({
        path: '/workpiece'
      });
      window.open(href, '_blank');
    },
    //今日出入库数据
    GetHomeNumData() {
      // no 编号;title 标题;value 数量
      GetHomeNumData().then(res => {
        let data = res.data || [];
        this.list = data;
        this.GetStorageOverviewData(data);
      });
    },
    GetStorageOverviewData() {
      GetStorageOverviewData().then(res => {
        let data = res.data || [];
        this.list = this.list.concat(data);
        console.log(this.list);
        this.ItemStorage();
      });
    },
    ItemStorage() {
      ItemStorage('1&onePageNum=1').then(res => {
        if (res.code == 0) {
          this.list.push({
            titel: '制件种类',
            name: '制件种类',
            value: res.num
          });
          this.titlelist.forEach(item => {
            this.list.forEach(element => {
              if (item.name == element.titel) {
                item.mun = element.value;
              }
            });
          });
        }
        console.log(this.list);
      });
    }
  },
  beforeDestroy() {
    if (this.cleartime) {
      clearInterval(this.cleartime);
      this.cleartime = null;
    }
  }
};
</script>
 
<style lang="scss" scoped>
#workpiece {
}
</style>