[feat][V]:新增实验室课表

master
Romesum 5 years ago
parent c1e972249f
commit e7f1e6d4e8

@ -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() {

@ -1,6 +1,6 @@
<template>
<div>
<el-dialog :visible.sync="courseDialog" append-to-body :close-on-click-modal="false"
<el-dialog :visible.sync="courseDialog" append-to-body :close-on-click-modal="false" width="80%"
:title="lab.position+' '+lab.name">
<el-table :data="tableData" :span-method="objectSpanMethod" @cell-click="cClick" :cell-style="cStyle">
<el-table-column :label="tableLabel" align="center ">

@ -29,7 +29,7 @@
label="操作"
width="212">
<template slot-scope="scope">
<el-button @click="" type="text" size="medium" @click="checkDetail(scope.row)">
<el-button type="text" size="medium" @click="checkDetail(scope.row)">
</el-button>
<el-button @click="clickLabApply(scope.row)" type="text" size="medium">申请</el-button>
</template>
@ -86,23 +86,26 @@
:able-list="ableList"></week-selection>
</el-dialog>
</el-container>
<!-- 课表-->
<tb_course-dialog table-label="" ref="schedule" :custom="true"></tb_course-dialog>
</div>
</template>
<script>
import tb_course from "~/components/tb_courseDialog";
import tb_courseDialog from "~/components/tb_courseDialog";
import navBar from "~/components/teacher/navBar";
import weekSelection from "~/components/weekSelection";
import timeSelect from "~/components/timeSelect";
import {get, post, stop} from "~/utils";
import {showDialog, showFail, showSuccess} from "~/utils/dialog";
import {arr2shortString} from "~/utils/converter";
import {arr2shortString, item2html} from "~/utils/converter";
export default {
name: "applyLab",
components: {
tb_courseDialog,
tb_course, navBar, weekSelection, timeSelect
},
data() {
@ -201,8 +204,13 @@
this.formDialog = true
},
//
checkDetail(row) {
this.$router.push('/labApplyDetail/' + row.position) //使
async checkDetail(event) {
await this.loadSchedule(event.lab_id)
this.$refs.schedule.lab={
name: event.name,
position: event.position
}
this.$refs.schedule.courseDialog = true
},
//
async selectChange(uc_id) {
@ -344,6 +352,22 @@
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
}
},
async loadSchedule(labId){
const schedule = await get('lb/labrecord/getLabSchedule',{
labId,
year: this.$refs.timeSelection.year,
semester: this.$refs.timeSelection.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])
}
}
},
//mouted

@ -53,7 +53,7 @@ export function item2html(items) {
for (let item in items) {
html += spanHeader + items[item].course_name + ' ' + items[item].nickname + spanFooter + br
html += spanHeader + items[item].classes + ' ' + items[item].population + spanFooter + br
html += spanHeader + arr2shortString(items[item].weeks) + '周' + spanFooter + br
html += spanHeader + '第' + arr2shortString(items[item].weeks) + '周' + spanFooter + br
html += spanHeader + items[item].software + spanFooter + br
}
return html

Loading…
Cancel
Save