Browse Source

Merge branch 'master' of https://git.7in6.com/liuhairui/mes-dacheng-admin-backend-ui

zck 6 days ago
parent
commit
e75c1124fd

+ 35 - 57
src/view/performance/WorkScoreReporting/WorkReportEntry.vue

@@ -19,8 +19,7 @@
 <script setup>
 import { ref, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
-import { ElMessage } from 'element-plus'
-import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
+import { getMachineMac } from '@/api/jixiaoguanli/jitairibaobiao'
 
 defineOptions({ name: 'WorkReportEntry' })
 
@@ -28,25 +27,18 @@ const router = useRouter()
 const Machine = ref('')
 const process = ref('')
 
-// 物理地址获取机台编号和工序
+// 物理地址获取机台编号和工序(仅用于产量报工跳转路由,失败不在此页弹错)
 const getMachineMacdata = async () => {
   try {
     const data = await getMachineMac({ sys_sbID: Machine.value })
     if (data.data === null) {
-      ElMessage({
-        type: 'warning',
-        message: '未获取到机台信息,使用默认工序'
-      })
-      process.value = '默认工序'
+      process.value = ''
       return
     }
-    process.value = data.data['生产工序']
+    process.value = data.data['生产工序'] || ''
   } catch (error) {
     console.error('获取机台信息失败:', error)
-    ElMessage({
-      type: 'error',
-      message: '获取机台信息失败'
-    })
+    process.value = ''
   }
 }
 
@@ -56,17 +48,17 @@ const GetAddr = () => {
   if (window.XMLHttpRequest) {
     xmlhttp = new XMLHttpRequest()
   } else if (window.ActiveXObject) {
-    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
+    xmlhttp = new ActiveXObject('Microsoft.XMLHTTP')
   }
-  
-  xmlhttp.onreadystatechange = function() {
+
+  xmlhttp.onreadystatechange = function () {
     if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
       try {
         const res = JSON.parse(xmlhttp.response)
         let result = ''
         for (let i = 0; i < res.macAddress.length; i++) {
           if (i % 2 === 0 && i !== 0) {
-            result += '-' // 根据实际需求修改分隔符
+            result += '-'
           }
           result += res.macAddress[i]
         }
@@ -74,51 +66,37 @@ const GetAddr = () => {
         getMachineMacdata()
       } catch (error) {
         console.error('解析物理地址失败:', error)
-        ElMessage({
-          type: 'error',
-          message: '获取物理地址失败'
-        })
+        process.value = ''
       }
     }
   }
-  
-  xmlhttp.open("get", "http://127.0.0.1:8090/init")
+
+  xmlhttp.onerror = function () {
+    process.value = ''
+  }
+
+  xmlhttp.open('get', 'http://127.0.0.1:8090/init')
   xmlhttp.send()
 }
 
-// 导航到报工页面
+const routeMap = {
+  裁剪: '/layout/baogong/caiqiebaogong',
+  车缝: '/layout/baogong/chafengbaogong',
+  后道: '/layout/baogong/houdaobaogong',
+  大烫: '/layout/baogong/datangbaogong',
+  总检: '/layout/baogong/zongjianbaogong',
+  包装: '/layout/baogong/baozhuangbaogong',
+}
+
+/** 机台未识别时的产量报工默认页(进页后再提示机台) */
+const DEFAULT_YIELD_ROUTE = '/layout/baogong/chafengbaogong'
+
+// 产量报工:始终可点进去;有工序进对应页,没有则进默认页,由目标页判断机台并提示
 const navigateToReporting = () => {
-  if (!process.value) {
-    ElMessage({
-      type: 'warning',
-      message: '请等待工序检测完成'
-    })
-    return
-  }
-  
-  // 根据工序跳转到对应页面
-  const routeMap = {
-    '裁剪': '/layout/baogong/caiqiebaogong',
-    '车缝': '/layout/baogong/chafengbaogong',
-    '后道': '/layout/baogong/houdaobaogong',
-    '大烫': '/layout/baogong/datangbaogong',
-    '总检': '/layout/baogong/zongjianbaogong',
-    '包装': '/layout/baogong/baozhuangbaogong'
-    // 可以根据实际需求添加更多工序映射
-  }
-  
-  const route = routeMap[process.value]
-  if (route) {
-    router.push(route)
-  } else {
-    ElMessage({
-      type: 'warning',
-      message: `未找到${process.value}对应的报工页面`
-    })
-  }
+  router.push(routeMap[process.value] || DEFAULT_YIELD_ROUTE)
 }
 
-// 导航到工分报工页面
+// 工分报工:直接进入,由工分页判断机台并提示
 const navigateToGongfen = () => {
   router.push('/layout/baogong/gongfenbaogong')
 }
@@ -195,20 +173,20 @@ onMounted(() => {
     height: 60%;
     width: 80%;
   }
-  
+
   .left-block,
   .right-block {
     height: 45%;
   }
-  
+
   .left-block h2,
   .right-block h2 {
     font-size: 16px;
   }
-  
+
   .left-block p,
   .right-block p {
     font-size: 12px;
   }
 }
-</style>
+</style>

+ 23 - 28
src/view/performance/WorkScoreReporting/gongfenbaogong.vue

@@ -697,7 +697,6 @@ const getMachineMacdata = async () => {
       add_formData['组别'] = ''
       add_formData['人员'] = ''
       employees.value = []
-      ElMessage.error('未获取到机台编号,请确认 MAC 地址或与管理员联系')
       return
     }
     add_formData['机台号'] = data.data['机台号']
@@ -721,7 +720,6 @@ const getMachineMacdata = async () => {
     add_formData['组别'] = ''
     add_formData['人员'] = ''
     employees.value = []
-    ElMessage.error('获取机台信息失败,请检查本机服务后刷新页面')
   }
 }
 
@@ -937,7 +935,6 @@ const openWorkScoreDialog = async () => {
   }
   const machineNo = String(add_formData['机台号'] || '').trim()
   if (!machineReady.value || !machineNo) {
-    warningres('未获取到机台信息,请确认本机 MAC 服务或与管理员联系后再报工')
     return
   }
 
@@ -1576,12 +1573,10 @@ const GetAddr =  () => {
       getMachineMacdata(Machine.value)
     } else if (xmlhttp.readyState == 4) {
       machineReady.value = false
-      ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
     }
   }
   xmlhttp.onerror = function() {
     machineReady.value = false
-    ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
   }
   // 3. 打开一个连接
   xmlhttp.open("get", "http://127.0.0.1:8090/init")
@@ -1682,6 +1677,11 @@ const add_onSubmit = async ()=>{
     warningres('请先关闭工分报工窗口后再查询其他订单,避免报错单')
     return
   }
+  const machineNo = String(add_formData['机台号'] || '').trim()
+  if (!machineReady.value || !machineNo || machineNo === '测试机台') {
+    machineTip()
+    return
+  }
   const searchKey = normalizeOrderSearchInput(add_searchInfo.value)
   if (!searchKey) {
     warningres('请扫描订单二维码')
@@ -1737,29 +1737,6 @@ const add_onSubmit = async ()=>{
   }
 };
 
-// 获取工分报工历史记录
-        await getGongfenHistory();
-
-        const searchValue = getActiveOrderNo();
-
-        // 附件加载失败不影响查询结果
-        await loadOrderAttachments(searchValue);
-
-        // 查询成功后清空搜索框,便于继续扫描下一单
-        add_searchInfo.value = '';
-        _searchInput();
-      }
-    } else {
-      warningres(response.msg || '查询失败');
-      orderInfoList.length = 0;
-      currentOrderNo.value = '';
-    }
-  } catch (error) {
-    console.error('查询订单信息失败:', error);
-    warningres('网络错误,请稍后重试');
-  }
-};
-
 // 获取工分报工历史记录
 const getGongfenHistory = async () => {
   const seq = ++historyQuerySeq
@@ -2127,6 +2104,20 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+/** 机台相关:黄色弹窗缩小版,略往下避开顶栏 */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${tip}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
 </script>
 
 <style scoped>
@@ -3314,6 +3305,10 @@ const warningres = (arr) => {
 .custom-warning-message .el-message__closeBtn {
   display: none !important;
 }
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
 
 .gy-detail-filter-popper {
   z-index: 10050 !important;

+ 67 - 17
src/view/performance/baozhuangbaogong.vue

@@ -601,6 +601,7 @@ const currentDates = `${year}-${month}-${day}`;
 const _code = '包装'
 //全局接口接受的物理地址
 const Machine = ref('')
+const machineReady = ref(false)
 //全局获取UniqId
 const UniqId = ref('')
 
@@ -610,17 +611,15 @@ const getMachineMacdata = async () => {
 	try {
 		const data = await getMachineMac({sys_sbID: Machine.value});
 		if (data.data === null) {
-			// ElMessage({
-			// 	type: 'error',
-			// 	message: '未获取到机台编号请确认MAC地址或与管理员联系'
-			// })
-			add_formData['机台号'] = '测试机台'
-			add_formData['工序'] = _code
-			add_formData['组别'] = "测试"
-			add_formData['人员'] = "测试"
-			return;
-		} else {
-			add_formData['机台号'] = data.data['机台号']
+		machineReady.value = false
+		add_formData['机台号'] = ''
+		add_formData['工序'] = ''
+		add_formData['组别'] = ''
+		add_formData['人员'] = ''
+		return;
+	} else {
+			machineReady.value = true
+	add_formData['机台号'] = data.data['机台号']
 			add_formData['工序'] = data.data['生产工序']
 			add_formData['工序名称'] = data.data['生产工序']
 			add_formData['组别'] = data.data['组别']
@@ -633,8 +632,13 @@ const getMachineMacdata = async () => {
 			}, 100); // 延迟100毫秒
 		}
 	} catch (error) {
-		console.error(error)
-	}
+    console.error(error)
+    machineReady.value = false
+    add_formData['机台号'] = ''
+    add_formData['工序'] = ''
+    add_formData['组别'] = ''
+    add_formData['人员'] = ''
+  }
 }
 //自动获取物理地址
 const GetAddr = () => {
@@ -800,6 +804,12 @@ const selectedOrder = ref(''); // 选中的订单
 
 //查询按钮
 const add_onSubmit = async() => {
+  const machineNo = String(add_formData['机台号'] || '').trim()
+    if (!machineReady.value || !machineNo || machineNo === '测试机台') {
+      machineTip()
+      return
+    }
+  
 	if(add_formData['机台号'] === ''){
 		warningres('未获取到机台')
 		return false;
@@ -1087,10 +1097,11 @@ const add_Dialog = async () => {
         isClickable = true;
     }, 2000);
 
-		if(add_formData['机台号'] === '测试机台'){
-			warningres('测试机台禁止报工')
-			return;
-		}
+		const _machineNo = String(add_formData['机台号'] || '').trim()
+	if (!machineReady.value || !_machineNo || _machineNo === '测试机台') {
+		machineTip()
+		return
+	}
 		sizeDatas.length = 0;
 		add_tableData.length = 0;
 		// console.log(_serial.value)
@@ -1540,6 +1551,22 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+
+/** 机台未获取统一黄字提示(查询时) */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${tip}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
+
 </script>
 <style scoped>
 	:deep(.el-table__body .status-plan-usage-low) {
@@ -2088,3 +2115,26 @@ const warningres = (arr) => {
 	  font-weight: bold;
 	}
 </style>
+
+<style>
+.custom-warning-message {
+  background: transparent !important;
+  border: none !important;
+  box-shadow: none !important;
+  padding: 0 !important;
+}
+.custom-warning-message .el-message__content {
+  padding: 0 !important;
+  line-height: 1 !important;
+}
+.custom-warning-message .el-message__icon {
+  display: none !important;
+}
+.custom-warning-message .el-message__closeBtn {
+  display: none !important;
+}
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
+</style>

+ 61 - 11
src/view/performance/caiqiebaogong.vue

@@ -344,6 +344,7 @@ const add_searchInfo = ref('')
 const _code = '裁剪'
 //全局接口接受的物理地址
 const Machine = ref('')
+const machineReady = ref(false)
 //全局获取UniqId
 const UniqId = ref('')
 
@@ -352,16 +353,14 @@ const getMachineMacdata = async () => {
   try {
     const data  = await getMachineMac({sys_sbID:Machine.value});
 	if (data.data === null) {
-		// ElMessage({
-		// 	type: 'error',
-		// 	message: '未获取到机台编号请确认MAC地址或与管理员联系'
-		// })
-		add_formData['机台号'] = '测试机台'
-		add_formData['工序'] = _code
-		add_formData['组别'] = "测试"
-		add_formData['人员'] = "测试"
+		machineReady.value = false
+		add_formData['机台号'] = ''
+		add_formData['工序'] = ''
+		add_formData['组别'] = ''
+		add_formData['人员'] = ''
 		return;
 	}
+	machineReady.value = true
 	add_formData['机台号'] = data.data['机台号']
 	add_formData['工序'] = data.data['生产工序']
 	add_formData['组别'] = data.data['组别']
@@ -374,6 +373,11 @@ const getMachineMacdata = async () => {
 	}, 100); // 延迟100毫秒
   } catch (error) {
     console.error(error)
+    machineReady.value = false
+    add_formData['机台号'] = ''
+    add_formData['工序'] = ''
+    add_formData['组别'] = ''
+    add_formData['人员'] = ''
   }
 }
 //自动获取物理地址
@@ -506,6 +510,12 @@ const _list = ref('');
 
 //查询
 const add_onSubmit = async ()=>{
+  const machineNo = String(add_formData['机台号'] || '').trim()
+    if (!machineReady.value || !machineNo || machineNo === '测试机台') {
+      machineTip()
+      return
+    }
+  
   if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
 	const WorkListdata = [];
 	// add_tableData.splice(0,add_tableData.length,...WorkListdata);
@@ -653,9 +663,10 @@ const add_Dialog = async () => {
     }, 2000);
 
 
-	if(add_formData['机台号'] === '测试机台'){
-		warningres('测试机台禁止报工')
-		return;
+	const _machineNo = String(add_formData['机台号'] || '').trim()
+	if (!machineReady.value || !_machineNo || _machineNo === '测试机台') {
+		machineTip()
+		return
 	}
 	if (!add_formData['机台号']) {
 		warningres('未获取到机台')
@@ -904,6 +915,22 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+
+/** 机台未获取统一黄字提示(查询时) */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${tip}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
+
 </script>
 
 <style scoped>
@@ -1211,3 +1238,26 @@ const warningres = (arr) => {
 }
 
 </style>
+
+<style>
+.custom-warning-message {
+  background: transparent !important;
+  border: none !important;
+  box-shadow: none !important;
+  padding: 0 !important;
+}
+.custom-warning-message .el-message__content {
+  padding: 0 !important;
+  line-height: 1 !important;
+}
+.custom-warning-message .el-message__icon {
+  display: none !important;
+}
+.custom-warning-message .el-message__closeBtn {
+  display: none !important;
+}
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
+</style>

+ 40 - 7
src/view/performance/chafengbaogong.vue

@@ -469,7 +469,6 @@ const UniqId = ref('')
 				add_formData['工序名称'] = ''
 				add_formData['组别'] = ''
 				add_formData['人员'] = ''
-				ElMessage.error('未获取到机台编号,请确认 MAC 地址或与管理员联系')
 				return;
 			} else {
 				add_formData['机台号'] = data.data['机台号']
@@ -493,7 +492,6 @@ const UniqId = ref('')
 			add_formData['工序名称'] = ''
 			add_formData['组别'] = ''
 			add_formData['人员'] = ''
-			ElMessage.error('获取机台信息失败,请检查本机服务后刷新页面')
 		}
 	}
 	//自动获取物理地址
@@ -520,12 +518,10 @@ const UniqId = ref('')
 				getMachineMacdata(Machine.value)
 			} else if (xmlhttp.readyState == 4) {
 				machineReady.value = false
-				ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
 			}
 		}
 		xmlhttp.onerror = function() {
 			machineReady.value = false
-			ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
 		}
 		// 3. 打开一个连接
 		xmlhttp.open("get", "http://127.0.0.1:8090/init")
@@ -656,7 +652,7 @@ const showPdf = async (row) => {
 	const add_onSubmit = async () => {
 		const machineNo = String(add_formData['机台号'] || '').trim()
 		if (!machineReady.value || !machineNo || machineNo === '测试机台') {
-			warningres('未获取到机台,请确认本机 MAC 服务或与管理员联系后再查询')
+			machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 			return false;
 		}
 		if(add_searchInfo.value === ''){
@@ -789,7 +785,7 @@ const add_Dialog = async () => {
 
 		const machineNo = String(add_formData['机台号'] || '').trim()
 		if (!machineReady.value || !machineNo || machineNo === '测试机台') {
-			warningres("未获取到机台,禁止报工")
+			machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 			return;
 		}
 		sizeDatas.length = 0;
@@ -1223,7 +1219,7 @@ const errorres = (arr) => {
     });
 }
 
-// 警告
+// 警告(大号,报工等场景)
 const warningres = (arr) => {
     ElMessage({
         type: '',
@@ -1233,6 +1229,20 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+/** 机台相关提示:沿用黄色弹窗样式,字号/内边距缩小 */
+const machineTip = (msg) => {
+  const text = msg || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${text}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
 </script>
 <style scoped>
 	:deep(.el-table__body .status-plan-usage-low) {
@@ -1751,3 +1761,26 @@ const warningres = (arr) => {
 	  border-color: #f5c6cb;
 	}
 </style>
+
+<style>
+.custom-warning-message {
+  background: transparent !important;
+  border: none !important;
+  box-shadow: none !important;
+  padding: 0 !important;
+}
+.custom-warning-message .el-message__content {
+  padding: 0 !important;
+  line-height: 1 !important;
+}
+.custom-warning-message .el-message__icon {
+  display: none !important;
+}
+.custom-warning-message .el-message__closeBtn {
+  display: none !important;
+}
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
+</style>

+ 60 - 6
src/view/performance/datangbaogong.vue

@@ -328,6 +328,7 @@ const _code = '大烫'
 const _gx = '5'
 //全局接口接受的物理地址
 const Machine = ref('')
+const machineReady = ref(false)
 //全局获取UniqId
 const UniqId = ref('')
 //全局获取工序名称
@@ -350,12 +351,14 @@ const getMachineMacdata = async () => {
   try {
     const data  = await getMachineMac({sys_sbID:Machine.value});
 	if (data.data === null) {
-		add_formData['机台号'] = '测试机台'
+		machineReady.value = false
+		add_formData['机台号'] = ''
 		add_formData['工序'] = "测试"
-		add_formData['组别'] = "测试"
-		add_formData['人员'] = "测试"
+		add_formData['组别'] = ''
+		add_formData['人员'] = ''
 		return;
 	}
+	machineReady.value = true
 	add_formData['机台号'] = data.data['机台号']
 	add_formData['工序'] = data.data['生产工序']
 	add_formData['组别'] = data.data['组别']
@@ -368,6 +371,11 @@ const getMachineMacdata = async () => {
 	 }, 100); // 延迟100毫秒
   } catch (error) {
     console.error(error)
+    machineReady.value = false
+    add_formData['机台号'] = ''
+    add_formData['工序'] = ''
+    add_formData['组别'] = ''
+    add_formData['人员'] = ''
   }
 }
 //自动获取物理地址
@@ -423,6 +431,12 @@ const ddtableData = reactive([])
 
 // 查询按钮
 const add_onSubmit = async ()=>{
+  const machineNo = String(add_formData['机台号'] || '').trim()
+    if (!machineReady.value || !machineNo || machineNo === '测试机台') {
+      machineTip()
+      return
+    }
+  
 	if(add_formData['机台号'] === ''){
 		warningres('未获取到机台');
 		return false;
@@ -569,9 +583,10 @@ const currentSlValue=ref('')
 
 //报工
 const add_Dialog = async ()=>{
-	if(add_formData['机台号'] === '测试机台'){
-		warningres('测试机台禁止报工');
-		return;
+	const _machineNo = String(add_formData['机台号'] || '').trim()
+	if (!machineReady.value || !_machineNo || _machineNo === '测试机台') {
+		machineTip()
+		return
 	}
  if(add_formData['上报数量'] === ''){
     warningres('上报数量为空,请填写上报数量');
@@ -770,6 +785,22 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+
+/** 机台未获取统一黄字提示(查询时) */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${tip}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
+
 </script>
 <style scoped>
 .form-container {
@@ -925,3 +956,26 @@ margin-bottom: 5px;
   color: red;
 } 
 </style>
+
+<style>
+.custom-warning-message {
+  background: transparent !important;
+  border: none !important;
+  box-shadow: none !important;
+  padding: 0 !important;
+}
+.custom-warning-message .el-message__content {
+  padding: 0 !important;
+  line-height: 1 !important;
+}
+.custom-warning-message .el-message__icon {
+  display: none !important;
+}
+.custom-warning-message .el-message__closeBtn {
+  display: none !important;
+}
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
+</style>

+ 60 - 6
src/view/performance/houdaoshougong.vue

@@ -330,6 +330,7 @@ const _code = '手工'
 const _gx = '4'
 //全局接口接受的物理地址
 const Machine = ref('')
+const machineReady = ref(false)
 //全局获取UniqId
 const UniqId = ref('')
 //全局获取工序名称
@@ -354,12 +355,14 @@ const getMachineMacdata = async () => {
   try {
     const data  = await getMachineMac({sys_sbID:Machine.value});
 	if (data.data === null) {
-		add_formData['机台号'] = '测试机台'
+		machineReady.value = false
+		add_formData['机台号'] = ''
 		add_formData['工序'] = "测试"
-		add_formData['组别'] = "测试"
-		add_formData['人员'] = "测试"
+		add_formData['组别'] = ''
+		add_formData['人员'] = ''
 		return;
 	}
+	machineReady.value = true
 	add_formData['机台号'] = data.data['机台号']
 	add_formData['工序'] = data.data['生产工序']
 	add_formData['组别'] = data.data['组别']
@@ -372,6 +375,11 @@ const getMachineMacdata = async () => {
 	 }, 100); // 延迟100毫秒
   } catch (error) {
     console.error(error)
+    machineReady.value = false
+    add_formData['机台号'] = ''
+    add_formData['工序'] = ''
+    add_formData['组别'] = ''
+    add_formData['人员'] = ''
   }
 }
 //自动获取物理地址
@@ -427,6 +435,12 @@ const ddtableData = reactive([])
 
 // 查询按钮
 const add_onSubmit = async ()=>{
+  const machineNo = String(add_formData['机台号'] || '').trim()
+    if (!machineReady.value || !machineNo || machineNo === '测试机台') {
+      machineTip()
+      return
+    }
+  
 	if(add_formData['机台号'] === ''){
 		warningres('未获取到机台')
 		return false;
@@ -587,9 +601,10 @@ const add_Dialog = async () => {
         isClickable = true;
     }, 2000);
 
-	if(add_formData['机台号'] === '测试机台'){
-		warningres('测试机台禁止报工')
-		return;
+	const _machineNo = String(add_formData['机台号'] || '').trim()
+	if (!machineReady.value || !_machineNo || _machineNo === '测试机台') {
+		machineTip()
+		return
 	}
  if(add_formData['上报数量'] === ''){
 	warningres('上报数量为空,请填写上报数量')
@@ -822,6 +837,22 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+
+/** 机台未获取统一黄字提示(查询时) */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${tip}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
+
 </script>
 <style scoped>
 .form-container {
@@ -977,3 +1008,26 @@ margin-bottom: 5px;
   color: red;
 } 
 </style>
+
+<style>
+.custom-warning-message {
+  background: transparent !important;
+  border: none !important;
+  box-shadow: none !important;
+  padding: 0 !important;
+}
+.custom-warning-message .el-message__content {
+  padding: 0 !important;
+  line-height: 1 !important;
+}
+.custom-warning-message .el-message__icon {
+  display: none !important;
+}
+.custom-warning-message .el-message__closeBtn {
+  display: none !important;
+}
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
+</style>

+ 67 - 17
src/view/performance/zongjianbaogong.vue

@@ -601,6 +601,7 @@ const currentDates = `${year}-${month}-${day}`;
 const _code = '总检'
 //全局接口接受的物理地址
 const Machine = ref('')
+const machineReady = ref(false)
 //全局获取UniqId
 const UniqId = ref('')
 
@@ -610,17 +611,15 @@ const getMachineMacdata = async () => {
 	try {
 		const data = await getMachineMac({sys_sbID: Machine.value});
 		if (data.data === null) {
-			// ElMessage({
-			// 	type: 'error',
-			// 	message: '未获取到机台编号请确认MAC地址或与管理员联系'
-			// })
-			add_formData['机台号'] = '测试机台'
-			add_formData['工序'] = _code
-			add_formData['组别'] = "测试"
-			add_formData['人员'] = "测试"
-			return;
-		} else {
-			add_formData['机台号'] = data.data['机台号']
+		machineReady.value = false
+		add_formData['机台号'] = ''
+		add_formData['工序'] = ''
+		add_formData['组别'] = ''
+		add_formData['人员'] = ''
+		return;
+	} else {
+			machineReady.value = true
+	add_formData['机台号'] = data.data['机台号']
 			add_formData['工序'] = data.data['生产工序']
 			add_formData['工序名称'] = data.data['生产工序']
 			add_formData['组别'] = data.data['组别']
@@ -633,8 +632,13 @@ const getMachineMacdata = async () => {
 			}, 100); // 延迟100毫秒
 		}
 	} catch (error) {
-		console.error(error)
-	}
+    console.error(error)
+    machineReady.value = false
+    add_formData['机台号'] = ''
+    add_formData['工序'] = ''
+    add_formData['组别'] = ''
+    add_formData['人员'] = ''
+  }
 }
 //自动获取物理地址
 const GetAddr = () => {
@@ -795,6 +799,12 @@ const selectedOrder = ref(''); // 选中的订单
 
 //查询按钮
 const add_onSubmit = async() => {
+  const machineNo = String(add_formData['机台号'] || '').trim()
+    if (!machineReady.value || !machineNo || machineNo === '测试机台') {
+      machineTip()
+      return
+    }
+  
 	if(add_formData['机台号'] === ''){
 		warningres('未获取到机台')
 		return false;
@@ -1076,10 +1086,11 @@ const add_Dialog = async () => {
         isClickable = true;
     }, 2000);
 
-		if(add_formData['机台号'] === '测试机台'){
-			warningres('测试机台禁止报工')
-			return;
-		}
+		const _machineNo = String(add_formData['机台号'] || '').trim()
+	if (!machineReady.value || !_machineNo || _machineNo === '测试机台') {
+		machineTip()
+		return
+	}
 		sizeDatas.length = 0;
 		add_tableData.length = 0;
 		// console.log(_serial.value)
@@ -1529,6 +1540,22 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+
+/** 机台未获取统一黄字提示(查询时) */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    offset: 110,
+    message: `<strong style="font-size: 28px; color: black; background-color: #f5ff2f; padding: 14px 36px; line-height: 1.4; text-align: center; display: inline-block; border-radius: 4px;">${tip}</strong>`,
+    customClass: 'custom-warning-message machine-tip-msg',
+  })
+}
+
 </script>
 <style scoped>
 	:deep(.el-table__body .status-plan-usage-low) {
@@ -2077,3 +2104,26 @@ const warningres = (arr) => {
 	  font-weight: bold;
 	}
 </style>
+
+<style>
+.custom-warning-message {
+  background: transparent !important;
+  border: none !important;
+  box-shadow: none !important;
+  padding: 0 !important;
+}
+.custom-warning-message .el-message__content {
+  padding: 0 !important;
+  line-height: 1 !important;
+}
+.custom-warning-message .el-message__icon {
+  display: none !important;
+}
+.custom-warning-message .el-message__closeBtn {
+  display: none !important;
+}
+.machine-tip-msg.el-message {
+  left: 68% !important;
+  transform: translateX(-50%) !important;
+}
+</style>