140 lines
2.8 KiB
Vue
Raw Normal View History

<template>
<view class="fullHeight">
<headers :showBack="true" class="">
<view class="headerName">
定时任务
</view>
</headers>
<view class="listBox">
<view class="listItem" v-for="item in list" :key="item.id" @click="goAdd(item.id)">
<view class="title">
执行时间{{item.executeTime}}
</view>
<view class="bottom">
重复{{formatRepeat(item)}}
</view>
<view class="bottom">
开关{{item.switchType===1?'关':item.switchType===2?'开':''}}
</view>
<!-- <view class="bottom">
<text class="time">{{item.createTime}}</text>
</view> -->
<image src="/static/icon-right.png" class="icon-right"></image>
</view>
<view class="placeholderBox" v-show="list.length==0">
<image src="/static/noData.png" class="noDataImg"></image>
<view class="text">
暂无数据
</view>
</view>
</view>
<image src="/static/addImg.png" class="addImg" @click="goAdd('')"></image>
</view>
</template>
<script>
import headers from "@/components/headers/headers.vue"
export default {
components:{headers},
data() {
return {
list:[],
sprayDevId:'',
weekArr:['周一','周二','周三','周四','周五','周六','周日'],
};
},
onLoad(options) {
this.sprayDevId=options.id
},
onShow() {
this.loadData()
},
onPullDownRefresh() {
this.list=[]
this.loadData()
},
methods:{
formatRepeat(row){
// console.log('formatRepeat',row)
if(row.isRepeat=='1'){
return '只执行一次'
}else{
var a = row.repeatExecuteWeek;
var arr=[]
if(a.indexOf(',')!=-1){
arr=a.split(',')
}else{
arr=[a]
}
if(arr.length==7){
return '每天'
}else{
let arr2=[]
arr.forEach(element => {
arr2.push(this.weekArr[parseInt(element)-1])
});
return arr2.join('、')
}
}
},
loadData(){
var that = this
this.sendRequest({
url: 'xmgl/sprayDevTimingTask/selectList',
data: {sprayDevId:this.sprayDevId},
method: "POST",
success(res){
that.list=res.result
}
})
},
goAdd(id){
uni.navigateTo({
url:'./add?id='+id+'&sprayDevId='+this.sprayDevId
})
}
}
}
</script>
<style lang="scss" scoped>
.addImg{
position: fixed;
bottom: 30rpx;
right: 30rpx;
width: 64rpx;
height: 64rpx;
}
.listBox{
margin: 30rpx;
}
.listItem{
box-shadow: 0px 4px 26rpx 0px rgba(212, 220, 236, 0.53);
position: relative;
margin-bottom: 10rpx;
padding: 30rpx;
border-radius: 16rpx;
.title{
font-size: 30rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.bottom{
color: rgba(55, 45, 102, 0.5);
font-size: 24rpx;
}
.time{
margin-right: 24rpx;
}
}
.icon-right{
position: absolute;
width: 16rpx;
height: 28rpx;
right: 30rpx;
top: calc(50% - 7px);
}
</style>