浏览代码

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

haojianlong 4 年之前
父节点
当前提交
c4bd0fa908

+ 34 - 2
package-lock.json

@@ -2793,6 +2793,16 @@
       "integrity": "sha1-I8DfFPaogHf1+YbA0WfsA8PVU3w=",
       "dev": true
     },
+    "bindings": {
+      "version": "1.5.0",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/bindings/-/bindings-1.5.0.tgz",
+      "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+      "dev": true,
+      "optional": true,
+      "requires": {
+        "file-uri-to-path": "1.0.0"
+      }
+    },
     "bluebird": {
       "version": "3.7.2",
       "resolved": "https://registry.npm.taobao.org/bluebird/download/bluebird-3.7.2.tgz",
@@ -5705,6 +5715,13 @@
         "schema-utils": "^2.5.0"
       }
     },
+    "file-uri-to-path": {
+      "version": "1.0.0",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+      "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+      "dev": true,
+      "optional": true
+    },
     "filesize": {
       "version": "3.6.1",
       "resolved": "https://registry.npm.taobao.org/filesize/download/filesize-3.6.1.tgz",
@@ -8152,6 +8169,13 @@
         "thenify-all": "^1.0.0"
       }
     },
+    "nan": {
+      "version": "2.14.1",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/nan/-/nan-2.14.1.tgz",
+      "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
+      "dev": true,
+      "optional": true
+    },
     "nanomatch": {
       "version": "1.2.13",
       "resolved": "https://registry.npm.taobao.org/nanomatch/download/nanomatch-1.2.13.tgz",
@@ -12143,7 +12167,11 @@
           "resolved": "http://192.168.200.80:8081/repository/npm-saga/fsevents/-/fsevents-1.2.13.tgz",
           "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
           "dev": true,
-          "optional": true
+          "optional": true,
+          "requires": {
+            "bindings": "^1.5.0",
+            "nan": "^2.12.1"
+          }
         },
         "glob-parent": {
           "version": "3.1.0",
@@ -12448,7 +12476,11 @@
           "resolved": "http://192.168.200.80:8081/repository/npm-saga/fsevents/-/fsevents-1.2.13.tgz",
           "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
           "dev": true,
-          "optional": true
+          "optional": true,
+          "requires": {
+            "bindings": "^1.5.0",
+            "nan": "^2.12.1"
+          }
         },
         "glob-parent": {
           "version": "3.1.0",

+ 4 - 2
src/components/baseEditer.vue

@@ -122,7 +122,7 @@ export default {
             this.scene.Relations.push(t);
           });
           this.view.fitSceneToView();
-          bus.$emit("initElement", this.scene);
+          bus.$emit("elementDataChange", this.scene);
         }
       });
       // 获取typeid
@@ -345,7 +345,9 @@ export default {
         categoryId: this.urlMsg.categoryId,
         projectId: this.urlMsg.projectId,
         BuildingID: this.urlMsg.BuildingID, // 建筑ID
-        FloorID: this.urlMsg.FloorID // 楼层id
+        FloorID: this.urlMsg.FloorID, // 楼层id
+        Pub:false   //是否获取草稿 //获取草稿
+
       };
       return readGroup(data);
     },

+ 35 - 12
src/components/edit/right_toolbar.vue

@@ -24,11 +24,11 @@
       </a-tab-pane>
       <a-tab-pane key="2" tab="元素" force-render>
         <div class="element">
-          <a-input-search placeholder="搜索" @search="onSearch" />
+          <a-input-search placeholder="搜索" style="margin-bottom: 12px;" v-model="key" @search="onSearch" />
           <ul class="element-list">
-            <li>
-              <a-icon type="play-circle" />
-              <span>电梯系统</span>
+            <li v-for="ele in elementData" :key="ele.id" v-show="ele.name == key">
+              <el-image style="width: 45px; height: 26px; margin-top: 6px;" :src="ele.data.Properties.IconUrl" fit="contain"></el-image>
+              <span class="element-name">{{ele.name}}</span>
             </li>
           </ul>
         </div>
@@ -87,26 +87,39 @@ export default {
     attrSelect
   },
   created() {
-    
+    this.listenElementData();
   },
   data() {
     return {
       msgList,
       attrType: "",
-      elementData: []
+      elementData: [],
+      key: "",
     };
   },
   methods: {
-    getElementData() {
-      bus.$on("initElement", val => {
-        console.log(val);
-        debugger
+    // 获取元素数据
+    listenElementData() {
+      bus.$on("elementDataChange", val => {
+        this.elementData = [];
+        if (val.Nodes.length) {
+          this.elementData = this.elementData.concat(val.Nodes);
+        }
+        if (val.Markers.length) {
+          this.elementData = this.elementData.concat(val.Markers);
+        }
+        if (val.Relations.length) {
+          this.elementData = this.elementData.concat(val.Relations);
+        }
       });
     },
     callback(key) {
       console.log(key);
     },
-    onSearch() {},
+    // 元素检索
+    onSearch(key) {
+
+    },
     // 改变状态
     changeStatus(item) {
       if (item.name == "Width") {
@@ -244,8 +257,10 @@ li {
   }
   .element {
     margin: 0 12px 0 12px;
+    height: 100%;
     .element-list {
-      padding-top: 12px;
+      height: calc(100% - 44px);
+      overflow-y: auto;
       box-sizing: border-box;
       li {
         width: 100%;
@@ -254,6 +269,11 @@ li {
         padding-left: 12px;
         box-sizing: border-box;
         color: #1f2429;
+        .element-name {
+          display: inline-block;
+          vertical-align: top;
+          line-height: 38px;
+        }
         &:hover {
           background: #f5f6f7;
         }
@@ -261,4 +281,7 @@ li {
     }
   }
 }
+/deep/ .ant-tabs .ant-tabs-top-content.ant-tabs-content-animated {
+  height: calc(100% - 60px);
+}
 </style>

+ 7 - 6
src/components/mapClass/EditScence.ts

@@ -132,6 +132,7 @@ export class EditScence extends SGraphScene {
             Pos: { X: 0, Y: 0 },
             /** 由应用自己定义  */
             Properties: {
+                IconUrl: require("../../assets/images/t-line-hover.png"),
                 Line: [{ X: event.x, Y: event.y }]
             }
         }
@@ -173,14 +174,11 @@ export class EditScence extends SGraphScene {
         const LegendData: Relation = {
             ID: uuid(),
             Name: this._legend.Name,
-            GraphElementType: this._legend.Type,
-            Num: 1,
             GraphElementId: this._legend.Id,
-            AttachObjectIds: [],
-            Type: "Line",
             PointList: [{ X: event.x, Y: event.y }],
-            LineType: 0,
+            LineType: "Line",
             Properties: {
+                IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
                 LineDash: this._legend.LineDash,
                 LineWidth: this._legend.LineWidth,
                 Color: this._legend.Color,
@@ -205,7 +203,6 @@ export class EditScence extends SGraphScene {
      * 增加多边形item lenged
      */
     addPolygonItem(event: SMouseEvent): void {
-
         const SubType = this._legend.SubType ? this._legend.SubType : ''
         const LegendData: Legend = {
             ID: uuid(),
@@ -219,6 +216,7 @@ export class EditScence extends SGraphScene {
             OutLine: [{ X: event.x, Y: event.y }],
             SubType: SubType,
             Properties: {
+                IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
                 StrokeColor: this._legend.Color,
                 FillColor: this._legend.FillColor,
                 LineDash: this._legend.LineDash,
@@ -312,6 +310,7 @@ export class EditScence extends SGraphScene {
             Pos: { X: event.x, Y: event.y },
             /** 由应用自己定义  */
             Properties: {
+                IconUrl: require(`../../assets/images/t-img-hover.png`),
                 Url: '',
             }
         }
@@ -341,6 +340,7 @@ export class EditScence extends SGraphScene {
             Pos: { X: event.x, Y: event.y },
             /** 由应用自己定义  */
             Properties: {
+                IconUrl: require(`../../assets/images/t-text-hover.png`),
                 Text: '请在右侧属性栏输入文字!',
                 Color: '',
                 Font: 0,
@@ -374,6 +374,7 @@ export class EditScence extends SGraphScene {
             Rolate: { X: 0, Y: 0, Z: 0 },
             Size: { Width: 0, Height: 0 },         // 大小
             Properties: {
+                IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
                 Url: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
                 Num: 1, // 此num与信息工程化得num无关
                 sWidth: 0,  //icon 的宽

+ 1 - 1
src/components/mapClass/until.ts

@@ -23,5 +23,5 @@
     s[8] = s[13] = s[18] = s[23] = "-";
 
     var uuid = s.join("");
-    return uuid;
+    return `${uuid}-${new Date().getTime()}`;
 }

+ 1 - 0
src/lib/items/TipelineItem.ts

@@ -96,6 +96,7 @@ export class TipelineItem extends SPolylineItem {
       return new SPoint(item.X, item.Y);
     });
     this.data = data;
+    this.name = data.Name;
     this.id = data.ID;
     if (data.GraphElementId) {
       this._graphElementId = data.GraphElementId

+ 1 - 1
src/lib/types/Relation.ts

@@ -47,7 +47,7 @@ export interface Relation {
     /** 方向(0:无向,1:节点1到节点2,2:节点2到节点1) */
     Dir?: SRelationDir;
     /** 线类型(0:直线,1:水平/垂直线,2:曲线) */
-    LineType: SLineType;
+    LineType: string;
     /** 线的顶点坐标 */
     PointList: Point[];
     /** 线的绘图样式 */

+ 140 - 79
src/views/drafts.vue

@@ -21,29 +21,38 @@
               <div class="canvas-container" ref="draftsCanvas">
                 <div id="fengMap"></div>
                 <canvas
-                        id="canvas"
-                        :width="canvasWidth"
-                        :height="canvasHeight"
-                        ref="canvas"
-                        tabindex="0"
+                  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">
+            <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"
+                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
+              <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
                   />
                   <span v-else>---</span>
                 </div>
@@ -55,7 +64,6 @@
       </div>
     </div>
   </a-spin>
-
 </template>
 <script>
 import Tree from "./../components/Tree/Tree.vue";
@@ -65,7 +73,6 @@ import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "@/components/mapClass/EditScence";
 import bus from "@/bus";
 import {
-  saveGroup,
   readGroup,
   queryDraftGroup,
   queryStatistic,
@@ -110,23 +117,27 @@ export default {
       },
       projectId: "", //项目id
       fmapID: "", //蜂鸟地图id
-      graphId:'124aeab6fbb346cd92057525a30aee18',
-      legendLoading:false,
-      spinning:false,//全局加载
-      systemName:'',
-      floorName:''
+      graphId: "", //绘制生成得图id
+      legendLoading: false,
+      spinning: false, //全局加载
+      systemName: "",
+      floorName: "",
+      BuildingID: "1", // 建筑id
+      categoryId: "" //系统类id
     };
   },
   methods: {
-    handleNodeClick(data,node) {
-      console.log(data,1111111,node);
+    handleNodeClick(data, node) {
       this.legendData = [];
-      this.systemName='';
-      this.floorName='';
-      if(data.Gname){
+      this.systemName = "";
+      this.floorName = "";
+      if (data.Gname) {
         this.systemName = node.parent.data.Gcode;
         this.floorName = data.Gcode;
+        console.log(node.parent.data.Id)
+        this.categoryId = node.parent.data.Id;
         this.getLegend();
+        this.checkFloor(data.Gname);
       }
     },
     init() {
@@ -141,19 +152,6 @@ export default {
         this.appName,
         null
       );
-      const floorid = "f1";
-      fengmap.loadMap(this.fmapID, resp => {
-        this.floorList = resp;
-        fengmap
-          .loadTheme(
-            `${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`
-          )
-          .then(response => {
-            console.log("获取rf成功", response);
-            this.parserData(floorid);
-          });
-        this.view.fitSceneToView();
-      });
     },
     clearGraphy() {
       if (this.view) {
@@ -206,67 +204,76 @@ export default {
         }
       }
     },
-    getTreeData(){
-      queryDraftGroup({projectId:this.projectId}).then(res=>{
+    getTreeData() {
+      queryDraftGroup({ projectId: this.projectId }).then(res => {
         console.log(res);
         if (res.Result == "success") {
           this.treeData = res.Data;
-        }else{
-          this.treeData=[];
-          this.$message.error('获取楼层结构失败');
+        } else {
+          this.treeData = [];
+          this.$message.error("获取楼层结构失败");
         }
       });
     },
     //获取补充图例
-    getLegend(){
+    getLegend() {
       this.legendLoading = true;
       this.legendData = [];
       queryStatistic({
-        projectId:this.projectId,
-        flag:true,
-        graphId:this.graphId,
-      }).then(res=>{
+        projectId: this.projectId,
+        flag: true,
+        graphId: this.graphId
+      }).then(res => {
         console.log(res);
         this.legendLoading = false;
-        if(res.data.Result =='success'){
+        if (res.data.Result == "success") {
           const data = res.data.Data;
-          data.map(item=>{
-            if(item.RealNum ==0){
+          data.map(item => {
+            if (item.RealNum == 0) {
               this.legendData.push(item);
             }
-          })
-        }else{
-          this.legendData=[];
-          this.$message.error('获取楼层结构补充图例失败');
+          });
+        } else {
+          this.legendData = [];
+          this.$message.error("获取楼层结构补充图例失败");
         }
-      })
+      });
     },
     //删除
-    deleteBtn(){
+    deleteBtn() {
       this.spinning = true;
-      deleteGraph([{Id:[this.graphId]}]).then(res =>{
+      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)
-
+        if (res.Result == "success") {
+          this.$message.success(res.Message);
+        } else {
+          this.$message.error(res.Message);
         }
-      })
+      });
     },
     //发布
-    publishBtn(){
+    publishBtn() {
       this.spinning = true;
-      publishGraph({graphId :this.graphId ,pubUser:''}).then(res=>{
+      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)
-
+        if (res.Result == "success") {
+          this.$message.success(res.Message);
+        } else {
+          this.$message.error(res.Message);
         }
-      })
+      });
+    },
+    // 读取数据
+    readGroup(floorid) {
+      const data = {
+        categoryId: this.categoryId,
+        projectId: this.projectId,
+        BuildingID: this.BuildingID, // 建筑ID
+        FloorID: floorid, // 楼层id
+        Pub:false   //是否获取草稿 //获取草稿
+      };
+      return readGroup(data);
     },
     /**
      * @name goToEditer
@@ -274,16 +281,70 @@ export default {
      */
     goToEditer() {
       console.log(this.$cookie);
-      let FloorID = this.$cookie.get('floorMapId') || 'f1'
-      let categoryId = this.$cookie.get('categoryId')
+      const FloorID = this.$cookie.get("floorMapId") || "f1";
+      const 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)
+        { editerUrl } = conf;
+      const data = `categoryId=${categoryId}&projectId=${this.plazaId}&BuildingID=1&FloorID=${FloorID}&fmapID=${this.fmapID}`;
+      const url = editerUrl + "editer?" + encodeURIComponent(data);
+      window.open(url, true);
     },
-
-
+    // 切换草稿箱楼层
+    checkFloor(floorid) {
+      fengmap.loadMap(this.fmapID, resp => {
+        this.floorList = resp;
+        fengmap
+          .loadTheme(
+            `${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`
+          )
+          .then(response => {
+            console.log("获取rf成功", response);
+            this.parserData(floorid);
+          });
+        this.view.fitSceneToView();
+        // 获取
+        // 获取主题数据
+        this.readGroup(floorid).then(data => {
+          this.graphId = data.Data[0].ID;
+          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();
+          }
+        });
+      });
+    }
   },
   mounted() {
     this.canvasWidth = this.$refs.draftsCanvas.offsetWidth - 10;