From 6c9369ab9b7da99687857004470e8d7824eb69ae Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期三, 03 九月 2025 08:02:00 +0800
Subject: [PATCH] 修改plc连接读取失败导致无法重新链接
---
UI-Project/src/views/SilkScreen/SilkScreen.vue | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/UI-Project/src/views/SilkScreen/SilkScreen.vue b/UI-Project/src/views/SilkScreen/SilkScreen.vue
index 99c5adc..d81ebe3 100644
--- a/UI-Project/src/views/SilkScreen/SilkScreen.vue
+++ b/UI-Project/src/views/SilkScreen/SilkScreen.vue
@@ -6,6 +6,7 @@
import { useI18n } from 'vue-i18n'
import { WebSocketHost ,host} from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
+import {gridDateFormatter} from '@/stores/tool';
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
@@ -15,15 +16,24 @@
});
const loadData = ref([]);
const findMachine = ref([]);
-const machineId=13;//褰撳墠椤甸潰鐨勮澶嘔D
+const sendRecords = ref([]);
+
+const userInfo=JSON.parse(window.localStorage.getItem('userInfo'));
+const pageParams=userInfo.user.menus[0].pages[4].params;
+const pageParamsJson=JSON.parse(pageParams);
+const machineId = pageParamsJson.machineId;//褰撳墠椤甸潰鐨勮澶嘔D
+console.log(machineId);
+//const machineId=14;//褰撳墠椤甸潰鐨勮澶嘔D
//浣跨敤WebSocket鏂瑰紡灞曠ず鏁版嵁
let socket = null;
-const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreen`;
+const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreenTask`;
// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
const handleMessage = (data) => {
// 鏇存柊 tableData 鐨勬暟鎹�
- loadData.value = data.taskingList[0];
- findMachine.value = data.machine[0];
+ let dataJson = data[""+machineId][0];
+ loadData.value = dataJson.taskingList[0];
+ findMachine.value = dataJson.machine[0];
+ sendRecords.value = dataJson.sendRecords[0];
};
onUnmounted(() => {
if (socket) {
@@ -195,9 +205,9 @@
{{findMachine['state']=='寮�宸�'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
<el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
</div>
- <div id="main-body" style="min-height:240px;">
+ <div id="main-body" style=" min-height:240px;">
<!-- 琛ㄦ牸鍐呭 -->
- <el-table :data="loadData" stripe
+ <el-table :data="loadData" stripe style="height:680px"
:header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }">
<!-- <el-table-column type="selection" min-width="30" /> -->
@@ -206,11 +216,13 @@
<el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
<el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
<el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
+ <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
<el-table-column prop="length" :label="$t('glassInfo.length')"/>
<el-table-column prop="width" :label="$t('glassInfo.width')"/>
<el-table-column prop="silkScreenX" :label="$t('glassInfo.silkScreenX')"/>
<el-table-column prop="silkScreenY" :label="$t('glassInfo.silkScreenY')"/>
<el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
+ <el-table-column prop="operationRecordTime" :formatter="gridDateFormatter" :label="$t('glassInfo.operationRecordTime')" width="180"/>
<el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
<template #default="scope">
<el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '閲嶅彂')" >{{$t('functionState.anew')}}</el-button>
@@ -221,13 +233,7 @@
</el-table-column>
</el-table>
</div>
-
- <div id="main-body"
- style="width: 100%; height: 460px;background-image: url(../../src/assets/a.png) ;background-size: 100% 100%;">
- <!-- 鐢诲浘鍐呭 -->
- <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
- </div>
- </div>
+
</div>
</template>
--
Gitblit v1.8.0