feat: 增加下拉框筛选
This commit is contained in:
parent
fe60927baf
commit
7ef046949b
|
@ -18,6 +18,7 @@
|
||||||
v-model="selected[index]"
|
v-model="selected[index]"
|
||||||
:placeholder="category.categoryName"
|
:placeholder="category.categoryName"
|
||||||
multiple
|
multiple
|
||||||
|
filterable
|
||||||
:collapse-tags="collapse"
|
:collapse-tags="collapse"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
|
@ -993,6 +994,11 @@ export default {
|
||||||
// 获取 区域 城市 列表
|
// 获取 区域 城市 列表
|
||||||
const result = await this.$API.select.reqGetRegionAndCity()
|
const result = await this.$API.select.reqGetRegionAndCity()
|
||||||
this.regionAndCityList = result.data
|
this.regionAndCityList = result.data
|
||||||
|
// 初始化城市
|
||||||
|
const cities = this.regionAndCityList.map(item => {
|
||||||
|
return item.cities.split(',')
|
||||||
|
})
|
||||||
|
this.cityList = cities.flat()
|
||||||
this.regionList = result.data.map(item => { return { value: item.region, label: item.region } })
|
this.regionList = result.data.map(item => { return { value: item.region, label: item.region } })
|
||||||
},
|
},
|
||||||
// 初始化部门选项为不限
|
// 初始化部门选项为不限
|
||||||
|
@ -1132,8 +1138,16 @@ export default {
|
||||||
return index + 1 + (page - 1) * limit
|
return index + 1 + (page - 1) * limit
|
||||||
},
|
},
|
||||||
handleRegion(region) {
|
handleRegion(region) {
|
||||||
|
// 如果区域为空,就不做筛选,显示所有的城市
|
||||||
|
if (region) {
|
||||||
const data = this.regionAndCityList.filter(item => item.region === region)
|
const data = this.regionAndCityList.filter(item => item.region === region)
|
||||||
this.cityList = data[0].cities.split(',')
|
this.cityList = data[0].cities.split(',')
|
||||||
|
} else {
|
||||||
|
const data = this.regionAndCityList.map(item => {
|
||||||
|
return item.cities.split(',')
|
||||||
|
})
|
||||||
|
this.cityList = data.flat()
|
||||||
|
}
|
||||||
this.city = ''
|
this.city = ''
|
||||||
console.log(this.cityList)
|
console.log(this.cityList)
|
||||||
},
|
},
|
||||||
|
@ -1279,6 +1293,9 @@ export default {
|
||||||
|
|
||||||
// 重置部门选项
|
// 重置部门选项
|
||||||
resetDepartmentSearch() {
|
resetDepartmentSearch() {
|
||||||
|
this.region = ''
|
||||||
|
this.city = ''
|
||||||
|
this.selected = []
|
||||||
this.departmentId = ''
|
this.departmentId = ''
|
||||||
this.getTableDataByDept()
|
this.getTableDataByDept()
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
v-model="selected[index]"
|
v-model="selected[index]"
|
||||||
:placeholder="category.categoryName"
|
:placeholder="category.categoryName"
|
||||||
multiple
|
multiple
|
||||||
|
filterable
|
||||||
:collapse-tags="collapse"
|
:collapse-tags="collapse"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue