diff --git a/element-vue/src/components/applyDialog.vue b/element-vue/src/components/applyDialog.vue index 44cda96..2df013f 100644 --- a/element-vue/src/components/applyDialog.vue +++ b/element-vue/src/components/applyDialog.vue @@ -38,7 +38,6 @@ population:'', schedule:[], remind:'' - } } } diff --git a/element-vue/src/components/tb_course.vue b/element-vue/src/components/tb_course.vue index 1c8a109..55ad4ef 100644 --- a/element-vue/src/components/tb_course.vue +++ b/element-vue/src/components/tb_course.vue @@ -1,8 +1,6 @@ @@ -11,12 +11,42 @@ import tb_course from "~/components/tb_course"; import timeSelect from "~/components/timeSelect"; import navBar from "~/components/teacher/navBar"; + import {get} from "~/utils"; export default { name: "labApplyDetail", + props:['id'], components:{ tb_course, navBar, timeSelect + }, + data(){ + return{ + tableData:[] + } + }, + methods: { + cClick(){ + console.log('you click a cell') + }, + cellStyle: function ({row, column, rowIndex, columnIndex}) { + if (column.label != '') { + return 'cursor:pointer' + } + }, + + }, + mounted() { + this.tableData=get('',this.id) //发送地址,请求该实验室地址的所有课程,用一个二位数组返回 + for (let i = 0; i < this.tableData.length; i++) { + this.tableData[i].Monday = this.data[i][0] + this.tableData[i].Tuesday = this.data[i][1] + this.tableData[i].Wednesday = this.data[i][2] + this.tableData[i].Thursday = this.data[i][3] + this.tableData[i].Friday = this.data[i][4] + this.tableData[i].Saturday = this.data[i][5] + this.tableData[i].Sunday = this.data[i][6] + } } } diff --git a/element-vue/src/pages/teacher/applyLab.vue b/element-vue/src/pages/teacher/applyLab.vue index eac35c7..b3d3372 100644 --- a/element-vue/src/pages/teacher/applyLab.vue +++ b/element-vue/src/pages/teacher/applyLab.vue @@ -11,7 +11,7 @@
- 我的申请记录 + 我的申请记录
@@ -29,8 +29,8 @@ label="操作" width="212"> > @@ -38,37 +38,40 @@ + - - + + + + + + + + + + + - + - + - + - - - - + - + - + - - - -
@@ -85,8 +88,8 @@ - - + + @@ -110,13 +113,19 @@ }, data(){ return{ - tableData:[{} - ], + user:{}, + lab:{}, + + tableData:[{}], + checkOptioin :[], + formDialog:false, courseDialog:false, weekDialog:false, + perTargetValue:'', allWeeksValue:[], + form:{ position:'', name:'', @@ -128,19 +137,97 @@ population:'', schedule:'', remind:'' - }, - + courseOption:[] } }, methods:{ + //表格中每个格子的风格 cellStyle:function({row, column, rowIndex, columnIndex}){ if (column.label!=''){ return 'cursor:pointer' } + //(待写)检索该实验室的申请情况,每个格子的周数未满则显示为绿色外框,满了则显示红色外框 + //思路大概是每个格子都定义一个属性——isFull,点击打开格子时,就会获取格子的信息,进行for循环,如果isFull,则格子显示为绿色,反之显示为红色。 }, + //点击格子促发的函数 cellClick:function (row, column, cell, event) { + //(待写)检索该格子的周数申请信息,被申请的周数使其样式变为disable + let position = this.lab.position + let rowIndex = row.index + let columIndex = column.index + var weeks=get('',{position,rowIndex,columIndex}) //返回该格子的周数信息:数组 + this.checkOption=weeks + //测试用例 + // this.checkOption=[ + // { + // value:'1', + // isDisable:false + // }, + // { + // value:'2', + // isDisable:false + // }, + // { + // value:'3', + // isDisable:false + // }, + // { + // value:'4', + // isDisable:false + // }, + // { + // value:'5', + // isDisable:false + // }, + // { + // value:'6', + // isDisable:false + // }, + // { + // value:'7', + // isDisable:false + // }, + // { + // value:'8', + // isDisable:false + // }, + // { + // value:'9', + // isDisable:false + // }, + // { + // value:'10', + // isDisable:false + // },{ + // value:'11', + // isDisable:false + // },{ + // value:'12', + // isDisable:false + // },{ + // value:'13', + // isDisable:false + // },{ + // value:'14', + // isDisable:false + // },{ + // value:'15', + // isDisable:false + // },{ + // value:'16', + // isDisable:false + // },{ + // value:'17', + // isDisable:false + // },{ + // value:'18', + // isDisable:false + // }, + // ] + console.log(row.index) + console.log(column.index) if (this.weekDialog=false){this.weekDialog=true} else {this.weekDialog=false} if (column.label!='') { @@ -148,12 +235,35 @@ // event.target.textContent='' //赋予格子内容 this.weekDialog=true this.perTargetValue=event.target //用target对表格进行定位并保存致target对象 - - } }, + //跳转到我的申请记录 + toMyRecord(){ + this.$router.push('/teacher/myApplyRecord/'+this.user.u_id) //这里的user.u_id作为是作为路径参数存在 + }, + //点击申请实验室按钮 + clickLabApply(row){ + this.lab=row + this.formDialog=true + + }, + //点击查看申请详情 + checkDetail(row){ + this.$router.push('/labApplyDetail/'+row.position) //发送该行的实验室地址作为参数,使得实验室申请详情可以获得此参数后请求并检索数据 + }, + //当选择的课程发生改变触发此函数 + selectChange(){ + this.courseOption = get('',this.u_id) //发送教师id,返回该教师课程管理中所有的课程信息,是一个数组 + this.form.position= this.lab.position //实验室地点 + this.form.name= this.lab.name //实验室名称 + this.form.date=d.getFullYear()+'/'+(d.getMonth()+1)+'/'+d.getDate() //日期 + this.form.nickname= this.user.nickname //昵称 + this.form.tel= this.user.tel //电话 + this.form.class= this.courseOption.class //班级 + this.form.population= this.courseOption.population //人数 + }, + //添加已选择的的周数 addWeek:function () { - console.log(this.perTargetValue) this.weekDialog=false var targetValue = this.$refs.weekSelection.checkedValue if(targetValue.length!==0){ @@ -163,6 +273,7 @@ } }, + //取消选择这些周数 cancelSelection:function () { console.log('已取消') this.perTargetValue.style.backgroundColor='' @@ -173,12 +284,14 @@ // } this.weekDialog=false }, + //确定所有已选择的周数 setWeeks:function () { this.form.schedule=this.allWeeksValue.toString() this.courseDialog=false console.log(this.$refs.times) }, + //取消所有已选择的周数 cancelSetWeeks:function () { this.courseDialog=false }, @@ -193,10 +306,12 @@ this.formDialog=false } }, + //钩子函数,生命周期mouted mounted() { console.log(this.$refs.detailtb) + this.user=get('') //获取账号信息 var d = new Date() - this.form.date=d.getFullYear()+'/'+(d.getMonth()+1)+'/'+d.getDate() + } } diff --git a/element-vue/src/pages/teacher/courseManagement.vue b/element-vue/src/pages/teacher/courseManagement.vue index 4c10262..a0fcb0c 100644 --- a/element-vue/src/pages/teacher/courseManagement.vue +++ b/element-vue/src/pages/teacher/courseManagement.vue @@ -1,10 +1,10 @@