院首页动态查询功能实现

This commit is contained in:
YuNan 2025-01-20 17:36:28 +08:00
parent 8f96b9ba85
commit d66336ab60
1 changed files with 51 additions and 30 deletions

View File

@ -27,7 +27,7 @@
:pagination="false" :pagination="false"
bordered bordered
class="custom-table" class="custom-table"
:style="{ fontSize: '10px', color: '#333', marginTop: '-11px' }" :style="{ fontSize: '10px', color: '#333', marginTop: '11px' }"
:loading="loadingTable" :loading="loadingTable"
/> />
</div> </div>
@ -66,11 +66,11 @@
export default { export default {
data() { data() {
return { return {
roleName: null,
collegeStudentCount: '11', collegeStudentCount: '11',
collegeStudentPassCount: '11', collegeStudentPassCount: '11',
collegeStudentPassRate: '11', collegeStudentPassRate: '11',
schoolStudentPassRate: '11', schoolStudentPassRate: '11',
loading: false,
loadingTable: false, loadingTable: false,
loadingMap2: false, loadingMap2: false,
loadingMap3: false, loadingMap3: false,
@ -116,20 +116,37 @@
getCollegeRate: '/cet/getRateByCollege', getCollegeRate: '/cet/getRateByCollege',
getEntrydate: '/cet/getEntrydate', getEntrydate: '/cet/getEntrydate',
getCollegeMajor: '/cet/getCollegeMajor', getCollegeMajor: '/cet/getCollegeMajor',
getUserInfo: '/sys/user/getUserInfo',
queryUserRole: '/sys/user/queryUserRole',
queryById: '/sys/role/queryById',
}, },
}; };
}, },
mounted() { mounted() {
this.query(); this.query();
this.majorPassRate();
this.gradePassRate();
this.queryMajorByCollege();
}, },
methods: { methods: {
// //
async query() { async query() {
this.loadingTable = true; this.loadingTable = true;
this.loadingMap2 = true;
this.loadingMap3 = true;
this.loadingMap4 = true;
this.loadingMap5 = true;
let resultData = null; let resultData = null;
let userInfoResult = await defHttp.get({ url: this.Url.getUserInfo });
console.log('123', userInfoResult.userInfo.id);
let id = userInfoResult.userInfo.id;
let roleId = await defHttp.get({ url: this.Url.queryUserRole, params: { userid: id } });
//console.log('userAndRoleId', userAndRoleId);
//let roleId = userAndRoleId[1];
console.log('roleId', roleId);
let roleInfo = await defHttp.get({ url: this.Url.queryById, params: { id: roleId[0] } });
console.log('roleInfo', roleInfo);
this.roleName = roleInfo.roleName;
console.log('roleName', this.roleName);
this.college = this.roleName;
try { try {
//this.batchnull //this.batchnull
if (!this.batch) { if (!this.batch) {
@ -145,7 +162,7 @@
}; };
resultData = await defHttp.get({ url: this.Url.getData, params }); resultData = await defHttp.get({ url: this.Url.getData, params });
console.log('result', resultData); //console.log('result', resultData);
// //
let tableData = []; let tableData = [];
for (let grade in resultData.gradeData) { for (let grade in resultData.gradeData) {
@ -157,13 +174,16 @@
}); });
} }
this.dataSourceCet4 = tableData; // this.dataSourceCet4 = tableData; //
console.log(this.dataSourceCet4, 'dataSourceCet4'); //console.log(this.dataSourceCet4, 'dataSourceCet4');
} finally { } finally {
this.loadingTable = false; this.loadingTable = false;
this.$nextTick(() => { this.$nextTick(() => {
//this.dataChart(resultData.data); //this.dataChart(resultData.data);
console.log('cet4:', resultData.data); //console.log('cet4:', resultData.data);
this.card_Table(); this.circleMap();
this.majorPassRate();
this.gradePassRate();
this.queryMajorByCollege();
}); });
} }
}, },
@ -174,15 +194,15 @@
} }
let resultData = await defHttp.get({ url: this.Url.getCollegeMajor }); let resultData = await defHttp.get({ url: this.Url.getCollegeMajor });
let collegeAndMajor = resultData.collegeMajor; let collegeAndMajor = resultData.collegeMajor;
console.log('11111111111', collegeAndMajor); //console.log('11111111111', collegeAndMajor);
// collegeAndMajor // collegeAndMajor
let majors = collegeAndMajor.find((item) => item.college === this.college); let majors = collegeAndMajor.find((item) => item.college === this.college);
console.log('3333', majors); //console.log('3333', majors);
majors = majors.major; majors = majors.major;
this.majors = majors; this.majors = majors;
console.log('444', this.majors); //console.log('444', this.majors);
let collegeAndMajors = this.majors.map((major) => [this.college, major]); let collegeAndMajors = this.majors.map((major) => [this.college, major]);
console.log('777', collegeAndMajors); //console.log('777', collegeAndMajors);
//this.major = resultData. //this.major = resultData.
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;
@ -192,20 +212,21 @@
college: collegeAndMajors, college: collegeAndMajors,
entrydate: entrydate, entrydate: entrydate,
}; };
console.log('666'); //console.log('666');
let res = await defHttp.post({ url: this.Url.getRateByMajor, params }); let res = await defHttp.post({ url: this.Url.getRateByMajor, params });
console.log('55555', res.data); //console.log('55555', res.data);
this.loadingMap5 = false; this.loadingMap5 = false;
this.$nextTick(() => { this.$nextTick(() => {
this.drawChart(res.data); this.drawChart(res.data);
}); });
}, },
//-- //map2--
async card_Table() { async circleMap() {
this.loadingMap2 = true; this.loadingMap2 = true;
//console.log(this.passRatePie); //console.log(this.passRatePie);
//console.log('piedata', piedata); //console.log('piedata', piedata);
//this.batchnull //this.batchnull
//S
if (!this.batch) { if (!this.batch) {
this.batch = '2024-06-01'; this.batch = '2024-06-01';
} }
@ -217,10 +238,10 @@
college: this.college, college: this.college,
level: 'cet4', level: 'cet4',
}; };
console.log(queryParams, 'queryParams'); //console.log(queryParams, 'queryParams');
let result = await defHttp.get({ url: this.Url.getData, params: queryParams }); let result = await defHttp.get({ url: this.Url.getData, params: queryParams });
console.log(result, 'result'); //console.log(result, 'result');
let chartsData = []; let chartsData = [];
for (let key in result.gradeData) { for (let key in result.gradeData) {
chartsData.push({ chartsData.push({
@ -247,7 +268,7 @@
left: 'top', left: 'top',
top: '0%', top: '0%',
textStyle: { textStyle: {
fontSize: 12, fontSize: 14,
}, },
}, },
legend: { legend: {
@ -337,7 +358,7 @@
// -map3--------------------------------------------- // -map3---------------------------------------------
async majorPassRate() { async majorPassRate() {
this.loadingMap3 = true; this.loadingMap3 = true;
console.log('55555555', this.entrydate); //console.log('55555555', this.entrydate);
if (!this.batch) { if (!this.batch) {
this.batch = '2024-06-01'; this.batch = '2024-06-01';
} }
@ -353,9 +374,9 @@
level: 'cet4', level: 'cet4',
}; };
let url = this.Url.getRateByMajor; let url = this.Url.getRateByMajor;
console.log(queryParams, 'queryParams'); //console.log(queryParams, 'queryParams');
let result = await defHttp.post({ url: url, data: queryParams }); let result = await defHttp.post({ url: url, data: queryParams });
console.log('88888', result.data); //console.log('88888', result.data);
if (!result) { if (!result) {
return; return;
} }
@ -447,7 +468,7 @@
this.entrydateOptions = getEntrydate.entrydates; this.entrydateOptions = getEntrydate.entrydates;
let entrydate = this.entrydateOptions.map((item) => item.value); let entrydate = this.entrydateOptions.map((item) => item.value);
const college = ['计算机科学与信息工程学院']; const college = [this.college];
let queryParams = { let queryParams = {
college: college, college: college,
@ -568,19 +589,19 @@
'#FAF0E6 ', '#FAF0E6 ',
]; ];
for (let i in data) { for (let i in data) {
console.log(i, 'i'); //console.log(i, 'i');
legendData.push(i); legendData.push(i);
let yData = []; let yData = [];
// legendData=[]; // legendData=[];
console.log(data[i], 'data[i]'); //console.log(data[i], 'data[i]');
for (let j in data[i]) { for (let j in data[i]) {
console.log(data[i][j].college, 'data[i][j].college111'); //console.log(data[i][j].college, 'data[i][j].college111');
// if(data[i][j].college == ''){ // if(data[i][j].college == ''){
yData.push(data[i][j].passRate); yData.push(data[i][j].passRate);
// legendData.push(data[i][j].college); // legendData.push(data[i][j].college);
} }
console.log(yData, 'yData'); //console.log(yData, 'yData');
seriesData.push({ seriesData.push({
name: i, name: i,
type: 'bar', type: 'bar',
@ -672,8 +693,8 @@
series: seriesData, series: seriesData,
}; };
// 使 // 使
console.log(option, 'option'); //console.log(option, 'option');
console.log(myChart, 'myChart'); //console.log(myChart, 'myChart');
this.loadingMap5 = false; this.loadingMap5 = false;
setTimeout(() => { setTimeout(() => {
myChart.setOption(option); myChart.setOption(option);