wangfei
2025-05-15 716e63512cf0ee1c2f007ffbd2695c3cf9590357
UI-Project/src/views/largescreendisplay/screendisplay.vue
@@ -64,17 +64,17 @@
  temperingGlassInfoList.value = data.temperingGlassInfoList[0];
  if (numBoxes3.value != temperingTaskType.value) {
    numBoxes3.value = temperingTaskType.value;
    // initBoxes(boxes3, numBoxes3, 'secondleft');
    initBoxes(boxes3, numBoxes3, 'secondleft');
  }
  if (temperingGlassInfoList.value > 1) {
  if (temperingGlassInfoList.value >= 1) {
    if (numBoxes4.value != 1) {
      numBoxes4.value = 1;
      // initBoxes(boxes4, numBoxes4, 'right');
      initBoxes(boxes4, numBoxes4, 'right');
    }
  } else {
    if (numBoxes4.value != 0) {
      numBoxes4.value = 0;
      // initBoxes(boxes4, numBoxes4, 'right');
      initBoxes(boxes4, numBoxes4, 'right');
    }
  }
@@ -144,6 +144,7 @@
    },
    z: 1
  }));
  const optionOne = {
    title: {
@@ -451,6 +452,22 @@
  }
}
const exportToExcel = async () => {
  try {
    window.open('http://'+{WebSocketHost}+':10011/largenScreen/exportDailyProduction', '_blank');
    // const response = await request.get('/cacheGlass/largenScreen/exportDailyProduction');
    // if (response.code == 200) {
    //   ElMessage.success(response.message);
    //   tableDatad.value = response.data;
    // } else {
    //   ElMessage.error(response.message);
    // }
  }
  catch (error) {
    console.error(error);
  }
}
const tableData = ref([]);
const dynamicColumns = ref([]);
const flowCardDetail = async (orderId) => {
@@ -506,6 +523,28 @@
const chartTemp = ref(null)
const chartHollow = ref(null)
const cleanupWebSocketData = (completeCleanup) => {
  if (completeCleanup) {
    // 完全清理
    rawGlassStorageDetailList.value = [];
    orderDTOS.value = [];
    // ...其他数组
  } else {
    // 部分清理 - 保留最近数据
    const MAX_ITEMS = 50;
    rawGlassStorageDetailList.value = rawGlassStorageDetailList.value.slice(-MAX_ITEMS);
    orderDTOS.value = orderDTOS.value.slice(-MAX_ITEMS);
    // ...其他数组
  }
  // 清理图表
  [myChart, myChart2, myChartLoad, myChartEdg, myChartTemp, myChartHollow].forEach(chart => {
    if (chart) {
      chart.clear();
      // 如果需要,可以重新初始化图表
    }
  });
};
// 在组件挂载时设置默认时间范围
onMounted(async () => {
@@ -525,6 +564,21 @@
  // 设置时间范围为 [开始时间, 结束时间]
  // timeRange.value = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
  const cleanupInterval = setInterval(() => {
    cleanupWebSocketData(true); // 完全清理
  }, 3000);
  // 每次收到消息时检查数据量
  const originalHandleMessage = handleMessage;
  handleMessage = (data) => {
    originalHandleMessage(data);
    cleanupWebSocketData(false); // 部分清理
  };
  onUnmounted(() => {
    clearInterval(cleanupInterval);
    cleanupWebSocketData(true); // 组件卸载时完全清理
  });
});
// onMounted(() => {
//   socket = initializeWebSocket(socketUrl, handleMessage);
@@ -539,10 +593,10 @@
    closeWebSocket(socket5);
  }
});
const numBoxes = ref(1);
const numBoxes2 = ref(1);
const numBoxes3 = ref(1);
const numBoxes4 = ref(1);
const numBoxes = ref(0);
const numBoxes2 = ref(0);
const numBoxes3 = ref(0);
const numBoxes4 = ref(0);
const speed = 0.1;
const delayFrames = 600;
@@ -581,11 +635,11 @@
      });
    } else {
      // 重置已有的 box 数据
      existing[i].x = 0;
      existing[i].y = 0;
      existing[i].direction = direction;
      existing[i].delay = i * delayFrames;
      existing[i].frameCount = 0;
      // existing[i].x = 0;
      // existing[i].y = 0;
      // existing[i].direction = direction;
      // existing[i].delay = i * delayFrames;
      // existing[i].frameCount = 0;
    }
  }
  if (existing.length > count) {
@@ -640,7 +694,13 @@
  if (box.frameCount % 2 === 0 && box.el) {
    box.el.style.top = `${box.y}px`;
    if (box.x > 0) {
      box.el.style.right = `${box.x}px`;
      if(box.direction=="right"){
        box.el.style.right = `-${box.x}px`;
      }else{
        box.el.style.right = `${box.x}px`;
      }
      box.el.style.left = '';
    } else {
      box.el.style.left = `${box.x}px`;
@@ -889,7 +949,7 @@
      <div style="width: 50%;">
        <div class="img-screen" alt="Screen">
          <div>
            <el-button type="primary" style="top:40px;left:670px;position: absolute;" @click="handlehistorical11()">{{
            <el-button type="primary" style="top:40px;left:670px;position: absolute;" @click="exportToExcel()">{{
              $t('large.statistics') }}</el-button>
          </div>
          <!-- 钢化半透明色块 -->
@@ -1037,8 +1097,8 @@
          <div class="clickable-area" @click="handlehistorical"
            style="position: relative;width: 108px;height: 134px;top: 478px;left: 290px;"></div>
        </div>
        <div style="height: 190px;width: 100%;float: right;">
          <el-table height="190" ref="table" :data="orderDTOS"
        <div style="height: 175px;width: 100%;float: right;">
          <el-table height="175" ref="table" :data="orderDTOS"
            :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
            <el-table-column prop="orderId" align="center" :label="$t('large.orderId')" min-width="50" />
            <el-table-column prop="customerName" align="center" :show-overflow-tooltip="true"