赛事修复

dev_2022-06-14
yujialong 2 years ago
parent a5e7c65d15
commit ae043cb947
  1. 150
      src/views/match/add/index.vue

@ -135,29 +135,21 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button v-if="!form.id" @click="save(0)">保存</el-button> <el-button v-if="!form.id" @click="save(0)">保存</el-button>
<el-button type="primary" @click="save(1)" v-auth="'/match:管理:大赛详情:发布'">发布</el-button> <el-button type="primary" @click="save(1)">发布</el-button>
<el-button type="danger" @click="preview" v-auth="'/match:管理:大赛详情:预览'">预览</el-button> <el-button type="danger" @click="preview">预览</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
<el-dialog title="请勾选院校" :visible.sync="rangeVisible" width="580px" custom-class="range-dia" :close-on-click-modal="false"> <el-dialog title="请勾选院校" :visible.sync="rangeVisible" width="580px" custom-class="range-dia" :close-on-click-modal="false">
<el-select v-model="rangeForm.provinceId" multiple filterable clearable placeholder="请选择省份" @change="getCity" @clear="clearProvince"> <el-cascader
<el-option v-for="(item,index) in provinces" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option> ref="range"
</el-select> v-model="range"
:props="props"
<el-select v-model="rangeForm.cityId" multiple filterable clearable placeholder="请选择城市" :disabled="rangeForm.provinceId ? false : true" @change="getSchool"> :show-all-levels="false"
<el-option v-for="(item,index) in cities" :key="index" :label="item.cityName" :value="item.cityId"></el-option> clearable
</el-select> filterable></el-cascader>
<el-select v-if="rangeForm.cityId.length" v-model="rangeForm.schoolId" multiple filterable clearable placeholder="请选择学校">
<el-option v-for="(item,index) in schools" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
<el-select v-else v-model="rangeForm.schoolId" multiple filterable clearable placeholder="请选择学校">
<el-option v-for="(item,index) in allSchool" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
<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>
@ -213,19 +205,66 @@ export default {
range: [], range: [],
rangeInit: [], rangeInit: [],
rangeName: '', rangeName: '',
//
props: {
multiple: true,
checkStrictly: true,
lazy: true,
lazyLoad (node, resolve) {
const { level, value } = node
//
console.log('lazy', node, that.range)
if (!level) {
that.$get(that.api.queryProvince).then(({ list }) => {
const data = []
list.map(e => {
data.push({
value: e.provinceId,
label: e.provinceName,
children: []
})
})
resolve(data)
}).catch(res => {})
} else if (level === 1) {
//
that.$get(that.api.queryCity, {
provinceId: value
}).then(({ list }) => {
const data = []
list.map(e => {
data.push({
provinceId: value,
value: e.cityId,
label: e.cityName
})
})
resolve(data)
}).catch(res => {})
} else if (level === 2) {
//
that.$get(that.api.getSchoolsByProvince, {
provinceId: node.data.provinceId,
cityId: value,
schoolName: ''
}).then(({ list }) => {
const data = []
list.map(e => {
data.push({
value: e.schoolId,
label: e.schoolName,
leaf: true
})
})
resolve(data)
}).catch(res => {})
} else {
resolve([])
}
}
},
submiting: false, submiting: false,
updateTime: 0, updateTime: 0,
rangeTimer: null,
provinces: [],
cities: [],
schools: [],
rangeForm: {
provinceId: [],
cityId: [],
schoolId: []
},
allSchool: [],
curProvinceId: ''
}; };
}, },
components: { components: {
@ -262,8 +301,6 @@ export default {
}, },
mounted() { mounted() {
this.getData() this.getData()
this.getProvince()
this.getAllSchool()
}, },
methods: { methods: {
getData() { getData() {
@ -299,6 +336,7 @@ export default {
range.push(item) range.push(item)
}) })
this.range = range this.range = range
console.log("🚀 ~ file: matchDetail.vue ~ line 327 ~ this.$post ~ this.range", this.range)
} }
// name // name
@ -316,49 +354,18 @@ 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
}, },
// //
getProvince() { rangeFilter(node, keyword) {
this.$get(this.api.queryProvince).then(({ list }) => { console.log("🚀 ~ file: index.vue ~ line 363 ~ rangeFilter ~ node, keyword", node, keyword)
this.provinces = list
}).catch(res => {})
},
//
clearProvince(){
this.rangeForm.cityId = ''
},
//
getCity(val) {
const { rangeForm } = this
rangeForm.cityId = ''
this.curProvinceId = val[val.length - 1] // id
this.$get(this.api.queryCity, {
provinceId: this.curProvinceId
}).then(({ list }) => {
this.cities = list
}).catch(res => {})
},
//
getSchool(val) {
this.$get(this.api.getSchoolsByProvince, {
provinceId: this.curProvinceId,
cityId: val[val.length - 1]
}).then(({ list }) => {
this.schools = list
}).catch(res => {})
},
//
getAllSchool() {
this.$get(this.api.querySchoolData).then(({ list }) => {
this.allSchool = list
}).catch(res => {})
}, },
// //
rangeSubmit() { rangeSubmit() {
// id // id
const data = [] const data = []
console.log("🚀 ~ file: index.vue ~ line 360 ~ rangeSubmit ~ data", this.rangeForm)
return
this.range.map(e => { this.range.map(e => {
data.push({ data.push({
provinceId: e[0] || '', provinceId: e[0] || '',
@ -402,7 +409,7 @@ export default {
const data = { const data = {
contestId: id || '', contestId: id || '',
fileName: this.fileName, fileName: this.fileName,
filePath: file.fileUrl filePath: file.fileUrl || file.fileId
} }
this.form.contestAnnexList.push(data) this.form.contestAnnexList.push(data)
// //
@ -642,12 +649,7 @@ $upload-lg-height: 150px;
margin-left: 32px; margin-left: 32px;
} }
} }
.range-dia {
.el-select {
width: 150px;
margin-right: 10px;
}
}
.add-btn { .add-btn {
display: flex; display: flex;
justify-content: center; justify-content: center;

Loading…
Cancel
Save