Browse Source

草稿箱区分原理图删除

xiebeibei 4 years ago
parent
commit
04f00c6950
2 changed files with 82 additions and 2 deletions
  1. 4 0
      src/api/editer.js
  2. 78 2
      src/views/drafts.vue

+ 4 - 0
src/api/editer.js

@@ -104,4 +104,8 @@ export function graphElementSearch(params){
 // 图例搜索(提取用)
 export function graphElementQuery(params){
     return httputils.postJson(`${testApi}/graphElement/query`, params)
+}
+//草稿箱原理图删除
+export function deleteByCategory(params){
+    return httputils.postJson(`${testApi}/graph/deleteByCategory`, params)
 }

+ 78 - 2
src/views/drafts.vue

@@ -17,7 +17,8 @@
         <div class="conent-tit">
           <div class="tit-left" v-if="floorName">{{systemName}}-{{floorName}}</div>
           <div class="tit-right">
-            <a-button @click="deleteBtn" :disabled="!floorName">删除</a-button>
+            <a-button @click="modalStatusTip=!modalStatusTip;grouptype='checked';grouptype1='uncheck';" :disabled="!floorName">删除</a-button>
+<!--            <a-button @click="deleteBtn" :disabled="!floorName">删除</a-button>-->
             <a-button @click="publishBtn" :disabled="!floorName">发布</a-button>
             <a-button type="primary" @click="goToEditer" :disabled="!floorName">编辑</a-button>
           </div>
@@ -68,6 +69,26 @@
         </div>
       </div>
     </div>
+    <Modal
+            :show="modalStatusTip"
+            title="确定要删除吗?"
+            mode="tip"
+            type="error"
+            @close="modalClose"
+    >
+      <template #content>
+        <div style="font-size: 15px; padding-left: 16px;padding-top: 16px;"  v-if="categoryId=='XFBFYCFL'||categoryId=='FZQZL'" >
+          <Radio :checked="grouptype" @change="grouptype='checked';grouptype1='uncheck'" >仅删除草稿</Radio>
+          <br>
+          <Radio :checked="grouptype1"  @change="grouptype1='checked';grouptype='uncheck'" >删除草稿和已发布的原理图</Radio>
+<!--          <radio-group  v-if="categoryId=='XFBFYCFL'||categoryId=='FZQZL'" :group-data.sync="groupData" :type="grouptype" @change="handleChange" />-->
+        </div>
+      </template>
+      <template #handle>
+        <Button @click="modalClose" type="default">取消</Button>
+        <Button @click="modalConfirm" type="error">确定</Button>
+      </template>
+    </Modal>
   </div>
 </template>
 <script>
@@ -82,7 +103,8 @@ import {
   queryDraftGroup,
   queryStatistic,
   deleteGraph,
-  publishGraph
+  publishGraph,
+  deleteByCategory
 } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
 import { uuid } from "@/components/mapClass/until";
@@ -95,6 +117,9 @@ export default {
   components: { Tree },
   data() {
     return {
+      modalStatusTip:false,
+      grouptype:'checked',
+      grouptype1:'uncheck',
       treeData: [],
       columns: [
         {
@@ -236,6 +261,7 @@ export default {
       }
     },
     change(id) {
+      console.log(id);
       const data = this.treeData;
       (function recursion(newObj) {
         newObj.map(function(item, index) {
@@ -383,8 +409,56 @@ export default {
         }
       });
     },
+    modalClose() {
+      this.modalStatusTip = false;
+    },
+    modalConfirm() {
+     this.deleteBtn();
+      this.modalStatusTip = false;
+    },
     //删除
     deleteBtn() {
+      if(this.categoryId=='XFBFYCFL'||this.categoryId=='FZQZL'){
+        if(this.grouptype=='checked'){
+          this.deleteGraphMap();
+        }else{
+          this.deleteByCategoryMap();
+        }
+      }else{
+       this.deleteGraphMap()
+      }
+
+    },
+    //原理图删除
+    deleteByCategoryMap(){
+      const loadings = Loading.service({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)"
+      });
+      let params = {
+        "BuildingID": this.BuildingID,
+        "CategoryID": this.categoryId,
+        "FloorID": this.floorId,
+        "ProjectID": this.projectId
+      }
+      deleteByCategory(params).then(res=>{
+        loadings.close();
+        if (res.Result == "success") {
+          this.$message.success("删除成功");
+          this.getTreeData();
+          // this.init();
+          this.legendData = [];
+        } else {
+          this.$message.error(res.Message);
+        }
+      }).catch(()=>{
+        loadings.close();
+      });
+    },
+    //正常删除
+    deleteGraphMap(){
       const loadings = Loading.service({
         lock: true,
         text: "Loading",
@@ -402,6 +476,8 @@ export default {
         } else {
           this.$message.error(res.Message);
         }
+      }).catch(()=>{
+        loadings.close();
       });
     },
     //发布