mao 1 year ago
parent
commit
7b45a3a671

+ 2 - 5
components/dialog-end-work/dialog-end-work.vue

@@ -112,7 +112,6 @@
 			uni.showToast({
 				icon: "error",
 				title: "请输入合格数",
-				duration: 2000
 			})
 			return;
 		}
@@ -140,16 +139,14 @@
 				uni.showToast({
 					icon: 'success',
 					title: '操作成功',
-					duration: 1000
 				});
 				uni.$emit('dayworkItemUpdate');
 				baseDialog.value.close();
 				workInfo.value.qualifiedNum = null;
 			} else {
 				uni.showToast({
-					icon: 'error',
-					title: '操作失败',
-					duration: 1000
+					icon: 'none',
+					title: res.msg
 				});
 			}
 		})

+ 1 - 1
pages/batchReporting/index.vue

@@ -34,7 +34,7 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">合格数/投入数</text>
-					<text class="label right">{{ item['qualifiedQuantity'] }}/{{item['invest']}}</text>
+					<text class="label right">{{ item['qualifiedQuantity'] }}/{{item['processQualifiedNum'] == 0 ? item['oneLotQuantity'] : item['processQualifiedNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">上道工序</text>

+ 66 - 63
pages/changeBox/index.vue

@@ -5,33 +5,32 @@
 				<text class='title'>当前箱号</text>
 
 				<view class="vehicleList uni-row" style="overflow: auto;">
-					<view class="vehicleNo uni-row" v-for="(item,index) in vehicleList"
-						>
+					<view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
 						<text>{{item.carrierCode}}</text>
 						<text @click="handleDelVehicleNo(item)">×</text>
 					</view>
 				</view>
-				<view style="border-top:1rpx solid #e1e1e1; height: 500rpx; overflow: auto; width: 90%;margin: 0 auto" >
-				<view class="uni-row" style="align-items: center;">
-					<view style="flex: 3;margin-left: 60rpx;">箱号</view>
-					<view style="flex: 3;">是否废弃</view>
-					<view style="flex: 4; " >废弃原因</view>
-				</view>	
-				<view class="vehicleNo uni-row" v-for="(item,index) in discardVehicleList" style="align-items: center;justify-content: space-around;" >
-					<view class="uni-row discardVehicleNo" ><text>{{item.carrierCode}}</text>
-						<text @click="handleDelDiscardVehicleList(item)">×</text>
+				<view style="border-top:1rpx solid #e1e1e1; height: 500rpx; overflow: auto; width: 90%;margin: 0 auto">
+					<view class="uni-row" style="align-items: center;">
+						<view style="flex: 3;margin-left: 60rpx;">箱号</view>
+						<view style="flex: 3;">是否废弃</view>
+						<view style="flex: 4; ">废弃原因</view>
 					</view>
-					<view class="uni-row" >
-						<switch v-model="item.checked" color="#ff0000" style="transform:scale(0.7)" @change="handleSwitchChange(item)" />
+					<view class="vehicleNo uni-row" v-for="(item,index) in discardVehicleList"
+						style="align-items: center;justify-content: space-around;">
+						<view class="uni-row discardVehicleNo"><text>{{item.carrierCode}}</text>
+							<text @click="handleDelDiscardVehicleList(item)">×</text>
+						</view>
+						<view class="uni-row">
+							<switch color="#ff0000" style="transform:scale(0.7)" @change="handleSwitchChange(item)" />
+						</view>
+						<view class="uni-row">
+							<uni-data-select v-model="item.reason" :localdata="abanonmentList" style="width: 240rpx;"
+								:clear="false"></uni-data-select>
+						</view>
 					</view>
-					<view  class="uni-row">
-				<uni-data-select v-model="item.reason" :localdata="abanonmentList" style="width: 240rpx;"
-					:clear="false"
-					></uni-data-select>
-					</view>
-				</view>
 
-</view>
+				</view>
 				<view class="btn">
 					<button class='submit code' @click="handleScanCode">扫码</button>
 				</view>
@@ -101,10 +100,11 @@
 			}
 		})
 	}
+
 	function handleSwitchChange(item) {
-        item.checked = !item.checked
+		item.checked = !item.checked
 	}
-    
+
 	// function handleSelectRejectReason(item) {
 	// 	for (var i = 0; i < abanonmentList.value.length; i++) {
 	// 		if(abanonmentList.value[i].value == item.reason ) {
@@ -115,10 +115,10 @@
 	function handleDelVehicleNo(item) {
 		vehicleList.value.splice(item, 1);
 		let discardVehicleInfo = {
-			carrierCode : item.carrierCode,
-			checked:false,
-			reason:'',
-			carrierId : item.carrierId
+			carrierCode: item.carrierCode,
+			checked: false,
+			reason: '',
+			carrierId: item.carrierId
 		}
 		discardVehicleList.value.push(discardVehicleInfo)
 	}
@@ -160,49 +160,51 @@
 
 	function handleSubmit() {
 		dayWorkInfo.dayworkCarriers = vehicleList.value;
-		var carrierRejectList = []
-		for (var i = 0; i < discardVehicleList.value.length; i++) {
-			if(discardVehicleList.value[i].checked && discardVehicleList.value[i].reason == "") {
+		saveDayWork(dayWorkInfo).then(res => {
+			if (res.code === 200) {
 				uni.showToast({
-							icon: 'error',
-							title: '第'+(i+1)+'条未选择废弃原因',
-							duration: 2000,
-							});
-			}
-			if(discardVehicleList.value[i].checked && discardVehicleList.value[i].reason !== "") {
-				carrierRejectList.push(discardVehicleList.value[i])
-			}
-		}
-		addCarrierReject(carrierRejectList).then((response) => {
-			if(response.code == 200) {
-				saveDayWork(dayWorkInfo).then(res => {
-					if (res.code === 200) {
-						uni.showToast({
-							icon: 'success',
-							title: '添加成功'
-						});
-						// uni.$emit('batchReporting-addBatch')
-						uni.$emit('dayworkItemUpdate');
-						uni.navigateBack({
-							url: '/pages/batchReporting/index'
-						})
-					} else {
-						uni.showToast({
-							icon: 'error',
-							title: '添加失败'
-						});
-					}
+					icon: 'success',
+					title: '添加成功'
+				});
+				// uni.$emit('batchReporting-addBatch')
+				uni.$emit('dayworkItemUpdate');
+				uni.navigateBack({
+					url: '/pages/batchReporting/index'
 				})
-			}
-			else {
+			} else {
 				uni.showToast({
 					icon: 'error',
-					title: '添加失败',
+					title: res.msg
 				});
 			}
 		})
 		
-		
+		let carrierRejectList = []
+		let flag = true;
+		for (var i = 0; i < discardVehicleList.value.length; i++) {
+			if (discardVehicleList.value[i].checked && discardVehicleList.value[i].reason == "") {
+				uni.showToast({
+					icon: 'error',
+					title: '第' + (i + 1) + '条未选择废弃原因'
+				});
+				flag = false;
+			}
+			if (discardVehicleList.value[i].checked && discardVehicleList.value[i].reason !== "") {
+				carrierRejectList.push(discardVehicleList.value[i])
+			}
+		}
+		if(carrierRejectList.length > 0 && flag){
+			addCarrierReject(carrierRejectList).then((response) => {
+				if (response.code == 200) {
+			
+				} else {
+					uni.showToast({
+						icon: 'error',
+						title: '添加失败',
+					});
+				}
+			})
+		}
 	}
 </script>
 
@@ -247,7 +249,7 @@
 			justify-content: flex-start;
 			flex-wrap: wrap;
 			width: 100%;
-			height: 45%; 
+			height: 45%;
 			// max-height: 300rpx;
 			overflow: auto;
 			padding: 0 80rpx;
@@ -262,10 +264,11 @@
 				border: 1px solid rgba(213, 213, 213, 1);
 				border-radius: 6rpx;
 			}
-		
+
 
 		}
 	}
+
 	.discardVehicleNo {
 		padding: 0 10rpx;
 		margin: 10rpx;