| | |
| | | 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() |
| | |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const sendRecords = ref([]); |
| | | const machineId=14;//当前页面的设备ID |
| | | |
| | | 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;//当前页面的设备ID |
| | | console.log(machineId); |
| | | //const machineId=14;//当前页面的设备ID |
| | | //使用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) { |
| | |
| | | {{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' }" |
| | |
| | | <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> |