Files
dvcp_v2_wxcp_app/src/apps/AppEpidemicSituation/AppEpidemicSituation.vue
2022-01-11 16:24:43 +08:00

282 lines
6.8 KiB
Vue

<template>
<div class="AppEpidemicSituation">
<div class="header">
<img src="./components/img/header.png" alt="" />
<div class="content-info">
<div class="title">
<h2>实时数据统计</h2>
<div>截止{{toadyText}}</div>
</div>
<div class="tab-content">
<div class="tab-item">
<h2 class="color-5AAD6A">{{totalInfo.back1}}</h2>
<p>返乡人数</p>
</div>
<div class="tab-item">
<h2 class="color-4185F5">{{totalInfo.back2}}</h2>
<p>今日新增返乡</p>
</div>
<div class="tab-item">
<h2 class="color-CD413A">{{totalInfo.back3}}</h2>
<p>今日返乡异常</p>
</div>
<div class="tab-item">
<h2 class="color-5AAD6A">{{totalInfo.report1}}</h2>
<p>健康上报人数</p>
</div>
<div class="tab-item">
<h2 class="color-4185F5">{{totalInfo.report2}}</h2>
<p>今日上报人数</p>
</div>
<div class="tab-item">
<h2 class="color-CD413A">{{totalInfo.report3}}</h2>
<p>今日上报异常</p>
</div>
</div>
</div>
</div>
<div class="banner">
<img src="./components/img/fxry.png" alt="" class="mar-r18" @click="toBack"/>
<img src="./components/img/jkjc.png" alt="" @click="toHealth" />
</div>
<div class="echart-content">
<div class="title">返乡数据统计</div>
<div class="echart" id="statistic"></div>
<div class="type-text"><span class="tips bg-32C5FF"></span>新增返乡人数 <span class="tips bg-FFAA44"></span>新增异常人数</div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
import echarts from 'echarts'
export default {
name: 'AppEpidemicSituation',
appName: '疫情防控',
data() {
return {
toadyText: '',
totalInfo: {},
echartData: null
}
},
computed: { ...mapState(['user']) },
onShow() {
document.title = '疫情防控'
},
onLoad() {
var date = new Date();
this.toadyText = date.getFullYear() + '-' + date.getMonth()+1 + '-' + date.getDate()
this.getTotal()
},
methods: {
getTotal() {
this.$http.post(`/app/appepidemicbackhomerecord/statisticForQW`).then((res) => {
if (res.code == 0) {
this.totalInfo = res.data.map
var xData = [], yDataBack = [], yDataError = []
for(let key in res.data.fiveTotal){
xData.push(key)
yDataBack.push(res.data.fiveTotal[key])
}
for(let key in res.data.fiveUnusual){
yDataError.push(res.data.fiveUnusual[key])
}
this.chartInit(xData, yDataBack, yDataError)
}
})
},
chartInit(xData, yDataBack, yDataError) {
console.log(xData)
this.echartData = echarts.init(document.getElementById('statistic'))
var option = {
grid: {
left: '6%',
right: '8%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
type: 'line',
data: yDataBack,
lineStyle: {
normal: {
color: '#32c5ff'
}
},
itemStyle : {
normal : {
color:'#32c5ff',
}
}
},
{
type: 'line',
data: yDataError,
lineStyle: {
normal: {
color: '#ffaa44'
}
},
itemStyle : {
normal : {
color:'#ffaa44',
}
}
},
]
};
this.echartData.setOption(option)
},
toHealth(){
uni.navigateTo({
url:`./Health`
})
},
toBack(){
uni.navigateTo({
url:`./BackUserList`
})
},
},
}
</script>
<style lang="scss" scoped>
.AppEpidemicSituation {
.header {
position: relative;
img {
width: 100%;
height: 504px;
}
.content-info {
width: calc(100% - 60px);
background: #fff;
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.12);
border-radius: 8px;
position: absolute;
top: 368px;
left: 30px;
z-index: 99;
margin-bottom: 32px;
.title {
display: flex;
justify-content: space-between;
padding: 32px 32px 32px 48px;
h2 {
font-size: 36px;
font-family: PingFang-SC-Heavy, PingFang-SC;
font-weight: 800;
color: #333;
line-height: 50px;
}
div {
font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 36px;
}
}
.tab-content {
padding-bottom: 20px;
.tab-item {
display: inline-block;
width: 33%;
text-align: center;
margin-bottom: 32px;
h2 {
font-size: 52px;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
line-height: 60px;
margin-bottom: 10px;
letter-spacing: -4px;
}
p {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 40px;
}
.color-5AAD6A {
color: #5aad6a;
}
.color-4185F5 {
color: #4185f5;
}
.color-CD413A {
color: #cd413a;
}
}
}
}
}
.banner {
width: 100%;
padding: 0 26px;
box-sizing: border-box;
margin: 306px 0 32px 0;
img {
width: calc(50% - 18px);
height: 136px;
}
.mar-r18 {
margin-right: 18px;
}
}
.echart-content {
width: 100%;
background-color: #fff;
padding: 0 32px 38px;
box-sizing: border-box;
.title {
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 96px;
margin-bottom: 16px;
}
.echart {
width: 100%;
height: 464px;
background: #f9f9f9;
border-radius: 8px;
margin-bottom: 32px;
}
.type-text {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #666;
line-height: 40px;
text-align: center;
.tips {
display: inline-block;
width: 16px;
height: 16px;
border-radius: 2px;
margin-right: 20px;
}
.bg-32C5FF {
background: #32c5ff;
}
.bg-FFAA44 {
background: #ffaa44;
margin-left: 80px;
}
}
}
}
</style>