| | |
| | | const selectedValuea = ref(''); |
| | | const selectedValueb = ref(''); |
| | | const selectedValuec = ref(''); |
| | | const upstatus = ref(''); // 假设这个用于显示自动/手动状态 |
| | | const cuttingMachine = ref(''); // 假设这个用于存储后端返回的状态值(0或1) |
| | | const cuttingMachineStatusColor = ref(''); // 用于动态设置i标签的背景色 |
| | | const inKageWord = ref(0); // 用于存储要传递给接口的inKageWord值 |
| | | const options = ref<any[]>([]); // 下拉选项列表 |
| | | const selectOptions = ref<Array<any>>([]); // 下拉选选项数组 |
| | | const selectOptionsa = ref<Array<any>>([]); // 下拉选选项数组 |
| | |
| | | console.log('成功获取表格数据:', response.data); |
| | | tableData.splice(0, tableData.length, ...response.data); |
| | | window.localStorage.setItem('engineeringId', response.data[0].engineeringId) |
| | | selectOptions.value = response.data.map(item => ({ |
| | | value: item.width, // 假设这是你想要作为value的属性 |
| | | label: item.width, // 假设这是你想要显示的label |
| | | // 获取唯一值 |
| | | const uniqueWidths = new Set(response.data.map(item => item.width)); |
| | | const uniqueHeights = new Set(response.data.map(item => item.height)); |
| | | const uniqueFilmsIds = new Set(response.data.map(item => item.filmsId)); |
| | | const uniqueThicknesses = new Set(response.data.map(item => item.thickness)); |
| | | |
| | | selectOptions.value = Array.from(uniqueWidths).map(width => ({ |
| | | value: width, // 假设这是你想要作为value的属性 |
| | | label: width, // 假设这是你想要显示的label |
| | | })); |
| | | selectOptionsa.value = response.data.map(item => ({ |
| | | value: item.height, |
| | | label: item.height, |
| | | selectOptionsa.value = Array.from(uniqueHeights).map(height => ({ |
| | | value: height, |
| | | label: height, |
| | | })); |
| | | selectOptionsb.value = response.data.map(item => ({ |
| | | value: item.filmsId, |
| | | label: item.filmsId, |
| | | selectOptionsb.value = Array.from(uniqueFilmsIds).map(filmsId => ({ |
| | | value: filmsId, |
| | | label: filmsId, |
| | | })); |
| | | selectOptionsc.value = response.data.map(item => ({ |
| | | value: item.thickness, |
| | | label: item.thickness, |
| | | selectOptionsc.value = Array.from(uniqueThicknesses).map(thickness => ({ |
| | | value: thickness, |
| | | label: thickness, |
| | | })); |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | |
| | | const confirmCuttingMachine = () => { |
| | | cuttingMachineStatus.value = 'green'; |
| | | }; |
| | | |
| | | |
| | | |
| | | const wsUrl = 'ws://10.153.19.150:88/api/loadGlass/api/talk/loadGlass'; |
| | | const ws = new WebSocket(wsUrl); |
| | | ws.onopen = () => { |
| | | console.log('WebSocket连接已打开'); |
| | | }; |
| | | |
| | | // 监听WebSocket的错误事件 |
| | | ws.onerror = (error) => { |
| | | console.error('WebSocket发生错误:', error); |
| | | }; |
| | | |
| | | // 监听WebSocket的关闭事件 |
| | | ws.onclose = (event) => { |
| | | if (event.wasClean) { |
| | | console.log('WebSocket连接已正常关闭'); |
| | | } else { |
| | | console.error('WebSocket连接异常关闭'); |
| | | } |
| | | }; |
| | | |
| | | // 监听WebSocket的消息事件 |
| | | ws.onmessage = (event) => { |
| | | // 假设服务器发送的是JSON格式的字符串 |
| | | try { |
| | | const data = JSON.parse(event.data); // 解析消息为JSON |
| | | |
| | | // 假设服务器发送的数据结构是 { InkageStatus: ["1"] } |
| | | if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) { |
| | | const status = data.InkageStatus[0]; |
| | | cuttingMachine.value = status; |
| | | upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green'; |
| | | inKageWord.value = status === '1' ? 0 : 1; |
| | | } else { |
| | | // 处理错误情况或无效数据 |
| | | console.error('接收到的数据无效', data); |
| | | } |
| | | } catch (error) { |
| | | console.error('解析WebSocket消息时发生错误', error); |
| | | } |
| | | }; |
| | | const confirmCutting = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', |
| | | inKageWord.value |
| | | ); |
| | | if (response.code == 200) { |
| | | const status = response.data.status; |
| | | upstatus.value = status === '1' ? '上片机联机状态' : '上片机手动状态'; |
| | | cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green'; |
| | | // 显示成功消息 |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | ElMessage.error(response.message || '请求失败'); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error('请求时发生错误', error); |
| | | ElMessage.error('请求时发生错误'); |
| | | } |
| | | }; |
| | | // const confirmCutting = async () => { |
| | | // try { |
| | | // const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', { |
| | | // inKageWord: inKageWord.value |
| | | // }) |
| | | // if (response.code == 200) { |
| | | // inKageWord == '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | // inKageWord.value == '1' ? '#911005' : 'green'; |
| | | // ElMessage.success(response.message); |
| | | // } else { |
| | | // // 请求失败,显示错误消息 |
| | | // ElMessage.error(response.msg); |
| | | // } |
| | | // } |
| | | // catch (error) { |
| | | // // 处理错误 |
| | | // console.error(error); |
| | | // } |
| | | // } |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <div id="dotClass"> |
| | | <div>打标机就绪状态:</div> |
| | | <i :style="{ marginTop: '2px', backgroundColor: markingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i> |
| | | <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">手动确认</el-button> |
| | | |
| | | <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">确认</el-button> |
| | | <div style="margin-left: 70px;">切割机就绪状态:</div> |
| | | <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i> |
| | | <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >手动确认</el-button> |
| | | </div> |
| | | <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >确认</el-button> |
| | | <div style="margin-left: 70px;">{{ upstatus }} </div> |
| | | <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatusColor, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i> |
| | | <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >确认</el-button> |
| | | |
| | | </div> |
| | | <el-button style="margin-top: 5px;margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true">选择工程</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">开始上片</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="warning" @click="handleBinda">暂停</el-button> |