ZengTao
2023-12-20 aff3977ee493cfa7554792285100c7b6407e1d74
CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -318,10 +318,22 @@
        };
        // 收到消息
        socket.onmessage = (msg) => {
          if (!msg.data) {
            return; // 如果收到空数据,则直接返回,不执行后续逻辑
          }
        let isMouseInInputBox = false; // 标记鼠标是否在输入框内
const inputBox = document.querySelectorAll('.input-box');
inputBox.forEach(box => {
  box.addEventListener('mouseenter', () => {
    isMouseInInputBox = true;
  });
  box.addEventListener('mouseleave', () => {
    isMouseInInputBox = false;
  });
});
socket.onmessage = (msg) => {
  if (!msg.data) {
    return; // 如果收到空数据,则直接返回,不执行后续逻辑
  }
          let obj = JSON.parse(msg.data);
@@ -329,21 +341,11 @@
          // console.log(obj)
          const jsonData2 = this.jsonData;
          const weihuiling = obj.weihuiling;
            const handleMouseMove = (event) => {
    if (!event || !event.target) {
      return; // 如果 event 或 event.target 不存在,则直接返回,不执行后续逻辑
    }
    const inputBox = document.querySelectorAll('.input-box');
    const target = event.target;
    // console.log(obj);
    const isMouseInInput = Array.from(inputBox).some(box => box.contains(target));
if (!isMouseInInput) {
            
            if (obj.zuhe1 ) {
            if (obj.zuhe1&& !isMouseInInputBox ) {
              // 执行更新逻辑
              for (let i = 0; i < 2; i++) {
                jsonData2[i].forEach((item, index) => {
@@ -378,13 +380,8 @@
            }
         
          }
        }
              // console.log(jsonData2);
              setInterval(() => handleMouseMove(event), 1000); // 每隔 1000ms 检测一次鼠标位置
document.addEventListener('mousemove', event => handleMouseMove(event));
          if(obj.zuhe1){