Commit 33dcd21e authored by 罗超's avatar 罗超

1

parent 7ac77e06
......@@ -23,3 +23,15 @@ export function getSchoolAndRoomNav(data) {
data
})
}
/**
* 获取教室使用记录
* @param {JSON参数} data
*/
export function getClassRoomTimeList(data) {
return request({
url: '/ClassRoom/GetClassRoomTimeList',
method: 'post',
data
})
}
......@@ -10,7 +10,7 @@
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<div class="classroom-name">{{_item.RoomName}}
<div class="classroom-name" @click="goUrl">{{_item.RoomName}}
<!-- <img src="../../assets/images/classroom/warning.png" class="q-ml-sm" v-if="_item.warn">
<img src="../../assets/images/classroom/normal.png" class="q-ml-sm" v-if="!_item.warn"> -->
</div>
......@@ -25,8 +25,8 @@
class="q-ma-md classroom-user"
readonly
style="text-align: center"
>
{{ _item.UserRate}}%
<br/>
使用率
......
<template>
<div class="">
<q-list style="width:180px;overflow:hidden;background-color: rgb(245, 246, 247);">
<template v-for="(x,i) in secondNavs">
<q-item :to="x.MenuUrl" clickable v-ripple :active="currentPath==x.MenuUrl" v-if="x.SubList.length==0"
<template v-for="(x,i) in NavData">
<q-item to="" clickable v-ripple :active="currentNav==x.key" @click="chooseNav(x)" v-if="x.RoomList.length==0"
:key="i">
<q-item-section avatar style="min-width:30px;">
<q-icon :name="x.MenuIcon" size="20px" />
</q-item-section>
<q-item-section>{{x.MenuName}}</q-item-section>
<!-- <q-item-section avatar style="min-width:30px;"> -->
<!-- <q-icon :name="x.MenuIcon" size="20px" /> -->
<!-- </q-item-section> -->
<q-item-section>{{x.SchoolName}}</q-item-section>
</q-item>
<q-expansion-item v-else :label="x.MenuName">
<q-item :to="y.MenuUrl" clickable v-ripple :active="currentPath==y.MenuUrl"
v-for="(y, yi) in x.SubList" :key="yi">
<q-item-section avatar style="padding-right:0;min-width:30px;">
<q-icon :name="y.MenuIcon" size="20px" />
</q-item-section>
<q-item-section>{{y.MenuName}}</q-item-section>
<q-expansion-item v-else :label="x.SchoolName" @show="showNav($event,x.Key)">
<q-item to="" clickable v-ripple :active="currentNav==y.RoomId"
v-for="(y, yi) in x.RoomList" :key="y.RoomId" @click="chooseNav(y)">
<!-- <q-item-section avatar style="padding-right:0;min-width:30px;"> -->
<!-- <q-icon :name="y.MenuIcon" size="20px" /> -->
<!-- </q-item-section> -->
<q-item-section style="padding-left:20px">{{y.RoomName}}</q-item-section>
</q-item>
</q-expansion-item>
</template>
......@@ -24,6 +24,7 @@
</template>
<script>
import { active } from 'src/pages/financial/lang/zh';
export default {
meta: {
title: "使用记录"
......@@ -31,52 +32,39 @@
props:{
NavData:{
type:Array,
default:()=>{
[
{
MenuName:"总部",
MenuIcon:"",
MenuUrl:"",
SubList:[
{MenuName:"樱花教室",MenuUrl:"/",MenuIcon:""},
{MenuName:"菊花教室",MenuUrl:"/",MenuIcon:""}
]
}
]
}
default:[]
},
activeNav:{
type:[Number,String],
default:0
}
},
watch:{
activeNav(val){
if(val!=this.currentNav){
this.currentNav=val
console.log(45,this.currentNav)
}
}
},
watch: {
$route: {
handler: function (route) {
this.currentPath = route.path
},
immediate: true
},
},
data() {
return {
currentPath: "",
secondNavs:[
{
MenuName:"总部",
MenuIcon:"",
SubList:[
{MenuName:"樱花教室",MenuUrl:"",MenuIcon:""},
{MenuName:"菊花教室",MenuUrl:"",MenuIcon:""}
]
}
]
currentNav: 1,
schoolId:0,
};
},
mounted(){
},
methods:{
showNav(val,id){
this.schoolId=id
},
chooseNav(i){
this.currentNav=i.RoomId
this.$emit("success",{...i,...{schoolId:this.schoolId}})
}
}
};
......
......@@ -225,14 +225,15 @@
.comSummary .mainSummary {
width: 100%;
/* min-height: 500px; */
margin-top:30px;
margin:10px;
overflow: auto;
}
.comSummary .summaryTable {
width:100%;
min-width: 1400px;
border-radius:4px;
background-color:#E6E6E6;
/* background-color:#E6E6E6; */
background-color: #F1F6FB;
/* table-layout:fixed;word-break:break-all; */
}
......@@ -360,7 +361,7 @@
cursor: pointer;
}
.summaryTable th:first-child{
/* width:180px; */
width:50px;
cursor: default;
}
.dayListTable td {
......
......@@ -196,18 +196,36 @@ var lunarCalendar = {
* @param m solar month
* @return Array
*/
initLunar: function (yearStr, monthStr, dayNum) {
initLunar: function (yearStr, monthStr, dayNum, dateStr) {
//年份限定、上限
if (yearStr < 1900 || yearStr > 2100) {
return -1;
}
var objDate = new Date();
var endDate = new Date();
if (dateStr) {
console.log(dateStr)
let d = Date.parse(dateStr)
let res = new Date(d);
console.log(res, 'res');
objDate = res
endDate = res
}
console.log(211, objDate.getTime(), objDate)
endDate.setDate(endDate.getDate() + dayNum);
console.log(222, endDate.getTime(), endDate)
console.log(endDate.getTime() - objDate.getTime(), 'time');
//修正ymd参数
var m = objDate.getMonth() + 1, d = objDate.getDate();
var totalMonthDay = lunarCalendar.solarDays(yearStr, m);
var array = [];
while ((endDate.getTime() - objDate.getTime()) > 0) {
//星期几
var nWeek = objDate.getDay(), cWeek = lunarCalendar.weekStr[nWeek];
......
<template>
<div class="page-body con">
<div class="left">
<ClassroomNav/>
<div class="dateModel col-5 q-mb-sm cursor-pointer shadow-1">
<div class="q-mb-sm">开始日期:{{dateModel}}</div>
<q-btn label="重新选择" color="primary" size="sm" >
<q-popup-proxy transition-show="scale" transition-hide="scale">
<q-date now-btn v-model="dateModel" mask="YYYY-MM-DD" @input="dateChoose">
<div class="row items-center justify-end">
<q-btn v-close-popup label="关闭" color="primary q-px-md" flat />
</div>
</q-date>
</q-popup-proxy>
</q-btn>
</div>
<ClassroomNav :NavData="navData" :activeNav="msg.RoomId" @success="successNav"/>
</div>
<div class="right">
<!-- <el-timeline :reverse="reverse">
<el-timeline-item
v-for="(activity, index) in activities"
:key="index"
:timestamp="activity.timestamp">
</el-timeline-item>
</el-timeline> -->
<Calendar></Calendar>
<Calendar :tbodayData="tbodayData" :startT="dateModel" @change="CalendarChange"></Calendar>
</div>
</div>
</template>
......@@ -22,60 +25,131 @@
import ClassroomNav from "./components/classroomNav";
import Calendar from './components/scenicSummary.vue'
import {
getSchoolAndRoomNav
getSchoolAndRoomNav,
getClassRoomTimeList
} from '../../api/classroom/index';
export default {
meta: {
title: "使用记录"
title: "教室状态"
},
components:{
ClassroomNav,
Calendar,
},
data() {
return {
return {
dateModel:"",
loading: true,
msg: {
pageIndex: 1,
pageSize: 12,
},
schoolId:0,
navData:[],
reverse: true,
activities: [{
timestamp: '09:30'
}, {
timestamp: '09:45'
}, {
timestamp: '10:00'
}]
msg:{
RoomId:0,
SchoolId:0,
StartTime:"2020-07-08",
EndTime:""
},
tbodayData:[]
};
},
created(){
let d=new Date();
let year =d.getFullYear();
let month=d.getMonth()+1;
month=month<10?'0'+month:month;
let day=d.getDate();
day=day<10?'0'+day:day;
let today=year+'-'+month+'-'+day;
this.msg.StartTime=today;
this.dateModel=today;
let endDate = new Date(d.getTime() + 6 * 24 * 60 * 60 * 1000);
let endYear = endDate.getFullYear();
let enDMonth = endDate.getMonth() + 1
if (enDMonth < 10) {
enDMonth = '0' + enDMonth
}
let endDay = endDate.getDate()
if (endDay < 10) {
endDay = '0' + endDay
}
let end = endYear + '-' + enDMonth + '-' + endDay
this.msg.EndTime = end;
},
mounted(){
this.getNavList();
this.getNavList();
// this.getClassRoomTimeList();
},
methods:{
// goUrl(){
// this.$router.push({
// path:"/classroom/useRecord",
// query:{
// }
// })
// },
getNavList() {
// 获取校区教室导航列表
getNavList() {
let that=this
getSchoolAndRoomNav({}).then(res => {
this.loading = false
if(res.Code===1){
this.navData=res.Data
this.msg.SchoolId=res.Data[0].Key
this.msg.RoomId=res.Data[0].RoomList[0].RoomId
that.getClassRoomTimeList()
}
}).catch(() => {
})
},
//获取教室使用记录
getClassRoomTimeList() {
getClassRoomTimeList(this.msg).then(res => {
this.loading = false
if(res.Code===1){
this.tbodayData=res.Data
}
}).catch(() => {
this.loading = false;
})
},
//选择校区教室导航
successNav(val){
this.msg.RoomId=val.RoomId
this.msg.SchoolId=val.SchoolId
this.getClassRoomTimeList();
this.$forceUpdate()
},
dateChoose(value, reason, details){
console.log(112,this.dateModel)
},
//获取结束日期
getEndTime(date){
let d=Date.parse(date)
let endDate = new Date(d + 6 * 24 * 60 * 60 * 1000);
let endYear = endDate.getFullYear();
let enDMonth = endDate.getMonth() + 1
if (enDMonth < 10) {
enDMonth = '0' + enDMonth
}
let endDay = endDate.getDate()
if (endDay < 10) {
endDay = '0' + endDay
}
let end = endYear + '-' + enDMonth + '-' + endDay
this.msg.EndTime = end;
},
//切换日历
CalendarChange(val){
let arr=val.split('-');
if(arr[1].length==1){
let month=parseInt(arr[1])
if(month<10){
arr[1]='0'+arr[1]
}
}
let newVal= arr.join("-")
this.dateModel=newVal
this.msg.StartTime=newVal
this.getEndTime(newVal)
this.getClassRoomTimeList();
this.$forceUpdate()
}
}
};
......@@ -85,8 +159,16 @@
padding: 5px !important;
display: flex;
.left{
width: 200px;
background-color: rgb(245, 246, 247);
}
}
.dateModel{
// height: 50px;
padding: 20px 10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: space-around;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment