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