修改部分bug
This commit is contained in:
parent
f96f5bf6ab
commit
b9d306edc5
|
@ -4,13 +4,13 @@
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<!-- <a-select v-model:value="college" style="width: 300px" :options="collegeOptions"></a-select> -->
|
<!-- <a-select v-model:value="college" style="width: 300px" :options="collegeOptions"></a-select> -->
|
||||||
<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>
|
||||||
<div>
|
<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">
|
||||||
<div id="map1" style="width: 100%; height: 400px;"></div>
|
<div id="map1" style="width: 100%; height: 400px"></div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
@ -24,14 +24,14 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Analysis",
|
name: 'Analysis',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
Url: {
|
Url: {
|
||||||
getBatch: '/cet/getBatch',
|
getBatch: '/cet/getBatch',
|
||||||
getCollege: '/cet/getCollege',
|
getCollege: '/cet/getCollege',
|
||||||
getRate: '/cet/getRateByAllBatch',
|
getRate: '/cet/getRateByAllBatch',
|
||||||
getCollegeMajor: '/cet/getCollegeMajor'
|
getCollegeMajor: '/cet/getCollegeMajor',
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
collegeOptions: [],
|
collegeOptions: [],
|
||||||
|
@ -39,12 +39,12 @@ 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,
|
||||||
batch: null,
|
batch: null,
|
||||||
collegeMajor: null
|
collegeMajor: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -54,41 +54,50 @@ 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));
|
||||||
}
|
}
|
||||||
let myChart = echarts.init(document.getElementById("map1"));
|
let myChart = echarts.init(document.getElementById('map1'));
|
||||||
// 指定图表的配置项和数据
|
// 指定图表的配置项和数据
|
||||||
let option = {
|
let option = {
|
||||||
title: {
|
title: {
|
||||||
text: "学院 / 专业通过率变化",
|
text: '学院 / 专业通过率变化',
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: xData,
|
data: xData,
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
interval: 0,//代表显示所有x轴标签显示
|
interval: 0, //代表显示所有x轴标签显示
|
||||||
rotate: -10,//代表倾斜30度显示
|
rotate: -10, //代表倾斜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;">' + ' ' + params[0].value + '%' + '</td></tr>' +
|
'<tr><td>' +
|
||||||
'<tr>'
|
params[0].marker +
|
||||||
+ '</table>';
|
'</td><td style="font-weight: bold;">' +
|
||||||
}
|
' ' +
|
||||||
|
params[0].value +
|
||||||
|
'%' +
|
||||||
|
'</td></tr>' +
|
||||||
|
'<tr>' +
|
||||||
|
'</table>'
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
name: '通过率',
|
name: '通过率',
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
formatter: '{value} %'
|
formatter: '{value} %',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
|
@ -99,16 +108,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);
|
||||||
|
@ -129,17 +139,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.collegeMajor = this.collegeMajorOptions[0].value;
|
this.collegeMajor = this.collegeMajorOptions[0].value;
|
||||||
console.log(this.collegeMajorOptions);
|
console.log(this.collegeMajorOptions);
|
||||||
|
@ -147,36 +157,40 @@ export default {
|
||||||
// 查询数据
|
// 查询数据
|
||||||
async query() {
|
async query() {
|
||||||
let data = null;
|
let data = null;
|
||||||
|
console.log(this.collegeMajor, 'collegeMajor');
|
||||||
try {
|
try {
|
||||||
console.log("sb", this.collegeMajor);
|
|
||||||
//如果this.collegeMajor为null则先赋个值
|
//如果this.collegeMajor为null则先赋个值
|
||||||
if (!this.collegeMajor) {
|
if (!this.collegeMajor) {
|
||||||
this.collegeMajor = ['东语学院'];
|
this.collegeMajor = ['东语学院'];
|
||||||
}
|
}
|
||||||
|
let major = null;
|
||||||
|
let college = null;
|
||||||
//如果this.collegeMajor[1]不存在则设为null
|
//如果this.collegeMajor[1]不存在则设为null
|
||||||
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : "";
|
college = this.collegeMajor[0];
|
||||||
|
major=this.collegeMajor.length>1?this.collegeMajor[1]:'';
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
console.log(college, major,"college,major");
|
||||||
let params = {
|
let params = {
|
||||||
college: this.collegeMajor[0],
|
college: college,
|
||||||
major: major,
|
major: major,
|
||||||
level: 'cet4',
|
level: 'cet4',
|
||||||
}
|
};
|
||||||
data = await defHttp.get({ url: this.Url.getRate, params });
|
data = await defHttp.get({ url: this.Url.getRate, params });
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.dataChart(data);
|
this.dataChart(data);
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getCollegeMajorData();
|
this.getCollegeMajorData();
|
||||||
this.getBatch();
|
this.getBatch();
|
||||||
this.query();
|
// this.query();
|
||||||
}
|
},
|
||||||
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
Loading…
Reference in New Issue