m0_70156489 2 days ago
parent
commit
3e7d84d705

+ 65 - 52
src/view/performance/WorkScoreReporting/WorkReportEntry.vue

@@ -20,33 +20,39 @@
 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' })
 
 const router = useRouter()
 const Machine = ref('')
 const process = ref('')
+const MACHINE_TIP = '未获取到机台编号,重启电脑或重新打开系统尝试'
+
+/** 机台提示:黄色缩小弹窗(进页后由各报工页再判;入口仅在无法确定跳转时提示) */
+const machineTip = (text = MACHINE_TIP) => {
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    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',
+  })
+}
 
-// 物理地址获取机台编号和工序
+// 物理地址获取机台编号和工序(仅用于产量报工跳转路由,失败不在此页弹错)
 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 +62,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 +80,39 @@ 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 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}对应的报工页面`
-    })
+    return
   }
+  machineTip()
 }
 
-// 导航到工分报工页面
+// 工分报工:直接进入,由工分页判断机台并提示
 const navigateToGongfen = () => {
   router.push('/layout/baogong/gongfenbaogong')
 }
@@ -195,20 +189,39 @@ 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>
+
+<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;
+}
+</style>

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

@@ -697,7 +697,7 @@ const getMachineMacdata = async () => {
       add_formData['组别'] = ''
       add_formData['人员'] = ''
       employees.value = []
-      ElMessage.error('未获取到机台编号,请确认 MAC 地址或与管理员联系')
+      machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
       return
     }
     add_formData['机台号'] = data.data['机台号']
@@ -721,7 +721,7 @@ const getMachineMacdata = async () => {
     add_formData['组别'] = ''
     add_formData['人员'] = ''
     employees.value = []
-    ElMessage.error('获取机台信息失败,请检查本机服务后刷新页面')
+    machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
   }
 }
 
@@ -937,7 +937,7 @@ const openWorkScoreDialog = async () => {
   }
   const machineNo = String(add_formData['机台号'] || '').trim()
   if (!machineReady.value || !machineNo) {
-    warningres('未获取到机台信息,请确认本机 MAC 服务或与管理员联系后再报工')
+    machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
     return
   }
 
@@ -1576,12 +1576,12 @@ const GetAddr =  () => {
       getMachineMacdata(Machine.value)
     } else if (xmlhttp.readyState == 4) {
       machineReady.value = false
-      ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
+      machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
     }
   }
   xmlhttp.onerror = function() {
     machineReady.value = false
-    ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
+    machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
   }
   // 3. 打开一个连接
   xmlhttp.open("get", "http://127.0.0.1:8090/init")
@@ -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,19 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+/** 机台相关:黄色弹窗缩小版 */
+const machineTip = (text) => {
+  const tip = text || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    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',
+  })
+}
 </script>
 
 <style scoped>

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

@@ -469,7 +469,7 @@ const UniqId = ref('')
 				add_formData['工序名称'] = ''
 				add_formData['组别'] = ''
 				add_formData['人员'] = ''
-				ElMessage.error('未获取到机台编号,请确认 MAC 地址或与管理员联系')
+				machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 				return;
 			} else {
 				add_formData['机台号'] = data.data['机台号']
@@ -493,7 +493,7 @@ const UniqId = ref('')
 			add_formData['工序名称'] = ''
 			add_formData['组别'] = ''
 			add_formData['人员'] = ''
-			ElMessage.error('获取机台信息失败,请检查本机服务后刷新页面')
+			machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 		}
 	}
 	//自动获取物理地址
@@ -520,12 +520,12 @@ const UniqId = ref('')
 				getMachineMacdata(Machine.value)
 			} else if (xmlhttp.readyState == 4) {
 				machineReady.value = false
-				ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
+				machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 			}
 		}
 		xmlhttp.onerror = function() {
 			machineReady.value = false
-			ElMessage.error('无法连接本机 MAC 服务(127.0.0.1:8090),请检查后刷新页面')
+			machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 		}
 		// 3. 打开一个连接
 		xmlhttp.open("get", "http://127.0.0.1:8090/init")
@@ -656,7 +656,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 +789,7 @@ const add_Dialog = async () => {
 
 		const machineNo = String(add_formData['机台号'] || '').trim()
 		if (!machineReady.value || !machineNo || machineNo === '测试机台') {
-			warningres("未获取到机台,禁止报工")
+			machineTip('未获取到机台编号,重启电脑或重新打开系统尝试')
 			return;
 		}
 		sizeDatas.length = 0;
@@ -1223,7 +1223,7 @@ const errorres = (arr) => {
     });
 }
 
-// 警告
+// 警告(大号,报工等场景)
 const warningres = (arr) => {
     ElMessage({
         type: '',
@@ -1233,6 +1233,19 @@ const warningres = (arr) => {
         customClass: 'custom-warning-message'
     });
 }
+
+/** 机台相关提示:沿用黄色弹窗样式,字号/内边距缩小 */
+const machineTip = (msg) => {
+  const text = msg || '未获取到机台编号,重启电脑或重新打开系统尝试'
+  ElMessage.closeAll()
+  ElMessage({
+    type: '',
+    dangerouslyUseHTMLString: true,
+    duration: 4000,
+    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',
+  })
+}
 </script>
 <style scoped>
 	:deep(.el-table__body .status-plan-usage-low) {
@@ -1751,3 +1764,22 @@ 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;
+}
+</style>