From ea46f28356e2acb3bc7cc69b9af3c52fab38c0b0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 18 一月 2024 16:56:47 +0800
Subject: [PATCH] 终止任务功能测试

---
 CanadaMes-ui/src/views/Electrical/Parameter2.vue |  161 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 115 insertions(+), 46 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index ea91310..ddcf02d 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -48,13 +48,13 @@
         active-class="blue-button"
         >{{ $t("Automatic State") }}</router-link
       >
-      <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"
@@ -64,36 +64,25 @@
         >{{ $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   v-if="hasPermission" to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
+        $t('Address parameter settings')
+      }}</router-link>
+  
+      <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
-        to="/Electrical/Positioning1"
+<router-link  v-if="hasPermission"
+        to="/Electrical/InteractionState"
         tag="el-button"
         type="text"
         active-class="blue-button"
-        >{{ $t("Address parameter settings") }}</router-link
-      >
-      <!-- <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
-        $t('Positioning2')
-      }}</router-link> -->
-      <!--      
-      <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
-        $t('ManualonePosition2')
-      }}</router-link> -->
-      <router-link
-        to="/Electrical/AutomaticParameterSetting"
-        tag="el-button"
-        type="text"
-        active-class="blue-button"
-        >{{ $t("Speed parameter settings") }}</router-link
+        >{{ $t("InteractionState") }}</router-link
       >
     </el-breadcrumb>
 
@@ -140,8 +129,15 @@
                     item.button.value === 2 && item.button.name !== 'Clear ID',
                   'yellow-button':
                     item.button.value === 1 && item.button.name !== 'Clear ID',
-                  id:
+                  'id':
                     item.button.value === 1 && item.button.name === 'Clear ID',
+                    'A01jiting':item.button.value === 0 && item.button.name === 'A01Abort/ResumeTasks',
+                    'A02jiting':item.button.value === 0 && item.button.name === 'A02Abort/ResumeTasks',
+                    'emgHMI':item.button.value === 0 && item.button.name === 'emgHMI',
+                    'GA01jiting':item.button.value ===1 && item.button.name === 'A01Abort/ResumeTasks',
+                    'GA02jiting':item.button.value === 1 && item.button.name === 'A02Abort/ResumeTasks',
+                    'GemgHMI':item.button.value === 1 && item.button.name === 'emgHMI'
+
                 }"
                 >{{ item.button.name }}</el-button
               >
@@ -162,7 +158,14 @@
                     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',
+                  'A01jiting':item.button.value === 0 && item.button.name === 'A01缁堟/缁х画',
+                  'A02jiting':item.button.value === 0 && item.button.name === 'A02缁堟/缁х画',
+                  'emgHMI':item.button.value === 0 && item.button.name === '杞�ュ仠',
+                  'GA01jiting':item.button.value === 1 && item.button.name === 'A01缁堟/缁х画',
+                  'GA02jiting':item.button.value === 1 && item.button.name === 'A02缁堟/缁х画',
+                  'GemgHMI':item.button.value === 1 && item.button.name === '杞�ュ仠'
+                 
                 }"
                 >{{ item.button.name }}</el-button
               >
@@ -186,7 +189,7 @@
   <el-input
                 v-if="item.type === '0' && groupIndex==15"
                 v-model="item.value"
-                @keyup.enter.native="timeout"
+                @keyup.enter.native="timeout($event)"
                 style="width: 300px"
                 class="input-box2"
               ></el-input>
@@ -209,6 +212,9 @@
   <script>
 import LanguageMixin from "../../lang/LanguageMixin";
 import data from "../../configuration/parameter2";
+import {
+SelectPermissionByUserName, currentUsername
+} from "../../api/home";
 // import { throttle } from 'lodash';
 let socket;
 
@@ -226,6 +232,9 @@
       jsonData: data,
       inputValue: "",
       language: this.$i18n.locale,
+      
+    
+      hasPermission: false // 榛樿娌℃湁鏉冮檺
 
       // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
     };
@@ -240,6 +249,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;
+                        }
+                       
+                    });
+                });
+
+            });
   },
 
   computed: {},
@@ -274,7 +294,7 @@
       }
     },
     //鑼冨洿 0-100
-    timeout(){
+    timeout(event){
 
     
         const data3 = [];
@@ -306,7 +326,7 @@
         // setTimeout(()=>
         //   window.location.reload(),2000
         // )
-      
+        event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
 
 
@@ -338,16 +358,27 @@
         const jsonString2 = JSON.stringify(jsonObject2);
         console.log("鎵�鏈塗ype涓�0鐨剉alue:", jsonString2);
         socket?.send(jsonString2);
+
+        // 寤惰繜2绉掑彂閫佹寚瀹氬唴瀹�
+setTimeout(() => {
+  const jsonObject = { data: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [], []] };
+  const jsonString = JSON.stringify(jsonObject);
+  console.log("鍙戦�佺殑鍐呭:", jsonString);
+  socket?.send(jsonString);
+}, 1000);
+
       }
 
       if (
         currentButtonName === "A01Abort/ResumeTasks" ||
         currentButtonName === "A01缁堟/缁х画" ||
         currentButtonName === "A02Abort/ResumeTasks" ||
-        currentButtonName === "A02缁堟/缁х画"
+        currentButtonName === "A02缁堟/缁х画" ||
+        currentButtonName === "杞�ュ仠" || 
+        currentButtonName === "emgHMI" 
       ) {
         const data3 = [];
-        const resetButtonValues3 = [this.jsonData[13][0].button.value2,this.jsonData[14][0].button.value2];
+        const resetButtonValues3 = [this.jsonData[13][0].button.value2,this.jsonData[14][0].button.value2,this.jsonData[16][0].button.value2];
 
         // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
         data3.push(resetButtonValues3.flat());
@@ -362,6 +393,16 @@
         const jsonString3 = JSON.stringify(jsonObject3);
         console.log("鎬ュ仠鍚庝腑姝�/缁х画閫夋嫨:", jsonString3);
         socket?.send(jsonString3);
+
+        setTimeout(() => {
+  const jsonObject = { data: [ [],[0, 0, 0], []] };
+  const jsonString = JSON.stringify(jsonObject);
+  console.log("鍙戦�佺殑鍥炲脊鍐呭:", jsonString);
+  socket?.send(jsonString);
+}, 1000);
+
+
+
         // setTimeout(()=>
         //   window.location.reload(),2000
         // )
@@ -396,22 +437,25 @@
         socket.onopen = function () {
           console.log("websocket宸叉墦寮�");
         };
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
         let isUpdated = false;  // 瀹氫箟鏍囧織鍙橀噺
-const inputBox = document.querySelectorAll('.input-box2');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    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) {
             return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
           }
+          if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
 
           let obj = JSON.parse(msg.data);
 
@@ -425,10 +469,11 @@
           // const inputBox = document.querySelectorAll('.id');
           // const target = event.target;
 
-          if (parms && !isMouseInInputBox) {
+          if (parms ) {
             //鎬ュ仠鎸夐挳
             jsonData2[13][0].button.value = obj.jiting[0][0];
             jsonData2[14][0].button.value = obj.jiting[0][1];
+            jsonData2[16][0].button.value = obj.jiting[0][2];
             
 
            
@@ -505,6 +550,8 @@
                 }
               }
             }
+            this.$forceUpdate();
+
             //鎵弿鏋壂鐮佺殑ID
 
             jsonData2.forEach((item) => {
@@ -641,4 +688,26 @@
 .id {
   background-color: green;
 }
+.A02jiting{
+
+  background-color: #66b1ff;
+}
+.A01jiting{
+
+background-color: #66b1ff;
+}
+.emgHMI{
+
+  background-color: #66b1ff;
+}
+.GA02jiting{
+
+  background-color: green;
+}
+.GA01jiting{
+  background-color: green;
+}
+.GemgHMI{
+  background-color: green;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0