|
|
@ -1,5 +1,6 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<el-dialog :visible="setLabTimeDialog" @close="setLabTimeDialog=false">
|
|
|
|
<el-form :model="form">
|
|
|
|
<el-form :model="form">
|
|
|
|
<el-form-item label="学年:">
|
|
|
|
<el-form-item label="学年:">
|
|
|
|
<el-select v-model="form.year" size="small">
|
|
|
|
<el-select v-model="form.year" size="small">
|
|
|
@ -25,9 +26,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="星期:">
|
|
|
|
<el-form-item label="星期:">
|
|
|
|
<el-input v-model="form.time" @focus="showCourseDialog" placeholder="点我设置" style="width: 200px" >点击设置</el-input>
|
|
|
|
<el-input v-model="form.time" @focus="showCourseDialog" placeholder="点我设置" style="width: 200px">点击设置
|
|
|
|
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 表格:节数选择-->
|
|
|
|
<!-- 表格:节数选择-->
|
|
|
|
<el-dialog :visible.sync="courseDialog" append-to-body :close-on-click-modal="false" v-if="tableAlive">
|
|
|
|
<el-dialog :visible.sync="courseDialog" append-to-body :close-on-click-modal="false" v-if="tableAlive">
|
|
|
@ -39,8 +42,10 @@
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
<!-- checkbox:周次选择-->
|
|
|
|
<!-- checkbox:周次选择-->
|
|
|
|
<el-dialog :visible.sync="weekDialog" title="请选择周数" width="400px" :close-on-click-modal="false" append-to-body>
|
|
|
|
<el-dialog :visible.sync="weekDialog" title="请选择周数" width="400px" :close-on-click-modal="false" append-to-body>
|
|
|
|
<week-selection @add="addWeek" @cancel="cancelSelection" ref="weekSelection" ></week-selection>
|
|
|
|
<week-selection @add="addWeek" @cancel="cancelSelection" ref="weekSelection"
|
|
|
|
|
|
|
|
:able-list="ableList"></week-selection>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
@ -49,16 +54,18 @@
|
|
|
|
import tb_course from "~/components/tb_course";
|
|
|
|
import tb_course from "~/components/tb_course";
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "setLabTime",
|
|
|
|
|
|
|
|
components: {weekSelection, tb_course},
|
|
|
|
components: {weekSelection, tb_course},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
form: {
|
|
|
|
form: {
|
|
|
|
year:2019,
|
|
|
|
year: '2019',
|
|
|
|
semester:2,
|
|
|
|
semester: 2
|
|
|
|
time:"",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
setLabTimeDialog: false,
|
|
|
|
|
|
|
|
ableList: [],
|
|
|
|
|
|
|
|
weekDisable:[],
|
|
|
|
allWeeksValue: [],
|
|
|
|
allWeeksValue: [],
|
|
|
|
aWeekValue: [],
|
|
|
|
aWeekValue: [],
|
|
|
|
courseDialog: false,
|
|
|
|
courseDialog: false,
|
|
|
@ -66,16 +73,20 @@
|
|
|
|
weekDialog: false,
|
|
|
|
weekDialog: false,
|
|
|
|
selectOptions1: [
|
|
|
|
selectOptions1: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
value: 2017,
|
|
|
|
value: '2017',
|
|
|
|
label: '2017-2018年'
|
|
|
|
label: '2017-2018年'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
value: 2018,
|
|
|
|
value: '2018',
|
|
|
|
label: '2018-2019年'
|
|
|
|
label: '2018-2019年'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
value: 2019,
|
|
|
|
value: '2019',
|
|
|
|
label: '2019-2020年'
|
|
|
|
label: '2019-2020年'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
value: '2020',
|
|
|
|
|
|
|
|
label: '2020-2021年'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
selectOptions2: [
|
|
|
|
selectOptions2: [
|
|
|
@ -92,8 +103,7 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
//设置周次与节次
|
|
|
|
//设置周次与节次
|
|
|
|
showCourseDialog(){
|
|
|
|
async showCourseDialog() {
|
|
|
|
console.log('嘿')
|
|
|
|
|
|
|
|
this.tableAlive = true
|
|
|
|
this.tableAlive = true
|
|
|
|
this.courseDialog = true
|
|
|
|
this.courseDialog = true
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -104,34 +114,53 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//点击格子促发的函数
|
|
|
|
//点击格子促发的函数
|
|
|
|
cellClick(row, column, cell, event) {
|
|
|
|
async cellClick(row, column, cell, event) {
|
|
|
|
console.log(row.index)
|
|
|
|
this.form.weeks = null
|
|
|
|
if (column.label!='') {
|
|
|
|
this.form.day = column.index
|
|
|
|
|
|
|
|
this.form.time = row.index
|
|
|
|
|
|
|
|
this.form.uc_id = 0
|
|
|
|
|
|
|
|
console.log(this.form)
|
|
|
|
|
|
|
|
const weekAll = await get('lb/labTime/getWeeks', this.form)
|
|
|
|
|
|
|
|
const weekAble = await get("lb/labTime/getWeeksAbleBook", this.form)
|
|
|
|
|
|
|
|
this.weekDisable = weekAll.filter(elem => !(weekAble.indexOf(elem) > -1))
|
|
|
|
|
|
|
|
this.ableList = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18].filter(elem=> !(this.weekDisable.indexOf(elem) > -1))
|
|
|
|
this.weekDialog = true
|
|
|
|
this.weekDialog = true
|
|
|
|
this.perTargetValue=event.target //用target对表格进行定位并保存致target对象
|
|
|
|
// if (column.label != '') {
|
|
|
|
console.log(this.aWeekValue,this.allWeeksValue)
|
|
|
|
// this.weekDialog = true
|
|
|
|
this.aWeekValue.push(row.index,column.index)
|
|
|
|
// this.perTargetValue = event.target //用target对表格进行定位并保存致target对象
|
|
|
|
}
|
|
|
|
// // console.log(this.aWeekValue, this.allWeeksValue)
|
|
|
|
|
|
|
|
// this.aWeekValue.push(row.index, column.index)
|
|
|
|
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//添加已选择的的周数
|
|
|
|
//添加已选择的的周数
|
|
|
|
async addWeek() {
|
|
|
|
async addWeek() {
|
|
|
|
|
|
|
|
console.log(this.form)
|
|
|
|
this.weekDialog = false
|
|
|
|
this.weekDialog = false
|
|
|
|
var targetValue = this.$refs.weekSelection.checkedValue
|
|
|
|
var targetValue = this.$refs.weekSelection.checkedValue
|
|
|
|
if(targetValue.length!==0){
|
|
|
|
this.form.weeks = targetValue
|
|
|
|
this.perTargetValue.textContent='【'+targetValue+'】周'
|
|
|
|
//提交
|
|
|
|
this.aWeekValue.push(targetValue) //单个节数时间段添加完成,包括[rowIndex,column,targetValue]
|
|
|
|
await showDialog("确认设置此时间段可预约吗?", this)
|
|
|
|
this.allWeeksValue.push(this.aWeekValue) //把单个格子选择的时间段添加到allWeeksValue中
|
|
|
|
for(let i in this.weekDisable){
|
|
|
|
this.perTargetValue.style.backgroundColor='lightyellow'
|
|
|
|
this.form.weeks.push(this.weekDisable[i])
|
|
|
|
for (let i=0;i<this.allWeeksValue.length;i++){
|
|
|
|
|
|
|
|
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]){
|
|
|
|
|
|
|
|
this.allWeeksValue.splice(i,1)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(this.form)
|
|
|
|
}
|
|
|
|
await post('lb/labTime/updateLabTime', this.form)
|
|
|
|
|
|
|
|
await showSuccess("设置成功",this)
|
|
|
|
}
|
|
|
|
// if (targetValue.length !== 0) {
|
|
|
|
this.aWeekValue=[]
|
|
|
|
// this.perTargetValue.textContent = '【' + targetValue + '】周'
|
|
|
|
|
|
|
|
// this.aWeekValue.push(targetValue) //单个节数时间段添加完成,包括[rowIndex,column,targetValue]
|
|
|
|
|
|
|
|
// this.allWeeksValue.push(this.aWeekValue) //把单个格子选择的时间段添加到allWeeksValue中
|
|
|
|
|
|
|
|
// this.perTargetValue.style.backgroundColor = 'lightyellow'
|
|
|
|
|
|
|
|
// for (let i = 0; i < this.allWeeksValue.length; i++) {
|
|
|
|
|
|
|
|
// 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]) {
|
|
|
|
|
|
|
|
// this.allWeeksValue.splice(i, 1)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// this.aWeekValue = []
|
|
|
|
// this.$refs.weekSelection.checkedValue=[] //将周数选择器已选择选项置空
|
|
|
|
// this.$refs.weekSelection.checkedValue=[] //将周数选择器已选择选项置空
|
|
|
|
// console.log(this.allWeeksValue)
|
|
|
|
// console.log(this.allWeeksValue)
|
|
|
|
|
|
|
|
|
|
|
|