页面布局改进

This commit is contained in:
Xubx 2024-10-11 15:29:09 +08:00
parent 4c60ba4ca7
commit 80a240675d
5 changed files with 2593 additions and 2138 deletions

View File

@ -1,46 +1,40 @@
<template> <template>
<div style="background: #ececec; padding: 15px"> <div style="background: #ececec; padding: 15px">
<a-card :bordered="false"> <a-card :bordered="false">
<a-tabs v-model:activeKey="activeKey" type="card">
<a-tab-pane key="1" tab="查询全校各学院四级通过率">
<div> <div>
<div class="query"> <div class="query">
<span style="font-size: 15px; margin-right: 10px; display: flex; justify-content: center; align-items: center; font-weight: bold" <span style="font-size: 15px; margin-right: 10px; display: flex; justify-content: center; align-items: center; font-weight: bold"
>年级: >年级:
</span> </span>
<a-select v-model:value="oneentrydate" style="width: 200px" :options="entrydateOptions"></a-select> <a-select v-model:value="oneentrydate" style="width: 200px" :options="entrydateOptions" />
<a-button style="margin-left: 10px" type="primary" @click="allQuery">查询</a-button> <a-button style="margin-left: 10px" type="primary" @click="allQuery">查询</a-button>
</div> </div>
<a-card :bordered="true">
<a-card title="查询全校各学院四级通过率" :loading="tab1loading" :bordered="false"> <a-row :gutter="12">
<template #extra> <a-col :xl="16">
<!-- <a-select v-model:value="college" style="width: 300px" mode="multiple" :max-tag-count="2" <a-card :loading="map1loading">
:options="collegeOptions" @change="onCollegeMajorChange"></a-select> -->
<!-- <a-select v-model:value="batch" style="margin-left: 10px;width: 120px" :options="batchOptions"></a-select> -->
<!-- <a-select v-model:value="level" style="margin-left: 10px;width: 120px" :options="levelOptions"></a-select> -->
<!-- <a-select v-model:value="entrydate" style="margin-left: 10px;width: 150px"
:options="entrydateOptions"></a-select>
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button> -->
</template>
<a-row :gutter="24">
<a-col :xl="24" :style="{ marginBottom: '24px' }">
<div class="container" >
<div id="span"> <div id="span">
<div style="display: flex; justify-content: center; align-items: center"> <div style="display: flex; justify-content: center; align-items: center">
<span style="font-size: 18px" >点击柱状图可查看该学院&nbsp </span> <span style="font-size: 16px">点击柱状图可查看该学院&nbsp; </span>
<span style="font-size: 18px; color: red">各年级四级通过率</span> <span style="font-size: 16px; color: red">各年级四级通过率</span>
</div> </div>
<!-- <span style=" font-size: 18px;">&nbsp 变化</span> --> <!-- <span style=" font-size: 18px;">&nbsp 变化</span> -->
</div> </div>
<div id="map1" style="width: 100%; height: 600px"></div> <div id="map1" style="width: 100%; height: 500px"></div>
</div> </a-card>
</a-col>
<a-col :xl="8">
<a-card :style="{ marginBottom: '12px' }">
<div id="map2" style="width: 100%; height: 230px"></div>
</a-card>
<a-card>
<div id="map3" style="width: 100%; height: 230px"></div>
</a-card>
</a-col> </a-col>
</a-row> </a-row>
</a-card> </a-card>
</div> </div>
</a-tab-pane>
</a-tabs>
</a-card> </a-card>
</div> </div>
</template> </template>
@ -48,12 +42,9 @@
<script> <script>
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import bar from '/@/components/Scrollbar/src/bar';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { last } from 'xe-utils';
export default { export default {
name: 'Analysis',
data() { data() {
return { return {
activeKey: '1', activeKey: '1',
@ -78,7 +69,7 @@ export default {
getCollegeMajor: '/cet/getCollegeMajor', getCollegeMajor: '/cet/getCollegeMajor',
getRateByMajor: '/cet/getRateByMajor', getRateByMajor: '/cet/getRateByMajor',
}, },
tab1loading: false, map1loading: false,
tab2loading: false, tab2loading: false,
tab3loading: false, tab3loading: false,
@ -105,9 +96,18 @@ export default {
lastCollegeEntrydate: [], lastCollegeEntrydate: [],
}; };
}, },
mounted() {
this.getCollegeOptions();
// this.getBatch();
this.getEntrydate();
this.allQuery();
this.getCollegeMajorData();
this.gradePassRate();
this.majorPassRate();
},
methods: { methods: {
allQuery() { allQuery() {
this.tab1loading = true; this.map1loading = true;
let college = ['全校']; let college = ['全校'];
let query = 'tab1'; let query = 'tab1';
if (this.oneentrydate == null) { if (this.oneentrydate == null) {
@ -184,12 +184,108 @@ export default {
console.log(this.collegeOptions, 'collegeOptions'); console.log(this.collegeOptions, 'collegeOptions');
}); });
}, },
//
async gradePassRate() {
var myChart = echarts.init(document.getElementById('map2'));
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates;
let entrydate = this.entrydateOptions.map((item) => item.value);
const name = ['西语学院'];
let queryParams = {
college: name,
entrydate: entrydate,
level: 'cet4',
};
let url = this.Url.getCollegeRate;
console.log(queryParams, 'queryParams');
let result = await defHttp.post({ url: url, data: queryParams });
console.log(myChart, 'mychart');
if (!result) {
return;
}
console.log(result.data, 'result');
result = result.data[name];
let collegeOption = {
title: {
text: name + '四级通过率',
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,
};
myChart.setOption(collegeOption);
},
//
majorPassRate() {
var myChart = echarts.init(document.getElementById('map3'));
var option = {
title: {
text: '西语学院各专业四级通过率',
textStyle: {
fontSize: 14,
},
},
xAxis: {
type: 'category',
data: ['英语', '翻译', '法语', '葡萄牙语', '西班牙语'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [200, 150, 80, 70, 110, 130],
type: 'bar',
},
],
};
myChart.setOption(option);
},
dataChart(data, tab) { dataChart(data, tab) {
let seriesData = []; let seriesData = [];
let xData = []; let xData = [];
let colors = [ let colors = [
'#5370c5', '#5370c5',
'#91CC75', '#ffffff',
'#fac858', '#fac858',
'#ee6666', '#ee6666',
'#73c0de', '#73c0de',
@ -251,7 +347,7 @@ export default {
name: i + '级累计总通过率', name: i + '级累计总通过率',
type: 'bar', type: 'bar',
// //
barWidth: 25, barWidth: 1,
data: yData, data: yData,
// //
barGap: '30%', barGap: '30%',
@ -298,7 +394,7 @@ export default {
textStyle: { textStyle: {
// //
color: 'black', color: 'black',
fontSize: 13, fontSize: 8,
}, },
}, },
color: colors[j++], color: colors[j++],
@ -311,14 +407,15 @@ export default {
} }
} }
let myChart = null; let myChart = null;
if (tab == 'tab1') {
myChart = echarts.init(document.getElementById('map1')); myChart = echarts.init(document.getElementById('map1'));
}
// //
// const college1 = this.college; // const college1 = this.college;
let option = { let option = {
title: { title: {
text: '本年级学院四级通过率排名', text: '本年级学院四级通过率排名',
textStyle: {
fontSize: 16,
},
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@ -396,14 +493,13 @@ export default {
], ],
series: seriesData, series: seriesData,
}; };
if (tab == 'tab1') {
option.series = [ option.series = [
{ {
name: '累计总通过率', name: '累计总通过率',
type: 'bar', type: 'bar',
data: seriesData[0].data, data: seriesData[0].data,
// //
barWidth: 25, barWidth: 16,
// barWidth: '60%', // barWidth: '60%',
itemStyle: { itemStyle: {
normal: { normal: {
@ -414,7 +510,7 @@ export default {
textStyle: { textStyle: {
// //
color: 'black', color: 'black',
fontSize: 13, fontSize: 10,
}, },
}, },
color: colors[0], color: colors[0],
@ -434,7 +530,6 @@ export default {
color: colors[1], color: colors[1],
}, },
]; ];
}
myChart.setOption(option, true); myChart.setOption(option, true);
// 使 // 使
myChart.on('click', async (params) => { myChart.on('click', async (params) => {
@ -468,6 +563,9 @@ export default {
let collegeOption = { let collegeOption = {
title: { title: {
text: name + '四级通过率', text: name + '四级通过率',
textStyle: {
fontSize: 14,
},
}, },
xAxis: { xAxis: {
data: result.map((item) => item.entrydate), data: result.map((item) => item.entrydate),
@ -507,50 +605,17 @@ export default {
yAxis: {}, yAxis: {},
animationDurationUpdate: 500, animationDurationUpdate: 500,
graphic: [
{
type: 'rect',
left: 30,
top: 43,
z: 1, //
shape: {
width: 55, //
height: 30, //
},
style: {
fill: 'rgba(24, 144, 255)', //
},
},
{
type: 'text',
left: 35,
top: 50,
z: 2, //
style: {
text: '返 回',
fontSize: 20,
fill: 'white', //
},
onclick: function () {
myChart.setOption(option, true);
let spanElement = document.getElementById('span');
// span
spanElement.style.display = 'block';
},
},
],
}; };
console.log(collegeOption, 'collegeOption'); console.log(collegeOption, 'collegeOption');
let spanElement = document.getElementById('span'); //let spanElement = document.getElementById('span');
// span // span
spanElement.style.display = 'none'; //spanElement.style.display = 'none';
var map2Chart = echarts.init(document.getElementById('map2'));
map2Chart.setOption(collegeOption, true);
//myChart.setOption(collegeOption, true);
myChart.setOption(collegeOption, true);
console.log(myChart, 'mychart'); console.log(myChart, 'mychart');
// this.college = [params]; // this.college = [params];
@ -604,7 +669,7 @@ export default {
// }); // });
console.log('data', result.data); console.log('data', result.data);
} finally { } finally {
query == 'tab1' ? (this.tab1loading = false) : (this.tab2loading = false); query == 'tab1' ? (this.map1loading = false) : (this.tab2loading = false);
this.$nextTick(() => { this.$nextTick(() => {
if (query == 'tab1') { if (query == 'tab1') {
this.dataChart(result.data, query); this.dataChart(result.data, query);
@ -613,13 +678,6 @@ export default {
} }
}, },
}, },
mounted() {
this.getCollegeOptions();
// this.getBatch();
this.getEntrydate();
this.allQuery();
this.getCollegeMajorData();
},
}; };
</script> </script>
@ -635,9 +693,10 @@ export default {
.query { .query {
// //
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-end;
align-items: center; align-items: center;
margin-left: 24px; margin-left: 24px;
padding-bottom: 10px;
} }
.tab3 { .tab3 {

View File

@ -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>
<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>
<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">
@ -23,7 +66,7 @@
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</div> </div> -->
</a-card> </a-card>
</div> </div>
</template> </template>
@ -33,7 +76,6 @@ 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: {
@ -58,6 +100,11 @@ export default {
topMajor: null, // topMajor: null, //
}; };
}, },
mounted() {
this.getCollegeMajorData();
this.getBatch();
this.query();
},
methods: { methods: {
dataChart(data) { dataChart(data) {
let xData = []; let xData = [];
@ -77,7 +124,7 @@ export default {
type: 'category', type: 'category',
data: xData, data: xData,
axisLabel: { axisLabel: {
interval: 0, //x interval: 1, //x
rotate: -10, //30 rotate: -10, //30
}, },
}, },
@ -134,6 +181,211 @@ export default {
// 使 // 使
myChart.setOption(option); 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',
top: '0%',
textStyle: {
fontSize: 14,
},
},
legend: {
top: '5%',
left: 'center',
},
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [
{
name: '学院/专业每个批次通过人数饼图',
type: 'pie',
radius: ['0', '100%'],
top: 80,
itemStyle: {
borderRadius: 5,
borderColor: '#fff',
borderWideth: 2,
},
label: {
show: true,
fontSize: 14,
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: ['#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,
// animationnfalse,
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 getBatch() { async getBatch() {
const getBatch = await defHttp.get({ url: this.Url.getBatch }); const getBatch = await defHttp.get({ url: this.Url.getBatch });
@ -169,7 +421,6 @@ export default {
let data = null; let data = null;
console.log(this.collegeMajor, 'collegeMajor'); console.log(this.collegeMajor, 'collegeMajor');
try { try {
//this.collegeMajornull //this.collegeMajornull
if (!this.collegeMajor) { if (!this.collegeMajor) {
this.collegeMajor = ['东语学院', '日语']; this.collegeMajor = ['东语学院', '日语'];
@ -182,7 +433,7 @@ export default {
this.topCollege = college; this.topCollege = college;
this.topMajor = major; this.topMajor = major;
this.loading = true; this.loading = true;
console.log(college, major, "college,major"); console.log(college, major, 'college,major');
let params = { let params = {
college: college, college: college,
major: major, major: major,
@ -193,15 +444,12 @@ export default {
this.loading = false; this.loading = false;
this.$nextTick(() => { this.$nextTick(() => {
this.dataChart(data); this.dataChart(data);
this.draPieChart_Pass();
this.draPieChart_Participate();
}); });
} }
}, },
}, },
mounted() {
this.getCollegeMajorData();
this.getBatch();
this.query();
},
}; };
</script> </script>
@ -219,4 +467,9 @@ export default {
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>

View File

@ -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>
<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>
<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,26 +68,23 @@
</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() { data() {
return { return {
Url: { Url: {
getBatch: '/cet/getBatch', getBatch: '/cet/getBatch',
getCollege: '/cet/getCollege', getCollege: '/cet/getCollege',
getRate: '/cet/getRateByBatch', getRate: '/cet/getRateByBatch',
getCollegeMajor: '/cet/getCollegeMajor' getCollegeMajor: '/cet/getCollegeMajor',
}, },
loading: false, loading: false,
collegeOptions: [], collegeOptions: [],
@ -52,7 +92,7 @@ export default {
batchOptions: [], batchOptions: [],
levelOptions: [ levelOptions: [
{ value: 'cet4', label: '英语四级' }, { value: 'cet4', label: '英语四级' },
{ value: 'cet6', label: '英语六级' } { value: 'cet6', label: '英语六级' },
], ],
level: null, level: null,
college: null, college: null,
@ -63,6 +103,11 @@ export default {
topBath: null, // topBath: null, //
}; };
}, },
mounted() {
this.getCollegeMajorData();
this.getBatch();
this.query();
},
methods: { methods: {
dataChart(data) { dataChart(data) {
let xData = []; let xData = [];
@ -70,10 +115,10 @@ export default {
for (let key in data) { for (let key in data) {
xData.push(key); xData.push(key);
// % // %
yData.push((data[key]).toFixed(1)); yData.push(data[key].toFixed(1));
} }
xData = xData.map(label => label.split("").join("\n"));//x xData = xData.map((label) => label.split('').join('\n')); //x
let myChart = echarts.init(document.getElementById("map1")); let myChart = echarts.init(document.getElementById('map1'));
// //
let option = { let option = {
title: { title: {
@ -85,21 +130,30 @@ export default {
axisLabel: { axisLabel: {
interval: 0, //x interval: 0, //x
rotate: 0, //30 rotate: 0, //30
} },
}, },
// //
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow' type: 'shadow',
}, },
formatter: function (params) { formatter: function (params) {
return params[0].name + '<br/>' + return (
params[0].name +
'<br/>' +
'<table>' + '<table>' +
'<tr><td>' + params[0].marker + '</td><td style="font-weight: bold;">' + '&nbsp;&nbsp;&nbsp;&nbsp;' + params[0].value + '%' + '</td></tr>' + '<tr><td>' +
'<tr>' params[0].marker +
+ '</table>'; '</td><td style="font-weight: bold;">' +
} '&nbsp;&nbsp;&nbsp;&nbsp;' +
params[0].value +
'%' +
'</td></tr>' +
'<tr>' +
'</table>'
);
},
}, },
toolbox: { toolbox: {
// show: true, // show: true,
@ -114,14 +168,14 @@ export default {
left: '3%', left: '3%',
right: '4%', right: '4%',
bottom: '1%', //3% bottom: '1%', //3%
containLabel: true containLabel: true,
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
name: '通过率', name: '通过率',
axisLabel: { axisLabel: {
formatter: '{value} %' formatter: '{value} %',
} },
}, },
series: [ series: [
{ {
@ -132,16 +186,17 @@ export default {
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); myChart.setOption(option);
@ -149,11 +204,11 @@ export default {
// //
async getBatch() { async getBatch() {
const getBatch = await defHttp.get({ url: this.Url.getBatch }); const getBatch = await defHttp.get({ url: this.Url.getBatch });
this.batchOptions = getBatch.batches.map(item => { this.batchOptions = getBatch.batches.map((item) => {
return { return {
value: item.value, value: item.value,
label: item.label label: item.label,
} };
}); });
// const getCollege = await defHttp.get({ url: this.Url.getCollege }); // const getCollege = await defHttp.get({ url: this.Url.getCollege });
@ -169,21 +224,21 @@ export default {
const res = await defHttp.get({ url: this.Url.getCollegeMajor }); const res = await defHttp.get({ url: this.Url.getCollegeMajor });
//map //map
this.collegeMajorOptions = res.collegeMajor.map(item => { this.collegeMajorOptions = res.collegeMajor.map((item) => {
return { return {
value: item.college, value: item.college,
label: item.college, label: item.college,
children: item.major.map(major => { children: item.major.map((major) => {
return { return {
value: major, value: major,
label: major label: major,
} };
}) }),
} };
}); });
this.collegeMajorOptions.unshift({ value: '全校', label: '全校' }); this.collegeMajorOptions.unshift({ value: '全校', label: '全校' });
this.collegeMajor = this.collegeMajorOptions[0].value; this.collegeMajor = this.collegeMajorOptions[0].value;
console.log(this.collegeMajor) console.log(this.collegeMajor);
console.log(this.collegeMajorOptions); console.log(this.collegeMajorOptions);
}, },
// //
@ -198,7 +253,7 @@ export default {
this.collegeMajor = '全校'; this.collegeMajor = '全校';
} }
//this.batch[1]null //this.batch[1]null
let major = this.batch.length > 1 ? this.batch[1] : ""; let major = this.batch.length > 1 ? this.batch[1] : '';
this.topCollege = this.collegeMajor; this.topCollege = this.collegeMajor;
this.topBath = this.batch; this.topBath = this.batch;
this.loading = true; this.loading = true;
@ -206,25 +261,226 @@ export default {
batch: this.batch, batch: this.batch,
college: this.collegeMajor, college: this.collegeMajor,
level: 'cet4', level: 'cet4',
} };
resultData = await defHttp.get({ url: this.Url.getRate, params }); resultData = await defHttp.get({ url: this.Url.getRate, params });
this.sumRate = resultData.sumRate; this.sumRate = resultData.sumRate;
console.log("result", resultData) console.log('result', resultData);
} finally { } finally {
this.loading = false; this.loading = false;
this.$nextTick(() => { this.$nextTick(() => {
this.dataChart(resultData.data); this.dataChart(resultData.data);
}) this.draPieChart_Pass();
} this.draPieChart_Participate();
});
} }
}, },
mounted() {
this.getCollegeMajorData();
this.getBatch();
this.query();
}
} //--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,
// animationnfalse,
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();
});
},
},
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -241,4 +497,9 @@ export default {
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>

View File

@ -1,9 +1,6 @@
<template> <template>
<div> <div style="background: #ececec; padding: 15px">
<div>
<a-card :bordered="false"> <a-card :bordered="false">
<a-tabs v-model:activeKey="activeKey" type="card">
<a-tab-pane key="1" tab="对比多学院四级通过率">
<div class="query"> <div class="query">
<div> <div>
<div style="display: flex"> <div style="display: flex">
@ -19,64 +16,36 @@
<a-checkbox-group :options="collegeOptions" v-model:value="collegetab2" @change="onCollegeChange" /> <a-checkbox-group :options="collegeOptions" v-model:value="collegetab2" @change="onCollegeChange" />
</div> </div>
<div style="margin-top: 20px; margin-right: 20px; display: flex; justify-content: flex-end; align-items: center"> <div style="margin-top: 10px; margin-right: 20px; display: flex; justify-content: flex-end; align-items: center">
<a-button style="margin-left: 10px" type="primary" @click="clearCollege">清除</a-button> <a-button style="margin-left: 10px" type="primary" @click="clearCollege">清除</a-button>
<a-button style="margin-left: 10px" type="primary" @click="collegeQuery">查询</a-button> <a-button style="margin-left: 10px" type="primary" @click="collegeQuery">查询</a-button>
</div> </div>
</div> </div>
<!-- <a-select
v-model:value="collegetab2"
style="width: 300px; margin-right: 20px"
mode="multiple"
:max-tag-count="5"
:options="collegeOptions"
@change="onCollegeChange"
></a-select> -->
<!-- <a-select
v-model:value="collegeentrydate"
style="width: 200px"
:options="entrydateOptions"
mode="multiple"
:max-tag-count="5"
@change="onCollegeChange"
></a-select> -->
</div> </div>
</a-tab-pane>
</a-tabs>
</a-card> </a-card>
<a-card title="按学院分析" :loading="tab2loading" :bordered="false"> <a-card title="学院四级通过率对比" :loading="tab2loading" :bordered="false">
<template #extra> <a-row :gutter="12">
<!-- <a-select v-model:value="college" style="width: 300px" mode="multiple" :max-tag-count="2" <a-col :xl="14">
:options="collegeOptions" @change="onCollegeMajorChange"></a-select> -->
<!-- <a-select v-model:value="batch" style="margin-left: 10px;width: 120px" :options="batchOptions"></a-select> -->
<!-- <a-select v-model:value="level" style="margin-left: 10px;width: 120px" :options="levelOptions"></a-select> -->
<!-- <a-select v-model:value="entrydate" style="margin-left: 10px;width: 150px"
:options="entrydateOptions"></a-select>
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button> -->
</template>
<a-row :gutter="24">
<a-col :xl="24" :style="{ marginBottom: '24px' }">
<div class="container"> <div class="container">
<div id="map2" style="width: 100%; height: 600px"></div> <div id="map2" style="width: 100%; min-height: 400px"></div>
</div>
</a-col>
<a-col :xl="10">
<div class="container">
<div id="map3" style="width: 100%; min-height: 400px"></div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</a-card> </a-card>
</div> </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';
import bar from '/@/components/Scrollbar/src/bar';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { last } from 'xe-utils';
export default { export default {
name: 'Analysis',
data() { data() {
return { return {
activeKey: '1', activeKey: '1',
@ -127,6 +96,13 @@ export default {
lastCollegeEntrydate: [], lastCollegeEntrydate: [],
}; };
}, },
mounted() {
this.getCollegeOptions();
// this.getBatch();
this.getEntrydate();
this.allQuery();
this.getCollegeMajorData();
},
methods: { methods: {
onMajorChange(value) { onMajorChange(value) {
console.log(value, 'value'); console.log(value, 'value');
@ -462,7 +438,7 @@ export default {
name: i, name: i,
type: 'bar', type: 'bar',
// //
barWidth: 25, barWidth: 16,
data: yData, data: yData,
// //
barGap: '30%', barGap: '30%',
@ -476,7 +452,7 @@ export default {
textStyle: { textStyle: {
// //
color: 'black', color: 'black',
fontSize: 13, fontSize: 10,
}, },
}, },
color: colors[k++], color: colors[k++],
@ -489,7 +465,6 @@ export default {
// debugger // debugger
let myChart = null; let myChart = null;
console.log(tab, 'tab'); console.log(tab, 'tab');
if (tab == 'tab2') {
myChart = document.getElementById('map2'); myChart = document.getElementById('map2');
if (myChart) { if (myChart) {
myChart = echarts.getInstanceByDom(myChart); myChart = echarts.getInstanceByDom(myChart);
@ -498,21 +473,14 @@ export default {
} }
} }
myChart = echarts.init(document.getElementById('map2')); myChart = echarts.init(document.getElementById('map2'));
} else if (tab == 'tab3') {
myChart = document.getElementById('map3');
if (myChart) {
myChart = echarts.getInstanceByDom(myChart);
if (myChart) {
myChart.dispose();
}
}
myChart = echarts.init(document.getElementById('map3'));
}
// //
let option = { let option = {
title: { //title: {
text: '学院四级通过率对比', // text: '',
}, // textStyle: {
// fontSize: 14,
// },
//},
legend: {}, legend: {},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@ -528,14 +496,14 @@ export default {
return result; return result;
}, },
}, },
toolbox: { //toolbox: {
show: true, // show: true,
feature: { // feature: {
magicType: { show: true, type: ['line', 'bar'] }, // magicType: { show: true, type: ['line', 'bar'] },
restore: { show: true }, // restore: { show: true },
saveAsImage: { show: true }, // saveAsImage: { show: true },
}, // },
}, //},
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
@ -570,10 +538,15 @@ export default {
myChart.setOption(option); myChart.setOption(option);
}, 1); }, 1);
}, },
drawChart2(data, tab) {
dataChart(data, tab) {
let seriesData = []; let seriesData = [];
let xData = [];
let xData = this.majorentrydate.sort((a, b) => a - b);
if (tab == 'tab2') {
xData = this.collegeentrydate.sort((a, b) => a - b);
}
let k = 0;
let legendData = [];
let colors = [ let colors = [
'#5370c5', '#5370c5',
'#91CC75', '#91CC75',
@ -622,23 +595,26 @@ export default {
'#FAFAD2', '#FAFAD2',
'#FAF0E6 ', '#FAF0E6 ',
]; ];
let j = 0; let isJK = false;
for (let i in data) { for (let i in data) {
xData = []; console.log(i, 'i');
legendData.push(i);
let yData = []; let yData = [];
for (let key in data[i]) { // legendData=[];
xData.push(data[i][key].college); console.log(data[i], 'data[i]');
// %
yData.push(data[i][key].passRate);
}
xData = xData.map((label) => label.split('').join('\n')); //x 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({ seriesData.push({
name: i + '级累计总通过率', name: i,
type: 'bar', type: 'line',
// //
barWidth: 25, barWidth: 18,
data: yData, data: yData,
// //
barGap: '30%', barGap: '30%',
@ -652,65 +628,28 @@ export default {
textStyle: { textStyle: {
// //
color: 'black', color: 'black',
fontSize: 13, fontSize: 10,
}, },
}, },
color: colors[j++], color: colors[k++],
}, },
}, },
}); });
if (j == colors.length) {
j = 0;
}
let rankData = yData
.slice()
.sort((a, b) => b - a)
.map((value) => yData.indexOf(value) + 1);
//
if (tab == 'tab1') {
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: 13,
},
},
color: colors[j++],
},
},
});
if (j == colors.length) {
j = 0;
}
}
} }
// debugger
let myChart = null; let myChart = null;
if (tab == 'tab2') { console.log(tab, 'tab');
myChart = echarts.init(document.getElementById('map2')); myChart = document.getElementById('map3');
} else if (tab == 'tab1') { if (myChart) {
myChart = echarts.init(document.getElementById('map1')); myChart = echarts.getInstanceByDom(myChart);
} else if (tab == 'tab3') { if (myChart) {
myChart = echarts.init(document.getElementById('map3')); myChart.dispose();
} }
}
myChart = echarts.init(document.getElementById('map3'));
// //
// const college1 = this.college;
let option = { let option = {
title: { legend: {},
text: '本批次学院通过率排名',
},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@ -718,43 +657,21 @@ export default {
}, },
formatter: function (params) { formatter: function (params) {
//tooltip, //tooltip,
let result = params[0].name + '<br>'; let result = params[0].name + '级通过率<br>';
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
result += params[i].marker + params[i].seriesName + ' : ' + params[i].value + '%' + '<br>'; result += params[i].marker + legendData[i] + ' : ' + 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; return result;
}, },
}, },
toolbox: { //toolbox: {
show: true, // show: true,
feature: { // feature: {
magicType: { show: true, type: ['line', 'bar'] }, // magicType: { show: true, type: ['line', 'bar'] },
restore: { show: true }, // restore: { show: true },
saveAsImage: { show: true }, // saveAsImage: { show: true },
}, // },
}, //},
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
@ -779,56 +696,15 @@ export default {
formatter: '{value} %', formatter: '{value} %',
}, },
}, },
{
type: 'value',
name: '排名',
show: false,
},
], ],
series: seriesData, series: seriesData,
}; };
if (tab == 'tab1') {
option.series = [
{
name: '累计总通过率',
type: 'bar',
data: seriesData[0].data,
//
barWidth: 25,
// barWidth: '60%',
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
formatter: '{c}%',
textStyle: {
//
color: 'black',
fontSize: 13,
},
},
color: colors[0],
},
},
},
{
name: '排名',
type: 'bar',
data: seriesData[1].data,
label: {
show: false,
position: 'inside',
formatter: '{c}',
},
yAxisIndex: 1,
color: colors[1],
},
];
}
// 使 // 使
console.log(option, 'option');
console.log(myChart, 'myChart');
setTimeout(() => {
myChart.setOption(option); myChart.setOption(option);
}, 1);
}, },
// //
async getBatch() { async getBatch() {
@ -882,18 +758,12 @@ export default {
this.dataChart(result.data, query); this.dataChart(result.data, query);
} else if (query == 'tab2') { } else if (query == 'tab2') {
this.drawChart(result.data, query); this.drawChart(result.data, query);
this.drawChart2(result.data, query);
} }
}); });
} }
}, },
}, },
mounted() {
this.getCollegeOptions();
// this.getBatch();
this.getEntrydate();
this.allQuery();
this.getCollegeMajorData();
},
}; };
</script> </script>

View File

@ -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;">
@ -53,7 +54,6 @@ 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,
@ -100,13 +100,13 @@ export default {
customCell: (_, index) => ({ customCell: (_, index) => ({
rowSpan: index % 2 === 0 ? 2 : 0, rowSpan: index % 2 === 0 ? 2 : 0,
}), }),
} },
], ],
Url: { Url: {
getEntrydate: '/cet/getEntrydate', getEntrydate: '/cet/getEntrydate',
getCollege: '/cet/getCollege', getCollege: '/cet/getCollege',
getData: '/cet/getData', getData: '/cet/getData',
getCollegeMajor: '/cet/getCollegeMajor' getCollegeMajor: '/cet/getCollegeMajor',
}, },
total: 0, total: 0,
totalName: '', totalName: '',
@ -125,6 +125,12 @@ export default {
topEntrydate: null, // topEntrydate: null, //
}; };
}, },
mounted() {
this.getEntrydateAndCollegeData();
this.getCollegeMajorData();
this.query();
this.map2Chart();
},
methods: { methods: {
// //
async getEntrydateAndCollegeData() { async getEntrydateAndCollegeData() {
@ -141,17 +147,17 @@ export default {
async getCollegeMajorData() { async getCollegeMajorData() {
const res = await defHttp.get({ url: this.Url.getCollegeMajor }); const res = await defHttp.get({ url: this.Url.getCollegeMajor });
//map //map
this.collegeMajorOptions = res.collegeMajor.map(item => { this.collegeMajorOptions = res.collegeMajor.map((item) => {
return { return {
value: item.college, value: item.college,
label: item.college, label: item.college,
children: item.major.map(major => { children: item.major.map((major) => {
return { return {
value: major, value: major,
label: major label: major,
} };
}) }),
} };
}); });
// //
this.collegeMajorOptions.unshift({ value: '专升本', label: '专升本' }); this.collegeMajorOptions.unshift({ value: '专升本', label: '专升本' });
@ -165,65 +171,64 @@ export default {
async query() { async query() {
try { try {
//this.collegeMajor[1]null //this.collegeMajor[1]null
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : ""; let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : '';
this.topCollege = this.collegeMajor[0]; this.topCollege = this.collegeMajor[0];
this.topMajor = major; this.topMajor = major;
this.topEntrydate = this.entrydate; this.topEntrydate = this.entrydate;
if (this.college) if (this.college) this.loading = true;
this.loading = true;
let params = { let params = {
college: this.collegeMajor[0], college: this.collegeMajor[0],
major: major, major: major,
entrydate: this.entrydate entrydate: this.entrydate,
} };
console.log("params", params); console.log('params', params);
const result = await defHttp.get({ url: this.Url.getData, params }); const result = await defHttp.get({ url: this.Url.getData, params });
let tableData = []; let tableData = [];
let piedata = []; let piedata = [];
let passrate = 0; let passrate = 0;
let index = 0; let index = 0;
const passRate = {} const passRate = {};
if(result.cet4["大一学年"] != undefined) { if (result.cet4['大一学年'] != undefined) {
passRate["大一学年"] = result.cet4["大一学年"]; passRate['大一学年'] = result.cet4['大一学年'];
} }
if(result.cet4["大二学年"] != undefined) { if (result.cet4['大二学年'] != undefined) {
passRate["大二学年"] = result.cet4["大二学年"]; passRate['大二学年'] = result.cet4['大二学年'];
} }
if(result.cet4["大三学年"] != undefined) { if (result.cet4['大三学年'] != undefined) {
passRate["大三学年"] = result.cet4["大三学年"]; passRate['大三学年'] = result.cet4['大三学年'];
} }
if(result.cet4["大四学年"] != undefined) { if (result.cet4['大四学年'] != undefined) {
passRate["大四学年"] = result.cet4["大四学年"]; passRate['大四学年'] = result.cet4['大四学年'];
} }
result.cet4 = passRate; result.cet4 = passRate;
for (let grade in result.cet4) { for (let grade in result.cet4) {
result.cet4[grade].forEach(item => { result.cet4[grade].forEach((item) => {
if (index % 2 == 0) { if (index % 2 == 0) {
piedata.push({ value: parseFloat(item.gradepassrate - passrate).toFixed(3), name: grade + "时通过" }); piedata.push({ value: parseFloat(item.gradepassrate - passrate).toFixed(3), name: grade + '时通过' });
passrate = parseFloat(item.gradepassrate).toFixed(3); passrate = parseFloat(item.gradepassrate).toFixed(3);
} }
index++ index++;
tableData.push({ tableData.push({
grade: grade, grade: grade,
attendNumber: item.attendNumber, attendNumber: item.attendNumber,
batch: item.batch, batch: item.batch,
gradepassrate: (item.gradepassrate * 100).toFixed(1) + '%', gradepassrate: (item.gradepassrate * 100).toFixed(1) + '%',
passNumber: item.passNumber, passNumber: item.passNumber,
batchpassrate: (item.batchpassrate * 100).toFixed(1) + '%' batchpassrate: (item.batchpassrate * 100).toFixed(1) + '%',
}); });
}); });
} }
console.log("tableData", tableData); console.log('tableData', tableData);
this.dataSourceCet4 = tableData; // this.dataSourceCet4 = tableData; //
this.total = result.total; // this.total = result.total; //
this.totalName = result.totalName; // this.totalName = result.totalName; //
this.passNumberBottom = result.passNumber; // this.passNumberBottom = result.passNumber; //
this.passRateBottom = (result.passRate * 100).toFixed(1) + '%'; // this.passRateBottom = (result.passRate * 100).toFixed(1) + '%'; //
// //
this.passRatePie = []// this.passRatePie = []; //
this.passRatePie.push({ value: result.passRate, name: '已通过' }); this.passRatePie.push({ value: result.passRate, name: '已通过' });
this.passRatePie.push({ value: 1 - result.passRate, name: '未通过' }) this.passRatePie.push({ value: 1 - result.passRate, name: '未通过' });
piedata.push({ value: (1 - passrate).toFixed(3), name: '未通过' }); // piedata.push({ value: (1 - passrate).toFixed(3), name: '未通过' }); //
setTimeout(() => { setTimeout(() => {
this.drawPieChart(piedata); this.drawPieChart(piedata);
@ -234,21 +239,58 @@ export default {
} }
}, },
test() { test() {
defHttp.get({ url: "/cet/getTest" }); 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) { drawPieChart(piedata) {
console.log(this.passRatePie) console.log(this.passRatePie);
console.log("piedata", piedata) console.log('piedata', piedata);
let myChart = echarts.init(document.getElementById('piechart')); let myChart = echarts.init(document.getElementById('piechart'));
let option = { let option = {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
confine: false, confine: false,
avoidLabelOverlap: true,
// //
itemStyle: { itemStyle: {
fontSize: 100 fontSize: 100,
} },
}, },
title: { title: {
@ -256,45 +298,23 @@ export default {
left: 'left', left: 'left',
top: '0%', top: '0%',
textStyle: { textStyle: {
fontSize: 20 fontSize: 16,
} },
}, },
legend: { legend: {
top: '5%', top: 'center',
left: 'center' right: '0%',
orient: 'vertical',
}, },
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'], color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [ 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: '四级通过率', name: '四级通过率',
type: 'pie', type: 'pie',
radius: ['35%', '60%'], center: ['30%', '50%'],
radius: ['35%', '70%'],
itemStyle: { itemStyle: {
borderRadius: 10, borderRadius: 10,
borderColor: '#fff', borderColor: '#fff',
@ -303,38 +323,30 @@ export default {
label: { label: {
show: true, show: true,
fontSize: 14, fontSize: 14,
overflow: 'truncate' overflow: 'truncate',
minMargin: -1,
}, },
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowColor: 'rgba(0, 0, 0, 0.5)',
}, },
label: { label: {
show: true, show: true,
fontSize: 15, fontSize: 15,
fontWeight: 'bold' 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>