ZengTao
2024-08-13 3ca932ad348e06449c63a1eeda3e4d3f5c5f9f35
UI-Project/src/views/largescreen/largescreen.vue
@@ -38,6 +38,12 @@
  <div id="longa" v-show="dalipiana"></div>
  <div id="longb" v-show="dalipianb"></div>
  <div id="shangpianji" v-show="shangpian"></div>
  <div id="xiapianji1" v-show="xiapian1"></div>
  <div id="xiapianji2" v-show="xiapian2"></div>
  <div id="xiapianji3" v-show="xiapian3"></div>
  <div id="xiapianji4" v-show="xiapian4"></div>
  <div id="xiapianji5" v-show="xiapian5"></div>
  <div id="xiapianji6" v-show="xiapian6"></div>
</div>
<div id="centerright" style="margin-top: 10px;margin-left: 10px; height: 240px;width: 240px;background-color: #911005;">
  <el-table height="240" ref="table" width="340px"
@@ -136,6 +142,12 @@
const dalipiana = ref(false)
const dalipianb = ref(false)
const shangpian = ref(false)
const xiapian1 = ref(false)
const xiapian2 = ref(false)
const xiapian3 = ref(false)
const xiapian4 = ref(false)
const xiapian5 = ref(false)
const xiapian6 = ref(false)
const thisProcess = ref(); // 用于存储process_id的响应式引用 
// 定义一个响应式引用来存储图表实例    
@@ -171,6 +183,7 @@
let socket3 = null;
let socket4 = null;
let socket5 = null;
let socket6 = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/screen`;
const handleMessage = (data) => {
tableData.value = data.awaitingRepairs[0]
@@ -208,8 +221,10 @@
const socketUrl3 = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlassIsRun`;
const handleMessage3 = (data) => {
  const tasks = data.taskCaches[0];  
  woshia.value = tasks.some(task => task.endCell == 2001 && task.glassId == 0);
  woshic.value = tasks.some(task => task.endCell == 2002 && task.glassId == 0);
  woshia.value = tasks.some(task => task.line == 2001);
  woshic.value = tasks.some(task => task.line == 2002);
  console.log(tasks);
};
// 大理片笼
const socketUrl4 = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/isRun`;
@@ -225,6 +240,19 @@
  if(data.engineering.length !==0 ){
    shangpian.value = true;
}
};
// 下片
const socketUrl6 = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unLoadGlassIsRun`;
const handleMessage6 = (data) => {
  const tasks = data.downWorkstation[0];
  if (tasks && tasks.length >= 6) {
    xiapian1.value = tasks[0].racksNumber !== 0;
    xiapian2.value = tasks[1].racksNumber !== 0;
    xiapian3.value = tasks[2].racksNumber !== 0;
    xiapian4.value = tasks[3].racksNumber !== 0;
    xiapian5.value = tasks[4].racksNumber !== 0;
    xiapian6.value = tasks[5].racksNumber !== 0;
  }
};
const renderPieCharts = () => {
processesData.value.forEach((data, index) => {
@@ -302,6 +330,7 @@
  socket3 = initializeWebSocket(socketUrl3, handleMessage3);
  socket4 = initializeWebSocket(socketUrl4, handleMessage4);
  socket5 = initializeWebSocket(socketUrl5, handleMessage5);
  socket6 = initializeWebSocket(socketUrl6, handleMessage6);
});
  onUnmounted(() => {
    if (socket) {
@@ -319,6 +348,9 @@
    if (socket5) {
    closeWebSocket5(socket5);
    }
    if (socket6) {
    closeWebSocket6(socket6);
    }
    });
onBeforeUnmount(() => {
console.log("关闭了")
@@ -327,6 +359,7 @@
closeWebSocket3();
closeWebSocket4();
closeWebSocket5();
closeWebSocket6();
});
</script>  
@@ -449,4 +482,58 @@
  margin-top: -90px;
  margin-left: 568px;
}
#xiapianji1{
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 7px;
  background-color: #529b2e;
  margin-top: -213px;
  margin-left: 111px;
}
#xiapianji2{
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 7px;
  background-color: #529b2e;
  margin-top: -213px;
  margin-left: 140px;
}
#xiapianji3{
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 7px;
  background-color: #529b2e;
  margin-top: -202px;
  margin-left: 126px;
}
#xiapianji4{
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 7px;
  background-color: #529b2e;
  margin-top: -213px;
  margin-left: 175px;
}
#xiapianji5{
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 7px;
  background-color: #529b2e;
  margin-top: -213px;
  margin-left: 204px;
}
#xiapianji6{
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 7px;
  background-color: #529b2e;
  margin-top: -202px;
  margin-left: 190px;
}
</style>