clll
2023-09-13 f53ba3a3e10df08aa0d23114fae200a99ade23f4
拉取
3个文件已修改
44 ■■■■■ 已修改文件
CanadaMes-ui/src/lang/locales/en-US.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/State.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json
@@ -171,5 +171,9 @@
  "State": "State",
  "Alarm": "Alarm",
  "Distribute": "Distribute",
  "Search": "Search"
  "Search": "Search",
  "dvstate": {
    "automatic": "automatic",
    "manual": "manual"
  }
}
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -168,8 +168,12 @@
  "Parameter": "参数下发",
  "Action": "开关控制",
  "Sign": "IO状态",
  "State": "State",
  "State": "设备状态",
  "Alarm": "报警信息",
  "Distribute": "下发",
  "Search": "搜索"
  "Search": "搜索",
  "dvstate": {
    "automatic": "自动",
    "manual": "手动"
  }
}
CanadaMes-ui/src/views/Electrical/State.vue
@@ -67,7 +67,7 @@
      },
      localizedRoles: [],
      messagepack: {
        data: { taskname: "" }
      },
@@ -107,7 +107,6 @@
          //console.log("收到数据====" + msg.data);
          let obj = JSON.parse(msg.data);
          this.record.params[0] = obj.sta[0];
          console.log(this.record.params[0]);
          //将读取到的PLC的数据,与定义的xyData,组合成新的数组
          for (let a = 0; a < this.record.params[0].length; a++) {
            if (!this.record.xyData[a]) {
@@ -117,6 +116,13 @@
            }
          }
          const language = this.$i18n.locale;
          if (language === 'en-US') {
            this.replaceChineseWithEnglish();
          } else {
            this.localizedRoles = [...this.record.xyData];
          }
          //console.log(this.localizedRoles);
          this.$forceUpdate();
        }.bind(this);
@@ -130,19 +136,15 @@
        }
      }
    },
    send () {
      this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value)); // 转换为整数数组
      console.log(this.messagepack);
      socket?.send(JSON.stringify(this.messagepack));
    //语言转换
    replaceChineseWithEnglish () {
      const translation = this.$t('dvstate');
      this.localizedRoles = this.record.xyData.map(role => ({
        ...role,
        content: translation[role.content] || role.content
      }));
      console.log(this.localizedRoles);
    },
    valuezhi (zhi) {
      if (zhi == 1) {
        return "自动";
      }
      else {
        return "手动";
      }
    }
  }