|
|
|
@ -107,7 +107,7 @@
|
|
|
|
|
<!-- <el-button @click="deleteLab(scope.row.lab_id)" type="danger" size="mini" plain-->
|
|
|
|
|
<!-- icon="el-icon-delete">删除-->
|
|
|
|
|
<!-- </el-button>-->
|
|
|
|
|
<el-button @click="schedulePreview(scope.row.lab_id)" size="mini" plain>查看课表</el-button>
|
|
|
|
|
<el-button @click="schedulePreview(scope.row)" size="mini" plain>查看课表</el-button>
|
|
|
|
|
<el-button @click="editSchedule(scope.row)" type="primary" size="mini" icon="el-icon-edit"
|
|
|
|
|
plain>修改可预约时间段
|
|
|
|
|
</el-button>
|
|
|
|
@ -116,19 +116,22 @@
|
|
|
|
|
</el-table>
|
|
|
|
|
<add-lab ref="addLab" @confirm="submit"></add-lab>
|
|
|
|
|
<set-lab-time ref="setLabTime"></set-lab-time>
|
|
|
|
|
<tb_courseDialog :cClick="cellClick" :cStyle="tableStyle" table-label="实验室课表" ref="schedule" :custom="true" c-click=""></tb_courseDialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
import addLab from "~/components/supManager/addLab" ;
|
|
|
|
|
import tb_courseDialog from "~/components/tb_courseDialog";
|
|
|
|
|
|
|
|
|
|
import {get, post} from "~/utils";
|
|
|
|
|
import {closeLoading, showDialog, showDialogWithReject, showFail, showLoading, showSuccess} from "~/utils/dialog";
|
|
|
|
|
import setLabTime from "~/components/supManager/setLabTime";
|
|
|
|
|
import {item2html} from "~/utils/converter";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {addLab, setLabTime},
|
|
|
|
|
components: {addLab, setLabTime, tb_courseDialog},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
edit: false,
|
|
|
|
@ -166,7 +169,7 @@
|
|
|
|
|
this.$refs.addLab.form.managerId = this.$refs.addLab.form.manager_id
|
|
|
|
|
if (this.$refs.addLab.form.lab_id) {
|
|
|
|
|
// 编辑
|
|
|
|
|
await showDialog('确认要编辑吗?',this)
|
|
|
|
|
await showDialog('确认要编辑吗?', this)
|
|
|
|
|
this.$refs.addLab.form.labId = this.$refs.addLab.form.lab_id
|
|
|
|
|
await post('lb/lab/updateLab', this.$refs.addLab.form).then(async () => {
|
|
|
|
|
await this.load()
|
|
|
|
@ -177,21 +180,21 @@
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// 新增
|
|
|
|
|
await showDialog('确认要新增吗?',this)
|
|
|
|
|
await showDialogWithReject('是否需要为该实验室添加'+parseInt(this.time.year)+'-'+(parseInt(this.time.year)+1)+'学年第'+this.time.semester+'学期16周的所有时间段?',this).then(async()=>{
|
|
|
|
|
await showDialog('确认要新增吗?', this)
|
|
|
|
|
await showDialogWithReject('是否需要为该实验室添加' + parseInt(this.time.year) + '-' + (parseInt(this.time.year) + 1) + '学年第' + this.time.semester + '学期16周的所有时间段?', this).then(async () => {
|
|
|
|
|
this.$refs.addLab.form.fastInsert = true
|
|
|
|
|
this.$refs.addLab.form.year = this.time.year
|
|
|
|
|
this.$refs.addLab.form.semester = this.time.semester
|
|
|
|
|
console.log(this.$refs.addLab.form)
|
|
|
|
|
await this.addLab()
|
|
|
|
|
}).catch(async()=>{
|
|
|
|
|
}).catch(async () => {
|
|
|
|
|
this.$refs.addLab.form.fastInsert = false
|
|
|
|
|
await this.addLab()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.$refs.addLab.addLabDialog = false
|
|
|
|
|
},
|
|
|
|
|
async addLab(){
|
|
|
|
|
async addLab() {
|
|
|
|
|
const loading = showLoading('正在新增...', this)
|
|
|
|
|
const newLab = await post('lb/lab/addLab', this.$refs.addLab.form).then(async () => {
|
|
|
|
|
await this.load()
|
|
|
|
@ -211,14 +214,42 @@
|
|
|
|
|
// showFail('删除失败,实验室含有时间段时无法删除', this)
|
|
|
|
|
// })
|
|
|
|
|
// },
|
|
|
|
|
async schedulePreview() {
|
|
|
|
|
await showFail('尚未开发', this)
|
|
|
|
|
async schedulePreview(event) {
|
|
|
|
|
await this.loadSchedule(event.lab_id)
|
|
|
|
|
this.$refs.schedule.lab = {
|
|
|
|
|
name: event.name,
|
|
|
|
|
position: event.position
|
|
|
|
|
}
|
|
|
|
|
this.$refs.schedule.courseDialog = true
|
|
|
|
|
},
|
|
|
|
|
async editSchedule(item) {
|
|
|
|
|
this.$refs.setLabTime.lab = item
|
|
|
|
|
this.$refs.setLabTime.form.labId = item.lab_id
|
|
|
|
|
this.$refs.setLabTime.setLabTimeDialog = true
|
|
|
|
|
},
|
|
|
|
|
async loadSchedule(labId) {
|
|
|
|
|
const schedule = await get('lb/labrecord/getLabSchedule', {
|
|
|
|
|
labId,
|
|
|
|
|
year: this.time.year,
|
|
|
|
|
semester: this.time.semester
|
|
|
|
|
}) //发送地址,请求该实验室地址的所有课程
|
|
|
|
|
for (let i = 0; i < schedule.length; i++) {
|
|
|
|
|
this.$refs.schedule.tableData[i].Monday = item2html(schedule[i][0])
|
|
|
|
|
this.$refs.schedule.tableData[i].Tuesday = item2html(schedule[i][1])
|
|
|
|
|
this.$refs.schedule.tableData[i].Wednesday = item2html(schedule[i][2])
|
|
|
|
|
this.$refs.schedule.tableData[i].Thursday = item2html(schedule[i][3])
|
|
|
|
|
this.$refs.schedule.tableData[i].Friday = item2html(schedule[i][4])
|
|
|
|
|
this.$refs.schedule.tableData[i].Saturday = item2html(schedule[i][5])
|
|
|
|
|
this.$refs.schedule.tableData[i].Sunday = item2html(schedule[i][6])
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cellClick() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
tableStyle() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
// tableDataComputed() {
|
|
|
|
|