上片机状态显示添加默认状态、颜色,下片卧式缓存websocket,ip和端口号均可配置
| | |
| | | // export const WebSocketHost = "192.168.1.199"; |
| | | export const WebSocketHost = "10.153.19.150"; |
| | | export const WebSocketHost = "10.153.19.150"; |
| | | export const host = "88"; |
| | |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | const adda = ref(false) |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`; |
| | | // const socketUrl = `ws://10.153.19.150:88/api/cacheGlass/api/talk/cacheGlass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | const adda = ref(false) |
| | | |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted } from "vue"; |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | // import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | // import LanguageMixin from './lang/LanguageMixin' |
| | |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | tableData.splice(0, tableData.length, ...data.params[0]); |
| | | // tableData.value = data.params[0] |
| | | // adjustedRects.value = data.EdgStorageCageinfos[0] |
| | | adjustedRects.value = data.params[0].map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | width: rect.width * 0.5 , |
| | | id: rect.id * 10, |
| | | })); |
| | | |
| | | }; |
| | | // 初始化 WebSocket,并传递消息处理函数 |
| | | onMounted(() => { |
| | | // fetchFlowCardId(); |
| | | // fetchTableData(); // 获取数据 |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | > |
| | | </div> |
| | | </div> |
| | | <!-- <div style="width: 100px;height: 10px;background-color: #409EFF;margin-top: -124px;margin-left: 480px;"></div> |
| | | <div style="width: 100px;height: 10px;background-color: #409EFF;margin-top: -30px;margin-left: 850px;"></div> |
| | | <div style="width: 100px;height: 10px;background-color: #409EFF;margin-top: 30px;margin-left: 695px;"></div> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { ref, onMounted, onBeforeUnmount } from 'vue'; |
| | | import request from "@/utils/request" |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | const blind = ref(false) |
| | | const olWidth = ref(); |
| | |
| | | } |
| | | }); |
| | | } |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | const adda = ref(false) |
| | | const flake = ref(false) |
| | | const flakea = ref(false) |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | const ida = ref(null); |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | |
| | | const selectedValuea = ref(''); |
| | | const selectedValueb = ref(''); |
| | | const selectedValuec = ref(''); |
| | | const upstatus = ref(''); // 假设这个用于显示自动/手动状态 |
| | | const upstatus = ref('上片机手动状态:'); // 假设这个用于显示自动/手动状态 |
| | | const cuttingMachine = ref(''); // 假设这个用于存储后端返回的状态值(0或1) |
| | | const cuttingMachineStatusColor = ref(''); // 用于动态设置i标签的背景色 |
| | | const cuttingMachineStatusColor = ref('#911005'); // 用于动态设置i标签的背景色 |
| | | const inKageWord = ref(0); // 用于存储要传递给接口的inKageWord值 |
| | | const options = ref<any[]>([]); // 下拉选项列表 |
| | | const selectOptions = ref<Array<any>>([]); // 下拉选选项数组 |
| | |
| | | const titleSelectJsona = ref({ |
| | | processTypea: [], |
| | | }) |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/loadGlass/api/talk/loadGlass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | |
| | | |
| | | |
| | | const wsUrl = `ws://${WebSocketHost}:88/api/loadGlass/api/talk/loadGlass`; |
| | | const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`; |
| | | const ws = new WebSocket(wsUrl); |
| | | ws.onopen = () => { |
| | | console.log('WebSocket连接已打开'); |
| | |
| | | const status = data.InkageStatus[0]; |
| | | cuttingMachine.value = status; |
| | | upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green'; |
| | | cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005'; |
| | | inKageWord.value = status === '1' ? 0 : 1; |
| | | } else { |
| | | // 处理错误情况或无效数据 |
| | |
| | | if (response.code == 200) { |
| | | const status = response.data.status; |
| | | upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green'; |
| | | cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005'; |
| | | // 显示成功消息 |
| | | ElMessage.success(response.message); |
| | | } else { |
| | |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | |
| | | } |
| | | |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/cacheVerticalGlass/api/talk/slicecage`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/slicecage`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | const adda = ref(false) |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | |
| | | } |
| | | }; |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | const adda = ref(false) |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | |
| | | }; |
| | | |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | import Swal from 'sweetalert2' |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost } from '@/utils/constants'; |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | const racks = ref([ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } }, |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/unLoadGlass/api/talk/unloadglass3`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass3`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | |
| | |
| | | import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost } from '@/utils/constants'; |
| | | |
| | | |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | const dialogFormVisiblea = ref(false) |
| | | |
| | | const dialogFormVisiblea2 = ref(false) |
| | |
| | | }; |
| | | |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:88/api/unLoadGlass/api/talk/unloadglass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | |