From 0613a5b982c6521560ea17eda7c07bb97e6ec5e9 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期三, 17 一月 2024 09:14:43 +0800
Subject: [PATCH] 修改交互状态页面
---
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue | 207 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 158 insertions(+), 49 deletions(-)
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index bb5400c..79d41fa 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -18,33 +18,34 @@
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
<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">{{
+ <!-- <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
$t('ManualJog')
- }}</router-link>
+ }}</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 v-if="hasPermission" to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">
+ {{ $t('Servomanualone') }}
+ </router-link>
+
- <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
+ <router-link v-if="hasPermission" 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">{{
+
+ <router-link v-if="hasPermission" to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
$t('Speed parameter settings')
}}</router-link>
+
+<router-link v-if="hasPermission"
+ to="/Electrical/InteractionState"
+ tag="el-button"
+ type="text"
+ active-class="blue-button"
+ >{{ $t("InteractionState") }}</router-link
+ >
</el-breadcrumb>
@@ -56,21 +57,21 @@
<span class="name" style="width:300px;">{{ item.name }}</span>
<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>
+ class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></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' && groupIndex === 0 " v-model="item.value" @keyup.enter.native="A01start($event)"
+ class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></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' && groupIndex === 1" v-model="item.value" @keyup.enter.native="A02start($event)"
+ class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></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($event)"
+ class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></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($event)"
+ class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></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>
+ class="input-box" :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
</div>
</div>
<div class="button-row" style="display: flex; justify-content: space-between;">
@@ -93,6 +94,7 @@
<div class="container">
<component :is="embeddedComponent"></component>
+ <component :is="embeddedComponent2"></component>
</div>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
@@ -106,6 +108,10 @@
import data from '../../configuration/Manualoneposition'
import ManualonePosition2 from './ManualonePosition2.vue';
+import ManualJog from './ManualJog.vue';
+import {
+SelectPermissionByUserName, currentUsername
+} from "../../api/home";
// import { createWebSocket } from '../../api/websocket.js';
let socket;
export default {
@@ -116,6 +122,8 @@
jsonData: data,
language: this.$i18n.locale,
embeddedComponent: ManualonePosition2,
+ embeddedComponent2: ManualJog,
+ hasPermission: false // 榛樿娌℃湁鏉冮檺
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -129,7 +137,17 @@
this.replaceChineseWithEnglish();
}
this.$forceUpdate();
+ currentUsername().then(res => {
+ SelectPermissionByUserName(res.data).then(res => {
+ res.data.permission.forEach(item => {
+ if (item.permissionId == "36" && item.state == 1) {
+ this.hasPermission = true;
+ }
+
+ });
+ });
+ });
},
methods: {
@@ -151,7 +169,7 @@
},
- A01start(){
+ A01start(event){
const data = [];
@@ -190,9 +208,12 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
+
+
},
- A02start(){
+ A02start(event){
const data = [];
for (let i = 1; i < 2; i++) {
@@ -223,9 +244,9 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
},
- B01start(){
+ B01start(event){
const data = [];
for (let i = 2; i < 3; i++) {
@@ -248,9 +269,9 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
},
- B02start(){
+ B02start(event){
const data = [];
for (let i = 3; i < 4; i++) {
@@ -259,6 +280,16 @@
});
const values = inputData.map(item => item.value);
+
+ if (values.length > 0) {
+
+let firstValue = values[0];
+if (!(firstValue >= "106" && firstValue <= "210")) {
+ values.shift();
+ this.$message.error("Out of range");
+ return false;
+}
+}
data.unshift([], [], []);
data.push(values);
}
@@ -273,7 +304,7 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
},
submitDataToBackend (currentButtonName) {
if (currentButtonName === 'A01鍚姩' || currentButtonName === 'A01 Start') {
@@ -293,6 +324,19 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
+ setTimeout(() => {
+ const reversedData = data.map(values => values.map(value => {
+ return (!value || value === 1) ? 0 : 0 ;
+ }));
+
+ const reversedJsonObject = { data: reversedData };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const reversedJsonString = JSON.stringify(reversedJsonObject);
+ console.log('鍙嶈浆鍚�:', reversedJsonString);
+ socket?.send(reversedJsonString);
+ }, 1000);
+ this.$forceUpdate();
}
@@ -313,6 +357,19 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
+ setTimeout(() => {
+ const reversedData = data.map(values => values.map(value => {
+ return (!value || value === 1) ? 0 : 0 ;
+ }));
+
+ const reversedJsonObject = { data: reversedData };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const reversedJsonString = JSON.stringify(reversedJsonObject);
+ console.log('鍙嶈浆鍚�:', reversedJsonString);
+ socket?.send(reversedJsonString);
+ }, 1000);
+ this.$forceUpdate();
}
@@ -333,6 +390,19 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
+ setTimeout(() => {
+ const reversedData = data.map(values => values.map(value => {
+ return (!value || value === 1) ? 0 : 0 ;
+ }));
+
+ const reversedJsonObject = { data: reversedData };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const reversedJsonString = JSON.stringify(reversedJsonObject);
+ console.log('鍙嶈浆鍚�:', reversedJsonString);
+ socket?.send(reversedJsonString);
+ }, 1000);
+ this.$forceUpdate();
}
@@ -353,6 +423,19 @@
const jsonString = JSON.stringify(jsonObject);
console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
socket?.send(jsonString);
+ setTimeout(() => {
+ const reversedData = data.map(values => values.map(value => {
+ return (!value || value === 1) ? 0 : 0 ;
+ }));
+
+ const reversedJsonObject = { data: reversedData };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const reversedJsonString = JSON.stringify(reversedJsonObject);
+ console.log('鍙嶈浆鍚�:', reversedJsonString);
+ socket?.send(reversedJsonString);
+ }, 1000);
+ this.$forceUpdate();
}
@@ -399,10 +482,19 @@
const jsonString2 = JSON.stringify(jsonObject2);
console.log('鎵�鏈夊浣嶇殑value:', jsonString2);
socket?.send(jsonString2);
- // setTimeout(() =>
- // window.location.reload(), 2000
- // )
+ setTimeout(() => {
+ const reversedData = data2.map(values => values.map(value => {
+ return (!value || value === 1) ? 0 : 0 ;
+ }));
+ const reversedJsonObject = { data: reversedData };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const reversedJsonString = JSON.stringify(reversedJsonObject);
+ console.log('鍙嶈浆鍚�:', reversedJsonString);
+ socket?.send(reversedJsonString);
+ }, 1000);
+ this.$forceUpdate();
}
if (currentButtonName === '鍥為浂' || currentButtonName === 'Home') {
@@ -423,6 +515,18 @@
const jsonString2 = JSON.stringify(jsonObject2);
console.log('鎵�鏈夊洖闆剁殑value:', jsonString2);
socket?.send(jsonString2);
+ setTimeout(() => {
+ const reversedData = data2.map(values => values.map(value => {
+ return (!value || value === 1) ? 0 : 0 ;
+ }));
+
+ const reversedJsonObject = { data: reversedData };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const reversedJsonString = JSON.stringify(reversedJsonObject);
+ console.log('鍙嶈浆鍚�:', reversedJsonString);
+ socket?.send(reversedJsonString);
+ }, 1000);
// setTimeout(() =>
// window.location.reload(), 2000
// )
@@ -430,7 +534,7 @@
}
-
+
},
@@ -457,21 +561,26 @@
};
// 鏀跺埌娑堟伅
- let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+// let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
- box.addEventListener('mouseenter', () => {
- isMouseInInputBox = true;
- });
- box.addEventListener('mouseleave', () => {
- isMouseInInputBox = false;
- });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+// box.addEventListener('mouseenter', () => {
+// isMouseInInputBox = true;
+// });
+// box.addEventListener('mouseleave', () => {
+// isMouseInInputBox = false;
+// });
+// });
socket.onmessage = (msg) => {
if (!msg.data) {
return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
+
+ // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+ if (document.activeElement.tagName.toLowerCase() === 'input') {
+ return;
}
let obj = JSON.parse(msg.data);
@@ -479,9 +588,9 @@
const weihuiling = obj.weihuiling;
- if(obj.zuhe1&& !isMouseInInputBox){
+ if(obj.zuhe1){
-// console.log(obj);
+ console.log(obj);
// 鎵ц鏇存柊閫昏緫
for (let i = 0; i < 4; i++) {
--
Gitblit v1.8.0