Procházet zdrojové kódy

Merge branch 'master' of http://121.42.8.157:13000/zengminguo/D-MAP

57862207 před 1 rokem
rodič
revize
5c051769f5

+ 3 - 1
src/components/TabList/index.vue

@@ -722,7 +722,8 @@ export default {
     },
     handleSelectionChange() {},
     startAutoCase() {
-      let data = {
+      let data = {}
+      data.data = {
         plan_id: this.currentPlanId,
         attribute: {},
         skips: [],
@@ -730,6 +731,7 @@ export default {
         match_agent_id: this.multipleSelection,
         custom_agent_id: this.multipleSelection,
       };
+      data.planId = plan_id;
       this.$store.dispatch("caseList/startPlan", data);
       this.clickBackToAutoCaseList();
     },

+ 27 - 2
src/store/modules/case/actions.js

@@ -125,8 +125,11 @@ export default {
   },
   async startPlan({commit}, data) {
     try {
-      const result = await caseApi.startPlan(data);
-      commit('setAutoStatus', result)
+      const result = await caseApi.startPlan(data.data);
+      commit('setAutoStatus', {
+        id: data.planId,
+        res: result
+      })
     }catch(e) {
 
     }
@@ -137,5 +140,27 @@ export default {
   },
   setCurrentTask({commit}, id) {
     commit('setCurrentTask', id)
+  },
+  async getAllAutoPlanStatus({commit}, data) {
+    try{
+      let getAutoPlanStatusParam = {
+        name: data.planName,
+        currentPage: 1,
+        pageSize: 20,
+      };
+      caseApi.getAutoPlanStatus(getAutoPlanStatusParam).then((res) => {
+        let rows = res.data.rows;
+        commit('setAllAutoPlanStatus', {
+          name: data.planName,
+          id: data.planId,
+          res: rows
+        });
+      })
+      .catch((err) => {
+        console.error(err);
+      }); 
+    } catch (e) {
+      
+    }
   }
 };

+ 22 - 2
src/store/modules/case/mutations.js

@@ -29,10 +29,12 @@ export default {
   setPlanExecId(state, id) {
     state.planExecId = id
   },
-  setAutoStatus(state, res) {
+  setAutoStatus(state, data) {
     // state.autoTaskSubmitLoading = false;
     state.autoTaskStatus = "running";
-    state.planExecId = res.data.info[0];
+    state.autoTaskStatusMap[data.id] = "running";
+    state.planExecId = data.res.data.info[0];
+    state.planExecIdMap[data.id] = data.res.data.info[0];
     localStorage.setItem("autoCurrentTaskData", JSON.stringify({
       index: state.currentTaskIndex,
       id: state.planExecId,
@@ -47,5 +49,23 @@ export default {
   cancelPlan(state, res) {
     state.autoTaskStatus = "ready";
     localStorage.removeItem("autoCurrentTaskData")
+  },
+  setAllAutoPlanStatus(state, data) {
+    let obj = JSON.parse(localStorage.getItem("autoCurrentTaskData"))
+    let planExecId = obj? obj.id : 0;
+    for (let i in data.res) {
+      if (data.res[i].id == planExecId) {
+        // state.autoTaskStatus = rows[i].status;
+        state.autoTaskStatusMap[data.id] = rows[i].status;
+        break;
+      }
+    }
+    // localStorage.setItem("autoCurrentTaskData", JSON.stringify({
+    //   index: state.currentTaskIndex,
+    //   id: state.planExecId,
+    // }));
+    // state.autoCaseList.forEach(c => {
+    //   c.status = "running"
+    // })
   }
 };

+ 37 - 37
src/uwb-sample.js

@@ -556,43 +556,43 @@ export function uwbMain(domId, modelWidth, modelHeight, finalMode, callback) {
             let bFirst = true;
             let bool = false;
             let bool1 = false;
-            intersects.forEach(m => {
-              if (m.object.geometry.type != "PlaneBufferGeometry") {
-                if (m.object.userData && m.object.userData.benchFlag == true) {
-                  if (!bool) {
-                    bool = true;
-                    //m.object.material = window.shader1;
-                    ////m.object.scale.set(10, 10, 10)
-                    //m.object.scale.set(5, 5, 5)
-                    //outlineObj(m.object)
-                    // let player = document.getElementById(domId)
-                    // player.style.display = "none"
-
-                    if (box) {
-                      sdkInstance.sceneRenderer.scene.remove(box);
-                    }
-                    window.handleBenchClick(m.object.userData.benchId, m.object.userData.bShowRemoteButton)
-
-                    box = new THREE.BoxHelper(m.object, '#ff0000');  //object 模型
-                    sdkInstance.sceneRenderer.scene.add(box);
-
-                    //let ambientLight = new THREE.AmbientLight(0xffffff); //设置环境光
-                    //sdkInstance.sceneRenderer.scene.add(ambientLight); //将环境光添加到场景中
-                    //let pointLight = new THREE.PointLight(0xffffff, 1, 0);
-                    //pointLight.position.set(200, 200, 200); //设置点光源位置
-                    //sdkInstance.sceneRenderer.scene.add(pointLight); //将点光源添加至场景
-                  }
-                  //outlineObj(m.object)
-
-                  //m.object.material = FXAAShader
-                }
-
-              } else if (m.object.geometry.type == "PlaneBufferGeometry") {
-                if (m.object.userData && m.object.userData.benchFlag == true) {
-                  window.handleListClick(m.object.userData.benchId)
-                }
-              }
-            })
+            // intersects.forEach(m => {
+            //   if (m.object.geometry.type != "PlaneBufferGeometry") {
+            //     if (m.object.userData && m.object.userData.benchFlag == true) {
+            //       if (!bool) {
+            //         bool = true;
+            //         //m.object.material = window.shader1;
+            //         ////m.object.scale.set(10, 10, 10)
+            //         //m.object.scale.set(5, 5, 5)
+            //         //outlineObj(m.object)
+            //         // let player = document.getElementById(domId)
+            //         // player.style.display = "none"
+
+            //         if (box) {
+            //           sdkInstance.sceneRenderer.scene.remove(box);
+            //         }
+            //         window.handleBenchClick(m.object.userData.benchId, m.object.userData.bShowRemoteButton)
+
+            //         box = new THREE.BoxHelper(m.object, '#ff0000');  //object 模型
+            //         sdkInstance.sceneRenderer.scene.add(box);
+
+            //         //let ambientLight = new THREE.AmbientLight(0xffffff); //设置环境光
+            //         //sdkInstance.sceneRenderer.scene.add(ambientLight); //将环境光添加到场景中
+            //         //let pointLight = new THREE.PointLight(0xffffff, 1, 0);
+            //         //pointLight.position.set(200, 200, 200); //设置点光源位置
+            //         //sdkInstance.sceneRenderer.scene.add(pointLight); //将点光源添加至场景
+            //       }
+            //       //outlineObj(m.object)
+
+            //       //m.object.material = FXAAShader
+            //     }
+
+            //   } else if (m.object.geometry.type == "PlaneBufferGeometry") {
+            //     if (m.object.userData && m.object.userData.benchFlag == true) {
+            //       window.handleListClick(m.object.userData.benchId)
+            //     }
+            //   }
+            // })
             bool = false;
             bool1 = false;
           }

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

@@ -1,6 +1,26 @@
 .el-table__column-filter-trigger {
   display: none !important;
 }
+.taskBtn.ready {
+  background-image: none;
+  background-color: #7BAF66;
+}
+
+.taskBtn.running, .taskBtn.waiting {
+  background-image: none;
+  background-color: #eebe77;
+}
+
+.taskBtn.finished {
+  background-image: none;
+  background-color: #eebe77;
+}
+
+.taskBtn.offline {
+  background-image: none;
+  background-color: #92949B;
+}
+
 .ordinary-container {
   display: flex;
 

+ 15 - 3
src/views/ordinaryPage/index.vue

@@ -727,6 +727,9 @@ export default {
         planList = planList.sort((p1, p2) => p1.id - p2.id);
         return planList;
       },
+      autoPlanList: (state) => {
+        return state.planList.autoPlanList;
+      },
       caseList: (state) => {
         return state.caseList.caseList;
       },
@@ -752,6 +755,9 @@ export default {
           return i - j;
         });
       },
+      autoTaskStatusMap: (state) => {
+        return state.caseList.autoTaskStatusMap
+      }
     }),
   },
   created() {
@@ -1221,9 +1227,7 @@ export default {
                     }">Auto</div>
                   </div>
               </div>
-              <!-- <div class="taskBtn" onClick="handleClickTask('${
-                item.uuid || item.id
-              }', '${item.auto}')">To Do</div> -->
+              <div class="taskBtn ${this.autoTaskStatusMap[item.id] || 'ready'}">${this.autoTaskStatusMap[item.id] || 'ready'}</div>
           </div>`;
     },
     issueRender(item) {
@@ -2531,6 +2535,14 @@ export default {
       this.readyCount = readyCount;
       this.offlineCount = offlineCount;
       this.occupiedCount = occupiedCount;
+    },
+    autoPlanList() {
+      this.autoPlanList.forEach(m => {
+        this.$store.dispatch('caseList/getAllAutoPlanStatus', {
+          planId: m.id,
+          planName: m.name
+        })
+      })
     }
   },
 };