页面布局改进
This commit is contained in:
parent
4c60ba4ca7
commit
80a240675d
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,50 @@
|
||||||
<a-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-select />
|
<a-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-select />
|
||||||
<a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
|
<a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :xl="16" :style="{ marginBottom: '24px' }">
|
||||||
|
<!-- 根据需求 删除 或 更改-->
|
||||||
|
<a-card class="tip">
|
||||||
|
<div style="display: flex">
|
||||||
|
<div v-if="topCollege != null">
|
||||||
|
<span style="font-size: 15px; padding-left: 100px">该数据为 </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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<a-card>
|
||||||
|
<!--<template #extra>
|
||||||
|
<div style="display: flex">
|
||||||
|
<div v-if="topCollege != null">
|
||||||
|
<span style="font-size: 15px; padding-left: 100px">该数据为 </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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>-->
|
||||||
|
<div>
|
||||||
|
<div id="map1" style="width: 100%; height: 400px"></div>
|
||||||
|
</div>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :xl="8">
|
||||||
|
<a-card style="margin-bottom: 10px">
|
||||||
|
<div style="width: 100%; height: 210px; padding: 10px" class="participate_Piechart" id="participate_Piechart"></div>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<a-card>
|
||||||
|
<div style="width: 100%; height: 210px; padding: 10px" class="pass_Piechart" id="pass_Piechart"></div>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<!-- <div>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -19,204 +62,414 @@
|
||||||
<span style="font-size: 15px;"> 的四级通过率变化趋势 </span>
|
<span style="font-size: 15px;"> 的四级通过率变化趋势 </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="map1" style="width: 100%; height: 500px"></div>
|
<div id="map1" style="width: 100%; height: 500px"></div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</div>
|
</div> -->
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Analysis',
|
data() {
|
||||||
data() {
|
return {
|
||||||
return {
|
Url: {
|
||||||
Url: {
|
getBatch: '/cet/getBatch',
|
||||||
getBatch: '/cet/getBatch',
|
getCollege: '/cet/getCollege',
|
||||||
getCollege: '/cet/getCollege',
|
getRate: '/cet/getRateByAllBatch',
|
||||||
getRate: '/cet/getRateByAllBatch',
|
getCollegeMajor: '/cet/getCollegeMajor',
|
||||||
getCollegeMajor: '/cet/getCollegeMajor',
|
|
||||||
},
|
|
||||||
loading: false,
|
|
||||||
collegeOptions: [],
|
|
||||||
collegeMajorOptions: [],
|
|
||||||
batchOptions: [],
|
|
||||||
levelOptions: [
|
|
||||||
{ value: 'cet4', label: '英语四级' },
|
|
||||||
{ value: 'cet6', label: '英语六级' },
|
|
||||||
],
|
|
||||||
level: null,
|
|
||||||
college: null,
|
|
||||||
batch: null,
|
|
||||||
collegeMajor: null,
|
|
||||||
topCollege: null,//顶部解释行
|
|
||||||
topMajor: null,//顶部解释行
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
dataChart(data) {
|
|
||||||
let xData = [];
|
|
||||||
let yData = [];
|
|
||||||
for (let key in data) {
|
|
||||||
xData.push(key);
|
|
||||||
// 将数据转换为百分比(加上%)
|
|
||||||
yData.push(data[key].toFixed(1));
|
|
||||||
}
|
|
||||||
let myChart = echarts.init(document.getElementById('map1'));
|
|
||||||
// 指定图表的配置项和数据
|
|
||||||
let option = {
|
|
||||||
title: {
|
|
||||||
// text: '学院 / 专业四级通过率变化',
|
|
||||||
},
|
},
|
||||||
xAxis: {
|
loading: false,
|
||||||
type: 'category',
|
collegeOptions: [],
|
||||||
data: xData,
|
collegeMajorOptions: [],
|
||||||
axisLabel: {
|
batchOptions: [],
|
||||||
interval: 0, //代表显示所有x轴标签显示
|
levelOptions: [
|
||||||
rotate: -10, //代表倾斜30度显示
|
{ value: 'cet4', label: '英语四级' },
|
||||||
|
{ value: 'cet6', label: '英语六级' },
|
||||||
|
],
|
||||||
|
level: null,
|
||||||
|
college: null,
|
||||||
|
batch: null,
|
||||||
|
collegeMajor: null,
|
||||||
|
topCollege: null, //顶部解释行
|
||||||
|
topMajor: null, //顶部解释行
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getCollegeMajorData();
|
||||||
|
this.getBatch();
|
||||||
|
this.query();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
dataChart(data) {
|
||||||
|
let xData = [];
|
||||||
|
let yData = [];
|
||||||
|
for (let key in data) {
|
||||||
|
xData.push(key);
|
||||||
|
// 将数据转换为百分比(加上%)
|
||||||
|
yData.push(data[key].toFixed(1));
|
||||||
|
}
|
||||||
|
let myChart = echarts.init(document.getElementById('map1'));
|
||||||
|
// 指定图表的配置项和数据
|
||||||
|
let option = {
|
||||||
|
title: {
|
||||||
|
// text: '学院 / 专业四级通过率变化',
|
||||||
},
|
},
|
||||||
},
|
xAxis: {
|
||||||
tooltip: {
|
type: 'category',
|
||||||
trigger: 'axis',
|
data: xData,
|
||||||
axisPointer: {
|
axisLabel: {
|
||||||
type: 'shadow',
|
interval: 1, //代表显示所有x轴标签显示
|
||||||
|
rotate: -10, //代表倾斜30度显示
|
||||||
|
},
|
||||||
},
|
},
|
||||||
formatter: function (params) {
|
tooltip: {
|
||||||
return (
|
trigger: 'axis',
|
||||||
params[0].name +
|
axisPointer: {
|
||||||
'<br/>' +
|
type: 'shadow',
|
||||||
'<table>' +
|
},
|
||||||
'<tr><td>' +
|
formatter: function (params) {
|
||||||
params[0].marker +
|
return (
|
||||||
'</td><td style="font-weight: bold;">' +
|
params[0].name +
|
||||||
' ' +
|
'<br/>' +
|
||||||
params[0].value +
|
'<table>' +
|
||||||
'%' +
|
'<tr><td>' +
|
||||||
'</td></tr>' +
|
params[0].marker +
|
||||||
'<tr>' +
|
'</td><td style="font-weight: bold;">' +
|
||||||
'</table>'
|
' ' +
|
||||||
);
|
params[0].value +
|
||||||
|
'%' +
|
||||||
|
'</td></tr>' +
|
||||||
|
'<tr>' +
|
||||||
|
'</table>'
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
yAxis: {
|
||||||
yAxis: {
|
type: 'value',
|
||||||
type: 'value',
|
name: '通过率',
|
||||||
name: '通过率',
|
axisLabel: {
|
||||||
axisLabel: {
|
formatter: '{value} %',
|
||||||
formatter: '{value} %',
|
},
|
||||||
},
|
},
|
||||||
},
|
series: [
|
||||||
series: [
|
{
|
||||||
{
|
data: yData,
|
||||||
data: yData,
|
type: 'line',
|
||||||
type: 'line',
|
itemStyle: {
|
||||||
itemStyle: {
|
normal: {
|
||||||
normal: {
|
label: {
|
||||||
label: {
|
show: true, //开启显示
|
||||||
show: true, //开启显示
|
position: 'top', //在上方显示
|
||||||
position: 'top', //在上方显示
|
textStyle: {
|
||||||
textStyle: {
|
//数值样式
|
||||||
//数值样式
|
color: 'black',
|
||||||
color: 'black',
|
fontSize: 12,
|
||||||
fontSize: 12,
|
},
|
||||||
|
formatter: '{c}%',
|
||||||
},
|
},
|
||||||
formatter: '{c}%',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
},
|
||||||
|
|
||||||
|
//绘画饼图--每个批次通过-数据分析
|
||||||
|
draPieChart_Pass() {
|
||||||
|
//console.log(this.passRatePie);
|
||||||
|
//console.log('piedata', piedata);
|
||||||
|
let myChart = echarts.init(document.getElementById('pass_Piechart'));
|
||||||
|
|
||||||
|
let option = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: '',
|
||||||
|
conginee: false,
|
||||||
|
//字体大小
|
||||||
|
itemStytle: {
|
||||||
|
fontSize: 100,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
title: {
|
||||||
};
|
//text: '学院/专业每个批次通过人数饼图',
|
||||||
// 使用刚指定的配置项和数据显示图表。
|
left: 'left',
|
||||||
myChart.setOption(option);
|
top: '0%',
|
||||||
},
|
textStyle: {
|
||||||
// 获取批次数据
|
fontSize: 14,
|
||||||
async getBatch() {
|
},
|
||||||
const getBatch = await defHttp.get({ url: this.Url.getBatch });
|
},
|
||||||
// const getCollege = await defHttp.get({ url: this.Url.getCollege });
|
legend: {
|
||||||
|
top: '5%',
|
||||||
|
left: 'center',
|
||||||
|
},
|
||||||
|
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
|
||||||
|
|
||||||
// this.collegeOptions = getCollege.colleges;
|
series: [
|
||||||
// this.college = this.collegeOptions[0].value;
|
{
|
||||||
|
name: '学院/专业每个批次通过人数饼图',
|
||||||
this.level = this.levelOptions[0].value;
|
type: 'pie',
|
||||||
|
radius: ['0', '100%'],
|
||||||
// this.query();
|
top: 80,
|
||||||
},
|
itemStyle: {
|
||||||
//获取学院专业级联数据
|
borderRadius: 5,
|
||||||
async getCollegeMajorData() {
|
borderColor: '#fff',
|
||||||
const res = await defHttp.get({ url: this.Url.getCollegeMajor });
|
borderWideth: 2,
|
||||||
//通过map方法将数据转换为级联选择器需要的数据格式
|
},
|
||||||
this.collegeMajorOptions = res.collegeMajor.map((item) => {
|
label: {
|
||||||
return {
|
show: true,
|
||||||
value: item.college,
|
fontSize: 14,
|
||||||
label: item.college,
|
overflow: 'truncate',
|
||||||
children: item.major.map((major) => {
|
},
|
||||||
return {
|
emphasis: {
|
||||||
value: major,
|
itemStyle: {
|
||||||
label: major,
|
shadowBlur: 10,
|
||||||
};
|
shadowOffsetX: 0,
|
||||||
}),
|
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 1048, name: '计算机' },
|
||||||
|
{ value: 735, name: '东语' },
|
||||||
|
{ value: 580, name: '物理' },
|
||||||
|
{ value: 484, name: '大数据' },
|
||||||
|
{ value: 300, name: '树莓' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
});
|
myChart.setOption(option);
|
||||||
this.collegeMajor = ['东语学院', '日语'];
|
},
|
||||||
},
|
|
||||||
// 查询数据
|
|
||||||
async query() {
|
|
||||||
let data = null;
|
|
||||||
console.log(this.collegeMajor, 'collegeMajor');
|
|
||||||
try {
|
|
||||||
|
|
||||||
//如果this.collegeMajor为null则先赋个值
|
//绘画饼图--每个批次参与人数-数据分析
|
||||||
if (!this.collegeMajor) {
|
draPieChart_Participate() {
|
||||||
this.collegeMajor = ['东语学院', '日语'];
|
//console.log(this.passRatePie);
|
||||||
}
|
//console.log('piedata', piedata);
|
||||||
let major = null;
|
let myChart = echarts.init(document.getElementById('participate_Piechart'));
|
||||||
let college = null;
|
|
||||||
//如果this.collegeMajor[1]不存在则设为null
|
let option = {
|
||||||
college = this.collegeMajor[0];
|
tooltip: {
|
||||||
major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : '';
|
trigger: 'item',
|
||||||
this.topCollege = college;
|
conginee: false,
|
||||||
this.topMajor = major;
|
//字体大小
|
||||||
this.loading = true;
|
itemStytle: {
|
||||||
console.log(college, major, "college,major");
|
// 设置阴影效果
|
||||||
let params = {
|
shadowBlur: 10, // 阴影模糊大小
|
||||||
college: college,
|
shadowColor: 'rgba(0, 0, 0, 0.3)', // 阴影颜色
|
||||||
major: major,
|
shadowOffsetX: 5, // 阴影水平方向偏移
|
||||||
level: 'cet4',
|
shadowOffsetY: 5, // 阴影垂直方向偏移
|
||||||
|
fontSize: 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// title: {
|
||||||
|
// text: '学院/专业该批次通过人数饼图',
|
||||||
|
// left: 'top',
|
||||||
|
// top: '0%',
|
||||||
|
// textStyle: {
|
||||||
|
// fontSize: 12,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
legend: {
|
||||||
|
top: '5%',
|
||||||
|
left: 'center',
|
||||||
|
// orient: 'vertical',
|
||||||
|
itemGap: 3,
|
||||||
|
selectedMode: true,
|
||||||
|
// inactiveColor: '#ccc',
|
||||||
|
// icon: 'circle',
|
||||||
|
|
||||||
|
// formatter: function (name) {
|
||||||
|
// var value;
|
||||||
|
// for (var i = 0; i < data.length; i++){
|
||||||
|
// if(data[i].name == name){
|
||||||
|
// value = data[i].value;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return name + ' : ' + Math.round(value / num * 10000) / 100 + "%";
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
|
||||||
|
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: [
|
||||||
|
{ value: 1048, name: '计算机' },
|
||||||
|
{ value: 735, name: '东语' },
|
||||||
|
{ value: 580, name: '物理' },
|
||||||
|
{ value: 484, name: '大数据' },
|
||||||
|
{ value: 300, name: '树莓' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
// animationn:false,
|
||||||
|
tooltip: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 1048, name: '计算机' },
|
||||||
|
{ value: 735, name: '东语' },
|
||||||
|
{ value: 580, name: '物理' },
|
||||||
|
{ value: 484, name: '大数据' },
|
||||||
|
{ value: 300, name: '树莓' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
data = await defHttp.get({ url: this.Url.getRate, params });
|
myChart.setOption(option);
|
||||||
} finally {
|
myChart.dispatchAction({
|
||||||
this.loading = false;
|
type: 'highlight',
|
||||||
this.$nextTick(() => {
|
seriesIndex: 1,
|
||||||
this.dataChart(data);
|
|
||||||
});
|
});
|
||||||
}
|
window.addEventListener('resize', function () {
|
||||||
|
myChart.resize();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取批次数据
|
||||||
|
async getBatch() {
|
||||||
|
const getBatch = await defHttp.get({ url: this.Url.getBatch });
|
||||||
|
// const getCollege = await defHttp.get({ url: this.Url.getCollege });
|
||||||
|
|
||||||
|
// this.collegeOptions = getCollege.colleges;
|
||||||
|
// this.college = this.collegeOptions[0].value;
|
||||||
|
|
||||||
|
this.level = this.levelOptions[0].value;
|
||||||
|
|
||||||
|
// this.query();
|
||||||
|
},
|
||||||
|
//获取学院专业级联数据
|
||||||
|
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 = ['东语学院', '日语'];
|
||||||
|
},
|
||||||
|
// 查询数据
|
||||||
|
async query() {
|
||||||
|
let data = null;
|
||||||
|
console.log(this.collegeMajor, 'collegeMajor');
|
||||||
|
try {
|
||||||
|
//如果this.collegeMajor为null则先赋个值
|
||||||
|
if (!this.collegeMajor) {
|
||||||
|
this.collegeMajor = ['东语学院', '日语'];
|
||||||
|
}
|
||||||
|
let major = null;
|
||||||
|
let college = null;
|
||||||
|
//如果this.collegeMajor[1]不存在则设为null
|
||||||
|
college = this.collegeMajor[0];
|
||||||
|
major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : '';
|
||||||
|
this.topCollege = college;
|
||||||
|
this.topMajor = major;
|
||||||
|
this.loading = true;
|
||||||
|
console.log(college, major, 'college,major');
|
||||||
|
let params = {
|
||||||
|
college: college,
|
||||||
|
major: major,
|
||||||
|
level: 'cet4',
|
||||||
|
};
|
||||||
|
data = await defHttp.get({ url: this.Url.getRate, params });
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.dataChart(data);
|
||||||
|
this.draPieChart_Pass();
|
||||||
|
this.draPieChart_Participate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
mounted() {
|
|
||||||
this.getCollegeMajorData();
|
|
||||||
this.getBatch();
|
|
||||||
this.query();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.container {
|
.container {
|
||||||
// display: flex;
|
// display: flex;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: rgb(8, 8, 8);
|
color: rgb(8, 8, 8);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
.tip {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
background-color: #d0e5fe;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,13 +1,56 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="background: #ececec; padding: 15px">
|
<div style="background: #ececec; padding: 15px">
|
||||||
<a-card title="按批次对比分析" :loading="loading" :bordered="false">
|
<a-card title="按单批次对比分析" :loading="loading" :bordered="false">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-select v-model:value="collegeMajor" style="width: 300px" :options="collegeMajorOptions"></a-select>
|
<a-select v-model:value="collegeMajor" style="width: 300px" :options="collegeMajorOptions" />
|
||||||
<a-select v-model:value="batch" :options="batchOptions" change-on-select
|
<a-select v-model:value="batch" :options="batchOptions" change-on-select style="margin-left: 10px; width: 120px" />
|
||||||
style="margin-left: 10px;width: 120px" />
|
<a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
|
||||||
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
|
|
||||||
</template>
|
</template>
|
||||||
<div>
|
|
||||||
|
<a-row :grutter="24">
|
||||||
|
<a-col :xl="16" :style="{ marginBottom: '24px' }">
|
||||||
|
<!-- 根据需求 删除 或 更改-->
|
||||||
|
<a-card style="margin-bottom: 10px" class="tip">
|
||||||
|
<div style="display: flex">
|
||||||
|
<div v-if="topCollege != null">
|
||||||
|
<span style="color: red; font-size: 18px; padding-left: 100px"> {{ topCollege }}</span>
|
||||||
|
<span style="font-size: 15px"> 在 </span>
|
||||||
|
<span style="color: red; font-size: 18px"> {{ topBath }} </span>
|
||||||
|
<span style="font-size: 15px"> 批次的四级通过率为:</span>
|
||||||
|
<span style="color: red; font-size: 18px"> {{ sumRate }}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<a-card>
|
||||||
|
<!--<template #extra>
|
||||||
|
<div style="display: flex">
|
||||||
|
<div v-if="topCollege != null">
|
||||||
|
<span style="color: red; font-size: 18px; padding-left: 100px"> {{ topCollege }}</span>
|
||||||
|
<span style="font-size: 15px"> 在 </span>
|
||||||
|
<span style="color: red; font-size: 18px"> {{ topBath }} </span>
|
||||||
|
<span style="font-size: 15px"> 批次的四级通过率为:</span>
|
||||||
|
<span style="color: red; font-size: 18px"> {{ sumRate }}%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>-->
|
||||||
|
<div>
|
||||||
|
<div id="map1" style="width: 100%; height: 400px"></div>
|
||||||
|
</div>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :xl="8" style="padding-left: 10px">
|
||||||
|
<a-card style="margin-bottom: 10px">
|
||||||
|
<div style="width: 100%; height: 210px; padding: 10px" class="participate_Piechart" id="participate_Piechart"></div>
|
||||||
|
</a-card>
|
||||||
|
<a-card>
|
||||||
|
<div style="width: 100%; height: 210px; padding: 10px" class="pass_Piechart" id="pass_Piechart"></div>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<!-- <div>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -25,220 +68,438 @@
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</div>
|
</div> -->
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { result } from 'lodash-es';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import * as echarts from 'echarts';
|
||||||
import * as echarts from 'echarts';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Analysis",
|
data() {
|
||||||
|
return {
|
||||||
data() {
|
Url: {
|
||||||
return {
|
getBatch: '/cet/getBatch',
|
||||||
Url: {
|
getCollege: '/cet/getCollege',
|
||||||
getBatch: '/cet/getBatch',
|
getRate: '/cet/getRateByBatch',
|
||||||
getCollege: '/cet/getCollege',
|
getCollegeMajor: '/cet/getCollegeMajor',
|
||||||
getRate: '/cet/getRateByBatch',
|
|
||||||
getCollegeMajor: '/cet/getCollegeMajor'
|
|
||||||
},
|
|
||||||
loading: false,
|
|
||||||
collegeOptions: [],
|
|
||||||
collegeMajorOptions: [],
|
|
||||||
batchOptions: [],
|
|
||||||
levelOptions: [
|
|
||||||
{ value: 'cet4', label: '英语四级' },
|
|
||||||
{ value: 'cet6', label: '英语六级' }
|
|
||||||
],
|
|
||||||
level: null,
|
|
||||||
college: null,
|
|
||||||
batch: null,
|
|
||||||
collegeMajor: null,
|
|
||||||
sumRate: null,//总通过率
|
|
||||||
topCollege: null,//顶部选择器选择的学院
|
|
||||||
topBath: null,//顶部选择器选择的批次
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
dataChart(data) {
|
|
||||||
let xData = [];
|
|
||||||
let yData = [];
|
|
||||||
for (let key in data) {
|
|
||||||
xData.push(key);
|
|
||||||
// 将数据转换为百分比(加上%)
|
|
||||||
yData.push((data[key]).toFixed(1));
|
|
||||||
}
|
|
||||||
xData = xData.map(label => label.split("").join("\n"));//将x轴竖着展示
|
|
||||||
let myChart = echarts.init(document.getElementById("map1"));
|
|
||||||
// 指定图表的配置项和数据
|
|
||||||
let option = {
|
|
||||||
title: {
|
|
||||||
// text: "学院 / 专业通过率变化",
|
|
||||||
},
|
},
|
||||||
xAxis: {
|
loading: false,
|
||||||
type: 'category',
|
collegeOptions: [],
|
||||||
data: xData,
|
collegeMajorOptions: [],
|
||||||
axisLabel: {
|
batchOptions: [],
|
||||||
interval: 0,//代表显示所有x轴标签显示
|
levelOptions: [
|
||||||
rotate: 0,//代表倾斜30度显示
|
{ value: 'cet4', label: '英语四级' },
|
||||||
}
|
{ value: 'cet6', label: '英语六级' },
|
||||||
},
|
],
|
||||||
//提示框
|
level: null,
|
||||||
tooltip: {
|
college: null,
|
||||||
trigger: 'axis',
|
batch: null,
|
||||||
axisPointer: {
|
collegeMajor: null,
|
||||||
type: 'shadow'
|
sumRate: null, //总通过率
|
||||||
},
|
topCollege: null, //顶部选择器选择的学院
|
||||||
formatter: function (params) {
|
topBath: null, //顶部选择器选择的批次
|
||||||
return params[0].name + '<br/>' +
|
|
||||||
'<table>' +
|
|
||||||
'<tr><td>' + params[0].marker + '</td><td style="font-weight: bold;">' + ' ' + params[0].value + '%' + '</td></tr>' +
|
|
||||||
'<tr>'
|
|
||||||
+ '</table>';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
toolbox: {
|
|
||||||
// show: true,
|
|
||||||
// feature: {
|
|
||||||
// magicType: { show: true, type: ['line', 'bar'] },
|
|
||||||
// restore: { show: true },
|
|
||||||
// saveAsImage: { show: true },
|
|
||||||
// },
|
|
||||||
},
|
|
||||||
//网格
|
|
||||||
grid: {
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '1%',//网格距离容器底部的距离是容器高度的3%
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value',
|
|
||||||
name: '通过率',
|
|
||||||
axisLabel: {
|
|
||||||
formatter: '{value} %'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
data: yData,
|
|
||||||
type: 'bar',
|
|
||||||
itemStyle: {
|
|
||||||
normal: {
|
|
||||||
label: {
|
|
||||||
show: true, //开启显示
|
|
||||||
position: 'top', //在上方显示
|
|
||||||
textStyle: { //数值样式
|
|
||||||
color: 'black',
|
|
||||||
fontSize: 12
|
|
||||||
},
|
|
||||||
formatter: '{c}%',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
// 使用刚指定的配置项和数据显示图表。
|
|
||||||
myChart.setOption(option);
|
|
||||||
},
|
},
|
||||||
// 获取批次数据
|
mounted() {
|
||||||
async getBatch() {
|
this.getCollegeMajorData();
|
||||||
const getBatch = await defHttp.get({ url: this.Url.getBatch });
|
this.getBatch();
|
||||||
this.batchOptions = getBatch.batches.map(item => {
|
this.query();
|
||||||
return {
|
|
||||||
value: item.value,
|
|
||||||
label: item.label
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// const getCollege = await defHttp.get({ url: this.Url.getCollege });
|
|
||||||
|
|
||||||
// this.collegeOptions = getCollege.colleges;
|
|
||||||
// this.college = this.collegeOptions[0].value;
|
|
||||||
|
|
||||||
this.level = this.levelOptions[0].value;
|
|
||||||
|
|
||||||
// this.query();
|
|
||||||
},
|
},
|
||||||
//获取学院专业级联数据
|
methods: {
|
||||||
async getCollegeMajorData() {
|
dataChart(data) {
|
||||||
const res = await defHttp.get({ url: this.Url.getCollegeMajor });
|
let xData = [];
|
||||||
|
let yData = [];
|
||||||
//通过map方法将数据转换为级联选择器需要的数据格式
|
for (let key in data) {
|
||||||
this.collegeMajorOptions = res.collegeMajor.map(item => {
|
xData.push(key);
|
||||||
return {
|
// 将数据转换为百分比(加上%)
|
||||||
value: item.college,
|
yData.push(data[key].toFixed(1));
|
||||||
label: item.college,
|
|
||||||
children: item.major.map(major => {
|
|
||||||
return {
|
|
||||||
value: major,
|
|
||||||
label: major
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
xData = xData.map((label) => label.split('').join('\n')); //将x轴竖着展示
|
||||||
this.collegeMajorOptions.unshift({ value: '全校', label: '全校' });
|
let myChart = echarts.init(document.getElementById('map1'));
|
||||||
this.collegeMajor = this.collegeMajorOptions[0].value;
|
// 指定图表的配置项和数据
|
||||||
console.log(this.collegeMajor)
|
let option = {
|
||||||
console.log(this.collegeMajorOptions);
|
title: {
|
||||||
|
// text: "学院 / 专业通过率变化",
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: xData,
|
||||||
|
axisLabel: {
|
||||||
|
interval: 0, //代表显示所有x轴标签显示
|
||||||
|
rotate: 0, //代表倾斜30度显示
|
||||||
|
},
|
||||||
|
},
|
||||||
|
//提示框
|
||||||
|
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;">' +
|
||||||
|
' ' +
|
||||||
|
params[0].value +
|
||||||
|
'%' +
|
||||||
|
'</td></tr>' +
|
||||||
|
'<tr>' +
|
||||||
|
'</table>'
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
// show: true,
|
||||||
|
// feature: {
|
||||||
|
// magicType: { show: true, type: ['line', 'bar'] },
|
||||||
|
// restore: { show: true },
|
||||||
|
// saveAsImage: { show: true },
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
//网格
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '1%', //网格距离容器底部的距离是容器高度的3%
|
||||||
|
containLabel: true,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
name: '通过率',
|
||||||
|
axisLabel: {
|
||||||
|
formatter: '{value} %',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: yData,
|
||||||
|
type: 'bar',
|
||||||
|
itemStyle: {
|
||||||
|
normal: {
|
||||||
|
label: {
|
||||||
|
show: true, //开启显示
|
||||||
|
position: 'top', //在上方显示
|
||||||
|
textStyle: {
|
||||||
|
//数值样式
|
||||||
|
color: 'black',
|
||||||
|
fontSize: 12,
|
||||||
|
},
|
||||||
|
formatter: '{c}%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
},
|
||||||
|
// 获取批次数据
|
||||||
|
async getBatch() {
|
||||||
|
const getBatch = await defHttp.get({ url: this.Url.getBatch });
|
||||||
|
this.batchOptions = getBatch.batches.map((item) => {
|
||||||
|
return {
|
||||||
|
value: item.value,
|
||||||
|
label: item.label,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
// const getCollege = await defHttp.get({ url: this.Url.getCollege });
|
||||||
|
|
||||||
|
// this.collegeOptions = getCollege.colleges;
|
||||||
|
// this.college = this.collegeOptions[0].value;
|
||||||
|
|
||||||
|
this.level = this.levelOptions[0].value;
|
||||||
|
|
||||||
|
// this.query();
|
||||||
|
},
|
||||||
|
//获取学院专业级联数据
|
||||||
|
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.collegeMajor = this.collegeMajorOptions[0].value;
|
||||||
|
console.log(this.collegeMajor);
|
||||||
|
console.log(this.collegeMajorOptions);
|
||||||
|
},
|
||||||
|
// 查询数据
|
||||||
|
async query() {
|
||||||
|
let resultData = null;
|
||||||
|
try {
|
||||||
|
//如果this.batch为null则先赋个值
|
||||||
|
if (!this.batch) {
|
||||||
|
this.batch = '2017-12-01';
|
||||||
|
}
|
||||||
|
if (!this.collegeMajor) {
|
||||||
|
this.collegeMajor = '全校';
|
||||||
|
}
|
||||||
|
//如果this.batch[1]不存在则设为null
|
||||||
|
let major = this.batch.length > 1 ? this.batch[1] : '';
|
||||||
|
this.topCollege = this.collegeMajor;
|
||||||
|
this.topBath = this.batch;
|
||||||
|
this.loading = true;
|
||||||
|
let params = {
|
||||||
|
batch: this.batch,
|
||||||
|
college: this.collegeMajor,
|
||||||
|
level: 'cet4',
|
||||||
|
};
|
||||||
|
resultData = await defHttp.get({ url: this.Url.getRate, params });
|
||||||
|
this.sumRate = resultData.sumRate;
|
||||||
|
console.log('result', resultData);
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.dataChart(resultData.data);
|
||||||
|
this.draPieChart_Pass();
|
||||||
|
this.draPieChart_Participate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//绘画饼图--cet4通过的数据分析
|
||||||
|
draPieChart_Pass() {
|
||||||
|
//console.log(this.passRatePie);
|
||||||
|
//console.log('piedata', piedata);
|
||||||
|
let myChart = echarts.init(document.getElementById('pass_Piechart'));
|
||||||
|
|
||||||
|
let option = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item',
|
||||||
|
conginee: false,
|
||||||
|
//字体大小
|
||||||
|
itemStytle: {
|
||||||
|
fontSize: 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
//title: {
|
||||||
|
// text: '学院/专业该批次通过人数饼图',
|
||||||
|
// left: 'top',
|
||||||
|
// top: '0%',
|
||||||
|
// textStyle: {
|
||||||
|
// fontSize: 12,
|
||||||
|
// },
|
||||||
|
//},
|
||||||
|
legend: {
|
||||||
|
top: '5%',
|
||||||
|
left: 'center',
|
||||||
|
},
|
||||||
|
color: ['#ec2e30', '#c75af1', '#2b9eef', '#eee03f', '#2aed91', '#c5ed3c'],
|
||||||
|
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '学院/专业该批次通过人数饼图',
|
||||||
|
type: 'pie',
|
||||||
|
radius: ['0', '100%'],
|
||||||
|
top: 80,
|
||||||
|
itemStyle: {
|
||||||
|
borderRadius: 5,
|
||||||
|
borderColor: '#fff',
|
||||||
|
borderWideth: 2,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
fontSize: 12,
|
||||||
|
overflow: 'truncate',
|
||||||
|
},
|
||||||
|
emphasis: {
|
||||||
|
itemStyle: {
|
||||||
|
shadowBlur: 10,
|
||||||
|
shadowOffsetX: 0,
|
||||||
|
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 1048, name: '你好' },
|
||||||
|
{ value: 735, name: '不好' },
|
||||||
|
{ value: 580, name: '孤寡' },
|
||||||
|
{ value: 484, name: '小鸟伏特加' },
|
||||||
|
{ value: 300, name: '喜喜' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
myChart.setOption(option);
|
||||||
|
},
|
||||||
|
|
||||||
|
//绘画饼图--参与人数数据分析
|
||||||
|
draPieChart_Participate() {
|
||||||
|
//console.log(this.passRatePie);
|
||||||
|
//console.log('piedata', piedata);
|
||||||
|
let myChart = echarts.init(document.getElementById('participate_Piechart'));
|
||||||
|
|
||||||
|
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: 'top',
|
||||||
|
// top: '0%',
|
||||||
|
// textStyle: {
|
||||||
|
// fontSize: 12,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
legend: {
|
||||||
|
top: '5%',
|
||||||
|
left: 'center',
|
||||||
|
// orient: 'vertical',
|
||||||
|
itemGap: 3,
|
||||||
|
selectedMode: true,
|
||||||
|
// inactiveColor: '#ccc',
|
||||||
|
// icon: 'circle',
|
||||||
|
|
||||||
|
// formatter: function (name) {
|
||||||
|
// var value;
|
||||||
|
// for (var i = 0; i < data.length; i++){
|
||||||
|
// if(data[i].name == name){
|
||||||
|
// value = data[i].value;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return name + ' : ' + Math.round(value / num * 10000) / 100 + "%";
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
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: [
|
||||||
|
{ value: 1048, name: '你好' },
|
||||||
|
{ value: 735, name: '不好' },
|
||||||
|
{ value: 580, name: '孤寡' },
|
||||||
|
{ value: 484, name: '小鸟伏特加' },
|
||||||
|
{ value: 300, name: '喜喜' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
// animationn:false,
|
||||||
|
tooltip: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 1048, name: '你好' },
|
||||||
|
{ value: 735, name: '不好' },
|
||||||
|
{ value: 580, name: '孤寡' },
|
||||||
|
{ value: 484, name: '小鸟伏特加' },
|
||||||
|
{ value: 300, name: '喜喜' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
myChart.setOption(option);
|
||||||
|
myChart.dispatchAction({
|
||||||
|
type: 'highlight',
|
||||||
|
seriesIndex: 1,
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', function () {
|
||||||
|
myChart.resize();
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// 查询数据
|
};
|
||||||
async query() {
|
|
||||||
let resultData = null;
|
|
||||||
try {
|
|
||||||
//如果this.batch为null则先赋个值
|
|
||||||
if (!this.batch) {
|
|
||||||
this.batch = '2017-12-01';
|
|
||||||
}
|
|
||||||
if (!this.collegeMajor) {
|
|
||||||
this.collegeMajor = '全校';
|
|
||||||
}
|
|
||||||
//如果this.batch[1]不存在则设为null
|
|
||||||
let major = this.batch.length > 1 ? this.batch[1] : "";
|
|
||||||
this.topCollege = this.collegeMajor;
|
|
||||||
this.topBath = this.batch;
|
|
||||||
this.loading = true;
|
|
||||||
let params = {
|
|
||||||
batch: this.batch,
|
|
||||||
college: this.collegeMajor,
|
|
||||||
level: 'cet4',
|
|
||||||
}
|
|
||||||
resultData = await defHttp.get({ url: this.Url.getRate, params });
|
|
||||||
this.sumRate = resultData.sumRate;
|
|
||||||
console.log("result", resultData)
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.dataChart(resultData.data);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getCollegeMajorData();
|
|
||||||
this.getBatch();
|
|
||||||
this.query();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.container {
|
.container {
|
||||||
// display: flex;
|
// display: flex;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: rgb(8, 8, 8);
|
color: rgb(8, 8, 8);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
</style>
|
.tip {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
background-color: #d0e5fe;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,42 +3,43 @@
|
||||||
<a-card title="四级总通过率查询" :loading="loading" :bordered="false">
|
<a-card title="四级总通过率查询" :loading="loading" :bordered="false">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-select />
|
<a-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-select />
|
||||||
<a-select v-model:value="entrydate" style="margin-left: 10px;width: 100px"
|
<a-select v-model:value="entrydate" style="margin-left: 10px; width: 100px" :options="entrydateOptions" />
|
||||||
:options="entrydateOptions"></a-select>
|
<a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
|
||||||
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
|
|
||||||
<!-- <a-button @click=test()>test</a-button> -->
|
<!-- <a-button @click=test()>test</a-button> -->
|
||||||
</template>
|
</template>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="12">
|
||||||
<a-col :xl="13">
|
<a-col :xl="13">
|
||||||
<div style="padding-left: 10px;min-height: 400px;">
|
<div style="padding-left: 10px; min-height: 400px">
|
||||||
<div v-if="topCollege != null" style="margin-bottom: 5px;">
|
<div v-if="topCollege != null" style="margin-bottom: 5px">
|
||||||
<span style="font-size: 15px;">当前数据为 </span>
|
<span style="font-size: 15px">当前数据为 </span>
|
||||||
<span style="color: red; font-size: 18px;">{{ topCollege }}</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 v-if="topMajor != null && topMajor != ''" style="color: red; font-size: 18px"> / {{ topMajor }}</span>
|
||||||
<span style="font-size: 15px;"> 的 </span>
|
<span style="font-size: 15px"> 的 </span>
|
||||||
<span style="color: red; font-size: 20px;">{{ topEntrydate }}</span>
|
<span style="color: red; font-size: 20px">{{ topEntrydate }}</span>
|
||||||
<span style="font-size: 15px;"> 级数据</span>
|
<span style="font-size: 15px"> 级数据</span>
|
||||||
</div>
|
</div>
|
||||||
<a-table :dataSource="dataSourceCet4" :columns="columns" :pagination='false' bordered>
|
<a-table :dataSource="dataSourceCet4" :columns="columns" :pagination="false" bordered>
|
||||||
<template v-slot:passRateSlot>
|
<template #passRateSlot>
|
||||||
累计总通过率
|
累计总通过率
|
||||||
<a-tooltip :title="'累计通过人数 / ' + this.totalName + '总人数'" placement="top">
|
<a-tooltip :title="'累计通过人数 / ' + totalName + '总人数'" placement="top">
|
||||||
<a-icon type="question-circle" />
|
<a-icon type="question-circle" />
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
<div style="display: flex; justify-content: space-between; font-size: 15px; margin-top: 10px;"
|
<div style="display: flex; justify-content: space-between; font-size: 15px; margin-top: 10px" v-if="total && total > 0">
|
||||||
v-if="total && total > 0">
|
<span>{{ totalName }}总人数:{{ total }}</span>
|
||||||
<span>{{ this.totalName }}总人数:{{ total }}</span>
|
|
||||||
<span>累计通过人数: {{ passNumberBottom }}</span>
|
<span>累计通过人数: {{ passNumberBottom }}</span>
|
||||||
<span>累计总通过率: {{ passRateBottom }}</span>
|
<span>累计总通过率: {{ passRateBottom }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="11">
|
<a-col :xl="11">
|
||||||
<div style="width: 100%;height: 500px;padding: 10px;" class="piechart" id="piechart">
|
<a-card style="margin-top: 33px; margin-bottom: 12px">
|
||||||
|
<div style="width: 100%; height: 215px" class="piechart" id="piechart"> </div>
|
||||||
</div>
|
</a-card>
|
||||||
|
<a-card>
|
||||||
|
<div style="width: 100%; height: 180px" id="map2"> </div>
|
||||||
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<!-- <div style="height: 300px;">
|
<!-- <div style="height: 300px;">
|
||||||
|
@ -49,306 +50,317 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Analysis",
|
data() {
|
||||||
data() {
|
return {
|
||||||
return {
|
loading: false,
|
||||||
loading: false,
|
dataSourceCet4: [],
|
||||||
dataSourceCet4: [],
|
columns: [
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
title: '学年',
|
|
||||||
dataIndex: 'grade',
|
|
||||||
key: 'grade',
|
|
||||||
align: 'center',
|
|
||||||
customCell: (_, index) => ({
|
|
||||||
rowSpan: index % 2 === 0 ? 2 : 0,//每两行合并一次grade列的单元格,rowSpan为跨度
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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: [],
|
|
||||||
collegeOptions: [],
|
|
||||||
collegeMajorOptions: [],
|
|
||||||
entrydateOptions: [],
|
|
||||||
college: null,
|
|
||||||
entrydate: 2017,//年级选择器
|
|
||||||
//设置默认值为全校
|
|
||||||
collegeMajor: ['全校'],//学院专业选择器
|
|
||||||
topCollege: null,//顶部选择器
|
|
||||||
topMajor: null,//顶部选择器
|
|
||||||
topEntrydate: null,//顶部选择器
|
|
||||||
};
|
|
||||||
},
|
|
||||||
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;
|
|
||||||
for (let grade in result.cet4) {
|
|
||||||
result.cet4[grade].forEach(item => {
|
|
||||||
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);
|
|
||||||
}, 100);
|
|
||||||
// this.drawPieChart();
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
test() {
|
|
||||||
defHttp.get({ url: "/cet/getTest" });
|
|
||||||
},
|
|
||||||
|
|
||||||
drawPieChart(piedata) {
|
|
||||||
console.log(this.passRatePie)
|
|
||||||
console.log("piedata", piedata)
|
|
||||||
let myChart = echarts.init(document.getElementById('piechart'));
|
|
||||||
let option = {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'item',
|
|
||||||
confine: false,
|
|
||||||
//字体大小
|
|
||||||
itemStyle: {
|
|
||||||
fontSize: 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
title: {
|
|
||||||
text: '四级通过率分析',
|
|
||||||
left: 'left',
|
|
||||||
top: '0%',
|
|
||||||
textStyle: {
|
|
||||||
fontSize: 20
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
top: '5%',
|
|
||||||
left: 'center'
|
|
||||||
},
|
|
||||||
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
|
|
||||||
|
|
||||||
series: [
|
|
||||||
//内圈饼图
|
|
||||||
// {
|
|
||||||
// name: '四级通过率',
|
|
||||||
// type: 'pie',
|
|
||||||
// radius: ['0', '30%'],
|
|
||||||
// avoidLabelOverlap: false,
|
|
||||||
// itemStyle: {
|
|
||||||
// borderRadius: 3,
|
|
||||||
// borderColor: '#fff',
|
|
||||||
// borderWidth: 2,
|
|
||||||
// },
|
|
||||||
// label: {
|
|
||||||
// position: 'inner',
|
|
||||||
// fontSize: 14
|
|
||||||
// },
|
|
||||||
// emphasis: {
|
|
||||||
// label: {
|
|
||||||
// show: true,
|
|
||||||
// fontSize: 20,
|
|
||||||
// fontWeight: 'bold'
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// data: this.passRatePie
|
|
||||||
// },
|
|
||||||
//外圈饼图
|
|
||||||
{
|
{
|
||||||
name: '四级通过率',
|
title: '学年',
|
||||||
type: 'pie',
|
dataIndex: 'grade',
|
||||||
radius: ['35%', '60%'],
|
key: 'grade',
|
||||||
|
align: 'center',
|
||||||
|
customCell: (_, index) => ({
|
||||||
|
rowSpan: index % 2 === 0 ? 2 : 0, //每两行合并一次grade列的单元格,rowSpan为跨度
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: [],
|
||||||
|
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;
|
||||||
|
for (let grade in result.cet4) {
|
||||||
|
result.cet4[grade].forEach((item) => {
|
||||||
|
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);
|
||||||
|
}, 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: 'item',
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
top: '50px',
|
||||||
|
left: '50px',
|
||||||
|
right: '50px',
|
||||||
|
bottom: '30px',
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: ['2017-12-01', '2017-12-01', '2017-12-01', '2017-12-01', '2017-12-01'],
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: [150, 230, 224, 218, 135],
|
||||||
|
type: 'line',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
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: {
|
itemStyle: {
|
||||||
borderRadius: 10,
|
fontSize: 100,
|
||||||
borderColor: '#fff',
|
|
||||||
borderWidth: 2,
|
|
||||||
},
|
},
|
||||||
label: {
|
},
|
||||||
show: true,
|
|
||||||
fontSize: 14,
|
title: {
|
||||||
overflow: 'truncate'
|
text: '四级通过率分析',
|
||||||
|
left: 'left',
|
||||||
|
top: '0%',
|
||||||
|
textStyle: {
|
||||||
|
fontSize: 16,
|
||||||
},
|
},
|
||||||
emphasis: {
|
},
|
||||||
|
legend: {
|
||||||
|
top: 'center',
|
||||||
|
right: '0%',
|
||||||
|
orient: 'vertical',
|
||||||
|
},
|
||||||
|
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
|
||||||
|
|
||||||
|
series: [
|
||||||
|
//外圈饼图
|
||||||
|
{
|
||||||
|
name: '四级通过率',
|
||||||
|
type: 'pie',
|
||||||
|
center: ['30%', '50%'],
|
||||||
|
radius: ['35%', '70%'],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
shadowBlur: 10,
|
borderRadius: 10,
|
||||||
shadowOffsetX: 0,
|
borderColor: '#fff',
|
||||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
borderWidth: 2,
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
fontSize: 15,
|
fontSize: 14,
|
||||||
fontWeight: 'bold'
|
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,
|
||||||
},
|
},
|
||||||
data: piedata
|
],
|
||||||
}
|
};
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
|
myChart.setOption(option);
|
||||||
|
},
|
||||||
myChart.setOption(option);
|
},
|
||||||
}
|
};
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getEntrydateAndCollegeData();
|
|
||||||
this.getCollegeMajorData();
|
|
||||||
this.query();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 34px;
|
font-size: 34px;
|
||||||
color: rgb(8, 8, 8);
|
color: rgb(8, 8, 8);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue