Files
dvcp_v2_webapp/project/qujing/app/AppLearningStatistics/AppLearningStatistics.vue

444 lines
13 KiB
Vue
Raw Normal View History

2023-02-10 10:04:51 +08:00
<template>
2023-02-15 14:45:02 +08:00
<ai-list class="AppLearningStatistics">
2023-02-10 10:04:51 +08:00
<template slot="title">
2023-02-20 17:51:52 +08:00
<ai-title title="学习统计" isShowBottomBorder isShowArea :hideLevel="user.info.areaList.length - 1" v-model="areaId" :instance="instance" @change="onChange()"></ai-title>
2023-02-10 10:04:51 +08:00
</template>
<template slot="content">
2023-02-15 14:45:02 +08:00
<ai-card title="关键数据">
2023-02-10 10:04:51 +08:00
<template #right>
2023-02-17 10:37:35 +08:00
<el-radio-group v-model="search1.dateRange" size="small" @change="search1.date = [], getStatisticsKeyData()">
2023-02-16 15:15:16 +08:00
<el-radio-button label="0">今天</el-radio-button>
<el-radio-button label="1">本周</el-radio-button>
<el-radio-button label="2">本月</el-radio-button>
</el-radio-group>
2023-02-15 14:45:02 +08:00
<el-date-picker
2023-02-16 15:15:16 +08:00
style="width: 240px"
v-model="search1.date"
2023-02-15 14:45:02 +08:00
value-format="yyyy-MM-dd"
2023-02-17 10:37:35 +08:00
@change="search1.dateRange = '', getStatisticsKeyData()"
2023-02-16 15:15:16 +08:00
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small">
2023-02-15 14:45:02 +08:00
</el-date-picker>
</template>
<template #content>
<div class="statistic ">
<div class="statistic-item">
<h2>课程数量</h2>
<div class="bottom">
<div class="bottom-item">
2023-02-17 10:37:35 +08:00
<h3>{{ statisticsKeyData['视频课程'] }}</h3>
2023-02-15 14:45:02 +08:00
<p>视频课程</p>
</div>
<div class="bottom-item">
2023-02-17 10:37:35 +08:00
<h3>{{ statisticsKeyData['图文课程'] }}</h3>
2023-02-15 14:45:02 +08:00
<p>图文课程</p>
</div>
</div>
</div>
<div class="statistic-item">
<h2>课程学习人数</h2>
<div class="bottom">
<div class="bottom-item">
2023-02-17 10:37:35 +08:00
<h3>{{ statisticsKeyData['课程学习人数'] }}</h3>
2023-02-15 14:45:02 +08:00
</div>
</div>
</div>
<div class="statistic-item">
2023-02-17 10:37:35 +08:00
<h2>课程累积学习时长</h2>
2023-02-15 14:45:02 +08:00
<div class="bottom">
<div class="bottom-item">
2023-02-17 10:37:35 +08:00
<h3>{{ statisticsKeyData['课程累积学习时长'] || 0 }}</h3>
2023-02-15 14:45:02 +08:00
</div>
</div>
</div>
<div class="statistic-item">
2023-04-19 09:15:06 +08:00
<h2>考试人次</h2>
2023-02-15 14:45:02 +08:00
<div class="bottom">
2023-02-17 10:37:35 +08:00
<div class="bottom-item">
2023-03-22 17:00:39 +08:00
<h3>{{ statisticsKeyData['学富五车'] }}</h3>
<p>学富五车</p>
2023-02-17 10:37:35 +08:00
</div>
<div class="bottom-item">
2023-03-22 17:00:39 +08:00
<h3>{{ statisticsKeyData['才高八斗'] }}</h3>
<p>才高八斗</p>
2023-02-17 10:37:35 +08:00
</div>
<div class="bottom-item">
<h3>{{ statisticsKeyData['合格'] }}</h3>
<p>合格</p>
</div>
<div class="bottom-item">
<h3>{{ statisticsKeyData['不合格'] }}</h3>
<p>不合格</p>
2023-02-15 14:45:02 +08:00
</div>
</div>
</div>
<div class="statistic-item">
<h2>获得证书人数</h2>
<div class="bottom">
<div class="bottom-item">
2023-03-22 17:00:39 +08:00
<h3>{{ statisticsKeyData['获得证书人数'] }}</h3>
2023-05-11 11:09:16 +08:00
<ai-download
:instance="instance"
url="/app/appcertificateinfo/exportUserInfo"
2023-05-11 13:57:00 +08:00
:params="{
...search1,
areaId
}"
2023-05-11 11:09:16 +08:00
fileName="证书统计">
<el-button icon="iconfont iconExported">导出</el-button>
</ai-download>
2023-02-15 14:45:02 +08:00
</div>
</div>
</div>
</div>
2023-02-10 10:04:51 +08:00
</template>
2023-02-15 14:45:02 +08:00
</ai-card>
<div class="middle">
<ai-card class="rank-card" title="热度榜单">
<template #title>
<div class="rank-title">
<h2>热度榜单</h2>
2023-02-17 10:37:35 +08:00
<el-radio-group v-model="type" size="small" @change="search2.date = [], getStatisticsHot()">
2023-02-16 15:15:16 +08:00
<el-radio-button :label="0">课程</el-radio-button>
<el-radio-button :label="1">考试</el-radio-button>
2023-02-15 14:45:02 +08:00
</el-radio-group>
2023-02-10 10:04:51 +08:00
</div>
</template>
2023-02-15 14:45:02 +08:00
<template #right>
2023-02-17 10:37:35 +08:00
<el-radio-group v-model="search2.dateRange" size="small" @change="search2.date = [], getStatisticsHot()">
2023-02-16 15:15:16 +08:00
<el-radio-button label="0" >今天</el-radio-button>
<el-radio-button label="1">本周</el-radio-button>
<el-radio-button label="2">本月</el-radio-button>
2023-02-15 14:45:02 +08:00
</el-radio-group>
<el-date-picker
2023-02-16 15:15:16 +08:00
style="width: 240px"
v-model="search2.date"
2023-02-15 14:45:02 +08:00
value-format="yyyy-MM-dd"
2023-02-20 16:41:35 +08:00
@change="search2.dateRange = '', getStatisticsHot()"
2023-02-16 15:15:16 +08:00
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small">
2023-02-15 14:45:02 +08:00
</el-date-picker>
</template>
<template #content>
<ai-table
2023-02-16 15:15:16 +08:00
v-if="type === 0"
:tableData="tableData1"
:col-configs="colConfigs1"
:isShowPagination="false"
2023-02-15 14:45:02 +08:00
style="margin-top: 6px;"
2023-02-16 15:15:16 +08:00
@getList="getStatisticsHot">
</ai-table>
<ai-table
v-else
:tableData="tableData2"
2023-02-16 15:41:18 +08:00
:isShowPagination="false"
2023-02-16 15:15:16 +08:00
:col-configs="colConfigs2"
style="margin-top: 6px;"
@getList="getStatisticsHot">
2023-02-15 14:45:02 +08:00
</ai-table>
</template>
</ai-card>
<ai-card class="resident" title="居民统计">
<template #right>
2023-02-17 13:58:15 +08:00
<el-radio-group v-model="search4.dateRange" size="small" @change="search4.date = [], getStatisticsUse()">
2023-02-16 15:15:16 +08:00
<el-radio-button label="0" >今天</el-radio-button>
<el-radio-button label="1">本周</el-radio-button>
<el-radio-button label="2">本月</el-radio-button>
</el-radio-group>
<el-date-picker
style="width: 240px"
v-model="search4.date"
value-format="yyyy-MM-dd"
2023-02-17 13:58:15 +08:00
@change="search4.dateRange = '', getStatisticsUse()"
2023-02-16 15:15:16 +08:00
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small">
</el-date-picker>
2023-02-15 14:45:02 +08:00
</template>
<template #content>
2023-02-16 15:15:16 +08:00
<div class="chart" style="width: 100%; height: 340px"></div>
2023-02-15 14:45:02 +08:00
</template>
</ai-card>
</div>
2023-02-10 10:04:51 +08:00
</template>
</ai-list>
</template>
<script>
2023-02-15 17:16:53 +08:00
import { mapState } from 'vuex'
2023-02-17 13:55:35 +08:00
import * as echarts from 'echarts'
2023-02-10 10:04:51 +08:00
export default {
name: 'AppLearningStatistics',
label: '学习统计',
props: {
instance: Function,
dict: Object
},
data () {
return {
2023-02-15 14:45:02 +08:00
date: '',
2023-02-16 15:15:16 +08:00
today: '',
search1: {
2023-02-10 10:04:51 +08:00
title: '',
2023-02-16 15:15:16 +08:00
areaId: '',
2023-02-17 15:27:32 +08:00
dateRange: '1',
2023-02-16 15:15:16 +08:00
date: []
},
search2: {
areaId: '',
2023-02-17 15:27:32 +08:00
dateRange: '1',
2023-02-16 15:15:16 +08:00
date: []
2023-02-10 10:04:51 +08:00
},
2023-02-16 15:15:16 +08:00
search3: {
areaId: '',
2023-02-17 15:27:32 +08:00
dateRange: '1',
2023-02-16 15:15:16 +08:00
date: []
},
search4: {
areaId: '',
2023-02-17 15:27:32 +08:00
dateRange: '1',
2023-02-16 15:15:16 +08:00
date: []
},
type: 0,
colConfigs1: [
{ type: 'index', label: '排名', align: 'left' },
2023-02-17 16:11:23 +08:00
{ prop: 'name', label: '课程名称', align: 'center' },
2023-02-17 10:37:35 +08:00
{ prop: 'number', label: '学习人数', align: 'center' }
2023-02-16 15:15:16 +08:00
],
colConfigs2: [
2023-02-15 14:45:02 +08:00
{ type: 'index', label: '排名', align: 'left' },
2023-02-17 16:11:23 +08:00
{ prop: 'name', label: '考试名称', align: 'center' },
2023-04-19 09:15:06 +08:00
{ prop: 'number', label: '考试人次', align: 'center' }
2023-02-10 10:04:51 +08:00
],
2023-02-16 15:15:16 +08:00
tableData1: [],
tableData2: [],
2023-02-17 13:55:35 +08:00
statisticsKeyData: {},
2023-02-20 10:55:12 +08:00
statisticsUse: {},
areaId: ''
2023-02-10 10:04:51 +08:00
}
},
2023-02-15 17:16:53 +08:00
computed: {
...mapState(['user'])
},
2023-02-16 15:15:16 +08:00
created () {
2023-02-20 10:55:12 +08:00
this.areaId = this.user.info.areaId
2023-02-16 15:15:16 +08:00
this.getStatisticsKeyData()
this.getStatisticsHot()
2023-02-17 13:55:35 +08:00
this.getStatisticsUse()
2023-02-10 10:04:51 +08:00
},
methods: {
2023-02-20 10:55:12 +08:00
onChange () {
this.getStatisticsKeyData()
this.getStatisticsHot()
this.getStatisticsUse()
},
2023-02-16 15:15:16 +08:00
getStatisticsKeyData () {
this.instance.post(`/app/appexaminationinfo/statisticsKeyData`, null, {
2023-02-10 10:04:51 +08:00
params: {
2023-02-16 15:15:16 +08:00
...this.search1,
2023-02-20 17:09:23 +08:00
beginDate: this.search1.date ? this.search1.date[0] : '',
endDate: this.search1.date ? this.search1.date[1] : '',
2023-02-20 10:55:12 +08:00
areaId: this.areaId
2023-02-10 10:04:51 +08:00
}
}).then(res => {
if (res.code == 0) {
2023-02-16 15:15:16 +08:00
this.statisticsKeyData = res.data
2023-02-10 10:04:51 +08:00
}
})
},
2023-02-17 13:55:35 +08:00
getStatisticsUse () {
this.instance.post(`/app/appwechatuserqujing/statisticsUse`, null, {
params: {
...this.search4,
2023-02-20 17:09:23 +08:00
beginDate: this.search4.date ? this.search4.date[0] : '',
endDate: this.search4.date ? this.search4.date[1] : '',
2023-02-20 10:55:12 +08:00
areaId: this.areaId
2023-02-17 13:55:35 +08:00
}
}).then(res => {
if (res.code == 0) {
res.data.length && this.initPieChart(res.data[0])
}
})
},
2023-02-16 15:15:16 +08:00
getStatisticsHot () {
this.instance.post(`/app/appexaminationinfo/statisticsHot`, null, {
2023-02-10 10:04:51 +08:00
params: {
2023-02-16 15:15:16 +08:00
...this.search2,
2023-02-17 10:37:35 +08:00
size: 20,
2023-02-20 10:55:12 +08:00
areaId: this.areaId,
2023-02-17 10:37:35 +08:00
type: this.type,
2023-02-20 17:09:23 +08:00
beginDate: this.search2.date ? this.search2.date[0] : '',
endDate: this.search2.date ? this.search2.date[1] : '',
2023-02-16 15:15:16 +08:00
}
}).then(res => {
if (res.code == 0) {
2023-02-17 10:37:35 +08:00
if (this.type === 0) {
this.tableData1 = res.data
} else {
this.tableData2 = res.data
}
2023-02-10 10:04:51 +08:00
}
})
},
2023-02-16 15:15:16 +08:00
initPieChart (data) {
let chart = echarts.init(document.querySelector('.chart'))
const option = {
tooltip: {},
color: ['#2896FF', '#09DBFE', '#61FDB9', '#FFBB69', '#8429FF', '#ea7ccc'],
legend: {
2023-02-17 13:55:35 +08:00
show: true
2023-02-16 15:15:16 +08:00
},
series: [
{
type: 'pie',
radius: '50%',
2023-02-17 13:55:35 +08:00
data: Object.keys(data).map(v => {
2023-02-16 15:15:16 +08:00
return {
2023-02-17 13:55:35 +08:00
value: data[v],
name: v
2023-02-16 15:15:16 +08:00
}
}),
label : {
normal : {
2023-02-20 15:13:31 +08:00
formatter: '{b}{c}',
2023-02-16 15:15:16 +08:00
textStyle : {
fontWeight : 'normal',
fontSize : 15
}
}
}
}
]
}
chart.setOption(option)
2023-02-10 10:04:51 +08:00
}
}
}
</script>
<style lang="scss" scoped>
2023-02-15 14:45:02 +08:00
.AppLearningStatistics {
.right-search {
display: flex;
align-items: center;
div {
display: flex;
align-items: center;
}
span {
margin-right: 10px;
font-size: 14px;
color: #686868;
}
div:first-child {
margin-right: 20px;
}
}
.middle {
display: flex;
.rank-card {
flex: 1;
}
.resident {
2023-02-17 13:55:35 +08:00
width: 660px;
2023-02-15 14:45:02 +08:00
margin-left: 20px;
}
}
.rank-title {
display: flex;
align-items: center;
h2 {
margin-right: 32px;
color: #222;
font-size: 16px;
font-weight: 700;
}
}
:deep(.ai-list__content--right .ai-list__content--right-wrapper ) {
padding: 0!important;
background: transparent!important;
border-radius: 0!important;
box-shadow: none!important;
}
.statistic {
display: flex;
justify-content: space-between;
.statistic-item {
text-align: center;
line-height: 1;
h2 {
color: #333;
font-weight: 600;
font-size: 16px;
}
h3 {
font-size: 22px;
color: #FFA322;
}
p {
margin-top: 10px;
2023-02-16 15:15:16 +08:00
word-break: keep-all;
2023-02-15 14:45:02 +08:00
color: #777;
font-size: 14px;
}
.bottom {
display: flex;
align-items: center;
justify-content: center;
margin: 30px 0 10px;
.bottom-item {
flex: 1;
margin-right: 30px;
&:last-child {
margin-right: 0;
}
}
}
}
}
:deep( .ai-list__content--right ){
flex: 1;
min-width: 0;
margin-left: 1px;
box-shadow: none;
.ai-list__content--right-wrapper {
width: 100%;
}
}
}
2023-02-10 10:04:51 +08:00
</style>