feature/1.0版本页面优化 #1
|
@ -59,10 +59,15 @@
|
|||
: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' }">
|
||||
<a-row :gutter="12">
|
||||
<a-col :xl="14">
|
||||
<div class="container">
|
||||
<div id="map3" style="width: 100%; height: 600px"></div>
|
||||
<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>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
@ -73,12 +78,9 @@
|
|||
<script>
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import * as echarts from 'echarts';
|
||||
import bar from '/@/components/Scrollbar/src/bar';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { last } from 'xe-utils';
|
||||
|
||||
export default {
|
||||
name: 'Analysis',
|
||||
data() {
|
||||
return {
|
||||
activeKey: '1',
|
||||
|
@ -129,6 +131,13 @@ export default {
|
|||
lastCollegeEntrydate: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getCollegeOptions();
|
||||
// this.getBatch();
|
||||
this.getEntrydate();
|
||||
this.allQuery();
|
||||
this.getCollegeMajorData();
|
||||
},
|
||||
methods: {
|
||||
onMajorChange(value) {
|
||||
console.log(value, 'value');
|
||||
|
@ -189,47 +198,10 @@ export default {
|
|||
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;
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -444,7 +416,6 @@ export default {
|
|||
'#FAFAD2',
|
||||
'#FAF0E6 ',
|
||||
];
|
||||
let isJK = false;
|
||||
for (let i in data) {
|
||||
console.log(i, 'i');
|
||||
legendData.push(i);
|
||||
|
@ -463,7 +434,7 @@ export default {
|
|||
name: i,
|
||||
type: 'bar',
|
||||
//设置柱状图大小
|
||||
barWidth: 25,
|
||||
barWidth: 16,
|
||||
data: yData,
|
||||
//柱子间距
|
||||
barGap: '30%',
|
||||
|
@ -485,8 +456,6 @@ export default {
|
|||
},
|
||||
});
|
||||
}
|
||||
console.log(legendData, 'legendData');
|
||||
console.log(seriesData, 'dasaaseriresdata');
|
||||
// debugger
|
||||
let myChart = null;
|
||||
console.log(tab, 'tab');
|
||||
|
@ -511,9 +480,6 @@ export default {
|
|||
}
|
||||
// 指定图表的配置项和数据
|
||||
let option = {
|
||||
title: {
|
||||
text: '专业四级通过率对比',
|
||||
},
|
||||
legend: {},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
|
@ -531,11 +497,11 @@ export default {
|
|||
},
|
||||
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%',
|
||||
|
@ -571,10 +537,15 @@ export default {
|
|||
myChart.setOption(option);
|
||||
}, 1);
|
||||
},
|
||||
|
||||
dataChart(data, tab) {
|
||||
drawChart2(data, tab) {
|
||||
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 = [
|
||||
'#5370c5',
|
||||
'#91CC75',
|
||||
|
@ -623,23 +594,23 @@ export default {
|
|||
'#FAFAD2',
|
||||
'#FAF0E6 ',
|
||||
];
|
||||
let j = 0;
|
||||
|
||||
for (let i in data) {
|
||||
xData = [];
|
||||
console.log(i, 'i');
|
||||
legendData.push(i);
|
||||
let yData = [];
|
||||
for (let key in data[i]) {
|
||||
xData.push(data[i][key].college);
|
||||
// 将数据转换为百分比(加上%)
|
||||
yData.push(data[i][key].passRate);
|
||||
}
|
||||
// legendData=[];
|
||||
console.log(data[i], 'data[i]');
|
||||
|
||||
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({
|
||||
name: i + '级累计总通过率',
|
||||
type: 'bar',
|
||||
//设置柱状图大小
|
||||
barWidth: 25,
|
||||
name: i,
|
||||
type: 'line',
|
||||
data: yData,
|
||||
//柱子间距
|
||||
barGap: '30%',
|
||||
|
@ -656,62 +627,27 @@ export default {
|
|||
fontSize: 13,
|
||||
},
|
||||
},
|
||||
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;
|
||||
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'));
|
||||
console.log(tab, 'tab');
|
||||
if (tab == 'tab3') {
|
||||
myChart = document.getElementById('map4');
|
||||
if (myChart) {
|
||||
myChart = echarts.getInstanceByDom(myChart);
|
||||
if (myChart) {
|
||||
myChart.dispose();
|
||||
}
|
||||
}
|
||||
myChart = echarts.init(document.getElementById('map4'));
|
||||
}
|
||||
// 指定图表的配置项和数据
|
||||
// const college1 = this.college;
|
||||
let option = {
|
||||
title: {
|
||||
text: '本批次学院通过率排名',
|
||||
},
|
||||
legend: {},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
|
@ -719,42 +655,20 @@ export default {
|
|||
},
|
||||
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 + 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;">' +
|
||||
' ' +
|
||||
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>';
|
||||
result += params[i].marker + legendData[i] + ' : ' + params[i].value + '%' + '<br>';
|
||||
}
|
||||
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%',
|
||||
|
@ -780,56 +694,13 @@ export default {
|
|||
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);
|
||||
},
|
||||
// 获取批次数据
|
||||
async getBatch() {
|
||||
|
@ -843,24 +714,11 @@ export default {
|
|||
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.college和this.batch为null则先赋静态值
|
||||
// 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 = {
|
||||
|
@ -879,22 +737,12 @@ export default {
|
|||
} finally {
|
||||
query == 'tab1' ? (this.tab1loading = false) : (this.tab2loading = false);
|
||||
this.$nextTick(() => {
|
||||
if (query == 'tab1') {
|
||||
this.dataChart(result.data, query);
|
||||
} else if (query == 'tab2') {
|
||||
this.drawChart(result.data, query);
|
||||
}
|
||||
this.drawChart2(result.data, query);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getCollegeOptions();
|
||||
// this.getBatch();
|
||||
this.getEntrydate();
|
||||
this.allQuery();
|
||||
this.getCollegeMajorData();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -113,6 +113,8 @@
|
|||
passNumberBottom: 0,
|
||||
passRateBottom: 0,
|
||||
passRatePie: [],
|
||||
lineXData: [],
|
||||
lineYData: [],
|
||||
collegeOptions: [],
|
||||
collegeMajorOptions: [],
|
||||
entrydateOptions: [],
|
||||
|
@ -129,7 +131,7 @@
|
|||
this.getEntrydateAndCollegeData();
|
||||
this.getCollegeMajorData();
|
||||
this.query();
|
||||
this.map2Chart();
|
||||
//this.map2Chart();
|
||||
},
|
||||
methods: {
|
||||
// 获取年级和学院数据
|
||||
|
@ -201,8 +203,12 @@
|
|||
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);
|
||||
|
@ -232,6 +238,7 @@
|
|||
piedata.push({ value: (1 - passrate).toFixed(3), name: '未通过' }); //外置饼图
|
||||
setTimeout(() => {
|
||||
this.drawPieChart(piedata);
|
||||
this.map2Chart();
|
||||
}, 100);
|
||||
// this.drawPieChart();
|
||||
} finally {
|
||||
|
@ -253,7 +260,26 @@
|
|||
},
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
},
|
||||
formatter: function (params) {
|
||||
return (
|
||||
params[0].name +
|
||||
'<br/>' +
|
||||
'<table>' +
|
||||
'<tr><td>' +
|
||||
params[0].marker +
|
||||
'</td><td style="font-weight: bold;">' +
|
||||
' ' +
|
||||
params[0].value +
|
||||
'%' +
|
||||
'</td></tr>' +
|
||||
'<tr>' +
|
||||
'</table>'
|
||||
);
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
top: '50px',
|
||||
|
@ -263,15 +289,29 @@
|
|||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['2017-12-01', '2017-12-01', '2017-12-01', '2017-12-01', '2017-12-01'],
|
||||
data: this.lineXData,
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [150, 230, 224, 218, 135],
|
||||
data: this.lineYData,
|
||||
type: 'line',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: true, //开启显示
|
||||
position: 'top', //在上方显示
|
||||
textStyle: {
|
||||
//数值样式
|
||||
color: 'black',
|
||||
fontSize: 12,
|
||||
},
|
||||
formatter: '{c}%',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue