赛事范围搜索(调试)

dev_202207
yujialong 3 years ago
parent 87ab0641ce
commit 6dc95d79d1
  1. 45
      src/views/match/add/index.vue

@ -149,7 +149,10 @@
:props="props" :props="props"
:show-all-levels="false" :show-all-levels="false"
clearable clearable
filterable></el-cascader> filterable
:before-filter="beforeFilter"
:options="rangeList"
@input.native="rangeSearch"></el-cascader>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="rangeVisible = false"> </el-button> <el-button size="small" @click="rangeVisible = false"> </el-button>
<el-button size="small" type="primary" @click="rangeSubmit"> </el-button> <el-button size="small" type="primary" @click="rangeSubmit"> </el-button>
@ -211,6 +214,10 @@ export default {
checkStrictly: true, checkStrictly: true,
lazy: true, lazy: true,
lazyLoad (node, resolve) { 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 const { level, value } = node
// //
console.log('lazy', node, that.range) console.log('lazy', node, that.range)
@ -265,6 +272,9 @@ export default {
}, },
submiting: false, submiting: false,
updateTime: 0, updateTime: 0,
rangeTimer: null,
schools: [],
rangeList: []
}; };
}, },
components: { components: {
@ -301,6 +311,7 @@ export default {
}, },
mounted() { mounted() {
this.getData() this.getData()
this.getSchool()
}, },
methods: { methods: {
getData() { getData() {
@ -354,13 +365,33 @@ export default {
// //
showRange() { showRange() {
this.rangeVisible = true this.rangeVisible = true
console.log("🚀 ~ file: index.vue ~ line 384 ~ showRange ~ rangeVisible", this.range)
// this.range = this.rangeInit
}, },
// //
rangeFilter(node, keyword) { getSchool() {
console.log("🚀 ~ file: index.vue ~ line 363 ~ rangeFilter ~ node, keyword", node, keyword) 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() { rangeSubmit() {

Loading…
Cancel
Save