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
131
132
133
134
135
136
137
138
139
140
141
142
| <template>
| <!-- 制件总览 -->
| <div id="workpiece" class="global-content backgroundrgb">
| <h3 class="text-center fontsize2rem colorfff absolute transformtopleft12" style="font-size: 80px">制件总览</h3>
| <div
| class="
| width80
| padding10
| borderradius
| margintopbot
| absolute
| transformtopleft
| flex
| justify-around
| flex-wrap
| 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 colorfff fontweight600 margin-top15" style="font-size: 50px">
| <countTo :startVal="startVal" :endVal="item.mun" :duration="3000"></countTo>
| </p>
| <p class="fontsize1_2rem color409EFF" style="font-size: 50px">{{ 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>
|
|