| | |
| | | "State": "State",
|
| | | "Alarm": "Alarm",
|
| | | "Distribute": "Distribute",
|
| | | "Search": "Search"
|
| | | "Search": "Search",
|
| | | "dvstate": {
|
| | | "automatic": "automatic",
|
| | | "manual": "manual"
|
| | | }
|
| | | } |
| | |
| | | "Parameter": "参数下发",
|
| | | "Action": "开关控制",
|
| | | "Sign": "IO状态",
|
| | | "State": "State",
|
| | | "State": "设备状态",
|
| | | "Alarm": "报警信息",
|
| | | "Distribute": "下发",
|
| | | "Search": "搜索"
|
| | | "Search": "搜索",
|
| | | "dvstate": {
|
| | | "automatic": "自动",
|
| | | "manual": "手动"
|
| | | }
|
| | | } |
| | |
| | |
|
| | | },
|
| | |
|
| | |
|
| | | localizedRoles: [],
|
| | | messagepack: {
|
| | | data: { taskname: "" }
|
| | | },
|
| | |
| | | //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]) {
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | 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);
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | | 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 "手动";
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|