|
|
@@ -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>
|