2024-03-26 13:30:08 +08:00
|
|
|
|
<template>
|
2024-04-10 21:34:49 +08:00
|
|
|
|
<div style="background: #ececec; padding: 15px">
|
2024-04-03 14:36:10 +08:00
|
|
|
|
<a-card title="按学院 / 专业分析" :loading="loading" :bordered="false">
|
2024-03-27 17:08:37 +08:00
|
|
|
|
<template #extra>
|
2024-04-15 21:55:27 +08:00
|
|
|
|
<a-select v-model:value="college" style="width: 300px" mode="multiple" :max-tag-count="2"
|
|
|
|
|
:options="collegeOptions" @change="onCollegeMajorChange"></a-select>
|
2024-04-08 16:41:42 +08:00
|
|
|
|
<!-- <a-select v-model:value="batch" style="margin-left: 10px;width: 120px" :options="batchOptions"></a-select> -->
|
2024-03-27 17:08:37 +08:00
|
|
|
|
<!-- <a-select v-model:value="level" style="margin-left: 10px;width: 120px" :options="levelOptions"></a-select> -->
|
2024-04-15 21:55:27 +08:00
|
|
|
|
<a-select v-model:value="entrydate" style="margin-left: 10px;width: 150px"
|
2024-04-08 16:41:42 +08:00
|
|
|
|
:options="entrydateOptions"></a-select>
|
2024-03-27 17:08:37 +08:00
|
|
|
|
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
|
|
|
|
|
</template>
|
2024-03-26 13:30:08 +08:00
|
|
|
|
<a-row :gutter="24">
|
2024-03-27 17:08:37 +08:00
|
|
|
|
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
2024-03-26 13:30:08 +08:00
|
|
|
|
<div class="container">
|
2024-03-27 19:12:05 +08:00
|
|
|
|
<div id="map1" style="width: 100%; height: 400px;"></div>
|
2024-03-26 13:30:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
2024-03-27 17:08:37 +08:00
|
|
|
|
</a-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
|
|
import * as echarts from 'echarts';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Analysis",
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
Url: {
|
|
|
|
|
getBatch: '/cet/getBatch',
|
2024-04-08 16:41:42 +08:00
|
|
|
|
getEntrydate: '/cet/getEntrydate',
|
2024-03-27 17:08:37 +08:00
|
|
|
|
getCollege: '/cet/getCollege',
|
2024-04-10 21:34:49 +08:00
|
|
|
|
getRate: '/cet/getRateByCollege'
|
2024-03-26 13:30:08 +08:00
|
|
|
|
},
|
2024-03-27 18:26:50 +08:00
|
|
|
|
loading: false,
|
2024-03-27 17:08:37 +08:00
|
|
|
|
collegeOptions: [],
|
|
|
|
|
batchOptions: [],
|
|
|
|
|
levelOptions: [
|
|
|
|
|
{ value: 'cet4', label: '英语四级' },
|
|
|
|
|
{ value: 'cet6', label: '英语六级' }
|
|
|
|
|
],
|
|
|
|
|
level: null,
|
|
|
|
|
college: null,
|
2024-04-08 16:41:42 +08:00
|
|
|
|
batch: null,
|
|
|
|
|
entrydateOptions: [],
|
|
|
|
|
entrydate: null,
|
|
|
|
|
|
2024-03-27 17:08:37 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-04-03 14:36:10 +08:00
|
|
|
|
getCollegeOptions() {
|
|
|
|
|
defHttp.get({ url: this.Url.getCollege }).then(res => {
|
|
|
|
|
this.collegeOptions = res.colleges;
|
|
|
|
|
// 手动添加一个全校字段
|
|
|
|
|
this.collegeOptions.unshift({ value: '全校', label: '全校' });
|
2024-04-10 21:34:49 +08:00
|
|
|
|
this.collegeOptions.forEach(option => {
|
|
|
|
|
if (option.value !== '全校') {
|
|
|
|
|
option.disabled = true;
|
|
|
|
|
}
|
2024-04-15 21:55:27 +08:00
|
|
|
|
|
2024-04-10 21:34:49 +08:00
|
|
|
|
});
|
|
|
|
|
this.college = ['全校'];
|
2024-04-03 14:36:10 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
2024-04-10 21:34:49 +08:00
|
|
|
|
onCollegeMajorChange(value) {
|
2024-04-15 21:55:27 +08:00
|
|
|
|
if (value.includes('全校')) {
|
|
|
|
|
this.collegeOptions.forEach(option => {
|
|
|
|
|
if (option.value !== '全校') {
|
|
|
|
|
option.disabled = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.collegeOptions.forEach(option => {
|
2024-04-10 21:34:49 +08:00
|
|
|
|
option.disabled = false;
|
2024-04-15 21:55:27 +08:00
|
|
|
|
if (value !== '全校' && option.value === '全校') {
|
|
|
|
|
option.disabled = true;
|
|
|
|
|
}
|
|
|
|
|
if (value.length === 0) {
|
|
|
|
|
option.disabled = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log(value);
|
|
|
|
|
},
|
2024-03-27 19:12:05 +08:00
|
|
|
|
dataChart(data) {
|
|
|
|
|
let xData = [];
|
|
|
|
|
let yData = [];
|
|
|
|
|
for (let key in data) {
|
2024-04-08 16:41:42 +08:00
|
|
|
|
xData.push(data[key].college);
|
2024-03-27 19:12:05 +08:00
|
|
|
|
// 将数据转换为百分比(加上%)
|
2024-04-08 16:41:42 +08:00
|
|
|
|
yData.push(data[key].passRate);
|
2024-03-27 19:12:05 +08:00
|
|
|
|
}
|
2024-04-10 21:34:49 +08:00
|
|
|
|
let rankData = yData.slice().sort((a, b) => b - a).map((value) => yData.indexOf(value) + 1);
|
|
|
|
|
xData = xData.map(label => label.split("").join("\n"));//将x轴竖着展示
|
2024-03-27 17:08:37 +08:00
|
|
|
|
let myChart = echarts.init(document.getElementById("map1"));
|
|
|
|
|
// 指定图表的配置项和数据
|
|
|
|
|
let option = {
|
|
|
|
|
title: {
|
2024-03-27 19:12:05 +08:00
|
|
|
|
text: "本批次学院通过率排名",
|
2024-03-27 17:08:37 +08:00
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
axisPointer: {
|
|
|
|
|
type: 'shadow'
|
2024-04-10 21:34:49 +08:00
|
|
|
|
},
|
|
|
|
|
formatter: function (params) {
|
|
|
|
|
return params[0].name + '<br/>' +
|
|
|
|
|
'<table>' +
|
2024-04-15 21:55:27 +08:00
|
|
|
|
'<tr><td>' + params[0].marker + params[0].seriesName + '</td><td style="font-weight: bold;">' + ' ' + params[0].value + '%' + '</td></tr>' +
|
|
|
|
|
'<tr><td>' + params[1].marker + params[1].seriesName + '</td><td style="font-weight: bold;">' + ' ' + params[1].value + '</td></tr>' +
|
2024-04-10 21:34:49 +08:00
|
|
|
|
'</table>';
|
2024-03-27 17:08:37 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-08 16:41:42 +08:00
|
|
|
|
toolbox: {
|
|
|
|
|
show: true,
|
|
|
|
|
feature: {
|
2024-04-10 21:34:49 +08:00
|
|
|
|
|
2024-04-08 16:41:42 +08:00
|
|
|
|
magicType: { show: true, type: ['line', 'bar'] },
|
|
|
|
|
restore: { show: true },
|
|
|
|
|
saveAsImage: { show: true }
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-27 19:12:05 +08:00
|
|
|
|
grid: {
|
|
|
|
|
left: '3%',
|
|
|
|
|
right: '4%',
|
|
|
|
|
bottom: '3%',
|
|
|
|
|
containLabel: true
|
2024-03-27 17:08:37 +08:00
|
|
|
|
},
|
2024-03-27 19:12:05 +08:00
|
|
|
|
xAxis: [
|
2024-03-27 17:08:37 +08:00
|
|
|
|
{
|
2024-03-27 19:12:05 +08:00
|
|
|
|
type: 'category',
|
|
|
|
|
data: xData,
|
2024-04-08 16:41:42 +08:00
|
|
|
|
axisLabel: {
|
2024-04-10 21:34:49 +08:00
|
|
|
|
interval: 0,//代表显示所有x轴标签显示
|
|
|
|
|
rotate: 0,//代表倾斜0度显示
|
2024-03-26 13:30:08 +08:00
|
|
|
|
}
|
2024-03-27 19:12:05 +08:00
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis: [
|
2024-03-27 17:08:37 +08:00
|
|
|
|
{
|
2024-04-10 21:34:49 +08:00
|
|
|
|
type: 'value',
|
|
|
|
|
name: '通过率',
|
|
|
|
|
axisLabel: {
|
|
|
|
|
formatter: '{value} %'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'value',
|
|
|
|
|
name: '排名',
|
|
|
|
|
show: false,
|
2024-03-27 19:12:05 +08:00
|
|
|
|
}
|
2024-03-27 17:08:37 +08:00
|
|
|
|
],
|
2024-03-27 19:12:05 +08:00
|
|
|
|
series: [
|
|
|
|
|
{
|
2024-04-08 16:41:42 +08:00
|
|
|
|
name: '累计总通过率',
|
2024-03-27 19:12:05 +08:00
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: '60%',
|
2024-04-08 16:41:42 +08:00
|
|
|
|
data: yData,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
label: {
|
|
|
|
|
show: true, //开启显示
|
|
|
|
|
position: 'top', //在上方显示
|
|
|
|
|
textStyle: { //数值样式
|
|
|
|
|
color: 'black',
|
|
|
|
|
fontSize: 13
|
2024-04-10 21:34:49 +08:00
|
|
|
|
},
|
|
|
|
|
formatter: '{c}%'
|
2024-04-08 16:41:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-10 21:34:49 +08:00
|
|
|
|
},
|
|
|
|
|
yAxisIndex: 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '排名',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
data: rankData,
|
|
|
|
|
label: {
|
|
|
|
|
show: false,
|
|
|
|
|
position: 'inside',
|
|
|
|
|
formatter: '{c}',
|
|
|
|
|
},
|
|
|
|
|
yAxisIndex: 1,
|
|
|
|
|
},
|
2024-03-27 19:12:05 +08:00
|
|
|
|
]
|
2024-03-27 17:08:37 +08:00
|
|
|
|
};
|
|
|
|
|
// 使用刚指定的配置项和数据显示图表。
|
|
|
|
|
myChart.setOption(option);
|
|
|
|
|
},
|
|
|
|
|
// 获取批次数据
|
|
|
|
|
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;
|
2024-03-26 13:30:08 +08:00
|
|
|
|
},
|
2024-04-08 16:41:42 +08:00
|
|
|
|
//获取年级数据
|
|
|
|
|
async getEntrydate() {
|
|
|
|
|
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
|
|
|
|
|
this.entrydateOptions = getEntrydate.entrydates;
|
|
|
|
|
this.entrydate = this.entrydateOptions[0].value;
|
|
|
|
|
},
|
2024-03-27 17:08:37 +08:00
|
|
|
|
// 查询数据
|
|
|
|
|
async query() {
|
2024-04-08 16:41:42 +08:00
|
|
|
|
let result = null;
|
|
|
|
|
console.log(this.college, this.entrydate);
|
2024-04-03 14:36:10 +08:00
|
|
|
|
//如果this.college和this.batch为null则先赋静态值
|
2024-04-15 21:55:27 +08:00
|
|
|
|
if (this.college === null || this.college.length === 0) {
|
2024-04-10 21:34:49 +08:00
|
|
|
|
this.college = ['全校'];
|
2024-04-03 14:36:10 +08:00
|
|
|
|
}
|
2024-04-08 16:41:42 +08:00
|
|
|
|
if (!this.entrydate) {
|
|
|
|
|
this.entrydate = '2017';
|
2024-04-03 14:36:10 +08:00
|
|
|
|
}
|
2024-03-27 18:46:10 +08:00
|
|
|
|
try {
|
|
|
|
|
this.loading = true;
|
2024-04-10 21:34:49 +08:00
|
|
|
|
console.log(this.college, this.entrydate)
|
2024-03-27 18:46:10 +08:00
|
|
|
|
let params = {
|
2024-04-03 14:36:10 +08:00
|
|
|
|
college: this.college,
|
2024-04-08 16:41:42 +08:00
|
|
|
|
entrydate: this.entrydate,
|
2024-03-27 18:46:10 +08:00
|
|
|
|
level: 'cet4'
|
|
|
|
|
}
|
2024-04-15 21:55:27 +08:00
|
|
|
|
console.log(params.college, "college")
|
2024-04-10 21:34:49 +08:00
|
|
|
|
result = await defHttp.post({ url: this.Url.getRate, params });
|
2024-04-08 16:41:42 +08:00
|
|
|
|
//使数据按照passRate从大到小排序
|
|
|
|
|
result.data.sort((a, b) => {
|
|
|
|
|
return b.passRate - a.passRate;
|
|
|
|
|
});
|
2024-04-10 21:34:49 +08:00
|
|
|
|
console.log("data", result.data);
|
2024-03-27 18:46:10 +08:00
|
|
|
|
} finally {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.$nextTick(() => {
|
2024-04-08 16:41:42 +08:00
|
|
|
|
this.dataChart(result.data);
|
2024-03-27 18:46:10 +08:00
|
|
|
|
})
|
2024-03-27 17:08:37 +08:00
|
|
|
|
}
|
2024-03-26 13:30:08 +08:00
|
|
|
|
}
|
2024-03-27 17:08:37 +08:00
|
|
|
|
},
|
|
|
|
|
mounted() {
|
2024-04-03 14:36:10 +08:00
|
|
|
|
this.getCollegeOptions();
|
2024-04-08 16:41:42 +08:00
|
|
|
|
// this.getBatch();
|
|
|
|
|
this.getEntrydate();
|
2024-04-03 14:36:10 +08:00
|
|
|
|
this.query();
|
2024-03-26 13:30:08 +08:00
|
|
|
|
}
|
2024-03-27 17:08:37 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</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>
|