Files
dvcp_v2_wxcp_app/library/project/lulong/AppHandSnapshot/Statistics.vue

425 lines
11 KiB
Vue
Raw Normal View History

2023-08-22 09:26:17 +08:00
<template>
2023-08-24 11:02:37 +08:00
<div class="statistics">
<AiTopFixed>
<div class="select-gird">
2023-09-11 11:08:13 +08:00
<AiPagePicker type="gird" valueObj nodeKey="id" formType="2" @select="handleSelectGird" class="right-span"
action="/app/apppatrolreportinfo/listByInfo">
<AiMore v-model="selectGird.girdName" icon="arrow-right" placeholder="选择网格"/>
</AiPagePicker>
2023-08-22 09:26:17 +08:00
</div>
2023-08-24 11:02:37 +08:00
</AiTopFixed>
<div class="statstics-content">
<div class="info-content">
2023-08-25 14:49:21 +08:00
<div class="title">概况总览</div>
2023-08-24 11:02:37 +08:00
<div class="el-row">
2023-09-05 14:15:00 +08:00
<div class="item" v-for="(item, index) in todayList" :key="index" @click="toList(item)">
2023-09-11 11:08:13 +08:00
<h2>{{ item.value }}</h2>
<p>{{ item.label }}</p>
2023-08-22 09:26:17 +08:00
</div>
</div>
</div>
2023-08-24 11:02:37 +08:00
<div class="info-content">
<div class="title">事件办结率</div>
2023-08-25 16:22:20 +08:00
<div class="echart-content" id="finish" v-if="showFinish"></div>
2023-09-11 11:08:13 +08:00
<div class="num" v-if="showFinish">{{ finshNum || 0 }}%</div>
2023-08-25 14:49:21 +08:00
<AiEmpty v-else></AiEmpty>
2023-08-22 09:26:17 +08:00
</div>
2023-08-24 11:02:37 +08:00
<div class="info-content">
<div class="title">巡查上报趋势图</div>
2023-08-25 14:49:21 +08:00
<AiEmpty v-if="!trendData.length"></AiEmpty>
2023-08-25 15:40:14 +08:00
<div class="echart-content" id="trend" v-else></div>
2023-08-24 11:02:37 +08:00
</div>
<div class="info-content">
<div class="title">巡查事件分类
2023-08-25 15:40:14 +08:00
<!-- <div class="type-select" :style="statusInfo.name ? '' : 'color:#999;'" @click="show=true">{{statusInfo.name || '请选择'}}<u-icon name="arrow-right"></u-icon></div> -->
2023-09-11 11:08:13 +08:00
<u-select v-model="show" :list="$dict.getDict('clapEventStatusHistory')" value-name="dictValue"
label-name="dictName" @confirm="selectStatus"></u-select>
2023-08-22 09:26:17 +08:00
</div>
2023-08-25 14:49:21 +08:00
<AiEmpty v-if="!typeData.length"></AiEmpty>
2023-09-11 11:08:13 +08:00
<div class="echart-content" id="type" v-else></div>
2023-08-22 09:26:17 +08:00
</div>
2023-08-24 11:02:37 +08:00
<div class="pad-b120"></div>
2023-08-22 09:26:17 +08:00
</div>
</div>
</template>
<script>
2023-08-24 11:02:37 +08:00
import {mapState} from 'vuex'
import echarts from 'echarts'
2023-09-11 11:08:13 +08:00
2023-08-22 09:26:17 +08:00
export default {
props: {},
data() {
return {
todayList: [],
2023-08-25 15:40:14 +08:00
selectGird: {id: '', girdName: ''},
2023-08-24 11:02:37 +08:00
finishChart: null,
trendChart: null,
typeChart: null,
show: false,
2023-08-25 14:49:21 +08:00
finishData: [],
2023-08-25 16:22:20 +08:00
showFinish: false,
2023-08-25 14:49:21 +08:00
finshNum: '',
trendData: [],
trendDataX: [],
typeData: [],
2023-09-11 11:35:53 +08:00
statusInfo: {name: '', eventStatus: ''},
2023-08-22 09:26:17 +08:00
}
},
2023-08-24 11:02:37 +08:00
computed: {
...mapState(['user']),
},
2023-09-11 11:08:13 +08:00
2023-09-07 11:46:09 +08:00
created() {
2023-09-07 10:59:25 +08:00
this.getGirdInfo()
2023-08-22 09:26:17 +08:00
},
methods: {
getStatistics() {
2023-08-25 16:22:20 +08:00
this.todayList = [], this.finishData = [], this.trendDataX = [], this.trendData = [], this.typeData = [], this.showFinish = false
2023-08-25 15:40:14 +08:00
this.$http.post(`/app/apppatrolreportinfo/countByGirdId?girdId=${this.selectGird.id}&eventStatus=${this.statusInfo.eventStatus}`).then((res) => {
2023-08-22 09:26:17 +08:00
if (res.code == 0) {
2023-08-24 11:02:37 +08:00
2023-08-25 14:49:21 +08:00
Object.keys(res.data.allCountMap).forEach((key) => {
var info = {
label: key,
value: res.data.allCountMap[key]
}
this.todayList.push(info)
})
Object.keys(res.data.finishCountMap).forEach((key) => {
var info = {
name: key,
value: res.data.finishCountMap[key]
}
2023-09-11 11:08:13 +08:00
if (res.data.finishCountMap[key] > 0) {
2023-08-25 16:22:20 +08:00
this.showFinish = true
}
2023-08-25 14:49:21 +08:00
this.finishData.push(info)
})
2023-09-11 11:08:13 +08:00
if (this.showFinish) {
var num = res.data.finishCountMap['累计事件办结'] / res.data.finishCountMap['累计事件上报']
this.finshNum = Number(num * 100).toFixed(2)
2023-08-25 16:22:20 +08:00
}
2023-09-11 11:08:13 +08:00
2023-08-25 14:49:21 +08:00
res.data.dateCountList.map((item) => {
this.trendData.push(item.ecount)
this.trendDataX.push(item.ymd)
})
res.data.groupList.map((item) => {
var info = {
name: item.groupName,
value: item.totalNum
}
this.typeData.push(info)
})
2023-08-25 15:40:14 +08:00
this.$nextTick(() => {
2023-09-11 11:08:13 +08:00
if (this.showFinish) {
2023-08-25 16:22:20 +08:00
this.finishChartInit()
}
2023-09-11 11:08:13 +08:00
if (this.trendData.length) {
2023-08-25 16:22:20 +08:00
this.trendChartInit()
}
2023-09-11 11:08:13 +08:00
if (this.typeData.length) {
2023-08-25 16:22:20 +08:00
this.typeChartInit()
}
2023-08-25 15:40:14 +08:00
})
2023-08-22 09:26:17 +08:00
}
})
},
2023-09-07 10:59:25 +08:00
getGirdInfo() {
this.$http.post(`/app/apppatrolreportinfo/getRootByGirdMember`).then((res) => {
if (res.code == 0) {
this.selectGird.girdName = res.data.girdName
this.selectGird.id = res.data.id
this.$dict.load('clapEventStatusHistory').then(() => {
this.getStatistics()
})
}
})
},
2023-08-25 16:22:20 +08:00
finishChartInit() {
2023-08-24 11:02:37 +08:00
this.finishChart = echarts.init(document.getElementById('finish'))
var option = {
tooltip: {
trigger: 'item'
},
series: [
{
name: '事件办结率',
type: 'pie',
radius: ['30%', '60%'],
itemStyle: {
normal: {
color: function (colors) {
2023-08-25 16:22:20 +08:00
var colorList = ['#7E94F6', '#85E3D5', '#2891FF'];
2023-08-24 11:02:37 +08:00
return colorList[colors.dataIndex];
}
},
},
2023-08-25 14:49:21 +08:00
data: this.finishData,
2023-08-24 11:02:37 +08:00
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
}
}
}
]
};
this.finishChart.setOption(option)
2023-08-25 16:22:20 +08:00
},
2023-08-22 09:26:17 +08:00
2023-08-25 16:22:20 +08:00
trendChartInit() {
this.trendChart = echarts.init(document.getElementById('trend'))
2023-08-24 11:02:37 +08:00
var option2 = {
grid: {
left: '5%',
right: '5%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#E1E5EF', //x轴的颜色
width: 1, //轴线的宽度
},
},
axisLabel: {
show: true,
textStyle: {
color: '#666',
},
},
2023-08-25 14:49:21 +08:00
data: this.trendDataX
2023-08-24 11:02:37 +08:00
},
yAxis: {
2023-09-11 11:08:13 +08:00
axisLine: { //y轴
2023-08-24 11:02:37 +08:00
show: false
},
axisTick: {
show: false
},
axisLabel: {
show: true,
textStyle: {
color: '#666',
},
},
type: 'value',
},
tooltip: {
trigger: 'axis'
},
series: [
{
2023-08-25 14:49:21 +08:00
data: this.trendData,
2023-08-24 11:02:37 +08:00
type: 'line',
areaStyle: {//覆盖区域的渐变色
2023-09-11 11:08:13 +08:00
normal: {
color: {
type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
2023-08-24 11:02:37 +08:00
colorStops: [
{
offset: 0, color: 'rgba(58,132,255, 0.8)' // 0% 处的颜色
},
{
offset: 1, color: 'rgba(58,132,255, 0)' // 100% 处的颜色
}
],
global: false // 缺省为 false
2023-09-11 11:08:13 +08:00
},
}
2023-08-24 11:02:37 +08:00
},
lineStyle: {
normal: {
color: '#2891FF'
}
},
2023-09-11 11:08:13 +08:00
itemStyle: {
normal: {
color: '#2891FF',
2023-08-24 11:02:37 +08:00
}
}
}
]
};
this.trendChart.setOption(option2)
2023-08-25 16:22:20 +08:00
},
2023-08-24 11:02:37 +08:00
2023-08-25 16:22:20 +08:00
typeChartInit() {
this.typeChart = echarts.init(document.getElementById('type'))
2023-08-24 11:02:37 +08:00
var option3 = {
tooltip: {
trigger: 'item'
},
series: [
{
name: '巡查事件分类',
type: 'pie',
radius: ['0%', '70%'],
itemStyle: {
normal: {
color: function (colors) {
var colorList = ['#2891FF', '#FF8700', '#83B5F7', '#7E94F6', '#85E3D5', '#2891FF'];
return colorList[colors.dataIndex];
}
},
},
2023-08-25 14:49:21 +08:00
data: this.typeData,
2023-08-24 11:02:37 +08:00
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
}
}
}
]
};
this.typeChart.setOption(option3)
2023-08-22 09:26:17 +08:00
},
2023-08-24 11:02:37 +08:00
selectStatus(e) {
2023-08-25 14:49:21 +08:00
this.statusInfo.name = e[0].label
this.statusInfo.eventStatus = e[0].value
this.getStatistics()
2023-08-24 11:02:37 +08:00
},
2023-08-25 15:40:14 +08:00
handleSelectGird(v) {
2023-09-11 11:37:03 +08:00
this.selectGird = v || {}
2023-08-25 15:40:14 +08:00
this.getStatistics()
2023-09-05 14:15:00 +08:00
},
toList(row) {
2023-09-11 11:08:13 +08:00
var searchType = '', typeList = ['', '', '累计上报', '今日上报', '今日办结', '办理中']
2023-09-05 14:15:00 +08:00
typeList.map((item, index) => {
2023-09-11 11:08:13 +08:00
if (item == row.label) {
2023-09-05 14:15:00 +08:00
return searchType = index
}
})
uni.navigateTo({url: `./StatisticsList?title=${row.label}&searchType=${searchType}&girdId=${this.selectGird.id}`})
2023-08-25 15:40:14 +08:00
}
2023-08-22 09:26:17 +08:00
},
}
</script>
<style scoped lang="scss">
.statistics {
background-color: #F3F7F8;
2023-09-11 11:08:13 +08:00
2023-08-24 11:02:37 +08:00
.statstics-content {
padding: 30px 30px 0;
}
2023-09-11 11:08:13 +08:00
2023-08-24 11:02:37 +08:00
::v-deep .AiTopFixed {
.content {
background-color: #3975C6;
color: #fff;
}
2023-09-11 11:08:13 +08:00
.icon-img {
2023-08-24 11:02:37 +08:00
width: 48px;
height: 48px;
2023-08-22 09:26:17 +08:00
}
2023-08-24 11:02:37 +08:00
}
2023-09-11 11:08:13 +08:00
::v-deep .AiMore {
span {
2023-08-24 11:02:37 +08:00
color: #fff;
2023-08-22 09:26:17 +08:00
}
}
2023-09-11 11:08:13 +08:00
.info-content {
2023-08-22 09:26:17 +08:00
width: 100%;
background: #FFF;
border-radius: 16px;
margin-bottom: 24px;
2023-08-24 11:02:37 +08:00
position: relative;
2023-08-25 14:49:21 +08:00
padding-bottom: 32px;
2023-09-11 11:08:13 +08:00
.title {
2023-08-22 09:26:17 +08:00
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
line-height: 48px;
padding: 24px 16px 24px 24px;
2023-09-11 11:08:13 +08:00
img {
2023-08-22 09:26:17 +08:00
float: right;
width: 40px;
height: 40px;
}
2023-09-11 11:08:13 +08:00
2023-08-24 11:02:37 +08:00
.type-select {
font-size: 26px;
position: absolute;
top: 20px;
right: 32px;
width: calc(100% - 250px);
text-align: right;
line-height: 48px;
}
2023-08-22 09:26:17 +08:00
}
2023-09-11 11:08:13 +08:00
.el-row {
2023-08-22 09:26:17 +08:00
display: flex;
padding: 32px 0 60px 0;
2023-09-11 11:08:13 +08:00
.item {
2023-08-22 09:26:17 +08:00
flex: 1;
text-align: center;
2023-09-11 11:08:13 +08:00
h2 {
2023-08-22 09:26:17 +08:00
font-size: 64px;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: #3B424A;
line-height: 64px;
margin-bottom: 8px;
}
2023-09-11 11:08:13 +08:00
p {
2023-08-22 09:26:17 +08:00
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 40px;
}
}
}
2023-09-11 11:08:13 +08:00
2023-08-24 11:02:37 +08:00
.echart-content {
width: 100%;
2023-08-25 14:49:21 +08:00
height: 500px;
2023-08-22 09:26:17 +08:00
}
2023-09-11 11:08:13 +08:00
2023-08-24 11:02:37 +08:00
.num {
position: absolute;
left: 50%;
2023-08-25 14:49:21 +08:00
top: 320px;
2023-08-24 11:02:37 +08:00
margin-left: -100px;
font-size: 40px;
font-weight: 600;
width: 200px;
text-align: center;
2023-08-22 09:26:17 +08:00
}
}
2023-09-11 11:08:13 +08:00
.pad-b120 {
2023-08-22 09:26:17 +08:00
background-color: #F3F7F8;
padding-bottom: 120px;
}
}
</style>