| | |
| | | const adda = ref(false) |
| | | const flake = ref(false) |
| | | const flakea = ref(false) |
| | | const flakeb = ref(false) |
| | | const flakec = ref(false) |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | const ida = ref(null); |
| | |
| | | // ElMessage.error('获取表格数据失败,请重试'); |
| | | } |
| | | }; |
| | | request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | window.localStorage.setItem('patternWidth', res.data.patternWidth) |
| | | window.localStorage.setItem('workstationId', res.data.workstationId) |
| | | if (res.code == 200) { |
| | | console.log(res.data); |
| | | tableDataa.value = res.data |
| | | console.log(res.data.patternWidth); |
| | | |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | let patternWidth = window.localStorage.getItem('patternWidth') |
| | | if (patternWidth !== '' || workstationId == '1') { |
| | | flake.value = true |
| | | } else if (patternWidth !== '' || workstationId == '2') { |
| | | flakea.value = true |
| | | onMounted(() => { |
| | | list(''); |
| | | fetchOptions(''); |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onMounted(() => { |
| | | }); |
| | | const list = async () => { |
| | | try { |
| | | const response = await request.get('/loadGlass/LoadGlass/list'); |
| | | if (response.code == 200) { |
| | | tableDataa.value = response.data |
| | | if (tableDataa.value.length === 4) { |
| | | if (tableDataa.value[0].patternHeight > 0) { |
| | | flake.value = true; |
| | | } |
| | | if (tableDataa.value[1].patternHeight > 0) { |
| | | flakea.value = true; |
| | | } |
| | | if (tableDataa.value[2].patternHeight > 0) { |
| | | flakeb.value = true; |
| | | } |
| | | if (tableDataa.value[3].patternHeight > 0) { |
| | | flakec.value = true; |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | // router.push("/login") |
| | | ElMessage.warning(response.data); |
| | | } |
| | | }); |
| | | } catch (error) { |
| | | console.error('Error fetching options:', error); |
| | | } |
| | | }; |
| | | // 假设这是您的响应处理函数 |
| | | // request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | // if (res.code == 200) { |
| | | // tableDataa.value = res.data |
| | | // if (tableDataa.value.length === 4) { |
| | | // if (tableDataa.value[0].patternHeight > 0) { |
| | | // flake.value = true; |
| | | // } |
| | | // if (tableDataa.value[1].patternHeight > 0) { |
| | | // flakea.value = true; |
| | | // } |
| | | // if (tableDataa.value[2].patternHeight > 0) { |
| | | // flakeb.value = true; |
| | | // } |
| | | // if (tableDataa.value[3].patternHeight > 0) { |
| | | // flakec.value = true; |
| | | // } |
| | | // } |
| | | // } else { |
| | | // ElMessage.warning(res.message) |
| | | // // router.push("/login") |
| | | // } |
| | | // }); |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | | processType: [], |
| | |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | |
| | | if(data.prioritylist!=null){ |
| | | tableData.splice(0, tableData.length, ...data.prioritylist[0]); |
| | | } |
| | | if(data.list!=null){ |
| | | tableDataa.value = data.list[0] |
| | | // console.log("更新后数据", tableData); |
| | | } |
| | | }; |
| | | const requestData = { |
| | | state: 100 |
| | |
| | | options.value = []; // 清空选项列表 |
| | | } |
| | | }; |
| | | // 初始化加载数据(如果需要) |
| | | onMounted(() => { |
| | | fetchOptions(''); |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | const user = ref(''); |
| | |
| | | const handleBindRack = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | ida.value = row.id; |
| | | console.log(ida.value); |
| | | add.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | // 添加 |
| | | const handleConfirm = async () => { |
| | | console.log(ida.value); |
| | | // console.log('id.value:', id.value); |
| | | if ((ida.value === 2 || ida.value === 4) && (parseInt(patternHeight.value, 10) >= 2700 )) { |
| | | if ((ida.value === 2 || ida.value === 4) && (parseInt(selectedValuea.value, 10) >= 2700 )) { |
| | | try { |
| | | const response = await request.post('/loadGlass/LoadGlass/updateGlassMessage', { |
| | | id: workstationId.value, |
| | |
| | | patternThickness: selectedValuec.value, |
| | | number: number.value |
| | | }); |
| | | window.localStorage.setItem('workstationId', workstationId.value) |
| | | window.localStorage.setItem('patternHeight', selectedValuea.value) |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | add.value = false; |
| | | tableDataa.value = response.data; |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | let patternHeight = window.localStorage.getItem('patternHeight') |
| | | if (patternHeight !== '' && workstationId === '1') { |
| | | flake.value = true |
| | | } else if (patternHeight !== '' && workstationId === '2'){ |
| | | flakea.value = true |
| | | }else if (patternHeight !== '' && workstationId === '3'){ |
| | | flakeb.value = true |
| | | }else if (patternHeight !== '' && workstationId === '4'){ |
| | | flakec.value = true |
| | | } |
| | | selectedValuea.value = ''; |
| | | selectedValue.value = ''; |
| | | selectedValueb.value = ''; |
| | | selectedValuec.value = ''; |
| | | number.value = ''; |
| | | window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId == '1') { |
| | | flake.value = true |
| | | } else if (workstationId == '2'){ |
| | | flakea.value = true |
| | | } |
| | | list() |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.message); |
| | |
| | | patternThickness: selectedValuec.value, |
| | | number: number.value |
| | | }); |
| | | window.localStorage.setItem('workstationId', workstationId.value) |
| | | window.localStorage.setItem('patternHeight', selectedValuea.value) |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | add.value = false; |
| | | tableDataa.value = response.data; |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | let patternHeight = window.localStorage.getItem('patternHeight') |
| | | if (patternHeight !== '' && workstationId === '1') { |
| | | flake.value = true |
| | | } else if (patternHeight !== '' && workstationId === '2'){ |
| | | flakea.value = true |
| | | }else if (patternHeight !== '' && workstationId === '3'){ |
| | | flakeb.value = true |
| | | }else if (patternHeight !== '' && workstationId === '4'){ |
| | | flakec.value = true |
| | | } |
| | | selectedValuea.value = ''; |
| | | selectedValue.value = ''; |
| | | selectedValueb.value = ''; |
| | | selectedValuec.value = ''; |
| | | number.value = ''; |
| | | window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId == '1') { |
| | | flake.value = true |
| | | } else if (workstationId == '2'){ |
| | | flakea.value = true |
| | | } |
| | | list() |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.message); |
| | |
| | | ElMessage.success(response.message); |
| | | adda.value = false; |
| | | tableDataa.value = response.data; |
| | | window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId == '1') { |
| | | // window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | // let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId.value == '1') { |
| | | flake.value = false |
| | | } else if (workstationId == '2'){ |
| | | } else if (workstationId.value == '2'){ |
| | | flakea.value = false |
| | | }else if (workstationId.value == '3'){ |
| | | flakeb.value = false |
| | | }else if (workstationId.value == '4'){ |
| | | flakec.value = false |
| | | } |
| | | list() |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.message); |
| | |
| | | const data = JSON.parse(event.data); // 解析消息为JSON |
| | | |
| | | if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) { |
| | | if(data.InkageStatus!=null){ |
| | | const status = data.InkageStatus[0]; |
| | | cuttingMachine.value = status; |
| | | upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa'); |
| | | cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005'; |
| | | inKageWord.value = status === '1' ? 0 : 1; |
| | | } |
| | | } else { |
| | | // 处理错误情况或无效数据 |
| | | console.error('接收到的数据无效', data); |
| | |
| | | </template> |
| | | </el-dialog> --> |
| | | <div id="parent"> |
| | | <img src="../../assets/shangpianji.png" alt="" style="max-width: 20%;max-height: 20%;margin-top: 20px;margin-left: 500px;"> |
| | | <img src="../../assets/shangpian.png" alt="" style="max-width: 40%;max-height: 40%;margin-top: 20px;margin-left: 340px;"> |
| | | <div id="overlay" v-show="flake"></div> |
| | | <div id="overlaya" v-show="flakea"></div> |
| | | <div id="overlayb" v-show="flakeb"></div> |
| | | <div id="overlayc" v-show="flakec"></div> |
| | | </div> |
| | | <div style="margin-top: -350px;margin-left: 650px;"> |
| | | <div style="margin-top: -300px;margin-left: 680px;"> |
| | | <el-table :data="tableDataa" border style="width: 85%" |
| | | :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" |
| | | > |
| | |
| | | #overlay{ |
| | | position: absolute; |
| | | z-index: 1; |
| | | width: 212px; |
| | | height: 15px; |
| | | width: 228px; |
| | | height: 16px; |
| | | background-color: #529b2e; |
| | | margin-top: -404px; |
| | | margin-left: 542px; |
| | | margin-top: -303px; |
| | | margin-left: 355px; |
| | | } |
| | | #overlaya{ |
| | | position: absolute; |
| | | z-index: 1; |
| | | width: 212px; |
| | | height: 15px; |
| | | width: 228px; |
| | | height: 16px; |
| | | background-color: #529b2e; |
| | | margin-top: -38px; |
| | | margin-left: 537px; |
| | | margin-top: -303px; |
| | | margin-left:703px; |
| | | } |
| | | #overlayb{ |
| | | position: absolute; |
| | | z-index: 1; |
| | | width: 228px; |
| | | height: 16px; |
| | | background-color: #529b2e; |
| | | margin-top: -45px; |
| | | margin-left: 355px; |
| | | } |
| | | #overlayc{ |
| | | position: absolute; |
| | | z-index: 1; |
| | | width: 228px; |
| | | height: 16px; |
| | | background-color: #529b2e; |
| | | margin-top: -45px; |
| | | margin-left: 703px; |
| | | } |
| | | |
| | | </style> |