From 5f9ca1634f6a0ba288048556e29fe2b3e7784682 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期五, 15 十二月 2023 09:59:56 +0800
Subject: [PATCH] 调整提示框
---
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue | 361 +++++++++++++++++++++++++++++++++++++-------------
1 files changed, 264 insertions(+), 97 deletions(-)
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index c09e846..d1ef0b8 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -12,46 +12,64 @@
<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="10">
<el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:585px;">
+ <el-card class="json-block" style="width:585px;margin-bottom: 10px;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:300px;">{{ item.name }}</span>
- <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
+
+ <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0' && groupIndex === 0 && (itemIndex === 2)" readonly v-model="item.value"
+ class="input-box"></el-input>
+
+ <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 " v-model="item.value" @keyup.enter.native="A01start"
+ class="input-box"></el-input>
+ <el-input style="width: 250px;" v-else-if="(item.state !== 0) && (item.type === '0') && (itemIndex === 2)" v-model="item.value" readonly class="input-box"></el-input>
+
+
+ <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value" @keyup.enter.native="A02start"
+ class="input-box"></el-input>
+ <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value" @keyup.enter.native="B01start"
+ class="input-box"></el-input>
+ <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value" @keyup.enter.native="B02start"
+ class="input-box"></el-input>
+ <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0'" v-model="item.value"
class="input-box"></el-input>
</div>
</div>
@@ -59,12 +77,12 @@
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
<el-button v-if="item.button && language === 'en-US' && item.state != 0" :name="item.button.name"
v-model="item.button.value"
- :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
+ :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'error-button3': item.button.name === 'Zero' && item.button.value === 1,'greenbutton': item.button.name !== 'NotZero' && item.button.name !== 'Fault' && item.button.value === 1 }"
@click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
item.button.name }}</el-button>
<el-button v-if="item.button && language === 'zh-CN' && item.state != 0" :name="item.button.name"
v-model="item.button.value"
- :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1, 'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0 }"
+ :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1, 'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0,'error-button3': item.button.name === '宸插洖闆�' && item.button.value === 1,'greenbutton': item.button.name !== '鏈洖闆�' && item.button.name !== '鏁呴殰' && item.button.value === 1 }"
@click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
item.button.name }}</el-button>
</div>
@@ -72,14 +90,22 @@
</el-card>
</el-col>
</el-row>
+ <div class="container">
+
+ <component :is="embeddedComponent"></component>
+ </div>
+
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
+
</template>
+
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/Manualoneposition'
import { throttle } from 'lodash';
+import ManualonePosition2 from './ManualonePosition2.vue';
let socket;
export default {
name: "ManualonePosition",
@@ -88,6 +114,7 @@
return {
jsonData: data,
language: this.$i18n.locale,
+ embeddedComponent: ManualonePosition2,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -112,25 +139,125 @@
updateButtonValue (dataGroup, itemIndex) {
// 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
- this.$set(dataGroup[itemIndex].button, 'value', 1);
+ if (dataGroup[itemIndex].button.value === 0) {
+ // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
+ } else {
+ // 鍚﹀垯灏嗗叾璁句负 0
+ this.$set(dataGroup[itemIndex].button, 'value', 0);
+ }
+
+ },
+ A01start(){
+
+ const data = [];
+
+for (let i = 0; i < 1; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+
+ data.push(values);
+}
+data.push([], [], [],[],[],[]);
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+ },
+ A02start(){
+ const data = [];
+
+for (let i = 1; i < 2; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([]);
+ data.push(values);
+}
+data.push([], [], [],[],[]);
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+ },
+ B01start(){
+ const data = [];
+
+for (let i = 2; i < 3; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([], []);
+ data.push(values);
+}
+//data.unshift([]);
+
+data.push([], [], [],[]);
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+ },
+ B02start(){
+ const data = [];
+
+for (let i = 3; i < 4; i++) {
+ const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+ return { value: item.value };
+ });
+
+ const values = inputData.map(item => item.value);
+ data.unshift([], [], []);
+ data.push(values);
+}
+
+data.push([], [],[]);
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
},
submitDataToBackend (currentButtonName) {
if (currentButtonName === 'A01鍚姩' || currentButtonName === 'A01 Start') {
const data = [];
- for (let i = 0; i < 1; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
-
- const values = inputData.map(item => item.value);
+ const values = [this.jsonData[0][3].button.value]
data.push(values);
- }
- data.push([], [], [],[],[],[]);
+
+ data.unshift([], [], [],[],[],[],[]);
@@ -146,77 +273,60 @@
if (currentButtonName === 'A02鍚姩' || currentButtonName === 'A02 Start') {
const data = [];
- for (let i = 1; i < 2; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
+const values = [this.jsonData[1][3].button.value]
- const values = inputData.map(item => item.value);
- data.unshift([]);
- data.push(values);
- }
- data.push([], [], [],[],[]);
+ data.push(values);
+
+ data.unshift([], [], [],[],[],[],[],[]);
- const jsonObject = { data };
+ const jsonObject = { data };
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
}
if (currentButtonName === 'B01鍚姩' || currentButtonName === 'B01 Start') {
const data = [];
- for (let i = 2; i < 3; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
+const values = [this.jsonData[2][3].button.value]
- const values = inputData.map(item => item.value);
- data.unshift([], []);
- data.push(values);
- }
- //data.unshift([]);
-
- data.push([], [], [],[]);
+ data.push(values);
+
+ data.unshift([], [], [],[],[],[],[],[],[]);
- const jsonObject = { data };
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
+ const jsonObject = { data };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
}
if (currentButtonName === 'B02鍚姩' || currentButtonName === 'B02 Start') {
const data = [];
- for (let i = 3; i < 4; i++) {
- const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
- return { value: item.value };
- });
+const values = [this.jsonData[3][3].button.value]
- const values = inputData.map(item => item.value);
- data.unshift([], [], []);
- data.push(values);
- }
-
- data.push([], [],[]);
+ data.push(values);
+
+ data.unshift([], [], [],[],[],[],[],[],[],[]);
- const jsonObject = { data };
+ const jsonObject = { data };
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
- socket?.send(jsonString);
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
}
@@ -268,11 +378,11 @@
}
- if (currentButtonName === '鍥為浂' || currentButtonName === 'Zero') {
+ if (currentButtonName === '鍥為浂' || currentButtonName === 'Home') {
const data2 = [];
const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && ['鍥為浂', 'Zero'].includes(subItem.button.name));
+ const buttonItem = item.find(subItem => subItem.button && ['鍥為浂', 'Home'].includes(subItem.button.name));
return buttonItem ? buttonItem.button.value : null;
}).filter(value => value !== null);
@@ -305,8 +415,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();
socket = null;
@@ -327,13 +436,13 @@
}
let obj = JSON.parse(msg.data);
- // console.log(obj);
+ // console.log(obj);
const jsonData2 = this.jsonData;
const weihuiling = obj.weihuiling;
const handleMouseMove = throttle(function (event) {
- const inputBox = document.querySelectorAll('.el-card__body');
+ const inputBox = document.querySelectorAll('.input-box');
const target = event.target;
- if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ if (obj.zuhe1 &&inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
// 鎵ц鏇存柊閫昏緫
for (let i = 0; i < 4; i++) {
jsonData2[i].forEach((item, index) => {
@@ -343,8 +452,23 @@
});
}
- //鏇存柊瀹炴椂浣嶇疆
- jsonData2.forEach((item) => {
+
+
+
+
+
+
+ }
+ }, 50);
+
+ document.addEventListener('mouseover', handleMouseMove);
+
+
+if(obj.zuhe1){
+
+
+ //鏇存柊瀹炴椂浣嶇疆
+ jsonData2.forEach((item) => {
item.forEach((subItem) => {
if (subItem.sending === 4) {
subItem.value = obj.shishi1[0][0];
@@ -375,14 +499,26 @@
}
+ for (let i = 0; i < jsonData2.length; i++) {
+ let arr4 = jsonData2[i];
+ for (let j = 0; j < arr4.length; j++) {
+ let obj4 = arr4[j];
+ if (obj4.button && (obj4.button.name.includes("鍚姩") || obj4.button.name.includes("Start"))) {
+ obj4.button.value = obj.qidong[0][i];
+ // console.log(obj2.button.value)
+ }
+ }
+
+
+ }
for (let i = 2; i < jsonData2.length; i++) {
let arr2 = jsonData2[i];
for (let j = 2; j < arr2.length; j++) {
let obj3 = arr2[j];
if (obj3.button) {
- if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero")) {
+ if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero" || obj3.button.name === "宸插洖闆�" || obj3.button.name === "Zero")) {
obj3.button.value = weihuiling[0][i];
- console.log(obj3.button.value)
+ // console.log(obj3.button.value)
}
}
@@ -393,12 +529,35 @@
}
+//鏀瑰彉鏈洖闆舵枃瀛�
+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.button && obj.button.value===1) {
+ if ( obj.button.name==="鏈洖闆�" && this.language==="zh-CN") {
+ obj.button.name =obj.button.name.replace("鏈洖闆�","宸插洖闆�") ;
+ }
+ if ( obj.button.name==="NotZero") {
+ obj.button.name =obj.button.name.replace("NotZero","Zero") ;
+ }
+ }
+ if (obj.button && obj.button.value===0) {
+ if ( obj.button.name==="宸插洖闆�"&& this.language==="zh-CN") {
+ obj.button.name =obj.button.name.replace("宸插洖闆�","鏈洖闆�") ;
+ }
+ if ( obj.button.name==="Zero") {
+ obj.button.name =obj.button.name.replace("Zero","NotZero") ;
+ }
+ }
+
+
+}
+}
+
+}
- }
- }, 200);
-
- document.addEventListener('mouseover', handleMouseMove);
};
@@ -482,4 +641,12 @@
.error-button2 {
background-color: red;
}
+.greenbutton{
+
+ background-color: green;
+}
+.error-button3{
+ background-color: green;
+
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0