浏览代码

0719手机端查看指定期间内每到工序的报工信息

zhuzeyu 11 月之前
父节点
当前提交
986761ea48
共有 1 个文件被更改,包括 161 次插入24 次删除
  1. 161 24
      pages/reportHistory/index.vue

+ 161 - 24
pages/reportHistory/index.vue

@@ -14,6 +14,7 @@
 	</view>
 	</view>
 
 
 	<view v-if="show" class="uni-column container">
 	<view v-if="show" class="uni-column container">
+		
 		<view class="uni-row" style="position: fixed;
 		<view class="uni-row" style="position: fixed;
 		top: 0;width: 100%;
 		top: 0;width: 100%;
 		height: 120rpx;
 		height: 120rpx;
@@ -24,19 +25,25 @@
 		align-items: center;
 		align-items: center;
 		border-top: 1rpx solid lightgray;
 		border-top: 1rpx solid lightgray;
 		border-bottom: 1rpx solid lightgray;">
 		border-bottom: 1rpx solid lightgray;">
-			<uni-section title="选择日期:" type="square" class="uni-row" style="margin-left: 16rpx;">
+		
+			<!-- <uni-section title="选择日期:" type="square" class="uni-row" style="margin-left: 16rpx;">
 				<uni-data-select v-model="selectDate" :localdata="dateList" @change="change" :clear="false"
 				<uni-data-select v-model="selectDate" :localdata="dateList" @change="change" :clear="false"
 				placeholder="无报工记录"
 				placeholder="无报工记录"
 					style="width: 200rpx;"></uni-data-select>
 					style="width: 200rpx;"></uni-data-select>
-			</uni-section>
-			<uni-section title="总数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
+			</uni-section> -->
+			<!-- <uni-section title="总数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
 				{{ total }}
 				{{ total }}
 			</uni-section>
 			</uni-section>
 			<uni-section title="条数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
 			<uni-section title="条数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
 				{{ listDataItem.length }}
 				{{ listDataItem.length }}
-			</uni-section>
+			</uni-section> -->
+			<view class="tab-container">
+				<view :class="['tab-item', editStatus === false ? 'active': '']" @click="handleCheckTabHis()">历史报工</view>
+				<view :class="['tab-item', editStatus === true ? 'active': '']" @click="handleCheckTab()">已完成报工</view>
+			</view>
 		</view>
 		</view>
-		<view class="scroll-container">
+		
+		<view class="scroll-container" v-if="!editStatus">
 
 
 			<view v-for="(item, index) in listDataItem" :key="index" class="list-item">
 			<view v-for="(item, index) in listDataItem" :key="index" class="list-item">
 				<view class="title-container">
 				<view class="title-container">
@@ -89,7 +96,62 @@
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
+		
+		<view class="scroll-container" v-if="editStatus">
+		
+			<view v-for="(item, index) in listDaywork" :key="index" class="list-item">
+				<view class="title-container">
+					<view class="title uni-row">
+						<view class="uni-row">
+							<text class="label">批次号:</text>
+							<text class="label code"> {{ item['lotCode'] }}</text>
+						</view>
+						<!-- <view style="color: #1684fc; margin-right: 0;" @click="handleOpenLonInfo">
+							<text>批次详情</text>
+						</view> -->
+					</view>
+					<view class="uni-row" style="margin: 10rpx 0 0;">
+						<!-- <view class="right-info uni-row"> <text class="label">工时</text>
+							<text class="label time">{{ item['taskTime'] }}</text>
+						</view> -->
+						<view class="right-info uni-row"> <text class="label">工序</text>
+							<text class="label time">{{ item['processAlias'] }}</text>
+						</view>
+						<view class="right-info uni-row" style="margin-left: 50rpx;"> <text class="label">合格数</text>
+							<text class="label number ">{{ item['qualifiedNum'] }}</text>
+						</view>
+					</view>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">产品描述</text>
+					<text class="label right">{{ item['productDescription'] }}</text>
+				</view>
+				<!-- <view class="item-info uni-row">
+					<text class="label">操作者</text>
+					<text class="label right">{{ item['nickName'] }}</text>
+				</view> -->
+			<!-- 	<view class="item-info uni-row">
+					<text class="label">开始时间</text>
+					<text class="label right">{{ item['startTime'] ? item['startTime'] : '-' }}</text>
+				</view> -->
+				<view class="item-info uni-row">
+					<text class="label">结束时间</text>
+					<text class="label right">{{ item['endTime'] ? item['endTime'] : '-'}}</text>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">废品数</text>
+					<text class="label right">{{ item['rejectSum'] ? item['rejectSum'] : 0 }}</text>
+				</view>
+				
+				<view class="item-info uni-row">
+					<text class="label">设备</text>
+					<text class="label right">{{ item['equipmentDetailCode'] }}</text>
+				</view>
+			</view>
+		</view>
 	</view>
 	</view>
+	
+	
 	<!-- <dialog-lotInfo ref="lotInfo"></dialog-lotInfo> -->
 	<!-- <dialog-lotInfo ref="lotInfo"></dialog-lotInfo> -->
 </template>
 </template>
 
 
@@ -111,7 +173,7 @@
 		toHHmmss
 		toHHmmss
 	} from '@/utils/common.js'
 	} from '@/utils/common.js'
 
 
-
+	const listDaywork = ref([])
 	const listData = ref([]) // 回显 	
 	const listData = ref([]) // 回显 	
 	const listDataItem = ref([])
 	const listDataItem = ref([])
 	const lotInfo = ref(null) // 详情弹窗
 	const lotInfo = ref(null) // 详情弹窗
@@ -121,7 +183,7 @@
 	const startTime = ref('')
 	const startTime = ref('')
 	const endTime = ref('')
 	const endTime = ref('')
 	const total = ref(0)
 	const total = ref(0)
-
+	const editStatus = ref(false)
 	onLoad(() => {
 	onLoad(() => {
 		
 		
 		
 		
@@ -192,15 +254,17 @@
 		getDayWorkItemHistory(startTime.value,endTime.value).then(res => {
 		getDayWorkItemHistory(startTime.value,endTime.value).then(res => {
 			if (res.code == 200) {
 			if (res.code == 200) {
 				listData.value = res.rows || [];
 				listData.value = res.rows || [];
+				listDataItem.value = res.rows || [];
+				console.log(listData.value)
 				total.value = res.rows.length;
 				total.value = res.rows.length;
 				// 时间戳转工时
 				// 时间戳转工时
-				for (var i = 0; i < listData.value.length; i++) {
-					let timeStamp = listData.value[i].workingHours;
-					listData.value[i].taskTime = toHHmmss(timeStamp);
+				for (var i = 0; i < listDataItem.value.length; i++) {
+					let timeStamp = listDataItem.value[i].workingHours;
+					listDataItem.value[i].taskTime = toHHmmss(timeStamp);
 				}
 				}
 				// 转为二维数组
 				// 转为二维数组
-				console.log(listData.value)
-				const groupedData = listData.value.reduce((accumulator, currentItem) => {
+				console.log(listDataItem.value)
+				const groupedData = listDataItem.value.reduce((accumulator, currentItem) => {
 					// 获取当前对象的日期字符串
 					// 获取当前对象的日期字符串
 					const dateString = currentItem.startTime.split(' ')[0];
 					const dateString = currentItem.startTime.split(' ')[0];
 					// 如果有这个日期,则 push 到对应的数组中,否则创建一个新的数组
 					// 如果有这个日期,则 push 到对应的数组中,否则创建一个新的数组
@@ -211,19 +275,63 @@
 					}
 					}
 					return accumulator;
 					return accumulator;
 				}, {});
 				}, {});
+				
+				
+		// 0718
+		for (var i = 0; i < listData.value.length; i++) {
+		  var current = listData.value[i];
+		  var found = false;
+		  var endTimeStatus = "";
+		  for (var j = 0; j < listDaywork.value.length; j++) {
+		    if (listDaywork.value[j].dayworkId === current.dayworkId && listDaywork.value[j].processId === current.processId) {
+		      listDaywork.value[j].qualifiedNum += current.qualifiedNum;
+		      listDaywork.value[j].rejectSum += current.rejectSum;
+			  if(listDaywork.value[j].equipmentDetailCode != null && listDaywork.value[j].equipmentDetailCode != undefined && listDaywork.value[j].equipmentDetailCode != listDaywork.value[j].equipmentDetailCode){
+				  listDaywork.value[j].equipmentDetailCode = listDaywork.value[j].equipmentDetailCode+","+current.equipmentDetailCode
+			  }
+		      found = true;
+		      break;
+		    }
+		  }
+		
+		if (current.status == 3 ) {
+		        endTimeStatus = current.endTime;
+		        
+		      } else  {
+		        endTimeStatus= null;
+		      }
+		  if (!found) {
+		    listDaywork.value.push({
+			  processAlias:current.process.processAlias,
+			  equipmentDetailCode:current.equipmentDetailCode,
+			  lotCode:current.lotCode,
+			  productDescription:current.productDescription,
+			  daywork:current.daywork,
+		      dayworkId: current.dayworkId,
+		      processId: current.processId,
+		      qualifiedNum: current.qualifiedNum,
+		      rejectSum: current.rejectSum,
+		      endTime: endTimeStatus
+		    });
+		  }
+		}
+		
+		console.log(listData.value);
+		console.log(listDaywork.value);
+				
 				// 时间下拉
 				// 时间下拉
-				for (let i = 0; i < Object.keys(groupedData).length; i++) {
-					dateList.value[i] = {
-						text: Object.keys(groupedData)[i],
-						value: Object.keys(groupedData)[i]
-					}
-				}
-				listData.value = groupedData;
-				if(dateList.value.length > 0){
-					listDataItem.value = listData.value[dateList.value[0].value]
-					selectDate.value = dateList.value[0].value;
-				}	
-				console.log(groupedData)
+				// for (let i = 0; i < Object.keys(groupedData).length; i++) {
+				// 	dateList.value[i] = {
+				// 		text: Object.keys(groupedData)[i],
+				// 		value: Object.keys(groupedData)[i]
+				// 	}
+				// }
+				// listData.value = groupedData;
+				// if(dateList.value.length > 0){
+				// 	listDataItem.value = listData.value[dateList.value[0].value]
+				// 	selectDate.value = dateList.value[0].value;
+				// }	
+				// console.log(groupedData)
 				uni.hideLoading();
 				uni.hideLoading();
 			} else {
 			} else {
 				uni.showToast({
 				uni.showToast({
@@ -236,6 +344,12 @@
 		})
 		})
 	}
 	}
 
 
+	function handleCheckTab(){
+		editStatus.value = true
+	}
+	function handleCheckTabHis(){
+		editStatus.value = false
+	}
 	function change() {
 	function change() {
 		listDataItem.value = listData.value[selectDate.value]
 		listDataItem.value = listData.value[selectDate.value]
 	}
 	}
@@ -246,6 +360,7 @@
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
+	
 	.time-controls {
 	.time-controls {
 		.title {
 		.title {
 			margin: 20% auto 40% auto; 
 			margin: 20% auto 40% auto; 
@@ -374,4 +489,26 @@
 
 
 		}
 		}
 	}
 	}
+	.tab-container {
+		display: flex;
+		flex-direction: row;
+		width: 100%;
+		height: 32px;
+		justify-content: space-around;
+	
+		.table-item {
+			display: flex;
+			flex-direction: row;
+			flex: 1;
+			font-size: 14px;
+			color: #666;
+			align-items: center;
+			justify-content: center;
+		}
+	}
+	.tab-item.active {
+		color: rgba(25, 137, 250, 1);
+		
+		font-weight: 700;
+	}
 </style>
 </style>