296 lines
6.8 KiB
Vue
Executable File
296 lines
6.8 KiB
Vue
Executable File
<template>
|
||
<view class="content">
|
||
<view style="height: 10rpx;"></view>
|
||
<text class="detail-row-content-class" v-if="taskList.length==0">您当前没有任务</text>
|
||
<view class="detail-table-class" v-for="(item,index) in taskList" @tap="itemClick(item)" :key="index">
|
||
<view class="detail-row0-class">
|
||
<text class="detail-row-title0-class">任务代码:{{item.FNumber}}</text>
|
||
<text class="detail-row-content-red-class" v-if="item.FDataStatus==0">新任务</text>
|
||
<text class="detail-row-content-green-class" v-if="item.FDataStatus==1">已完成</text>
|
||
<text class="detail-row-content-yellow-class" v-if="item.FDataStatus==2">进行中</text>
|
||
<view class="detail-row-content-status" :class="[item.FDataStatus==2?'detail-row-content-status-yellow':item.FDataStatus==1?'detail-row-content-status-green':'detail-row-content-status-red']"
|
||
></view>
|
||
</view>
|
||
<view class="detail-line-class">
|
||
</view>
|
||
<view class="detail-row-class">
|
||
<text class="detail-row-title-class">巡检任务:</text>
|
||
<text class="detail-row-content-class">{{item.FName}}</text>
|
||
</view>
|
||
<view class="detail-row-class">
|
||
<text class="detail-row-title-class">开始时间:</text>
|
||
<text class="detail-row-content-class">{{item.FPlanDate}}</text>
|
||
</view>
|
||
<view class="detail-row-class">
|
||
<text class="detail-row-title-class">检查时间:</text>
|
||
<text class="detail-row-content-class">{{item.FRealDate}}</text>
|
||
</view>
|
||
<view class="detail-row-class">
|
||
<text class="detail-row-title-class">检查人:</text>
|
||
<text class="detail-row-content-class">{{item.FExectorName}}</text>
|
||
</view>
|
||
</view>
|
||
<view style="height: 10rpx;"></view>
|
||
</view>
|
||
</template>
|
||
<script>
|
||
import Vue from 'vue';
|
||
import {
|
||
mapState,
|
||
mapMutations
|
||
} from 'vuex';
|
||
|
||
var commonUtil = require('../../../common/util.js');
|
||
var _self;
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
scrollTop: 0,
|
||
old: {
|
||
scrollTop: 0
|
||
},
|
||
taskList:[],
|
||
pageIndex:1,
|
||
pageSize:6,
|
||
showTips:false,
|
||
}
|
||
},
|
||
|
||
onLoad() {
|
||
this.getTaskList(1, this.pageSize);
|
||
this.pageIndex = 1;
|
||
|
||
_self = this;
|
||
},
|
||
|
||
onPullDownRefresh:function(){
|
||
_self.showTips = false;
|
||
this.taskList = new Array();
|
||
this.getTaskList(1, this.pageSize);
|
||
setTimeout(()=>{
|
||
//停止下拉样式
|
||
uni.stopPullDownRefresh();
|
||
//隐藏标题读取
|
||
uni.hideNavigationBarLoading();
|
||
},
|
||
500);
|
||
},
|
||
|
||
onReachBottom:function(){
|
||
if(!_self.showTips) {
|
||
this.getTaskList(this.pageIndex, this.pageSize);
|
||
}
|
||
else {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '已经到底了'
|
||
});
|
||
}
|
||
},
|
||
|
||
computed: {
|
||
...mapState(['userInfo'])
|
||
},
|
||
|
||
methods: {
|
||
|
||
itemClick: function(item){
|
||
let itemString = JSON.stringify(item);
|
||
uni.navigateTo({
|
||
url: '../../views/MESQS42Item/MESQS42Item?item='+itemString,
|
||
});
|
||
},
|
||
|
||
getTaskList: function(index, size) {
|
||
let userID = this.userInfo.token;
|
||
this.pageIndex = index;
|
||
let requestParams = {
|
||
"id": userID,
|
||
"pageIndex": this.pageIndex,
|
||
"pageSize": size
|
||
};
|
||
|
||
uni.showLoading({
|
||
icon:'loading',
|
||
title:'加载中……',
|
||
mask:true
|
||
});
|
||
|
||
this.$request.post(
|
||
{
|
||
data: {
|
||
action: 'GetInspectPlanList',
|
||
params: requestParams
|
||
}
|
||
}
|
||
).then(res => {
|
||
uni.hideLoading();
|
||
let data = JSON.parse(res);
|
||
data.forEach(
|
||
function(el){
|
||
let planData = commonUtil.removeLetter(el.FPlanDate);
|
||
el.FPlanDate = planData.substr(0,10) + " " + planData.substr(10 ,15);
|
||
if(el.FRealDate) {
|
||
let realDate = commonUtil.removeLetter(el.FRealDate);
|
||
el.FRealDate = realDate.substr(0,10) + " " + realDate.substr(10 ,15);
|
||
}
|
||
}
|
||
);
|
||
console.log("this.pageIndex---------"+this.pageIndex);
|
||
if(this.pageIndex == 1) {
|
||
this.taskList = data;
|
||
this.pageIndex = this.pageIndex+1;
|
||
}
|
||
else {
|
||
if(data.length != 0) {
|
||
let newArray = this.taskList.concat(data);
|
||
this.taskList = newArray;
|
||
this.pageIndex = this.pageIndex+1;
|
||
if(data.length < 6) {
|
||
_self.showTips = true;
|
||
}
|
||
} else {
|
||
_self.showTips = true;
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.content {
|
||
height: 100%;
|
||
background-color: #F5F5F5;
|
||
display: flex;
|
||
flex-direction:column;
|
||
flex-wrap: nowrap;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
.detail-table-class{
|
||
margin-top: 10rpx;
|
||
margin-left: 32rpx;
|
||
margin-right: 32rpx;
|
||
margin-bottom: 34rpx;
|
||
background-color: #FFFFFF;
|
||
border-radius:10rpx;
|
||
padding-left: 24rpx;
|
||
padding-right: 24rpx;
|
||
padding-bottom: 16rpx;
|
||
display: flex;
|
||
flex-direction:column;
|
||
flex-wrap: nowrap;
|
||
justify-content: flex-start;
|
||
|
||
flex-shrink: 0;
|
||
flex-grow: 0;
|
||
position: relative;
|
||
}
|
||
|
||
.detail-row0-class{
|
||
height: 64rpx;
|
||
line-height: 64rpx;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
}
|
||
|
||
.detail-row-title0-class{
|
||
width: auto;
|
||
flex-shrink: 1;
|
||
flex-grow: 1;
|
||
height: 34rpx;
|
||
font-size: 26rpx;
|
||
font-family: MicrosoftYaHei;
|
||
color: #3D3D3D;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.detail-line-class{
|
||
background-color: #F8F8F8;
|
||
height: 1px;
|
||
}
|
||
|
||
.detail-row-class{
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
font-size: 24rpx;
|
||
font-family: MicrosoftYaHei;
|
||
color: #505050;
|
||
height: 48rpx;
|
||
}
|
||
|
||
.detail-row-title-class{
|
||
color: #8F8F8F;
|
||
width: 120rpx;
|
||
text-align: end;
|
||
flex-shrink: 0;
|
||
flex-grow: 0;
|
||
}
|
||
|
||
.detail-row-content-class{
|
||
color: #505050;
|
||
flex-shrink: 1;
|
||
flex-grow: 1;
|
||
}
|
||
|
||
.detail-row-content-green-class{
|
||
flex-shrink: 0;
|
||
flex-grow: 0;
|
||
width: 78rpx;
|
||
height: 34rpx;
|
||
font-size: 26rpx;
|
||
font-family: MicrosoftYaHei;
|
||
color: #5EC02D;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.detail-row-content-yellow-class{
|
||
flex-shrink: 0;
|
||
flex-grow: 0;
|
||
width: 78rpx;
|
||
height: 34rpx;
|
||
font-size: 26rpx;
|
||
font-family: MicrosoftYaHei;
|
||
color: #FAAE12;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.detail-row-content-red-class{
|
||
flex-shrink: 0;
|
||
flex-grow: 0;
|
||
width: 78rpx;
|
||
height: 34rpx;
|
||
font-size: 26rpx;
|
||
font-family: MicrosoftYaHei;
|
||
color: #FF2E2E;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.detail-row-content-status{
|
||
width: 4rpx;
|
||
height: 30rpx;
|
||
background: #FF2E2E;
|
||
border-radius: 3rpx;
|
||
position: absolute;
|
||
right: 0;
|
||
}
|
||
|
||
.detail-row-content-status-red{
|
||
background: #FF2E2E;
|
||
}
|
||
|
||
.detail-row-content-status-yellow{
|
||
background: #FAAE12;
|
||
}
|
||
|
||
.detail-row-content-status-green{
|
||
background: #5EC02D;
|
||
}
|
||
</style> |