ZengTao
2023-12-20 aff3977ee493cfa7554792285100c7b6407e1d74
CanadaMes-ui/src/views/Electrical/ManualJog.vue
@@ -92,12 +92,10 @@
    if (language === 'en-US') {
      this.replaceChineseWithEnglish();
    }
    // this.$forceUpdate();
             SelectPassword().then(res => {
                this.password = res.data.password;
                console.log(this.password)
            });
this.load();
  },
  methods: {
    closeSocket () {
@@ -113,9 +111,25 @@
    this.$set(dataGroup[itemIndex].button, 'value2', 0);
  }
    },
    load(){
      SelectPassword().then(res => {
                this.password = res.data.password;
                console.log(this.password)
            });
console.log(this.jsonData)
    },
    submitDataToBackend (currentButtonName) {
      if (currentButtonName === 'A01 SERVE TRAVEL Home' || currentButtonName === 'A02 SERVE TRAVEL Home' || currentButtonName === 'A01行走伺服回零' || currentButtonName === 'A02行走伺服回零') {
      if (currentButtonName ===   'A01 SERVE TRAVEL Home' || currentButtonName === 'A02 SERVE TRAVEL Home' || currentButtonName === 'A01行走伺服回零' || currentButtonName === 'A02行走伺服回零') {
        this.$prompt(
          this.$t('Are you sure to perform this operation?'),
          this.$t('prompt'),
@@ -177,17 +191,7 @@
        socket?.send(jsonString);
      }
    },
    //根据读取PLC的值,根据名称改变颜色1打开,0关闭
//     getStatusClass (zhuangtai) {
// // console.log(zhuangtai);
//       if (zhuangtai === 1) {
//         return "op";
//       }
//       else {
//         return "dow";
//       }
//     },
    initWebSocket () {
      let viewname = "ManualJog";
@@ -208,7 +212,7 @@
        socket.onopen = function () {
          console.log("websocket已打开");
        };
        let isUpdated = false;  // 定义标志变量
        // 收到消息
        socket.onmessage = (msg) => {
          if (!msg.data) {
@@ -219,7 +223,7 @@
          const jsonData2 = this.jsonData;
          const parms = obj.params;
//  console.log(obj)
// console.log(obj)
//console.log(this.jsonData)
          if(parms){
          // 如果鼠标不在输入框内,更新输入框的值
@@ -232,13 +236,26 @@
            for (let j = 0; j < arr.length; j++) {
              let obj = arr[j];
              obj.button.value = parms[0][j];
              obj.button.value2 =obj.button.value;
              // obj.button.value2 = parms[0][j];
             // obj.button.value2 =obj.button.value;
            }
          }
          jsonData2[1][0].button.value = obj.params[0][26];
          jsonData2[1][1].button.value = obj.params[0][27];
          if (!isUpdated) {
      for (let i = 0; i < this.jsonData.length; i++) {
        for (let j = 0; j < this.jsonData[i].length; j++) {
          this.jsonData[i][j].button.value2 = this.jsonData[i][j].button.value;
        }
      }
      isUpdated = true;  // 更新标志变量的值
    }
@@ -248,6 +265,11 @@
        };
        // 关闭事件
        socket.onclose = function () {
          console.log("websocket已关闭");