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

1

parent 7ac77e06
...@@ -23,3 +23,15 @@ export function getSchoolAndRoomNav(data) { ...@@ -23,3 +23,15 @@ export function getSchoolAndRoomNav(data) {
data data
}) })
} }
/**
* 获取教室使用记录
* @param {JSON参数} data
*/
export function getClassRoomTimeList(data) {
return request({
url: '/ClassRoom/GetClassRoomTimeList',
method: 'post',
data
})
}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<i class="el-icon-picture-outline"></i> <i class="el-icon-picture-outline"></i>
</div> </div>
</el-image> </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/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"> --> <img src="../../assets/images/classroom/normal.png" class="q-ml-sm" v-if="!_item.warn"> -->
</div> </div>
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
class="q-ma-md classroom-user" class="q-ma-md classroom-user"
readonly readonly
style="text-align: center" style="text-align: center"
> >
{{ _item.UserRate}}% {{ _item.UserRate}}%
<br/> <br/>
使用率 使用率
......
<template> <template>
<div class=""> <div class="">
<q-list style="width:180px;overflow:hidden;background-color: rgb(245, 246, 247);"> <q-list style="width:180px;overflow:hidden;background-color: rgb(245, 246, 247);">
<template v-for="(x,i) in secondNavs"> <template v-for="(x,i) in NavData">
<q-item :to="x.MenuUrl" clickable v-ripple :active="currentPath==x.MenuUrl" v-if="x.SubList.length==0" <q-item to="" clickable v-ripple :active="currentNav==x.key" @click="chooseNav(x)" v-if="x.RoomList.length==0"
:key="i"> :key="i">
<q-item-section avatar style="min-width:30px;"> <!-- <q-item-section avatar style="min-width:30px;"> -->
<q-icon :name="x.MenuIcon" size="20px" /> <!-- <q-icon :name="x.MenuIcon" size="20px" /> -->
</q-item-section> <!-- </q-item-section> -->
<q-item-section>{{x.MenuName}}</q-item-section> <q-item-section>{{x.SchoolName}}</q-item-section>
</q-item> </q-item>
<q-expansion-item v-else :label="x.MenuName"> <q-expansion-item v-else :label="x.SchoolName" @show="showNav($event,x.Key)">
<q-item :to="y.MenuUrl" clickable v-ripple :active="currentPath==y.MenuUrl" <q-item to="" clickable v-ripple :active="currentNav==y.RoomId"
v-for="(y, yi) in x.SubList" :key="yi"> 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-item-section avatar style="padding-right:0;min-width:30px;"> -->
<q-icon :name="y.MenuIcon" size="20px" /> <!-- <q-icon :name="y.MenuIcon" size="20px" /> -->
</q-item-section> <!-- </q-item-section> -->
<q-item-section>{{y.MenuName}}</q-item-section> <q-item-section style="padding-left:20px">{{y.RoomName}}</q-item-section>
</q-item> </q-item>
</q-expansion-item> </q-expansion-item>
</template> </template>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
</template> </template>
<script> <script>
import { active } from 'src/pages/financial/lang/zh';
export default { export default {
meta: { meta: {
title: "使用记录" title: "使用记录"
...@@ -31,52 +32,39 @@ ...@@ -31,52 +32,39 @@
props:{ props:{
NavData:{ NavData:{
type:Array, type:Array,
default:()=>{ default:[]
},
[ activeNav:{
{ type:[Number,String],
MenuName:"总部", default:0
MenuIcon:"", }
MenuUrl:"", },
SubList:[ watch:{
{MenuName:"樱花教室",MenuUrl:"/",MenuIcon:""}, activeNav(val){
{MenuName:"菊花教室",MenuUrl:"/",MenuIcon:""} if(val!=this.currentNav){
] this.currentNav=val
} console.log(45,this.currentNav)
] }
}
} }
}, },
watch: {
$route: {
handler: function (route) {
this.currentPath = route.path
},
immediate: true
},
},
data() { data() {
return { return {
currentPath: "", currentNav: 1,
secondNavs:[ schoolId:0,
{
MenuName:"总部",
MenuIcon:"",
SubList:[
{MenuName:"樱花教室",MenuUrl:"",MenuIcon:""},
{MenuName:"菊花教室",MenuUrl:"",MenuIcon:""}
]
}
]
}; };
}, },
mounted(){ mounted(){
}, },
methods:{ methods:{
showNav(val,id){
this.schoolId=id
},
chooseNav(i){
this.currentNav=i.RoomId
this.$emit("success",{...i,...{schoolId:this.schoolId}})
}
} }
}; };
......
...@@ -225,14 +225,15 @@ ...@@ -225,14 +225,15 @@
.comSummary .mainSummary { .comSummary .mainSummary {
width: 100%; width: 100%;
/* min-height: 500px; */ /* min-height: 500px; */
margin-top:30px; margin:10px;
overflow: auto; overflow: auto;
} }
.comSummary .summaryTable { .comSummary .summaryTable {
width:100%; width:100%;
min-width: 1400px; min-width: 1400px;
border-radius:4px; border-radius:4px;
background-color:#E6E6E6; /* background-color:#E6E6E6; */
background-color: #F1F6FB;
/* table-layout:fixed;word-break:break-all; */ /* table-layout:fixed;word-break:break-all; */
} }
...@@ -360,7 +361,7 @@ ...@@ -360,7 +361,7 @@
cursor: pointer; cursor: pointer;
} }
.summaryTable th:first-child{ .summaryTable th:first-child{
/* width:180px; */ width:50px;
cursor: default; cursor: default;
} }
.dayListTable td { .dayListTable td {
......
...@@ -196,18 +196,36 @@ var lunarCalendar = { ...@@ -196,18 +196,36 @@ var lunarCalendar = {
* @param m solar month * @param m solar month
* @return Array * @return Array
*/ */
initLunar: function (yearStr, monthStr, dayNum) { initLunar: function (yearStr, monthStr, dayNum, dateStr) {
//年份限定、上限 //年份限定、上限
if (yearStr < 1900 || yearStr > 2100) { if (yearStr < 1900 || yearStr > 2100) {
return -1; return -1;
} }
var objDate = new Date(); var objDate = new Date();
var endDate = 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); endDate.setDate(endDate.getDate() + dayNum);
console.log(222, endDate.getTime(), endDate)
console.log(endDate.getTime() - objDate.getTime(), 'time');
//修正ymd参数 //修正ymd参数
var m = objDate.getMonth() + 1, d = objDate.getDate(); var m = objDate.getMonth() + 1, d = objDate.getDate();
var totalMonthDay = lunarCalendar.solarDays(yearStr, m); var totalMonthDay = lunarCalendar.solarDays(yearStr, m);
var array = []; var array = [];
while ((endDate.getTime() - objDate.getTime()) > 0) { while ((endDate.getTime() - objDate.getTime()) > 0) {
//星期几 //星期几
var nWeek = objDate.getDay(), cWeek = lunarCalendar.weekStr[nWeek]; var nWeek = objDate.getDay(), cWeek = lunarCalendar.weekStr[nWeek];
......
<template> <template>
<div class="page-body con"> <div class="page-body con">
<div class="left"> <div class="left">
<div class="dateModel col-5 q-mb-sm cursor-pointer shadow-1">
<ClassroomNav/> <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>
<div class="right"> <div class="right">
<!-- <el-timeline :reverse="reverse"> <Calendar :tbodayData="tbodayData" :startT="dateModel" @change="CalendarChange"></Calendar>
<el-timeline-item
v-for="(activity, index) in activities"
:key="index"
:timestamp="activity.timestamp">
</el-timeline-item>
</el-timeline> -->
<Calendar></Calendar>
</div> </div>
</div> </div>
</template> </template>
...@@ -22,60 +25,131 @@ ...@@ -22,60 +25,131 @@
import ClassroomNav from "./components/classroomNav"; import ClassroomNav from "./components/classroomNav";
import Calendar from './components/scenicSummary.vue' import Calendar from './components/scenicSummary.vue'
import { import {
getSchoolAndRoomNav getSchoolAndRoomNav,
getClassRoomTimeList
} from '../../api/classroom/index'; } from '../../api/classroom/index';
export default { export default {
meta: { meta: {
title: "使用记录" title: "教室状态"
}, },
components:{ components:{
ClassroomNav, ClassroomNav,
Calendar, Calendar,
}, },
data() { data() {
return { return {
dateModel:"",
loading: true, loading: true,
msg: { schoolId:0,
pageIndex: 1,
pageSize: 12,
},
navData:[], navData:[],
reverse: true,
activities: [{
msg:{
timestamp: '09:30' RoomId:0,
}, { SchoolId:0,
StartTime:"2020-07-08",
timestamp: '09:45' EndTime:""
}, { },
tbodayData:[]
timestamp: '10:00'
}]
}; };
}, },
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(){ mounted(){
this.getNavList();
this.getNavList();
// this.getClassRoomTimeList();
}, },
methods:{ methods:{
// goUrl(){ // 获取校区教室导航列表
// this.$router.push({ getNavList() {
// path:"/classroom/useRecord", let that=this
// query:{
// }
// })
// },
getNavList() {
getSchoolAndRoomNav({}).then(res => { getSchoolAndRoomNav({}).then(res => {
this.loading = false
if(res.Code===1){ if(res.Code===1){
this.navData=res.Data 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(() => { }).catch(() => {
this.loading = false; 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 @@ ...@@ -85,8 +159,16 @@
padding: 5px !important; padding: 5px !important;
display: flex; display: flex;
.left{ .left{
width: 200px;
background-color: rgb(245, 246, 247); 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> </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