ezhizao_zx 1 年間 前
コミット
864d961c90
1 ファイル変更104 行追加80 行削除
  1. 104 80
      pages/sortBatchReporting/index.vue

+ 104 - 80
pages/sortBatchReporting/index.vue

@@ -90,6 +90,10 @@
 					<text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
 				</view>
 				<view class="status-btn uni-row">
+					<view v-if="item.dayworkItemList[0].status == 0" class=" uni-row">
+						<button class="reporting-tag" size="mini" @click.stop="startReport(item)">开始报工</button>
+						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
+					</view>
 					<view v-if="item['status'] == 2" class=" uni-row">
 						<button class="turnover-tag" size="mini"
 							@click.stop="handleShowTurnoverApplication(item)">周转申请</button>
@@ -165,6 +169,9 @@
 	import {
 		toHHmmss
 	} from '@/utils/common.js'
+	import {
+		getSortingDayworkItem
+	} from '@/api/business/sortDaywork.js'
 
 	const turnoverApplicationDialog = ref(null)
 	const selectProduction = ref(null)
@@ -308,6 +315,7 @@
 		// normalStatus.value = true;
 		getDayWorkList(reqData).then(res => {
 			if (res.code == 200) {
+				console.log(res)
 				tempList.value = res.data
 				if (normalStatus.value) {
 					listData.value = res.data.filter(item => {
@@ -345,6 +353,9 @@
 	}
 
 	function handleToreportingForWork(item) {
+		if (item.dayworkItemList[0].status == 0) {
+			return
+		}
 		uni.$once("formBack", () => handleSearch())
 		uni.navigateTo({
 			url: "/pages/sorting/form",
@@ -400,104 +411,104 @@
 
 	// }
 
-/*
-	function handleScanCode() {
-		// 引入原生插件
-		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
-		// const mpaasScanModule = null
-		if (mpaasScanModule) {
-			// 调用插件的 mpaasScan 方法
-			mpaasScanModule.mpaasScan({
-					// 扫码识别类型,参数可多选,qrCode、barCode,
-					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
-					scanType: ["qrCode", "barCode"],
-					// 是否隐藏相册,默认false不隐藏
-					hideAlbum: false,
-				},
-				(ret) => {
-					console.log(ret);
-					let vehicleObj = JSON.parse(ret.resp_result);
-					if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
-						uni.showToast({
-							icon: "none",
-							title: "请扫载具码",
-							duration: 1000
-						})
-						return;
-					}
-					showDaywork({
-						carrierId: vehicleObj.carrierId,
-						status: 7
-					}).then(response => {
-						if (response.code == 200) {
-							// console.log(response)
-							// console.log(response.data[0].productionPlanDetailId)
-							// console.log(store.planDetails.id)
-							if (response.data[0].deptId !== store.curDeptDetails.deptId) {
-								uni.showToast({
-									icon: 'none',
-									title: '该批次不在当前工段',
-									duration: 2000
-								})
-								return
-							}
-							if (response.data[0].productionPlanDetailId == store.planDetails.id) {
-								// console.log(response.data)
-								lotDialog.value.open(response.data);
+	/*
+		function handleScanCode() {
+			// 引入原生插件
+			const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+			// const mpaasScanModule = null
+			if (mpaasScanModule) {
+				// 调用插件的 mpaasScan 方法
+				mpaasScanModule.mpaasScan({
+						// 扫码识别类型,参数可多选,qrCode、barCode,
+						// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+						scanType: ["qrCode", "barCode"],
+						// 是否隐藏相册,默认false不隐藏
+						hideAlbum: false,
+					},
+					(ret) => {
+						console.log(ret);
+						let vehicleObj = JSON.parse(ret.resp_result);
+						if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
+							uni.showToast({
+								icon: "none",
+								title: "请扫载具码",
+								duration: 1000
+							})
+							return;
+						}
+						showDaywork({
+							carrierId: vehicleObj.carrierId,
+							status: 7
+						}).then(response => {
+							if (response.code == 200) {
+								// console.log(response)
+								// console.log(response.data[0].productionPlanDetailId)
+								// console.log(store.planDetails.id)
+								if (response.data[0].deptId !== store.curDeptDetails.deptId) {
+									uni.showToast({
+										icon: 'none',
+										title: '该批次不在当前工段',
+										duration: 2000
+									})
+									return
+								}
+								if (response.data[0].productionPlanDetailId == store.planDetails.id) {
+									// console.log(response.data)
+									lotDialog.value.open(response.data);
+								} else {
+									uni.showToast({
+										icon: 'none',
+										title: '该批次不在此计划单内',
+										duration: 2000
+									})
+								}
 							} else {
 								uni.showToast({
 									icon: 'none',
-									title: '该批次不在此计划单内',
+									title: response.msg,
 									duration: 2000
 								})
 							}
+						})
+					}
+				);
+			} else {
+				// 测试时用
+				showDaywork({
+					carrierId: '1770342949090017283',
+					status: 7
+				}).then(response => {
+					if (response.code == 200) {
+						if (response.data[0].deptId !== store.curDeptDetails.deptId) {
+							uni.showToast({
+								icon: 'none',
+								title: '该批次不在当前工段',
+								duration: 2000
+							})
+							return
+						}
+						if (response.data[0].productionPlanDetailId == store.planDetails.id) {
+							console.log(response.data)
+							lotDialog.value.open(response.data);
 						} else {
 							uni.showToast({
 								icon: 'none',
-								title: response.msg,
+								title: '该批次不在此计划单内',
 								duration: 2000
 							})
 						}
-					})
-				}
-			);
-		} else {
-			// 测试时用
-			showDaywork({
-				carrierId: '1770342949090017283',
-				status: 7
-			}).then(response => {
-				if (response.code == 200) {
-					if (response.data[0].deptId !== store.curDeptDetails.deptId) {
-						uni.showToast({
-							icon: 'none',
-							title: '该批次不在当前工段',
-							duration: 2000
-						})
-						return
-					}
-					if (response.data[0].productionPlanDetailId == store.planDetails.id) {
-						console.log(response.data)
-						lotDialog.value.open(response.data);
 					} else {
+						console.log(response)
 						uni.showToast({
 							icon: 'none',
-							title: '该批次不在此计划单内',
+							title: response.msg,
 							duration: 2000
 						})
 					}
-				} else {
-					console.log(response)
-					uni.showToast({
-						icon: 'none',
-						title: response.msg,
-						duration: 2000
-					})
-				}
-			})
+				})
+			}
 		}
-	}
-*/
+	*/
 
 	function handleScanCode() {
 		// 引入原生插件
@@ -514,7 +525,9 @@
 				},
 				(ret) => {
 					console.log(ret);
-					let vehicleObj = {carrierCode: ret.resp_result};
+					let vehicleObj = {
+						carrierCode: ret.resp_result
+					};
 					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
 						uni.showToast({
 							icon: "none",
@@ -652,6 +665,17 @@
 		console.log(listData.value)
 	}
 
+	function startReport(data) {
+		getSortingDayworkItem(data).then(res => {
+			uni.showToast({
+				icon: "success",
+				title: "开始成功",
+				duration: 2000
+			})
+			init(store.planDetails.id)
+		})
+	}
+
 	function handleCancelTurnover(data) {
 		turnoverDelete(data).then(res => {
 			if (res.code == 200) {