Merge branch 'DEV' of http://82.157.76.162:3000/Big-Data-Lab/CET-vue-3.0 into DEV
This commit is contained in:
commit
59d3f54666
|
@ -1,14 +1,65 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="background: #ececec; padding: 15px">
|
<div style="background: #ececec; padding: 15px">
|
||||||
|
|
||||||
|
|
||||||
|
<a-card :bordered="false">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a-button type="primary" @click="visible = true">打开筛选项</a-button>
|
||||||
|
</div>
|
||||||
|
<a-drawer placement="right" :visible="visible" width="90%" :closable="false">
|
||||||
|
|
||||||
|
<template slot="title">
|
||||||
|
<span>CET查询筛选项</span>
|
||||||
|
</template>
|
||||||
|
<a-descriptions bordered>
|
||||||
|
|
||||||
|
<a-descriptions-item label="学院" :span="3">
|
||||||
|
|
||||||
|
<a-checkbox v-model="allCollege" :disabled="showBox" @change="checkAll">
|
||||||
|
全校
|
||||||
|
</a-checkbox>
|
||||||
|
<a-checkbox-group v-model="checkedOptions" :options="collegeOptions" :disabled="showGroup"
|
||||||
|
@change="checkOne"></a-checkbox-group>
|
||||||
|
|
||||||
|
</a-descriptions-item>
|
||||||
|
|
||||||
|
<a-descriptions-item label="年级" :span="3" v-if="showGroup">
|
||||||
|
<a-radio-group v-model:value="oneentrydate" :options="entrydateOptions" @change="checkoneentrydate" />
|
||||||
|
</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="年级" :span="3" v-if="showBox">
|
||||||
|
<a-checkbox-group v-model:value="entrydate" :options="entrydateOptions" />
|
||||||
|
</a-descriptions-item>
|
||||||
|
</a-descriptions>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<a-button type="primary" style="margin-right: 5px;" @click="visible = false"><a-icon
|
||||||
|
type="close" />取消</a-button>
|
||||||
|
<a-button type="primary" @click="query" style="margin-right: 5px;"><a-icon type="search" />查询</a-button>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</a-drawer>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a-card title="按学院 / 专业分析" :loading="loading" :bordered="false">
|
<a-card title="按学院 / 专业分析" :loading="loading" :bordered="false">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-select v-model:value="college" style="width: 300px" mode="multiple" :max-tag-count="2"
|
<!-- <a-select v-model:value="college" style="width: 300px" mode="multiple" :max-tag-count="2"
|
||||||
:options="collegeOptions" @change="onCollegeMajorChange"></a-select>
|
: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="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="level" style="margin-left: 10px;width: 120px" :options="levelOptions"></a-select> -->
|
||||||
<a-select v-model:value="entrydate" style="margin-left: 10px;width: 150px"
|
<!-- <a-select v-model:value="entrydate" style="margin-left: 10px;width: 150px"
|
||||||
:options="entrydateOptions"></a-select>
|
: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> -->
|
||||||
</template>
|
</template>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
||||||
|
@ -24,11 +75,17 @@
|
||||||
<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';
|
||||||
export default {
|
export default {
|
||||||
name: "Analysis",
|
name: "Analysis",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
allCollege:[],
|
||||||
|
showBox: false,
|
||||||
|
showGroup: false,
|
||||||
|
oneentrydate: null,
|
||||||
|
checkedOptions: [],
|
||||||
Url: {
|
Url: {
|
||||||
getBatch: '/cet/getBatch',
|
getBatch: '/cet/getBatch',
|
||||||
getEntrydate: '/cet/getEntrydate',
|
getEntrydate: '/cet/getEntrydate',
|
||||||
|
@ -42,27 +99,53 @@ export default {
|
||||||
{ value: 'cet4', label: '英语四级' },
|
{ value: 'cet4', label: '英语四级' },
|
||||||
{ value: 'cet6', label: '英语六级' }
|
{ value: 'cet6', label: '英语六级' }
|
||||||
],
|
],
|
||||||
|
visible: false,
|
||||||
level: null,
|
level: null,
|
||||||
college: null,
|
college: [],
|
||||||
batch: null,
|
batch: null,
|
||||||
entrydateOptions: [],
|
entrydateOptions: [],
|
||||||
entrydate: null,
|
entrydate: [],
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
//选择全校
|
||||||
|
checkAll(e) {
|
||||||
|
this.college = ['全校']
|
||||||
|
this.showGroup = !this.showGroup;
|
||||||
|
},
|
||||||
|
|
||||||
|
//选择学院
|
||||||
|
checkOne(e) {
|
||||||
|
console.log(e)
|
||||||
|
this.college = e;
|
||||||
|
this.showBox = true;
|
||||||
|
if (e.length == 0) {
|
||||||
|
this.showBox = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//选择年级
|
||||||
|
checkoneentrydate(e) {
|
||||||
|
console.log(e.target.value, "e")
|
||||||
|
this.entrydate = [e.target.value];
|
||||||
|
|
||||||
|
},
|
||||||
getCollegeOptions() {
|
getCollegeOptions() {
|
||||||
defHttp.get({ url: this.Url.getCollege }).then(res => {
|
defHttp.get({ url: this.Url.getCollege }).then(res => {
|
||||||
this.collegeOptions = res.colleges;
|
this.collegeOptions = res.colleges;
|
||||||
// 手动添加一个全校字段
|
// 手动添加一个全校字段
|
||||||
this.collegeOptions.unshift({ value: '全校', label: '全校' });
|
|
||||||
this.collegeOptions.forEach(option => {
|
|
||||||
if (option.value !== '全校') {
|
|
||||||
option.disabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
//this.collegeOptions.unshift({ value: '全校', label: '全校' });
|
||||||
this.college = ['全校'];
|
// this.collegeOptions.forEach(option => {
|
||||||
|
// if (option.value !== '全校') {
|
||||||
|
// option.disabled = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
// });
|
||||||
|
// this.college = ['全校'];
|
||||||
|
console.log(this.collegeOptions, "collegeOptions");
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onCollegeMajorChange(value) {
|
onCollegeMajorChange(value) {
|
||||||
|
@ -85,18 +168,87 @@ export default {
|
||||||
}
|
}
|
||||||
console.log(value);
|
console.log(value);
|
||||||
},
|
},
|
||||||
|
// deleteData() {
|
||||||
|
// console.log("delete")
|
||||||
|
// //清空所有选项
|
||||||
|
// this.college = [];
|
||||||
|
// this.entrydate = [];
|
||||||
|
// this.oneentrydate = null;
|
||||||
|
// this.checkedOptions = [];
|
||||||
|
// this.allCollege = [];
|
||||||
|
// },
|
||||||
dataChart(data) {
|
dataChart(data) {
|
||||||
|
let seriesData = [];
|
||||||
let xData = [];
|
let xData = [];
|
||||||
let yData = [];
|
let colors = ['#5370c5', '#91CC75', '#fac858', '#ee6666', '#73c0de', '#FF6A6A', '#FFA500', '#EE2C2C', '#90EE90', '#008B8B', '#FFC0CB', '#FFDAB9', '#FFDEAD', '#FFE4B5', '#FFE4C4', '#FFE4E1', '#FFEBCD', '#FFEFD5', '#FFFAF0', '#FFFAFA', '#FFFFE0', '#FFFFF0', '#FFFFFF', '#F0F8FF', '#FAEBD7', '#FAF0E6', '#FAFAD2', '#F5FFFA', '#F8F8FF', '#F0FFF0', '#F0FFFF', '#F0E68C', '#F0F8FF', '#F0FFF0', '#F0FFFF', '#F4A460', '#F5DEB3', '#F5F5DC', '#F5F5F5', '#F5FFFA', '#F8F8FF', '#F9EBEA', '#FAD7A0', '#FAF0E6', '#FAFAD2', '#FAF0E6 ']
|
||||||
for (let key in data) {
|
let j = 0;
|
||||||
xData.push(data[key].college);
|
|
||||||
// 将数据转换为百分比(加上%)
|
for (let i in data) {
|
||||||
yData.push(data[key].passRate);
|
|
||||||
|
xData = [];
|
||||||
|
let yData = [];
|
||||||
|
for (let key in data[i]) {
|
||||||
|
xData.push(data[i][key].college);
|
||||||
|
// 将数据转换为百分比(加上%)
|
||||||
|
yData.push(data[i][key].passRate);
|
||||||
|
}
|
||||||
|
xData = xData.map(label => label.split("").join("\n"));//将x轴竖着展示
|
||||||
|
seriesData.push({
|
||||||
|
name: i + '级累计总通过率',
|
||||||
|
type: 'bar',
|
||||||
|
// barWidth: '30%',
|
||||||
|
data: yData,
|
||||||
|
//颜色
|
||||||
|
|
||||||
|
itemStyle: {
|
||||||
|
normal: {
|
||||||
|
label: {
|
||||||
|
show: true,//开启显示
|
||||||
|
position: 'top',//在上方显示
|
||||||
|
formatter: '{c}%',
|
||||||
|
textStyle: { //数值样式
|
||||||
|
color: 'black',
|
||||||
|
fontSize: 13
|
||||||
|
},
|
||||||
|
},
|
||||||
|
color: colors[j++]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let rankData = yData.slice().sort((a, b) => b - a).map((value) => yData.indexOf(value) + 1);
|
||||||
|
//如果选择全校,增加排名
|
||||||
|
if (this.college.includes('全校')) {
|
||||||
|
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++]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let rankData = yData.slice().sort((a, b) => b - a).map((value) => yData.indexOf(value) + 1);
|
|
||||||
xData = xData.map(label => label.split("").join("\n"));//将x轴竖着展示
|
|
||||||
let myChart = echarts.init(document.getElementById("map1"));
|
let myChart = echarts.init(document.getElementById("map1"));
|
||||||
// 指定图表的配置项和数据
|
// 指定图表的配置项和数据
|
||||||
|
const college1 = this.college;
|
||||||
let option = {
|
let option = {
|
||||||
title: {
|
title: {
|
||||||
text: "本批次学院通过率排名",
|
text: "本批次学院通过率排名",
|
||||||
|
@ -110,11 +262,19 @@ export default {
|
||||||
type: 'shadow'
|
type: 'shadow'
|
||||||
},
|
},
|
||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
return params[0].name + '<br/>' +
|
//生成tooltip,加上小圆球
|
||||||
'<table>' +
|
let result = params[0].name + '<br>';
|
||||||
'<tr><td>' + params[0].marker + params[0].seriesName + '</td><td style="font-weight: bold;">' + ' ' + params[0].value + '%' + '</td></tr>' +
|
for (let i = 0; i < params.length; i++) {
|
||||||
'<tr><td>' + params[1].marker + params[1].seriesName + '</td><td style="font-weight: bold;">' + ' ' + params[1].value + '</td></tr>' +
|
result += params[i].marker + params[i].seriesName + ' : ' + params[i].value + '%' + '<br>';
|
||||||
'</table>';
|
}
|
||||||
|
if (college1.includes('全校')) {
|
||||||
|
result = params[0].name + '<br/>' +
|
||||||
|
'<table>' +
|
||||||
|
'<tr><td>' + params[0].marker + params[0].seriesName + '</td><td style="font-weight: bold;">' + ' ' + params[0].value + '%' + '</td></tr>' +
|
||||||
|
'<tr><td>' + params[1].marker + params[1].seriesName + '</td><td style="font-weight: bold;">' + ' ' + params[1].value + '</td></tr>' +
|
||||||
|
'</table>';
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
|
@ -156,40 +316,45 @@ export default {
|
||||||
show: false,
|
show: false,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
series: [
|
series: seriesData
|
||||||
{
|
|
||||||
name: '累计总通过率',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '60%',
|
|
||||||
data: yData,
|
|
||||||
itemStyle: {
|
|
||||||
normal: {
|
|
||||||
label: {
|
|
||||||
show: true, //开启显示
|
|
||||||
position: 'top', //在上方显示
|
|
||||||
textStyle: { //数值样式
|
|
||||||
color: 'black',
|
|
||||||
fontSize: 13
|
|
||||||
},
|
|
||||||
formatter: '{c}%'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxisIndex: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '排名',
|
|
||||||
type: 'bar',
|
|
||||||
data: rankData,
|
|
||||||
label: {
|
|
||||||
show: false,
|
|
||||||
position: 'inside',
|
|
||||||
formatter: '{c}',
|
|
||||||
},
|
|
||||||
yAxisIndex: 1,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
if (this.college.includes('全校')) {
|
||||||
|
option.series = [{
|
||||||
|
name: '累计总通过率',
|
||||||
|
type: 'bar',
|
||||||
|
data: seriesData[0].data,
|
||||||
|
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]
|
||||||
|
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
// 使用刚指定的配置项和数据显示图表。
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
myChart.setOption(option);
|
myChart.setOption(option);
|
||||||
},
|
},
|
||||||
|
@ -204,19 +369,23 @@ export default {
|
||||||
async getEntrydate() {
|
async getEntrydate() {
|
||||||
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
|
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
|
||||||
this.entrydateOptions = getEntrydate.entrydates;
|
this.entrydateOptions = getEntrydate.entrydates;
|
||||||
this.entrydate = this.entrydateOptions[0].value;
|
// this.entrydate.push (this.entrydateOptions[0].value);
|
||||||
},
|
},
|
||||||
// 查询数据
|
// 查询数据
|
||||||
async query() {
|
async query() {
|
||||||
|
this.visible = false;
|
||||||
let result = null;
|
let result = null;
|
||||||
console.log(this.college, this.entrydate);
|
console.log(this.college, this.entrydate);
|
||||||
//如果this.college和this.batch为null则先赋静态值
|
//如果this.college和this.batch为null则先赋静态值
|
||||||
if (this.college === null || this.college.length === 0) {
|
if (this.college === null || this.college.length === 0) {
|
||||||
this.college = ['全校'];
|
this.college = ['全校'];
|
||||||
}
|
}
|
||||||
if (!this.entrydate) {
|
|
||||||
this.entrydate = '2017';
|
|
||||||
|
if (!this.entrydate || this.entrydate.length === 0) {
|
||||||
|
this.entrydate = ['2017'];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
console.log(this.college, this.entrydate)
|
console.log(this.college, this.entrydate)
|
||||||
|
@ -228,9 +397,9 @@ export default {
|
||||||
console.log(params.college, "college")
|
console.log(params.college, "college")
|
||||||
result = await defHttp.post({ url: this.Url.getRate, params });
|
result = await defHttp.post({ url: this.Url.getRate, params });
|
||||||
//使数据按照passRate从大到小排序
|
//使数据按照passRate从大到小排序
|
||||||
result.data.sort((a, b) => {
|
// result.data.sort((a, b) => {
|
||||||
return b.passRate - a.passRate;
|
// return b.passRate - a.passRate;
|
||||||
});
|
// });
|
||||||
console.log("data", result.data);
|
console.log("data", result.data);
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
Loading…
Reference in New Issue