[fix][V]:完善申请实验室课表组件与router

master
Romesum 5 years ago
parent f2625c7bbb
commit f4cb7f8475

@ -77,14 +77,12 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 表格节数选择--> <!-- 表格节数选择-->
<el-dialog :title="form.position+' '+form.name" :visible.sync="courseDialog" append-to-body <tb_course :cClick="cellClick" :cStyle="cellStyle" table-label="" ref="times"
:close-on-click-modal="false" v-if="tableAlive"> :custom="true"></tb_course>
<tb_course :cClick="cellClick" :cStyle="cellStyle" table-label="" ref="times"></tb_course>
</el-dialog>
<!-- checkbox:周次选择--> <!-- checkbox:周次选择-->
<el-dialog :visible.sync="weekDialog" title="请选择周数" width="400px" :close-on-click-modal="false" <el-dialog :visible.sync="weekDialog" title="请选择周数" width="400px" :close-on-click-modal="false"
:before-close="beforeClose" :destroy-on-close="true"> :before-close="beforeClose" :destroy-on-close="true">
<week-selection @add="addWeek" @cancel="cancelSelection" ref="weekSelection" <week-selection @add="addWeek" @cancel="weekDialog=false" ref="weekSelection"
:able-list="ableList"></week-selection> :able-list="ableList"></week-selection>
</el-dialog> </el-dialog>
</el-container> </el-container>
@ -94,12 +92,13 @@
</template> </template>
<script> <script>
import tb_course from "~/components/tb_course"; import tb_course from "~/components/tb_courseDialog";
import navBar from "~/components/teacher/navBar"; import navBar from "~/components/teacher/navBar";
import weekSelection from "~/components/weekSelection"; import weekSelection from "~/components/weekSelection";
import timeSelect from "~/components/timeSelect"; import timeSelect from "~/components/timeSelect";
import {get, post, stop} from "~/utils"; import {get, post, stop} from "~/utils";
import {showDialog, showFail, showSuccess} from "~/utils/dialog"; import {showDialog, showFail, showSuccess} from "~/utils/dialog";
import {arr2shortString} from "~/utils/converter";
export default { export default {
name: "applyLab", name: "applyLab",
@ -220,24 +219,25 @@
// //
await showDialog("确认预约此时间段吗?", this) await showDialog("确认预约此时间段吗?", this)
await post('lb/labrecord/updateWeeks', this.form) await post('lb/labrecord/updateWeeks', this.form)
await showSuccess("预约成功,管理员正在审核",this) await this.getScheduleAble()
await showSuccess("预约成功,管理员正在审核", this)
this.form.weeks = [] this.form.weeks = []
if (targetValue.length !== 0) { // if (targetValue.length !== 0) {
this.perTargetValue.textContent = '【' + targetValue + '】周' // this.perTargetValue.textContent = '' + targetValue + ''
this.aWeekValue.push(targetValue) //[rowIndex,column,targetValue] // this.aWeekValue.push(targetValue) //[rowIndex,column,targetValue]
this.allWeeksValue.push(this.aWeekValue) //allWeeksValue // this.allWeeksValue.push(this.aWeekValue) //allWeeksValue
this.perTargetValue.style.backgroundColor = 'lightyellow' // this.perTargetValue.style.backgroundColor = 'lightyellow'
for (let i = 0; i < this.allWeeksValue.length; i++) { // for (let i = 0; i < this.allWeeksValue.length; i++) {
for (let j = i + 1; j < this.allWeeksValue.length; j++) { // for (let j = i + 1; j < this.allWeeksValue.length; j++) {
if (this.allWeeksValue[i][0] === this.allWeeksValue[j][0] && this.allWeeksValue[i][1] === this.allWeeksValue[j][1]) { // if (this.allWeeksValue[i][0] === this.allWeeksValue[j][0] && this.allWeeksValue[i][1] === this.allWeeksValue[j][1]) {
this.allWeeksValue.splice(i, 1) // this.allWeeksValue.splice(i, 1)
} // }
} // }
} // }
} // }
this.aWeekValue = [] // this.aWeekValue = []
this.$refs.weekSelection.checkedValue = [] // // this.$refs.weekSelection.checkedValue = [] //
// console.log(this.allWeeksValue) // console.log(this.allWeeksValue)
}, },
// //
@ -290,12 +290,14 @@
// this.tableAlive = false // // this.tableAlive = false //
// }, // },
setTime: function () { setTime: function () {
this.tableAlive = true
// alert('便') // alert('便')
// this.courseDialog = true // this.courseDialog = true
this.$refs.courseForm.validate((valid)=>{ this.$refs.courseForm.validate(async (valid) => {
if (valid){ if (valid) {
this.courseDialog=true console.log(this)
await this.getScheduleAble()
this.$refs.times.lab = this.lab
this.$refs.times.courseDialog = true
this.formDialog = false this.formDialog = false
} }
}) })
@ -314,6 +316,34 @@
}, },
async loadCourse() { async loadCourse() {
this.courseOption = await get("lb/usercourse/findbyyearandsemester/" + this.$refs.timeSelection.year + "/" + this.$refs.timeSelection.semester) this.courseOption = await get("lb/usercourse/findbyyearandsemester/" + this.$refs.timeSelection.year + "/" + this.$refs.timeSelection.semester)
},
async getScheduleAble() {
const params = {
labId: this.form.labId,
year: this.$refs.timeSelection.year,
semester: this.$refs.timeSelection.semester,
uc_id: this.form.uc_id
}
const schedule = await get('lb/labTime/getLabScheduleAbleBook', params)
const booked = await get('lb/labrecord/getWeekBooked', params)
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].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].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].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>': ''
}
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].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].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].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
}
} }
}, },
//mouted //mouted

@ -19,7 +19,6 @@ import supIndex from "~/components/supManager/index";
import globalPersonal from "~/components/personal"; import globalPersonal from "~/components/personal";
import userManage from "~/components/supManager/userManage"; import userManage from "~/components/supManager/userManage";
import labManager from "~/components/supManager/labManage"; import labManager from "~/components/supManager/labManage";
import tool from "~/components/tool";
//manager //manager
import check from "~/components/supManager/check"; import check from "~/components/supManager/check";
@ -139,10 +138,6 @@ const routes = [
path: '/labApplyDetail/:id', path: '/labApplyDetail/:id',
component: labApplyDetail, component: labApplyDetail,
props: true props: true
},
{
path: '/tool',
component: tool
} }
] ]

Loading…
Cancel
Save