From 82c2df0968b099bd589936adc5b28c1ac4827a05 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期一, 04 十二月 2023 08:20:07 +0800
Subject: [PATCH] 更新测试后电气管理
---
CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue | 61 +++++++++++++++++++++++-------
1 files changed, 46 insertions(+), 15 deletions(-)
diff --git a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
index 8ea34da..be85e56 100644
--- a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
+++ b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -7,8 +7,8 @@
}}</router-link>
<router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
}}</router-link>
- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
- }}</router-link>
+ <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
+ }}</router-link> -->
<router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
}}</router-link>
<router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
@@ -23,8 +23,8 @@
}}</router-link>
<router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
}}</router-link>
- <!-- <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
- }}</router-link> -->
+ <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
+ }}</router-link>
<router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
$t('Positioning1')
}}</router-link>
@@ -47,10 +47,10 @@
<el-row :gutter="20">
<el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:485px;">
+ <el-card class="json-block" style="width:585px;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row" v-if="item.type === '0'">
- <span class="name" v-if="item.type === '0'" style="width:150px;">{{ item.name }}</span>
+ <span class="name" v-if="item.type === '0'" style="width:300px;">{{ item.name }}</span>
<el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box"
@keyup.enter.native="submitDataToBackend"></el-input>
</div>
@@ -76,12 +76,23 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
+ activated () {
+
this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+
},
methods: {
+ closeSocket () {
+ // 鍏抽棴 WebSocket 杩炴帴
+ socket.close();
+ },
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
},
@@ -146,7 +157,7 @@
let obj = JSON.parse(msg.data);
const jsonData2 = this.jsonData;
-
+ // console.log(obj);
const handleMouseMove = throttle(function (event) {
const inputBox = document.querySelectorAll('.el-card__body');
@@ -186,7 +197,7 @@
jsonData2[2][0]['value'] = dache[0][0];
}
}
- }, 50);
+ }, 200);
document.addEventListener('mouseover', handleMouseMove);
};
@@ -205,20 +216,40 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function () {
+ socket.close();
+ })
}
},
- replaceChineseWithEnglish () {
- const translation = this.$t('AutomaticParameterSetting');
- this.jsonData = this.jsonData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; });
- // console.log(translation);
- },
send () {
socket?.send(JSON.stringify(this.messagepack));
},
+ replaceChineseWithEnglish () {
+
+
+ const nameMap = this.$t('AutomaticParameterSettinglang')
+ this.jsonData = this.jsonData.map((item) => {
+ return item.map((obj) => {
+ if (obj.name) {
+ const newName = nameMap[obj.name] || obj.name;
+ return { ...obj, name: newName };
+ } else if (obj.button && obj.button.name) {
+ const newName = nameMap[obj.button.name] || obj.button.name;
+ return { ...obj, button: { ...obj.button, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+ });
+
+
+ console.log(this.jsonData)
+
+ }
}
}
--
Gitblit v1.8.0