浏览代码

Merge branch 'zhangmingyan' of zengminguo/D-MAP into master

zengminguo 6 月之前
父节点
当前提交
1b4d560cf0
共有 4 个文件被更改,包括 205 次插入128 次删除
  1. 5 2
      src/components/BenchDetail/index.vue
  2. 9 2
      src/service/ws.js
  3. 186 123
      src/views/ordinaryPage/index.vue
  4. 5 1
      src/views/ordinaryPage/origin.less

+ 5 - 2
src/components/BenchDetail/index.vue

@@ -24,7 +24,7 @@
               <el-row>
                 <el-col :span="6">Display: {{bench.Display}}</el-col>
                 <el-col :span="6">VIN: {{bench.vin}}</el-col>
-                <el-col :span="6">Precondition: <span style="font-size: 12px;word-wrap: break-word;word-break: break-all;">{{bench.Precondition.join(',')}}</span></el-col>
+                <!-- <el-col :span="6">Precondition: <span style="font-size: 12px;word-wrap: break-word;word-break: break-all;">{{bench.Precondition.join(',')}}</span></el-col> -->
               </el-row>
               <el-row>
                 <el-col :span="6">AED SW: {{bench.AED_SW}}</el-col>
@@ -33,7 +33,10 @@
               <el-row>
                 <el-col :span="6">Repository: {{bench.Repository}}</el-col>
                 <el-col :span="6">Variant: {{bench.Variant}}</el-col>
-              </el-row>     
+              </el-row>  
+              <el-row>
+                <el-col :span="24">Precondition: <span style="font-size: 12px;word-wrap: break-word;word-break: break-all;">{{bench.Precondition.join(',')}}</span></el-col>
+              </el-row>   
             </div>
           </div>
         </div>

+ 9 - 2
src/service/ws.js

@@ -1,4 +1,5 @@
 import bus from "./bus";
+import { Message } from "element-ui";
 export default class wsService {
     constructor() {
         // const wsUrl = ref("ws://172.16.50.3/websocket");
@@ -13,7 +14,7 @@ export default class wsService {
 
     open() {
         return new Promise((resolve, reject) => {
-            console.warn(this.address);
+            console.log(this.address);
             if (typeof this._websocket === "undefined") {
                 this._websocket = new WebSocket(this.address);
                 this._websocket.onopen = e => {
@@ -74,7 +75,13 @@ export default class wsService {
                             }
                         } else {
                             let err = { action, data: JSON.stringify(data) };
-                            console.error(err);
+                            console.log(err);
+                            console.log(err.data);
+                            Message({
+                                message: err.data,
+                                // message: "",
+                                type: "error",
+                            });
                             // req.reject(err);
                         }
                     }

+ 186 - 123
src/views/ordinaryPage/index.vue

@@ -22,7 +22,7 @@
         />
         <div class="square-map" v-show="isOpenSquare && !isOpen">
           <el-row>
-            <el-col v-for="(item, index) in images" :key="item" :span="8">
+            <el-col v-for="(item, index) in images" :key="index" :span="8">
               <div
                 class="grid-item-background"
                 :style="{
@@ -269,6 +269,59 @@
             </div>
           </Transition>
           <img :src="mainSnapshot" />
+          <el-row v-show="isConnected && !isOpenSquare && !isOpen" class="bench-button">
+            <el-col :span="5" class="btn-item" style="text-align: center">
+              {{currentBench && currentBench.name}}
+            </el-col>
+            <el-col
+              :span="3"
+              class="btn-item"
+              :class="{ benchBtnActive: isPlaying }"
+            >
+              <el-tooltip class="item" effect="dark" content="音量" placement="top-start">
+                <img
+                  @click="connectAudioDevice('collectAudio')"
+                  src="../../images/sound.png"
+                />
+              </el-tooltip>
+            </el-col>
+            <el-col
+              :span="3"
+              class="btn-item"
+              :class="{ benchBtnActive: isRecording }"
+            >
+              <el-tooltip class="item" effect="dark" content="麦克风" placement="top-start">
+                  <img
+                    @click="connectAudioDevice('playAudio')"
+                    src="../../images/mic.png"
+                  />
+              </el-tooltip>
+            </el-col>
+            <el-col
+              :span="3"
+              class="btn-item"
+              :class="{ benchBtnActive: displayTapMode }"
+            >
+              <el-tooltip class="item" effect="dark" content="点击" placement="top-start">
+                  <img @click="tapModeControl" src="../../images/pointer.png" />
+              </el-tooltip>
+            </el-col>
+            <el-col :span="3" class="btn-item" v-show="false">
+              <el-tooltip class="item" effect="dark" content="日志" placement="top-start">
+                  <img @click="showLogBox" src="../../images/book.png" />
+              </el-tooltip>
+            </el-col>
+            <el-col :span="3" class="btn-item">
+              <el-tooltip class="item" effect="dark" content="唤醒语音助手按钮" placement="top-start">
+                  <img @click="pressPtt" src="../../images/robot.png" />
+              </el-tooltip>
+            </el-col>
+            <el-col :span="3" class="btn-item">
+              <el-tooltip class="item" effect="dark" content="断开远程控制按钮" placement="top-start">
+                  <img @click="disconnectBench" src="../../images/disconnect.png" />
+              </el-tooltip>
+            </el-col>
+          </el-row>
         </div>
         <image-list
           v-show="isConnected && !isOpenSquare && !isOpen"
@@ -281,7 +334,7 @@
           @next-page="nextPage"
           class="image-container"
         />
-        <el-row v-show="isConnected && !isOpenSquare && !isOpen" class="bench-button">
+        <!-- <el-row v-show="isConnected && !isOpenSquare && !isOpen" class="bench-button">
           <el-col :span="5" class="btn-item" style="text-align: center">{{
             currentBench && currentBench.name
           }}</el-col>
@@ -290,62 +343,50 @@
             class="btn-item"
             :class="{ benchBtnActive: isPlaying }"
           >
-			<el-tooltip class="item" effect="dark" content="音量" placement="top-start">
-		        <img
-		          @click="connectAudioDevice('collectAudio')"
-		          src="../../images/sound.png"
-		        />
-		    </el-tooltip>
-            
+			      <el-tooltip class="item" effect="dark" content="音量" placement="top-start">
+              <img
+                @click="connectAudioDevice('collectAudio')"
+                src="../../images/sound.png"
+              />
+            </el-tooltip>
           </el-col>
           <el-col
             :span="3"
             class="btn-item"
             :class="{ benchBtnActive: isRecording }"
           >
-		  <el-tooltip class="item" effect="dark" content="麦克风" placement="top-start">
-		      <img
-		        @click="connectAudioDevice('playAudio')"
-		        src="../../images/mic.png"
-		      />
-		  </el-tooltip>
-            
+            <el-tooltip class="item" effect="dark" content="麦克风" placement="top-start">
+                <img
+                  @click="connectAudioDevice('playAudio')"
+                  src="../../images/mic.png"
+                />
+            </el-tooltip>
           </el-col>
           <el-col
             :span="3"
             class="btn-item"
             :class="{ benchBtnActive: displayTapMode }"
           >
-		  <el-tooltip class="item" effect="dark" content="点击" placement="top-start">
-		      <img @click="tapModeControl" src="../../images/pointer.png" />
-		  </el-tooltip>
-            
+            <el-tooltip class="item" effect="dark" content="点击" placement="top-start">
+                <img @click="tapModeControl" src="../../images/pointer.png" />
+            </el-tooltip>
           </el-col>
           <el-col :span="3" class="btn-item" v-show="false">
-			  <el-tooltip class="item" effect="dark" content="日志" placement="top-start">
-			      <img @click="showLogBox" src="../../images/book.png" />
-			  </el-tooltip>
-            
+            <el-tooltip class="item" effect="dark" content="日志" placement="top-start">
+                <img @click="showLogBox" src="../../images/book.png" />
+            </el-tooltip>
           </el-col>
           <el-col :span="3" class="btn-item">
-            
-			<el-tooltip class="item" effect="dark" content="唤醒语音助手按钮" placement="top-start">
-			    <img @click="pressPtt" src="../../images/robot.png" />
-			</el-tooltip>
+            <el-tooltip class="item" effect="dark" content="唤醒语音助手按钮" placement="top-start">
+                <img @click="pressPtt" src="../../images/robot.png" />
+            </el-tooltip>
           </el-col>
-          <!-- <el-col :span="3" class="btn-item" @click="clickBenchList">
-		  <el-tooltip class="item" effect="dark" content="最小化按钮" placement="top-start">
-		      <img @click="gotoGrid" src="../../images/grid.png" />
-		  </el-tooltip>
-            
-          </el-col> -->
           <el-col :span="3" class="btn-item">
-			  <el-tooltip class="item" effect="dark" content="断开远程控制按钮" placement="top-start">
-			      <img @click="disconnectBench" src="../../images/disconnect.png" />
-			  </el-tooltip>
-            
+            <el-tooltip class="item" effect="dark" content="断开远程控制按钮" placement="top-start">
+                <img @click="disconnectBench" src="../../images/disconnect.png" />
+            </el-tooltip>
           </el-col>
-        </el-row>
+        </el-row> -->
         
       </div>
 
@@ -897,9 +938,9 @@ export default {
 
     window.bmMapItemActivate = this.bmMapItemActivate;
 	
-    this.$store.dispatch("benchList/fetchBenchList").then(()=>{
-      this.getImageName();
-    });
+  this.$store.dispatch("benchList/fetchBenchList").then(()=>{
+    this.getImageName();
+  });
 	
     // 调用定时器方法,返回定时器id,用于按条件清空
     that.timerId = that.myInterval((count) => {
@@ -1065,28 +1106,26 @@ export default {
     }
   },
   methods: {
-	getImageName() {
-	      var sqlstr = "SELECT * FROM dat_bench_extend order by bench_id asc";
-	      let msg = {
-	        cmd: "query", // server端要进行判断的
-	        data: {
-	          name: "name", // 这个无所谓怎么写,有就行
-	          sql: sqlstr,
-	        },
-	      };
-	      window.vm.$socket.emit("REPT", msg, (datas) => {
-	        let result = datas.data;
-	        for (var item of result) {
-	
-	          var currentBench = this.benchList.find((a) => a.id == item.bench_id);
-	          if (currentBench) {
-	            currentBench.image = require("../../assets/bench_img/"+item.bench_img);
-	          }
-	          this.tabs[0].list = this.benchList;
-	
-	        }
-	      })
-	    },
+    getImageName() {
+      var sqlstr = "SELECT * FROM dat_bench_extend order by bench_id asc";
+      let msg = {
+        cmd: "query", // server端要进行判断的
+        data: {
+          name: "name", // 这个无所谓怎么写,有就行
+          sql: sqlstr,
+        },
+      };
+      window.vm.$socket.emit("REPT", msg, (datas) => {
+        let result = datas.data;
+        for (var item of result) {
+          var currentBench = this.benchList.find((a) => a.id == item.bench_id);
+          if (currentBench) {
+            currentBench.image = require("../../assets/bench_img/"+item.bench_img);
+          }
+          this.tabs[0].list = this.benchList;
+        }
+      })
+    },
     changeCurrentBench(benchId) {
       this.isDetailVisible = false;
       if (this.isOpen3d) {
@@ -1457,56 +1496,72 @@ export default {
       });
     },
     itemRender(item) {
-
-      //item.image = require("../../assets/mechine.png");
-      //item.image = require("../../assets/bench_img/"+item.benchImg);
-      /*return `
-                  <div class="item-box">
-                      <div class="item-image"><img src="${item.image}" alt="${item.title}"></div>
-                      <div class="item-right">
-                          <div class="item-title">
-                              <span onClick="handleListClick(${item.id})">${item.id}</span>
-                              <span onClick="selectBench(${item.id})" class="el-icon-s-platform ${item.status}"></span>
-                          </div>
-                          <div class="item-text">
-                            <div class="item-description">Automation Lab-7E</div>
-                              <div class="item-description">${item.name}</div>
-                              <div class="item-tag">
-                                  <div class="tag">${item.Market}</div>
-                                  <div class="tag">${item.Platform}</div>
-                                  <div class="tag">${item.Project}</div>
-                                  <div class="tag">${item.Carline}</div>
-                                  <div class="tag">${item.Cluster}</div>
-                              </div>
-                              <div class="item-tag">
-                                  <div class="tag">${item.MU_SW}</div>
-                                  <div class="tag">${item.Variant}</div>
-                                  <div class="tag">${item.ip}</div>
-                              </div>
-                          </div>
-                      </div>
-                  </div>`;*/
-      return `
-                  <div onDblClick="handleListDbClick(${item.id})" data-index="${item.id}" onClick="handleListClick(${item.id})" class="item-box">
-                  <div class="item-image"><img src="${item.image}" alt="${item.title}"></div>
-                  <div class="item-right">
-                      <div class="item-text">
-                          <div class="item-title">${item.name}
-                            <span onClick="selectBench(${item.id})" class="el-icon-monitor ${item.status}"></span>
-                          </div>
-                          <div class="item-description">Automation Lab-7E</div>
-                          <div class="item-tag">
-                              <div class="tag" title="Market">${item.Market}</div>
-                              <div class="tag" title="Platform">${item.Platform}</div>
-                              <div class="tag" title="Project">${item.Project}</div>
-                              <div class="tag" title="Carline">${item.Carline}</div>
-                              <div class="tag" title="Cluster">${item.Cluster}</div>
-                              <div class="tag" title="MU_SW">${item.MU_SW}</div>
-                              <div class="tag" title="Variant">${item.Variant}</div>
-                          </div>
-                      </div>
-                  </div>
-              </div>`;
+      if (item.groups["Basic Information"].Display == "DUO") {
+        return `
+          <div onDblClick="handleListDbClick(${item.id})" data-index="${item.id}" onClick="handleListClick(${item.id})" class="item-box">
+            <div class="item-image"><img src="${item.image}" alt="${item.title}"></div>
+            <div class="item-right">
+                <div class="item-text">
+                    <div class="item-title">${item.name}
+                      <span onClick="selectBench(${item.id})" class="el-icon-s-platform ${item.status}"></span>
+                    </div>
+                    <div class="item-description">Automation Lab-7E</div>
+                    <div class="item-tag">
+                        <div class="tag" title="Market">${item.Market}</div>
+                        <div class="tag" title="Platform">${item.Platform}</div>
+                        <div class="tag" title="Project">${item.Project}</div>
+                        <div class="tag" title="Carline">${item.Carline}</div>
+                        <div class="tag" title="Cluster">${item.Cluster}</div>
+                        <div class="tag" title="MU_SW">${item.MU_SW}</div>
+                        <div class="tag" title="Variant">${item.Variant}</div>
+                    </div>
+                </div>
+            </div>
+          </div>`;
+      }else{
+        return `
+          <div onDblClick="handleListDbClick(${item.id})" data-index="${item.id}" onClick="handleListClick(${item.id})" class="item-box">
+            <div class="item-image"><img src="${item.image}" alt="${item.title}"></div>
+            <div class="item-right">
+                <div class="item-text">
+                    <div class="item-title">${item.name}
+                      <span onClick="selectBench(${item.id})" class="el-icon-monitor ${item.status}"></span>
+                    </div>
+                    <div class="item-description">Automation Lab-7E</div>
+                    <div class="item-tag">
+                        <div class="tag" title="Market">${item.Market}</div>
+                        <div class="tag" title="Platform">${item.Platform}</div>
+                        <div class="tag" title="Project">${item.Project}</div>
+                        <div class="tag" title="Carline">${item.Carline}</div>
+                        <div class="tag" title="Cluster">${item.Cluster}</div>
+                        <div class="tag" title="MU_SW">${item.MU_SW}</div>
+                        <div class="tag" title="Variant">${item.Variant}</div>
+                    </div>
+                </div>
+            </div>
+          </div>`;
+      }
+      // return `
+      //             <div onDblClick="handleListDbClick(${item.id})" data-index="${item.id}" onClick="handleListClick(${item.id})" class="item-box">
+      //             <div class="item-image"><img src="${item.image}" alt="${item.title}"></div>
+      //             <div class="item-right">
+      //                 <div class="item-text">
+      //                     <div class="item-title">${item.name}
+      //                       <span onClick="selectBench(${item.id})" class="el-icon-monitor ${item.status}"></span>
+      //                     </div>
+      //                     <div class="item-description">Automation Lab-7E</div>
+      //                     <div class="item-tag">
+      //                         <div class="tag" title="Market">${item.Market}</div>
+      //                         <div class="tag" title="Platform">${item.Platform}</div>
+      //                         <div class="tag" title="Project">${item.Project}</div>
+      //                         <div class="tag" title="Carline">${item.Carline}</div>
+      //                         <div class="tag" title="Cluster">${item.Cluster}</div>
+      //                         <div class="tag" title="MU_SW">${item.MU_SW}</div>
+      //                         <div class="tag" title="Variant">${item.Variant}</div>
+      //                     </div>
+      //                 </div>
+      //             </div>
+      //         </div>`;
     },
     handleImageClick(index) {
       this.selectBench(
@@ -2271,7 +2326,6 @@ export default {
           }
         }
       }
-
       var source = audioCtx.createBufferSource();
       source.buffer = myArrayBuffer;
       source.connect(audioCtx.destination);
@@ -2421,6 +2475,9 @@ export default {
           let items = document.getElementsByClassName("grid-item-background");
           for (var index = 0; index < items.length; index++) {
             items[index].style.background = "#000000";
+            if (this.images[index].alt == benchId) {
+              items[index].style.background = "#ffffff";
+            }
           }
           return;
         }
@@ -2570,6 +2627,9 @@ export default {
             let items = document.getElementsByClassName("grid-item-background");
             for (var index = 0; index < items.length; index++) {
               items[index].style.background = "#000000";
+              if (index == indexParam) {
+                items[index].style.background = "#ffffff";
+              }
             }
             this.brnchshow = false;
             
@@ -2579,13 +2639,13 @@ export default {
           }
         }
         this.currentBenchId = benchId;
-        let items = document.getElementsByClassName("grid-item-background");
-        for (var index = 0; index < items.length; index++) {
-          items[index].style.background = "#000000";
-          if (index == indexParam) {
-            items[index].style.background = "#ffffff";
-          }
-        }
+        // let items = document.getElementsByClassName("grid-item-background");
+        // for (var index = 0; index < items.length; index++) {
+        //   items[index].style.background = "#000000";
+        //   if (index == indexParam) {
+        //     items[index].style.background = "#ffffff";
+        //   }
+        // }
       });
       this.$nextTick(() => {
         if (
@@ -2608,7 +2668,10 @@ export default {
           let itemOther = this.benchList.find(
             (b) => parseInt(b.id) == parseInt(title[0].textContent) || b.id == benchId
           );
-          itemOther.selected = false;
+          if(itemOther){
+            itemOther.selected = false;
+          }
+          // itemOther.selected = false;
           if(items[index].dataset.index == benchId){
             items[index].style.background = "#000000C0";
             this.currentBench = this.benchList.find((b) => b.id == benchId);

+ 5 - 1
src/views/ordinaryPage/origin.less

@@ -39,11 +39,15 @@
         );
         border-radius: 79px 79px 79px 79px;
         position: absolute;
-        margin-top: 81.9vh;
+        bottom: 0;
+        left: 50%;
+        margin-left: -20.57vw;
+        // margin-top: 81.9vh;
         z-index: 3;
         color: #fff;
         display: flex;
         align-items: center;
+        justify-content: space-around;
         .btn-item {
           height: 100%;
           img {