deepsea 1 year ago
parent
commit
98dbc34ea0

+ 3 - 0
src/store/modules/bench/actions.js

@@ -41,5 +41,8 @@ export default {
   },
   setFilterBenchFlag({ commit }, flag) {
     commit('setFilterBenchFlag', flag)
+  },
+  filterBenchListByName({commit}, value) {
+    commit('setFilterBenchListByName', value)
   }
 };

+ 25 - 6
src/store/modules/bench/index.js

@@ -9,12 +9,31 @@ export default {
       benchList: [],
       filterBenchList: [],
       benchImgList:[],
-      statusOptions:[],
-      projectOptions:[],
-      carlineOptions:[],
-      variantOptions:[],
-      clusterOptions:[],
-      marketOptions:[],
+      filterMapList: [],
+      statusOptions:[{
+        value: 'Status',
+        label: ''
+      }],
+      projectOptions:[{
+        value: 'Project',
+        label: ''
+      }],
+      carlineOptions:[{
+        value: 'Carline',
+        label: ''
+      }],
+      variantOptions:[{
+        value: 'Variant',
+        label: ''
+      }],
+      clusterOptions:[{
+        value: 'Cluster',
+        label: ''
+      }],
+      marketOptions:[{
+        value: 'Market',
+        label: ''
+      }],
       matchedBenchList:[],
       filterBenchFlag: false
     };

+ 14 - 3
src/store/modules/bench/mutations.js

@@ -125,11 +125,19 @@ export default {
     state.benchImgList = newBenchImgList;
     console.log('state.benchImgList-2', state.benchImgList);
   },
-  filterBenchList(state, list) {
-
+  filterBenchList(state, data) {
+    let option = state.filterMapList.find(option => option.type == data.type);
+    if (option){
+      option.value = data.value
+    } else {
+      state.filterMapList.push(data)
+    }
     state.filterBenchList = state.benchList.slice();
-    list.forEach(data => {
+    state.filterMapList.forEach(data => {
       switch (data.type) {
+        case "name":
+          state.filterBenchList = state.filterBenchList.filter(s => s.name.toUpperCase().indexOf(data.value.toUpperCase())>-1);
+          break;
         case 'status':
           state.filterBenchList = state.filterBenchList.filter(s => s.status == data.value);
           break;
@@ -151,6 +159,9 @@ export default {
       }
     })
 
+  },
+  setFilterBenchListByName(state, value) {
+
   },
   setTaskList(state, taskList) {
     taskList.forEach((task) => {

+ 32 - 8
src/store/modules/common/index.js

@@ -9,14 +9,38 @@ export default {
       benchList: [],
       filterBenchList: [],
       benchImgList:[],
-      statusOptions:[],
-      projectOptions:[],
-      carlineOptions:[],
-      variantOptions:[],
-      clusterOptions:[],
-      marketOptions:[],
-      resultOptions: [],
-      TBTypeOptions: [],
+      statusOptions:[{
+        value: 'Status',
+        label: ''
+      }],
+      projectOptions:[{
+        value: 'Project',
+        label: ''
+      }],
+      carlineOptions:[{
+        value: 'Carline',
+        label: ''
+      }],
+      variantOptions:[{
+        value: 'Variant',
+        label: ''
+      }],
+      clusterOptions:[{
+        value: 'Cluster',
+        label: ''
+      }],
+      marketOptions:[{
+        value: 'Market',
+        label: ''
+      }],
+      resultOptions: [{
+        value: 'Result',
+        label: ''
+      }],
+      TBTypeOptions: [{
+        value: 'TBType',
+        label: ''
+      }],
       isOpenSquare: false,
       isOpen3d: true
     };

+ 6 - 8
src/views/ordinaryPage/components/TableComponent/index.vue

@@ -124,26 +124,24 @@ export default {
   },
   methods: {
     changeFilter(type) {
-      let list = [];
       if (this.statusValue) {
-        list.push({type: 'status', value: this.statusValue})
+        this.$store.dispatch('benchList/filterBenchList', {type: 'status', value: this.statusValue});
       }
       if (this.projectValue) {
-        list.push({type: 'project', value: this.projectValue})
+        this.$store.dispatch('benchList/filterBenchList', {type: 'project', value: this.projectValue});
       }
       if (this.carlineValue) {
-        list.push({type: 'carline', value: this.carlineValue})
+        this.$store.dispatch('benchList/filterBenchList', {type: 'carline', value: this.carlineValue});
       }
       if (this.variantValue) {
-        list.push({type: 'variant', value: this.variantValue})
+        this.$store.dispatch('benchList/filterBenchList', {type: 'variant', value: this.variantValue});
       }
       if (this.clusterValue) {
-        list.push({type: 'cluster', value: this.clusterValue})
+        this.$store.dispatch('benchList/filterBenchList', {type: 'cluster', value: this.clusterValue});
       }
       if (this.marketValue) {
-        list.push({type: 'market', value: this.marketValue})
+        this.$store.dispatch('benchList/filterBenchList', {type: 'market', value: this.marketValue});
       }
-      this.$store.dispatch('benchList/filterBenchList', list);
       this.$store.dispatch('benchList/setFilterBenchFlag', true);
     }
   }

+ 5 - 0
src/views/ordinaryPage/index.less

@@ -1,3 +1,6 @@
+.el-table__column-filter-trigger {
+  display: none !important;
+}
 .ordinary-container {
   display: flex;
 
@@ -87,6 +90,8 @@
         // opacity: 0;
         // width: 130vw;
         // height: 130vh;
+        width: 100%;
+        height: 100%;
         z-index: 0;
         border-radius: 40px;
         // margin-left: -35vw;

+ 95 - 78
src/views/ordinaryPage/index.vue

@@ -1,12 +1,22 @@
 <template>
   <div>
     <div class="container" v-show="isOpen3d" key="container">
-      <SearchBarMain/>
+      <SearchBarMain />
       <div class="vr-bg" id="vr-bg-container"></div>
       <div id="player" style="width: 100%; height: 100%"></div>
-      <bench-detail :is-detail-visible="isDetailVisible" :is-remote-btn-visible="isRemoteBtnVisible" :closeDetail="closeDetail" :bench="currentBench" />
+      <bench-detail
+        :is-detail-visible="isDetailVisible"
+        :is-remote-btn-visible="isRemoteBtnVisible"
+        :closeDetail="closeDetail"
+        :bench="currentBench"
+      />
     </div>
-    <div class="ordinary-container" key="ordinary-container" v-show="!isOpen3d" @click="onBlur">
+    <div
+      class="ordinary-container"
+      key="ordinary-container"
+      v-show="!isOpen3d"
+      @click="onBlur"
+    >
       <div class="ordinary-left">
         <SearchBar
           class="search-container"
@@ -58,30 +68,31 @@
             <!-- <img src="../../images/map.png" /> -->
             <div class="vr-bg" id="vr-bg-container"></div>
             <div id="playersmall"></div>
+            <div class="ordinary-map-ex">
+              <div class="square-count">
+                <status-bar
+                  :ready="readyCount"
+                  :occupied="occupiedCount"
+                  :offline="offlineCount"
+                ></status-bar>
+              </div>
+              <!-- <div class="bench-list">
+              <div class="bench-list-buttons" @click="clickBenchList">
+                My Bench List
+              </div>
+            </div> -->
+            </div>
             <dropdown :is-open="isOpen" ref="dropdown">
               <template v-slot:table>
                 <table-component
-                  :data="tableData"
+                  :data="filterBenchList"
                   :filters="filters"
                   :row-class-name="rowClassName"
                 ></table-component>
               </template>
             </dropdown>
           </div>
-          <div class="ordinary-map-ex">
-            <div class="square-count">
-              <status-bar
-                :ready="readyCount"
-                :occupied="occupiedCount"
-                :offline="offlineCount"
-              ></status-bar>
-            </div>
-            <!-- <div class="bench-list">
-              <div class="bench-list-buttons" @click="clickBenchList">
-                My Bench List
-              </div>
-            </div> -->
-          </div>
+
           <div class="ordinary-map-hidden" v-if="false">
             <div class="ordinary-map-blocker" id="ordinary-map-blocker">
               <Transition name="slide">
@@ -247,7 +258,9 @@
                 <img
                   class="bmBenchImg bmBenchImgUpper"
                   ref="bmBenchRef"
-                  :src="currentScreen == 'upper' ? benchImgUpper : benchImgLower"
+                  :src="
+                    currentScreen == 'upper' ? benchImgUpper : benchImgLower
+                  "
                   alt=""
                 />
                 <div
@@ -282,7 +295,8 @@
                       v-if="ifBmBenchTrailUpperCursorSwipe"
                       class="bmBenchTrailUpperCursorSwipe bmBenchTrailUpperCursorSwipe2"
                       :style="{
-                        left: 'calc(' + trailCursorPosition.left + '% - 0.75vh)',
+                        left:
+                          'calc(' + trailCursorPosition.left + '% - 0.75vh)',
                         top: 'calc(' + trailCursorPosition.top + '% - 0.75vh)',
                       }"
                     ></div>
@@ -312,7 +326,8 @@
                       v-if="ifBmBenchTrailUpperCursor"
                       class="bmBenchTrailUpperCursor"
                       :style="{
-                        left: 'calc(' + controlCursorPosition.left + 'px - 1vh)',
+                        left:
+                          'calc(' + controlCursorPosition.left + 'px - 1vh)',
                         top: 'calc(' + controlCursorPosition.top + 'px - 1vh)',
                       }"
                     ></div>
@@ -550,7 +565,6 @@
       />
     </div>
   </div>
-  
 </template>
 <script>
 import "./index.less";
@@ -572,7 +586,7 @@ import webSocket from "../../service/ws";
 import bus from "../../service/bus";
 
 import { FBXLoader } from "../../FBXLoader.js";
-import SearchBarMain from '../../components/SearchBarMain'
+import SearchBarMain from "../../components/SearchBarMain";
 
 const ws = new webSocket();
 let that = null;
@@ -596,7 +610,7 @@ export default {
     TableComponent,
     BenchDetail,
     ImageList,
-    SearchBarMain
+    SearchBarMain,
   },
   data() {
     return {
@@ -780,7 +794,7 @@ export default {
       currentBenchId: 0,
       gridItems: [1, 2, 3, 4, 5, 6, 7, 8, 9],
       timerIdMap: { num: 0 },
-      timerId: 0
+      timerId: 0,
     };
   },
   computed: {
@@ -799,7 +813,7 @@ export default {
         return state.common.isOpenSquare;
       },
       isOpen3d: (state) => {
-        return state.common.isOpen3d
+        return state.common.isOpen3d;
       },
       benchList: (state) => {
         return state.benchList.benchList;
@@ -840,7 +854,7 @@ export default {
     }),
   },
   created() {
-    uwbMain('player', window.innerWidth, window.innerHeight, "panorama");
+    uwbMain("player", window.innerWidth, window.innerHeight, "panorama");
     ws.open().then((res) => {
       // console.log("res", res);
     });
@@ -865,19 +879,17 @@ export default {
     });
 
     window.bmMapItemActivate = this.bmMapItemActivate;
-    setInterval(() => {
-      
-    }, 1500);
-    
+    setInterval(() => {}, 1500);
+
     // 调用定时器方法,返回定时器id,用于按条件清空
     that.timerId = that.myInterval((count) => {
-        // console.log(count)
-        this.$store.dispatch("benchList/fetchBenchList");
-        if (count > 30000) {
-            console.log('end')
-            that.clearMyInterval(that.timerId)
-        }
-    }, 1000)
+      // console.log(count)
+      this.$store.dispatch("benchList/fetchBenchList");
+      if (count > 30000) {
+        console.log("end");
+        that.clearMyInterval(that.timerId);
+      }
+    }, 1000);
 
     this.$store.dispatch("issueList/fetchIssueList", {
       bench_id: null,
@@ -1010,12 +1022,14 @@ export default {
     bus.on("goHome", () => {
       this.isConnected = false;
       this.$store.dispatch("common/setSquareStatus", false);
-    })
+    });
 
-    let autoCurrentTaskData = window.localStorage.getItem("autoCurrentTaskData");
-    autoCurrentTaskData = JSON.parse(autoCurrentTaskData)
+    let autoCurrentTaskData = window.localStorage.getItem(
+      "autoCurrentTaskData"
+    );
+    autoCurrentTaskData = JSON.parse(autoCurrentTaskData);
     if (autoCurrentTaskData) {
-      this.$store.dispatch("planList/setPlanExecId", autoCurrentTaskData.id)
+      this.$store.dispatch("planList/setPlanExecId", autoCurrentTaskData.id);
       getAutoPlanResult(autoCurrentTaskData.index);
       autoPlanResultInterval.value = setInterval(() => {
         getAutoPlanResult(autoCurrentTaskData.index);
@@ -1027,32 +1041,32 @@ export default {
   },
   methods: {
     myInterval(callback, interval) {
-        // 每设置一次定时器,num++ 代表系统中有num个自定义的定时器
-        this.timerIdMap.num ++
-        // 第 num 个定时器的id
-        let intervalId = 'id' + this.timerIdMap.num
-        this.timerIdMap[intervalId] = true
-        // 循环次数
-        let count = 0
-        
-        let startTime = Date.now()
-        let loop = () => {
-            // 系统map中不存在这个id,就停止循环
-            if (!this.timerIdMap[intervalId]) {
-                return
-            }
-            if (Date.now() > startTime + interval * (count + 1)) {
-                count ++
-                callback(count)
-            }
-            window.requestAnimationFrame(loop)
+      // 每设置一次定时器,num++ 代表系统中有num个自定义的定时器
+      this.timerIdMap.num++;
+      // 第 num 个定时器的id
+      let intervalId = "id" + this.timerIdMap.num;
+      this.timerIdMap[intervalId] = true;
+      // 循环次数
+      let count = 0;
+
+      let startTime = Date.now();
+      let loop = () => {
+        // 系统map中不存在这个id,就停止循环
+        if (!this.timerIdMap[intervalId]) {
+          return;
         }
-        loop()
-        return intervalId
+        if (Date.now() > startTime + interval * (count + 1)) {
+          count++;
+          callback(count);
+        }
+        window.requestAnimationFrame(loop);
+      };
+      loop();
+      return intervalId;
     },
     // 清空定时器,删除全局的定时器id map
     clearMyInterval(intervalId) {
-        delete this.timerIdMap[intervalId]
+      delete this.timerIdMap[intervalId];
     },
     turnToNextManualCase() {},
     clickBackToTaskList() {
@@ -1193,13 +1207,17 @@ export default {
       this.isOpen = true;
     },
     onBlur(e) {
-      console.log('=====----====', e.target.classList)
-      if (Array.prototype.indexOf.call(e.target.classList,'ordinary-left') > -1) {
+      console.log("=====----====", e.target.classList);
+      if (
+        Array.prototype.indexOf.call(e.target.classList, "ordinary-left") > -1
+      ) {
         this.isOpen = false;
       }
     },
     onInput(value) {
       this.inputValue = value;
+      this.$store.dispatch('benchList/filterBenchList', {type: 'name', value: value});
+      this.$store.dispatch('benchList/setFilterBenchFlag', true);
     },
     onClickOutside() {
       if (
@@ -1266,8 +1284,8 @@ export default {
     },
     taskRender(item) {
       return `<div class="item-box" onClick="handleClickTask('${
-                item.uuid || item.id
-              }', '${item.auto}')">
+        item.uuid || item.id
+      }', '${item.auto}')">
               <div class="left">
                   <div style="">
                     <div class="item-title">${item.name}</div>
@@ -1289,7 +1307,7 @@ export default {
           </div>`;
     },
     planRender(item) {
-      console.log(item, 'plan')
+      console.log(item, "plan");
       return `<div onClick="selectRowPlan('${item.uuid || item.id}', '${
         item.auto
       }', '${item.name}')" class="item-box" style="display:${
@@ -2409,7 +2427,7 @@ export default {
       });
     },
     handleBenchClick(benchId, showRemoteButton) {
-      this.currentBench = this.benchList.find(b => b.id == benchId);
+      this.currentBench = this.benchList.find((b) => b.id == benchId);
       this.isRemoteBtnVisible = showRemoteButton;
       this.isDetailVisible = true;
     },
@@ -2438,11 +2456,13 @@ export default {
           func();
           if (screenType == 1) {
             self.benchImgUpper = "data:image/png;base64," + res.data.data;
-            self.benchImgUpperMap[benchId] = "data:image/png;base64," + res.data.data;
+            self.benchImgUpperMap[benchId] =
+              "data:image/png;base64," + res.data.data;
             bus.emit("benchImgChange", { benchImgUpper: self.benchImgUpper });
           } else {
             self.benchImgLower = "data:image/png;base64," + res.data.data;
-            self.benchImgLowerMap[benchId] = "data:image/png;base64," + res.data.data;
+            self.benchImgLowerMap[benchId] =
+              "data:image/png;base64," + res.data.data;
             bus.emit("benchImgChange", { benchImgLower: self.benchImgLower });
           }
           // let screen = res.data.screen_type;
@@ -2460,7 +2480,7 @@ export default {
     handleDblClickImg(benchId) {
       this.benchImgUpper = this.benchImgUpperMap[benchId];
       this.benchImgLower = this.benchImgLowerMap[benchId];
-      this.$store.dispatch('common/setSquareStatus', false)
+      this.$store.dispatch("common/setSquareStatus", false);
       this.selectBench(benchId);
     },
     handleClickImg(benchId, indexParam) {
@@ -2543,9 +2563,7 @@ export default {
         }
       }
     },
-    getAutoPlanResult(key) {
-      
-    }
+    getAutoPlanResult(key) {},
   },
   watch: {
     benchDisplayVisible(newValue, oldValue) {
@@ -2583,11 +2601,10 @@ export default {
       //     let height = parseFloat(style.height);
       //     uwbMain('playersmall', width, height, "floorplan");
       //   })
-        
       // } else {
       //   uwbMain('player', window.innerWidth, window.innerHeight, "panorama");
       // }
-    }
+    },
   },
 };
 </script>