增加设备保养

This commit is contained in:
2024-05-07 19:37:20 +08:00
parent 162ef0ef26
commit ef313b9399
18 changed files with 1116 additions and 257 deletions

View File

@ -8,9 +8,10 @@
<view class="center-cut-menu">
<scroll-view scroll-x="true" show-scrollbar="false" scroll-with-animation="true" :scroll-left="scrollLeft" class="scroll-view horizontalScrollView" :class="{'monthScroll':params.date!=='day'}" >
<view class="scroll-item" :style="'width:'+itemWidth+'px'" v-for="(item, index) in titleList" :key="index" @click="changeMenu(index)">
<view class="viewItem" :class="{'active':curIndex == index,'monthViewItem':params.date !=='day'}">
<view class="viewItem" :class="{'active':curIndex == index,'monthViewItem':params.date !=='day','todoayView':item.todoay}">
<text class="item-text">{{item.name}}</text>
<text class="item-date" v-if="params.date == 'day'">{{item.text}}</text>
<text class="todoay" v-if="item.todoay"></text>
</view>
</view>
</scroll-view>
@ -25,8 +26,11 @@
<view :style="'height:'+swiperHeight+'px'" v-if="curIndex == index">
<view class="swiper-item padd_top12 font14">
<view class="device_row" v-for="(em,inde) in item.data" :key="inde">
<text class="name font_bold">{{em.text}}</text>
<text class="text">{{em.name}}</text>
<view class="rowView" :class="{'active':inde==0,'todoayView':em.todoay}">
<text class="name font_bold">{{em.text}}</text>
<text class="text">{{em.name}}</text>
<text v-if="em.todoay" class="todoay"></text>
</view>
</view>
</view>
</view>
@ -113,9 +117,16 @@
setTitle(){
if(this.params.date == 'day'){
let list = this.$wf.getDatesOfWeek();
let todoay = this.$wf.getToday();
list.forEach(item=>{
if(item.date == todoay){
item.todoay = true;
}
item.text = item.date.split('-')[2];
})
if(this.curIndex >= list.length){
this.curIndex = list.length - 1;
}
this.titleList = list;
}
if(this.params.date == 'week'){
@ -124,8 +135,12 @@
arr.forEach((item,index)=>{
let date = item.find(em=> em!==null && em!==undefined);
let todoay = this.$wf.getToday();
item.forEach(em=>{
if(em){
if(em.date == todoay){
em.todoay = true;
}
em.text = em.date.split('-')[2];
em.name = '星期'+em.name;
}
@ -136,11 +151,32 @@
data:item.filter(em=> em!==null),
})
})
console.log(list,233)
if(this.curIndex >= list.length){
this.curIndex = list.length - 1;
}
this.titleList = list;
}
if(this.params.date == 'month'){
let list = [];
let arr = this.$wf.getCurrentYearData();
arr.forEach((item,index)=>{
let weeks = [];
item.weeks.forEach((em,ind)=>{
let dateList = em.filter(em=> em!==null);
weeks.push({
data:dateList,
text:dateList[0].date.split('-')[2],
name:'第'+Number(ind+1)+'周',
date:dateList[0].date,
})
})
list.push({
name:this.$wf.numberToChineseLower(Number(item.month))+'月',
date:weeks[0].date,
data:weeks,
})
})
this.titleList = list;
}
this.getScrollW();
@ -198,6 +234,30 @@
})
this.titleList = list;
}
if(this.params.date == 'month'){
// 获取本年的选中周日期
let date = this.titleList[this.curIndex];
let list = [];
let arr = this.$wf.getPreviousYearData(String(date.date));
arr.forEach((item,index)=>{
let weeks = [];
item.weeks.forEach((em,ind)=>{
let dateList = em.filter(em=> em!==null);
weeks.push({
data:dateList,
text:dateList[0].date.split('-')[2],
name:'第'+Number(ind+1)+'周',
date:dateList[0].date,
})
})
list.push({
name:this.$wf.numberToChineseLower(Number(item.month))+'月',
date:weeks[0].date,
data:weeks,
})
})
this.titleList = list;
}
this.getScrollW();
this.changeDate();
@ -241,6 +301,30 @@
})
this.titleList = list;
}
// 获取下一年的日期
if(this.params.date == 'month'){
let date = this.titleList[this.curIndex];
let list = [];
let arr = this.$wf.getNextYearData(String(date.date));
arr.forEach((item,index)=>{
let weeks = [];
item.weeks.forEach((em,ind)=>{
let dateList = em.filter(em=> em!==null);
weeks.push({
data:dateList,
text:dateList[0].date.split('-')[2],
name:'第'+Number(ind+1)+'周',
date:dateList[0].date,
})
})
list.push({
name:this.$wf.numberToChineseLower(Number(item.month))+'月',
date:weeks[0].date,
data:weeks,
})
})
this.titleList = list;
}
this.getScrollW();
this.changeDate();
@ -281,6 +365,7 @@
.scroll-view {height: 50px;white-space: nowrap;
.scroll-item {height: 100%;padding: 0 5px;display: inline-block;text-align: center;box-sizing: border-box;
.viewItem{
position: relative;
font-size: 14px;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;
border: 1px solid $uni-color-primary;box-sizing: border-box;border-radius: 8px;
}
@ -291,16 +376,25 @@
.active {
background: $uni-color-primary;
}
.todoay{
display: flex;align-items: center;justify-content: center;background: $uni-bg-color-success;
position: absolute;top: 2px;right: 2px;z-index: 20;
border-radius: 2px;width: 12px;height: 12px;font-size: 8px;
}
}
}
.monthScroll{height: 28px;}
.monthScroll{height: 27px;}
}
.content-right{flex-basis: 30px;text-align: center;}
}
.swiper-box-list{height: 240px;padding:0 12px;
.swiper-item{display: flex;flex-direction: row;flex-wrap: wrap;}
.device_row{display: flex;flex-direction: column;width: 33%;justify-content: center;align-items: center;margin-bottom: 12px;padding: 12px 0;height: 70px;box-sizing: border-box;
.device_row{display: flex;flex-direction: column;width: 33%;justify-content: center;align-items: center;margin-bottom: 12px;height: 70px;box-sizing: border-box;padding: 0 8px;position: relative;
.name{margin-bottom: 6px;}
.rowView{display: flex;flex-direction: column;justify-content: center;align-items: center;height: 100%;width: 100%;padding: 12px 0;box-sizing: border-box;position: relative;}
.todoayView{padding: 0 8px; background: $uni-bg-color-default-dark; box-sizing: border-box;border-radius: 8px;}
.active{background: $uni-bg-color-info;border-radius: 8px;}
.todoay{position: absolute;top: -5px;right: -5px;z-index: 20;display: flex;align-items: center;justify-content: center;background: $uni-bg-color-success;width: 16px;height: 16px;border-radius: 3px;font-size: 10px;}
}
}
</style>