Compare commits

...

8 Commits

4 changed files with 2112 additions and 2 deletions

View File

@ -334,7 +334,7 @@
},
},
title: {
text: '该批次每一年级的通过率图',
text: '该批次每一年级的通过率环形图',
left: 'top',
top: '0%',
textStyle: {
@ -352,7 +352,7 @@
series: [
{
name: '学院/专业该批次通过人数图',
name: '学院/专业该批次通过人数环形图',
type: 'pie',
radius: ['50%', '100%'],
center: ['50%', '50%'],

View File

@ -0,0 +1,408 @@
<template>
<div style="background: #ececec; padding: 15px">
<a-card title="四级总通过率查询" :loading="loading" :bordered="false">
<template #extra>
<a-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-select />
<a-select v-model:value="entrydate" style="margin-left: 10px; width: 100px" :options="entrydateOptions" />
<a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
<!-- <a-button @click=test()>test</a-button> -->
</template>
<a-row :gutter="12">
<a-col :xl="13">
<div style="padding-left: 10px; min-height: 400px">
<div v-if="topCollege != null" style="margin-bottom: 5px">
<span style="font-size: 15px">当前数据为 </span>
<span style="color: red; font-size: 18px">{{ topCollege }}</span>
<span v-if="topMajor != null && topMajor != ''" style="color: red; font-size: 18px"> / {{ topMajor
}}</span>
<span style="font-size: 15px"> </span>
<span style="color: red; font-size: 20px">{{ topEntrydate }}</span>
<span style="font-size: 15px"> 级数据</span>
</div>
<a-table :dataSource="dataSourceCet4" :columns="columns" :pagination="false" bordered>
<template #passRateSlot>
累计总通过率
<a-tooltip :title="'累计通过人数 / ' + totalName + '总人数'" placement="top">
<a-icon type="question-circle" />
</a-tooltip>
</template>
</a-table>
<div style="display: flex; justify-content: space-between; font-size: 15px; margin-top: 10px"
v-if="total && total > 0">
<span>{{ totalName }}总人数{{ total }}</span>
<span>累计通过人数: {{ passNumberBottom }}</span>
<span>累计总通过率: {{ passRateBottom }}</span>
</div>
</div>
</a-col>
<a-col :xl="11">
<a-card style="margin-top: 33px; margin-bottom: 12px">
<div style="width: 100%; height: 215px" class="piechart" id="piechart"> </div>
</a-card>
<a-card>
<div style="width: 100%; height: 180px" id="map2"> </div>
</a-card>
</a-col>
</a-row>
<!-- <div style="height: 300px;">
<a-empty style="margin-top: 100px" />
</div> -->
</a-card>
</div>
</template>
<script>
import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts';
export default {
data() {
return {
loading: false,
dataSourceCet4: [],
columns: [
{
title: '学年',
dataIndex: 'grade',
key: 'grade',
align: 'center',
customCell: (_, index) => ({
rowSpan: index % 2 === 0 ? 2 : 0, //graderowSpan
}),
},
{
title: '考试批次',
dataIndex: 'batch',
key: 'batch',
align: 'center',
},
{
title: '参加人数',
dataIndex: 'attendNumber',
key: 'attendNumber',
align: 'center',
},
{
title: '通过人数',
dataIndex: 'passNumber',
key: 'passNumber',
align: 'center',
},
{
title: '本批次通过率',
dataIndex: 'batchpassrate',
key: 'batchpassrate',
align: 'center',
},
{
slots: { title: 'passRateSlot' },
dataIndex: 'gradepassrate',
key: 'gradepassrate',
align: 'center',
customCell: (_, index) => ({
rowSpan: index % 2 === 0 ? 2 : 0,
}),
},
],
Url: {
getEntrydate: '/cet/getEntrydate',
getCollege: '/cet/getCollege',
getData: '/cet/getData',
getCollegeMajor: '/cet/getCollegeMajor',
},
total: 0,
totalName: '',
passNumberBottom: 0,
passRateBottom: 0,
passRatePie: [],
lineXData: [],
lineYData: [],
collegeOptions: [],
collegeMajorOptions: [],
entrydateOptions: [],
college: null,
entrydate: 2017, //
//
collegeMajor: ['全校'], //
topCollege: null, //
topMajor: null, //
topEntrydate: null, //
};
},
mounted() {
this.getEntrydateAndCollegeData();
this.getCollegeMajorData();
this.query();
//this.map2Chart();
},
methods: {
//
async getEntrydateAndCollegeData() {
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
const getCollege = await defHttp.get({ url: this.Url.getCollege });
this.collegeOptions = getCollege.colleges;
//
this.collegeOptions.unshift({ value: '全校', label: '全校' });
this.college = this.collegeOptions[0].value;
this.entrydateOptions = getEntrydate.entrydates;
// this.entrydate = this.entrydateOptions[0].value;
},
//
async getCollegeMajorData() {
const res = await defHttp.get({ url: this.Url.getCollegeMajor });
//map
this.collegeMajorOptions = res.collegeMajor.map((item) => {
return {
value: item.college,
label: item.college,
children: item.major.map((major) => {
return {
value: major,
label: major,
};
}),
};
});
//
this.collegeMajorOptions.unshift({ value: '专升本', label: '专升本' });
//
this.collegeMajorOptions.unshift({ value: '全校', label: '全校' });
// this.collegeMajor = [''];
console.log(this.collegeMajorOptions);
},
//
async query() {
try {
//this.collegeMajor[1]null
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : '';
this.topCollege = this.collegeMajor[0];
this.topMajor = major;
this.topEntrydate = this.entrydate;
if (this.college) this.loading = true;
let params = {
college: this.collegeMajor[0],
major: major,
entrydate: this.entrydate,
};
console.log('params', params);
const result = await defHttp.get({ url: this.Url.getData, params });
let tableData = [];
let piedata = [];
let passrate = 0;
let index = 0;
const passRate = {};
if (result.cet4['大一学年'] != undefined) {
passRate['大一学年'] = result.cet4['大一学年'];
}
if (result.cet4['大二学年'] != undefined) {
passRate['大二学年'] = result.cet4['大二学年'];
}
if (result.cet4['大三学年'] != undefined) {
passRate['大三学年'] = result.cet4['大三学年'];
}
if (result.cet4['大四学年'] != undefined) {
passRate['大四学年'] = result.cet4['大四学年'];
}
result.cet4 = passRate;
this.lineXData = [];
this.lineYData = [];
for (let grade in result.cet4) {
result.cet4[grade].forEach((item) => {
this.lineXData.push(item.batch);
this.lineYData.push((item.batchpassrate * 100).toFixed(1));
if (index % 2 == 0) {
piedata.push({ value: parseFloat(item.gradepassrate - passrate).toFixed(3), name: grade + '时通过' });
passrate = parseFloat(item.gradepassrate).toFixed(3);
}
index++;
tableData.push({
grade: grade,
attendNumber: item.attendNumber,
batch: item.batch,
gradepassrate: (item.gradepassrate * 100).toFixed(1) + '%',
passNumber: item.passNumber,
batchpassrate: (item.batchpassrate * 100).toFixed(1) + '%',
});
});
}
console.log('tableData', tableData);
this.dataSourceCet4 = tableData; //
this.total = result.total; //
this.totalName = result.totalName; //
this.passNumberBottom = result.passNumber; //
this.passRateBottom = (result.passRate * 100).toFixed(1) + '%'; //
//
this.passRatePie = []; //
this.passRatePie.push({ value: result.passRate, name: '已通过' });
this.passRatePie.push({ value: 1 - result.passRate, name: '未通过' });
piedata.push({ value: (1 - passrate).toFixed(3), name: '未通过' }); //
setTimeout(() => {
this.drawPieChart(piedata);
this.map2Chart();
}, 100);
// this.drawPieChart();
} finally {
this.loading = false;
}
},
test() {
defHttp.get({ url: '/cet/getTest' });
},
map2Chart() {
var myChart = echarts.init(document.getElementById('map2'));
var option = {
title: {
text: '各批次通过率分析',
left: 'left',
top: '0%',
textStyle: {
fontSize: 16,
},
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
return (
params[0].name +
'<br/>' +
'<table>' +
'<tr><td>' +
params[0].marker +
'</td><td style="font-weight: bold;">' +
'&nbsp;&nbsp;&nbsp;&nbsp;' +
params[0].value +
'%' +
'</td></tr>' +
'<tr>' +
'</table>'
);
},
},
grid: {
top: '50px',
left: '50px',
right: '50px',
bottom: '30px',
},
xAxis: {
type: 'category',
data: this.lineXData,
},
yAxis: {
type: 'value',
},
series: [
{
data: this.lineYData,
type: 'line',
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
textStyle: {
//
color: 'black',
fontSize: 12,
},
formatter: '{c}%',
},
},
},
},
],
};
option && myChart.setOption(option);
},
drawPieChart(piedata) {
console.log(this.passRatePie);
console.log('piedata', piedata);
let myChart = echarts.init(document.getElementById('piechart'));
let option = {
tooltip: {
trigger: 'item',
confine: false,
avoidLabelOverlap: true,
//
itemStyle: {
fontSize: 100,
},
},
title: {
text: '四级通过率分析',
left: 'left',
top: '0%',
textStyle: {
fontSize: 16,
},
},
legend: {
top: 'center',
right: '0%',
orient: 'vertical',
},
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [
//
{
name: '四级通过率',
type: 'pie',
center: ['30%', '50%'],
radius: ['35%', '70%'],
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2,
},
label: {
show: true,
fontSize: 14,
overflow: 'truncate',
minMargin: -1,
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
label: {
show: true,
fontSize: 15,
fontWeight: 'bold',
},
},
data: piedata,
},
],
};
myChart.setOption(option);
},
},
};
</script>
<style lang="less" scoped>
.container {
display: flex;
background-color: #fff;
padding: 15px;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
.title {
font-size: 34px;
color: rgb(8, 8, 8);
font-weight: bold;
}
</style>

View File

@ -0,0 +1,720 @@
<template>
<a-card>
<a-row :gutter="1">
<a-card class="card-center" :loading="loadingTable">
<div>
<h style="margin-left: 70px; font-size: 14; font-weight: bold" class="table-title">最新批次各年级数据表格</h>
<a-table
:dataSource="dataSourceCet4"
:columns="columns"
:pagination="false"
bordered
class="custom-table"
:style="{ fontSize: '10px', color: '#333', marginTop: '11px' }"
/>
</div>
</a-card>
<a-card class="card-center" :loading="loadingMap2">
<div style="width: 100%; height: 210px; padding: 10px" class="map2" id="map2"></div>
</a-card>
<a-card class="card-center" :loading="loadingMap3">
<a-select
v-model:value="entrydate"
style="border-radius: 10%; width: 100px; margin-left: 220px"
:options="entrydateOptions"
@change="handleSelectChange"
/>
<div id="map3" style="width: 100%; height: 230px"></div>
</a-card>
</a-row>
<a-row :gutter="1">
<a-card class="card-bottom" style="width: 32%" :loading="loadingMap4">
<div id="map4" style="width: 100%; height: 300%"></div>
</a-card>
<a-card style="width: 65%" class="card-bottom" :loading="loadingMap5">
<div id="map5" style="width: 100%; height: 300%"></div>
</a-card>
</a-row>
</a-card>
</template>
<script>
import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts';
export default {
data() {
return {
roleName: null,
collegeStudentCount: '11',
collegeStudentPassCount: '11',
collegeStudentPassRate: '11',
schoolStudentPassRate: '11',
loadingTable: false,
loadingMap2: false,
loadingMap3: false,
loadingMap4: false,
loadingMap5: false,
dataSourceCet4: [],
batch: '',
college: '',
majors: [],
majorentrydate: [],
entrydate: '2017',
entrydateOptions: [],
columns: [
{
title: '年级',
dataIndex: 'grade',
key: 'grade',
align: 'center',
},
{
title: '参加人数',
dataIndex: 'attendNumber',
key: 'attendNumber',
align: 'center',
},
{
title: '通过人数',
dataIndex: 'passNumber',
key: 'passNumber',
align: 'center',
},
{
title: '通过率',
dataIndex: 'passrate',
key: 'passrate',
align: 'center',
},
],
Url: {
getDataForHead: '/cet/getDataForHLeadersHome',
getData: '/cet/getRateByBatch',
getRateByMajor: '/cet/getRateByMajor',
getCollegeRate: '/cet/getRateByCollege',
getEntrydate: '/cet/getEntrydate',
getCollegeMajor: '/cet/getCollegeMajor',
getUserInfo: '/sys/user/getUserInfo',
queryUserRole: '/sys/user/queryUserRole',
queryById: '/sys/role/queryById',
},
};
},
mounted() {
this.query();
},
methods: {
//
async query() {
this.loadingTable = true;
this.loadingMap2 = true;
this.loadingMap3 = true;
this.loadingMap4 = true;
this.loadingMap5 = true;
let resultData = null;
let userInfoResult = await defHttp.get({ url: this.Url.getUserInfo });
console.log('123', userInfoResult.userInfo.id);
let id = userInfoResult.userInfo.id;
let roleId = await defHttp.get({ url: this.Url.queryUserRole, params: { userid: id } });
//console.log('userAndRoleId', userAndRoleId);
//let roleId = userAndRoleId[1];
console.log('roleId', roleId);
let roleInfo = await defHttp.get({ url: this.Url.queryById, params: { id: roleId[0] } });
console.log('roleInfo', roleInfo);
this.roleName = roleInfo.roleName;
console.log('roleName', this.roleName);
this.college = this.roleName;
try {
//this.batchnull
if (!this.batch) {
this.batch = '2024-06-01';
}
if (!this.college) {
this.college = '计算机科学与信息工程学院';
}
let params = {
batch: this.batch,
college: this.college,
level: 'cet4',
};
resultData = await defHttp.get({ url: this.Url.getData, params });
//console.log('result', resultData);
//
let tableData = [];
for (let grade in resultData.gradeData) {
tableData.push({
grade: grade + '级',
attendNumber: resultData.gradeData[grade].allStudent,
passNumber: resultData.gradeData[grade].passed,
passrate: resultData.gradeData[grade].passRate,
});
}
this.dataSourceCet4 = tableData; //
//console.log(this.dataSourceCet4, 'dataSourceCet4');
} finally {
this.loadingTable = false;
this.$nextTick(() => {
//this.dataChart(resultData.data);
//console.log('cet4:', resultData.data);
this.circleMap();
this.majorPassRate();
this.gradePassRate();
this.queryMajorByCollege();
});
}
},
async queryMajorByCollege() {
this.loadingMap5 = true;
if (!this.college) {
this.college = '计算机科学与信息工程学院';
}
let resultData = await defHttp.get({ url: this.Url.getCollegeMajor });
let collegeAndMajor = resultData.collegeMajor;
//console.log('11111111111', collegeAndMajor);
// collegeAndMajor
let majors = collegeAndMajor.find((item) => item.college === this.college);
//console.log('3333', majors);
majors = majors.major;
this.majors = majors;
//console.log('444', this.majors);
let collegeAndMajors = this.majors.map((major) => [this.college, major]);
//console.log('777', collegeAndMajors);
//this.major = resultData.
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates;
let entrydate = this.entrydateOptions.map((item) => item.value).splice(-5);
this.majorentrydate = entrydate;
let params = {
college: collegeAndMajors,
entrydate: entrydate,
};
//console.log('666');
let res = await defHttp.post({ url: this.Url.getRateByMajor, params });
//console.log('55555', res.data);
this.loadingMap5 = false;
this.$nextTick(() => {
this.drawChart(res.data);
});
},
//map2--
async circleMap() {
this.loadingMap2 = true;
//console.log(this.passRatePie);
//console.log('piedata', piedata);
//this.batchnull
//S
if (!this.batch) {
this.batch = '2024-06-01';
}
if (!this.college) {
this.college = '计算机科学与信息工程学院';
}
let queryParams = {
batch: this.batch,
college: this.college,
level: 'cet4',
};
//console.log(queryParams, 'queryParams');
let result = await defHttp.get({ url: this.Url.getData, params: queryParams });
//console.log(result, 'result');
let chartsData = [];
for (let key in result.gradeData) {
chartsData.push({
name: key + '级',
value: result.gradeData[key].passRate,
});
}
let option = {
tooltip: {
trigger: 'item',
conginee: false,
//
itemStytle: {
//
shadowBlur: 10, //
shadowColor: 'rgba(0, 0, 0, 0.3)', //
shadowOffsetX: 5, //
shadowOffsetY: 5, //
fontSize: 100,
},
},
title: {
text: '最新批次每一年级的通过率环形图',
left: 'center',
top: '0%',
textStyle: {
fontSize: 14,
},
},
legend: {
top: '10%',
left: 'center',
itemGap: 3,
selectedMode: true,
},
color: ['#ec2e30', '#c75af1', '#2b9eef', '#eee03f', '#2aed91', '#c5ed3c'],
series: [
{
name: '学院/专业该批次通过人数环形图',
type: 'pie',
radius: ['50%', '100%'],
center: ['50%', '50%'],
startAngle: 130,
top: 80,
//
itemStyle: {
// borderRadius: 5,
// borderColor: '#fff',
borderWidth: 2,
},
label: {
show: true,
// position: 'inside',
fontSize: 12,
overflow: 'truncate',
},
labelLine: {
show: true,
smooth: true,
length: 10,
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
label: {
show: true,
fontSize: 15,
fontWeight: 'bold',
},
},
data: chartsData,
},
{
type: 'pie',
startAngle: 130,
top: 80,
radius: ['40%', '51%'],
center: ['50%', '50%'],
//
itemStyle: {
// borderRadius: 3,
// borderColor: '#fff',
borderWidth: 2,
},
label: {
show: false,
},
hoverAnimation: false,
legendHoverLink: false,
// animationnfalse,
tooltip: {
show: false,
},
data: chartsData,
},
],
animationDurationUpate: 500,
};
this.loadingMap2 = false;
this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('map2'));
myChart.setOption(option);
});
},
handleSelectChange() {
this.loadingMap3 = true;
this.majorPassRate();
},
// -map3---------------------------------------------
async majorPassRate() {
this.loadingMap3 = true;
//console.log('55555555', this.entrydate);
if (!this.batch) {
this.batch = '2024-06-01';
}
if (!this.college) {
this.college = ['计算机科学与信息工程学院'];
}
//entrydate
let entrydateArray = [];
entrydateArray.push(this.entrydate);
let queryParams = {
college: [[this.college]],
entrydate: entrydateArray,
level: 'cet4',
};
let url = this.Url.getRateByMajor;
//console.log(queryParams, 'queryParams');
let result = await defHttp.post({ url: url, data: queryParams });
//console.log('88888', result.data);
if (!result) {
return;
}
//result = result.data[name];
// result.data
const majors = Object.keys(result.data); //
const passRates = majors.map((major) => {
const entries = result.data[major];
return entries.length > 0 ? parseFloat(entries[0].passRate) : 0; //
});
let xData = majors.map((label) => label.split('').join('\n')); //x
var majorOption = {
tooltip: {
trigger: 'item',
conginee: false,
//
itemStytle: {
fontSize: 100,
},
formatter: function (params) {
// %
return `${params.marker}${params.name} ${params.value}%`;
},
},
title: {
text: this.college + '各专业四级通过率',
left: 'center',
textStyle: {
fontSize: 14,
},
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
interval: 0, //x
//rotate: -10, //30
},
//data: result.map((item) => item.major),
//data: ['', '', '', '', '西'],
},
yAxis: {
type: 'value',
},
series: [
{
label: {
show: true,
fontSize: 14,
overflow: 'truncate',
position: 'top',
formatter: function (params) {
//
return params.value + '%';
},
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
//
label: {
show: false,
fontSize: 14,
fontWeight: 'bold',
},
},
data: passRates,
//data: result.map((item) => item.passRate),
//data: [200, 150, 80, 70, 110, 130],
type: 'bar',
},
],
animationDurationUpdate: 500,
};
this.loadingMap3 = false;
this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('map3'));
myChart.setOption(majorOption);
});
},
// map4
async gradePassRate() {
this.loadingMap4 = true;
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates;
let entrydate = this.entrydateOptions.map((item) => item.value);
const college = [this.college];
let queryParams = {
college: college,
entrydate: entrydate,
level: 'cet4',
};
let url = this.Url.getCollegeRate;
let result = await defHttp.post({ url: url, data: queryParams });
if (!result) {
return;
}
result = result.data[college];
let collegeOption = {
title: {
text: college + '四级通过率',
left: 'center',
textStyle: {
fontSize: 14,
},
},
xAxis: {
data: result.map((item) => item.entrydate),
},
//
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
//tooltip,
let result = params[0].name + '<br>';
for (let i = 0; i < params.length; i++) {
result += params[i].marker + name + ' : ' + params[i].value + '%' + '<br>';
}
return result;
},
},
series: {
type: 'line',
data: result.map((item) => item.passRate),
label: {
show: true, //
position: 'top', //
formatter: function (params) {
//
return params.value + '%';
},
//
},
universalTransition: {
// enabled: true,
// divideShape: 'clone',
},
},
yAxis: {},
animationDurationUpdate: 500,
};
this.loadingMap4 = false;
this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('map4'));
myChart.setOption(collegeOption);
});
},
//map5
drawChart(data) {
this.loadingMap5 = true;
let seriesData = [];
let xData = this.majorentrydate.sort((a, b) => a - b);
let k = 0;
let legendData = [];
let colors = [
'#5370c5',
'#91CC75',
'#fac858',
'#ee6666',
'#73c0de',
'#FF6A6A',
'#FFA500',
'#EE2C2C',
'#90EE90',
'#008B8B',
'#FFC0CB',
'#FFDAB9',
'#FFDEAD',
'#FFE4B5',
'#FFE4C4',
'#FFE4E1',
'#FFEBCD',
'#FFEFD5',
'#FFFAF0',
'#FFFAFA',
'#FFFFE0',
'#FFFFF0',
'#FFFFFF',
'#F0F8FF',
'#FAEBD7',
'#FAF0E6',
'#FAFAD2',
'#F5FFFA',
'#F8F8FF',
'#F0FFF0',
'#F0FFFF',
'#F0E68C',
'#F0F8FF',
'#F0FFF0',
'#F0FFFF',
'#F4A460',
'#F5DEB3',
'#F5F5DC',
'#F5F5F5',
'#F5FFFA',
'#F8F8FF',
'#F9EBEA',
'#FAD7A0',
'#FAF0E6',
'#FAFAD2',
'#FAF0E6 ',
];
for (let i in data) {
//console.log(i, 'i');
legendData.push(i);
let yData = [];
// legendData=[];
//console.log(data[i], 'data[i]');
for (let j in data[i]) {
//console.log(data[i][j].college, 'data[i][j].college111');
// if(data[i][j].college == ''){
yData.push(data[i][j].passRate);
// legendData.push(data[i][j].college);
}
//console.log(yData, 'yData');
seriesData.push({
name: i,
type: 'bar',
//
barWidth: 16,
data: yData,
//
barGap: '30%',
//
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
formatter: '{c}%',
textStyle: {
//
color: 'black',
fontSize: 13,
},
},
color: colors[k++],
},
},
});
}
// debugger
let myChart = null;
myChart = document.getElementById('map5');
if (myChart) {
myChart = echarts.getInstanceByDom(myChart);
if (myChart) {
myChart.dispose();
}
}
myChart = echarts.init(document.getElementById('map5'));
//
let option = {
title: {
text: '近五年各专业通过率柱状图',
textStyle: {
fontSize: 14,
},
left: 'center',
},
legend: {
top: '10%',
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
//tooltip,
let result = params[0].name + '级通过率<br>';
for (let i = 0; i < params.length; i++) {
result += params[i].marker + legendData[i] + ' : ' + params[i].value + '%' + '<br>';
}
return result;
},
},
toolbox: {
show: true,
//feature: {
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true },
//},
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
top: '100px',
containLabel: true,
},
xAxis: [
{
type: 'category',
data: xData,
axisLabel: {
interval: 0, //x
rotate: 0, //0
},
},
],
yAxis: [
{
type: 'value',
name: '通过率',
axisLabel: {
formatter: '{value} %',
},
},
],
series: seriesData,
};
// 使
//console.log(option, 'option');
//console.log(myChart, 'myChart');
this.loadingMap5 = false;
setTimeout(() => {
myChart.setOption(option);
}, 1);
},
},
};
</script>
<style lang="less" scoped>
.card-title {
width: 15%;
height: 10%;
//text-align: top center;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 10%;
}
.card-center {
width: 31%;
margin-right: 25px;
margin-bottom: 10px;
border-radius: 2%;
}
.card-bottom {
margin-right: 10px;
height: 300px;
}
</style>

View File

@ -0,0 +1,982 @@
<template>
<div style="background: #ececec; padding: 5px 5px">
<a-card :loading="loading" :bordered="false">
<template #extra>
<div class="search-row">
<!-- <div v-if="topCollege != null" style="margin-bottom: 5px;margin-right: 10px;">
<span style="font-size: 15px">当前数据为 </span>
<span style="color: red; font-size: 20px">{{ topCollege }}</span>
<span v-if="topMajor != null && topMajor != ''" style="color: red; font-size: 18px"> / {{ topMajor
}}</span>
<span style="font-size: 15px"> </span>
<span style="color: red; font-size: 18px">{{ topEntrydate }}</span>
<span style="font-size: 15px"> 级数据</span>
</div> -->
<div class="stats-container" v-if="total && total > 0">
<span>{{ totalName }}总人数{{ total }}</span>
<span>累计通过人数: {{ passNumberBottom }}</span>
<span>累计总通过率: {{ passRateBottom }}</span>
</div>
<a-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-select />
<a-select v-model:value="entrydate" style="margin-left: 10px; width: 100px" :options="entrydateOptions" />
<a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
</div>
<!-- <a-button @click=test()>test</a-button> -->
</template>
<a-row :gutter="12">
<a-col :xl="14">
<div style="padding-left: 10px; min-height: 200px">
<a-table size="small" :dataSource="dataSourceCet4" :columns="columns" :pagination="false" bordered
:scroll="{ y: 290 }">
<template #passRateSlot>
累计总通过率
<a-tooltip :title="'累计通过人数 / ' + totalName + '总人数'" placement="top">
<a-icon type="question-circle" />
</a-tooltip>
</template>
</a-table>
</div>
</a-col>
<a-col :xl="10" >
<a-card class="card-with-piechart">
<div style="width: 100%; height: 200px" class="piechart" id="piechart"> </div>
</a-card>
</a-col>
</a-row>
<!-- <div style="height: 300px;">
<a-empty style="margin-top: 100px" />
</div> -->
</a-card>
</div>
<div class="bottom-box">
<div class="left-side">
<a-card :loading="loading" :bordered="false">
<div style="width: 100%; height: 350px" id="map2"> </div>
</a-card>
</div>
<div class="right-side">
<!-- <a-row :gutter="12"> -->
<!-- <a-col :xl="16"> -->
<a-card :loading="map1loading">
<!-- <div class="query">
<span
style="font-size: 15px; margin-right: 10px; display: flex; justify-content: center; align-items: center; font-weight: bold">年级:
</span>
<a-select v-model:value="oneentrydate" style="width: 200px" :options="entrydateOptions" />
<a-button style="margin-left: 10px" type="primary" @click="allQuery">查询</a-button>
</div> -->
<div id="map1" style="width: 100%; height: 350px"></div>
</a-card>
<!-- </a-col> -->
<!-- </a-row> -->
</div>
</div>
</template>
<script>
import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts';
import { message } from 'ant-design-vue';
export default {
data() {
return {
activeKey: '1',
allCollege: [],
showBox: false,
showGroup: false,
oneentrydate: null,
collegeentrydate: [],
majorentrydate: [],
lastMajorEntrydate: [],
checkedOptions: [],
collegetab2: [],
collegeMajorOptions: [],
collegeMajor: [],
loading: false,
dataSourceCet4: [],
columns: [
{
title: '学年',
dataIndex: 'grade',
key: 'grade',
align: 'center',
customCell: (_, index) => ({
rowSpan: index % 2 === 0 ? 2 : 0, //graderowSpan
}),
},
{
title: '考试批次',
dataIndex: 'batch',
key: 'batch',
align: 'center',
},
{
title: '参加人数',
dataIndex: 'attendNumber',
key: 'attendNumber',
align: 'center',
},
{
title: '通过人数',
dataIndex: 'passNumber',
key: 'passNumber',
align: 'center',
},
{
title: '本批次通过率',
dataIndex: 'batchpassrate',
key: 'batchpassrate',
align: 'center',
},
{
slots: { title: 'passRateSlot' },
dataIndex: 'gradepassrate',
key: 'gradepassrate',
align: 'center',
customCell: (_, index) => ({
rowSpan: index % 2 === 0 ? 2 : 0,
}),
},
],
Url: {
getEntrydate: '/cet/getEntrydate',
getCollege: '/cet/getCollege',
getData: '/cet/getData',
getCollegeMajor: '/cet/getCollegeMajor',
getBatch: '/cet/getBatch',
getEntrydate: '/cet/getEntrydate',
getCollegeRate: '/cet/getRateByCollege',
getAllRate: '/cet/getAllRate',
getMajor: '/cet/getMajorByCollege',
getMajorRate: '/cet/getRateByMajor',
getRateByMajor: '/cet/getRateByMajor',
},
map1loading: false,
collegeOptions: [],
batchOptions: [],
levelOptions: [
{ value: 'cet4', label: '英语四级' },
{ value: 'cet6', label: '英语六级' },
],
visible: false,
level: null,
college: [],
batch: null,
entrydateOptions: [],
entrydate: [],
majorCheckOn: [],
//
lastCollegeMajor: [],
majorLength: 0,
majorOptions: [],
//
lastCollege: [],
//
lastCollegeEntrydate: [],
total: 0,
totalName: '',
passNumberBottom: 0,
passRateBottom: 0,
passRatePie: [],
lineXData: [],
lineYData: [],
collegeOptions: [],
collegeMajorOptions: [],
entrydateOptions: [],
college: null,
entrydate: 2017, //
//
collegeMajor: ['全校'], //
topCollege: null, //
topMajor: null, //
topEntrydate: null, //
};
},
mounted() {
this.getEntrydateAndCollegeData();
this.getCollegeMajorData();
this.query();
// this.allQuery();
this.getCollegeOptions();
this.getEntrydate();
},
methods: {
allQuery() {
this.map1loading = true;
console.log('查询===========ddddddddddd');
let college = ['全校'];
let query = 'tab1';
if (this.oneentrydate == null) {
this.oneentrydate = '2017';
}
this.queryChart(query, college, [this.entrydate]);
this.majorPassRate();
this.gradePassRate();
},
async majorQuery() {
if (this.majorentrydate.length == 0) {
message.error('请选择年级');
return;
}
if (this.collegeMajor.length == 0 || this.collegeMajor == null) {
message.error('请选择学院');
return;
}
if (this.lastCollegeMajor.length == 0 || this.lastCollegeMajor == null) {
message.error('请选择专业');
return;
}
this.tab3loading = true;
let res = null;
try {
let params = {
college: this.lastCollegeMajor,
entrydate: this.majorentrydate,
};
res = await defHttp.post({ url: this.Url.getRateByMajor, params });
} finally {
console.log(res, 'res');
this.tab3loading = false;
this.$nextTick(() => {
this.drawChart(res.data, 'tab3');
});
}
},
//
async getCollegeMajorData() {
const res = await defHttp.get({ url: this.Url.getCollegeMajor });
//map
this.collegeMajorOptions = res.collegeMajor.map((item) => {
return {
value: item.college,
label: item.college,
children: item.major.map((major) => {
return {
value: major,
label: major,
};
}),
};
});
// this.collegeMajor = [''];
console.log(this.collegeMajor, 'collegeMajor');
console.log(this.collegeMajorOptions, 'collegeMajorOptions1');
},
getCollegeOptions() {
defHttp.get({ url: this.Url.getCollege }).then((res) => {
this.collegeOptions = res.colleges;
//
// this.collegeOptions.unshift({ value: '', label: '' });
// this.collegeOptions.forEach(option => {
// if (option.value !== '') {
// option.disabled = true;
//}
// });
// this.college = [''];
// this.collegetab2 = ['', ''];
console.log(this.collegeOptions, 'collegeOptions');
});
},
//
async gradePassRate() {
this.map2loading = true;
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates;
const name = ['西语学院'];
},
//
async majorPassRate() {
this.map3loading = true;
const name = '西语学院';
},
dataChart(data, tab) {
let seriesData = [];
let xData = [];
let colors = [
'#5370c5',
'#ffffff',
'#fac858',
'#ee6666',
'#73c0de',
'#FF6A6A',
'#FFA500',
'#EE2C2C',
'#90EE90',
'#008B8B',
'#FFC0CB',
'#FFDAB9',
'#FFDEAD',
'#FFE4B5',
'#FFE4C4',
'#FFE4E1',
'#FFEBCD',
'#FFEFD5',
'#FFFAF0',
'#FFFAFA',
'#FFFFE0',
'#FFFFF0',
'#FFFFFF',
'#F0F8FF',
'#FAEBD7',
'#FAF0E6',
'#FAFAD2',
'#F5FFFA',
'#F8F8FF',
'#F0FFF0',
'#F0FFFF',
'#F0E68C',
'#F0F8FF',
'#F0FFF0',
'#F0FFFF',
'#F4A460',
'#F5DEB3',
'#F5F5DC',
'#F5F5F5',
'#F5FFFA',
'#F8F8FF',
'#F9EBEA',
'#FAD7A0',
'#FAF0E6',
'#FAFAD2',
'#FAF0E6 ',
];
let j = 0;
for (let i in data) {
xData = [];
let yData = [];
for (let key in data[i]) {
xData.push(data[i][key].college);
// %
yData.push(data[i][key].passRate);
}
xData = xData.map((label) => label.split('').join('\n')); //x
seriesData.push({
name: i + '级累计总通过率',
type: 'bar',
//
barWidth: 1,
data: yData,
//
barGap: '20%',
//
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
formatter: '{c}%',
textStyle: {
//
color: 'black',
fontSize: 13,
},
},
color: colors[j++],
},
},
});
if (j == colors.length) {
j = 0;
}
let rankData = yData
.slice()
.sort((a, b) => b - a)
.map((value) => yData.indexOf(value) + 1);
//
seriesData.push({
name: i + '级累计总通过率排名',
type: 'line',
yAxisIndex: 1,
data: rankData,
bar: {},
show: false,
itemStyle: {
normal: {
label: {
show: false, //
position: 'top', //
formatter: '{c}',
textStyle: {
//
color: 'black',
fontSize: 8,
},
},
color: colors[j++],
},
},
});
if (j == colors.length) {
j = 0;
}
}
console.log('实例化图表');
let myChart = null;
myChart = echarts.init(document.getElementById('map1'));
//
// const college1 = this.college;
let option = {
title: {
text: '本年级各学院四级通过率排名',
textStyle: {
fontSize: 16,
},
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
//tooltip,
let result = params[0].name + '<br>';
for (let i = 0; i < params.length; i++) {
result += params[i].marker + params[i].seriesName + ' : ' + params[i].value + '%' + '<br>';
}
if (tab == 'tab1') {
result =
params[0].name +
'<br/>' +
'<table>' +
'<tr><td>' +
params[0].marker +
params[0].seriesName +
'</td><td style="font-weight: bold;">' +
'&nbsp;&nbsp;&nbsp;&nbsp;' +
params[0].value +
'%' +
'</td></tr>' +
'<tr><td>' +
params[1].marker +
params[1].seriesName +
'</td><td style="font-weight: bold;">' +
'&nbsp;&nbsp;&nbsp;&nbsp;' +
params[1].value +
'</td></tr>' +
'</table>';
}
return result;
},
},
toolbox: {
// show: true,
// feature: {
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true },
// },
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
xAxis: [
{
type: 'category',
data: xData,
axisLabel: {
interval: 0, //x
rotate: 0, //0
},
},
],
yAxis: [
{
type: 'value',
name: '通过率',
axisLabel: {
formatter: '{value} %',
},
},
{
type: 'value',
name: '排名',
show: false,
},
],
series: seriesData,
};
option.series = [
{
name: '累计总通过率',
type: 'bar',
data: seriesData[0].data,
//
barWidth: 16,
// barWidth: '60%',
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
formatter: '{c}%',
textStyle: {
//
color: 'black',
fontSize: 10,
},
},
color: colors[0],
},
},
},
{
name: '排名',
type: 'bar',
data: seriesData[1].data,
label: {
show: false,
position: 'inside',
formatter: '{c}',
},
yAxisIndex: 1,
color: colors[1],
},
];
myChart.setOption(option, true);
// 使
myChart.on('click', async (params) => {
console.log(
this.collegeOptions.map((item) => item.value),
'collegeOptions'
);
console.log(this.collegeOptions.map((item) => item.value).includes(name), 'bool');
});
},
//
async getBatch() {
const getBatch = await defHttp.get({ url: this.Url.getBatch });
this.batchOptions = getBatch.batches;
this.batch = this.batchOptions[0].value;
this.level = this.levelOptions[0].value;
},
//
async getEntrydate() {
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates;
this.oneentrydate = this.entrydateOptions[0].value;
// this.collegeentrydate = [this.entrydateOptions[0].value];
// this.majorentrydate = [this.entrydateOptions[0].value];
// this.entrydate.push (this.entrydateOptions[0].value);
},
//
async queryChart(query, college, entrydate) {
console.log('dddddddddddddddddddddddd');
this.visible = false;
let result = null;
// console.log(this.college, this.entrydate);
// //this.collegethis.batchnull
// if (this.college === null || this.college.length === 0) {
// this.college = [''];
// }
// if (!this.entrydate || this.entrydate.length === 0) {
// this.entrydate = ['2017'];
// }
try {
// console.log(this.college, this.entrydate)
let params = {
college: college,
entrydate: [String(entrydate[0])],
level: 'cet4',
};
let url = query == 'tab1' ? this.Url.getAllRate : this.Url.getCollegeRate;
console.log(params.college, 'college');
result = await defHttp.post({ url: url, params });
//使passRate
// result.data.sort((a, b) => {
// return b.passRate - a.passRate;
// });
console.log('data', result.data);
} finally {
this.map1loading=false;
this.$nextTick(() => {
console.log('调用==============');
this.dataChart(result.data, query);
});
}
},
//
async getEntrydateAndCollegeData() {
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
const getCollege = await defHttp.get({ url: this.Url.getCollege });
this.collegeOptions = getCollege.colleges;
//
this.collegeOptions.unshift({ value: '全校', label: '全校' });
this.college = this.collegeOptions[0].value;
this.entrydateOptions = getEntrydate.entrydates;
// this.entrydate = this.entrydateOptions[0].value;
},
//
async getCollegeMajorData() {
const res = await defHttp.get({ url: this.Url.getCollegeMajor });
//map
this.collegeMajorOptions = res.collegeMajor.map((item) => {
return {
value: item.college,
label: item.college,
children: item.major.map((major) => {
return {
value: major,
label: major,
};
}),
};
});
//
this.collegeMajorOptions.unshift({ value: '专升本', label: '专升本' });
//
this.collegeMajorOptions.unshift({ value: '全校', label: '全校' });
// this.collegeMajor = [''];
console.log(this.collegeMajorOptions);
},
//
async query() {
try {
this.allQuery();
//this.collegeMajor[1]null
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : '';
this.topCollege = this.collegeMajor[0];
this.topMajor = major;
this.topEntrydate = this.entrydate;
if (this.college) this.loading = true;
let params = {
college: this.collegeMajor[0],
major: major,
entrydate: this.entrydate,
};
console.log('params', params);
const result = await defHttp.get({ url: this.Url.getData, params });
let tableData = [];
let piedata = [];
let passrate = 0;
let index = 0;
const passRate = {};
if (result.cet4['大一学年'] != undefined) {
passRate['大一学年'] = result.cet4['大一学年'];
}
if (result.cet4['大二学年'] != undefined) {
passRate['大二学年'] = result.cet4['大二学年'];
}
if (result.cet4['大三学年'] != undefined) {
passRate['大三学年'] = result.cet4['大三学年'];
}
if (result.cet4['大四学年'] != undefined) {
passRate['大四学年'] = result.cet4['大四学年'];
}
result.cet4 = passRate;
this.lineXData = [];
this.lineYData = [];
for (let grade in result.cet4) {
result.cet4[grade].forEach((item) => {
this.lineXData.push(item.batch);
this.lineYData.push((item.batchpassrate * 100).toFixed(1));
if (index % 2 == 0) {
piedata.push({ value: parseFloat(item.gradepassrate - passrate).toFixed(3), name: grade + '时通过' });
passrate = parseFloat(item.gradepassrate).toFixed(3);
}
index++;
tableData.push({
grade: grade,
attendNumber: item.attendNumber,
batch: item.batch,
gradepassrate: (item.gradepassrate * 100).toFixed(1) + '%',
passNumber: item.passNumber,
batchpassrate: (item.batchpassrate * 100).toFixed(1) + '%',
});
});
}
console.log('tableData', tableData);
this.dataSourceCet4 = tableData; //
this.total = result.total; //
this.totalName = result.totalName; //
this.passNumberBottom = result.passNumber; //
this.passRateBottom = (result.passRate * 100).toFixed(1) + '%'; //
//
this.passRatePie = []; //
this.passRatePie.push({ value: result.passRate, name: '已通过' });
this.passRatePie.push({ value: 1 - result.passRate, name: '未通过' });
piedata.push({ value: (1 - passrate).toFixed(3), name: '未通过' }); //
setTimeout(() => {
this.drawPieChart(piedata);
this.map2Chart();
}, 100);
// this.drawPieChart();
} finally {
this.loading = false;
}
},
test() {
defHttp.get({ url: '/cet/getTest' });
},
map2Chart() {
var myChart = echarts.init(document.getElementById('map2'));
var option = {
title: {
text: '各批次通过率分析',
left: 'left',
top: '0%',
textStyle: {
fontSize: 16,
},
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
return (
params[0].name +
'<br/>' +
'<table>' +
'<tr><td>' +
params[0].marker +
'</td><td style="font-weight: bold;">' +
'&nbsp;&nbsp;&nbsp;&nbsp;' +
params[0].value +
'%' +
'</td></tr>' +
'<tr>' +
'</table>'
);
},
},
grid: {
// top: '50px',
top: '15%',
left: '50px',
right: '50px',
// bottom: '30px',
bottom: '30%',
},
xAxis: {
type: 'category',
data: this.lineXData,
},
yAxis: {
type: 'value',
},
series: [
{
data: this.lineYData,
type: 'line',
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
textStyle: {
//
color: 'black',
fontSize: 12,
},
formatter: '{c}%',
},
},
},
},
],
};
option && myChart.setOption(option);
},
drawPieChart(piedata) {
console.log(this.passRatePie);
console.log('piedata', piedata);
let myChart = echarts.init(document.getElementById('piechart'));
let option = {
tooltip: {
trigger: 'item',
confine: false,
avoidLabelOverlap: true,
//
itemStyle: {
fontSize: 100,
},
},
title: {
text: '四级通过率分析',
left: 'left',
top: '0%',
textStyle: {
fontSize: 15,
},
},
legend: {
top: 'center',
right: '0%',
orient: 'vertical',
},
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [
//
{
name: '四级通过率',
type: 'pie',
center: ['30%', '60%'],
radius: ['30%', '70%'],
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2,
},
label: {
show: true,
fontSize: 13,
overflow: 'truncate',
minMargin: -1,
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
label: {
show: true,
fontSize: 13,
fontWeight: 'bold',
},
},
data: piedata,
},
],
};
myChart.setOption(option);
},
},
};
</script>
<style lang="less" scoped>
* {
font-size: 12px;
}
::v-deep .ant-card-body {
padding: 4px;
}
::v-deep {
.ant-table-cell {
font-size: 12px;
}
}
.card-with-piechart {
margin-top: 1px;
margin-bottom: 20px;
padding-top: 10px;
height:100%; /* 调整高度 */
}
.container {
display: flex;
background-color: #fff;
// padding: 15px;
padding: 5px 15px;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
.title {
font-size: 34px;
color: rgb(8, 8, 8);
font-weight: bold;
}
.stats-container {
margin-right:270px;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 90px;
// margin-top: 10px;
// padding: 10px;
// background-color: #f8f8f8f8;
// /* */
// border-radius: 12px;
// /* */
}
.stats-container span {
padding: 15px 30px;
/* 调整内边距 */
font-size: 15px;
color: #292929;
/* 文本颜色 */
white-space: nowrap;
/* 防止文本换行 */
flex: 1;
/* 每个项目占据相同的空间 */
text-align: center;
/* 文本居中 */
margin: 0 10px;
/* 调整外边距 */
}
.bottom-box {
display: flex;
column-gap: 10px;
padding: 0 5px;
.left-side {
// margin-top: 41px;
width: 40%;
}
.right-side {
position: relative;
flex: 1;
}
}
.search-row {
display: flex;
align-items: center;
}
.query {
right: 3%;
top: 10px;
position: absolute;
padding-left: 20px;
margin-bottom: 10px;
display: flex;
align-items: center;
z-index:9999;
}
</style>