<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>
|