Bladeren bron

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

zhangyu 5 jaren geleden
bovenliggende
commit
122cd2e372

File diff suppressed because it is too large
+ 0 - 12998
package-lock.json


+ 1 - 1
package.json

@@ -11,7 +11,7 @@
     "@saga-web/base": "2.1.22",
     "@saga-web/big": "1.0.54",
     "@saga-web/draw": "2.1.100",
-    "@saga-web/feng-map": "1.0.11",
+    "@saga-web/feng-map": "1.0.13",
     "@saga-web/graph": "2.1.94",
     "@saga-web/topology": "1.0.84",
     "ant-design-vue": "^1.6.0",

+ 4 - 0
src/api/editer.js

@@ -84,4 +84,8 @@ export function deleteGraph(params){
 // 发布系统图
 export function publishGraph(params){
     return httputils.postJson(`${testApi}/graph/publish`, params)
+}
+// 查询设备台账
+export function queryGlsmsAsset(data,params){
+    return httputils.fetchJson(`${dataApi}/data/glsms_asset/query`,data, params)
 }

+ 90 - 72
src/components/baseEditer.vue

@@ -21,7 +21,7 @@ import store from "../store";
 import { Loading } from "element-ui";
 import { Message } from 'element-ui';
 let fengmap = null;
-
+//// 底图空间增加字段 isExtracted:boolean true 已被提取过
 export default {
   props: {
     cmdType: {
@@ -91,52 +91,10 @@ export default {
           .then(response => {
             console.log("获取rf成功", response);
             this.parserData(floorid);
+            this.readGraph()
             loadings.close();
           });
         this.view.fitSceneToView();
-
-      });
-      // 获取主题数据
-      this.readGroup().then(data => {
-        this.graphId = data.Data[0].ID;
-        bus.$emit('setGraphId',this.graphId)
-        if (data.Data) {
-          const parserData = new STopologyParser(null);
-          parserData.parseData(data.Data[0].Elements);
-          // 多边形
-          parserData.zoneLegendList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Nodes.push(t);
-          });
-          // 增加文字
-          parserData.textMarkerList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Markers.push(t);
-          });
-          // 增加图片
-          parserData.imageMarkerList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Markers.push(t);
-          });
-          // 增加直线
-          parserData.lineMarkerList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Markers.push(t);
-          });
-          // 增加图标类图例
-          parserData.imageLegendList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Nodes.push(t);
-          });
-          // 增加管线类
-          // 增加图标类图例
-          parserData.relationList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Relations.push(t);
-          });
-          this.view.fitSceneToView();
-          bus.$emit("elementDataChange", this.scene);
-        }
       });
       // 获取typeid
       this.getTypeId();
@@ -166,8 +124,10 @@ export default {
             }
             this.fParser = new SFloorParser(null);
             this.fParser.parseData(res);
+            this.scene.fidToItem = {}
             this.fParser.spaceList.forEach(t => {
               t.selectable = true;
+              this.scene.fidToItem[t.data.SourceId] = t;
               this.scene.addItem(t);
             });
             this.scene.spaceList = this.fParser.spaceList;
@@ -183,13 +143,61 @@ export default {
             console.log("success");
             // 设置初始化缩放比例
             this.initScale = this.view.scale
-            bus.$emit('initScale', this.view.scale)
+            bus.$emit('initScale', this.view.scale);
           });
         } else {
           console.log("楼层不正确");
         }
       }
     },
+    // 读取绘制数据
+    readGraph(){
+      this.readGroup().then(data => {
+        this.graphId = data.Data[0].ID;
+        bus.$emit('setGraphId',this.graphId)
+        if (data.Data) {
+          const parserData = new STopologyParser(null);
+          parserData.parseData(data.Data[0].Elements);
+          // 多边形
+          parserData.zoneLegendList.forEach(t => {
+            this.scene.addItem(t);
+            // 记录提取
+            if (t.data.Properties && t.data.Properties.FID) {
+              this.scene.fidToItem[t.data.Properties.FID].isExtracted = true
+            }
+            this.scene.Nodes.push(t);
+          });
+          // 增加文字
+          parserData.textMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加图片
+          parserData.imageMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加直线
+          parserData.lineMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加图标类图例
+          parserData.imageLegendList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Nodes.push(t);
+          });
+          // 增加管线类
+          // 增加图标类图例
+          parserData.relationList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Relations.push(t);
+          });
+          this.view.fitSceneToView();
+          bus.$emit("elementDataChange", this.scene);
+        }
+      });
+    },
     // 监听变化
     emitChange(itemMsg) {
       this.chiceItemList = itemMsg.itemList;
@@ -283,30 +291,34 @@ export default {
         saveGroup(data).then(res => {
           Message.close()
           console.log("aaaaaaaaaaaaaa", res);
+          this.graphId = res.Data;
         });
       });
       bus.$on("exportByKey", val => {
         const list = this.fParser.spaceList
           .map(t => {
             if (t.data.Type == val.key) {
-              return {
-                ID: uuid(),
-                Name: val.name,
-                GraphElementType: val.properties.Type,
-                GraphElementId: "273d633cc5c54a4882794b34843d1a00",
-                AttachObjectIds: [],
-                Pos: { x: t.x, y: t.y },
-                OutLine: t.pointArr[0],
-                SubType: "",
-                Properties: {
-                  StrokeColor: "#3d73c0",
-                  FillColor: "#72f5f980",
-                  font: 0,
-                  color: "",
-                  TextPos: { X: 0, Y: 0 }
-                },
-                Num: 1
-              };
+              if (!t.isExtracted) {
+                t.isExtracted = true
+                return {
+                  ID: uuid(),
+                  Name: val.name,
+                  GraphElementType: val.properties.Type,
+                  GraphElementId: "273d633cc5c54a4882794b34843d1a00",
+                  AttachObjectIds: [],
+                  Pos: { x: t.x, y: t.y },
+                  OutLine: t.pointArr[0],
+                  SubType: "",
+                  Properties: {
+                    StrokeColor: "#3d73c0",
+                    FillColor: "#72f5f980",
+                    font: 0,
+                    color: "",
+                    TextPos: { X: 0, Y: 0 }
+                  },
+                  Num: 1
+                };
+              }
             }
           })
           .filter(item => item);
@@ -377,12 +389,16 @@ export default {
       }),
       //发布图
       bus.$on("publishMap", () => {
+        if(this.graphId==''){
+          this.$message.error('请先保存');
+          return false;
+        }
        this.publishBtn()
       })
       /**
        * @name changeScale缩放底图
        * @param { Number } zoom 缩放比例
-       * 
+       *
        */
       // TODO: changeScale缩放底图
       bus.$on('changeScale', zoom => {
@@ -425,13 +441,15 @@ export default {
       publishGraph(data).then(res => {
         loadings.close();
         if (res.Result == "success") {
-          this.$message.success(res.Message);
-          const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
-          const url =
-                  window.location.origin +
-                  "/wandaEditer/drafts?" +
-                  encodeURIComponent(data);
-          window.open(url, true);
+          this.$message.success('发布成功');
+         setTimeout(()=>{
+           const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
+           const url =
+                   window.location.origin +
+                   "/wandaEditer/drafts?" +
+                   encodeURIComponent(data);
+           window.open(url, true);
+         },1000);
         } else {
           this.$message.error(res.Message);
         }
@@ -463,7 +481,7 @@ export default {
       },
       deep: true
     },
-    // 监听scale的变化 
+    // 监听scale的变化
     'view.scale': {
       handler(scale) {
 

+ 48 - 13
src/components/edit/attr_select.vue

@@ -104,10 +104,6 @@
     <!--针对“设备/位置/管线/分区”属性示例-->
     <div class="attr-select" v-show="type =='Image'|| type == 'Line' || type == 'Zone'">
       <div v-if="type =='Image'|| type == 'Line'">
-        <div class="row-tit" v-if="true">颜色</div>
-        <div class="row" v-if="true">
-          <swatches @input="changefillColor" :swatches="swatchess" v-model="fillColor" inline></swatches>
-        </div>
         <div class="row">
           <div class="row-tit">名称显示</div>
           <a-button type="link" class="edit-option-btn" @click="OpenEditStatus">{{editStatus[type]}}</a-button>
@@ -149,7 +145,7 @@
           </div>
         </div>
       </div>
-      <div v-else>
+      <div v-if="type == 'Zone'">
         <div v-if="SubType=='FHFQ'">
           <!-- 防火分区 -->
           <div class="row-tit">颜色</div>
@@ -244,20 +240,21 @@
     </div>
 
     <!--设备/工程信息化ID/工程信息化中的位置类型-->
+
     <div
       class="attr-select attr-select-bottom"
       v-if="type =='Zone' || type =='Image' ||type == 'fire-Zone' ||type == 'Line'"
     >
+      <a-spin :spinning="spinning">
       <div class="row">
-        <span>{{`工程信息化ID`}}</span>
+        <span>{{type =='Zone'?`工程信息化中的位置类型`:'工程信息化中的设备类型'}}</span>
         <a-button type="link" class="edit-option-btn" @click="handleEdit">选择编辑</a-button>
       </div>
 
-      <div class="grid-content">
-        <a-card class="attr-card">福建三明万达-供电系统-6楼-工程信息化中的区域编NDDKJD4</a-card>
-        <a-card class="attr-card">福建三明万达-供电系统-6楼-工程信息化中的区域编NDDKJD</a-card>
-        <a-card class="attr-card">福建三明万达-供电系统-6楼-工程信息化中的区域编NDDKJD</a-card>
-      </div>
+        <div class="grid-content">
+          <a-card class="attr-card" v-for="(item,index) in attrCards" :key="index">{{item.wzjc ||item.sbjc}}</a-card>
+        </div>
+      </a-spin>
     </div>
     <!--    快捷操作提示-->
     <div style="position: fixed;bottom: 0;width: 280px;" class="key-boards">
@@ -297,7 +294,7 @@ import Swatches from "vue-swatches";
 import bus from "@/bus";
 import "vue-swatches/dist/vue-swatches.css";
 import { ItemColor } from "@saga-web/big/lib";
-import { uploadImg } from "@/api/editer.js";
+import { uploadImg, queryGlsmsLocation,queryGlsmsAsset } from "@/api/editer.js";
 export default {
   name: "attr_select",
   props: ["type", "focusItemList"],
@@ -373,7 +370,9 @@ export default {
       imageNum: 1, //设备数量
       fillColor: "", //修改填充色 (主要针对防火风区以及石材铺装)
       SubType: "", //空间类型,区分石材铺装
-      itemExplain:'' //图例说明 只针对石材铺装
+      itemExplain:'', //图例说明 只针对石材铺装
+      attrCards:[],
+      spinning:false
     };
   },
   methods: {
@@ -472,6 +471,7 @@ export default {
   },
   watch: {
     focusItemList: function(newval) {
+      console.log(111111111,newval);
       const Item = newval.itemList[0];
       if (Item.data && Item.data.SubType) {
         this.SubType = Item.data.SubType;
@@ -491,6 +491,11 @@ export default {
           newval.itemType == "Image"
         ) {
           this.lengedName = Item.data.Name;
+          this.itemExplain = '';
+          if(Item.data.Properties.ItemExplain){
+          this.itemExplain = Item.data.Properties.ItemExplain ? Item.data.Properties.ItemExplain : '';
+          }
+
           if (newval.itemType == "Image") {
             this.imageNum = Item.num;
             this.color = Item.color.value;
@@ -503,12 +508,42 @@ export default {
           }
         }
       }
+     if(newval.itemType == 'Zone'){
+       let location = Item.location;
+       this.spinning = true;
+       queryGlsmsLocation({plazaId: '1000423'},{location:'1890'}).then(res=>{
+         this.spinning = false;
+         if(res.data.result =='success'){
+           this.attrCards = res.data.data;
+         }else{
+           this.$message.error('工程信息化中的位置信息获取失败')
+         }
+       })
+     }else if(newval.itemType == 'Image'){
+       this.spinning = true;
+       queryGlsmsAsset({plazaId: '1000423'},{assetnum:'21784'}).then(res=>{
+         this.spinning = false;
+         if(res.data.result =='success'){
+           this.attrCards = res.data.data;
+         }else{
+           this.$message.error('工程信息化中的设备信息获取失败')
+         }
+       })
+     }
+
     }
   }
 };
 </script>
 
 <style scoped lang="less">
+  /deep/ .ant-spin-nested-loading{
+    height: 100% !important;
+    .ant-spin-container{
+      height: 100% !important;
+
+    }
+  }
 .attr-select {
   padding: 12px 16px;
   box-sizing: border-box;

+ 2 - 1
src/components/edit/left_toolbar.vue

@@ -82,7 +82,7 @@
           <a-spin :spinning="spinning">
           <div class="drawer-model-body" v-if="!isExtract">
             <div class="btn-list">
-              <a-radio-group default-value="draw" button-style="solid" @change="changeDrawType">
+              <a-radio-group v-show="showDrawerItem.type == 'Zone'" default-value="draw" button-style="solid" @change="changeDrawType">
                 <a-radio-button value="draw">
                   绘制
                 </a-radio-button>
@@ -290,6 +290,7 @@ export default {
     },
     showDrawer(item) {
       this.showDrawerItem = item;
+      console.log('showDrawerItem',this.showDrawerItem)
       this.isExtract = false;
       if (item.isChoice) {
         this.systemChoice.forEach(a => {

+ 1 - 0
src/components/edit/right_toolbar.vue

@@ -177,6 +177,7 @@ export default {
   watch: {
     focusItemList: function(newVal) {
       this.attrType = newVal.itemType;
+      console.log(' this.attrType',this.attrType)
       if (newVal.itemList.length !== 1) {
         this.msgList.forEach(item => {
           if (item.name == "X") {

+ 26 - 11
src/components/edit/top_toolbar.vue

@@ -37,7 +37,7 @@
               <a-icon type="caret-down" class="down-icon" />
             </div>
             <a-menu slot="overlay">
-              <a-menu-item v-for="item in alignmentOptions" :key="item.value" @click="changeAlignItem(item.value)">
+              <a-menu-item :disabled='item.disable' v-for="item in alignmentOptions" :key="item.value" @click="changeAlignItem(item.value)">
                 <img style="width: 16px;margin-right: 5px;" :src="require(`./../../assets/images/`+item.img+`.png`)" alt />
                 <span>{{item.label}}</span>
               </a-menu-item>
@@ -89,42 +89,50 @@ export default {
         {
           value: SGraphLayoutType.Left,
           label: "左对齐",
-          img: "t-left"
+          img: "t-left",
+          disable:true,
         },
         {
           value: SGraphLayoutType.Right,
           label: "右对齐",
-          img: "t-right"
+          img: "t-right",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Top,
           label: "顶对齐",
-          img: "t-top"
+          img: "t-top",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Bottom,
           label: "底对齐",
-          img: "t-bottom"
+          img: "t-bottom",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Center,
           label: "水平居中对齐",
-          img: "t-center"
+          img: "t-center",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Middle,
           label: "垂直居中对齐",
-          img: "t-topandbottm"
+          img: "t-topandbottm",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Vertical,
           label: "垂直分布",
-          img: "t-vertical"
+          img: "t-vertical",
+           disable:true,
         },
         {
           value: SGraphLayoutType.Horizontal,
           label: "水平分布",
-          img: "t-level"
+          img: "t-level",
+           disable:true,
         }
       ],
       scale: 0.5, //底图缩放比例
@@ -177,15 +185,22 @@ export default {
         return false
       }
       // emit 缩放比例 this.scale / oldScale
-      let oldScale = this.scale
+      const oldScale = this.scale
       this.scale = Number((oldScale + type * this.scaleStep).toFixed(2))
       bus.$emit('changeScale', this.scale / oldScale)
     },
     FocusItemChanged(itemMsg) {
-      this.focusItem = null;
+      this.focusItem = null; 
+      this.alignmentOptions.forEach(el=>{
+            el.disable = true
+        })
       if (itemMsg.itemList.length == 1) {
         this.isLock = itemMsg.itemList[0].moveable;
         this.focusItem = itemMsg.itemList[0];
+      }else if (itemMsg.itemList.length > 1) {
+          this.alignmentOptions.forEach(el=>{
+              el.disable = false
+          })
       }
     },
     lockItem() {

+ 37 - 20
src/components/mapClass/EditScence.ts

@@ -81,6 +81,9 @@ export class EditScence extends SGraphScene {
         this._legend = obj;
         console.log('aaaaaa', obj)
     }
+    /** fid=>item映射,由解析器存入   */
+    fidToItem = {}
+
     /**
      * 监听变化
      * @param obj 变化后的对象
@@ -180,6 +183,13 @@ export class EditScence extends SGraphScene {
      * 增加管道 lenged
      */
     addTipelineItem(event: SMouseEvent): boolean {
+        const anc = this.clickIsAnchor(event);
+        if (anc) {
+            const p = anc.mapToScene(0, 0)
+            anc.isConnected = true;
+            event.x = p.x;
+            event.y = p.y;
+        }
         const LegendData: Relation = {
             ID: uuid(),
             Name: this._legend.Name,
@@ -205,6 +215,11 @@ export class EditScence extends SGraphScene {
         // this.undoStack.push(new SGraphAddCommand(this, item));
         this.grabItem = item;
         this.focusItem = item;
+        // 起始锚点
+        item.startAnchor = anc;
+        if (anc) {
+            anc.parent?.connect('changePos', item, item.changePos)
+        }
         this.scenceUpdate(this);
         return true
     }
@@ -261,11 +276,12 @@ export class EditScence extends SGraphScene {
      * 点选创建区域
     */
     clickToAddArea(item: SSpaceItem): void {
-        console.log(item)
         if (this.cmd != 'Zone') {
             return
         }
-        if (this.isSelecting  && this._legend) {
+        if (this.isSelecting && this._legend) {
+            //@ts-ignore
+            item.isExtracted = true
             const SubType = this._legend.SubType ? this._legend.SubType : ''
             const LegendData: Legend = {
                 ID: uuid(),
@@ -286,6 +302,7 @@ export class EditScence extends SGraphScene {
                     LineWidth: this._legend.LineWidth,
                     font: 12,
                     color: '',
+                    FID: item.data.SourceId,
                     TextPos: { X: item.data.Location.Points[0].X, Y: -item.data.Location.Points[0].Y }
                 },
             }
@@ -584,7 +601,7 @@ export class EditScence extends SGraphScene {
     upadataLengedName(val: string): void {
         if (this.focusItem && this.focusItem.data) {
             this.focusItem.text = val;
-            this.scenceUpdate(this); 
+            this.scenceUpdate(this);
         }
     }
 
@@ -608,12 +625,12 @@ export class EditScence extends SGraphScene {
         }
     }
     /**
-   * 更改图例说明数量
-   * @param num number item数量 (只对icon设备类)
+   * 更改图例说
+   * @param num number
    */
-    upadatitemExplain(itemExplain: string): void {
+    upadatitemExplain(ItemExplain: string): void {
         if (this.focusItem) {
-            this.focusItem.itemExplain = itemExplain;
+            this.focusItem.data.Properties.ItemExplain = ItemExplain;
         }
     }
 
@@ -637,7 +654,7 @@ export class EditScence extends SGraphScene {
                         a = index
                     }
                 });
-                if(a > -1) {
+                if (a > -1) {
                     this.Nodes.splice(a, 1);
                 }
                 let b = -1;
@@ -666,7 +683,7 @@ export class EditScence extends SGraphScene {
             }
         }
     }
-    scenceUpdate(scence: any) {}
+    scenceUpdate(scence: any) { }
 
     /**
      * 对齐指定item
@@ -775,7 +792,7 @@ export class EditScence extends SGraphScene {
         }
     }
 
-    onMouseMove(event: SMouseEvent):boolean {
+    onMouseMove(event: SMouseEvent): boolean {
         if (this.isAbsorbing) {
             if (!this.highLight) {
                 this.highLight = new HighlightItem(null);
@@ -816,7 +833,6 @@ export class EditScence extends SGraphScene {
         this.Nodes.forEach(image => {
             if (image.anchorList && image.anchorList.length) {
                 image.anchorList.forEach(anchor => {
-                    console.log(anchor)
                     let anchorPoint = anchor.mapToScene(0, 0);
                     let dis = SMathUtil.pointDistance(
                         event.x,
@@ -836,18 +852,19 @@ export class EditScence extends SGraphScene {
         })
         console.log('-----------------------')
         console.log(minAnchor)
+        console.log('-----------------------')
         return minAnchor;
     }
 
-   /**
-     *  点是否在吸附区域内
-     *
-     *  @param  p       要判断的点
-     *  @param  minX    空间区域
-     *  @param  minY    空间区域
-     *  @param  maxX    空间区域
-     *  @param  maxY    空间区域
-     */
+    /**
+      *  点是否在吸附区域内
+      *
+      *  @param  p       要判断的点
+      *  @param  minX    空间区域
+      *  @param  minY    空间区域
+      *  @param  maxX    空间区域
+      *  @param  maxY    空间区域
+      */
     static isPointInAbsorbArea(
         p: SPoint,
         minX: number,