|
|
@ -233,6 +233,7 @@ export default { |
|
|
|
lazyLoad (node, resolve) { |
|
|
|
lazyLoad (node, resolve) { |
|
|
|
// 如果是在模糊搜索中,则不再用懒加载请求数据 |
|
|
|
// 如果是在模糊搜索中,则不再用懒加载请求数据 |
|
|
|
const input = document.querySelector('.el-cascader__search-input') |
|
|
|
const input = document.querySelector('.el-cascader__search-input') |
|
|
|
|
|
|
|
const checked = that.rangeChecked |
|
|
|
|
|
|
|
|
|
|
|
if (input && input.value.trim()) { |
|
|
|
if (input && input.value.trim()) { |
|
|
|
const val = input.value.trim() |
|
|
|
const val = input.value.trim() |
|
|
@ -248,6 +249,7 @@ export default { |
|
|
|
e.value = e.provinceId |
|
|
|
e.value = e.provinceId |
|
|
|
e.label = e.provinceName |
|
|
|
e.label = e.provinceName |
|
|
|
e.children = [] |
|
|
|
e.children = [] |
|
|
|
|
|
|
|
e.disabled = !!checked.find(n => n.provinceId == e.provinceId) |
|
|
|
data.push(e) |
|
|
|
data.push(e) |
|
|
|
}) |
|
|
|
}) |
|
|
|
resolve(data) |
|
|
|
resolve(data) |
|
|
@ -262,6 +264,7 @@ export default { |
|
|
|
e.value = e.cityId |
|
|
|
e.value = e.cityId |
|
|
|
e.label = e.cityName |
|
|
|
e.label = e.cityName |
|
|
|
e.children = [] |
|
|
|
e.children = [] |
|
|
|
|
|
|
|
e.disabled = !!checked.find(n => n.cityId == e.cityId) |
|
|
|
data.push(e) |
|
|
|
data.push(e) |
|
|
|
}) |
|
|
|
}) |
|
|
|
resolve(data) |
|
|
|
resolve(data) |
|
|
@ -278,6 +281,7 @@ export default { |
|
|
|
e.value = e.schoolId |
|
|
|
e.value = e.schoolId |
|
|
|
e.label = e.schoolName |
|
|
|
e.label = e.schoolName |
|
|
|
e.leaf = true |
|
|
|
e.leaf = true |
|
|
|
|
|
|
|
e.disabled = !!checked.find(n => n.schoolId == e.schoolId) |
|
|
|
data.push(e) |
|
|
|
data.push(e) |
|
|
|
}) |
|
|
|
}) |
|
|
|
resolve(data) |
|
|
|
resolve(data) |
|
|
@ -386,7 +390,7 @@ export default { |
|
|
|
checked.map(e => { |
|
|
|
checked.map(e => { |
|
|
|
rangeChecked.find(n => n.value === e.value) || name.push(e.data) |
|
|
|
rangeChecked.find(n => n.value === e.value) || name.push(e.data) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.rangeChecked = checked |
|
|
|
this.rangeChecked.push(...name) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取学校列表 |
|
|
|
// 获取学校列表 |
|
|
|
getSchool() { |
|
|
|
getSchool() { |
|
|
@ -408,13 +412,19 @@ export default { |
|
|
|
// 范围筛选 |
|
|
|
// 范围筛选 |
|
|
|
rangeSearch(el) { |
|
|
|
rangeSearch(el) { |
|
|
|
const val = el.target.value.trim() |
|
|
|
const val = el.target.value.trim() |
|
|
|
|
|
|
|
const checked = this.rangeChecked |
|
|
|
if (!val) { |
|
|
|
if (!val) { |
|
|
|
this.rangeList = [] |
|
|
|
this.rangeList = [] |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
clearTimeout(this.rangeTimer) |
|
|
|
clearTimeout(this.rangeTimer) |
|
|
|
this.rangeTimer = setTimeout(() => { |
|
|
|
this.rangeTimer = setTimeout(() => { |
|
|
|
let result = this.schools.filter(e => e.label.includes(val)) // 用学校列表做比对 |
|
|
|
let result = this.schools.filter(e => { |
|
|
|
|
|
|
|
if (e.label.includes(val)) { |
|
|
|
|
|
|
|
e.disabled = !!checked.find(n => n.schoolId == e.schoolId) |
|
|
|
|
|
|
|
return e |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) // 用学校列表做比对 |
|
|
|
this.rangeList = result |
|
|
|
this.rangeList = result |
|
|
|
}, 100) |
|
|
|
}, 100) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -425,18 +435,19 @@ export default { |
|
|
|
rangeSubmit() { |
|
|
|
rangeSubmit() { |
|
|
|
// 处理提交需要的id |
|
|
|
// 处理提交需要的id |
|
|
|
const data = [] |
|
|
|
const data = [] |
|
|
|
this.range.map(e => { |
|
|
|
const isSearch = this.rangeList.length // 如果是搜索,则只存schoolId |
|
|
|
|
|
|
|
const checked = this.rangeChecked |
|
|
|
|
|
|
|
checked.map(e => { |
|
|
|
data.push({ |
|
|
|
data.push({ |
|
|
|
provinceId: e[0] || '', |
|
|
|
provinceId: e.provinceId || '', |
|
|
|
cityId: e[1] || '', |
|
|
|
cityId: e.cityId || '', |
|
|
|
schoolId: e[2] || '', |
|
|
|
schoolId: e.schoolId || '', |
|
|
|
type: e.length > 2 ? 0 : 1 |
|
|
|
type: e.schoolId ? 0 : 1 |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.form.contestRangeList = data |
|
|
|
this.form.contestRangeList = data |
|
|
|
|
|
|
|
|
|
|
|
// 处理显示的name |
|
|
|
// 处理显示的name |
|
|
|
const checked = this.$refs.range.getCheckedNodes() |
|
|
|
|
|
|
|
const name = [] |
|
|
|
const name = [] |
|
|
|
checked.map(e => { |
|
|
|
checked.map(e => { |
|
|
|
name.push(e.label) |
|
|
|
name.push(e.label) |
|
|
|