页面优化 和 数据导入

This commit is contained in:
YuNan 2024-10-23 14:00:27 +08:00
parent cf89aae584
commit 4aef7d706d
2 changed files with 340 additions and 227 deletions

View File

@ -209,7 +209,7 @@
}
console.log(result.data, 'result');
let titleText = major ? `${college} / ${major}专业 最新批次通过人数饼图` : `${college} 最新批次通过人数饼图`;
let titleText = major ? `${college} / ${major}专业 最新批次通过人数` : `${college} 最新批次通过人数`;
// 使 API
let chartData = [];
@ -221,109 +221,57 @@
});
}
console.log(chartData, '123');
let xData = chartData.map((item) => item.name); //
let yData = chartData.map((item) => item.value); //
let option = {
tooltip: {
trigger: 'item',
//conginee: false,
//
itemStytle: {
//
shadowBlur: 10, //
shadowColor: 'rgba(0, 0, 0, 0.3)', //
shadowOffsetX: 5, //
shadowOffsetY: 5, //
fontSize: 100,
},
grid: {
left: '20%', //
right: '5%', //
top: '10%', //
bottom: '10%', //
},
title: {
text: '最新批次每一年级的通过率饼图',
text: '最新批次每一年级的通过率',
left: 'top',
top: '0%',
textStyle: {
fontSize: 12,
},
},
legend: {
top: '15%',
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 + "%";
// },
tooltip: {
trigger: 'item',
},
xAxis: {
type: 'category',
data: xData,
//data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}%',
},
},
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [
{
name: titleText,
type: 'pie',
radius: ['50%', '100%'],
center: ['50%', '50%'],
startAngle: 130,
top: 80,
//
data: yData,
//data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
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',
normal: {
label: {
show: true, //
position: 'top', //
textStyle: {
//
color: 'black',
fontSize: 12,
},
formatter: '{c}%',
},
},
},
data: chartData,
},
{
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: chartData,
},
],
};
@ -337,6 +285,158 @@
});
},
////--
//async draPieChart_Participate() {
// console.log(this.collegeMajor, 'collegeMajor');
// let college = this.collegeMajor[0];
// let major = this.collegeMajor[1];
// console.log(college, major, 'college major');
// let myChart = echarts.init(document.getElementById('participate_Piechart'));
// let queryParams = {
// college: college,
// major: major,
// level: 'cet4',
// };
// let url = this.Url.getRateByMajorAndLastestBatch;
// console.log(queryParams, 'queryParams');
// let result = await defHttp.post({ url: url, data: queryParams });
// if (!result) {
// return;
// }
// console.log(result.data, 'result');
// let titleText = major ? `${college} / ${major} ` : `${college} `;
// // 使 API
// let chartData = [];
// for (let key in result.data) {
// chartData.push({
// name: key + '',
// value: result.data[key].passRate,
// });
// }
// console.log(chartData, '123');
// 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: '15%',
// 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: titleText,
// 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: chartData,
// },
// {
// 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: chartData,
// },
// ],
// };
// myChart.setOption(option);
// myChart.dispatchAction({
// type: 'highlight',
// seriesIndex: 1,
// });
// window.addEventListener('resize', function () {
// myChart.resize();
// });
//},
//--/
async draPieChart_Pass() {
//console.log(this.passRatePie);

View File

@ -23,17 +23,6 @@
</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>
@ -44,42 +33,60 @@
<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 style="height: 268px">
<div>
<a-table
:dataSource="dataSourceCet4"
:columns="columns"
:pagination="false"
bordered
class="custom-table"
:style="{ fontSize: '12px', color: '#333', marginTop: '-11px' }"
/>
</div>
</a-card>
</a-col>
</a-row>
<!-- <div>
<a-row :gutter="24">
<a-col :xl="24" :style="{ marginBottom: '24px' }">
<div class="container">
<div style="display: flex;">
<span class="title">学院 / 专业四级通过率变化</span>
<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>
<div id="map1" style="width: 100%; height: 600px;"></div>
</div>
</a-col>
</a-row>
</div> -->
</a-card>
</div>
</template>
<script>
//import { pagination } from 'mock/_util';
import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts';
export default {
data() {
return {
dataSourceCet4: [],
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: {
getBatch: '/cet/getBatch',
getCollege: '/cet/getCollege',
@ -179,6 +186,7 @@
},
series: [
{
barMaxWidth: 50, //
data: yData,
type: 'bar',
itemStyle: {
@ -264,93 +272,122 @@
};
resultData = await defHttp.get({ url: this.Url.getRate, params });
this.sumRate = resultData.sumRate;
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.loading = false;
this.$nextTick(() => {
this.dataChart(resultData.data);
this.draPieChart_Pass();
//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'));
//--
//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'],
// 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);
},
// 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() {
//--
async draPieChart_Participate() {
//console.log(this.passRatePie);
//console.log('piedata', piedata);
let myChart = echarts.init(document.getElementById('participate_Piechart'));
let queryParams = {
batch: this.batch,
college: this.collegeMajor,
level: 'cet4',
};
console.log(queryParams, 'queryParams');
let url = this.Url.getRate;
let result = await defHttp.get({ url: url, 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',
@ -365,32 +402,20 @@
fontSize: 100,
},
},
// title: {
// text: '/',
// left: 'top',
// top: '0%',
// textStyle: {
// fontSize: 12,
// },
// },
title: {
text: '该批次每一年级的通过率饼图',
left: 'top',
top: '0%',
textStyle: {
fontSize: 12,
},
},
legend: {
top: '5%',
top: '10%',
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'],
@ -431,13 +456,7 @@
fontWeight: 'bold',
},
},
data: [
{ value: 1048, name: '你好' },
{ value: 735, name: '不好' },
{ value: 580, name: '孤寡' },
{ value: 484, name: '小鸟伏特加' },
{ value: 300, name: '喜喜' },
],
data: chartsData,
},
{
type: 'pie',
@ -460,13 +479,7 @@
tooltip: {
show: false,
},
data: [
{ value: 1048, name: '你好' },
{ value: 735, name: '不好' },
{ value: 580, name: '孤寡' },
{ value: 484, name: '小鸟伏特加' },
{ value: 300, name: '喜喜' },
],
data: chartsData,
},
],
};