guoyujia 4 месяцев назад
Родитель
Сommit
1a65065430
1 измененных файлов с 79 добавлено и 2 удалено
  1. 79 2
      pages/factoryInspection/form.vue

+ 79 - 2
pages/factoryInspection/form.vue

@@ -122,6 +122,18 @@
 					:localdata="range"></uni-data-checkbox>
 			</view>
 			<view v-if="editable()">
+				<view v-if="showTransfer" class="list-title uni-row" style="margin-top: 16rpx;">
+					<text class="label">是否移交仪器室</text><text>&nbsp;否</text>
+					<!-- <switch class="switch" @change="switchChange" style="transform:scale(0.7);margin-top: -16rpx;"
+						color="rgba(255,85,85,1)" /> -->
+					<zero-switch v-model="processInspecion.flag" @change="switchChange"
+						active-color="rgba(103, 195, 55, 1.0)" :size="18"
+						style="transform:scale(0.9);margin-top: -9rpx;"></zero-switch>
+					<text>是</text>
+				</view>
+				<view v-else class="list-title uni-row" style="margin-top: 16rpx;">
+					<text class="label">已经移交给仪器室</text>
+				</view>
 				<view class="list-title uni-row" style="margin-top: 16rpx;">
 					<text class="label">检测完成</text><text>&nbsp;否</text>
 					<!-- <switch :checked="isAllChecked" class="switch" :disabled="!showTransfer || processInspecion.flag"
@@ -147,6 +159,8 @@
 				</view>
 			</view>
 		</view>
+		<dialog-inspectionChamber ref='selectInspectionChamber'
+			@handleSelectInspectionChamber='handleSelectInspectionChamber'></dialog-inspectionChamber>
 	</view>
 </template>
 
@@ -168,7 +182,8 @@
 	} from '@/store/index.js'
 	import {
 		saveFactoryInspecion,
-		selectInspecion
+		selectInspecion,
+		getInstrumentRoomInspection
 	} from '@/api/business/processInspection.js'
 	import {
 		getInspectionStandardsList
@@ -180,10 +195,12 @@
 	const isEventTriggered = ref(false); // 创建一个标志位
 	const isAllChecked = ref(false)
 	const unfitInfos = ref([]) //废品信息
+	const showTransfer = ref(true)
 	const consultations = ref([]) //咨询信息
 	const flag = ref(false)
 	// 创建一个引用来存储最后一次请求的时间戳
 	const lastRequestTimestamp = ref(0);
+	const selectInspectionChamber = ref(null)
 	const processInspecion = ref({
 		remark: "",
 		rejectNum: 0,
@@ -293,6 +310,8 @@
 						});
 						console.log("res", res);
 						console.log(processInspecion.value)
+						//是否已经移交仪器室
+						getInstrumentRoomInspectionList()
 						uni.hideLoading();
 						// getInspecion();
 					} else {
@@ -345,6 +364,18 @@
 		})
 	}
 
+	function getInstrumentRoomInspectionList() {
+		getInstrumentRoomInspection(processInspecion.value).then(res => {
+			if (res.data.length > 0) {
+				showTransfer.value = false
+				// processInspecion.value.flag = true
+			} else {
+				showTransfer.value = true
+				// processInspecion.value.flag = false
+			}
+		})
+	}
+
 	function select(e) {
 		console.log(e)
 		const {
@@ -542,10 +573,44 @@
 		processInspecion.value.inspectionCarrierCode = processInspecion.value.lot.inspectionCarrierCode
 		processInspecion.value.processInspectionPictureList = selectedPhotos.value
 		console.log(processInspecion.value)
+		if (processInspecion.value.flag) {
+			//打开选择仪器室的弹窗
+			selectInspectionChamber.value.open()
+			console.log(processInspecion.value)
+		} else {
+			saveFactoryInspecion(processInspecion.value).then(res => {
+				if (res.code == 200) {
+					let index = 0;
+
+					for (let i = 0; i < pages.length; i++) {
+
+						if (pages[i].$page.fullPath == "/pages/factoryInspection/index") {
+
+							index = pages.length - i - 1;
+						}
+					}
+					console.log("index", index);
+					uni.navigateBack({
+						delta: index
+					});
+				} else {
+					uni.showToast({
+						icon: 'none',
+						title: res.msg,
+						duration: 2000
+					})
+				}
+			});
+		}
+	}
+	//仪器室带回
+	function handleSelectInspectionChamber(data) {
+		processInspecion.value.inspectionChamberId = data
+		console.log(processInspecion.value)
 		saveFactoryInspecion(processInspecion.value).then(res => {
 			if (res.code == 200) {
 				let index = 0;
-
+				let pages = getCurrentPages();
 				for (let i = 0; i < pages.length; i++) {
 
 					if (pages[i].$page.fullPath == "/pages/factoryInspection/index") {
@@ -636,6 +701,18 @@
 		})
 	}
 
+	function switchChange(event) {
+		console.log(event)
+		// if (event.detail.value) {
+		if (event) {
+			processInspecion.value.flag = true
+			processInspecion.value.isAllChecked = 0
+			isAllChecked.value = false
+		} else {
+			processInspecion.value.flag = false
+		}
+	}
+
 	// 咨询
 	const handleAddConsultation = () => {
 		console.log("9999")