部分需求

This commit is contained in:
xbx 2024-04-15 21:55:27 +08:00
parent 9d1b7cc623
commit 06f8f0c7d9
4 changed files with 306 additions and 259 deletions

View File

@ -2,7 +2,8 @@
<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="college" style="width: 300px" mode="multiple" :max-tag-count="2" :options="collegeOptions" @change="onCollegeMajorChange"></a-select> <a-select v-model:value="college" style="width: 300px" mode="multiple" :max-tag-count="2"
: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"
@ -71,13 +72,13 @@ export default {
option.disabled = true; option.disabled = true;
} }
}); });
}else{ } else {
this.collegeOptions.forEach(option => { this.collegeOptions.forEach(option => {
option.disabled = false; option.disabled = false;
if (value!=='全校'&&option.value === '全校') { if (value !== '全校' && option.value === '全校') {
option.disabled = true; option.disabled = true;
} }
if(value.length===0){ if (value.length === 0) {
option.disabled = false; option.disabled = false;
} }
}); });
@ -108,8 +109,8 @@ export default {
formatter: function (params) { formatter: function (params) {
return params[0].name + '<br/>' + return params[0].name + '<br/>' +
'<table>' + '<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[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>' + '<tr><td>' + params[1].marker + params[1].seriesName + '</td><td style="font-weight: bold;">' + '&nbsp;&nbsp;&nbsp;&nbsp;' + params[1].value + '</td></tr>' +
'</table>'; '</table>';
} }
}, },
@ -207,7 +208,7 @@ export default {
let result = null; let result = null;
console.log(this.college, this.entrydate); console.log(this.college, this.entrydate);
//this.collegethis.batchnull //this.collegethis.batchnull
if (this.college===null||this.college.length===0) { if (this.college === null || this.college.length === 0) {
this.college = ['全校']; this.college = ['全校'];
} }
if (!this.entrydate) { if (!this.entrydate) {
@ -221,7 +222,7 @@ export default {
entrydate: this.entrydate, entrydate: this.entrydate,
level: 'cet4' level: 'cet4'
} }
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) => {

View File

@ -67,7 +67,7 @@ export default {
data: xData, data: xData,
axisLabel: { axisLabel: {
interval: 0,//x interval: 0,//x
rotate: -20,//30 rotate: -10,//30
} }
}, },
tooltip: { tooltip: {

View File

@ -2,28 +2,29 @@
<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>
<a-select v-model:value="batch" :options="batchOptions" change-on-select style="margin-left: 10px;width: 100px" /> <a-select v-model:value="batch" :options="batchOptions" change-on-select
style="margin-left: 10px;width: 100px" />
<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: 450px;"></div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</a-card> </a-card>
</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';
export default { export default {
name: "Analysis", name: "Analysis",
data() { data() {
@ -52,12 +53,13 @@
dataChart(data) { dataChart(data) {
let xData = []; let xData = [];
let yData = []; let yData = [];
console.log(data,"data") console.log(data, "data")
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
let myChart = echarts.init(document.getElementById("map1")); let myChart = echarts.init(document.getElementById("map1"));
// //
let option = { let option = {
@ -69,9 +71,10 @@
data: xData, data: xData,
axisLabel: { axisLabel: {
interval: 0,//x interval: 0,//x
rotate: -20,//30 rotate: 0,//30
} }
}, },
//
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@ -85,6 +88,13 @@
+ '</table>'; + '</table>';
} }
}, },
//
grid: {
left: '3%',
right: '4%',
bottom: '1%',//3%
containLabel: true
},
yAxis: { yAxis: {
type: 'value', type: 'value',
name: '通过率', name: '通过率',
@ -191,22 +201,21 @@
this.query(); this.query();
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.container { .container {
display: flex; display: flex;
background-color: #fff; background-color: #fff;
padding: 15px; padding: 15px;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
} }
.title { .title {
font-size: 34px; font-size: 34px;
color: rgb(8, 8, 8); color: rgb(8, 8, 8);
font-weight: bold; font-weight: bold;
} }
</style> </style>

View File

@ -19,10 +19,12 @@
</a-tooltip> </a-tooltip>
</template> </template>
</a-table> </a-table>
<span style="font-size: 15px;float: right;margin-top: 10px;" v-if="total && total > 0"> <div style="display: flex; justify-content: space-between; font-size: 15px; margin-top: 10px;"
学院 / 专业总人数: {{ total }} v-if="total && total > 0">
</span> <span>学院 / 专业总人数: {{ total }}</span>
<span>累计通过人数: {{ passNumberBottom }}</span>
<span>累计总通过率: {{ passRateBottom }}</span>
</div>
</div> </div>
</a-col> </a-col>
<a-col :xl="11"> <a-col :xl="11">
@ -99,6 +101,9 @@ export default {
getCollegeMajor: '/cet/getCollegeMajor' getCollegeMajor: '/cet/getCollegeMajor'
}, },
total: 0, total: 0,
passNumberBottom: 0,
passRateBottom: 0,
passRatePie: [],
collegeOptions: [], collegeOptions: [],
collegeMajorOptions: [], collegeMajorOptions: [],
entrydateOptions: [], entrydateOptions: [],
@ -169,14 +174,13 @@ export default {
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, gradepassrate: (item.gradepassrate * 100).toFixed(1) + '%',
passNumber: item.passNumber, passNumber: item.passNumber,
batchpassrate: item.batchpassrate batchpassrate: (item.batchpassrate * 100).toFixed(1) + '%'
}); });
}); });
} }
@ -184,6 +188,13 @@ export default {
console.log("tableData", tableData); console.log("tableData", tableData);
this.dataSourceCet4 = tableData; this.dataSourceCet4 = tableData;
this.total = result.total; this.total = result.total;
this.passNumberBottom = result.passNumber;
this.passRateBottom = (result.passRate * 100).toFixed(1) + '%';
//
//
this.passRatePie =[]
this.passRatePie.push({ value: 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);
@ -196,33 +207,21 @@ export default {
test() { test() {
defHttp.get({ url: "/cet/getTest" }); defHttp.get({ url: "/cet/getTest" });
}, },
renderGrade(record, index) {
console.log(record, "record", index, "index");
console.log(record.grade)
if (index % 2 == 0) {
return {
children: record.grade,
attrs: {
rowSpan: 2
}
}
} else {
return {
children: record.grade,
attrs: {
rowSpan: 0
}
}
}
},
drawPieChart(piedata) { drawPieChart(piedata) {
console.log(this.passRatePie)
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,
//
itemStyle:{
fontSize:100
}
}, },
title: { title: {
text: '四级通过率分析', text: '四级通过率分析',
left: 'left', left: 'left',
@ -235,22 +234,60 @@ export default {
top: '5%', top: '5%',
left: 'center' left: 'center'
}, },
series: [ series: [
//
{ {
name: '四级通过率', name: '四级通过率',
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['0', '30%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 3,
borderColor: '#fff',
borderWidth: 2,
normal: {
color: function (colors) {
var colorList = ['#00CD66', '#FF6A6A'];
return colorList[colors.dataIndex];
}
},
},
label: {
position: 'inner',
fontSize: 14
},
emphasis: {
label: {
show: true,
fontSize: 20,
fontWeight: 'bold'
}
},
data: this.passRatePie
},
//
{
name: '四级通过率',
type: 'pie',
radius: ['40%', '60%'],
avoidLabelOverlap: false, avoidLabelOverlap: false,
itemStyle: { itemStyle: {
borderRadius: 10, borderRadius: 10,
borderColor: '#fff', borderColor: '#fff',
borderWidth: 2 borderWidth: 2,
normal: {
color: function (colors) {
var colorList = ['#008B45', '#00CD66', '#00EE76', '#00FF7F', '#FF6A6A'];
return colorList[colors.dataIndex];
}
},
},
label: {
show: true,
fontSize:14,
overflow: 'truncate'
}, },
// label: {
// show: false,
// position: 'center'
// },
emphasis: { emphasis: {
label: { label: {
show: true, show: true,