mao 1 年間 前
コミット
da29162309

+ 7 - 0
api/business/carrier.js

@@ -17,4 +17,11 @@ export function addCarrierReject(data) {
 		method: 'POST',
 		data: data
 	})
+}
+
+export function checkCarrier(id) {
+	return req.request({
+		url:'/business/carrier/' + id,
+		method: 'GET',
+	})
 }

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

@@ -146,12 +146,12 @@
 	}
 
 	function handleInputQualifiedNum() {
-		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-+|[^\d]/g, '');
+		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^-+|[^\d]/g, '');
 	}
 
 	function handleInputRejectNum() {
 		for (let i = 0; i < wasteInfo.value.length; i++) {
-			wasteInfo.value[i].rejectNum = wasteInfo.value[i].rejectNum.replace(/^-|[^\d]/g, '');
+			wasteInfo.value[i].rejectNum = wasteInfo.value[i].rejectNum.replace(/^0+|^-|[^\d]/g, '');
 		}
 	}
 

+ 1 - 0
components/dialog-selectEquipment/dialog-selectEquipment.vue

@@ -126,6 +126,7 @@
 						value: filteredData[i].processId
 					}
 				}
+				console.log(processList.value)
 				selectedProcess.value = filteredData[0].processId;
 			} 
 		})

+ 43 - 24
components/dialog-turnoverApplication/dialog-turnoverApplication.vue

@@ -10,7 +10,7 @@
 			<view class="" style="margin: 0 20rpx 20rpx 0;width: 88%;">
 				<uni-section title="请选择下序工段" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;">
 					<uni-data-select v-model="curDayworkItem.deptId" :localdata="deptList" @change="handleChange"
-					:clear="false"
+						:clear="false"
 						style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
 				</uni-section>
 			</view>
@@ -64,7 +64,7 @@
 		timestampToTime
 	} from '@/utils/common.js'
 
-	const baseDialog = ref(null) 
+	const baseDialog = ref(null)
 	const turnoverDoorChecked = ref([])
 	const turnoverType = ref([])
 	const turnoverArea = ref([])
@@ -82,8 +82,7 @@
 	})
 
 	function open(data) {
-		deptList.value = [];
-		turnAreaList.value = [];
+		resetPage();
 		dayworkInfo.value = data;
 		baseDialog.value.open();
 		init();
@@ -98,6 +97,18 @@
 		turnAreaList.value = [];
 	}
 
+	function resetPage() {
+		turnoverDoorChecked.value = []
+		turnoverType.value = []
+		turnoverArea.value = []
+		selection.value = []
+		curDayworkItem.value = {
+			turnoverType: 1
+		}
+		deptList.value = []
+		turnAreaList.value = []
+	}
+
 	function init() {
 		getDictInfoByType('daywork_turnover_type').then(res => {
 			turnoverType.value = res.data;
@@ -120,7 +131,7 @@
 			tenantId: store.tenantId
 		}).then(res => {
 			console.log(res.data)
-			for (var i = 0; i < res.data.length; i++) {
+			for (let i = 0; i < res.data.length; i++) {
 				deptList.value[i] = {
 					text: res.data[i].deptName,
 					value: res.data[i].deptId,
@@ -138,21 +149,21 @@
 	function selectTurnoverDoor(item) {
 		// turnoverDoorChecked.value = item;
 		// curDayworkItem.value.turnoverArea = item.dictValue;
-	let index = selection.value.findIndex(selectedItem => selectedItem === item);
-	if (index > -1) {
-		selection.value.splice(index, 1); 
-	} else {
-		selection.value.push(item); 
-	}
-		
+		let index = selection.value.findIndex(selectedItem => selectedItem === item);
+		if (index > -1) {
+			selection.value.splice(index, 1);
+		} else {
+			selection.value.push(item);
+		}
 	}
-    
+
 	function handleTurnoverDoor(item) {
 		return selection.value.includes(item);
 	}
+
 	function handleValidate(data) {
 		console.log(data)
-		if (data.turnoverType === "0" || data.turnoverArea === "" || data.deptId === "0") {
+		if (data.turnoverArea == "" || data.deptId == null || selection.value.length == 0) {
 			return false;
 		} else {
 			return true;
@@ -169,7 +180,18 @@
 		} else {
 			curDayworkItem.value.tenantId = store.tenantId;
 		}
-		console.log(deptList.value)
+		// 过滤出周转位置的数组,并转换成字符串
+		const newArray = selection.value.map((item) => {
+			if (item.code) {
+				return item.code;
+			} else if (item.dictLabel) {
+				return item.dictLabel;
+			} else {
+				return null;
+			}
+		})
+		curDayworkItem.value.turnoverArea = newArray.join('、');
+		// curDayworkItem.value.dayworkId = store.dayworkInfo.id;
 		// 设置周转下一个车间名
 		for (let i = 0; i < deptList.value.length; i++) {
 			if (deptList.value[i].value == curDayworkItem.value.deptId) {
@@ -177,29 +199,26 @@
 			}
 		}
 		console.log(curDayworkItem.value);
+		console.log(dayworkInfo.value)
 		if (!handleValidate(curDayworkItem.value)) {
 			uni.showToast({
 				icon: "error",
-				title: '请选择完整信息',
-				duration: 2000
+				title: '请选择完整信息'
 			});
 		} else {
+			close();
 			saveDayWorkItem(curDayworkItem.value).then(res => {
 				if (res.code === 200) {
 					uni.showToast({
 						icon: 'success',
-						title: '操作成功',
-						duration: 2000
+						title: '操作成功'
 					});
 					uni.$emit('dayworkItemUpdate');
-					close();
 				} else {
 					uni.showToast({
 						icon: 'error',
-						title: '操作失败',
-						duration: 2000
+						title: '操作失败'
 					});
-					close();
 				}
 			})
 		}
@@ -213,7 +232,7 @@
 			deptId: curDayworkItem.value.deptId,
 		}).then(res => {
 			for (var i = 0; i < res.data.length; i++) {
-				if(res.data[i].status == 0){
+				if (res.data[i].status == 0) {
 					turnAreaList.value[i] = res.data[i];
 				}
 			}

+ 12 - 5
pages/addNewBatch/index.vue

@@ -88,7 +88,7 @@
 		store
 	} from '@/store/index.js'
 	import {
-		getCarrierById
+		getCarrierById,checkCarrier
 	} from '@/api/business/carrier.js'
 
 	const batchNoCheck = ref(null) // 批次号是否选中
@@ -180,10 +180,17 @@
 						return;
 					}
 				}
-				// getCarrierById(vehicleObj.carrierId).then(response => {
-						
-				// })
-				vehicleList.value.push(vehicleObj);
+				checkCarrier(vehicleObj.carrierId).then(response => {
+						if(res.code == 200){
+							vehicleList.value.push(vehicleObj);
+						}else{
+							uni.showToast({
+								icon: 'none',
+								title: response.msg
+							})
+							return;
+						}
+				})
 			}
 		});
 	}

+ 18 - 8
pages/changeBox/index.vue

@@ -65,7 +65,7 @@
 		debounce
 	} from '@/utils/common.js'
 	import {
-		addCarrierReject
+		addCarrierReject,checkCarrier
 	} from '@/api/business/carrier.js'
 
 	const bindList = ref([])
@@ -88,7 +88,7 @@
 		getDayworkCarrierList(data).then(res => {
 			console.log(res)
 			if (res.code == 200) {
-				bindList.value = res.rows;
+				bindList.value = [...res.rows];
 				newBindList.value = res.rows;
 			}
 		})
@@ -115,6 +115,7 @@
 	// }
 	function handleDelVehicleNo(item, index) {
 		if (bindList.value.includes(item)) {
+			console.log(bindList.value)
 			newBindList.value.splice(index, 1);
 			let discardVehicleInfo = {
 				carrierCode: item.carrierCode,
@@ -145,8 +146,7 @@
 				if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
 					uni.showToast({
 						icon: "error",
-						title: "请扫载具码",
-						duration: 1000
+						title: "请扫载具码"
 					})
 					return;
 				}
@@ -154,13 +154,23 @@
 					if (newBindList.value[i].carrierId === vehicleObj.carrierId) {
 						uni.showToast({
 							icon: "error",
-							title: "载具已存在",
-							duration: 1000
+							title: "载具已存在"
 						})
 						return;
 					}
 				}
-				newBindList.value.push(JSON.parse(res.result));
+				checkCarrier(vehicleObj.carrierId).then(response => {
+					console.log(response)
+						if(response.code == 200){
+							newBindList.value.push(JSON.parse(res.result));
+						}else{
+							uni.showToast({
+								icon: 'none',
+								title: response.msg
+							})
+							return;
+						}
+				})
 			}
 		});
 	}
@@ -179,7 +189,7 @@
 				carrierRejectList.push(discardVehicleList.value[i])
 			}
 		}
-		if (carrierRejectList.length > 0) {
+		if (carrierRejectList.length > 0 && newBindList.value.length > 0) {
 			addCarrierReject(carrierRejectList).then((response) => {
 				if (response.code == 200) {
 					uni.showToast({