YaolongHan vor 4 Jahren
Ursprung
Commit
48c4a80d4d

+ 7 - 25
package-lock.json

@@ -1064,29 +1064,11 @@
       "integrity": "sha512-Oy5eRCxqJoP3RzT8w6auuk1M3u93CXfW7fhzL3BNhl71WnDk0hjpJ2/TXOOdS8kVqYm7zLx5PhmO/EU0CCoZTQ=="
     },
     "@saga-web/big": {
-      "version": "1.0.43",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/big/-/big-1.0.43.tgz",
-      "integrity": "sha512-AAi/EBXfdb4nuMYkY6Tl2/bB9uNt/X7Py0BBR1L6Yof8xqpALULKFT4dZoU+3CU7yG6yNAW6+jK3wGzd3ApMwQ==",
+      "version": "1.0.44",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/big/-/big-1.0.44.tgz",
+      "integrity": "sha512-7xRC4Qe3aly5x/3jpGCnzb12b+gcMBwfgMx3ZGD2uxdmPkisQzPNZuPxp6j4+RrYILhgRnL+AiaUQdEv9go3JQ==",
       "requires": {
-        "@saga-web/graph": "2.1.84"
-      },
-      "dependencies": {
-        "@saga-web/draw": {
-          "version": "2.1.94",
-          "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/draw/-/draw-2.1.94.tgz",
-          "integrity": "sha512-niu1zEvTv4l3Gnx+Qv7LPjgaPAgKQIIjUGM0H2nyvfJlRZb96LVJSum77cGJunhTl7ak6opg28JWCUUCKW/qRw==",
-          "requires": {
-            "@saga-web/base": "^2.1.19"
-          }
-        },
-        "@saga-web/graph": {
-          "version": "2.1.84",
-          "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graph/-/graph-2.1.84.tgz",
-          "integrity": "sha512-7RwFNoVQcjrmWmzZhOrSUkvCeBfJsf7i0HElXvouN8ooy9R3KP1xcJnDGZ2MP9i9udmw09JEbjMVHrLhXZrEsQ==",
-          "requires": {
-            "@saga-web/draw": "2.1.94"
-          }
-        }
+        "@saga-web/graph": "2.1.87"
       }
     },
     "@saga-web/draw": {
@@ -1133,9 +1115,9 @@
       }
     },
     "@saga-web/graph": {
-      "version": "2.1.86",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graph/-/graph-2.1.86.tgz",
-      "integrity": "sha512-ZapOQ7BJymzsYcW5qjv5dWjUiDeI3gHOZOIv8UV3/CuQ3s09WMv75jGG/D0dQtiDhICoUYc5IVZlZVBS184a5g==",
+      "version": "2.1.87",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graph/-/graph-2.1.87.tgz",
+      "integrity": "sha512-83CNK2dLurIaBIt6BNz+1rGaVd1tY2mOuVf0TuMP/3CZ/VyqVZ4Jg7m39/dxNWdsrhjsjBecrN5GudMut41iig==",
       "requires": {
         "@saga-web/draw": "2.1.97"
       }

+ 13 - 4
src/components/baseEditer.vue

@@ -134,6 +134,7 @@ export default {
       // 获取typeid
       this.getTypeId();
       this.scene.emitChange = this.emitChange;
+      this.scene.scenceUpdate = this.scenceUpdate;
     },
     parserData(floor) {
       if (floor == "g80") {
@@ -184,6 +185,10 @@ export default {
       this.$emit("changeFocusItem", itemMsg);
       bus.$emit("FocusItemChanged", itemMsg);
     },
+    // 监听场景元素数据变化
+    scenceUpdate(scence) {
+      bus.$emit("elementDataChange", scence);
+    },
     clearGraphy() {
       if (this.view) {
         this.view.scene = null;
@@ -283,8 +288,8 @@ export default {
                 OutLine: t.pointArr[0],
                 SubType: "",
                 Properties: {
-                  strokeColor: "#3d73c0",
-                  fillColor: "#eda986",
+                  StrokeColor: "#3d73c0",
+                  FillColor: "#72f5f980",
                   font: 0,
                   color: "",
                   TextPos: { X: 0, Y: 0 }
@@ -346,8 +351,8 @@ export default {
         this.scene.upadatitemExplain(val);
       });
       //发布图
-      bus.$on("publishGraph", val => {
-            this.spinning = true;
+      // bus.$on("publishGraph", val => {
+      //       this.spinning = true;
     //   publishGraph({ graphId: this.graphId, pubUser: "" }).then(res => {
     //     this.spinning = false;
     //     if (res.Result == "success") {
@@ -357,6 +362,10 @@ export default {
     //     }
     //   });
     // });
+      //创建区域是否点选
+      bus.$on("changeDrawType", val => {
+        this.scene.isSelecting = val == "select";
+      })
     },
     // 读取数据
     readGroup() {

+ 11 - 4
src/components/edit/left_toolbar.vue

@@ -80,10 +80,14 @@
         >
           <div class="drawer-model-body" v-if="!isExtract">
             <div class="btn-list">
-              <a-button-group>
-                <a-button type="primary">绘制</a-button>
-                <a-button>点选</a-button>
-              </a-button-group>
+              <a-radio-group default-value="draw" button-style="solid" @change="changeDrawType">
+                <a-radio-button value="draw">
+                  绘制
+                </a-radio-button>
+                <a-radio-button value="select">
+                  点选
+                </a-radio-button>
+              </a-radio-group>
             </div>
             <div class="list" v-for="(item,index) in itemList" :key="index">
               <div class="title">{{item.Name}}</div>
@@ -334,6 +338,9 @@ export default {
     },
     pickUp(text, record, index) {
       bus.$emit("exportByKey", record);
+    },
+    changeDrawType(v) {
+      bus.$emit('changeDrawType', v.target.value)
     }
   },
   watch: {

+ 3 - 2
src/components/edit/right_toolbar.vue

@@ -26,7 +26,7 @@
         <div class="element">
           <a-input-search placeholder="搜索" style="margin-bottom: 12px;" v-model="key" @search="onSearch" />
           <ul class="element-list">
-            <li v-for="ele in elementData" :key="ele.id" v-show="ele.name == key">
+            <li v-for="ele in elementData" :key="ele.id" v-show="key?ele.name.search(key) != -1:true">
               <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>
@@ -111,6 +111,7 @@ export default {
         if (val.Relations.length) {
           this.elementData = this.elementData.concat(val.Relations);
         }
+        console.log(this.elementData);
       });
     },
     callback(key) {
@@ -118,7 +119,7 @@ export default {
     },
     // 元素检索
     onSearch(key) {
-
+      console.log(key);
     },
     // 改变状态
     changeStatus(item) {

+ 87 - 9
src/components/mapClass/EditScence.ts

@@ -16,6 +16,7 @@ import { Relation } from '@/lib/types/Relation';
 import { uuid } from "@/components/mapClass/until";
 import { STextMarkerItem } from '@/lib/items/STextMarkerItem';
 import { SLineMarkerItem } from '@/lib/items/SLineMarkerItem';
+import { SSpaceItem } from '@saga-web/big/lib/items/floor/SSpaceItem';
 /**
  * 在线绘图
  *
@@ -47,6 +48,8 @@ export class EditScence extends SGraphScene {
             this.view.update();
         }
     };
+    /** 绘制区域时 是否为点选   */
+    isSelecting: boolean = false;
 
     /** 当前选中焦点Item */
     focusItem: SGraphItem | null = null;
@@ -94,6 +97,9 @@ export class EditScence extends SGraphScene {
             itemType = 'Image'
         } else if (obj.itemList[0] instanceof TipelineItem) {
             itemType = 'Line'
+        } else if (obj.itemList[0] instanceof SSpaceItem) { // 点选
+            this.clickToAddArea(obj.itemList[0]);
+            return
         } else {
             itemType = ''
         };
@@ -137,7 +143,8 @@ export class EditScence extends SGraphScene {
         this.addItem(item);
         item.connect("finishCreated", this, this.finishCreated);
         this.grabItem = item;
-        this.Markers.push(item)
+        this.Markers.push(item);
+        this.scenceUpdate(this);
         // this.undoStack.push(new SGraphAddCommand(this, item));
         // item.connect("onMove", this, this.onItemMove.bind(this));
         return true
@@ -190,6 +197,7 @@ export class EditScence extends SGraphScene {
         // this.undoStack.push(new SGraphAddCommand(this, item));
         this.grabItem = item;
         this.focusItem = item;
+        this.scenceUpdate(this);
         return true
     }
 
@@ -238,6 +246,58 @@ export class EditScence extends SGraphScene {
         this.grabItem = Polylines;
         this.focusItem = Polylines;
         this.Nodes.push(Polylines);
+        this.scenceUpdate(this);
+    }
+
+    /**
+     * 点选创建区域
+    */
+    clickToAddArea(item: SSpaceItem): void {
+        console.log(item)
+        if (this.cmd != 'Zone') {
+            return
+        }
+        if (this.isSelecting  && this._legend) {
+            const SubType = this._legend.SubType ? this._legend.SubType : ''
+            const LegendData: Legend = {
+                ID: uuid(),
+                Name: this._legend.Name,
+                GraphElementType: this._legend.Type,
+                Num: 1,
+                GraphElementId: this._legend.Id,
+                AttachObjectIds: [],
+                Type: "Zone",
+                Pos: { X: item.x, Y: item.y },
+                OutLine: item.pointArr[0],
+                SubType: SubType,
+                Properties: {
+                    IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
+                    StrokeColor: this._legend.Color,
+                    FillColor: this._legend.FillColor,
+                    LineDash: this._legend.LineDash,
+                    LineWidth: this._legend.LineWidth,
+                    font: 0,
+                    color: '',
+                    TextPos: { X: item.data.Location.Points[0].X, Y: -item.data.Location.Points[0].Y }
+                },
+            }
+            let Polylines = null;
+            if (SubType == "SCPZ") {
+                Polylines = new SSCPZZoneLegendItem(null, LegendData);
+            } else if (SubType == "FHFQ") {
+                Polylines = new SFHFQZoneLegendItem(null, LegendData);
+            } else {
+                Polylines = new SZoneLegendItem(null, LegendData);
+            }
+            Polylines.selectable = true;
+            //设置状态
+            Polylines.status = SItemStatus.Normal;
+            this.addItem(Polylines);
+            Polylines.connect("finishCreated", this, this.finishCreated);
+            this.focusItem = Polylines;
+            this.Nodes.push(Polylines);
+            this.scenceUpdate(this);
+        }
     }
 
     /**
@@ -268,7 +328,8 @@ export class EditScence extends SGraphScene {
         this.grabItem == null;
         this.focusItem = item;
         this.cmd = 'choice';
-        this.Markers.push(item)
+        this.Markers.push(item);
+        this.scenceUpdate(this);
     }
 
     /**
@@ -301,7 +362,8 @@ export class EditScence extends SGraphScene {
         this.addItem(item);
         this.grabItem == null
         this.cmd = 'choice';
-        this.Markers.push(item)
+        this.Markers.push(item);
+        this.scenceUpdate(this);
     }
 
     /**
@@ -338,6 +400,7 @@ export class EditScence extends SGraphScene {
         // item.moveTo(event.x, event.y);
         this.addItem(item);
         this.Nodes.push(item);
+        this.scenceUpdate(this);
     }
 
     /**
@@ -355,6 +418,7 @@ export class EditScence extends SGraphScene {
         if (this.focusItem) {
             const old = this.focusItem.text;
             this.focusItem.text = str;
+            this.scenceUpdate(this);
             // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", old, str));
         }
     }
@@ -510,7 +574,8 @@ export class EditScence extends SGraphScene {
      */
     upadataLengedName(val: string): void {
         if (this.focusItem && this.focusItem.data) {
-            this.focusItem.text = val
+            this.focusItem.text = val;
+            this.scenceUpdate(this); 
         }
     }
 
@@ -520,7 +585,7 @@ export class EditScence extends SGraphScene {
      */
     upadatImageNum(num: number): void {
         if (this.focusItem && this.focusItem.num) {
-            this.focusItem.num = num
+            this.focusItem.num = num;
         }
     }
 
@@ -555,27 +620,35 @@ export class EditScence extends SGraphScene {
                     a = index
                 }
             });
-            this.Nodes.splice(a, 1);
+            if(a > -1) {
+                this.Nodes.splice(a, 1);
+            }
             let b = -1;
             this.Markers.forEach((item: any, index: number) => {
                 if (item.id == this.focusItem.id) {
                     b = index
                 }
             });
-            this.Markers.splice(b, 1);
+            if (b > -1) {
+                this.Markers.splice(b, 1);
+            }
             let c = -1;
             this.Relations.forEach((item: any, index: number) => {
                 if (item.id == this.focusItem.id) {
                     c = index
                 }
             });
-            this.Relations.splice(c, 1);
+            if (c > -1) {
+                this.Relations.splice(c, 1);
+            }
             this.focusItem = null;
         }
         if (this.view) {
             this.view.update();
         }
+        this.scenceUpdate(this);
     }
+    scenceUpdate(scence: any) {}
 
     /**
      * 对齐指定item
@@ -657,7 +730,12 @@ export class EditScence extends SGraphScene {
                 this.addImgItem(event)
                 break;
             case 'Zone':
-                this.addPolygonItem(event);
+                if (!this.isSelecting) {
+                    this.addPolygonItem(event);
+                } else {
+                    // 点选创建区域
+                    return super.onMouseDown(event)
+                }
                 break;
             case 'Image':
                 this.addIconItem(event);

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

@@ -103,7 +103,6 @@ export class SZoneLegendItem extends SPolygonItem {
             this.setPointList = [];
             let setPointList: SPoint[];
             if (data.OutLine) {
-                console.log(data.OutLine[0] instanceof SPoint)
                 if (data.OutLine[0] instanceof SPoint) {
                     // @ts-ignore
                     this.setPointList = data.OutLine;

+ 2 - 1
src/lib/types/Legend.ts

@@ -23,6 +23,7 @@ import { Anchor } from "./Anchor";
 import { SGraphElementType } from "./../enums/SGraphElementType";
 import { Point } from "@saga-web/big/lib/types/Point";
 import { Size } from "@saga-web/big/lib/types/Size";
+import { SPoint } from '@saga-web/draw/lib';
 
 /**
  * 图例节点接口
@@ -55,7 +56,7 @@ export interface Legend {
     /** 锚点List  */
     AnchorList?: Anchor[];
     /** 轮廓线  */
-    OutLine?: Point[];
+    OutLine?: Point[] | SPoint[];
     /** 由应用自己定义  */
     Properties?: any;
      /** zone 区分防火分区和石材铺装  */

+ 13 - 3
src/views/drafts.vue

@@ -1,6 +1,7 @@
 <template>
-  <a-spin :spinning="spinning">
+
     <div id="drafts">
+      <a-spin :spinning="spinning">
       <div class="tit">草稿箱</div>
       <div class="conent">
         <div class="left-nav">
@@ -62,8 +63,9 @@
           </div>
         </div>
       </div>
+      </a-spin>
     </div>
-  </a-spin>
+
 </template>
 <script>
 import Tree from "./../components/Tree/Tree.vue";
@@ -247,7 +249,9 @@ export default {
         console.log(res);
         this.spinning = false;
         if (res.Result == "success") {
-          this.$message.success(res.Message);
+          this.$message.success('删除成功');
+          this.getTreeData();
+          this.legendData = [];
         } else {
           this.$message.error(res.Message);
         }
@@ -368,6 +372,12 @@ export default {
 };
 </script>
 <style lang="less" scoped>
+  /deep/ .ant-spin-nested-loading{
+    height: 100% !important;
+   .ant-spin-container{
+     height: 100% !important;
+   }
+  }
 #drafts {
   widows: 100%;
   height: 100%;

+ 13 - 12
vue.config.js

@@ -1,9 +1,10 @@
 module.exports = {
     devServer: {
+        port: 8091,
         // 关闭esline
         overlay: {
             warnings: false,
-            errors: false
+            errors: false,
         },
         proxy: {
             '/wdfn': {
@@ -13,34 +14,34 @@ module.exports = {
                     '^/wdfn': '/editor',
                 },
             },
-            "/serve": {
+            '/serve': {
                 target: 'http://192.168.200.87:8088/',
                 // target: 'http://192.168.200.83:8085/',
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {
-                    "^/serve": "",
+                    '^/serve': '',
                 },
             },
-            "/data": {
-                target: "http://192.168.200.87:9003",
+            '/data': {
+                target: 'http://192.168.200.87:9003',
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {
-                    "^/data": "",
+                    '^/data': '',
                 },
             },
-        }
+        },
     },
     chainWebpack: (config) => {
-        const svgRule = config.module.rule('svg');
-        svgRule.uses.clear();
+        const svgRule = config.module.rule('svg')
+        svgRule.uses.clear()
         svgRule
             .use('babel-loader')
             .loader('babel-loader')
             .end()
             .use('vue-svg-loader')
-            .loader('vue-svg-loader');
+            .loader('vue-svg-loader')
     },
     lintOnSave: false,
     // publicPath: '/dist',
@@ -48,5 +49,5 @@ module.exports = {
     // 打包名称
     outputDir: 'wandaEditer',
     // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
-    assetsDir: "static",
-}
+    assetsDir: 'static',
+}