diff --git a/src/views/cet/cet-ana-1.vue b/src/views/cet/cet-ana-1.vue index 4a7367b..244db0b 100644 --- a/src/views/cet/cet-ana-1.vue +++ b/src/views/cet/cet-ana-1.vue @@ -5,8 +5,8 @@
- 年级: + 年级: 查询 @@ -35,17 +35,44 @@
- 学院: - - - 年级: - - - 查询 +
+
+ 年级: + + +
+
+ 学院: + + +
+ +
+ 清除 + 查询 +
+ +
+ + + +
@@ -82,45 +109,35 @@ :max-tag-count="5" @change="onCollegeMajorChange"> 查询 -->
- 年级: + 年级: - +
- 学院: + 学院: - +
- 专业: + 专业:
- 已选择: - + 已选择: + {{ item[1] }} - +
-
- 清除 - 查询 - +
+ 清除 + 查询
@@ -254,9 +271,14 @@ export default { entrydateOptions: [], entrydate: [], majorCheckOn: [], + //对不同的学院选择的专业进行记忆化 lastCollegeMajor: [], majorLength: 0, majorOptions: [], + //对学院对比学院进行记忆化上次选择结果 + lastCollege: [], + //对学院对比学院进行记忆化上次选择结果 + lastCollegeEntrydate: [], }; }, methods: { @@ -386,7 +408,7 @@ export default { // }); // this.college = ['全校']; - this.collegetab2 = ['地理科学学院', '文学院']; + // this.collegetab2 = ['地理科学学院', '文学院']; console.log(this.collegeOptions, 'collegeOptions'); }); }, @@ -405,15 +427,37 @@ export default { } this.lastMajorEntrydate = value; }, - //学院对比学院选项回调函数 + //学院对比 学院选项回调函数 onCollegeChange(value) { console.log(value, 'value'); if (value.length > 5) { message.error('最多选择五个'); - //删除value最后一个数据 - value.pop(); + //和lastCollege比较,如果value中的数据不在lastCollege中则删除 + for (let i = 0; i < value.length; i++) { + if (!this.lastCollege.includes(value[i])) { + value.splice(i, 1); + return; + } + } return; } + this.lastCollege = value; + }, + //学院对比 年级选项回调函数 + onCollegeEntrydateChange(value) { + console.log(value, 'value'); + if (value.length > 5) { + message.error('最多选择五个'); + //和lastCollegeEntrydate比较,如果value中的数据不在lastCollegeEntrydate中则删除 + for (let i = 0; i < value.length; i++) { + if (!this.lastCollegeEntrydate.includes(value[i])) { + value.splice(i, 1); + return; + } + } + return; + } + this.lastCollegeEntrydate = value; }, //专业选项回调函数 onCollegeMajorChange(value) { @@ -444,7 +488,7 @@ export default { }, removeTag(index) { if (this.majorCheckOn.includes(this.lastCollegeMajor[index][1])) { - let index1 = this.majorCheckOn.indexOf(this.lastCollegeMajor[index][1]) + let index1 = this.majorCheckOn.indexOf(this.lastCollegeMajor[index][1]); this.majorCheckOn.splice(index1, 1); } this.lastCollegeMajor.splice(index, 1); @@ -474,11 +518,17 @@ export default { console.log(this.majorCheckOn, 'majorCheckOn'); }, - clear() { + clearMajor() { this.majorCheckOn = []; this.lastCollegeMajor = []; this.majorLength = 0; }, + clearCollege() { + this.collegetab2 = []; + this.collegeentrydate = []; + this.lastCollege = []; + this.lastCollegeEntrydate = []; + }, //tab2\3图标 drawChart(data, tab) { let seriesData = []; @@ -936,7 +986,7 @@ export default { const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate }); this.entrydateOptions = getEntrydate.entrydates; this.oneentrydate = this.entrydateOptions[0].value; - this.collegeentrydate = [this.entrydateOptions[0].value]; + // this.collegeentrydate = [this.entrydateOptions[0].value]; this.majorentrydate = [this.entrydateOptions[0].value]; // this.entrydate.push (this.entrydateOptions[0].value); },