guoyujia 2 月之前
父節點
當前提交
2be2caf0fb
共有 3 個文件被更改,包括 98 次插入72 次删除
  1. 6 0
      api/business/dayWorkItem.js
  2. 2 2
      manifest.json
  3. 90 70
      pages/reportHistory/index.vue

+ 6 - 0
api/business/dayWorkItem.js

@@ -171,6 +171,12 @@ export function getDayWorkItemHistory(startTime, endTime) {
 		method: 'GET',
 	})
 }
+export function getDayWorkItemFinishHistory(startTime, endTime) {
+	return req.request({
+		url: '/business/dayworkItem/getDayWorkItemFinishHistory?startTime=' + startTime + '&endTime=' + endTime,
+		method: 'GET',
+	})
+}
 
 export function turnover(data) {
 	return req.request({

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "(测试)德迈仕数字生产管理平台",
     "appid" : "__UNI__54D8B02",
     "description" : "",
-    "versionName" : "1.0.51",
-    "versionCode" : 151,
+    "versionName" : "1.0.53",
+    "versionCode" : 153,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 90 - 70
pages/reportHistory/index.vue

@@ -179,7 +179,8 @@
 		onShow
 	} from '@dcloudio/uni-app'
 	import {
-		getDayWorkItemHistory
+		getDayWorkItemHistory,
+		getDayWorkItemFinishHistory
 	} from "@/api/business/dayWorkItem.js"
 	import {
 		store
@@ -278,72 +279,84 @@
 					listDataItem.value[i].taskTime = toHHmmss(timeStamp);
 				}
 				// 转为二维数组
-				console.log(listDataItem.value)
-				const groupedData = listDataItem.value.reduce((accumulator, currentItem) => {
-					// 获取当前对象的日期字符串
-					const dateString = currentItem.startTime.split(' ')[0];
-					// 如果有这个日期,则 push 到对应的数组中,否则创建一个新的数组
-					if (accumulator[dateString]) {
-						accumulator[dateString].push(currentItem);
-					} else {
-						accumulator[dateString] = [currentItem];
-					}
-					return accumulator;
-				}, {});
-
-				var hasEndTime = false
-				// 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]
-							.processStepNumber === current.processStepNumber) {
-							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) {
-						console.log("999")
-						hasEndTime = true
-						endTimeStatus = current.endTime;
-						console.log(endTimeStatus)
-					}
-					if (!hasEndTime && current.status != 3) {
-						console.log("777")
-						endTimeStatus = null;
-					}
-					if (!found && current.status == 3) {
-						console.log()
-						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,
-							adoptStatus: current.adoptStatus == null ? null : current.adoptStatus
-
-						});
-					}
-				}
+				// console.log(listDataItem.value)
+				// const groupedData = listDataItem.value.reduce((accumulator, currentItem) => {
+				// 	// 获取当前对象的日期字符串
+				// 	const dateString = currentItem.startTime.split(' ')[0];
+				// 	// 如果有这个日期,则 push 到对应的数组中,否则创建一个新的数组
+				// 	if (accumulator[dateString]) {
+				// 		accumulator[dateString].push(currentItem);
+				// 	} else {
+				// 		accumulator[dateString] = [currentItem];
+				// 	}
+				// 	return accumulator;
+				// }, {});
+
+				// var hasEndTime = false
+				// // 0718
+				// for (var i = 0; i < listData.value.length; i++) {
+				// 	var current = listData.value[i];
+				// 	var found = false;
+				// 	var endTimeStatus = "";
+				// 	console.log(current, i)
+				// 	console.log(listDaywork.value, i)
+				// 	console.log(listDaywork.value.length > 0)
+				// 	for (var j = 0; j < listDaywork.value.length; j++) {
+				// 		console.log(listDaywork.value[j])
+				// 		if (listDaywork.value[j].dayworkId === current.dayworkId && listDaywork.value[j]
+				// 			.processStepNumber === current.processStepNumber) {
+				// 			listDaywork.value[j].qualifiedNum = listData.value.filter(v => v.dayworkId == current
+				// 				.dayworkId && v.processStepNumber == current.processStepNumber).reduce((acc,
+				// 				item) => acc + item.qualifiedNum, 0);
+				// 			console.log("666", listData.value.filter(v => v.dayworkId == current
+				// 				.dayworkId && v.processStepNumber == current.processStepNumber))
+				// 			listDaywork.value[j].rejectNum = listData.value.filter(v => v.dayworkId == current
+				// 				.dayworkId && v.processStepNumber == current.processStepNumber).reduce((acc,
+				// 				item) => acc + item.rejectNum, 0);
+				// 			// 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) {
+				// 		console.log("999")
+				// 		hasEndTime = true
+				// 		endTimeStatus = current.endTime;
+				// 		console.log(endTimeStatus)
+				// 	}
+				// 	if (!hasEndTime && current.status != 3) {
+				// 		console.log("777")
+				// 		endTimeStatus = null;
+				// 	}
+				// 	if (!found && current.status == 3) {
+				// 		console.log()
+				// 		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,
+				// 			adoptStatus: current.adoptStatus == null ? null : current.adoptStatus,
+				// 			processStepNumber: current.processStepNumber
+				// 		});
+				// 	}
+				// }
 
-				console.log(listData.value);
-				console.log(listDaywork.value);
+				// console.log(listData.value);
+				// console.log(listDaywork.value);
 
 				// 时间下拉
 				// for (let i = 0; i < Object.keys(groupedData).length; i++) {
@@ -371,16 +384,23 @@
 	}
 
 	function handleCheckTab() {
-		editStatus.value = true
+		uni.showLoading({
+			title: '加载中'
+		});
+		getDayWorkItemFinishHistory(startTime.value, endTime.value).then(res => {
+			listDaywork.value = res.data
+			editStatus.value = true
+			uni.hideLoading()
+		})
 	}
 
 	function handleCheckTabHis() {
 		editStatus.value = false
 	}
 
-	function change() {
-		listDataItem.value = listData.value[selectDate.value]
-	}
+	// function change() {
+	// 	listDataItem.value = listData.value[selectDate.value]
+	// }
 
 	// function handleOpenLonInfo() {
 	// 	lotInfo.value.open();