校历大号视图

init
gongdi 4 years ago
parent bcfdc21612
commit 4cb007ba55

@ -1,17 +1,327 @@
<template>
<div>
<div class="school-calendar-large-search-div">
<div class="search-div">
<span style="margin-right: 1rem">学期</span>
<a-select :value="calendarId" style="width: 200px" @change="termChange">
<a-select-option v-for="item in termList" :key="item.calendar_id">
{{item.cycle_name}}
</a-select-option>
</a-select>
</div>
<div class="school-calendar-content-div">
<div class="month-div" v-for="item in showTermMonths">
<div class="month-top-div">
<div class="top-line-div"></div>
<div class="top-content-div">
<template v-for="calendar,index in item.calendar">
<div v-if="index < 2" :class="'calendar-div ' + (index == 0?'more-left-div':'')">
<div class="calendar-item-div">
<div :title="calendar.detail_time">{{calendar.detail_time}}</div>
<div :title="calendar.detail_content">{{calendar.detail_content}}</div>
</div>
</div>
</template>
</div>
</div>
<div class="month-line-div">
<div class="line-div"></div>
<div class="month-title-div">{{item.month}}</div>
</div>
<div class="month-bottom-div">
<div class="bottom-line-div"></div>
<div class="bottom-content-div">
<template v-for="calendar,index in item.calendar">
<div v-if="index >= 2 && index < 4" :class="'calendar-div ' + (index == 3?'more-left-div':'')">
<div class="calendar-item-div">
<div :title="calendar.detail_time">{{calendar.detail_time}}</div>
<div :title="calendar.detail_content">{{calendar.detail_content}}</div>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import InterConfig from './interConfig';
import {Select, Spin, Empty} from 'ant-design-vue';
import _ from "lodash";
const lastSemesterMonths = [{month: 9, calendar: []}, {month: 10, calendar: []}, {
month: 11,
calendar: []
}, {month: 12, calendar: []}, {month: 1, calendar: []}];//
const nextSemesterMonths = [{month: 3, calendar: []}, {month: 4, calendar: []}, {
month: 5,
calendar: []
}, {month: 6, calendar: []}, {month: 7, calendar: []}];//
export default{
data(){
return {}
return {
listScroll: this.StaticParams.scrollOption,
isLoading: true,
calendarId: "",//ID
cycleName: "",
term: "",//1 2
termList: [],//
dataList: [],//
pageNumber: 1,
pageSize: 1000000,
totalPage: 0,
totalRow: 0,
showTermMonths: [],//
}
},
mounted(){
this.getWeekCalendarList();
},
methods: {
//
getWeekCalendarList: function () {
let params = {
org_id: this.BaseConfig.person_info_my.bureau_id,
calendar_type: 1,
calendar_id: this.calendarId,
page_number: this.pageNumber,
page_size: this.pageSize
}
this.isLoading = true;
this.InterfaceConfig.callInterface([{
url: InterConfig.viewSchoolCalendar.url,
params: params,
method: InterConfig.viewSchoolCalendar.method,
isTestLogin: InterConfig.viewSchoolCalendar.isTestLogin,
}], (result) => {
this.isLoading = false;
if (result[0].data.code === 2000) {
let resObj = result[0].data.data;
this.calendarId = resObj.now_calendar_id ? parseInt(resObj.now_calendar_id) : "";
this.termList = resObj.calendar_list;
this.cycleName = this.getCycleNameByCalendarId();
this.getShowTermMonths();
this.dataList = resObj.list;
this.buildMonthDataList();
this.totalPage = resObj.total_page;
this.totalRow = resObj.total_row;
}
})
},
getCycleNameByCalendarId: function () {
let cycleName = "";
for (let i = 0, len = this.termList.length; i < len; i++) {
let week = this.termList[i];
if (week.calendar_id == this.calendarId) {
cycleName = week.cycle_name;
break;
}
}
return cycleName;
},
getShowTermMonths: function () {
let cycleName = "";
for (let i = 0, len = this.termList.length; i < len; i++) {
let week = this.termList[i];
if (week.calendar_id == this.calendarId) {
cycleName = week.cycle_name;
break;
}
}
let text = cycleName[cycleName.length - 3];
if (text == "上") {
this.term = 1;
this.showTermMonths = _.cloneDeep(lastSemesterMonths);
} else if (text == "下") {
this.term = 2;
this.showTermMonths = _.cloneDeep(nextSemesterMonths);
}
},
termChange: function (value) {
if (this.calendarId != value) {
this.calendarId = value;
this.dataList = [];
this.showTermMonths = [];
this.isLoading = true;
this.pageNumber = 1;
this.getWeekCalendarList();
}
},
buildMonthDataList: function () {
//
let lastYear = this.cycleName.split("~")[0];
let nextYear = this.cycleName.split("~")[1].substring(0, 4);
//
let term = this.term;
for (let i = 0, len = this.showTermMonths.length; i < len; i++) {
let month = this.showTermMonths[i].month;
month = (month + "").length > 1 ? month : "0" + month;
let compareDate = "";
this.dataList.forEach(item => {
if (term == 1) {
if (i < len - 1) {
compareDate = lastYear + "-" + month;
} else {
compareDate = nextYear + "-" + month;
}
} else if (term == 2) {
compareDate = nextYear + "-" + month;
}
let detailTime = item.detail_time;
let detailLastTime = detailTime.split("~")[0].substring(0, detailTime.split("~")[0].lastIndexOf("-"));
if (detailLastTime === compareDate) {
this.showTermMonths[i].calendar.push(item);
}
})
}
}
},
components: {
ASelect: Select,
ASelectOption: Select.Option,
ASpin: Spin,
//AEmpty: Empty
}
}
</script>
<style></style>
<style scoped lang="scss">
.school-calendar-large-search-div {
width: 100%;
min-height: 20rem;
padding: 0.5rem;
display: flex;
flex-direction: column;
.search-div {
width: 100%;
min-height: 3rem;
display: flex;
justify-content: center;
align-items: center;
}
.school-calendar-content-div {
width: 100%;
min-height: 20rem;
display: flex;
overflow: auto;
/* scrollbar-width: none; !* Firefox *!
-ms-overflow-style: none; !* IE 10+ *!*/
.month-div {
width: 25%;
height: 21rem;
.month-top-div {
width: 100%;
height: 10rem;
position: relative;
.top-line-div {
width: 10px;
height: 100%;
position: absolute;
left: 30px;
top: 8px;
border-left: 1px solid #31a8fa;
transform: rotate(20deg);
}
.top-content-div {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 30px;
overflow: hidden;
.calendar-div {
width: 90%;
height: 4rem;
margin-left: 0.5rem;
margin-right: 0.5rem;
.calendar-item-div {
border: 1px solid #f4b159;
border-right: 0;
background-color: #f8ebe9;
margin-top: 0.5rem;
div{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.more-left-div{
margin-left: 1rem;
margin-right: 1rem;
}
}
}
.month-line-div {
width: 100%;
height: 1rem;
display: flex;
justify-content: center;
align-items: center;
position: relative;
.line-div {
width: 100%;
border-bottom: 1px solid #31a8fa;
}
.month-title-div {
width: 2rem;
height: 1rem;
position: absolute;
left: 0;
border-radius: 1rem;
background-color: #31a8fa;
color: white;
font-size: 12px;
display: flex;
justify-content: center;
align-items: center;
}
}
.month-bottom-div {
width: 100%;
height: 10rem;
position: relative;
.bottom-line-div {
width: 10px;
height: 100%;
position: absolute;
left: 30px;
top: -8px;
border-left: 1px solid #31a8fa;
transform: rotate(-20deg);
}
.bottom-content-div {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 30px;
overflow: hidden;
.calendar-div {
width: 90%;
height: 4rem;
margin-left: 0.5rem;
margin-right: 0.5rem;
.calendar-item-div {
border: 1px solid #f4b159;
border-right: 0;
background-color: #f8ebe9;
margin-top: 0.5rem;
div{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.more-left-div{
margin-left: 1rem;
margin-right: 1rem;
}
}
}
}
}
/* ::-webkit-scrollbar {
display: none; !* Chrome Safari *!
}*/
}
</style>
Loading…
Cancel
Save