完善学院对比

This commit is contained in:
Cool 2024-04-23 23:55:23 +08:00
parent 29f5da8c52
commit 7fc0f45a6a
1 changed files with 94 additions and 47 deletions

View File

@ -10,8 +10,7 @@
<div>
<div class="query">
<a-select v-model:value="oneentrydate" style="width: 200px" :options="entrydateOptions"
@change="onCollegeMajorChange"></a-select>
<a-select v-model:value="oneentrydate" style="width: 200px" :options="entrydateOptions"></a-select>
<a-button style="margin-left: 10px;" type="primary" @click="allQuery">查询</a-button>
</div>
@ -79,7 +78,8 @@
<div>
<div class="query">
<a-cascader v-model:value="collegeMajor" style="width: 300px;margin-right: 20px;"
:options="collegeMajorOptions" :changeOnSelect="false" multiple :maxTagCount="2" />
:options="collegeMajorOptions" :changeOnSelect="false" multiple :maxTagCount="2"
@change="onMajorChange" />
<a-select v-model:value="majorentrydate" style="width: 200px" :options="entrydateOptions" mode="multiple"
:max-tag-count="2" @change="onCollegeMajorChange"></a-select>
<a-button style="margin-left: 10px;" type="primary" @click="majorQuery">查询</a-button>
@ -228,6 +228,25 @@ export default {
};
},
methods: {
onMajorChange(value) {
console.log(value, "value")
let length = value.length;
//value,this.collegeMajorOptionsvaluethis.collegeMajorOptionschildren
for (let i = 0; i < value.length; i++) {
for (let j = 0; j < this.collegeMajorOptions.length; j++) {
if (value[i] == this.collegeMajorOptions[j].value) {
length += this.collegeMajorOptions[j].children.length;
length -= 1;
if (length > 5) {
message.error("最多选择五个专业")
//value
value.pop();
return
}
}
}
}
},
allQuery() {
this.tab1loading = true;
let college = ['全校'];
@ -238,9 +257,18 @@ export default {
this.query(query, college, [this.oneentrydate]);
},
async majorQuery() {
if (this.collegeMajor.length == 0 || this.collegeMajor == null) {
message.error("请选择专业")
return
}
if (this.majorentrydate.length == 0) {
message.error("请选择年级")
return
}
this.tab3loading = true;
let res = null;
try {
let params = {
college: this.collegeMajor,
entrydate: this.majorentrydate,
@ -257,6 +285,15 @@ export default {
}
},
collegeQuery() {
if (this.collegetab2.length == 0) {
message.error("请选择学院")
return
}
if (this.collegeentrydate.length == 0) {
message.error("请选择年级")
return
}
this.tab2loading = true;
let query = 'tab2'
this.query(query, this.collegetab2, this.collegeentrydate);
@ -337,10 +374,14 @@ export default {
},
//tab3
//tab2\3
drawChart(data, tab) {
let seriesData = [];
let xData = this.majorentrydate.sort((a, b) => a - b);
if (tab == 'tab2') {
xData = this.collegeentrydate.sort((a, b) => a - b);
}
let k = 0;
let legendData = [];
let colors = ['#5370c5', '#91CC75', '#fac858', '#ee6666', '#73c0de', '#FF6A6A', '#FFA500', '#EE2C2C', '#90EE90', '#008B8B', '#FFC0CB', '#FFDAB9', '#FFDEAD', '#FFE4B5', '#FFE4C4', '#FFE4E1', '#FFEBCD', '#FFEFD5', '#FFFAF0', '#FFFAFA', '#FFFFE0', '#FFFFF0', '#FFFFFF', '#F0F8FF', '#FAEBD7', '#FAF0E6', '#FAFAD2', '#F5FFFA', '#F8F8FF', '#F0FFF0', '#F0FFFF', '#F0E68C', '#F0F8FF', '#F0FFF0', '#F0FFFF', '#F4A460', '#F5DEB3', '#F5F5DC', '#F5F5F5', '#F5FFFA', '#F8F8FF', '#F9EBEA', '#FAD7A0', '#FAF0E6', '#FAFAD2', '#FAF0E6 ']
@ -520,6 +561,9 @@ export default {
}
});
if (j == colors.length) {
j = 0;
}
let rankData = yData.slice().sort((a, b) => b - a).map((value) => yData.indexOf(value) + 1);
//
if (tab == 'tab1') {
@ -548,6 +592,9 @@ export default {
}
}
});
if (j == colors.length) {
j = 0;
}
}
}
let myChart = null;
@ -691,19 +738,19 @@ export default {
this.visible = false;
let result = null;
console.log(this.college, this.entrydate);
//this.collegethis.batchnull
if (this.college === null || this.college.length === 0) {
this.college = ['全校'];
}
// console.log(this.college, this.entrydate);
// //this.collegethis.batchnull
// if (this.college === null || this.college.length === 0) {
// this.college = [''];
// }
if (!this.entrydate || this.entrydate.length === 0) {
this.entrydate = ['2017'];
}
// if (!this.entrydate || this.entrydate.length === 0) {
// this.entrydate = ['2017'];
// }
try {
console.log(this.college, this.entrydate)
// console.log(this.college, this.entrydate)
let params = {
college: college,
entrydate: entrydate,