加入专业
This commit is contained in:
parent
f8a938049f
commit
50a62cbae3
|
@ -2,7 +2,8 @@
|
||||||
<div style="background: #ececec; padding: 25px">
|
<div style="background: #ececec; padding: 25px">
|
||||||
<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" :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"
|
<a-select v-model:value="entrydate" style="margin-left: 10px;width: 100px"
|
||||||
:options="entrydateOptions"></a-select>
|
:options="entrydateOptions"></a-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>
|
||||||
|
@ -57,13 +58,16 @@ export default {
|
||||||
Url: {
|
Url: {
|
||||||
getEntrydate: '/cet/getEntrydate',
|
getEntrydate: '/cet/getEntrydate',
|
||||||
getCollege: '/cet/getCollege',
|
getCollege: '/cet/getCollege',
|
||||||
getData: '/cet/getData'
|
getData: '/cet/getData',
|
||||||
|
getCollegeMajor: '/cet/getCollegeMajor'
|
||||||
},
|
},
|
||||||
total: 0,
|
total: 0,
|
||||||
collegeOptions: [],
|
collegeOptions: [],
|
||||||
|
collegeMajorOptions: [],
|
||||||
entrydateOptions: [],
|
entrydateOptions: [],
|
||||||
college: null,
|
college: null,
|
||||||
entrydate: null
|
entrydate: null,
|
||||||
|
collegeMajor: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -78,14 +82,40 @@ export default {
|
||||||
this.entrydateOptions = getEntrydate.entrydates;
|
this.entrydateOptions = getEntrydate.entrydates;
|
||||||
this.entrydate = this.entrydateOptions[0].value;
|
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() {
|
async query() {
|
||||||
try {
|
try {
|
||||||
|
//如果this.collegeMajor[1]不存在则设为null
|
||||||
|
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : "";
|
||||||
|
if (this.college)
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let params = {
|
let params = {
|
||||||
college: this.college,
|
college: this.collegeMajor[0],
|
||||||
|
major: major,
|
||||||
entrydate: this.entrydate
|
entrydate: this.entrydate
|
||||||
}
|
}
|
||||||
|
console.log("params", params);
|
||||||
const result = await defHttp.get({ url: this.Url.getData, params });
|
const result = await defHttp.get({ url: this.Url.getData, params });
|
||||||
this.dataSourceCet4 = result.cet4;
|
this.dataSourceCet4 = result.cet4;
|
||||||
this.total = result.total;
|
this.total = result.total;
|
||||||
|
@ -93,10 +123,11 @@ export default {
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getEntrydateAndCollegeData();
|
this.getEntrydateAndCollegeData();
|
||||||
|
this.getCollegeMajorData();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue