-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 新增
-
- 批量操作
-
-
+
- 可预约时间段:
-
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 至
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 检索
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- 查看申请详情
- 详细信息
- 查看
+ 编辑
+
+
+
+
+ 查看课表
+ 修改可预约时间段
+
-
+
+
@@ -146,53 +124,101 @@
import addLab from "~/components/supManager/addLab" ;
import {get, post} from "~/utils";
- import {showDialog, showFail, showSuccess} from "~/utils/dialog";
+ import {closeLoading, showDialog, showDialogWithReject, showFail, showLoading, showSuccess} from "~/utils/dialog";
+ import setLabTime from "~/components/supManager/setLabTime";
+
export default {
- components:{addLab},
- data(){
- return{
- edit:"",
- form:{
- type:'0',
- position:'0',
- status:'0',
- },
- time:{
- year:'0',
- week:'0',
- day1:"0",
- day2:"16",
- semester:'0'
+ components: {addLab, setLabTime},
+ data() {
+ return {
+ edit: false,
+ setLabTimeDialog: false,
+ form: {},
+ time: {
+ year: '2019',
+ semester: 2
},
-
- search:'',
- tableData:[
- { name:"aaaa" , address:"509"}
- ],
+ search: '',
+ tableData: [],
}
},
- methods:{
- showAddLab(){
+ methods: {
+ async load() {
+ this.tableData = await get('/lb/lab/getLabList')
+ },
+ // 编辑
+ async editLab(item) {
+ // 判断是否为编辑模式
+ this.edit = !!item
+ this.$refs.addLab.form = item ? item : {
+ position: '',
+ name: '',
+ capacity: '',
+ manager_id: ''
+ }
+ this.$refs.addLab.addLabDialog = true
console.log(this.$refs.addLab)
- this.$refs.addLab.addLabDialog=true
- this.$router.push('/supManager/index/labManager')
-
+ // 弹出编辑框
+ this.dialogFormVisible = true
},
- // 编辑用户
- // async editLab(item) {
- // // 判断是否为编辑模式
- // this.edit = !!item
- // this.userForm = item ? item : {
- // nickname: "",
- // tel: "",
- // email: "",
- // username: "",
- // office: "",
- // position: ''
- // }
- // // 弹出编辑框
- // this.dialogFormVisible = true
+ async submit() {
+ this.$refs.addLab.form.capacity = parseInt(this.$refs.addLab.form.capacity)
+ this.$refs.addLab.form.managerId = this.$refs.addLab.form.manager_id
+ if (this.$refs.addLab.form.lab_id) {
+ // 编辑
+ 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()
+ showSuccess('编辑成功', this)
+ }).catch(() => {
+ showFail('编辑失败', this)
+ })
+
+ } else {
+ // 新增
+ 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()=>{
+ this.$refs.addLab.form.fastInsert = false
+ await this.addLab()
+ })
+ }
+ this.$refs.addLab.addLabDialog = false
+ },
+ async addLab(){
+ const loading = showLoading('正在新增...', this)
+ const newLab = await post('lb/lab/addLab', this.$refs.addLab.form).then(async () => {
+ await this.load()
+ showSuccess('新增成功', this)
+ closeLoading(loading)
+ }).catch(() => {
+ closeLoading(loading)
+ showFail('新增失败', this)
+ })
+ },
+ // async deleteLab(labId) {
+ // await showDialog("确定要删除吗?", this)
+ // await post('lb/lab/deleteLab', {labId}).then(async () => {
+ // await this.load()
+ // await showSuccess('删除成功', this)
+ // }).catch(err => {
+ // showFail('删除失败,实验室含有时间段时无法删除', this)
+ // })
// },
+ async schedulePreview() {
+ await showFail('尚未开发', this)
+ },
+ async editSchedule(item) {
+ this.$refs.setLabTime.lab = item
+ this.$refs.setLabTime.form.labId = item.lab_id
+ this.$refs.setLabTime.setLabTimeDialog = true
+ }
},
computed: {
// tableDataComputed() {
@@ -207,7 +233,8 @@
},
- mounted() {
+ async mounted() {
+ await this.load()
// this.tableData=get('/url')
}
}
diff --git a/element-vue/src/components/supManager/setLabTime.vue b/element-vue/src/components/supManager/setLabTime.vue
index 83790d0..4bdf5b0 100644
--- a/element-vue/src/components/supManager/setLabTime.vue
+++ b/element-vue/src/components/supManager/setLabTime.vue
@@ -1,8 +1,9 @@
+
-
-
+
+
-
-
+
+
-
- 点击设置
+
+ 点击设置
+
-
+
+
-
-
-
+
+
+
@@ -49,33 +51,43 @@
import tb_course from "~/components/tb_course";
import {get, post, stop} from "~/utils";
import {showDialog, showFail, showSuccess} from "~/utils/dialog";
+
export default {
- name: "setLabTime",
- components:{weekSelection,tb_course},
- data(){
- return{
- form:{
- year:2019,
- semester:2,
- time:"",
+ components: {weekSelection, tb_course},
+ data() {
+ return {
+ lab: {
+ name: '',
+ position: ''
+ },
+ form: {
+ year: '2019',
+ semester: 2
},
- allWeeksValue:[],
- aWeekValue:[],
- courseDialog:false,
- tableAlive:false, //用于重载表格
- weekDialog:false,
+ setLabTimeDialog: false,
+ ableList: [],
+ weekDisable: [],
+ allWeeksValue: [],
+ aWeekValue: [],
+ courseDialog: false,
+ tableAlive: false, //用于重载表格
+ weekDialog: false,
selectOptions1: [
{
- value: 2017,
+ value: '2017',
label: '2017-2018年'
},
{
- value: 2018,
+ value: '2018',
label: '2018-2019年'
},
{
- value: 2019,
+ value: '2019',
label: '2019-2020年'
+ },
+ {
+ value: '2020',
+ label: '2020-2021年'
}
],
selectOptions2: [
@@ -90,90 +102,108 @@
],
}
},
- methods:{
+ methods: {
//设置周次与节次
- showCourseDialog(){
- console.log('嘿')
- this.tableAlive=true
- this.courseDialog=true
+ async showCourseDialog() {
+ this.tableAlive = true
+ this.courseDialog = true
},
//表格中每个格子的风格
- cellStyle:function({row, column, rowIndex, columnIndex}){
- if (column.label!=''){
+ cellStyle: function ({row, column, rowIndex, columnIndex}) {
+ if (column.label != '') {
return 'cursor:pointer'
}
},
//点击格子促发的函数
- cellClick(row, column, cell, event) {
- console.log(row.index)
- if (column.label!='') {
- this.weekDialog=true
- this.perTargetValue=event.target //用target对表格进行定位并保存致target对象
- console.log(this.aWeekValue,this.allWeeksValue)
- this.aWeekValue.push(row.index,column.index)
- }
+ async cellClick(row, column, cell, event) {
+ this.form.weeks = null
+ 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
+ // if (column.label != '') {
+ // this.weekDialog = true
+ // this.perTargetValue = event.target //用target对表格进行定位并保存致target对象
+ // // console.log(this.aWeekValue, this.allWeeksValue)
+ // this.aWeekValue.push(row.index, column.index)
+ // }
},
//添加已选择的的周数
async addWeek() {
- this.weekDialog=false
+ console.log(this.form)
+ this.weekDialog = false
var targetValue = this.$refs.weekSelection.checkedValue
- if(targetValue.length!==0){
- 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
+
+ {{arr1}} -> {{constrict(arr1)}}
+ {{arr2}}->{{seg(arr2,4)}}
+
+
+
+
+
+
diff --git a/element-vue/src/components/weekSelection.vue b/element-vue/src/components/weekSelection.vue
index a4373fa..b7cea8f 100644
--- a/element-vue/src/components/weekSelection.vue
+++ b/element-vue/src/components/weekSelection.vue
@@ -10,7 +10,7 @@