From 3545d55a89255b2c5849018019335d90172fcc04 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期三, 20 十二月 2023 13:26:03 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
---
CanadaMes-ui/src/views/Electrical/Parameter2.vue | 278 +++++++++++++++++++++++++++++++++---------------------
1 files changed, 169 insertions(+), 109 deletions(-)
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index bfb587f..d07f6b4 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -21,7 +21,7 @@
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
@@ -102,10 +102,9 @@
:span="6"
v-for="(dataGroup, groupIndex) in jsonData"
:key="groupIndex"
-
- style="margin-bottom: -20px;"
+ style="margin-bottom: -20px"
>
- <el-card class="json-block" style="width: 300px; margin-bottom: 2px">
+ <el-card class="json-block" style="width: 300px; margin-bottom: 2px;height:170px;">
<div
class="button-row"
style="display: flex; justify-content: space-between"
@@ -141,7 +140,8 @@
item.button.value === 2 && item.button.name !== 'Clear ID',
'yellow-button':
item.button.value === 1 && item.button.name !== 'Clear ID',
- 'id': item.button.value === 1 && item.button.name === 'Clear ID',
+ id:
+ item.button.value === 1 && item.button.name === 'Clear ID',
}"
>{{ item.button.name }}</el-button
>
@@ -162,7 +162,7 @@
item.button.value === 2 && item.button.name !== '娓呴櫎ID',
'yellow-button':
item.button.value === 1 && item.button.name !== '娓呴櫎ID',
- 'id': item.button.value === 1 && item.button.name === '娓呴櫎ID',
+ id: item.button.value === 1 && item.button.name === '娓呴櫎ID',
}"
>{{ item.button.name }}</el-button
>
@@ -183,9 +183,15 @@
<span class="name" v-else style="width: 150px">{{
item.name
}}</span>
-
+ <el-input
+ v-if="item.type === '0' && groupIndex==15"
+ v-model="item.value"
+ @keyup.enter.native="timeout"
+ style="width: 300px"
+ class="input-box2"
+ ></el-input>
<el-input
- v-if="item.type === '0'"
+ v-else-if="item.type === '0' "
v-model="item.value"
readonly="readonly"
style="width: 300px"
@@ -260,13 +266,40 @@
updateButtonValue(dataGroup, itemIndex) {
if (dataGroup[itemIndex].button.value === 1) {
- // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
- this.$set(dataGroup[itemIndex].button, 'value', 0);
- } else {
- // 鍚﹀垯灏嗗叾璁句负 0
- this.$set(dataGroup[itemIndex].button, 'value', 1);
- }
-},
+ // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
+ this.$set(dataGroup[itemIndex].button, "value", 0);
+ } else {
+ // 鍚﹀垯灏嗗叾璁句负 0
+ this.$set(dataGroup[itemIndex].button, "value", 1);
+ }
+ },
+ //鑼冨洿 0-100
+ timeout(){
+
+
+ const data3 = [];
+ const resetButtonValues3 = [this.jsonData[15][0].value];
+
+ // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+ data3.push(resetButtonValues3.flat());
+ data3.unshift([],[]);
+ // 鍦� data3 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
+
+ // 鍒涘缓 jsonObject3 瀵硅薄锛屽苟娣诲姞 data3 灞炴��
+ const jsonObject3 = { data: data3 };
+
+ // 鎻愪氦鏁版嵁鍒板悗绔�
+ const jsonString3 = JSON.stringify(jsonObject3);
+ console.log("Storage wait delay:", jsonString3);
+ socket?.send(jsonString3);
+ // setTimeout(()=>
+ // window.location.reload(),2000
+ // )
+
+ },
+
+
+
submitDataToBackend(currentButtonName) {
if (currentButtonName === "娓呴櫎ID" || currentButtonName === "Clear ID") {
const data2 = [];
@@ -297,11 +330,13 @@
}
if (
- currentButtonName === "Abort/ResumeTasks" ||
- currentButtonName === "鎬ュ仠鍚庝腑姝�/缁х画閫夋嫨"
+ currentButtonName === "A01Abort/ResumeTasks" ||
+ currentButtonName === "A01缁堟/缁х画" ||
+ currentButtonName === "A02Abort/ResumeTasks" ||
+ currentButtonName === "A02缁堟/缁х画"
) {
const data3 = [];
- const resetButtonValues3 = [this.jsonData[13][0].button.value];
+ const resetButtonValues3 = [this.jsonData[13][0].button.value,this.jsonData[14][0].button.value];
// 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
data3.push(resetButtonValues3.flat());
@@ -319,7 +354,11 @@
// window.location.reload(),2000
// )
}
+
+
},
+
+
initWebSocket() {
let viewname = "Parameter2";
@@ -345,7 +384,17 @@
socket.onopen = function () {
console.log("websocket宸叉墦寮�");
};
+ let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+const inputBox = document.querySelectorAll('.input-box2');
+inputBox.forEach(box => {
+ box.addEventListener('mouseenter', () => {
+ isMouseInInputBox = true;
+ });
+ box.addEventListener('mouseleave', () => {
+ isMouseInInputBox = false;
+ });
+});
// 鏀跺埌娑堟伅
socket.onmessage = (msg) => {
if (!msg.data) {
@@ -358,122 +407,134 @@
const parms = obj.params;
- // console.log(obj);
+ //console.log(obj);
// const handleMouseMove = throttle(function(event) {
// const inputBox = document.querySelectorAll('.id');
// const target = event.target;
- if (parms ) {
- //鎬ュ仠鎸夐挳
- jsonData2[13][0].button.value = obj.jiting[0][0];
+ if (parms && !isMouseInInputBox) {
+ //鎬ュ仠鎸夐挳
+ jsonData2[13][0].button.value = obj.jiting[0][0];
+ jsonData2[14][0].button.value = obj.jiting[0][1];
+
- //娓呴櫎id
+
+
+
+ //娓呴櫎id
- 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(obj.button.value);
- }
- }
- }
-
- //ID
- const specialChars = /[^\w\s]/g; // 姝e垯琛ㄨ揪寮忓尮閰嶉潪瀛楁瘝銆佹暟瀛椼�佷笅鍒掔嚎鍜岀┖鏍肩殑瀛楃
-
- 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") {
- if (parms[1] && parms[1][i]) {
- obj.value = parms[1][i].replace(specialChars, "");
- // console.log(obj.value);
- }
- if (obj.name === "ID2") {
- obj.value = parms[1][7].replace(specialChars, ""); // 灏咺D2瀵瑰簲鐨勫�艰祴涓簆arms[1][7]
- }
-
- if (obj.name === "A02ID") {
- obj.value = parms[1][8].replace(specialChars, "");
- }
- if (obj.name === "B01ID") {
- obj.value = parms[1][9].replace(specialChars, "");
- }
- if (obj.name === "B02ID") {
- obj.value = parms[1][10].replace(specialChars, "");
+ 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(obj.button.value);
}
}
}
- }
- //鎵嬪姩鐘舵��
- 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 === "4" && obj.button.value === 1) {
- if (
- obj.button.name.includes("鐘舵��") &&
- this.language === "zh-CN"
- ) {
- obj.button.name = obj.button.name.replace("鎵嬪姩", "鑷姩");
- }
- if (obj.button.name.includes("Status")) {
- obj.button.name = obj.button.name.replace("Manual", "Auto");
+ //ID
+ const specialChars = /[^\w\s]/g; // 姝e垯琛ㄨ揪寮忓尮閰嶉潪瀛楁瘝銆佹暟瀛椼�佷笅鍒掔嚎鍜岀┖鏍肩殑瀛楃
+
+ 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") {
+ if (parms[1] && parms[1][i]) {
+ obj.value = parms[1][i].replace(specialChars, "");
+ // console.log(obj.value);
+ }
+ if (obj.name === "ID2") {
+ obj.value = parms[1][7].replace(specialChars, ""); // 灏咺D2瀵瑰簲鐨勫�艰祴涓簆arms[1][7]
+ }
+
+ if (obj.name === "A02ID") {
+ obj.value = parms[1][8].replace(specialChars, "");
+ }
+ if (obj.name === "B01ID") {
+ obj.value = parms[1][9].replace(specialChars, "");
+ }
+ if (obj.name === "B02ID") {
+ obj.value = parms[1][10].replace(specialChars, "");
+ }
}
}
}
- }
- //鎵弿鏋壂鐮佺殑ID
- jsonData2.forEach((item) => {
- item.forEach((subItem) => {
- if (subItem.read === 66) {
- subItem.value = parms[3][0].replace(specialChars, "");
+ //鎵嬪姩鐘舵��
+ 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 === "4" && obj.button.value === 1) {
+ if (
+ obj.button.name.includes("鐘舵��") &&
+ this.language === "zh-CN"
+ ) {
+ obj.button.name = obj.button.name.replace("鎵嬪姩", "鑷姩");
+ }
+ if (obj.button.name.includes("Status")) {
+ obj.button.name = obj.button.name.replace("Manual", "Auto");
+ }
+ }
+ }
+ }
+ //鎵弿鏋壂鐮佺殑ID
+
+ jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.read === 66) {
+ subItem.value = parms[3][0].replace(specialChars, "");
+ }
+ });
});
- });
- jsonData2.forEach((item) => {
- item.forEach((subItem) => {
- if (subItem.read === 666) {
- subItem.value = parms[3][1].replace(specialChars, "");
- }
+ jsonData2.forEach((item) => {
+ item.forEach((subItem) => {
+ if (subItem.read === 666) {
+ subItem.value = parms[3][1].replace(specialChars, "");
+ }
+ });
});
- });
- //A01褰撳墠鏍煎瓙
- let lastParmsArray = parms[parms.length - 1];
+ //A01褰撳墠鏍煎瓙
+ let lastParmsArray = parms[parms.length - 1];
- let lastParmsIndex = 0;
+ let lastParmsIndex = 0;
- for (let i = 0; i < jsonData2.length; i++) {
- for (let j = 0; j < jsonData2[i].length; j++) {
- if (jsonData2[i][j].read === 333) {
- jsonData2[i][j].value = lastParmsArray[lastParmsIndex];
- lastParmsIndex++;
- if (lastParmsIndex === lastParmsArray.length) {
- lastParmsIndex = 0;
+ for (let i = 0; i < jsonData2.length; i++) {
+ for (let j = 0; j < jsonData2[i].length; j++) {
+ if (jsonData2[i][j].read === 333) {
+ jsonData2[i][j].value = lastParmsArray[lastParmsIndex];
+ lastParmsIndex++;
+ if (lastParmsIndex === lastParmsArray.length) {
+ lastParmsIndex = 0;
+ }
}
}
}
+
+
+ jsonData2[15][0].value = obj.timeout[0];
+
+
+
+
}
- }
};
// console.log(jsonData2);
@@ -557,5 +618,4 @@
.id {
background-color: green;
}
-
</style>
\ No newline at end of file
--
Gitblit v1.8.0