20250523-修改会议管理数据统计中的会议室使用情况排序和部门开会情况数量

This commit is contained in:
luoyu 2025-05-23 15:33:49 +08:00
parent 2ea35864c3
commit 38faff747e

View File

@ -1,6 +1,6 @@
<template>
<div class='container'>
<a-card title='会议室管理'>
<a-card title='会议室管理' :bodyStyle="{ padding: '12px' }">
<a slot='extra'>
<a-date-picker @change='onChangeNumCount' :default-value='nowDate' />
</a>
@ -67,9 +67,9 @@
</a-col>
</a-row>
</a-card>
<a-row>
<a-row :gutter="[0, 16]">
<a-col :span='18'>
<a-card title='会议日历' bodyStyle='height: 780px'>
<a-card title='会议日历' :bodyStyle='{ height: "780px", padding: "0" }'>
<a-calendar :header-render='headerRender' @select='onSelect'>
<ul slot='dateCellRender' slot-scope='value' class='c_meeting'
style='padding: 0;text-align: center; font-size: 30px;font-weight: 700; margin-top: 6px'>
@ -89,7 +89,7 @@
</a-card>
</a-col>
<a-col :span='6'>
<a-card title='会议状态'>
<a-card title='会议状态' :bodyStyle="{ padding: '16px' }">
<a-row>
<a-col :span='18'>
<a-icon type='message' theme='filled' style='font-size: 24px;color: #E6A23C' />
@ -136,7 +136,7 @@
</a-col>
</a-row>
</a-card>
<a-card title='任务代办(会议审核)' bodyStyle='height: 554px'>
<a-card title='任务代办(会议审核)' :bodyStyle='{ height: "554px", padding: "0" }'>
<a-list item-layout='horizontal' :data-source='waitList'>
<a-list-item @click='goRes({status: "5"})' slot='renderItem' slot-scope='item, index'>
<!-- <a slot='actions'>审核</a>-->
@ -150,43 +150,43 @@
</a-card>
</a-col>
</a-row>
<a-card title='数据统计'>
<a-card title='数据统计' :bodyStyle="{ padding: '12px' }">
<a slot='extra'>
<a-range-picker @change='onChangeChartCount' :default-value='[nowMonthStart,nowMonthEnd]' />
</a>
</a-card>
<a-row>
<a-row :gutter="[16, 16]">
<a-col :span='8'>
<a-card title='会议室使用排名'>
<div id='chartUse' style='width: 100%; height: 500px'></div>
<a-card title='会议室使用情况' class="chart-card" :bodyStyle="{ padding: '0' }">
<div id='chartUse' class="responsive-chart" style='width: 100%; height: 650px'></div>
</a-card>
</a-col>
<a-col :span='16'>
<a-row>
<a-row :gutter="[16, 16]">
<a-col :span='12'>
<a-card title='服务情况'>
<div id='chartServe' style='width: 100%; height: 200px'></div>
<a-card title='服务情况' class="chart-card" :bodyStyle="{ padding: '0' }">
<div id='chartServe' class="responsive-chart" style='width: 100%; height: 225px'></div>
</a-card>
</a-col>
<a-col :span='12'>
<a-card title='形式统计'>
<div id='chartType' style='width: 100%; height: 200px'></div>
<a-card title='形式统计' class="chart-card" :bodyStyle="{ padding: '0' }">
<div id='chartType' class="responsive-chart" style='width: 100%; height: 225px'></div>
</a-card>
</a-col>
</a-row>
<a-row>
<a-row :gutter="[16, 16]">
<a-col :span='24'>
<a-card title='部门开会情况'>
<div id='chartDep' style='width: 100%; height: 194px'></div>
<a-card title='部门开会情况' class="chart-card" :bodyStyle="{ padding: '0' }">
<div id='chartDep' class="responsive-chart" style='width: 100%; height: 325px'></div>
</a-card>
</a-col>
</a-row>
</a-col>
</a-row>
<a-row>
<a-row :gutter="[16, 16]">
<a-col :span='24'>
<a-card title='开会情况'>
<div id='chartMeeting' style='width: 100%; height: 300px'></div>
<a-card title='开会情况' class="chart-card" :bodyStyle="{ padding: '0' }">
<div id='chartMeeting' class="responsive-chart" style='width: 100%; height: 300px'></div>
</a-card>
</a-col>
</a-row>
@ -194,6 +194,14 @@
</div>
</template>
<style>
.container {
padding: 0;
}
.ant-card {
margin-bottom: 16px;
}
.eachNum {
margin-left: 50px;
}
@ -237,6 +245,28 @@
padding: 2px 5px;
font-size: 0.8rem;
}
/* 响应式图表样式 */
.chart-card {
margin-bottom: 16px;
}
.responsive-chart {
min-height: 200px;
}
@media (max-width: 1200px) {
.responsive-chart {
height: auto !important;
min-height: 300px;
}
}
@media (max-width: 768px) {
.responsive-chart {
min-height: 250px;
}
}
</style>
<script>
import * as echarts from 'echarts'
@ -276,7 +306,9 @@ export default {
closed: 0,
wait: 0
}, //
waitList: [] //
waitList: [], //
resizeTimer: null, //
charts: [] //
}
},
mounted() {
@ -285,9 +317,28 @@ export default {
this.getStatusCount()
this.getWaitList()
this.getChartCount()
// this.drawChart()
//
window.addEventListener('resize', this.handleResize)
},
beforeDestroy() {
//
window.removeEventListener('resize', this.handleResize)
},
methods: {
//
handleResize() {
if (this.resizeTimer) {
clearTimeout(this.resizeTimer)
}
this.resizeTimer = setTimeout(() => {
// 使
this.charts.forEach(chart => {
if (chart && !chart.isDisposed()) {
chart.resize()
}
})
}, 200) // 200ms
},
onSelect(nowDate) {
let date = nowDate.format('YYYY-MM-DD')
this.goRes({ date: date })
@ -452,33 +503,99 @@ export default {
* 获取统计图数据
*/
getChartCount() {
console.log('调用图表统计接口,请求参数:', {
startDate: this.nowMonthStart,
endDate: this.nowMonthEnd
});
//
this.charts.forEach(chart => {
if (chart && !chart.isDisposed()) {
chart.dispose()
}
})
this.charts = []
getChartData({
startDate: this.nowMonthStart,
endDate: this.nowMonthEnd
}).then(res => {
console.log('图表统计接口返回数据:', res);
console.log('会议室使用排名数据:', res.data.roomRank);
this.drawChart(res.data)
}).catch(error => {
console.error('图表统计接口调用失败:', error);
})
},
drawChart(data) {
// 使
try {
// 使
let chartUse = echarts.init(document.getElementById('chartUse'))
let useData = data.roomRank
//
this.charts.push(chartUse)
console.log('绘制会议室使用情况图表,原始数据:', useData);
// 使1
if (useData && useData.y && useData.total) {
useData.y.reverse()
useData.total.reverse()
console.log('反转后的会议室数据:', useData);
}
//
let yAxisLabels = []
let seriesData = []
if (useData && useData.y && useData.total) {
console.log('会议室名称列表:', useData.y);
console.log('会议室使用次数列表:', useData.total);
for (let i = 0; i < useData.y.length; i++) {
// 使+
yAxisLabels.push(useData.y[i])
//
seriesData.push({
value: useData.total[i],
itemStyle: {
color: '#87CEEB' //
}
});
}
console.log('处理后的图表数据:', {
yAxisLabels: yAxisLabels,
seriesData: seriesData
});
} else {
console.warn('会议室使用情况数据不完整或为空');
}
let chartUseOp = {
title: {
left: 'center',
top: '10px'
},
tooltip: {
trigger: 'item',
formatter: '{b}<br />会议场次 : {c} 次'
},
yAxis: {
type: 'category',
data: useData.y
data: yAxisLabels,
axisLabel: {
interval: 0,
rotate: 0
}
},
xAxis: {
type: 'value'
},
grid: {
top: '0',
top: '60px',
left: '2%',
right: '2%',
bottom: '1%',
@ -486,21 +603,25 @@ export default {
},
series: [
{
data: useData.total,
data: seriesData.length > 0 ? seriesData : useData.total,
type: 'bar',
label: {
show: true, //
position: 'inside' //
position: 'right' //
},
barWidth: '20px',
itemStyle: {
color: '#50B5FF', //
color: '#87CEEB', //
borderRadius: [0, 5, 5, 0] //
}
}
]
}
chartUse.setOption(chartUseOp)
} catch (error) {
console.error('绘制会议室使用情况图表出错:', error);
}
//
let chartServe = echarts.init(document.getElementById('chartServe'))
let serveData = data.serve
@ -557,6 +678,8 @@ export default {
]
}
chartServe.setOption(chartServeOp)
//
this.charts.push(chartServe)
//
let chartType = echarts.init(document.getElementById('chartType'))
let typeData = data.roomType
@ -618,26 +741,38 @@ export default {
]
}
chartType.setOption(chartTypeOp)
//
this.charts.push(chartType)
//
let chartDep = echarts.init(document.getElementById('chartDep'))
let depData = data.orgMeeting
let chartDepOp = {
title: {
// text: '20',
left: 'center',
top: '10px'
},
tooltip: {
trigger: 'item',
formatter: '{b}<br />会议场次 : {c} 次'
},
xAxis: {
type: 'category',
data: depData.x
data: depData.x,
axisLabel: {
interval: 0,
rotate: 45, //
fontSize: 12 //
}
},
yAxis: {
type: 'value'
},
grid: {
top: '3%',
top: '60px', //
left: '2%',
right: '2%',
bottom: '0%',
bottom: '20%', //
containLabel: true
},
series: [
@ -645,10 +780,12 @@ export default {
data: depData.total,
label: {
show: true, //
position: 'inside' //
position: 'top', //
fontSize: 12, //
formatter: '{c}' //
},
type: 'bar',
barWidth: '20px',
barWidth: '15px', //
itemStyle: {
color: '#FFEC6D' //
}
@ -656,6 +793,8 @@ export default {
]
}
chartDep.setOption(chartDepOp)
//
this.charts.push(chartDep)
//
let chartMeeting = echarts.init(document.getElementById('chartMeeting'))
let meetingData = data.everyDay
@ -701,6 +840,8 @@ export default {
]
}
chartMeeting.setOption(chartMeetingOp)
//
this.charts.push(chartMeeting)
}
}
}