Procházet zdrojové kódy

属性栏点击选中

YaolongHan před 4 roky
rodič
revize
f819e572e7

+ 3 - 3
package.json

@@ -9,10 +9,10 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.22",
-    "@saga-web/big": "1.0.67",
+    "@saga-web/big": "1.0.70",
     "@saga-web/draw": "2.1.100",
-    "@saga-web/feng-map": "1.0.19",
-    "@saga-web/graph": "2.1.102",
+    "@saga-web/feng-map": "1.0.20",
+    "@saga-web/graph": "2.1.103",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",
     "element-ui": "^2.13.2",

+ 4 - 0
src/api/editer.js

@@ -96,4 +96,8 @@ export function queryInfoSystem(params){
 // 图例搜索
 export function graphElementGroup(params){
     return httputils.postJson(`${testApi}/infoSystem/graphElementGroup`, params)
+}
+// 图例搜索(提取用)
+export function graphElementSearch(params){
+    return httputils.postJson(`${testApi}/graphElement/search`, params)
 }

+ 105 - 37
src/components/baseEditer.vue

@@ -8,7 +8,7 @@
 </template>
 <script>
 import { SFengParser } from "@saga-web/feng-map";
-import { SFloorParser } from "@saga-web/big";
+import { SFloorParser,SItemStatus } from "@saga-web/big";
 import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "./mapClass/EditScence";
 import bus from "@/bus";
@@ -22,9 +22,11 @@ import { STopologyParser } from "./../lib/parsers/STopologyParser";
 import { uuid } from "@/components/mapClass/until";
 import { SImageItem } from "@saga-web/graph/lib";
 import { SPainter, SColor, SFont, SPoint } from "@saga-web/draw";
+import { SImageLegendItem } from "@/lib/items/SImageLegendItem";
 import store from "../store";
 import { Loading } from "element-ui";
 import { Message } from "element-ui";
+import { SCircleItem } from "@/lib/items/SCircleItem"
 let fengmap = null;
 //// 底图空间增加字段 isExtracted:boolean true 已被提取过
 export default {
@@ -165,6 +167,13 @@ export default {
             this.fParser.doorList.forEach(t => this.scene.addItem(t));
             this.fParser.columnList.forEach(t => this.scene.addItem(t));
             this.fParser.casementList.forEach(t => this.scene.addItem(t));
+            this.fParser.pList = [];
+            res.PList.forEach(t => {
+              const item = new SCircleItem(null, t);
+              this.fParser.pList.push(item);
+              this.scene.fidToItem[t.SourceId] = item;
+              this.scene.addItem(item);
+            })
             this.view.scene = this.scene;
             this.view.fitSceneToView();
             this.loading = false;
@@ -312,9 +321,20 @@ export default {
         this.scene.changeAlignItem(val);
       });
       bus.$on("extractItem", () => {
-        const map = {};
+        const map = {},type={};
         this.fParser.spaceList.forEach(t => {
           if (this.hasTypeList.indexOf(t.data.Type) > -1) {
+            type[t.data.Type] = 'Zone'
+            if (map[t.data.Type]) {
+              map[t.data.Type]++;
+            } else {
+              map[t.data.Type] = 1;
+            }
+          }
+        });
+        this.fParser.pList.forEach(t => {
+          if (this.hasTypeList.indexOf(t.data.Type) > -1) {
+            type[t.data.Type] = 'Image'
             if (map[t.data.Type]) {
               map[t.data.Type]++;
             } else {
@@ -329,6 +349,7 @@ export default {
             name: key,
             age: "",
             number: map[key],
+            type: type[key],
             address: "提取"
           });
         }
@@ -348,41 +369,89 @@ export default {
           });
       });
       bus.$on("exportByKey", val => {
-        const list = this.fParser.spaceList
-          .map(t => {
-            if (t.data.Type == val.key) {
-              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
-                };
+        if (val.type == "Image") {
+          const list = this.fParser.pList.map(t => {
+            if (t.data.Type == val.key && val.age.Url) {
+                if (!t.isExtracted) {
+                  t.isExtracted = true;
+                  const data = {
+                    ID: uuid(),
+                    Name: val.age.Name,
+                    GraphElementType: val.age.Type,
+                    Num: 1,
+                    GraphElementId: val.age.Id,
+                    AttachObjectIds: [],
+                    Pos: { X: t.data.Pos.X, Y: -t.data.Pos.Y },
+                    Scale: { X: 1, Y: 1, Z: 1 },          // 缩放
+                    Rolate: { X: 0, Y: 0, Z: 0 },
+                    Size: { Width: 0, Height: 0 },         // 大小
+                    Type: val.age.Type,
+                    Properties: {
+                        IconUrl: '/serve/topology-wanda/Picture/query/' + val.age.Url,
+                        Url: '/serve/topology-wanda/Picture/query/' + val.age.Url,
+                        Num: 1, // 此num与信息工程化得num无关
+                        sWidth: 24,  //icon 的宽
+                        sHeight: 24,   //icon 的高
+                        font: 12,    //font
+                        color: '',  //字体颜色
+                        GraphCategoryId: val.age.GraphCategoryId,
+                        InfoSystemId: val.age.InfoSystemId?val.age.InfoSystemId:'',   //信息工程话分类ID分类
+                        FID: t.data.SourceId
+                    },
+                  };
+                  const item = new SImageLegendItem(null, data)
+                  item.selectable = true;
+                  item.moveable = true;
+                  this.scene.addItem(item);
+                  this.scene.Nodes.push(item);
+                  return item
+                }
               }
-            }
-          })
-          .filter(item => item);
-        const parserData = new STopologyParser(null);
-        parserData.parseData({ Nodes: list });
-        parserData.zoneLegendList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Nodes.push(t);
-        });
-        // undo/redo事件
-        this.scene.AddListCommand(parserData.zoneLegendList);
+          }).filter(item => item);
+          this.scene.AddListCommand(list);
+          bus.$emit("elementDataChange", this.scene);
+        } else if (val.type == "Zone") {
+          const list = this.fParser.spaceList
+            .map(t => {
+              if (t.data.Type == val.key && val.age.Url) {
+                if (!t.isExtracted) {
+                  t.isExtracted = true;
+                  return {
+                    ID: uuid(),
+                    Name: val.age.Name,
+                    GraphElementType: val.age.Type,
+                    GraphElementId: val.age.Id,
+                    AttachObjectIds: [],
+                    Pos: { x: t.x, y: t.y },
+                    OutLine: t.pointArr[0],
+                    SubType: "",
+                    Properties: {
+                      IconUrl: '/serve/topology-wanda/Picture/query/' + val.age.Url,
+                      StrokeColor: val.age.Color,
+                      FillColor: val.age.FillColor,
+                      LineDash: val.age.LineDash,
+                      font: 12,
+                      color: "",
+                      TextPos: { X: 0, Y: 0},
+                      FID: t.data.SourceId
+                    },
+                    Num: 1
+                  };
+                }
+              }
+            })
+            .filter(item => item);
+          const parserData = new STopologyParser(null);
+          parserData.parseData({ Nodes: list });
+          parserData.zoneLegendList.forEach(t => {
+            t.$emit('finishCreated')
+            this.scene.addItem(t);
+            this.scene.Nodes.push(t);
+          });
+          // undo/redo事件
+          this.scene.AddListCommand(parserData.zoneLegendList);
+          bus.$emit("elementDataChange", this.scene);
+        } 
       });
       // 设备图例样式对象
       bus.$on("setLenged", obj => {
@@ -475,7 +544,6 @@ export default {
           this.canvasHeight / 2
         );
         this.changeScaleByClick = false;
-        setTimeout(() => {}, 100);
       });
       // 更改图例数据工程化数据
       bus.$on("changeAttachObjectIds", arr => {

+ 9 - 10
src/components/edit/attr_select.vue

@@ -73,7 +73,7 @@
     </div>
     <!--图片-->
     <div class="attr-select" v-if="type=='baseImage'">
-      <span class="grid-title">文字内容</span>
+      <span class="grid-title">图片</span>
       <section class="grid">
         <div class="grid-content">
           <a-upload-dragger
@@ -104,7 +104,7 @@
           />
         </div>
         <div class="color-choice">
-          <swatches v-model="color" popover-x="left" />
+          <swatches v-model="borderColor" popover-x="left" @close="changeBorderColor" />
         </div>
       </div>
     </div>
@@ -265,12 +265,8 @@
           <a-button type="link" class="edit-option-btn" @click="handleEdit">选择编辑</a-button>
         </div>
 
-        <div class="grid-content">
-          <a-card
-            class="attr-card"
-            v-for="(item,index) in attrCards"
-            :key="index"
-          >{{item.sbjc ||item.wzjc}}</a-card>
+        <div class="grid-content" style="margin-top: 12px;">
+          <a-card class="attr-card" v-for="(item,index) in attrCards" :key="index">{{item.sbjc ||item.wzjc}}</a-card>
         </div>
       </a-spin>
     </div>
@@ -528,7 +524,10 @@ export default {
           } else if (Item.lineStyle == SLineStyle.Dotted) {
             this.borderStyle = "dotted";
           }
-        } else if (
+        } else if (newval.itemType == "baseImage") {
+          this.lineWidth = Item.lineWidth;
+          this.borderColor = Item.strokeColor.value;
+        }else if (
           newval.itemType == "Zone" ||
           newval.itemType == "Line" ||
           newval.itemType == "Image"
@@ -652,7 +651,7 @@ export default {
   }
 
   .grid-content {
-    margin-top: 12px;
+     /*margin-top: 12px;*/
     position: relative;
   }
 

+ 5 - 0
src/components/edit/edit-dialog.vue

@@ -243,6 +243,9 @@
             },
           //获取表格数据
           queryGlsmsasset(){
+              if(!this.classstructureid && !this.locfl){
+                return
+              }
             const data = {
               plazaId: getUrlMsg().projectId,//广场id 必填
               page: this.page,//页数
@@ -356,6 +359,7 @@
                 const data = res.data;
                 data.map(item=>{
                   item.id = item.gname;
+                  item.name = item.code;
                 })
                 this.dataFloor  = data;
               }
@@ -450,6 +454,7 @@
           }
         },
         created() {
+          this.floorId = getUrlMsg().FloorID;
           if(this.attrCards.length){
             this.attrCards.map(item=>{
               this.selectedRowKeys.push(item.location||item.assetnum)

+ 36 - 23
src/components/edit/left_toolbar.vue

@@ -121,6 +121,17 @@
             </div>
             <div v-else class="drawer-model-body drawer-model-body-extract">
               <a-table :columns="columns" :data-source="data" size="small" :pagination="false">
+                <template slot="age" slot-scope="text, record, index">
+                  <div>
+                    <img
+                      :class="['item',`item-${text.Type}`]"
+                      :src="'/serve/topology-wanda/Picture/query/'+ text.Url"
+                      alt
+                      v-if="text.Url"
+                    />
+                    <span v-else>无对应图例</span>
+                  </div>
+                </template>
                 <a-tag
                   slot="address"
                   slot-scope="text, record, index"
@@ -137,7 +148,7 @@
 </template>
 <script>
 import itemTree from "./leftbar_components/itemTree";
-import { graphElementGroup } from "@/api/editer.js";
+import { graphElementGroup, graphElementSearch} from "@/api/editer.js";
 import bus from "@/bus";
 import { queryGroup } from "@/api/editer.js";
 import { mapState, mapActions } from "vuex";
@@ -148,7 +159,8 @@ const columns = [
   },
   {
     title: "图例",
-    dataIndex: "age"
+    dataIndex: "age",
+    scopedSlots: { customRender: "age" }
   },
   {
     title: "数量",
@@ -160,22 +172,7 @@ const columns = [
     scopedSlots: { customRender: "address" }
   }
 ];
-const data = [
-  {
-    key: "1",
-    name: "电梯",
-    age: 32,
-    number: 123,
-    address: "提取"
-  },
-  {
-    key: "2",
-    name: "防火风区",
-    age: 42,
-    number: 123,
-    address: "提取"
-  }
-];
+const data = [];
 
 export default {
   components: { itemTree },
@@ -384,11 +381,27 @@ export default {
     },
     getBus() {
       bus.$on("exportItem", data => {
-        this.data = data.map(t => {
-          (t.name = this.TypeIdToGraphElement[t.key].Name),
-            (t.properties = this.TypeIdToGraphElement[t.key]);
-          return t;
-        });
+        this.data = [];
+        if (data.length) {
+          data.forEach(t => {
+            const pa = {
+              Deleted: false,
+              InfoTypeIds: [t.key],
+              PageSize: 1000,
+              Type: t.type
+            }
+            this.spinning = true
+            graphElementSearch(pa).then(res => {
+              this.spinning = false
+              if (res.Content && res.Content.length) {
+                t.age = res.Content[0];
+                t.name = this.TypeIdToGraphElement[t.key].Name
+                t.properties = this.TypeIdToGraphElement[t.key]
+                this.data.push(t)
+              }
+            })
+          })
+        }
       });
     },
     pickUp(text, record, index) {

+ 3 - 0
src/components/edit/leftbar_components/itemTree.vue

@@ -163,6 +163,9 @@ export default {
   .tree-body {
     height: 420px;
     overflow-y: auto;
+    /deep/ .p-tree-node-content{
+      padding-left: 0 !important;
+    }
   }
 }
 </style>

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

@@ -883,7 +883,7 @@ export class EditScence extends SGraphScene {
     //  以下为鼠标键盘操作事件
     onMouseDown(event: SMouseEvent): any {
         if (!this.isEditStatus) {
-            return super.onMouseDown(event);
+            return true
         }
         // 判断是否开启吸附,并且有吸附的点
         if (
@@ -935,7 +935,7 @@ export class EditScence extends SGraphScene {
 
     onMouseMove(event: SMouseEvent): boolean {
         if (!this.isEditStatus) {
-            return super.onMouseMove(event);
+            return true
         }
         if (this.isAbsorbing) {
             if (!this.highLight) {
@@ -949,6 +949,9 @@ export class EditScence extends SGraphScene {
     }
 
     onMouseUp(event: SMouseEvent): boolean {
+        if (!this.isEditStatus) {
+            return true
+        }
         if (this.grabItem) {
             if (this.grabItem instanceof SLineMarkerItem && this.grabItem.status == SItemStatus.Edit) {
                 this.setLineItem(event)
@@ -970,7 +973,7 @@ export class EditScence extends SGraphScene {
      */
     onKeyDown(event: KeyboardEvent): any {
         if (!this.isEditStatus) {
-            return super.onKeyDown(event);
+            return true
         }
         if (this.grabItem) {
             this.grabItem.onKeyDown(event);

+ 27 - 0
src/lib/items/SCircleItem.ts

@@ -0,0 +1,27 @@
+import { SGraphItem } from '@saga-web/graph/lib';
+import { SPainter, SColor } from '@saga-web/draw/lib';
+
+
+export class SCircleItem extends SGraphItem {
+  private r: number = 3;
+  data: any | null = null
+  isExtracted: boolean = false;
+
+  constructor(parent: SGraphItem | null, data: any) {
+    super(parent)
+    this.visible = false;
+    this.enabled = false;
+    this.data = data;
+    this.name = data.Name;
+    this.isTransform = false;
+    this.moveTo(data.Pos.X, -data.Pos.Y);
+  }
+
+  onDraw(painter: SPainter): void {
+    painter.brush.color = SColor.Black
+    if (this.isExtracted) {
+      painter.brush.color = SColor.Red;
+    }
+    painter.drawCircle(0, 0, this.r);
+  }
+}

+ 1 - 1
src/lib/items/SFHFQZoneLegendItem.ts

@@ -126,7 +126,7 @@ export class SFHFQZoneLegendItem extends SPolygonItem {
             }
             // 设置线宽
             if (data.Properties.LineWidth) {
-                this.lineWidth = data.Properties.LineWidth
+                this.lineWidth = data.Properties.LineWidth;
             }
             if (data.Properties.StrokeColor) {
                 this.strokeColor = data.Properties.StrokeColor.includes('#') ? new SColor(data.Properties.StrokeColor) : new SColor(hexify(data.Properties.StrokeColor));

+ 11 - 1
src/lib/items/SImageMarkerItem.ts

@@ -1,8 +1,9 @@
 
 import { SGraphItem, SImageItem } from "@saga-web/graph/lib";
-import { SPainter } from "@saga-web/draw";
+import { SPainter, SColor } from "@saga-web/draw";
 import { Marker } from '../types/Marker';
 import { ItemOrder } from '@saga-web/big/lib';
+import { hexify } from "@/components/mapClass/until";
 
 /**
  * 标识对象Item(图标类型)
@@ -23,6 +24,7 @@ export class SImageMarkerItem extends SImageItem {
         super(parent);
         this.zOrder = ItemOrder.imageOrder;
         this.isTransform = false;
+        this.url = "";
         this.data = data;
         this.id = data.ID;
         this.name = data.Name;
@@ -34,12 +36,20 @@ export class SImageMarkerItem extends SImageItem {
         if (data.Properties && data.Properties.Url) {
             this.url = data.Properties.Url;
         }
+        if (data.Properties.LineWidth) {
+            this.lineWidth = data.Properties.LineWidth;
+        }
+        if (data.Properties.StrokeColor) {
+            this.strokeColor = data.Properties.StrokeColor.includes('#') ? new SColor(data.Properties.StrokeColor) : new SColor(hexify(data.Properties.StrokeColor));
+        }
     } // Constructor
 
     toData(): Marker {
         this.data.Pos = {X: this.x, Y: this.y};
         this.data.Size = {Width: this.width, Height: this.height};
         this.data.Properties.Url = this.url;
+        this.data.Properties.StrokeColor = this.strokeColor.value;
+        this.data.Properties.LineWidth = this.lineWidth;
         return this.data;
     }
 } // Class SImageMarkerItem

+ 1 - 1
src/lib/items/SSCPZZoneLegendItem.ts

@@ -134,7 +134,7 @@ export class SSCPZZoneLegendItem extends SPolygonItem {
             }
             // 设置线宽
             if (data.Properties.LineWidth) {
-                this.lineWidth = data.Properties.LineWidth
+                this.lineWidth = data.Properties.LineWidth;
             }
             if (data.Properties.StrokeColor) {
                 this.strokeColor = data.Properties.StrokeColor.includes('#') ? new SColor(data.Properties.StrokeColor) : new SColor(hexify(data.Properties.StrokeColor));

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

@@ -127,7 +127,7 @@ export class SZoneLegendItem extends SPolygonItem {
             }
             // 设置线宽
             if (data.Properties.LineWidth) {
-                this.lineWidth = data.Properties.LineWidth
+                this.lineWidth = data.Properties.LineWidth;
             }
             if (data.Properties.StrokeColor) {
                 this.strokeColor = data.Properties.StrokeColor.includes('#') ? new SColor(data.Properties.StrokeColor) : new SColor(hexify(data.Properties.StrokeColor));

+ 6 - 3
src/views/drafts.vue

@@ -246,12 +246,12 @@ export default {
       let items = null;
       data.forEach(ele => {
         ele.children.forEach(item => {
+          ele.open = true;
           if (item.children) {
             item.children.forEach(item1 => {
+              item.open = true;
               if (item1.id == id.id) {
                 items = item;
-                item.open = true;
-                ele.open = true;
                 item1.checked = "checked";
               }
             });
@@ -307,7 +307,9 @@ export default {
             })(data);
             data.forEach(ele => {
               ele.children.forEach(item => {
+                ele.open=true;
                 if (item.children) {
+                  item.open=true;
                   item.children.forEach(item1 => {
                     item1.id = item.Id + item1.Gname;
                   });
@@ -389,7 +391,7 @@ export default {
         if (res.Result == "success") {
           this.$message.success("删除成功");
           this.getTreeData();
-          this.init();
+          // this.init();
           this.legendData = [];
         } else {
           this.$message.error(res.Message);
@@ -468,6 +470,7 @@ export default {
     // 切换草稿箱楼层
     checkFloor(floorid) {
       this.scene = new EditScence();
+      this.scene.isEditStatus = false
       this.clearGraphy();
       const loadings = Loading.service({
         lock: true,