Compare commits

..

No commits in common. "54d1bcb9aab5287dcba53a868968f4aab7c0b19a" and "cf6302cc71e939b35deda480ceadffc0cc55523b" have entirely different histories.

2 changed files with 214 additions and 313 deletions

View File

@ -59,15 +59,10 @@
:options="entrydateOptions"></a-select>
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button> -->
</template>
<a-row :gutter="12">
<a-col :xl="14">
<a-row :gutter="24">
<a-col :xl="24" :style="{ marginBottom: '24px' }">
<div class="container">
<div id="map3" style="width: 100%; height: 400px"></div>
</div>
</a-col>
<a-col :xl="10">
<div class="container">
<div id="map4" style="width: 100%; height: 400px"></div>
<div id="map3" style="width: 100%; height: 600px"></div>
</div>
</a-col>
</a-row>
@ -79,37 +74,7 @@
import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts';
import { message } from 'ant-design-vue';
import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts';
import { message } from 'ant-design-vue';
export default {
data() {
return {
activeKey: '1',
allCollege: [],
showBox: false,
showGroup: false,
oneentrydate: null,
collegeentrydate: [],
majorentrydate: [],
lastMajorEntrydate: [],
checkedOptions: [],
collegetab2: [],
collegeMajorOptions: [],
collegeMajor: [],
Url: {
getBatch: '/cet/getBatch',
getEntrydate: '/cet/getEntrydate',
getCollege: '/cet/getCollege',
getCollegeRate: '/cet/getRateByCollege',
getAllRate: '/cet/getAllRate',
getCollegeMajor: '/cet/getCollegeMajor',
getRateByMajor: '/cet/getRateByMajor',
},
tab1loading: false,
tab2loading: false,
tab3loading: false,
export default {
data() {
return {
@ -228,31 +193,48 @@
this.tab3loading = false;
this.$nextTick(() => {
this.drawChart(res.data, 'tab3');
this.drawChart2(res.data, 'tab3');
});
}
},
collegeQuery() {
if (this.collegeentrydate.length == 0) {
message.error('请选择年级');
return;
}
if (this.collegetab2.length == 0) {
message.error('请选择学院');
return;
}
//
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 = [''];
console.log(this.collegeMajor, 'collegeMajor');
console.log(this.collegeMajorOptions, 'collegeMajorOptions1');
this.tab2loading = true;
let query = 'tab2';
this.query(query, this.collegetab2, this.collegeentrydate);
},
test(value) {
console.log(this.collegeMajor);
console.log(value);
},
//
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];
},
//
async getCollegeMajorData() {
const res = await defHttp.get({ url: this.Url.getCollegeMajor });
@ -274,20 +256,11 @@
console.log(this.collegeMajorOptions, 'collegeMajorOptions1');
},
getCollegeOptions() {
defHttp.get({ url: this.Url.getCollege }).then((res) => {
this.collegeOptions = res.colleges;
//
getCollegeOptions() {
defHttp.get({ url: this.Url.getCollege }).then((res) => {
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.collegeOptions.forEach(option => {
// if (option.value !== '') {
@ -383,117 +356,6 @@
this.majorLength--;
},
//
onMajorCollegeChange(value) {
let val = value.target.value;
console.log(val, 'value');
console.log(this.collegeMajorOptions.find((item) => item.value == val).children, 'majorOptions');
this.majorOptions = this.collegeMajorOptions.find((item) => item.value == val).children;
//this.majorCheckOnthis.lastCollegeMajorthis.lastCollegeMajorthis.majorCheckOn,
// for (let i = 0; i < this.majorCheckOn.length; i++) {
// if (!this.lastCollegeMajor.includes(this.majorCheckOn[i])) {
// this.lastCollegeMajor.push(this.majorCheckOn[i]);
// }
// }
// for (let i = 0; i < this.lastCollegeMajor.length; i++) {
// if (!this.majorCheckOn.includes(this.lastCollegeMajor[i])) {
// this.lastCollegeMajor.splice(i, 1);
// console.log("splice")
// }
// }
// this.lastCollegeMajor = this.majorCheckOn;
console.log(this.lastCollegeMajor, 'lastCollegeMajor');
this.majorCheckOn = this.lastCollegeMajor.map((item) => item[1]);
console.log(this.majorCheckOn, 'majorCheckOn');
},
// });
// this.college = [''];
// this.collegetab2 = ['', ''];
console.log(this.collegeOptions, 'collegeOptions');
});
},
onMajorEntrydateChange(value) {
console.log(value, 'value');
if (value.length > 5) {
//valuethis.lastMajorEntrydate
for (let i = 0; i < value.length; i++) {
if (!this.lastMajorEntrydate.includes(value[i])) {
message.error('最多选择五个');
//value[i]
value.splice(i, 1);
return;
}
}
}
this.lastMajorEntrydate = value;
},
//
onCollegeChange(value) {
console.log(value, 'value');
if (value.length > 5) {
message.error('最多选择五个');
//lastCollegevaluelastCollege
for (let i = 0; i < value.length; i++) {
if (!this.lastCollege.includes(value[i])) {
value.splice(i, 1);
return;
}
}
return;
}
this.lastCollege = value;
},
//
onCollegeEntrydateChange(value) {
console.log(value, 'value');
if (value.length > 5) {
message.error('最多选择五个');
//lastCollegeEntrydatevaluelastCollegeEntrydate
for (let i = 0; i < value.length; i++) {
if (!this.lastCollegeEntrydate.includes(value[i])) {
value.splice(i, 1);
return;
}
}
return;
}
this.lastCollegeEntrydate = value;
},
//
onCollegeMajorChange(value) {
//valuethis.lastCollegeMajorvaluethis.lastCollegeMajor,this.majorOptionsthis.lastCollegeMajorvalue
for (let i = 0; i < value.length; i++) {
if (!this.lastCollegeMajor.map((item) => item[1]).includes(value[i])) {
if (this.majorLength == 5) {
message.error('最多选择五个');
//valuevalue[i]
value.splice(i, 1);
return;
}
this.lastCollegeMajor.push([this.collegeMajor, value[i]]);
this.majorLength++;
}
}
for (let i = 0; i < this.lastCollegeMajor.length; i++) {
if (!value.includes(this.lastCollegeMajor[i][1])) {
//this.majorOptions
if (this.majorOptions.find((item) => item.value == this.lastCollegeMajor[i][1])) {
this.lastCollegeMajor.splice(i, 1);
console.log('splice');
this.majorLength--;
}
}
}
console.log(value, 'value');
},
removeTag(index) {
if (this.majorCheckOn.includes(this.lastCollegeMajor[index][1])) {
let index1 = this.majorCheckOn.indexOf(this.lastCollegeMajor[index][1]);
this.majorCheckOn.splice(index1, 1);
}
this.lastCollegeMajor.splice(index, 1);
this.majorLength--;
},
//
onMajorCollegeChange(value) {
let val = value.target.value;
console.log(val, 'value');
@ -517,20 +379,6 @@
console.log(this.majorCheckOn, 'majorCheckOn');
},
clearMajor() {
this.majorCheckOn = [];
this.lastCollegeMajor = [];
this.majorLength = 0;
},
clearCollege() {
this.collegetab2 = [];
this.collegeentrydate = [];
this.lastCollege = [];
this.lastCollegeEntrydate = [];
},
//tab2\3
drawChart(data, tab) {
let seriesData = [];
clearMajor() {
this.majorCheckOn = [];
this.lastCollegeMajor = [];
@ -600,6 +448,7 @@
'#FAFAD2',
'#FAF0E6 ',
];
let isJK = false;
for (let i in data) {
console.log(i, 'i');
legendData.push(i);
@ -618,7 +467,7 @@
name: i,
type: 'bar',
//
barWidth: 16,
barWidth: 25,
data: yData,
//
barGap: '30%',
@ -640,6 +489,8 @@
},
});
}
console.log(legendData, 'legendData');
console.log(seriesData, 'dasaaseriresdata');
// debugger
let myChart = null;
console.log(tab, 'tab');
@ -664,6 +515,9 @@
}
//
let option = {
title: {
text: '专业四级通过率对比',
},
legend: {},
tooltip: {
trigger: 'axis',
@ -681,11 +535,11 @@
},
toolbox: {
show: true,
//feature: {
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true },
//},
feature: {
magicType: { show: true, type: ['line', 'bar'] },
restore: { show: true },
saveAsImage: { show: true },
},
},
grid: {
left: '3%',
@ -721,15 +575,10 @@
myChart.setOption(option);
}, 1);
},
drawChart2(data, tab) {
let seriesData = [];
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 = [];
dataChart(data, tab) {
let seriesData = [];
let xData = [];
let colors = [
'#5370c5',
'#91CC75',
@ -778,23 +627,23 @@
'#FAFAD2',
'#FAF0E6 ',
];
for (let i in data) {
console.log(i, 'i');
legendData.push(i);
let yData = [];
// legendData=[];
console.log(data[i], 'data[i]');
let j = 0;
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);
for (let i in data) {
xData = [];
let yData = [];
for (let key in data[i]) {
xData.push(data[i][key].college);
// %
yData.push(data[i][key].passRate);
}
console.log(yData, 'yData');
xData = xData.map((label) => label.split('').join('\n')); //x
seriesData.push({
name: i,
type: 'line',
name: i + '级累计总通过率',
type: 'bar',
//
barWidth: 25,
data: yData,
//
barGap: '30%',
@ -811,27 +660,62 @@
fontSize: 13,
},
},
color: colors[k++],
color: colors[j++],
},
},
});
}
// debugger
let myChart = null;
console.log(tab, 'tab');
if (tab == 'tab3') {
myChart = document.getElementById('map4');
if (myChart) {
myChart = echarts.getInstanceByDom(myChart);
if (myChart) {
myChart.dispose();
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;
}
}
myChart = echarts.init(document.getElementById('map4'));
}
let myChart = null;
if (tab == 'tab2') {
myChart = echarts.init(document.getElementById('map2'));
} else if (tab == 'tab1') {
myChart = echarts.init(document.getElementById('map1'));
} else if (tab == 'tab3') {
myChart = echarts.init(document.getElementById('map3'));
}
//
// const college1 = this.college;
let option = {
legend: {},
title: {
text: '本批次学院通过率排名',
},
tooltip: {
trigger: 'axis',
axisPointer: {
@ -839,20 +723,42 @@
},
formatter: function (params) {
//tooltip,
let result = params[0].name + '级通过率<br>';
let result = params[0].name + '<br>';
for (let i = 0; i < params.length; i++) {
result += params[i].marker + legendData[i] + ' : ' + params[i].value + '%' + '<br>';
result += params[i].marker + params[i].seriesName + ' : ' + 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;
},
},
toolbox: {
show: true,
//feature: {
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true },
//},
feature: {
magicType: { show: true, type: ['line', 'bar'] },
restore: { show: true },
saveAsImage: { show: true },
},
},
grid: {
left: '3%',
@ -878,13 +784,56 @@
formatter: '{value} %',
},
},
{
type: 'value',
name: '排名',
show: false,
},
],
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],
},
];
}
// 使
setTimeout(() => {
myChart.setOption(option);
}, 1);
myChart.setOption(option);
},
//
async getBatch() {
@ -898,11 +847,24 @@
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates;
this.oneentrydate = this.entrydateOptions[0].value;
// this.collegeentrydate = [this.entrydateOptions[0].value];
// this.majorentrydate = [this.entrydateOptions[0].value];
// this.entrydate.push (this.entrydateOptions[0].value);
},
//
async query(query, college, entrydate) {
this.visible = false;
let result = null;
// console.log(this.college, this.entrydate);
// //this.collegethis.batchnull
// if (this.college === null || this.college.length === 0) {
// this.college = [''];
// }
// if (!this.entrydate || this.entrydate.length === 0) {
// this.entrydate = ['2017'];
// }
try {
// console.log(this.college, this.entrydate)
let params = {
@ -921,8 +883,11 @@
} finally {
query == 'tab1' ? (this.tab1loading = false) : (this.tab2loading = false);
this.$nextTick(() => {
this.drawChart(result.data, query);
this.drawChart2(result.data, query);
if (query == 'tab1') {
this.dataChart(result.data, query);
} else if (query == 'tab2') {
this.drawChart(result.data, query);
}
});
}
},
@ -938,21 +903,7 @@
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
.container {
display: flex;
background-color: #fff;
padding: 15px;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
.query {
//
display: flex;
justify-content: flex-start;
align-items: center;
margin-left: 24px;
}
.query {
//
display: flex;
@ -961,11 +912,6 @@
margin-left: 24px;
}
.tab3 {
justify-content: flex-start;
align-items: center;
margin-left: 24px;
}
.tab3 {
justify-content: flex-start;
align-items: center;
@ -977,9 +923,4 @@
color: rgb(8, 8, 8);
font-weight: bold;
}
.title {
font-size: 34px;
color: rgb(8, 8, 8);
font-weight: bold;
}
</style>

View File

@ -113,8 +113,6 @@
passNumberBottom: 0,
passRateBottom: 0,
passRatePie: [],
lineXData: [],
lineYData: [],
collegeOptions: [],
collegeMajorOptions: [],
entrydateOptions: [],
@ -131,7 +129,7 @@
this.getEntrydateAndCollegeData();
this.getCollegeMajorData();
this.query();
//this.map2Chart();
this.map2Chart();
},
methods: {
//
@ -203,12 +201,8 @@
passRate['大四学年'] = result.cet4['大四学年'];
}
result.cet4 = passRate;
this.lineXData = [];
this.lineYData = [];
for (let grade in result.cet4) {
result.cet4[grade].forEach((item) => {
this.lineXData.push(item.batch);
this.lineYData.push((item.batchpassrate * 100).toFixed(1));
if (index % 2 == 0) {
piedata.push({ value: parseFloat(item.gradepassrate - passrate).toFixed(3), name: grade + '时通过' });
passrate = parseFloat(item.gradepassrate).toFixed(3);
@ -238,7 +232,6 @@
piedata.push({ value: (1 - passrate).toFixed(3), name: '未通过' }); //
setTimeout(() => {
this.drawPieChart(piedata);
this.map2Chart();
}, 100);
// this.drawPieChart();
} finally {
@ -260,26 +253,7 @@
},
},
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;">' +
'&nbsp;&nbsp;&nbsp;&nbsp;' +
params[0].value +
'%' +
'</td></tr>' +
'<tr>' +
'</table>'
);
},
trigger: 'item',
},
grid: {
top: '50px',
@ -289,29 +263,15 @@
},
xAxis: {
type: 'category',
data: this.lineXData,
data: ['2017-12-01', '2017-12-01', '2017-12-01', '2017-12-01', '2017-12-01'],
},
yAxis: {
type: 'value',
},
series: [
{
data: this.lineYData,
data: [150, 230, 224, 218, 135],
type: 'line',
itemStyle: {
normal: {
label: {
show: true, //
position: 'top', //
textStyle: {
//
color: 'black',
fontSize: 12,
},
formatter: '{c}%',
},
},
},
},
],
};