mao 1 рік тому
батько
коміт
1f5b376261
1 змінених файлів з 23 додано та 3 видалено
  1. 23 3
      pages/reportingForWork/index.vue

+ 23 - 3
pages/reportingForWork/index.vue

@@ -108,6 +108,9 @@
 	import {
 		isCurProcessFinish
 	} from '@/api/business/dayWorkItem.js'
+	import {
+		getEquipmentByUidAndDid
+	} from '@/api/resourceGroup/resourceGroupDetail.js'
 
 	const listData = ref([]) // 回显 
 	const curPlan = ref({}) // 接收生产计划单信息 
@@ -121,6 +124,7 @@
 	const userInfo = ref(null) // 登录员工信息
 	const flag = ref(true) // 控制底部开始加工按钮功能
 	const lotInfo = ref(null) // 详情弹窗
+	const hasEquipment = ref(true) // 判断资源组是否有设备
 
 
 	onLoad(() => {
@@ -153,7 +157,7 @@
 				console.log(listData.value)
 				// 时间戳转工时
 				for (var i = 0; i < listData.value.length; i++) {
-					let timeStamp = listData.value[i].workingHours; 
+					let timeStamp = listData.value[i].workingHours;
 					listData.value[i].taskTime = toHHmmss(timeStamp);
 				}
 				flag.value = !listData.value.some(item => item.status == 0);
@@ -167,6 +171,12 @@
 				uni.hideLoading();
 			}
 		})
+
+		getEquipmentByUidAndDid(store.planDetails.id).then(equipmentRes => {
+			if (equipmentRes.code == 200) {
+				hasEquipment.value = equipmentRes.rows.length > 0 ? 'true' : 'false';
+			}
+		})
 	}
 
 	function reflush() {
@@ -212,18 +222,23 @@
 				icon: 'none',
 				title: '当前工序已完成'
 			})
+		} else if (!hasEquipment.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '当前无可用设备',
+			})
 		} else {
 			inviteUser.value.open(data);
 		}
 	}
 
 	function HandleChangevehicle() {
-		if(store.dayworkInfo.status == 4){
+		if (store.dayworkInfo.status == 4) {
 			uni.showToast({
 				icon: 'none',
 				title: '该工序已完成'
 			})
-		}else{
+		} else {
 			uni.navigateTo({
 				url: "/pages/changeBox/index"
 			})
@@ -259,6 +274,11 @@
 					icon: 'none',
 					title: '该工序已完成,不能继续报工'
 				})
+			} else if (!hasEquipment.value) {
+				uni.showToast({
+					icon: 'none',
+					title: '当前无可用设备',
+				})
 			} else {
 				selectEquipment.value.open(item);
 			}