Bläddra i källkod

草稿箱删除接口联调

xiebeibei 4 år sedan
förälder
incheckning
0cc8f4abcf
1 ändrade filer med 90 tillägg och 54 borttagningar
  1. 90 54
      src/views/drafts.vue

+ 90 - 54
src/views/drafts.vue

@@ -1,58 +1,61 @@
 <template>
-  <div id="drafts">
-    <div class="tit">草稿箱</div>
-    <div class="conent">
-      <div class="left-nav">
-        <!--        <Tree :data="treeData" @change="change"></Tree>-->
-        <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
-      </div>
-      <div class="conent-right">
-        <div class="conent-tit">
-          <div class="tit-left">消防系统-4F</div>
-          <div class="tit-right">
-            <a-button @click="deleteBtn">删除</a-button>
-            <a-button>发布</a-button>
-            <a-button type="primary">编辑</a-button>
-          </div>
+  <a-spin :spinning="spinning">
+    <div id="drafts">
+      <div class="tit">草稿箱</div>
+      <div class="conent">
+        <div class="left-nav">
+          <!--        <Tree :data="treeData" @change="change"></Tree>-->
+          <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
         </div>
-        <div class="concent-bottom">
-          <div class="map">
-            <div class="canvas-container" ref="draftsCanvas">
-              <div id="fengMap"></div>
-              <canvas
-                id="canvas"
-                :width="canvasWidth"
-                :height="canvasHeight"
-                ref="canvas"
-                tabindex="0"
-              ></canvas>
+        <div class="conent-right">
+          <div class="conent-tit">
+            <div class="tit-left" v-if="floorName">{{systemName}}-{{floorName}}</div>
+            <div class="tit-right">
+              <a-button @click="deleteBtn">删除</a-button>
+              <a-button>发布</a-button>
+              <a-button type="primary" @click="goToEditer">编辑</a-button>
             </div>
           </div>
-          <div v-show="!legend" class="legend-btn" @click="legend = !legend">
-            <a-icon type="right" style="color: #8D9399;font-size: 10px" />
-          </div>
-          <div  v-show="legend" class="legend-btn legend-btn-close" @click="legend = !legend">
-            <a-icon type="right" style="color: #8D9399;font-size: 10px" />
-          </div>
-          <div class="legend" v-if="legend">
-            <div
-              style="font-size:14px;color: #1F2429;padding-left: 12px;height: 40px;line-height: 40px"
-            >可能需要补充的图例</div>
-            <a-table   v-loading='legendLoading' :columns="columns" rowKey="Id" :data-source="legendData" size="middle" :pagination="false">
+          <div class="concent-bottom">
+            <div class="map">
+              <div class="canvas-container" ref="draftsCanvas">
+                <div id="fengMap"></div>
+                <canvas
+                        id="canvas"
+                        :width="canvasWidth"
+                        :height="canvasHeight"
+                        ref="canvas"
+                        tabindex="0"
+                ></canvas>
+              </div>
+            </div>
+            <div v-show="!legend" class="legend-btn" @click="legend = !legend">
+              <a-icon type="right" style="color: #8D9399;font-size: 10px" />
+            </div>
+            <div  v-show="legend" class="legend-btn legend-btn-close" @click="legend = !legend">
+              <a-icon type="right" style="color: #8D9399;font-size: 10px" />
+            </div>
+            <div class="legend" v-if="legend">
+              <div
+                      style="font-size:14px;color: #1F2429;padding-left: 12px;height: 40px;line-height: 40px"
+              >可能需要补充的图例</div>
+              <a-table   v-loading='legendLoading' :columns="columns"  :rowKey="(record,index)=>{return index}" :data-source="legendData" size="middle" :pagination="false">
                 <div slot="Url" slot-scope='text,record'>
                   <img  v-if="record.Url" style=" width: 20px;height: 22px;"
-                       :src="'/serve/topology-wanda/Picture/query/'+ record.Url"
-                       alt
+                        :src="'/serve/topology-wanda/Picture/query/'+ record.Url"
+                        alt
                   />
                   <span v-else>---</span>
                 </div>
-              <span></span>
-            </a-table>
+                <span></span>
+              </a-table>
+            </div>
           </div>
         </div>
       </div>
     </div>
-  </div>
+  </a-spin>
+
 </template>
 <script>
 import Tree from "./../components/Tree/Tree.vue";
@@ -107,14 +110,23 @@ export default {
       projectId: "", //项目id
       fmapID: "", //蜂鸟地图id
       graphId:'124aeab6fbb346cd92057525a30aee18',
-      legendLoading:false
+      legendLoading:false,
+      spinning:false,//全局加载
+      systemName:'',
+      floorName:''
     };
   },
   methods: {
-    handleNodeClick(data) {
-      console.log(data);
-      this.getLegend();
-      console.log(queryPicture);
+    handleNodeClick(data,node) {
+      console.log(data,1111111,node);
+      this.legendData = [];
+      this.systemName='';
+      this.floorName='';
+      if(data.Gname){
+        this.systemName = node.parent.data.Gcode;
+        this.floorName = data.Gcode;
+        this.getLegend();
+      }
     },
     init() {
       // const loadings = this.$loading({type: 'global'});
@@ -194,7 +206,7 @@ export default {
       }
     },
     getTreeData(){
-      queryDraftGroup({projectId:'1000423'}).then(res=>{
+      queryDraftGroup({projectId:this.projectId}).then(res=>{
         console.log(res);
         if (res.Result == "success") {
           this.treeData = res.Data;
@@ -206,9 +218,10 @@ export default {
     },
     //获取补充图例
     getLegend(){
-        this.legendLoading = true;
+      this.legendLoading = true;
+      this.legendData = [];
       queryStatistic({
-        projectId:'1000423',
+        projectId:this.projectId,
         flag:true,
         graphId:this.graphId,
       }).then(res=>{
@@ -229,12 +242,34 @@ export default {
     },
     //删除
     deleteBtn(){
-      const  idList = [];
-      idList.push(this.graphId)
-      deleteGraph({idList:idList}).then(res =>{
+      this.spinning = true;
+      deleteGraph([{Id:[this.graphId]}]).then(res =>{
         console.log(res);
+        this.spinning = false;
+        if(res.Result =='success'){
+          this.$message.success(res.Message)
+        }else{
+          this.$message.error(res.Message)
+
+        }
       })
-    }
+    },
+    /**
+     * @name goToEditer
+     * @description t跳转editer编辑器
+     */
+    goToEditer() {
+      console.log(this.$cookie);
+      let FloorID = this.$cookie.get('floorMapId') || 'f1'
+      let categoryId = this.$cookie.get('categoryId')
+      const { conf } = window.__systemConf,
+              { editerUrl } = conf
+      let data = `categoryId=${categoryId}&projectId=${this.plazaId}&BuildingID=1&FloorID=${FloorID}&fmapID=${this.fmapID}`
+      let url = editerUrl + 'editer?' + encodeURIComponent(data)
+      window.open(url, true)
+    },
+
+
   },
   mounted() {
     this.canvasWidth = this.$refs.draftsCanvas.offsetWidth - 10;
@@ -321,6 +356,7 @@ export default {
           width: 246px;
           display: flex;
           justify-content: space-between;
+          margin-left: auto;
         }
       }
       .concent-bottom {