浏览代码

自定义编队删除问题

Rmengdi 1 月之前
父节点
当前提交
fdc689ef05
共有 1 个文件被更改,包括 23 次插入20 次删除
  1. 23 20
      uavps-web/src/views/system/task/index.vue

+ 23 - 20
uavps-web/src/views/system/task/index.vue

@@ -477,7 +477,7 @@
                       ><label>{{ item.latitude }}</label>
                     </div>
                     <div>
-                      <span>海拔&nbsp;&nbsp;</span
+                      <span>海拔&nbsp;&nbsp;</span
                       ><label>{{ item.altitude }}</label>
                     </div>
                     <div>
@@ -596,7 +596,12 @@
           </el-form-item>
         </el-form>
         <div class="demo-drawer__footer">
-          <el-button type="danger" @click="canvasInfoDel">删 除</el-button>
+          <el-button
+            type="danger"
+            :disabled="this.addOrUpdate == 'add'"
+            @click="canvasInfoDel"
+            >删 除</el-button
+          >
           <el-button type="primary" @click="handleDrawerSubmit"
             >确 定</el-button
           >
@@ -2300,32 +2305,30 @@ export default {
       this.$modal
         .confirm("是否确认删除该无人机")
         .then(() => {
-          // return delTask(bizIds);
           this.formationInfoForm = this.ObjectStringToNumber(
             this.formationInfoForm
           );
           let index = this.formationInfoList.findIndex(
             (item) => item.number == this.formationInfoForm.number
           );
-          this.formationInfoList.splice(index, 1);
-          this.formationInfoAirDataList = this.formationInfoAirDataList.filter(
-            (item) => {
-              return item.id !== this.formationInfoForm.number;
-            }
-          );
-          this.formationAirPiXiApp.stage.children.forEach((child, index) => {
-            // 检查 child 是否是 Container 类型
-            if (child instanceof PIXI.Sprite) {
-              if (child.id == this.formationInfoForm.number) {
-                if (child.parent) {
-                  child.parent.removeChild(child);
+          if (index > -1) {
+            this.formationInfoAirDataList =
+              this.formationInfoAirDataList.filter((item) => {
+                return item.id !== this.formationInfoForm.number;
+              });
+            this.formationAirPiXiApp.stage.children.forEach((child, index) => {
+              // 检查 child 是否是 Container 类型
+              if (child instanceof PIXI.Sprite) {
+                if (child.id == this.formationInfoForm.number) {
+                  if (child.parent) {
+                    child.parent.removeChild(child);
+                  }
+                  child.destroy();
                 }
-
-                // 可选:销毁精灵并释放资源
-                child.destroy();
               }
-            }
-          });
+            });
+            this.formationInfoList.splice(index, 1);
+          }
         })
         .then(() => {
           this.drawerOpen = false;