From 0ece3ba8c92df0438af52b8de6b9225d8ada4103 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期四, 30 十一月 2023 08:46:34 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/views/Electrical/Parameter2.vue |  314 ++++++++++++++++++++++++++-------------------------
 1 files changed, 160 insertions(+), 154 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index 9497c30..ada201c 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -1,74 +1,79 @@
 <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>
+    </el-breadcrumb>
+
     <el-row :gutter="40">
       <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 +84,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,90 +138,90 @@
 
         // 鏀跺埌娑堟伅
         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;
-      // const xiaoche = obj.params[3];
-   
-     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 === '3') {
-      obj.button.value = parms[0][i];
-    }
-  }
+          const jsonData2 = this.jsonData;
 
-     
-}
+          // 濡傛灉榧犳爣涓嶅湪杈撳叆妗嗗唴锛屾洿鏂拌緭鍏ユ鐨勫��
+          // this.submitDataToBackend()
+          const parms = obj.params;
+          // const xiaoche = obj.params[3];
 
-      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];
-    }
-  }
+          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];
-    }
-  }
-
-     
-}
-
-jsonData2.forEach((item) => {
-  item.forEach((subItem) => {
-    if (subItem.read === 66) {
-      subItem.value = parms[3][0]; 
-    }
-  });
-});
-
-
-let lastParmsArray = parms[parms.length - 1];
-
-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++) {
+            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 === '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 === '4') {
+                obj.button.value = parms[2][i];
+              }
+            }
+
+
+          }
+
+          jsonData2.forEach((item) => {
+            item.forEach((subItem) => {
+              if (subItem.read === 66) {
+                subItem.value = parms[3][0];
+              }
+            });
+          });
+
+
+          let lastParmsArray = parms[parms.length - 1];
+
+          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;
+                }
+              }
+            }
+          }
 
 
 
 
 
-//  console.log(jsonData2);
+          //  console.log(jsonData2);
 
-  
-};
+
+        };
 
 
 
@@ -234,28 +239,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;
 }
 
@@ -263,8 +270,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

--
Gitblit v1.8.0