ezhizao_zx 7 月之前
父節點
當前提交
cab4d1584e

+ 4 - 4
pages/auxiliaryDaywork/form.vue

@@ -59,8 +59,8 @@
 					<!-- <view class="add-btn" v-if="editable()"
 					<!-- <view class="add-btn" v-if="editable()"
 						style="height: 80rpx;background-color: #393cfc;color: #ffffff;text-align: center;justify-content: center;align-items: center;border-radius: 8rpx;"
 						style="height: 80rpx;background-color: #393cfc;color: #ffffff;text-align: center;justify-content: center;align-items: center;border-radius: 8rpx;"
 						@click="() => addReject(item, index)">废品信息</view> -->
 						@click="() => addReject(item, index)">废品信息</view> -->
-					<button v-if="editable()" @click="() => addReject(item, index)" size="mini"
-						type="primary">废品信息</button>
+					<button v-if="editable()" @click="() => addReject(item, index)" size="mini" type="primary"
+						style="z-index: 50;">废品信息</button>
 				</view>
 				</view>
 				<view class="resu uni-row">
 				<view class="resu uni-row">
 					<view class="label">报工人</view>
 					<view class="label">报工人</view>
@@ -298,7 +298,7 @@
 
 
 		let sumReject = 0
 		let sumReject = 0
 		unfitInfos.value.forEach(v => {
 		unfitInfos.value.forEach(v => {
-			sumReject += Number(v.rejectNum)
+			sumReject += v.rejectNum != null ? Number(v.rejectNum) : 0
 		})
 		})
 		auxiliaryDayworkItem.value.rejectNum = sumReject
 		auxiliaryDayworkItem.value.rejectNum = sumReject
 		endSave();
 		endSave();
@@ -401,7 +401,7 @@
 		currentItem.value.rejectList = data.filter(e => e.reason != null && e.reason != '')
 		currentItem.value.rejectList = data.filter(e => e.reason != null && e.reason != '')
 		let rejectNum = 0
 		let rejectNum = 0
 		currentItem.value.rejectList.forEach(l => {
 		currentItem.value.rejectList.forEach(l => {
-			rejectNum += Number(l.rejectNum)
+			rejectNum += l.rejectNum != null ? Number(l.rejectNum) : 0
 		})
 		})
 		currentItem.value.rejectNum = rejectNum
 		currentItem.value.rejectNum = rejectNum
 		rejectNumberChange()
 		rejectNumberChange()

+ 38 - 19
pages/outsourcedInspection/form.vue

@@ -156,7 +156,7 @@
 				</view>
 				</view>
 			</view>
 			</view>
 			<view>
 			<view>
-				<zb-table :columns="getRelateList()" :stripe="true" :fit="true" @dele="dele"
+				<zb-table :columns="getRelateList()" :stripe="true" :fit="false" @dele="dele"
 					:data="processInspecion.relateList"></zb-table>
 					:data="processInspecion.relateList"></zb-table>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -198,7 +198,7 @@
 			</view>
 			</view>
 
 
 			<view class="btns-container uni-row">
 			<view class="btns-container uni-row">
-				<view v-if="editable()" class="finished-btn" @click="endWork">结束报工</view>
+				<view v-if="editable() && navigateOnce== 0" class="finished-btn" @click="endWork">结束报工</view>
 				<view v-if="editable()" class="question-btn uni-column" @click.stop="handleAddConsultation">
 				<view v-if="editable()" class="question-btn uni-column" @click.stop="handleAddConsultation">
 					<uni-icons type="headphones" size="24" />
 					<uni-icons type="headphones" size="24" />
 					<text>咨询</text>
 					<text>咨询</text>
@@ -245,11 +245,13 @@
 	const consultations = ref([]) //咨询信息
 	const consultations = ref([]) //咨询信息
 	const flag = ref(false)
 	const flag = ref(false)
 	const showTransfer = ref(true)
 	const showTransfer = ref(true)
+	const navigateOnce = ref(0)
 	const processInspecion = ref({
 	const processInspecion = ref({
 		remark: "",
 		remark: "",
 		rejectNum: 0,
 		rejectNum: 0,
 		examiningNum: 0,
 		examiningNum: 0,
 		status: 0,
 		status: 0,
+		lot: {}
 	})
 	})
 	const editRelate = ref(false)
 	const editRelate = ref(false)
 	const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
 	const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
@@ -265,17 +267,19 @@
 			name: 'lotCode',
 			name: 'lotCode',
 			label: '批号',
 			label: '批号',
 			align: 'center',
 			align: 'center',
-			width: 200
+			width: 100
 		},
 		},
 		{
 		{
 			name: 'allCarriers',
 			name: 'allCarriers',
 			label: '箱号',
 			label: '箱号',
-			align: 'center'
+			align: 'center',
+			width: 80
 		},
 		},
 		{
 		{
 			name: 'isMaster',
 			name: 'isMaster',
 			label: '主检查单',
 			label: '主检查单',
 			align: 'center',
 			align: 'center',
+			width: 60,
 			filters: {
 			filters: {
 				0: '否',
 				0: '否',
 				1: '是'
 				1: '是'
@@ -286,6 +290,7 @@
 			type: 'operation',
 			type: 'operation',
 			label: '关联',
 			label: '关联',
 			align: 'center',
 			align: 'center',
+			width: 60,
 			renders: [{
 			renders: [{
 				name: '删除',
 				name: '删除',
 				type: 'warn',
 				type: 'warn',
@@ -377,13 +382,18 @@
 	})
 	})
 
 
 	onLoad(() => {
 	onLoad(() => {
-		// uni.$off('addWasteInfoEvent');
+		navigateOnce.value = 0
+		uni.$off('addWasteInfoEvent');
 		if (!flag.value) {
 		if (!flag.value) {
 			if (store.processInspection != null) {
 			if (store.processInspection != null) {
 				uni.showLoading({
 				uni.showLoading({
 					title: '加载中'
 					title: '加载中'
 				});
 				});
-				processInspecion.value = store.processInspection
+				console.log(store.processInspection)
+				processInspecion.value = {
+					...store.processInspection,
+					lot: {}
+				}
 				selectOutsourcedInspecion(processInspecion.value).then(res => {
 				selectOutsourcedInspecion(processInspecion.value).then(res => {
 					console.log("res", res);
 					console.log("res", res);
 					if (res.code == 200) {
 					if (res.code == 200) {
@@ -680,7 +690,11 @@
 					// 	delta: index
 					// 	delta: index
 					// }
 					// }
 					// );
 					// );
-					uni.navigateBack()
+					if (navigateOnce.value == 0) {
+						navigateOnce.value = 1
+						uni.navigateBack()
+					}
+
 				} else {
 				} else {
 					uni.showToast({
 					uni.showToast({
 						icon: 'none',
 						icon: 'none',
@@ -695,7 +709,7 @@
 	function handleSelectInspectionChamber(data) {
 	function handleSelectInspectionChamber(data) {
 		processInspecion.value.inspectionChamberId = data
 		processInspecion.value.inspectionChamberId = data
 		console.log(processInspecion.value)
 		console.log(processInspecion.value)
-		saveOutsourcedInspecion(processInspecion.value).then(res => {
+		saveOutsourceInspectionWithRelate(processInspecion.value).then(res => {
 			if (res.code == 200) {
 			if (res.code == 200) {
 				// let index = 0;
 				// let index = 0;
 				// let pages = getCurrentPages();
 				// let pages = getCurrentPages();
@@ -712,7 +726,10 @@
 				// 		delta: index
 				// 		delta: index
 				// 	}
 				// 	}
 				// );
 				// );
-				uni.navigateBack()
+				if (navigateOnce.value == 0) {
+					navigateOnce.value = 1
+					uni.navigateBack()
+				}
 			} else {
 			} else {
 				uni.showToast({
 				uni.showToast({
 					icon: 'none',
 					icon: 'none',
@@ -797,7 +814,7 @@
 		unfitInfos.value.push(info)
 		unfitInfos.value.push(info)
 		console.log(data)
 		console.log(data)
 
 
-		uni.$off('addWasteInfoEvent')
+		// uni.$off('addWasteInfoEvent')
 	}
 	}
 	// 删除不合格信息
 	// 删除不合格信息
 	const handleDelWaste = (index) => {
 	const handleDelWaste = (index) => {
@@ -816,17 +833,19 @@
 	}
 	}
 
 
 	const addRelate = (relates) => {
 	const addRelate = (relates) => {
+		isEventTriggered.value = true;
 		processInspecion.value.relateList = relates
 		processInspecion.value.relateList = relates
-		uni.$off('relateEvent')
+		// uni.$off('relateEvent')
 	}
 	}
 
 
 	const handleAddLot = () => {
 	const handleAddLot = () => {
 		console.log('添加关联')
 		console.log('添加关联')
+		isEventTriggered.value = false;
 		uni.$once('relateEvent', (data) => {
 		uni.$once('relateEvent', (data) => {
-			// if (!isEventTriggered.value) {
-			// 如果事件尚未触发,则执行事件触发逻辑
-			addRelate(data)
-			// }
+			if (!isEventTriggered.value) {
+				// 如果事件尚未触发,则执行事件触发逻辑
+				addRelate(data)
+			}
 			// uni.$off('relateEvent')
 			// uni.$off('relateEvent')
 		})
 		})
 		uni.navigateTo({
 		uni.navigateTo({
@@ -844,10 +863,10 @@
 		isEventTriggered.value = false;
 		isEventTriggered.value = false;
 		// 监听事件
 		// 监听事件
 		uni.$once('wasteConsultationEvent', (data) => {
 		uni.$once('wasteConsultationEvent', (data) => {
-			// if (!isEventTriggered.value) {
-			// 如果事件尚未触发,则执行事件触发逻辑
-			addConsultation(data)
-			// }
+			if (!isEventTriggered.value) {
+				// 如果事件尚未触发,则执行事件触发逻辑
+				addConsultation(data)
+			}
 			// uni.$off('wasteConsultationEvent')
 			// uni.$off('wasteConsultationEvent')
 		})
 		})
 
 

+ 7 - 3
pages/outsourcedInspection/relate.vue

@@ -2,7 +2,8 @@
 	<view class="uni-column" style="padding: 24rpx">
 	<view class="uni-column" style="padding: 24rpx">
 		<view class="consultation-container ">
 		<view class="consultation-container ">
 			<view>
 			<view>
-				<zb-table :columns="relateColumn" :stripe="true" :fit="true" @dele="dele" :data="relateList"></zb-table>
+				<zb-table :columns="relateColumn" :stripe="true" :fit="false" @dele="dele"
+					:data="relateList"></zb-table>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class='btn uni-row'>
 		<view class='btn uni-row'>
@@ -57,17 +58,19 @@
 			name: 'lotCode',
 			name: 'lotCode',
 			label: '批号',
 			label: '批号',
 			align: 'center',
 			align: 'center',
-			width: 200
+			width: 100
 		},
 		},
 		{
 		{
 			name: 'allCarriers',
 			name: 'allCarriers',
 			label: '箱号',
 			label: '箱号',
 			align: 'center',
 			align: 'center',
+			width: 60
 		},
 		},
 		{
 		{
 			name: 'isMaster',
 			name: 'isMaster',
 			label: '主检查单',
 			label: '主检查单',
 			align: 'center',
 			align: 'center',
+			width: 80,
 			filters: {
 			filters: {
 				0: '否',
 				0: '否',
 				1: '是'
 				1: '是'
@@ -78,13 +81,14 @@
 			type: 'operation',
 			type: 'operation',
 			label: '关联',
 			label: '关联',
 			align: 'center',
 			align: 'center',
+			width: 60,
 			renders: [{
 			renders: [{
 				name: '删除',
 				name: '删除',
 				type: 'warn',
 				type: 'warn',
 				func: "dele",
 				func: "dele",
 				class: "buttonOp"
 				class: "buttonOp"
 			}, ]
 			}, ]
-		},
+		}
 	])
 	])
 	onShow(() => {
 	onShow(() => {
 		init()
 		init()

+ 22 - 4
pages/outsourcedInspection/scan.vue

@@ -196,10 +196,11 @@
 										...res.data,
 										...res.data,
 										processNames: res.data.processList
 										processNames: res.data.processList
 									};
 									};
+									console.log(lot.value.hasInspection)
 									lot.value.carrierCode = result.carrierCode
 									lot.value.carrierCode = result.carrierCode
 									carrierCode.value = result.carrierCode;
 									carrierCode.value = result.carrierCode;
-									lot.value.inspectionCarrierId = '1803605009546395652'
-									lot.value.inspectionCarrierCode = "300041"
+									lot.value.inspectionCarrierId = '1846793994481221640'
+									lot.value.inspectionCarrierCode = "300250"
 									// console.log("res", res);
 									// console.log("res", res);
 									uni.hideLoading();
 									uni.hideLoading();
 									// 判断是否批次号和检查箱码都扫完
 									// 判断是否批次号和检查箱码都扫完
@@ -392,9 +393,25 @@
 			return
 			return
 		}
 		}
 		// 保存
 		// 保存
+		if (lot.value.hasInspection == 1) {
+			uni.showModal({
+				title: '提示',
+				content: `该批次已做过检查是否继续?`,
+				success: function(res) {
+					if (res.confirm) {
+						confirmThen()
+					} else if (res.cancel) {}
+				}
+			})
+		} else {
+			confirmThen()
+		}
 
 
-		const currentTime = Date.now();
 
 
+	}
+
+	function confirmThen() {
+		const currentTime = Date.now();
 		// 检查是否已经过去了 2 秒
 		// 检查是否已经过去了 2 秒
 		if (currentTime - lastRequestTimestamp.value < 2000) {
 		if (currentTime - lastRequestTimestamp.value < 2000) {
 			// 如果在 2 秒 内已经点击,那么不执行
 			// 如果在 2 秒 内已经点击,那么不执行
@@ -420,7 +437,8 @@
 			if (res.code == 200) {
 			if (res.code == 200) {
 				let index = 0;
 				let index = 0;
 				for (let i = 0; i < pages.length; i++) {
 				for (let i = 0; i < pages.length; i++) {
-					if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
+					if (pages[i].$page.fullPath ==
+						"/pages/outsourcedInspection/index") {
 						index = pages.length - i - 1;
 						index = pages.length - i - 1;
 					}
 					}
 				}
 				}