213 lines
6.3 KiB
Vue
213 lines
6.3 KiB
Vue
|
|
<template>
|
|||
|
|
<div class="centerFold">
|
|||
|
|
<div @click="toggleDiv">
|
|||
|
|
<img v-if="isUp" src="../../assets/img/myImage/up.png" alt="" />
|
|||
|
|
<img v-else src="../../assets/img/myImage/down.png" alt="" />
|
|||
|
|
</div>
|
|||
|
|
<div class="box1" ref="box1" id="box1">
|
|||
|
|
<div class="box1-item_one">
|
|||
|
|
<div class="box1-item" v-for="(item, index) of newArrOne" :key="index">
|
|||
|
|
<div class="box1-item-name">{{ item.name }}</div>
|
|||
|
|
<div class="box1-item-number">
|
|||
|
|
<h4>{{ item.value }}</h4>
|
|||
|
|
<div>+</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="box1-item_two">
|
|||
|
|
<div>
|
|||
|
|
<div class="box_header_div">
|
|||
|
|
<div class="box_list" v-for="(item, index) of newArr" :key="index">
|
|||
|
|
<div class="item-value">
|
|||
|
|
{{ item.value }}
|
|||
|
|
</div>
|
|||
|
|
<div class="box_img"><img :src="item.url" alt="" /></div>
|
|||
|
|
<div class="item-name">{{ item.name }}</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import GROUP from '../../assets/img/myImage/group.png';
|
|||
|
|
import { getTotalOwnershipApi } from "../../api/screen";
|
|||
|
|
|
|||
|
|
export default {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
isUp: true,
|
|||
|
|
isCollapse: false,
|
|||
|
|
newArrOne: [
|
|||
|
|
{ name: '施工机具总保有量', value: 9999 },
|
|||
|
|
{ url: GROUP, name: '工器具总保有量', value: 9999 },
|
|||
|
|
],
|
|||
|
|
newArr: [
|
|||
|
|
{ url: GROUP, name: '在库机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '待入库机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '在用机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '在修机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: 999 },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: 999 },
|
|||
|
|
]
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
mounted() {
|
|||
|
|
console.log(this.$refs['box1'].scrollHeight); // 110
|
|||
|
|
this.$refs['box1'].style.height = 'auto'
|
|||
|
|
this.$refs['box1'].style.height = window.getComputedStyle(this.$refs['box1']).height
|
|||
|
|
this.getTotalOwnershipApiPage()
|
|||
|
|
setInterval(() => {
|
|||
|
|
this.getTotalOwnershipApiPage()
|
|||
|
|
}, 60 * 1000);
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
getTotalOwnershipApiPage() {
|
|||
|
|
this.newArrOne = []
|
|||
|
|
this.newArr = []
|
|||
|
|
getTotalOwnershipApi().then(res => {
|
|||
|
|
this.newArrOne.push(
|
|||
|
|
{ name: '施工机具总保有量', value: res.data[0].totalOwnershipNum },
|
|||
|
|
{ url: GROUP, name: '工器具总保有量', value: res.data[1].totalOwnershipNum },
|
|||
|
|
)
|
|||
|
|
this.newArr.push(
|
|||
|
|
{ url: GROUP, name: '在库机具', value: res.data[0].stockNum },
|
|||
|
|
{ url: GROUP, name: '待入库机具', value: res.data[0].storedNum },
|
|||
|
|
{ url: GROUP, name: '在用机具', value: res.data[0].useNum },
|
|||
|
|
{ url: GROUP, name: '在修机具', value: res.data[0].repairNum },
|
|||
|
|
{ url: GROUP, name: '报废机具', value: res.data[0].scrapNum },
|
|||
|
|
{ url: GROUP, name: '在库工器具', value: res.data[1].stockNum },
|
|||
|
|
{ url: GROUP, name: '待入库工器具', value: res.data[1].storedNum },
|
|||
|
|
{ url: GROUP, name: '在用工器具', value: res.data[1].useNum },
|
|||
|
|
{ url: GROUP, name: '在修工器具', value: res.data[1].repairNum },
|
|||
|
|
{ url: GROUP, name: '报废工器具', value: res.data[1].scrapNum },
|
|||
|
|
)
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
toggleDiv() {
|
|||
|
|
this.isUp = !this.isUp
|
|||
|
|
this.isCollapse = !this.isCollapse
|
|||
|
|
if (this.isCollapse) {
|
|||
|
|
this.$refs['box1'].style.height = 0
|
|||
|
|
} else {
|
|||
|
|
this.$refs['box1'].style.height = 'auto'
|
|||
|
|
let height = window.getComputedStyle(this.$refs['box1']).height
|
|||
|
|
// 这里修改的太快,transition都还没开始做动画
|
|||
|
|
this.$refs['box1'].style.height = 0
|
|||
|
|
this.$refs['box1'].style.height = height
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style lang="scss" scoped>
|
|||
|
|
.centerFold {
|
|||
|
|
z-index: 2000;
|
|||
|
|
|
|||
|
|
.box1 {
|
|||
|
|
z-index: 1001;
|
|||
|
|
clear: both;
|
|||
|
|
width: 969px;
|
|||
|
|
height: 400px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
margin-left: -45%;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
|
|||
|
|
.box1-item_one {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
width: 200px;
|
|||
|
|
margin-left: 40px;
|
|||
|
|
.box1-item {
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
.box1-item-name {
|
|||
|
|
font-size: 18px;
|
|||
|
|
font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
|
|||
|
|
font-weight: 500;
|
|||
|
|
color: #ffffff;
|
|||
|
|
line-height: 21px;
|
|||
|
|
letter-spacing: 2px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.box1-item-number {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
margin-top: 10px;
|
|||
|
|
h4 {
|
|||
|
|
margin-left: 25px;
|
|||
|
|
font-size: 60px;
|
|||
|
|
font-family: Roboto, Roboto;
|
|||
|
|
font-weight: 500;
|
|||
|
|
color: #34dbff;
|
|||
|
|
line-height: 70px;
|
|||
|
|
letter-spacing: 2px;
|
|||
|
|
}
|
|||
|
|
div {
|
|||
|
|
font-size: 40px;
|
|||
|
|
font-family: Roboto, Roboto;
|
|||
|
|
font-weight: 500;
|
|||
|
|
color: #fff;
|
|||
|
|
line-height: 90px;
|
|||
|
|
letter-spacing: 2px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
.box1-item_two {
|
|||
|
|
margin-top: 20px;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
margin-left: 10%;
|
|||
|
|
margin-right: 40px;
|
|||
|
|
width: calc(969px - 200px);
|
|||
|
|
.box_header_div {
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
flex-wrap: wrap;
|
|||
|
|
.box_list {
|
|||
|
|
width: 20%;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
align-items: center;
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
}
|
|||
|
|
.item-value {
|
|||
|
|
font-size: 32px;
|
|||
|
|
font-family: Roboto, Roboto;
|
|||
|
|
font-weight: 500;
|
|||
|
|
color: #34dbff;
|
|||
|
|
}
|
|||
|
|
.box_img {
|
|||
|
|
width: 90px;
|
|||
|
|
height: 90px;
|
|||
|
|
margin-top: -35px;
|
|||
|
|
img {
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
.item-name {
|
|||
|
|
font-size: 14px;
|
|||
|
|
font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
|
|||
|
|
font-weight: 400;
|
|||
|
|
color: #ffffff;
|
|||
|
|
line-height: 16px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|