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 | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/UI-Project/src/views/SilkScreen/SilkScreen.vue b/UI-Project/src/views/SilkScreen/SilkScreen.vue
index e86836f..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()
@@ -16,16 +17,23 @@
const loadData = ref([]);
const findMachine = ref([]);
const sendRecords = ref([]);
-const machineId=14;//褰撳墠椤甸潰鐨勮澶嘔D
+
+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/silkScreenTask`;
// 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
const handleMessage = (data) => {
// 鏇存柊 tableData 鐨勬暟鎹�
- loadData.value = data.taskingList[0];
- findMachine.value = data.machine[0];
- sendRecords.value = data.sendRecords[0];
+ let dataJson = data[""+machineId][0];
+ loadData.value = dataJson.taskingList[0];
+ findMachine.value = dataJson.machine[0];
+ sendRecords.value = dataJson.sendRecords[0];
};
onUnmounted(() => {
if (socket) {
@@ -197,7 +205,7 @@
{{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="height:240px; min-height:240px;">
+ <div id="main-body" style=" min-height:240px;">
<!-- 琛ㄦ牸鍐呭 -->
<el-table :data="loadData" stripe style="height:680px"
:header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
@@ -214,6 +222,7 @@
<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>
--
Gitblit v1.8.0