mao 1 anno fa
parent
commit
975e3627a0

+ 1 - 0
api/base/path.js

@@ -1,3 +1,4 @@
 const baseURL = 'http://192.168.31.216:8099'
+// const baseURL = 'http://192.168.1.181:8099'
 
 export default baseURL

+ 3 - 14
components/dialog-confirm/dialog-confirm.vue

@@ -22,26 +22,15 @@
 	const baseDialog = ref(null)
 	const message = ref('')
 	const reqParam = ref({})
-	const emit = defineEmits(['reflush'])
+	const emit = defineEmits(['submit'])
 
-	function open(msg, data) {
+	function open(msg) {
 		message.value = msg;
-		reqParam.value = data;
 		baseDialog.value.open();
 	}
 
 	function handleConfirm() {
-		saveUserequipment(reqParam.value).then(res => {
-			if (res.code === 200) {
-				uni.showToast({
-					icon: "success",
-					title: "设备绑定成功"
-				})
-				
-			}
-			
-		})
-		emit('reflush');
+		emit('submit');
 		close();
 	}
 

+ 0 - 1
components/dialog-end-work/dialog-end-work.vue

@@ -50,7 +50,6 @@
 	])
 	const workInfo = ref({})
 	const open = (data) => {
-		// console.log(dialog.value)
 		workInfo.value.dayworkId = data.dayworkId;
 		workInfo.value.id = data.id;
 		baseDialog.value.open()

+ 6 - 5
pages/addNewBatch/index.vue

@@ -165,26 +165,27 @@
 		dayWork.value.dayworkCarriers = vehicleList.value;
 		console.log(dayWork.value)
 		saveDayWork(dayWork.value).then(res => {
+			console.log(res)
 			if (res.code === 200) {
 				uni.showToast({
 					icon: 'success',
 					title: '添加成功',
 					duration: 2000
 				});
+				uni.$emit('addBatch')
 				uni.navigateTo({
 					url: '/pages/batchReporting/index'
 				})
-				let pages = getCurrentPages(); //当前页面栈
-				if (pages.length > 1) {
-					let beforePage = pages[pages.length - 2]; //获取上一个页面实例对象
-					beforePage.$vm.init(curSubPlan.value.id); //触发上一个页面中的方法,并传过去当前的值
-				}
 			} else {
 				uni.showToast({
 					icon: 'error',
 					title: '添加失败',
 					duration: 2000
 				});
+				uni.$emit('addBatch')
+				uni.navigateBack({
+					url: '/pages/batchReporting/index'
+				})
 			}
 		})
 	}

+ 6 - 2
pages/batchReporting/index.vue

@@ -80,15 +80,19 @@
 	const curSubPlan = ref({})
 
 	onLoad((options) => {
-		curSubPlan.value = JSON.parse(options.currentSubPlan);
+		curSubPlan.value = JSON.parse(options?.currentSubPlan || {});
 		console.log(curSubPlan.value)
 		init(curSubPlan.value.id);
+		uni.$on('batchReportingaddBatch',() =>{
+			console.log("111111111111111111")
+			init(curSubPlan.value.id);
+		})
 	})
 	const handleShowTurnoverApplication = (data) => {
 		let _data = data ?? {}
 		// 调用子组件中的方法
 		turnoverApplicationDialog.value.open(_data)
-	}
+	} 
 	const handleShowLotDialog = (data) => {
 		if (data.length > 0) {
 			lotDialog.value.open(data)

+ 12 - 7
pages/equipmentList/index.vue

@@ -12,7 +12,7 @@
 			<button class="btn" @click="handleScanCode">扫码</button>
 		</view>
 	</view>
-	<dialog-confirm ref="confirm" @reflush="reflush"></dialog-confirm>
+	<dialog-confirm ref="confirm" @submit="handleConfirmUnbind" @reflush="reflush"></dialog-confirm>
 </template>
 
 <script setup>
@@ -59,7 +59,7 @@
 			getEquipmentUserList(data).then(res => {
 				curBindDetails.value = res.rows;
 				for (var i = 0; i < curBindDetails.value.length; i++) {
-					curBindEquipmentIds.value.push(curBindDetails.value[i].equipmentDetailId)
+					curBindEquipmentIds?.value.push(curBindDetails.value[i].equipmentDetailId)
 				}
 			})
 		})
@@ -69,9 +69,12 @@
 	 * 刷新
 	 */
 	function reflush(){
-		console.log('111111111111111111111111111113')
 		init();
 	}
+	
+	function handleConfirmUnbind(){
+		handleSaveInfo();
+	}
 
 	/**
 	 *  长按显示解绑按钮
@@ -115,13 +118,15 @@
 					}
 				}
 				// 设置绑定员工的信息
-				userEquipmentData.value = JSON.parse(res.result);
-				userEquipmentData.value.userId = userInfo.value.userId;
-				userEquipmentData.value.nickName = userInfo.value.nickName;
+				userEquipmentData.value = {
+					...JSON.parse(res.result), 
+					userId: userInfo.value.userId,
+					nickName: userInfo.value.nickName
+				}
 				// 判断该设备是否分配给改员工
 				if (!curBindEquipmentIds.value.includes(equipment.equipmentId)) {
 					let msg = '当前员工没有分配到该设备,确定继续绑定吗?';		 
-					confirm.value.open(msg,userEquipmentData.value);
+					confirm.value.open(msg);
 				}else{
 					handleSaveInfo();
 				}