From 87ff1d57df1102d1f689b806f138072f858ef421 Mon Sep 17 00:00:00 2001
From: clll <1320612696@qq.com>
Date: 星期一, 27 十一月 2023 13:37:36 +0800
Subject: [PATCH] 添加新界面,配置新界面json文件,补充IO状态界面地址,添加报警信息界面json
---
CanadaMes-ui/src/views/Electrical/Positioning2.vue | 318 +++++----
CanadaMes-ui/src/views/Electrical/Positioning1.vue | 244 ++++---
CanadaMes-ui/src/views/Electrical/Servomanual.vue | 83 +-
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 36
CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue | 136 ++++
CanadaMes-ui/src/views/Electrical/Parameter2.vue | 271 ++++----
CanadaMes-ui/src/views/Electrical/Parameter1.vue | 258 ++++---
CanadaMes-ui/src/views/Electrical/ServoManualone.vue | 357 ++++++-----
CanadaMes-ui/src/configuration/AutomaticParameterSetting.json | 67 +
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java | 32
10 files changed, 1,035 insertions(+), 767 deletions(-)
diff --git a/CanadaMes-ui/src/configuration/AutomaticParameterSetting.json b/CanadaMes-ui/src/configuration/AutomaticParameterSetting.json
index 72ce6d5..c9b9d14 100644
--- a/CanadaMes-ui/src/configuration/AutomaticParameterSetting.json
+++ b/CanadaMes-ui/src/configuration/AutomaticParameterSetting.json
@@ -1,52 +1,37 @@
[
[
{
- "name": "澶ц溅鑷姩閫熷害",
- "read": 33,
- "sending": "",
- "type": "0",
- "address": "DB100.0",
- "count": 3
- }
- ],
- [
- {
- "name": "灏忚溅鑷姩閫熷害",
- "read": 11,
- "sending": "",
- "address": "DB100.0",
- "type": "0"
- }
- ],
- [
- {
"name": "A01琛岃蛋楂橀�熻搴�",
"read": 33,
"sending": "",
"type": "0",
"address": "DB100.0",
- "count": 3
+ "count": 3,
+ "value": ""
},
{
"name": "A01琛岃蛋浣庨�熻搴�",
"read": 11,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
},
{
"name": "A01杈撻�佹帴鐗囪搴�",
"read": 22,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
},
{
"name": "A01绗煎瓙瑙掑害",
"read": 22,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
}
],
[
@@ -56,28 +41,53 @@
"sending": "",
"type": "0",
"address": "DB100.0",
- "count": 3
+ "count": 3,
+ "value": ""
},
{
"name": "A02琛岃蛋浣庨�熻搴�",
"read": 11,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
},
{
"name": "A02杈撻�佹帴鐗囪搴�",
"read": 22,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
},
{
"name": "A02绗煎瓙瑙掑害",
"read": 22,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
+ }
+ ],
+ [
+ {
+ "name": "澶ц溅鑷姩閫熷害",
+ "read": 100,
+ "sending": "",
+ "type": "0",
+ "address": "DB100.0",
+ "count": 3,
+ "value": ""
+ }
+ ],
+ [
+ {
+ "name": "灏忚溅鑷姩閫熷害",
+ "read": 11,
+ "sending": "",
+ "address": "DB100.0",
+ "type": "0",
+ "value": ""
}
],
[
@@ -86,7 +96,8 @@
"read": 33,
"sending": "",
"address": "DB100.0",
- "type": "0"
+ "type": "0",
+ "value": ""
}
]
]
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
index 7c9475b..8ea34da 100644
--- a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
+++ b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -51,8 +51,8 @@
<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>
- <el-input style="width:150px;" v-if="item.type === '0'" v-model="item.read" class="input-box"></el-input>
- <el-input style="width:150px;" v-if="item.type === '0'" v-model="item.sending" class="input-box"></el-input>
+ <el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box"
+ @keyup.enter.native="submitDataToBackend"></el-input>
</div>
</div>
</el-card>
@@ -65,6 +65,8 @@
<script>
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/AutomaticParameterSetting'
+import { throttle } from 'lodash';
+let socket;
export default {
name: "AutomaticParameterSetting",
@@ -73,6 +75,11 @@
return {
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
+ },
+ created () {
+ this.initWebSocket();
+ // console.log('jsonData:', this.jsonData);
+
},
methods: {
updateButtonValue (dataGroup, itemIndex) {
@@ -90,10 +97,129 @@
});
});
- // 妯℃嫙鎻愪氦鏁版嵁鍒板悗绔殑鎿嶄綔锛屽疄闄呮儏鍐典笅闇�瑕佹牴鎹綘鐨勫悗绔疉PI杩涜淇敼
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', inputData);
+ // 灏唅nputData杞崲涓烘暣鏁版暟缁�
+ const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+ });
+ // 鏋勫缓JSON瀵硅薄
+ const jsonObject = { data: integerArray };
- }
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ socket?.send(jsonString);
+
+
+ },
+ initWebSocket () {
+
+ let viewname = "AutomaticParameterSetting";
+
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+
+ // 鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+
+ // 鏀跺埌娑堟伅
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
+
+ let obj = JSON.parse(msg.data);
+ const jsonData2 = this.jsonData;
+
+ const handleMouseMove = throttle(function (event) {
+
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ const parms = obj.params;
+ const fanzhuan = obj.fanzhuan;
+ const xiaoche = obj.xiaoche;
+ const dache = obj.dache1;
+
+ // console.log('parms:', parms);
+ // console.log('fanzhuan:', fanzhuan);
+ // console.log('xiaoche:', xiaoche);
+ // console.log('dache:', dache);
+
+ let index = 0;
+ for (let i = 0; i < jsonData2.length - 1; 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')) {
+ if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+ obj.value = parms[0][index];
+ index++;
+ }
+ }
+ }
+ }
+ if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
+ jsonData2[4][0]['value'] = fanzhuan[0][0];
+ }
+ if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
+ jsonData2[3][0]['value'] = xiaoche[0][0];
+ }
+ if (Array.isArray(dache) && Array.isArray(dache[0]) && dache[0][0] !== undefined) {
+ jsonData2[2][0]['value'] = dache[0][0];
+ }
+ }
+ }, 50);
+
+ document.addEventListener('mouseover', handleMouseMove);
+ };
+
+
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
+
+ }
+
+ },
+ 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));
+ },
+
}
}
</script>
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter1.vue b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
index f06f2fc..e3e5032 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter1.vue
@@ -1,6 +1,6 @@
<template>
<div class="app">
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
<router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
}}</router-link>
<router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
@@ -11,43 +11,60 @@
}}</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('Servo Manual')
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ServoManual')
}}</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 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>
- </el-breadcrumb>
+ <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>
+ <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualJog')
+ }}</router-link>
+ </el-breadcrumb>
- <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">
- <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span>
+ <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">
+ <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span>
+ </div>
</div>
- </div>
- <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" @keyup.enter.native="submitDataToBackend"></el-input>
+ <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"
+ @keyup.enter.native="submitDataToBackend"></el-input>
+ </div>
</div>
- </div>
-
- </el-card>
- </el-col>
- </el-row>
- <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
-</div>
+
+ </el-card>
+ </el-col>
+ </el-row>
+ <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
+ </div>
</template>
<script>
@@ -56,52 +73,52 @@
import { throttle } from 'lodash';
let socket;
export default {
-name: "Parameter1",
-mixins: [LanguageMixin],
-data() {
- return {
- jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
- }
-}, created () {
+ name: "Parameter1",
+ mixins: [LanguageMixin],
+ data () {
+ return {
+ jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ }
+ }, created () {
this.initWebSocket();
// console.log('jsonData:', this.jsonData);
},
methods: {
- updateButtonValue(dataGroup, itemIndex) {
+ updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
},
- submitDataToBackend() {
- const inputData = this.jsonData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item.type === '0') {
- return { value: parseInt(item.value) };
- } else if (item.button) {
- return { value: parseInt(item.button.value) };
- }
- return null;
- });
- });
+ submitDataToBackend () {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '0') {
+ return { value: parseInt(item.value) };
+ } else if (item.button) {
+ return { value: parseInt(item.button.value) };
+ }
+ return null;
+ });
+ });
- // 灏唅nputData杞崲涓烘暣鏁版暟缁�
- const integerArray = inputData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item !== null) {
- return item.value;
- }
- return null;
- });
- });
- // 鏋勫缓JSON瀵硅薄
- const jsonObject = { data: integerArray };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
- socket?.send(jsonString);
-},
+ // 灏唅nputData杞崲涓烘暣鏁版暟缁�
+ const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+ });
+ // 鏋勫缓JSON瀵硅薄
+ const jsonObject = { data: integerArray };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ socket?.send(jsonString);
+ },
initWebSocket () {
-
+
let viewname = "Parameter1";
if (typeof WebSocket === "undefined") {
@@ -124,49 +141,50 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
-
- let obj = JSON.parse(msg.data);
- const jsonData2 = this.jsonData;
-
- const handleMouseMove = throttle(function(event) {
- const inputBox = document.querySelectorAll('.el-card__body');
- const target = event.target;
- if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
- const parms = obj.params;
- const fanzhuan = obj.fanzhuan;
- const xiaoche = obj.xiaoche;
-
- // console.log('parms:', parms);
- // console.log('fanzhuan:', fanzhuan);
- // console.log('xiaoche:', xiaoche);
-
- 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')) {
- if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
- obj.value = parms[0][index];
- index++;
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
}
- }
- }
- if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
- jsonData2[3][0]['value'] = fanzhuan[0][0];
- }
- if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
- jsonData2[4][0]['value'] = xiaoche[0][0];
- }
- }
- }, 200);
- document.addEventListener('mouseover', handleMouseMove);
-};
+ let obj = JSON.parse(msg.data);
+ const jsonData2 = this.jsonData;
+
+ const handleMouseMove = throttle(function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ const parms = obj.params;
+ const fanzhuan = obj.fanzhuan;
+ const xiaoche = obj.xiaoche;
+
+ // console.log('parms:', parms);
+ // console.log('fanzhuan:', fanzhuan);
+ // console.log('xiaoche:', xiaoche);
+
+ 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')) {
+ if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+ obj.value = parms[0][index];
+ index++;
+ }
+ }
+ }
+ }
+ if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
+ jsonData2[3][0]['value'] = fanzhuan[0][0];
+ }
+ if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
+ jsonData2[4][0]['value'] = xiaoche[0][0];
+ }
+ }
+ }, 200);
+
+ document.addEventListener('mouseover', handleMouseMove);
+ };
@@ -182,10 +200,10 @@
socket.onerror = function () {
console.log("websocket鍙戠敓浜嗛敊璇�");
};
-
+
}
-
+
},
replaceChineseWithEnglish () {
const translation = this.$t('Parameter1');
@@ -193,27 +211,29 @@
// console.log(translation);
},
send () {
-
-
+
+
socket?.send(JSON.stringify(this.messagepack));
},
}
- }
+}
</script>
<style scoped>
.item-row {
-display: flex;
-align-items: center;
-margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ display: flex;
+ align-items: center;
+ margin-bottom: 5px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
-margin-right: 30px;
-background: #66b1ff;
-color: #FFF;
+ margin-right: 30px;
+ background: #66b1ff;
+ color: #FFF;
}
+
.blue-button {
background-color: skyblue;
}
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index 8aac6bd..b16bb05 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -1,74 +1,92 @@
<template>
- <div class="app">
+ <div class="app">
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
- }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
- }}</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/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('Servo Manual')
- }}</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/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
+ }}</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</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/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')
+ }}</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>
+ <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualJog')
+ }}</router-link>
+ </el-breadcrumb>
+
<el-row :gutter="20">
<el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:260px;">
+ <el-card class="json-block" style="width:260px;">
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span>
+ <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span>
</div>
</div>
<div class="button-row" style="display: flex; justify-content: space-between;">
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
<el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" class="action-button"
- @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)"
- :class="{ 'green-button': item.button.value === 0 && item.button.name !== '娓呴櫎ID','red-button': item.button.value === 1 && item.button.name !== '娓呴櫎ID' }">{{ item.button.name }}</el-button>
+ @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name)"
+ :class="{ 'green-button': item.button.value === 0 && item.button.name !== '娓呴櫎ID', 'red-button': item.button.value === 1 && item.button.name !== '娓呴櫎ID' }">{{
+ item.button.name }}</el-button>
</div>
</div>
<div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
<div class="item-row">
<span class="name" style="width:150px;">{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:150px;" class="input-box"></el-input>
+ <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:150px;"
+ class="input-box"></el-input>
</div>
</div>
-
+
</el-card>
</el-col>
</el-row>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
- </template>
+</template>
- <script>
- import LanguageMixin from '../../lang/LanguageMixin'
- import data from '../../configuration/parameter2'
- let socket;
- export default {
+<script>
+import LanguageMixin from '../../lang/LanguageMixin'
+import data from '../../configuration/parameter2'
+let socket;
+export default {
name: "Parameter2",
mixins: [LanguageMixin],
- data() {
+ data () {
return {
- jsonData: data ,
+ jsonData: data,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -79,38 +97,38 @@
},
methods: {
- updateButtonValue(dataGroup, itemIndex) {
- // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+ updateButtonValue (dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
- this.$set(dataGroup[itemIndex].button, 'value', 1);
-
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
- // 灏嗗叾浠栨寜閽殑鍊煎叏閮ㄨ涓�0
-},
- submitDataToBackend(currentButtonName) {
- if (currentButtonName === '娓呴櫎ID') {
- const inputData = this.jsonData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item.type === '3') {
- return { value: item.button.value };
- }
- return null;
- });
- });
+ // 灏嗗叾浠栨寜閽殑鍊煎叏閮ㄨ涓�0
- const values = inputData.flat().filter(item => item !== null).map(item => item.value);
+ },
+ submitDataToBackend (currentButtonName) {
+ if (currentButtonName === '娓呴櫎ID') {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '3') {
+ return { value: item.button.value };
+ }
+ return null;
+ });
+ });
- const jsonObject = { data: values };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- console.log('Type涓�3鐨剉alue:', jsonString);
- socket?.send(jsonString);
- }
-},
+ const values = inputData.flat().filter(item => item !== null).map(item => item.value);
+
+ const jsonObject = { data: values };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('Type涓�3鐨剉alue:', jsonString);
+ socket?.send(jsonString);
+ }
+ },
initWebSocket () {
-
+
let viewname = "Parameter2";
if (typeof WebSocket === "undefined") {
@@ -133,59 +151,59 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- let obj = JSON.parse(msg.data);
-
- const jsonData2 = this.jsonData;
-
- // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
- // this.submitDataToBackend()
- const parms = obj.params;
- // console.log(parms);
+ let obj = JSON.parse(msg.data);
- 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') {
- obj.value = parms[1][i];
- }
- }
+ const jsonData2 = this.jsonData;
-
-}
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
+ // console.log(parms);
-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 === '4') {
- obj.button.value = parms[2][i];
- }
- }
+ 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') {
+ obj.value = parms[1][i];
+ }
+ }
-
-}
-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 === '3') {
- obj.button.value = parms[0][i];
- }
- }
+ }
-
-}
+ 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 === '4') {
+ obj.button.value = parms[2][i];
+ }
+ }
-// console.log(jsonData2);
-
-};
+ }
+
+ 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 === '3') {
+ obj.button.value = parms[0][i];
+ }
+ }
+
+
+ }
+
+ // console.log(jsonData2);
+
+
+ };
@@ -203,28 +221,30 @@
}
},
send () {
-
-
+
+
socket?.send(JSON.stringify(this.messagepack));
}
}
- }
- </script>
+}
+</script>
- <style scoped>
- .item-row {
+<style scoped>
+.item-row {
display: flex;
align-items: center;
- margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
- }
-
- .action-button {
+ margin-bottom: 5px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+}
+
+.action-button {
margin-right: 30px;
background: #66b1ff;
color: #FFF;
- }
- .blue-button {
+}
+
+.blue-button {
background-color: skyblue;
}
@@ -232,8 +252,7 @@
background-color: green;
}
-.red-button{
+.red-button {
background-color: red;
}
-
- </style>
\ No newline at end of file
+</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index 52de811..24132fc 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -1,68 +1,86 @@
<template>
- <div class="app">
+ <div class="app">
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
- }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
- }}</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/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('Servo Manual')
- }}</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/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
+ }}</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</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/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')
+ }}</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>
+ <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualJog')
+ }}</router-link>
+ </el-breadcrumb>
+
<el-row :gutter="18" class='card'>
- <el-col :span="7" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" >
+ <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">
- <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span>
+ <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span>
</div>
</div>
<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' && item.name !== '鏍煎瓙闂磋窛' && item.name !== '鍑虹墖鎺ョ墖鍦板潃' && item.name !== '瀛樼墖鎺ョ墖鍦板潃'" class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
+
+
+ <el-button
+ v-if="item.type === '0' && item.name !== '鏍煎瓙闂磋窛' && item.name !== '鍑虹墖鎺ョ墖鍦板潃' && item.name !== '瀛樼墖鎺ョ墖鍦板潃'"
+ class="input-box" @click="submitDataToBackend();">鍙栧湴鍧�</el-button>
</div>
</div>
-
+
</el-card>
</el-col>
</el-row>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
- </template>
+</template>
- <script>
- let socket;
- import LanguageMixin from '../../lang/LanguageMixin'
- import data from '../../configuration/Positioning1'
-
- export default {
+<script>
+let socket;
+import LanguageMixin from '../../lang/LanguageMixin'
+import data from '../../configuration/Positioning1'
+
+export default {
name: "Positioning1",
mixins: [LanguageMixin],
- data() {
+ data () {
return {
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -73,40 +91,40 @@
},
methods: {
- updateButtonValue(dataGroup, itemIndex) {
+ updateButtonValue (dataGroup, itemIndex) {
this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
},
- submitDataToBackend() {
- const inputData = this.jsonData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item.type === '0') {
- return { value: parseInt(item.value) };
- } else if (item.button) {
- return { value: parseInt(item.title.value) };
- }
- return null;
- });
- });
+ submitDataToBackend () {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '0') {
+ return { value: parseInt(item.value) };
+ } else if (item.button) {
+ return { value: parseInt(item.title.value) };
+ }
+ return null;
+ });
+ });
- // 灏唅nputData杞崲涓烘暣鏁版暟缁�
- const integerArray = inputData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item !== null) {
- return item.value;
- }
- return null;
- });
- });
- // 鏋勫缓JSON瀵硅薄
- const jsonObject = { data: integerArray };
-
- // 鎻愪氦鏁版嵁鍒板悗绔�
- const jsonString = JSON.stringify(jsonObject);
- // console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
- socket?.send(jsonString);
-},
+ // 灏唅nputData杞崲涓烘暣鏁版暟缁�
+ const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+ });
+ // 鏋勫缓JSON瀵硅薄
+ const jsonObject = { data: integerArray };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ // console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ socket?.send(jsonString);
+ },
initWebSocket () {
-
+
let viewname = "Positioning1";
if (typeof WebSocket === "undefined") {
@@ -129,43 +147,43 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- let obj = JSON.parse(msg.data);
- const jsonData2 = this.jsonData;
- document.addEventListener('mouseover', function(event) {
- const inputBox = document.querySelectorAll('.el-card__body');
- const target = event.target;
- if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
- // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
- // this.submitDataToBackend()
- const parms = obj.params;
-
+ let obj = JSON.parse(msg.data);
+ const jsonData2 = this.jsonData;
+ document.addEventListener('mouseover', function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
-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++;
- }
- }
-}
+
+ 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++;
+ }
+ }
+ }
-// console.log(jsonData2);
+ // console.log(jsonData2);
- }
- });
-};
+ }
+ });
+ };
@@ -183,28 +201,30 @@
}
},
send () {
-
-
+
+
socket?.send(JSON.stringify(this.messagepack));
},
}
- }
- </script>
+}
+</script>
- <style scoped>
- .item-row {
+<style scoped>
+.item-row {
display: flex;
align-items: center;
- margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
- }
-
- .action-button {
+ margin-bottom: 5px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+}
+
+.action-button {
margin-right: 30px;
background: #66b1ff;
color: #FFF;
- }
- .blue-button {
+}
+
+.blue-button {
background-color: skyblue;
}
- </style>
+</style>
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning2.vue b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
index 5e20ccf..4ecd2ac 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning2.vue
@@ -1,6 +1,6 @@
<template>
<div class="app">
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
<router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
}}</router-link>
<router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
@@ -11,44 +11,60 @@
}}</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('Servo Manual')
+ <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ServoManual')
}}</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 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>
- </el-breadcrumb>
+ <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>
+ <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualJog')
+ }}</router-link>
+ </el-breadcrumb>
- <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">
- <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span>
+ <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">
+ <span v-if="item.title" :name="item.title.name" class="action-button">{{ item.title.name }}</span>
+ </div>
</div>
- </div>
- <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>
+ <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>
+ </div>
</div>
- </div>
-
- </el-card>
- </el-col>
- </el-row>
- <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
-</div>
+
+ </el-card>
+ </el-col>
+ </el-row>
+ <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
+ </div>
</template>
<script>
@@ -57,145 +73,147 @@
import data from '../../configuration/Positioning2'
export default {
-name: "Positioning2",
-mixins: [LanguageMixin],
-data() {
- return {
- jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
- }
-},
-created () {
- this.initWebSocket();
- // console.log('jsonData:', this.jsonData);
-
-},
-methods: {
- updateButtonValue(dataGroup, itemIndex) {
- this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
+ name: "Positioning2",
+ mixins: [LanguageMixin],
+ data () {
+ return {
+ jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
+ }
},
- submitDataToBackend() {
-const inputData = this.jsonData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item.type === '0') {
- return { value: parseInt(item.value) };
- } else if (item.button) {
- return { value: parseInt(item.title.value) };
- }
- return null;
- });
-});
+ created () {
+ this.initWebSocket();
+ // console.log('jsonData:', this.jsonData);
-// 灏唅nputData杞崲涓烘暣鏁版暟缁�
-const integerArray = inputData.map(dataGroup => {
- return dataGroup.map(item => {
- if (item !== null) {
- return item.value;
- }
- return null;
- });
-});
-// 鏋勫缓JSON瀵硅薄
-const jsonObject = { data: integerArray };
+ },
+ methods: {
+ updateButtonValue (dataGroup, itemIndex) {
+ this.$set(dataGroup[itemIndex].button, 'value', 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
+ },
+ submitDataToBackend () {
+ const inputData = this.jsonData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item.type === '0') {
+ return { value: parseInt(item.value) };
+ } else if (item.button) {
+ return { value: parseInt(item.title.value) };
+ }
+ return null;
+ });
+ });
-// 鎻愪氦鏁版嵁鍒板悗绔�
-const jsonString = JSON.stringify(jsonObject);
-// console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
-socket?.send(jsonString);
-},
- initWebSocket () {
+ // 灏唅nputData杞崲涓烘暣鏁版暟缁�
+ const integerArray = inputData.map(dataGroup => {
+ return dataGroup.map(item => {
+ if (item !== null) {
+ return item.value;
+ }
+ return null;
+ });
+ });
+ // 鏋勫缓JSON瀵硅薄
+ const jsonObject = { data: integerArray };
- let viewname = "Positioning2";
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ // console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
+ socket?.send(jsonString);
+ },
+ initWebSocket () {
- if (typeof WebSocket === "undefined") {
- console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
- } else {
- let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+ let viewname = "Positioning2";
- if (socket != null) {
- socket.close();
- socket = null;
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+
+ // 鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+
+ // 鏀跺埌娑堟伅
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
+
+ let obj = JSON.parse(msg.data);
+ const jsonData2 = this.jsonData;
+ document.addEventListener('mouseover', function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+ // this.submitDataToBackend()
+ const parms = obj.params;
+
+
+ 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++;
+ }
+ }
+ }
+ // console.log(jsonData2);
+
+ }
+ });
+ };
+
+
+
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ };
+
}
+ },
+ send () {
- // 寮�鍚竴涓獁ebsocket鏈嶅姟
- socket = new WebSocket(socketUrl);
- // 鎵撳紑浜嬩欢
- socket.onopen = function () {
- console.log("websocket宸叉墦寮�");
- };
-
- // 鏀跺埌娑堟伅
- socket.onmessage = (msg) => {
-if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
-}
-
-let obj = JSON.parse(msg.data);
-const jsonData2 = this.jsonData;
-document.addEventListener('mouseover', function(event) {
- const inputBox = document.querySelectorAll('.el-card__body');
- const target = event.target;
- if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
- // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
- // this.submitDataToBackend()
- const parms = obj.params;
-
-
- 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++;
- }
- }
-}
-// console.log(jsonData2);
+ socket?.send(JSON.stringify(this.messagepack));
+ },
}
-});
-};
-
-
-
-
- // 鍏抽棴浜嬩欢
- socket.onclose = function () {
- console.log("websocket宸插叧闂�");
- };
-
- // 鍙戠敓閿欒浜嬩欢
- socket.onerror = function () {
- console.log("websocket鍙戠敓浜嗛敊璇�");
- };
-
- }
- },
- send () {
-
-
- socket?.send(JSON.stringify(this.messagepack));
- },
-
-}
}
</script>
<style scoped>
.item-row {
-display: flex;
-align-items: center;
-margin-bottom: 5px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ display: flex;
+ align-items: center;
+ margin-bottom: 5px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
-margin-right: 30px;
-background: #66b1ff;
-color: #FFF;
+ margin-right: 30px;
+ background: #66b1ff;
+ color: #FFF;
}
+
.blue-button {
-background-color: skyblue;
+ background-color: skyblue;
}
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index b9f65fc..21b837c 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -1,56 +1,90 @@
<template>
- <div class="app">
+ <div class="app">
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
- }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
- }}</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/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('Servo Manual')
- }}</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 to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
}}</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/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</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/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')
+ }}</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>
+ <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/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>
+ <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualJog')
+ }}</router-link>
</el-breadcrumb>
<el-row :gutter="26">
- <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
- <el-card class="json-block" style="width:auto;">
- <el-row >
- <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12">
- <div class="item-container">
- <div class="item-row">
- <span class="name" style='width:230px;'>{{ item.name }}</span>
- <el-input v-if="item.type === '0'" v-model="item.value" class='input-box' :class="{ 'special-class': groupIndex === 0,'special-class2': groupIndex === 1 }" v-show="groupIndex !== 0 && groupIndex !== 1" ></el-input>
+ <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
+ <el-card class="json-block" style="width:auto;">
+ <el-row>
+ <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12">
+ <div class="item-container">
+ <div class="item-row">
+ <span class="name" style='width:230px;'>{{ item.name }}</span>
+ <el-input v-if="item.type === '0'" v-model="item.value" class='input-box'
+ :class="{ 'special-class': groupIndex === 0, 'special-class2': groupIndex === 1 }"
+ v-show="groupIndex !== 0 && groupIndex !== 1"></el-input>
+ </div>
+ </div>
+ </el-col>
+ </el-row>
+ <div class="button-row" style="display: flex; justify-content: space-between;">
+ <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
+ <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value"
+ :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1 }"
+ @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
+ item.button.name }}</el-button>
+
</div>
</div>
- </el-col>
- </el-row>
- <div class="button-row" style="display: flex; justify-content: space-between;">
- <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
- <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button>
-
- </div>
- </div>
- </el-card>
- </el-col>
-</el-row>
+ </el-card>
+ </el-col>
+ </el-row>
<!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
</div>
@@ -61,12 +95,12 @@
import data from '../../configuration/ServoManualone'
import { throttle } from 'lodash';
let socket;
- export default {
+export default {
name: "ServoManualone",
mixins: [LanguageMixin],
- data() {
+ data () {
return {
- jsonData: data ,
+ jsonData: data,
// 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
@@ -77,84 +111,84 @@
},
methods: {
- updateButtonValue(dataGroup, itemIndex) {
- // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
+ updateButtonValue (dataGroup, itemIndex) {
+ // 灏嗗綋鍓嶆寜閽殑鍊艰涓�1
- this.$set(dataGroup[itemIndex].button, 'value', 1);
-
-
-
-},
-submitDataToBackend(currentButtonName) {
- if (currentButtonName === '鍗婅嚜鍔ㄥ惎鍔�') {
- const data = [];
-
-for (let i = 0; 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.push(values);
-}
+ this.$set(dataGroup[itemIndex].button, 'value', 1);
-const jsonObject = { data };
+ },
+ submitDataToBackend (currentButtonName) {
+ if (currentButtonName === '鍗婅嚜鍔ㄥ惎鍔�') {
+ const data = [];
-// 鎻愪氦鏁版嵁鍒板悗绔�
-const jsonString = JSON.stringify(jsonObject);
-console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
-socket?.send(jsonString);
+ for (let i = 0; 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);
- if (currentButtonName === '澶嶄綅') {
-
- const data2 = [];
- const resetButtonValues = this.jsonData.map(item => {
- const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '澶嶄綅');
- return buttonItem ? buttonItem.button.value : null;
-}).filter(value => value !== null);
-
-// 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
-data2.push(...resetButtonValues);
-const jsonObject2 = { data2 };
-
-// 鎻愪氦鏁版嵁鍒板悗绔�
-const jsonString2 = JSON.stringify(jsonObject2);
-console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
-socket?.send(jsonString2);
+ data.push(values);
+ }
-}
- if (currentButtonName === 'A01鍗婅嚜鍔�') {
- const elements = document.getElementsByClassName('special-class');
- for (let i = 0; i < elements.length; i++) {
- if (elements[i].style.display === 'none') {
- elements[i].style.display = ''; // 鏄剧ず鍏冪礌
- }
- }
- }
- if (currentButtonName === 'A02鍗婅嚜鍔�') {
- const elements = document.getElementsByClassName('special-class2');
- for (let i = 0; i < elements.length; i++) {
- if (elements[i].style.display === 'none') {
- elements[i].style.display = ''; // 鏄剧ず鍏冪礌
- }
- }
- }
+ const jsonObject = { data };
-
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString = JSON.stringify(jsonObject);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+ socket?.send(jsonString);
-
-},
+ }
+
+ if (currentButtonName === '澶嶄綅') {
+
+ const data2 = [];
+ const resetButtonValues = this.jsonData.map(item => {
+ const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '澶嶄綅');
+ return buttonItem ? buttonItem.button.value : null;
+ }).filter(value => value !== null);
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data2.push(...resetButtonValues);
+ const jsonObject2 = { data2 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString2 = JSON.stringify(jsonObject2);
+ console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString2);
+ socket?.send(jsonString2);
+
+
+ }
+ if (currentButtonName === 'A01鍗婅嚜鍔�') {
+ const elements = document.getElementsByClassName('special-class');
+ for (let i = 0; i < elements.length; i++) {
+ if (elements[i].style.display === 'none') {
+ elements[i].style.display = ''; // 鏄剧ず鍏冪礌
+ }
+ }
+ }
+
+ if (currentButtonName === 'A02鍗婅嚜鍔�') {
+ const elements = document.getElementsByClassName('special-class2');
+ for (let i = 0; i < elements.length; i++) {
+ if (elements[i].style.display === 'none') {
+ elements[i].style.display = ''; // 鏄剧ず鍏冪礌
+ }
+ }
+ }
+
+
+
+
+ },
initWebSocket () {
-
+
let viewname = "ServoManualone";
if (typeof WebSocket === "undefined") {
@@ -177,48 +211,48 @@
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
- if (!msg.data) {
- return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
- }
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- let obj = JSON.parse(msg.data);
- // console.log(obj)
- const jsonData2 = this.jsonData;
+ let obj = JSON.parse(msg.data);
+ // console.log(obj)
+ const jsonData2 = this.jsonData;
- const handleMouseMove = throttle(function(event) {
- const inputBox = document.querySelectorAll('.el-card__body');
- const target = event.target;
- if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
- // 鎵ц鏇存柊閫昏緫
- for (let i = 0; i < 6; i++) {
- jsonData2[i].forEach((item, index) => {
- if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined') {
- item.value = obj[`zuhe${i+1}`][0][index];
- }
- });
-}
+ const handleMouseMove = throttle(function (event) {
+ const inputBox = document.querySelectorAll('.el-card__body');
+ const target = event.target;
+ if (inputBox && Array.from(inputBox).every(box => !box.contains(target))) {
+ // 鎵ц鏇存柊閫昏緫
+ for (let i = 0; i < 6; i++) {
+ jsonData2[i].forEach((item, index) => {
+ if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i + 1}`][0][index] !== 'undefined') {
+ item.value = obj[`zuhe${i + 1}`][0][index];
+ }
+ });
+ }
-// 閬嶅巻guzhang鏁扮粍
-for (let i = 0; i < obj.guzhang[0].length; i++) {
- const guzhangValue = obj.guzhang[0][i];
-
- // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
- for (let j = 0; j < jsonData2.length; j++) {
- const section = jsonData2[j];
-
- for (let k = 0; k < section.length; k++) {
- const item = section[k];
-
- if (item.button && item.button.name === "鏁呴殰") {
- // 鏇存柊value灞炴��
- item.button.value = guzhangValue;
- break;
- }
- }
-
-
- }
-}
+ // 閬嶅巻guzhang鏁扮粍
+ for (let i = 0; i < obj.guzhang[0].length; i++) {
+ const guzhangValue = obj.guzhang[0][i];
+
+ // 鏌ユ壘jsonData2涓甫鏈�"button"鐨勫璞★紝骞朵笖name绛変簬"鏁呴殰"
+ for (let j = 0; j < jsonData2.length; j++) {
+ const section = jsonData2[j];
+
+ for (let k = 0; k < section.length; k++) {
+ const item = section[k];
+
+ if (item.button && item.button.name === "鏁呴殰") {
+ // 鏇存柊value灞炴��
+ item.button.value = guzhangValue;
+ break;
+ }
+ }
+
+
+ }
+ }
@@ -226,11 +260,11 @@
- }
-}, 200);
+ }
+ }, 200);
- document.addEventListener('mouseover', handleMouseMove);
-};
+ document.addEventListener('mouseover', handleMouseMove);
+ };
@@ -248,22 +282,21 @@
}
},
send () {
-
-
+
+
socket?.send(JSON.stringify(this.messagepack));
}
}
- }
+}
</script>
<style scoped>
-
-
.item-row {
display: flex;
align-items: center;
- margin-bottom: 2px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ margin-bottom: 2px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
@@ -271,12 +304,12 @@
background: #66b1ff;
color: #FFF;
}
+
.blue-button {
background-color: skyblue;
}
+
.error-button {
background-color: red;
}
-
-
</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Servomanual.vue b/CanadaMes-ui/src/views/Electrical/Servomanual.vue
index b2ae739..804876a 100644
--- a/CanadaMes-ui/src/views/Electrical/Servomanual.vue
+++ b/CanadaMes-ui/src/views/Electrical/Servomanual.vue
@@ -1,39 +1,53 @@
<template>
- <div class="app">
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
- }}</router-link>
- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
- }}</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/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('Servo Manual')
- }}</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')
+ <div class="app">
+ <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
}}</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/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
+ }}</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/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')
+ }}</router-link>
+
</el-breadcrumb>
-
- </div >
+ <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>
+ <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
+ $t('ManualJog')
+ }}</router-link>
+ </el-breadcrumb>
+ </div>
</template>
<script>
import LanguageMixin from '../../lang/LanguageMixin'
@@ -47,7 +61,7 @@
jsonData: data // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
}
},
- created() {
+ created () {
// 閫氳繃璺敱璺宠浆鍒�/Electrical/Servomanualone椤甸潰
this.$router.push('/Electrical/Servomanualone');
}
@@ -58,13 +72,16 @@
.item-row {
display: flex;
align-items: center;
- margin-bottom: 10px; /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
+ margin-bottom: 10px;
+ /* 璋冩暣姣忎釜椤圭洰涔嬮棿鐨勯棿璺� */
}
.action-button {
- margin-right: 60px; /* 璋冩暣鎸夐挳涔嬮棿鐨勯棿璺� */
+ margin-right: 60px;
+ /* 璋冩暣鎸夐挳涔嬮棿鐨勯棿璺� */
}
+
.blue-button {
background-color: skyblue;
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
index 607e51e..08b75b0 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1.java
@@ -66,9 +66,9 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
-// this.readValue();
-// String PlcAddress = this.name;
-// Integer Plccount = this.count;
+ // this.readValue();
+ // String PlcAddress = this.name;
+ // Integer Plccount = this.count;
// System.out.println(stt);
// List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
@@ -78,10 +78,8 @@
List<Short> arraylist = new ArrayList<>(Arrays.asList(values1));
Short[] fanzhuan = { 4 };
List<Short> fanzhuan1 = new ArrayList<>(Arrays.asList(fanzhuan));
- Short[] xiaoche = {5};
+ Short[] xiaoche = { 5 };
List<Short> xiaoche1 = new ArrayList<>(Arrays.asList(xiaoche));
-
-
JSONObject jsonObject = new JSONObject();
// new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
@@ -92,13 +90,16 @@
jsonObject.append("xiaoche", xiaoche1);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter1");
+ // System.out.println(sendwServer);
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
}
WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter1");
+
if (webSocketServer != null) {
List<String> messages = webSocketServer.getMessages();
+ // System.out.println(messages);
String addressList1 = "DB100.0";
String addressList2 = "DB100.8";
String addressList3 = "DB100.12";
@@ -106,9 +107,9 @@
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
String lastMessage = messages.get(messages.size() - 1);
-// System.out.println("lastMessage锛�" + lastMessage);
+ // System.out.println("lastMessage锛�" + lastMessage);
JSONArray messageArray = new JSONArray(lastMessage);
-
+ // System.out.println(messageArray);
// 鏁村悎绗� 1 鍒� 3 涓暟缁勫苟鍘绘帀 null 鍏冪礌
List<Short> mergedList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
@@ -135,8 +136,9 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
-// S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue));
- System.out.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList1);
+ // S7control.getinstance().WriteWord(addressList1, Arrays.asList(sValue));
+ System.out
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList1);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -151,8 +153,9 @@
try {
String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
short sValue = Short.parseShort(cleanedValue.trim());
-// S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
- System.out.println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
+ // S7control.getinstance().WriteWord(addressList2, Arrays.asList(sValue));
+ System.out
+ .println("messageValue锛�" + Arrays.asList(sValue) + " written to PLC at address " + addressList2);
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -162,16 +165,15 @@
// 鍐欏叆绗笁涓湴鍧�
if (!mergedList.isEmpty()) {
-// S7control.getinstance().WriteWord(addressList3, mergedList);
+ // S7control.getinstance().WriteWord(addressList3, mergedList);
System.out.println("messageValue锛�" + mergedList + " written to PLC at address " + addressList3);
}
// 娓呯┖娑堟伅鍒楄〃
webSocketServer.clearMessages();
}
-
- }
+ }
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index 8978f12..7d52f42 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -6,6 +6,7 @@
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
+import com.example.springboot.component.PLCAutomaticParameterSetting;
import com.example.springboot.component.PlcHold;
import com.example.springboot.component.PlcParameter;
import com.example.springboot.component.Plcaction;
@@ -17,7 +18,7 @@
import com.example.springboot.component.PlcPositioning2;
import com.example.springboot.component.PlcParameter2;
import com.example.springboot.component.PlcParameter1;
-import com.example.springboot.component.PlcServoManualone;
+//import com.example.springboot.component.PlcServoManualone;
@Component
@Order(1)
@@ -32,21 +33,22 @@
// new PlcHold().start();
-// new Plcaction().start();
-//
-// new Plchome().start();
-//
-// new PlcParameter().start();
-//
-// new Plcalarm().start();
-//
-// new Plcsign().start();
-//
-// new Plcstate().start();
- new PlcPositioning1().start();
- new PlcPositioning2().start();
- new PlcParameter2().start();
- new PlcParameter1().start();
- new PlcServoManualone().start();
+ // new Plcaction().start();
+ //
+ // new Plchome().start();
+ //
+ // new PlcParameter().start();
+ //
+ // new Plcalarm().start();
+ //
+ // new Plcsign().start();
+ //
+ // new Plcstate().start();
+ new PlcPositioning1().start();
+ new PlcPositioning2().start();
+ new PlcParameter2().start();
+ new PlcParameter1().start();
+ new PLCAutomaticParameterSetting().start();
+ // new PlcServoManualone().start();
}
}
\ No newline at end of file
--
Gitblit v1.8.0