From 31101f632c27c05d15f30ca3084e3ed3da2a29af Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期五, 08 十二月 2023 11:42:08 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/Electrical/Positioning1.vue | 155 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 102 insertions(+), 53 deletions(-)
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index d44cc90..2f99457 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -7,45 +7,50 @@
}}</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">{{
- $t('ServoManual')
+ $t('Parameter')
}}</router-link>
</el-breadcrumb>
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{
- $t('Servomanualone')
- }}</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/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
- $t('Positioning1')
- }}</router-link>
- <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
- $t('Positioning2')
- }}</router-link>
- <router-link to="/Electrical/Manualoneposition" tag="el-button" type="text" active-class="blue-button">{{
- $t('Manualoneposition')
- }}</router-link>
- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
- $t('ManualonePosition2')
- }}</router-link>
- <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
- $t('AutomaticParameterSetting')
+ <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Automatic State')
}}</router-link>
<router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
$t('ManualJog')
}}</router-link>
+
+ <router-link to="/Electrical/ManualonePosition" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualonePosition')
+ }}</router-link>
+
+<router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{
+ $t('Servomanualone')
+ }}</router-link>
+ <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
+ }}</router-link>
+
+ <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
+ $t('Address parameter settings')
+ }}</router-link>
+ <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
+ $t('Positioning2')
+ }}</router-link>
+
+ <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualonePosition2')
+ }}</router-link>
+ <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
+ $t('Speed parameter settings')
+ }}</router-link>
+
</el-breadcrumb>
- <el-row :gutter="18">
- <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" class='card'>
+ <el-row :gutter="18" class='card'>
+ <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
<el-card class="json-block">
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
@@ -55,8 +60,13 @@
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:250px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input>
- <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
+ <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend" ></el-input>
+ <span v-if="item.unit" :name="item.unit" >{{ item.unit }}</span>
+
+
+ <!-- <el-button
+ v-if="item.type === '0' && item.name !== '鏍煎瓙闂磋窛' && item.name !== '鍑虹墖鎺ョ墖鍦板潃' && item.name !== '瀛樼墖鎺ョ墖鍦板潃'"
+ class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button> -->
</div>
</div>
@@ -80,15 +90,21 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created () {
- this.initWebSocket();
- console.log('jsonData:', this.jsonData);
-
- },
+ activated(){
+
+ this.initWebSocket ();
+ const language = this.$i18n.locale;
+ console.log(language);
+ if (language === 'en-US') {
+ this.replaceChineseWithEnglish();
+ }
+ this.$forceUpdate();
+ },
methods: {
updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
},
+ //鎻愪氦鏁版嵁鍒板悗绔�
submitDataToBackend () {
const inputData = this.jsonData.map(dataGroup => {
return dataGroup.map(item => {
@@ -115,7 +131,7 @@
// 鎻愪氦鏁版嵁鍒板悗绔�
const jsonString = JSON.stringify(jsonObject);
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ // console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
socket?.send(jsonString);
},
initWebSocket () {
@@ -125,7 +141,7 @@
if (typeof WebSocket === "undefined") {
console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
} else {
- let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+ let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
if (socket != null) {
socket.close();
@@ -149,29 +165,33 @@
let obj = JSON.parse(msg.data);
const jsonData2 = this.jsonData;
document.addEventListener('mouseover', function (event) {
- const inputBox = document.querySelector('.card'); // 鏍规嵁浣犵殑瀹為檯鎯呭喌閫夋嫨姝g‘鐨勯�夋嫨鍣�
- if (inputBox && !inputBox.contains(event.target)) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ const parms = obj.params;
+ if (parms && inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
// 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
// this.submitDataToBackend()
- const params = obj.params;
+
+ // console.log(parms)
- // this.submitDataToBackend()
- let currentIndex = 0;
-
- jsonData2.forEach((group, groupIndex) => {
- group.forEach((item) => {
- if (item.type !== '1') {
- if (params[groupIndex] && params[groupIndex][currentIndex] !== undefined) {
- item.value = params[groupIndex][currentIndex];
- }
- currentIndex++;
+ let index = 0;
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr = jsonData2[i];
+ for (let j = 0; j < arr.length; j++) {
+ let obj = arr[j];
+ if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+ obj.value = parms[0][index];
+ index++;
}
- });
- currentIndex = 0; // 鎵嬪姩閲嶇疆绱㈠紩锛屽噯澶囧鐞嗕笅涓�涓垎缁�
- });
+ }
+ }
- console.log(jsonData2);
+
+
+
+
+ // console.log(jsonData2);
}
});
@@ -189,9 +209,38 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
+ this.$router.afterEach(function(){
+ socket.close();
+ })
}
},
+ //璇█鏇挎崲
+ replaceChineseWithEnglish() {
+
+
+ const nameMap= this.$t('langPositioning1')
+ 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 if (obj.title && obj.title.name) {
+ const newName = nameMap[obj.title.name] || obj.title.name;
+ return { ...obj, title: { ...obj.title, name: newName } };
+ } else {
+ return obj;
+ }
+ });
+});
+
+
+// console.log(this.jsonData)
+
+},
send () {
@@ -219,4 +268,4 @@
.blue-button {
background-color: skyblue;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.8.0