[fix][V]:完善周次选择器

master
aiyadc 5 years ago
parent 264286510b
commit 8b24e3527f

@ -86,7 +86,7 @@
:able-list="ableList"></week-selection> :able-list="ableList"></week-selection>
</el-dialog> </el-dialog>
</el-container> </el-container>
<!-- 课表--> <!-- 课表-->
<tb_course-dialog table-label="" ref="schedule" :custom="true" :cClick="f" :cStyle="f"></tb_course-dialog> <tb_course-dialog table-label="" ref="schedule" :custom="true" :cClick="f" :cStyle="f"></tb_course-dialog>
</div> </div>
@ -137,7 +137,8 @@
schedule: '', schedule: '',
remind: '无' remind: '无'
}, },
courseOption: [] courseOption: [],
booked: []
} }
}, },
@ -148,17 +149,11 @@
return 'cursor:pointer' return 'cursor:pointer'
} }
}, },
f(){}, f() {
},
// //
async cellClick(row, column, cell, event) { async cellClick(row, column, cell, event) {
this.form.weeks = null
this.form.day = column.index
this.form.time = row.index
this.form.year = this.$refs.timeSelection.year
this.form.semester = this.$refs.timeSelection.semester
this.ableList = await get("lb/labTime/getWeeksAbleBook", this.form)
this.aWeekValue.push(row.index, column.index)
//()使disable //()使disable
// let position = this.lab.position // let position = this.lab.position
// let rowIndex = row.index // let rowIndex = row.index
@ -167,13 +162,25 @@
// var weeks=[6,7,8] // var weeks=[6,7,8]
//()使disablevar //()使disablevar
if (column.label != '') { if (column.label != '') {
this.perTargetValue = event.target //targettarget this.form.weeks = null
this.aWeekValue.push(row.index, column.index) this.form.day = column.index
this.form.time = row.index
this.form.year = this.$refs.timeSelection.year
this.form.semester = this.$refs.timeSelection.semester
new Promise((resolve, reject) => { //使weekDialog new Promise((resolve, reject) => { //使weekDialog
this.weekDialog = true this.weekDialog = true
resolve('打开了weekDialog') resolve('打开了weekDialog')
}).then((res) => { }).then(async (res) => {
this.ableList = await get("lb/labTime/getWeeksAbleBook", this.form)
this.$refs.weekSelection.singleVal = this.ableList.filter(elem => elem % 2 !== 0)
this.$refs.weekSelection.doubleVal = this.ableList.filter(elem => elem % 2 === 0)
this.$refs.weekSelection.allVal = this.ableList
this.$refs.weekSelection.checkedValue = this.booked[row.index - 1][column.index - 1]
this.aWeekValue.push(row.index, column.index)
this.perTargetValue = event.target //targettarget
this.aWeekValue.push(row.index, column.index)
// console.log(this.$refs.weekSelection) // console.log(this.$refs.weekSelection)
// var position = this.form.position // var position = this.form.position
// var rowIndex = row.index // var rowIndex = row.index
@ -181,9 +188,7 @@
// var selectedWeeks = get('', {position, rowIndex, columnIndex}) //rowIndexcolumIndex: // var selectedWeeks = get('', {position, rowIndex, columnIndex}) //rowIndexcolumIndex:
// selectedWeeks = [1, 2, 3] // selectedWeeks = [1, 2, 3]
// this.$refs.weekSelection.disableList = selectedWeeks // this.$refs.weekSelection.disableList = selectedWeeks
// this.$refs.weekSelection.singleVal = this.$refs.weekSelection.singleVal.filter(x => !selectedWeeks.includes(x))
// this.$refs.weekSelection.doubleVal = this.$refs.weekSelection.doubleVal.filter(x => !selectedWeeks.includes(x))
// this.$refs.weekSelection.allVal = this.$refs.weekSelection.allVal.filter(x => !selectedWeeks.includes(x))
// console.log('aa', this.$refs.weekSelection.singleVal) // console.log('aa', this.$refs.weekSelection.singleVal)
}) })
} }
@ -207,7 +212,7 @@
// //
async checkDetail(event) { async checkDetail(event) {
await this.loadSchedule(event.lab_id) await this.loadSchedule(event.lab_id)
this.$refs.schedule.lab={ this.$refs.schedule.lab = {
name: event.name, name: event.name,
position: event.position position: event.position
} }
@ -335,27 +340,29 @@
} }
const schedule = await get('lb/labTime/getLabScheduleAbleBook', params) const schedule = await get('lb/labTime/getLabScheduleAbleBook', params)
const booked = await get('lb/labrecord/getWeekBooked', params) const booked = await get('lb/labrecord/getWeekBooked', params)
this.booked = booked
console.log(this.booked)
for (let i = 0; i < schedule.length; i++) { for (let i = 0; i < schedule.length; i++) {
this.$refs.times.tableData[i].Monday = arr2shortString(schedule[i][0]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][0]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Monday = arr2shortString(schedule[i][0]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][0]) + '周可预约' + '</span>' : ''
this.$refs.times.tableData[i].Tuesday =arr2shortString(schedule[i][1]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][1]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Tuesday = arr2shortString(schedule[i][1]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][1]) + '周可预约' + '</span>' : ''
this.$refs.times.tableData[i].Wednesday = arr2shortString(schedule[i][2]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][2]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Wednesday = arr2shortString(schedule[i][2]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][2]) + '周可预约' + '</span>' : ''
this.$refs.times.tableData[i].Thursday = arr2shortString(schedule[i][3]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][3]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Thursday = arr2shortString(schedule[i][3]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][3]) + '周可预约' + '</span>' : ''
this.$refs.times.tableData[i].Friday = arr2shortString(schedule[i][4]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][4]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Friday = arr2shortString(schedule[i][4]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][4]) + '周可预约' + '</span>' : ''
this.$refs.times.tableData[i].Saturday = arr2shortString(schedule[i][5]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][5]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Saturday = arr2shortString(schedule[i][5]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][5]) + '周可预约' + '</span>' : ''
this.$refs.times.tableData[i].Sunday = arr2shortString(schedule[i][6]) ? '<span style="color:#1989fa">'+arr2shortString(schedule[i][6]) + '周可预约' +'</span>': '' this.$refs.times.tableData[i].Sunday = arr2shortString(schedule[i][6]) ? '<span style="color:#1989fa">' + arr2shortString(schedule[i][6]) + '周可预约' + '</span>' : ''
} }
for (let i = 0; i < booked.length; i++) { for (let i = 0; i < booked.length; i++) {
this.$refs.times.tableData[i].Monday = arr2shortString(booked[i][0]) ? '<span style="color:red">'+arr2shortString(booked[i][0]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Monday : this.$refs.times.tableData[i].Monday this.$refs.times.tableData[i].Monday = arr2shortString(booked[i][0]) ? '<span style="color:red">' + arr2shortString(booked[i][0]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Monday : this.$refs.times.tableData[i].Monday
this.$refs.times.tableData[i].Tuesday =arr2shortString(booked[i][1]) ? '<span style="color:red">'+arr2shortString(booked[i][1]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Tuesday : this.$refs.times.tableData[i].Tuesday this.$refs.times.tableData[i].Tuesday = arr2shortString(booked[i][1]) ? '<span style="color:red">' + arr2shortString(booked[i][1]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Tuesday : this.$refs.times.tableData[i].Tuesday
this.$refs.times.tableData[i].Wednesday = arr2shortString(booked[i][2]) ? '<span style="color:red">'+arr2shortString(booked[i][2]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Wednesday : this.$refs.times.tableData[i].Wednesday this.$refs.times.tableData[i].Wednesday = arr2shortString(booked[i][2]) ? '<span style="color:red">' + arr2shortString(booked[i][2]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Wednesday : this.$refs.times.tableData[i].Wednesday
this.$refs.times.tableData[i].Thursday = arr2shortString(booked[i][3]) ? '<span style="color:red">'+arr2shortString(booked[i][3]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Thursday : this.$refs.times.tableData[i].Thursday this.$refs.times.tableData[i].Thursday = arr2shortString(booked[i][3]) ? '<span style="color:red">' + arr2shortString(booked[i][3]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Thursday : this.$refs.times.tableData[i].Thursday
this.$refs.times.tableData[i].Friday = arr2shortString(booked[i][4]) ? '<span style="color:red">'+arr2shortString(booked[i][4]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Friday : this.$refs.times.tableData[i].Friday this.$refs.times.tableData[i].Friday = arr2shortString(booked[i][4]) ? '<span style="color:red">' + arr2shortString(booked[i][4]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Friday : this.$refs.times.tableData[i].Friday
this.$refs.times.tableData[i].Saturday = arr2shortString(booked[i][5]) ? '<span style="color:red">'+arr2shortString(booked[i][5]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Saturday : this.$refs.times.tableData[i].Saturday this.$refs.times.tableData[i].Saturday = arr2shortString(booked[i][5]) ? '<span style="color:red">' + arr2shortString(booked[i][5]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Saturday : this.$refs.times.tableData[i].Saturday
this.$refs.times.tableData[i].Sunday = arr2shortString(booked[i][6]) ? '<span style="color:red">'+arr2shortString(booked[i][6]) + '周已预约' +'</span><br>'+this.$refs.times.tableData[i].Sunday : this.$refs.times.tableData[i].Sunday this.$refs.times.tableData[i].Sunday = arr2shortString(booked[i][6]) ? '<span style="color:red">' + arr2shortString(booked[i][6]) + '周已预约' + '</span><br>' + this.$refs.times.tableData[i].Sunday : this.$refs.times.tableData[i].Sunday
} }
}, },
async loadSchedule(labId){ async loadSchedule(labId) {
const schedule = await get('lb/labrecord/getLabSchedule',{ const schedule = await get('lb/labrecord/getLabSchedule', {
labId, labId,
year: this.$refs.timeSelection.year, year: this.$refs.timeSelection.year,
semester: this.$refs.timeSelection.semester semester: this.$refs.timeSelection.semester

Loading…
Cancel
Save