YaolongHan 4 years ago
parent
commit
60c124aa9c
4 changed files with 58 additions and 33 deletions
  1. 1 1
      src/api/editer.js
  2. 28 14
      src/components/baseEditer.vue
  3. 5 2
      src/components/edit/top_toolbar.vue
  4. 24 16
      src/views/drafts.vue

+ 1 - 1
src/api/editer.js

@@ -83,5 +83,5 @@ export function deleteGraph(params){
 
 // 发布系统图
 export function publishGraph(params){
-    return httputils.getJson(`${testApi}/graph/publish`, params)
+    return httputils.postJson(`${testApi}/graph/publish`, params)
 }

+ 28 - 14
src/components/baseEditer.vue

@@ -12,7 +12,7 @@ import { SFloorParser } from "@saga-web/big";
 import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "./mapClass/EditScence";
 import bus from "@/bus";
-import { saveGroup, readGroup, queryTypeGraph } from "@/api/editer.js";
+import { saveGroup, readGroup, queryTypeGraph,publishGraph } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
 import { uuid } from "@/components/mapClass/until";
 import { SImageItem } from "@saga-web/graph/lib";
@@ -48,7 +48,8 @@ export default {
       floorList: {},
       urlMsg: {},
       chiceItemList: [], //选中itemlist
-      hasTypeList: [] // 当前类型下包含的typeid(提取)
+      hasTypeList: [], // 当前类型下包含的typeid(提取)
+      graphId:''
     };
   },
   mounted() {
@@ -93,6 +94,7 @@ export default {
       });
       // 获取主题数据
       this.readGroup().then(data => {
+        this.graphId = data.Data[0].ID;
         if (data.Data) {
           const parserData = new STopologyParser(null);
           parserData.parseData(data.Data[0].Elements);
@@ -350,21 +352,13 @@ export default {
       bus.$on("changeitemExplain", val => {
         this.scene.upadatitemExplain(val);
       });
-      //发布图
-      // bus.$on("publishGraph", val => {
-      //       this.spinning = true;
-    //   publishGraph({ graphId: this.graphId, pubUser: "" }).then(res => {
-    //     this.spinning = false;
-    //     if (res.Result == "success") {
-    //       this.$message.success(res.Message);
-    //     } else {
-    //       this.$message.error(res.Message);
-    //     }
-    //   });
-    // });
       //创建区域是否点选
       bus.$on("changeDrawType", val => {
         this.scene.isSelecting = val == "select";
+      }),
+      //发布图
+      bus.$on("publishMap", () => {
+       this.publishMap()
       })
     },
     // 读取数据
@@ -378,6 +372,26 @@ export default {
       };
       return readGroup(data);
     },
+        //发布
+    publishBtn() {
+      this.spinning = true;
+             const data = {
+        BuildingID: this.urlMsg.BuildingID,
+        CategoryID: this.urlMsg.categoryId,
+        FloorID: this.urlMsg.FloorID,
+        GraphId: this.graphId,
+        ProjectID: this.urlMsg.projectId,
+        PubUser: ""
+      };
+      publishGraph(data).then(res => {
+        this.spinning = false;
+        if (res.Result == "success") {
+          this.$message.success(res.Message);
+        } else {
+          this.$message.error(res.Message);
+        }
+      });
+    },
     // 获取typeid
     getTypeId() {
       const data = {

+ 5 - 2
src/components/edit/top_toolbar.vue

@@ -75,7 +75,7 @@
       </ul>
     </div>
     <div class="btn-list">
-      <div class="btn-list-item">
+      <div class="btn-list-item" @click="publishMap">
         <Icon name="release" />
         <span>发布</span>
       </div>
@@ -167,6 +167,10 @@ export default {
         this.$message.error("请选择指定对象!", 1);
       }
     },
+    // 发布图例
+    publishMap(){
+      bus.$emit("publishMap");
+    },
     // 对齐item
     changeAlignItem(val) {
       bus.$emit("changeAlignItem", val);
@@ -198,7 +202,6 @@ export default {
       obj[arr[0]] = arr[1];
     });
     this.urlMsg = obj;
-    // ///////////测试代码
     const FloorName =  this.urlMsg.FloorName ? this.urlMsg.FloorName:'';
     this.urlMsg.floorName = systym[this.urlMsg.categoryId] + '-' + FloorName;
   }

+ 24 - 16
src/views/drafts.vue

@@ -1,7 +1,6 @@
 <template>
-
-    <div id="drafts">
-      <a-spin :spinning="spinning">
+  <div id="drafts">
+    <a-spin :spinning="spinning">
       <div class="tit">草稿箱</div>
       <div class="conent">
         <div class="left-nav">
@@ -63,9 +62,8 @@
           </div>
         </div>
       </div>
-      </a-spin>
-    </div>
-
+    </a-spin>
+  </div>
 </template>
 <script>
 import Tree from "./../components/Tree/Tree.vue";
@@ -124,7 +122,7 @@ export default {
       spinning: false, //全局加载
       systemName: "",
       floorName: "",
-      floorId:'',    //楼层id
+      floorId: "", //楼层id
       BuildingID: "1", // 建筑id
       categoryId: "" //系统类id
     };
@@ -249,7 +247,7 @@ export default {
         console.log(res);
         this.spinning = false;
         if (res.Result == "success") {
-          this.$message.success('删除成功');
+          this.$message.success("删除成功");
           this.getTreeData();
           this.legendData = [];
         } else {
@@ -260,7 +258,15 @@ export default {
     //发布
     publishBtn() {
       this.spinning = true;
-      publishGraph({ graphId: this.graphId, pubUser: "" }).then(res => {
+      const data = {
+        BuildingID: this.BuildingID,
+        CategoryID: this.categoryId,
+        FloorID: this.floorId,
+        GraphId: this.graphId,
+        ProjectID: this.projectId,
+        PubUser: ""
+      };
+      publishGraph(data).then(res => {
         this.spinning = false;
         if (res.Result == "success") {
           this.$message.success(res.Message);
@@ -275,8 +281,7 @@ export default {
         categoryId: this.categoryId,
         projectId: this.projectId,
         BuildingID: this.BuildingID, // 建筑ID
-        FloorID: floorid, // 楼层id
-        Pub:false   //是否获取草稿 //获取草稿
+        FloorID: floorid // 楼层id
       };
       return readGroup(data);
     },
@@ -286,7 +291,10 @@ export default {
      */
     goToEditer() {
       const data = `categoryId=${this.categoryId}&projectId=${this.projectId}&BuildingID=1&FloorID=${this.floorId}&FloorName=${this.floorName}&fmapID=${this.fmapID}`;
-      const url = window.location.origin + "/wandaEditer/editer?" + encodeURIComponent(data);
+      const url =
+        window.location.origin +
+        "/wandaEditer/editer?" +
+        encodeURIComponent(data);
       window.open(url, true);
     },
     // 切换草稿箱楼层
@@ -372,12 +380,12 @@ export default {
 };
 </script>
 <style lang="less" scoped>
-  /deep/ .ant-spin-nested-loading{
+/deep/ .ant-spin-nested-loading {
+  height: 100% !important;
+  .ant-spin-container {
     height: 100% !important;
-   .ant-spin-container{
-     height: 100% !important;
-   }
   }
+}
 #drafts {
   widows: 100%;
   height: 100%;