赛事范围

dev_2022-06-14
yujialong 2 years ago
parent 08ae3a52f6
commit d5cec48e52
  1. 27
      src/pages/match/add/index.vue

@ -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)

Loading…
Cancel
Save