增加专业

This commit is contained in:
xbx 2024-04-03 14:36:10 +08:00
parent 50a62cbae3
commit e7786d3429
3 changed files with 66 additions and 16 deletions

View File

@ -1,8 +1,8 @@
<template> <template>
<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-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-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button> <a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
@ -44,6 +44,14 @@ export default {
}; };
}, },
methods: { methods: {
getCollegeOptions() {
defHttp.get({ url: this.Url.getCollege }).then(res => {
this.collegeOptions = res.colleges;
//
this.collegeOptions.unshift({ value: '全校', label: '全校' });
this.college = this.collegeOptions[0].value;
});
},
dataChart(data) { dataChart(data) {
let xData = []; let xData = [];
let yData = []; let yData = [];
@ -102,14 +110,22 @@ export default {
this.batchOptions = getBatch.batches; this.batchOptions = getBatch.batches;
this.batch = this.batchOptions[0].value; this.batch = this.batchOptions[0].value;
this.level = this.levelOptions[0].value; this.level = this.levelOptions[0].value;
this.query();
}, },
// //
async query() { async query() {
let data = null; let data = null;
console.log(this.college, this.batch);
//this.collegethis.batchnull
if (!this.college) {
this.college = '全校';
}
if (!this.batch) {
this.batch = '2017-12-01';
}
try { try {
this.loading = true; this.loading = true;
let params = { let params = {
college: this.college,
batch: this.batch, batch: this.batch,
level: 'cet4' level: 'cet4'
} }
@ -123,7 +139,9 @@ export default {
} }
}, },
mounted() { mounted() {
this.getCollegeOptions();
this.getBatch(); this.getBatch();
this.query();
} }
} }

View File

@ -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-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>
@ -29,10 +30,12 @@ export default {
Url: { Url: {
getBatch: '/cet/getBatch', getBatch: '/cet/getBatch',
getCollege: '/cet/getCollege', getCollege: '/cet/getCollege',
getRate: '/cet/getRateByCollege' getRate: '/cet/getRateByCollege',
getCollegeMajor: '/cet/getCollegeMajor'
}, },
loading: false, loading: false,
collegeOptions: [], collegeOptions: [],
collegeMajorOptions: [],
batchOptions: [], batchOptions: [],
levelOptions: [ levelOptions: [
{ value: 'cet4', label: '英语四级' }, { value: 'cet4', label: '英语四级' },
@ -40,7 +43,8 @@ export default {
], ],
level: null, level: null,
college: null, college: null,
batch: null batch: null,
collegeMajor: null
}; };
}, },
methods: { methods: {
@ -56,7 +60,7 @@ export default {
// //
let option = { let option = {
title: { title: {
text: "学院通过率变化", text: "学院 / 专业通过率变化",
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@ -84,23 +88,50 @@ export default {
// //
async getBatch() { async getBatch() {
const getBatch = await defHttp.get({ url: this.Url.getBatch }); const getBatch = await defHttp.get({ url: this.Url.getBatch });
const getCollege = await defHttp.get({ url: this.Url.getCollege }); // const getCollege = await defHttp.get({ url: this.Url.getCollege });
this.collegeOptions = getCollege.colleges; // this.collegeOptions = getCollege.colleges;
this.college = this.collegeOptions[0].value; // this.college = this.collegeOptions[0].value;
this.level = this.levelOptions[0].value; this.level = this.levelOptions[0].value;
this.query(); // this.query();
},
//
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.collegeMajor = this.collegeMajorOptions[0].value;
console.log(this.collegeMajorOptions);
}, },
// //
async query() { async query() {
let data = null; let data = null;
try { try {
console.log("sb",this.collegeMajor);
//this.collegeMajornull
if (!this.collegeMajor) {
this.collegeMajor = ['东语学院'];
}
//this.collegeMajor[1]null
let major = this.collegeMajor.length > 1 ? this.collegeMajor[1] : "";
this.loading = true; this.loading = true;
let params = { let params = {
college: this.college, college: this.collegeMajor[0],
level: 'cet4' major: major,
level: 'cet4',
} }
data = await defHttp.get({ url: this.Url.getRate, params }); data = await defHttp.get({ url: this.Url.getRate, params });
} finally { } finally {
@ -112,7 +143,9 @@ export default {
} }
}, },
mounted() { mounted() {
this.getCollegeMajorData();
this.getBatch(); this.getBatch();
this.query();
} }
} }

View File

@ -2,7 +2,6 @@
<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-cascader v-model:value="collegeMajor" :options="collegeMajorOptions" change-on-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>
@ -14,7 +13,7 @@
<a-table :dataSource="dataSourceCet4" :columns="columns" :pagination='false'> <a-table :dataSource="dataSourceCet4" :columns="columns" :pagination='false'>
</a-table> </a-table>
<span style="font-size: 15px;float: right;margin-top: 10px;" v-if="total && total > 0"> <span style="font-size: 15px;float: right;margin-top: 10px;" v-if="total && total > 0">
学院总人数: {{ total }} 学院 / 专业总人数: {{ total }}
</span> </span>
</div> </div>
</a-col> </a-col>
@ -40,7 +39,7 @@ export default {
key: 'grade', key: 'grade',
}, },
{ {
title: '参加人数', title: '两个批次总参加人数',
dataIndex: 'attendNumber', dataIndex: 'attendNumber',
key: 'attendNumber', key: 'attendNumber',
}, },