From 7a17e9a0edf0deb25c4e92fda36edf77902a75e0 Mon Sep 17 00:00:00 2001 From: xbx <1827135378@qq.com> Date: Wed, 27 Mar 2024 16:10:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/Analysis/index.vue | 36 +++++++++++++++++--------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/views/dashboard/Analysis/index.vue b/src/views/dashboard/Analysis/index.vue index fae6957..daf59a6 100644 --- a/src/views/dashboard/Analysis/index.vue +++ b/src/views/dashboard/Analysis/index.vue @@ -3,7 +3,7 @@ @@ -32,7 +32,6 @@ import { defHttp } from '/@/utils/http/axios'; import * as echarts from 'echarts'; export default { - name: "Analysis", data() { return { @@ -61,23 +60,28 @@ export default { } ], Url: { - getGradeAndCollegeData: '/cet/getGradeAndCollege', + getEntrydate: '/cet/getEntrydate', + getCollege: '/cet/getCollege', getData: '/cet/getData' }, collegeOptions: [], entrydateOptions: [], college: null, - entrydate: null, + entrydate: null }; }, methods: { // 获取年级和学院数据 - async getGradeAndCollegeData() { - const data = await defHttp.get({ url: this.Url.getGradeAndCollegeData }); - this.collegeOptions = data.colleges; + async getEntrydateAndCollegeData() { + const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate }); + const getCollege = await defHttp.get({ url: this.Url.getCollege }); + this.collegeOptions = getCollege.colleges; + // 手动添加一个全校字段 + this.collegeOptions.unshift({ value: '全校', label: '全校' }); this.college = this.collegeOptions[0].value; - this.entrydateOptions = data.entrydates; + this.entrydateOptions = getEntrydate.entrydates; this.entrydate = this.entrydateOptions[0].value; + this.query(); }, // 查询数据 async query() { @@ -85,23 +89,31 @@ export default { college: this.college, entrydate: this.entrydate } - const result = await defHttp.get({ url: this.Url.getData, params }); + const data = await defHttp.get({ url: this.Url.getData, params }); this.dataSourceCet4 = result.data.cet4; this.dataSourceCet6 = result.data.cet6; - this.$message.info(`查询结果:${JSON.stringify(result)}`); + this.$message.info(`查询结果:${JSON.stringify(data)}`); } }, mounted() { - this.getGradeAndCollegeData(); + this.getEntrydateAndCollegeData(); } } + \ No newline at end of file