Browse Source

点检中心

lilei 4 years ago
parent
commit
dec4190da8
2 changed files with 232 additions and 255 deletions
  1. 28 7
      pages/spotCheckCenter/spotCheckResult.vue
  2. 204 248
      pages/spotCheckCenter/spotChecking.vue

+ 28 - 7
pages/spotCheckCenter/spotCheckResult.vue

@@ -1,29 +1,35 @@
 <template>
 	<view class="result-pages">
-		<view class="results">
+		<view class="results" v-if="pageData">
 			<view class="results-head">
-				<view>夏季活夏季活动布置动布置-长青长青二路店二路店-2020-05-26</view>
+				<view>{{pageData.name}}-{{pageData.storeName}}-{{pageData.createDate}}</view>
 				<view>任务的点检结果</view>
 				<view>
-					<view class="r-totals">113</view>
+					<view class="r-totals">{{pageData.totalTargetCount}}</view>
 					<view>点检总数</view>
 				</view>
 			</view>
 			<view class="results-items">
 				<view>
-					<view class="hg">6</view>
+					<view class="hg">{{pageData.passTargetCount}}</view>
 					<view>合格项数</view>
 				</view>
 				<view>
-					<view class="bhg">2</view>
+					<view class="bhg">{{pageData.notPassTargetCount}}</view>
 					<view>不合格项数</view>
 				</view>
 				<view>
-					<view class="bsy">5</view>
+					<view class="bsy">{{pageData.notWorkTargetCount}}</view>
 					<view>不适用项数</view>
 				</view>
 			</view>
 		</view>
+		<view v-else>
+			<view class="loadingStyle">
+				<u-loading mode="circle"></u-loading>
+				<view>正在加载...</view>
+			</view>
+		</view>
 		<view class="result-back">
 			<u-button type="primary" @click="goBack">返回任务列表</u-button>
 		</view>
@@ -31,15 +37,26 @@
 </template>
 
 <script>
+	import { getTaskDetail } from '@/api/task';
 	export default {
 		data() {
 			return {
-				pageData: null
+				pageData: null,
+				id: ''
 			}
 		},
+		onLoad(options) {
+			this.id = options.id
+			this.getDetail()
+		},
 		methods: {
 			goBack(){
 				uni.navigateBack()
+			},
+			getDetail(){
+				getTaskDetail({id:this.id}).then(res => {
+					this.pageData = res.data || null
+				})
 			}
 		}
 	}
@@ -47,6 +64,10 @@
 
 <style lang="scss">
 	.result-pages{
+		.loadingStyle{
+			text-align: center;
+			padding: 10vh 0 10vh 0;
+		}
 		.results{
 			padding: 20upx;
 			background: #fff;

+ 204 - 248
pages/spotCheckCenter/spotChecking.vue

@@ -1,276 +1,232 @@
 <template>
 	<view class="pagesCons">
 		<view class="tab-body">
-			    <view>
-					<u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
-					 swiperWidth="750"></u-tabs-swiper>
-				</view>
-				<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
-					<swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, index) in tabList" :key="index">
-						<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
-							<view  
-							class="check-order-list" 
-							v-for="(item,index) in list" 
-							:key="item.id"
-							>
-								 <view class="check-row" @click="viewRow(item)">
-									 <view class="createDate">{{item.createDate}}</view>
-									 <view>待处理</view>
-								 </view>
-								 <view class="check-row" @click="viewRow(item)">
-									 <view>
-										 <view style="font-size: 30upx;margin-bottom: 10upx;">夏季活动布置</view>
-										 <view style="color: #666666;">长青二路店</view>
-									</view>
-									 <view>
-										 <text style="color: #007AFF;">开始点检</text>
-									 	 <u-icon name="icon-xian-11" custom-prefix="xd-icon" size="28" color="#888888"></u-icon>
-									 </view>
-								 </view>
-							 </view>
-							 <u-empty :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
-							 <view style="padding: 20upx;">
-								 <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
-							 </view>
-						</scroll-view>
-					</swiper-item>
-				</swiper>
+			<view><u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper></view>
+			<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
+				<swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, index) in tabList" :key="index">
+					<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
+						<view class="check-order-list" v-for="(item, index) in list" :key="item.id">
+							<view class="check-row" @click="viewRow(item)">
+								<view class="createDate">{{ item.createDate }}</view>
+								<view>{{ item.status }}</view>
+							</view>
+							<view class="check-row" @click="viewRow(item)">
+								<view>
+									<view style="font-size: 30upx;margin-bottom: 10upx;">{{ item.name }}</view>
+									<view style="color: #666666;">{{ item.storeName }}</view>
+								</view>
+								<view>
+									<text style="color: #007AFF;">开始点检</text>
+									<u-icon name="icon-xian-11" custom-prefix="xd-icon" size="28" color="#888888"></u-icon>
+								</view>
+							</view>
+						</view>
+						<u-empty :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty>
+						<view style="padding: 20upx;"><u-loadmore v-if="total > pageSize || status == 'loading'" :status="status" /></view>
+					</scroll-view>
+				</swiper-item>
+			</swiper>
 		</view>
 	</view>
 </template>
 
 <script>
-	import {getCheckResult, deleteCheckResult} from '@/api/task.js'
-	import { getLookUpDatas, listLookUp } from '@/api/data'
-	import { orderQueryLike, deleteOrder, finishOrder, smAddSerPerson } from '@/api/task'
-	import { clzConfirm } from '@/libs/tools.js'
-	export default {
-		components: {
-		},
-		data() {
-			return {
-				showSearch: false,
-				status: 'loadmore',
-				canEdit: false, 
-				canFinish: false, 
-				canDel: false, 
-				canView: false, 
-				canPay: false, 
-				noDataText: '暂无数据',
-				background: {
-					// 渐变色
-					backgroundImage: 'linear-gradient(45deg, rgb(85, 170, 255), rgb(21, 102, 223))'
+import { getTaskList } from '@/api/task.js';
+import { getLookUpDatas, listLookUp } from '@/api/data';
+import { clzConfirm } from '@/libs/tools.js';
+export default {
+	data() {
+		return {
+			status: 'loadmore',
+			noDataText: '暂无数据',
+			tabList: [
+				{
+					dispName: '待处理',
+					typeId: 4
+				},
+				{
+					dispName: '已完成',
+					typeId: 3
+				},
+				{
+					dispName: '已过期',
+					typeId: 2
 				},
-				tabList: [
-					   {
-						  dispName: '待处理',
-						  typeId: 4
-					   },
-					  {
-					    dispName: '已完成',
-					  	typeId: 3
-					  },
-					  {
-					    dispName: '已过期',
-					  	typeId: 2
-					  },
-					  {
-					    dispName: '全部',
-					  	typeId: 1
-					  },
-				  ],
-				current: 0,
-				swiperCurrent: 0,
-				pageNo: 1,
-				pageSize: 10,
-				list: [],
-				total: 0,
+				{
+					dispName: '全部',
+					typeId: 1
+				}
+			],
+			current: 0,
+			swiperCurrent: 0,
+			pageNo: 1,
+			pageSize: 10,
+			list: [],
+			total: 0
+		};
+	},
+	onLoad() {
+		this.getRow();
+	},
+	methods: {
+		message(title) {
+			uni.showToast({
+				icon: 'none',
+				title: title
+			});
+		},
+		// tabs通知swiper切换
+		tabsChange(index) {
+			this.swiperCurrent = index;
+			this.list = [];
+			this.status = 'loading';
+		},
+		swiperChange(event) {
+			console.log(event.detail);
+			this.list = [];
+			this.status = 'loading';
+		},
+		// swiper-item左右移动,通知tabs的滑块跟随移动
+		transition(e) {
+			let dx = e.detail.dx;
+			this.$refs.uTabs.setDx(dx);
+		},
+		// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
+		// swiper滑动结束,分别设置tabs和swiper的状态
+		animationfinish(e) {
+			let current = e.detail.current;
+			if (current != this.current) {
+				this.$refs.uTabs.setFinishCurrent(current);
+				this.swiperCurrent = current;
+				this.current = current;
+				this.getRow();
 			}
 		},
-		onLoad() {
-			this.getRow()
+		// scroll-view到底部加载更多
+		onreachBottom() {
+			console.log(this.list.length, this.total);
+			if (this.list.length < this.total) {
+				this.pageNo += 1;
+				this.getRow();
+			} else {
+				this.status = 'nomore';
+			}
 		},
-		methods:{
-			message(title){
-				uni.showToast({
-					icon:'none',
-					title: title
-				})
-			},
-			// tabs通知swiper切换
-			tabsChange(index) {
-				this.swiperCurrent = index;
-				this.list = []
-				this.status = "loading"
-			},
-			swiperChange(event){
-				console.log(event.detail)
-				this.list = []
-				this.status = "loading"
-			},
-			// swiper-item左右移动,通知tabs的滑块跟随移动
-			transition(e) {
-				let dx = e.detail.dx;
-				this.$refs.uTabs.setDx(dx);
-			},
-			// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
-			// swiper滑动结束,分别设置tabs和swiper的状态
-			animationfinish(e) {
-				let current = e.detail.current;
-				if(current != this.current){
-					this.$refs.uTabs.setFinishCurrent(current);
-					this.swiperCurrent = current;
-					this.current = current;
-					this.getRow()
-				}
-			},
-			// scroll-view到底部加载更多
-			onreachBottom() {
-				console.log(this.list.length, this.total)
-				if(this.list.length < this.total){
-					this.pageNo += 1
-					this.getRow()
-				}else{
-					this.status = "nomore"
-				}
-			},
-			// 查询列表
-			getRow (pageNo) {
-			  let _this = this
-			  if (pageNo) {
-			    this.pageNo = pageNo
-			  }
-			  
-			  let params = {
-			    pageNo: this.pageNo,
-			    pageSize: this.pageSize,
-			    queryWord: this.queryWord,
-			    queryBeginDate: this.beginDate,
-			    queryEndDate: this.endDate,
-			    typeId: this.typeId,
-			    finishFlag: this.finishFlag,
-			    orderFlag: this.orderFlag,
-				orderFlags: this.orderFlags,
-			    orderSource: this.orderSource
-			  }
-			  this.status = "loading"
-			  orderQueryLike(params).then(res => {
+		// 查询列表
+		getRow(pageNo) {
+			let _this = this;
+			if (pageNo) {
+				this.pageNo = pageNo;
+			}
+			let params = {
+				pageNo: this.pageNo,
+				pageSize: this.pageSize,
+				type: '点检任务', // 任务类型
+				status: this.typeId == 1 ? '' : this.typeId // 任务状态
+			};
+			this.status = 'loading';
+			getTaskList(params).then(res => {
 				if (res.code == 200 || res.status == 204 || res.status == 200) {
-				  if(_this.pageNo>1){
-					  _this.list = _this.list.concat(res.data.list || [])
-				  }else{
-					  _this.list = res.data.list || []
-				  }
-				  _this.total = res.data.count || 0
+					if (_this.pageNo > 1) {
+						_this.list = _this.list.concat(res.data.list || []);
+					} else {
+						_this.list = res.data.list || [];
+					}
+					_this.total = res.data.count || 0;
 				} else {
-				  _this.list = []
-				  _this.total = 0
-				  _this.noDataText = res.message
+					_this.list = [];
+					_this.total = 0;
+					_this.noDataText = res.message;
 				}
-				_this.status = "loadmore"
-			  })
-			},
-			// 查询条件
-			openSearch(){
-				this.showSearch = true
-			},
-			bindBeginDateChange(e){
-				this.beginDate = e.target.value
-			},
-			bindEndDateChange(e){
-				this.endDate = e.target.value
-			},
-			// 重置
-			resetForm(){
-				this.queryWord = ''
-				this.beginDate = ''
-				this.endDate = ''
-				this.pageInit(true)
-			},
-			// 详细页
-			viewRow(item){
-				// 已完成的
-				uni.navigateTo({
-					url: "/pages/spotCheckCenter/spotCheckResult?id="+item.id
-				})
-			},
+				_this.status = 'loadmore';
+			});
+		},
+		// 详细页
+		viewRow(item) {
+			// 判断状态,待处理的跳转的开始点检页面,已完成的查看点检结果,已过期的不处理
+			// 已完成的
+			uni.navigateTo({
+				url: '/pages/spotCheckCenter/spotCheckResult?id=' + item.id
+			});
+			// 待处理
 		}
 	}
+};
 </script>
 
 <style lang="scss" scoped>
-	page{
-		height: 100%;
-	}
-	.pagesCons{
-		height: 100%;
-		display: flex;
-		flex-direction: column;
-		.tab-body{
-			.check-list{
-				height: calc(100vh - 120px);
-			}
-			.check-order-list{
-				background: #ffffff;
-				padding: 10upx 20upx;
-				margin: 25upx;
-				border-radius: 6upx;
-				box-shadow: 1px 1px 3px #EEEEEE;
-				.check-row{
+page {
+	height: 100%;
+}
+.pagesCons {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	.tab-body {
+		.check-list {
+			height: calc(100vh - 120px);
+		}
+		.check-order-list {
+			background: #ffffff;
+			padding: 10upx 20upx;
+			margin: 25upx;
+			border-radius: 6upx;
+			box-shadow: 1px 1px 3px #eeeeee;
+			.check-row {
+				display: flex;
+				align-items: center;
+				padding: 20upx 10upx;
+				font-size: 28upx;
+				&:first-child {
+					border-bottom: 1px dashed #f8f8f8;
+					font-size: 26upx;
+				}
+				&:last-child {
+					border-top: 1px dashed #f8f8f8;
+				}
+				> view {
+					&:first-child {
+						flex-grow: 1;
+					}
+				}
+				.action {
+					margin: 0 6rpx;
+					padding: 0 20rpx;
+					color: #fff;
+				}
+				.edit {
+					background-color: #f9ba09;
+				}
+				.view {
+					background-color: #ff7801;
+				}
+				.del {
+					background-color: #f72525;
+				}
+				.finish {
+					background-color: #2d8cf0;
+				}
+				.pay {
+					background-color: #10c71e;
+				}
+				.check-btns {
+					width: '50%';
 					display: flex;
 					align-items: center;
-					padding: 20upx 10upx;
-					font-size: 28upx;
-					&:first-child{
-						border-bottom: 1px dashed #F8F8F8;
-						font-size: 26upx;
-					}
-					&:last-child{
-						border-top: 1px dashed #F8F8F8;
-					}
-					> view{
-						&:first-child{
-							flex-grow: 1;
-						}
-					}
-					.action{
-						margin: 0 6rpx;
-						padding: 0 20rpx;
-						color: #fff;
-					}
-					.edit{
-						background-color: #f9ba09;
-					}
-					.view{
-						background-color: #ff7801;
-					}
-					.del{
-						background-color: #f72525;
-					}
-					.finish{
-						background-color: #2d8cf0;
-					}
-					.pay{
-						background-color: #10c71e;
-					}
-					.check-btns{
-						width: '50%';
-						display: flex;
-						align-items: center;
-						justify-content: flex-end;
-						> view{
-							margin-left: 35upx;
-							font-size: 28upx;
-						}
-					}
-					.u-tag{
-						border-radius: 0;
-					}
-					.uni-icons{
-						margin: 0 5upx;
+					justify-content: flex-end;
+					> view {
+						margin-left: 35upx;
+						font-size: 28upx;
 					}
 				}
+				.u-tag {
+					border-radius: 0;
+				}
+				.uni-icons {
+					margin: 0 5upx;
+				}
 			}
 		}
 	}
+}
 </style>