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