Skip to content

Commit

Permalink
Improved UI in LookupConditions (#39)
Browse files Browse the repository at this point in the history
* fix(ui): major filter will revert to default if college selection change
* feat: enable search when selecting college, major and property
  • Loading branch information
hidacow authored Oct 29, 2023
1 parent 71260b6 commit 45a5584
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/mixins/LookupPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,5 +302,8 @@ export const LookupConditionsMixin = {
});
}
},
changeCollege() {
this.conditions.search['class_sort_major'] = '{"name":""}';
},
},
};
11 changes: 8 additions & 3 deletions src/pages/index/components/LookupPanel/LookupConditions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
</a-select>
</a-form-item>
<a-form-item label="学院">
<a-select v-model="conditions.search['class_sort_college']" class="w-200px">
<a-select show-search v-model="conditions.search['class_sort_college']" @change="changeCollege" class="w-200px">
<a-select-option value='{"name":""}'>全部</a-select-option>
<a-select-option v-for="item in getCollegesList()" :key="item.name" :value="JSON.stringify({name:item.name,regex:item.regex.toString()})">{{item.name}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="专业">
<a-select v-model="conditions.search['class_sort_major']" class="w-200px">
<a-select show-search v-model="conditions.search['class_sort_major']" class="w-200px">
<a-select-option value='{"name":""}'>全部</a-select-option>
<a-select-option v-for="item in getMajorsList(JSON.parse(conditions.search['class_sort_college']).name)" :key="item.name" :value="JSON.stringify({name:item.name,regex:item.regex.toString()})">{{item.name}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="课程属性">
<a-select v-model="conditions.search['class_sort_property']" class="w-200px">
<a-select show-search v-model="conditions.search['class_sort_property']" class="w-200px">
<a-select-option value='{"name":""}'>全部</a-select-option>
<a-select-option v-for="item in getLessonPropertiesList()" :key="item.name" :value="JSON.stringify({name:item.name,code:item.code,regex:item.regex.toString()})">{{item.name}}</a-select-option>
</a-select>
Expand Down Expand Up @@ -140,6 +140,11 @@
margin: 0 16px 16px;
}
/*noinspection CssUnusedSymbol*/
.lookup-conditions >>> .ant-select-search__field {
padding: 0;
}
.w-200px {
width: 200px;
}
Expand Down
15 changes: 10 additions & 5 deletions src/pages/m/components/LookupPanel/LookupConditions.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<a-form class="conditions-wrapper" layout="vertical" ref="form">
<a-form class="lookup-conditions" layout="vertical" ref="form">
<a-form-item :validate-status="regexpValidateStatus['course_id']">
<a-input allow-clear v-model="conditions.search['course_id']">
<span class="label" slot="prefix">课程号:</span>
Expand Down Expand Up @@ -59,15 +59,15 @@
<a-row>
<a-col :xs="11">
<a-form-item label="学院">
<a-select v-model="conditions.search['class_sort_college']" class="w-200px">
<a-select show-search v-model="conditions.search['class_sort_college']" @change="changeCollege" class="w-200px">
<a-select-option value='{"name":""}'>全部</a-select-option>
<a-select-option v-for="item in getCollegesList()" :key="item.name" :value="JSON.stringify({name:item.name,regex:item.regex.toString()})">{{item.name}}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xs="{offset: 2, span: 11}">
<a-form-item label="专业">
<a-select v-model="conditions.search['class_sort_major']" class="w-200px">
<a-select show-search v-model="conditions.search['class_sort_major']" class="w-200px">
<a-select-option value='{"name":""}'>全部</a-select-option>
<a-select-option v-for="item in getMajorsList(JSON.parse(conditions.search['class_sort_college']).name)" :key="item.name" :value="JSON.stringify({name:item.name,regex:item.regex.toString()})">{{item.name}}</a-select-option>
</a-select>
Expand All @@ -77,7 +77,7 @@
<a-row>
<a-col :xs="11">
<a-form-item label="课程属性">
<a-select v-model="conditions.search['class_sort_property']" class="w-200px">
<a-select show-search v-model="conditions.search['class_sort_property']" class="w-200px">
<a-select-option value='{"name":""}'>全部</a-select-option>
<a-select-option v-for="item in getLessonPropertiesList()" :key="item.name" :value="JSON.stringify({name:item.name,code:item.code,regex:item.regex.toString()})">{{item.name}}</a-select-option>
</a-select>
Expand Down Expand Up @@ -165,10 +165,15 @@
</script>

<style scoped>
.conditions-wrapper {
.lookup-conditions {
padding: 16px 16px 0;
}
/*noinspection CssUnusedSymbol*/
.lookup-conditions >>> .ant-select-search__field {
padding: 0;
}
.w-80px {
width: 80px;
}
Expand Down

0 comments on commit 45a5584

Please sign in to comment.