|
|
|
@ -149,7 +149,10 @@ |
|
|
|
|
:props="props" |
|
|
|
|
:show-all-levels="false" |
|
|
|
|
clearable |
|
|
|
|
filterable></el-cascader> |
|
|
|
|
filterable |
|
|
|
|
:before-filter="beforeFilter" |
|
|
|
|
:options="rangeList" |
|
|
|
|
@input.native="rangeSearch"></el-cascader> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" @click="rangeVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="rangeSubmit">确 定</el-button> |
|
|
|
@ -211,6 +214,10 @@ export default { |
|
|
|
|
checkStrictly: true, |
|
|
|
|
lazy: true, |
|
|
|
|
lazyLoad (node, resolve) { |
|
|
|
|
// 如果是在模糊搜索中,则不再用懒加载请求数据 |
|
|
|
|
const input = document.querySelector('.el-cascader__search-input') |
|
|
|
|
console.log("🚀 ~ file: index.vue ~ line 219 ~ lazyLoad ~ input", input, node) |
|
|
|
|
if (input && input.value) return resolve([]) |
|
|
|
|
const { level, value } = node |
|
|
|
|
// 省份 |
|
|
|
|
console.log('lazy', node, that.range) |
|
|
|
@ -265,6 +272,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
submiting: false, |
|
|
|
|
updateTime: 0, |
|
|
|
|
rangeTimer: null, |
|
|
|
|
schools: [], |
|
|
|
|
rangeList: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -301,6 +311,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getData() |
|
|
|
|
this.getSchool() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getData() { |
|
|
|
@ -354,13 +365,33 @@ export default { |
|
|
|
|
// 选择范围 |
|
|
|
|
showRange() { |
|
|
|
|
this.rangeVisible = true |
|
|
|
|
console.log("🚀 ~ file: index.vue ~ line 384 ~ showRange ~ rangeVisible", this.range) |
|
|
|
|
// this.range = this.rangeInit |
|
|
|
|
}, |
|
|
|
|
// 范围模糊查询 |
|
|
|
|
rangeFilter(node, keyword) { |
|
|
|
|
console.log("🚀 ~ file: index.vue ~ line 363 ~ rangeFilter ~ node, keyword", node, keyword) |
|
|
|
|
|
|
|
|
|
// 获取学校列表 |
|
|
|
|
getSchool() { |
|
|
|
|
this.$get(this.api.querySchoolData).then(({ list }) => { |
|
|
|
|
const result = [] |
|
|
|
|
list.map(e => { |
|
|
|
|
result.push({ |
|
|
|
|
value: e.schoolId, |
|
|
|
|
label: e.schoolName, |
|
|
|
|
leaf: true |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.schools = result |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 范围模糊查询前置钩子 |
|
|
|
|
beforeFilter() { |
|
|
|
|
return false |
|
|
|
|
}, |
|
|
|
|
// 范围筛选 |
|
|
|
|
rangeSearch(el) { |
|
|
|
|
clearTimeout(this.rangeTimer) |
|
|
|
|
this.rangeTimer = setTimeout(() => { |
|
|
|
|
const val = el.target.value |
|
|
|
|
let result = this.schools.filter(e => e.label.includes(val)) // 用学校列表做比对 |
|
|
|
|
this.rangeList = val ? result : [] |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 范围确定 |
|
|
|
|
rangeSubmit() { |
|
|
|
|