加入专业

This commit is contained in:
xbx 2024-04-02 18:00:44 +08:00
parent f8a938049f
commit 50a62cbae3
1 changed files with 37 additions and 6 deletions

View File

@ -2,7 +2,8 @@
<div style="background: #ececec; padding: 25px">
<a-card title="四级总通过率查询" :loading="loading" :bordered="false">
<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-select v-model:value="entrydate" style="margin-left: 10px;width: 100px"
:options="entrydateOptions"></a-select>
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
@ -57,13 +58,16 @@ export default {
Url: {
getEntrydate: '/cet/getEntrydate',
getCollege: '/cet/getCollege',
getData: '/cet/getData'
getData: '/cet/getData',
getCollegeMajor: '/cet/getCollegeMajor'
},
total: 0,
collegeOptions: [],
collegeMajorOptions: [],
entrydateOptions: [],
college: null,
entrydate: null
entrydate: null,
collegeMajor: null
};
},
methods: {
@ -78,14 +82,40 @@ export default {
this.entrydateOptions = getEntrydate.entrydates;
this.entrydate = this.entrydateOptions[0].value;
},
//
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.collegeMajorOptions.unshift({ value: '全校', label: '全校' });
this.collegeMajor = ['全校'];
console.log(this.collegeMajorOptions);
},
//
async query() {
try {
//this.collegeMajor[1]null
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : "";
if (this.college)
this.loading = true;
let params = {
college: this.college,
college: this.collegeMajor[0],
major: major,
entrydate: this.entrydate
}
console.log("params", params);
const result = await defHttp.get({ url: this.Url.getData, params });
this.dataSourceCet4 = result.cet4;
this.total = result.total;
@ -93,10 +123,11 @@ export default {
} finally {
this.loading = false;
}
}
},
},
mounted() {
this.getEntrydateAndCollegeData();
this.getCollegeMajorData();
}
}