Selaa lähdekoodia

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

zhangyu 4 vuotta sitten
vanhempi
commit
7295657908

+ 2 - 2
package.json

@@ -9,10 +9,10 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.22",
-    "@saga-web/big": "1.0.56",
+    "@saga-web/big": "1.0.57",
     "@saga-web/draw": "2.1.100",
     "@saga-web/feng-map": "1.0.15",
-    "@saga-web/graph": "2.1.94",
+    "@saga-web/graph": "2.1.95",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",
     "element-ui": "^2.13.2",

+ 6 - 3
src/components/baseEditer.vue

@@ -325,7 +325,10 @@ export default {
           Message.close()
           this.graphId = res.Data;
         }).catch((err)=>{
-
+         Message({
+          message: '上传失败!',
+          type: 'error'
+        });
         })
       });
       bus.$on("exportByKey", val => {
@@ -445,9 +448,9 @@ export default {
       })
       // 更改图例数据工程化数据
        bus.$on('changeAttachObjectIds', arr => {
-        this.scene.upadatAttachObjectIds(arr);
+         console.log(arr);
+         this.scene.upadatAttachObjectIds(arr);
       })
-
     },
     // 读取数据
     readGroup() {

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

@@ -126,7 +126,7 @@
           <div class="grid-content">
             <a-input-number
               v-model="imageNum"
-              :min="1"
+              :min="attrCards.length==imageNum?imageNum:1"
               @change="changeImageNum"
               style="width: 208px"
             />
@@ -243,7 +243,7 @@
 
     <div
       class="attr-select attr-select-bottom"
-      v-if="type =='Zone' || type =='Image' ||type == 'fire-Zone' ||type == 'Line'"
+      v-if="type =='Zone' || type =='Image'||type == 'Line'"
     >
       <a-spin :spinning="spinning">
       <div class="row">
@@ -252,7 +252,7 @@
       </div>
 
         <div class="grid-content">
-          <a-card class="attr-card" v-for="(item,index) in attrCards" :key="index">{{item.wzjc ||item.sbjc}}</a-card>
+          <a-card class="attr-card" v-for="(item,index) in attrCards" :key="index">{{item.sbjc ||item.wzjc}}</a-card>
         </div>
       </a-spin>
     </div>
@@ -283,7 +283,7 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
-    <editDialog ref="dialog" :typeEdit="type" :getmajorId="'1001'" :sysNum="imageNum" :key="Date.now()"/>
+    <editDialog  ref="dialog" :attrCards="attrCards" :typeEdit="type" :getmajorId="getmajorId" :sysNum="imageNum" :key="new Date().getTime()"/>
     <!--    <editDialog ref="dialog" :typeEdit="2" :getmajorId="'1001'" :sysNum="5" />-->
   </div>
 </template>
@@ -372,7 +372,8 @@ export default {
       SubType: "", //空间类型,区分石材铺装
       itemExplain:'', //图例说明 只针对石材铺装
       attrCards:[],
-      spinning:false
+      spinning:false,
+      getmajorId:''
     };
   },
   methods: {
@@ -475,11 +476,14 @@ export default {
   },
   watch: {
     focusItemList: function(newval) {
-      console.log(newval);
       const Item = newval.itemList[0];
+      this.getmajorId = Item.data.Properties.GraphCategoryId;
       if (Item.data && Item.data.SubType) {
         this.SubType = Item.data.SubType;
+      }else{
+         this.SubType = '';
       }
+       console.log('this.SubType',this.SubType);
       if (newval.itemList.length == 1) {
         if (newval.itemType == "baseText") {
           this.textMsg = Item.text;
@@ -513,25 +517,36 @@ export default {
         }
       }
       let  location =[];
+      let  params ={};
       Item.data.AttachObjectIds.map(item=>{
         location.push(item.id)
       })
      if(newval.itemType == 'Zone'){
        this.spinning = true;
-       queryGlsmsLocation({plazaId: '1000423'},{location:location}).then(res=>{
+       if(location.length){
+         params = {locationList:location}
+       }else{
+         params = {locationList:['']};
+       }
+       queryGlsmsLocation({plazaId: '1000423'},params).then(res=>{
          this.spinning = false;
          if(res.data.result =='success'){
-           this.attrCards = res.data.data;
+           this.attrCards = res.data.data||[];
          }else{
            this.$message.error('工程信息化中的位置信息获取失败')
          }
        })
      }else if(newval.itemType == 'Image'){
        this.spinning = true;
-       queryGlsmsAsset({plazaId: '1000423'},{assetnum:location}).then(res=>{
+       if(location.length){
+         params = {assetnumList:location}
+       }else{
+         params = {assetnumList:['']};
+       }
+       queryGlsmsAsset({plazaId: '1000423'},params).then(res=>{
          this.spinning = false;
          if(res.data.result =='success'){
-           this.attrCards = res.data.data;
+           this.attrCards = res.data.data||[];
          }else{
            this.$message.error('工程信息化中的设备信息获取失败')
          }

+ 56 - 38
src/components/edit/edit-dialog.vue

@@ -1,5 +1,5 @@
 <template>
-  <a-modal v-model="visible"  title="选择编辑" on-ok="handleOk" width="1200px" class="edit-dialog">
+  <a-modal v-model="visible"  title="选择编辑"  width="1200px" class="edit-dialog" >
     <template slot="footer">
       <a-button key="back" @click="handleCancel">
         取消
@@ -41,18 +41,18 @@
           <searchTree  @getTreeId="getTreeId" :treeData="treeData"/>
         </div>
         <div class="checkbox">
-          <a-table :pagination="false" row-key='location||assetnum' :columns="typeEdit=='Image'?columnsSys:columnsLocal" :data-source="tableData"  :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }" :scroll="{ y: 340 }"  :loading="loading"/>
+          <a-table :pagination="false" :row-key='typeEdit=="Zone"?"location":"assetnum"' :columns="typeEdit=='Image'?columnsSys:columnsLocal" :data-source="tableData"  :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }" :scroll="{ y: 340 }"  :loading="loading"/>
           <a-pagination v-if="total>0" v-model="page" :total="total" show-less-items style="margin-left: auto;"  @change="handleTableChange"/>
         </div>
       </div>
       <div class="right">
         <div class="header">
-          <span class="select-number">已选择 <b>{{selectList.length}}</b>/{{sysNum}}</span>
-          <a-button type="link" class="link" @click="clearSelectList">清空</a-button>
+          <span class="select-number">已选择 <b>{{arrList.length}}</b>/{{sysNum}}</span>
+          <a-button type="link" class="link" @click="clearArrList">清空</a-button>
         </div>
 
         <div class="list-box">
-          <p v-for="(item,index) in selectList" :key="index" class="list">{{item.sbjc||item.wzjc}}
+          <p v-for="(item,index) in arrList" :key="index" class="list">{{item.sbjc||item.wzjc}}
             <a-icon type="close" class="icon" @click="deleteItem(item,index)"/>
           </p>
         </div>
@@ -65,13 +65,15 @@
 <script>
     import searchTree from "@/components/edit/search_tree";
     import {queryGlsmsasset ,getQuerySmsxt,getPlazaFloor,getQuerySmsxtBy,queryWzfldl,queryWzflByDl,queryGlsmsLocation} from "@/api/editer";
+    import bus from "@/bus";
     export default {
         name: "edit-dialog",
         components: {searchTree},
       props:{
         typeEdit:String , //用于区分是设备 还是  位置
         getmajorId:String, //专业Id
-        sysNum:Number //设备总数
+        sysNum:Number ,//设备总数
+        attrCards:Array
       },
         data() {
             return {
@@ -81,7 +83,6 @@
                 searchName: '',
                 floorId:"",//所属楼层
                 dataFloor: [],
-                selectList: [],
                 plainOptions: ['福建三明万达-供电系统-6楼-工程信息化中的区域编码ND182472e83742', '福建三明万达-供电系统-6楼-工程信息化中的区域编码ND18247283742'],
                 majorList: [],
                 checkedList: [],
@@ -122,15 +123,16 @@
               loading:false,
               page:1,
               size:10,
-              selectedRowKeys:[],
               treeData:[],
-              total:0
+              total:0,
+              selectedRowKeys :[],
+              arrList:[]
             }
         },
         computed:{
           majorId(){
-            return  this.getmajorId||''
-          }
+            return this.typeEdit=='Zone'?'位置区域': this.getmajorId
+          },
         },
       watch:{
         floorId(val){
@@ -149,10 +151,13 @@
                     this.visible = false;
                     this.loading = false;
                     let lists = [];
-                    this.selectList.map(item =>{
+                    let arr = [];
+                    arr = JSON.parse(JSON.stringify( this.arrList))
+                  arr.map(item =>{
                       lists.push({id:item.location||item.assetnum,name:item.wzjc||item.sbjc})
                     })
-                  console.log(lists);
+                    bus.$emit('changeAttachObjectIds',lists)
+
                 }, 3000);
             },
             handleCancel(e) {
@@ -239,45 +244,52 @@
             this.queryGlsmsasset();
           },
           onSelect(record, selected, selectedRows, nativeEvent){
-            if(!selected  && this.selectList.length>0){
-              this.selectList.map((item,index)=>{
-                if( item.id == record.id){
-                  this.selectList.splice(index,1);
+            if(!selected  && this.arrList.length>0){
+              this.arrList.map((item,index)=>{
+                if(this.typeEdit=='Zone'&& item.location == record.location ){
+                  this.arrList.splice(index,1);
+                }else if(this.typeEdit=='Image'&& item.assetnum == record.assetnum ){
+                  this.arrList.splice(index,1);
                 }
               })
             }
           },
           // 中间表格勾选
           onSelectChange(selectedRowKeys,selectedRows) {
-            console.log(selectedRows);
             this.selectedRowKeys = selectedRowKeys;
               if(this.selectedRowKeys.length>this.sysNum){
                 this.selectedRowKeys.pop();
                 this.$message.error('不能超过设备数')
                 return false;
               }
-            selectedRows.map(item=>{
-              this.selectList.push(item)
-            })
-            // let obj = {}
-            //
-            // this.selectList = this.selectList.reduce (function(item,next){
-            //
-            //   obj[next.id] ? ' ' : obj[next.id]  = true && item.push(next)
-            //
-            //   return item;
-            //
-            // },[])
+            this.arrList = [...this.arrList,...selectedRows]
+            let obj = {}
+            if(this.typeEdit=='Zone'){
+              this.arrList = this.arrList.reduce (function(item,next){
+                obj[next.location] ? ' ' : obj[next.location]  = true && item.push(next)
+
+                return item;
+
+              },[])
+            }else{
+              this.arrList = this.arrList.reduce (function(item,next){
+                obj[next.assetnum] ? ' ' : obj[next.assetnum]  = true && item.push(next)
+
+                return item;
+
+              },[])
+            }
+
           },
           //右侧删除
           deleteItem(item,index){
-            this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(item.id),1);
-            this.selectList.splice(index,1);
+            this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(item.location||item.assetnum),1);
+            this.arrList.splice(index,1);
           },
           //右侧清空
-          clearSelectList(){
+          clearArrList(){
             this.selectedRowKeys = [];
-            this.selectList = [];
+            this.arrList = [];
           },
           //获取楼层
           getPlazaFloor(){
@@ -380,14 +392,20 @@
 
           }
         },
-        mounted() {
+        created() {
+          if(this.attrCards.length){
+            this.attrCards.map(item=>{
+              this.selectedRowKeys.push(item.location||item.assetnum)
+            })
+            this.arrList = JSON.parse(JSON.stringify(this.attrCards));
+          } else{
+            this.selectedRowKeys = [];
+          }
           this.getQuerySmsxt();
           //如果有专业就带过来
           this.getQuerySmsxtBy(this.majorId)
-          console.log(this.typeEdit);
-
-
           this.getPlazaFloor();
+
         }
     }
 </script>

+ 8 - 9
src/components/edit/top_toolbar.vue

@@ -190,7 +190,7 @@ export default {
       bus.$emit('changeScale', this.scale / oldScale)
     },
     FocusItemChanged(itemMsg) {
-      this.focusItem = null; 
+      this.focusItem = null;
       this.alignmentOptions.forEach(el=>{
             el.disable = true
         })
@@ -217,14 +217,13 @@ export default {
     },
     // 删除item
     deleteItem() {
-      console.log(this.focusItem);
-      if (this.focusItem) {
-        bus.$emit("deleiteItem");
-        // this.focusItem = null;
-        this.$message.success("删除成功", 1);
-      } else {
-        this.$message.error("请选择指定对象!", 1);
-      }
+      bus.$emit("deleiteItem");
+      // if (this.focusItem) {
+      //   bus.$emit("deleiteItem");
+      //   this.$message.success("删除成功", 1);
+      // } else {
+      //   this.$message.error("请选择指定对象!", 1);
+      // }
     },
     // 发布图例
     publishMap(){

+ 95 - 18
src/components/mapClass/EditScence.ts

@@ -60,13 +60,21 @@ export class EditScence extends SGraphScene {
 
     /** 当前选中焦点Item */
     focusItem: SGraphItem | null = null;
-
+    /** 当前选中焦点ItemList */
+    focusItemList:SGraphItem[] | null = null;
     /**图例节点 */
     Nodes: any = [];  // 图例节点,所有与工程信息化相关的图例(图标类型与区域)
     /**图例节点 */  // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
     Markers: any = [];
     /**  管线对象 */
     Relations: any = [];
+    _isEditStatus: Boolean = true; // 是否可编辑
+    set isEditStatus(bol: Boolean): void {
+        this._isEditStatus = bol;
+    }
+    get isEditStatus(): Boolean {
+        return this._isEditStatus
+    }
     constructor() {
         super();
         // // 选择绑定选额item事件
@@ -96,7 +104,7 @@ export class EditScence extends SGraphScene {
      */
     listChange(obj: any) {
         let itemType: string = 'equipment';
-
+        this.focusItemList = obj.itemList;
         if (obj.itemList[0] instanceof STextMarkerItem) {
             itemType = 'baseText'
         } else if (obj.itemList[0] instanceof SImageMarkerItem) {
@@ -122,6 +130,8 @@ export class EditScence extends SGraphScene {
         if (obj.itemList.length == 1) {
             // 获取聚焦item
             this.focusItem = obj.itemList[0]
+        }else{
+            this.focusItem = null
         }
         let msg = {
             itemList: obj.itemList,
@@ -237,7 +247,7 @@ export class EditScence extends SGraphScene {
         // 起始锚点
         item.startAnchor = anc;
         if (anc) {
-            anc.parent?.connect('changePos', item, item.changePos)
+            anc.parent ?.connect('changePos', item, item.changePos)
             item.anchor1ID = anc.id;
             item.node1Id = anc.parent.id;
         }
@@ -418,7 +428,7 @@ export class EditScence extends SGraphScene {
      * 增加图标lenged图标
      */
     addIconItem(event: SMouseEvent): void {
-           //获取信息工程化相关参数
+        //获取信息工程化相关参数
         const LegendData: Legend = {
             ID: uuid(),
             Name: this._legend.Name,
@@ -439,6 +449,7 @@ export class EditScence extends SGraphScene {
                 sHeight: 24,   //icon 的高
                 font: 12,    //font
                 color: '',  //字体颜色
+                GraphCategoryId: this._legend.GraphCategoryId
             },
         }
         const item = new SImageLegendItem(null, LegendData);
@@ -658,11 +669,12 @@ export class EditScence extends SGraphScene {
         }
     }
 
-   /**
-    * 更新工程信息化的相关数据
-    * @param AttachObjectIds Array
-    */
+    /**
+     * 更新工程信息化的相关数据
+     * @param AttachObjectIds Array
+     */
     upadatAttachObjectIds(AttachObjectIds: []): void {
+        console.log('AttachObjectIds',AttachObjectIds)
         if (this.focusItem) {
             this.focusItem.data.AttachObjectIds = AttachObjectIds;
         }
@@ -715,6 +727,46 @@ export class EditScence extends SGraphScene {
                 }
                 this.scenceUpdate(this);
             }
+        }else{
+            //批量删除
+            if(!this.focusItemList){
+                return
+            }
+            this.focusItemList.forEach((focusItem)=>{
+                this.removeItem(focusItem);
+                let a = -1
+                this.Nodes.forEach((item: any, index: number) => {
+                    if (item.id == focusItem.id) {
+                        a = index
+                    }
+                });
+                if (a > -1) {
+                    this.Nodes.splice(a, 1);
+                }
+                let b = -1;
+                this.Markers.forEach((item: any, index: number) => {
+                    if (item.id == focusItem.id) {
+                        b = index
+                    }
+                });
+                if (b > -1) {
+                    this.Markers.splice(b, 1);
+                }
+                let c = -1;
+                this.Relations.forEach((item: any, index: number) => {
+                    if (item.id == focusItem.id) {
+                        c = index
+                    }
+                });
+                if (c > -1) {
+                    this.Relations.splice(c, 1);
+                }
+            });
+            this.focusItemList = [];
+            if (this.view) {
+                this.view.update();
+            }
+            this.scenceUpdate(this);
         }
     }
     scenceUpdate(scence: any) { }
@@ -785,6 +837,9 @@ export class EditScence extends SGraphScene {
     ////////////////////////
     //  以下为鼠标键盘操作事件
     onMouseDown(event: SMouseEvent): any {
+        if (!this.isEditStatus) {
+            return super.onMouseDown(event);
+        }
         // 判断是否开启吸附,并且有吸附的点
         if (
             this.isAbsorbing &&
@@ -834,6 +889,9 @@ export class EditScence extends SGraphScene {
     }
 
     onMouseMove(event: SMouseEvent): boolean {
+        if (!this.isEditStatus) {
+            return super.onMouseMove(event);
+        }
         if (this.isAbsorbing) {
             if (!this.highLight) {
                 this.highLight = new HighlightItem(null);
@@ -863,16 +921,19 @@ export class EditScence extends SGraphScene {
      * @return	boolean
      */
     onKeyDown(event: KeyboardEvent): any {
+        if (!this.isEditStatus) {
+            return super.onKeyDown(event);
+        }
         if (this.grabItem) {
             this.grabItem.onKeyDown(event);
-            console.log('event',event)
-            if(event.code == "Escape"){
-               const item = this.grabItem;
-               this.grabItem = null
-               this.removeItem(item);
-               if(this.view){
-                   this.view.update()
-               }
+            if (event.code == "Escape") {
+                const item = this.grabItem;
+                this.grabItem = null
+                this.removeItem(item);
+                if (this.view) {
+                    this.view.update()
+                }
+                this.setCmd = 'choice'
             }
         }
         // if (event.key == "Enter") {
@@ -881,6 +942,22 @@ export class EditScence extends SGraphScene {
         return false
     }
 
+
+    /**
+     * 鼠标双击事件
+     *
+     * @param	event         事件参数
+     * @return	boolean
+     */
+    onDoubleClick(event: SMouseEvent): boolean {
+        if (!this.isEditStatus) {
+            return true
+        }else{
+           return super.onDoubleClick(event);
+        }
+
+    } // Function onDoubleClick()
+
     /**
      * 设置管线结束锚点
      *
@@ -896,7 +973,7 @@ export class EditScence extends SGraphScene {
                     event.y = p.y;
                     if (this.grabItem.pointList.length) {
                         this.grabItem.endAnchor = anc;
-                        anc.parent?.connect('changePos', this.grabItem, this.grabItem.changePos)
+                        anc.parent ?.connect('changePos', this.grabItem, this.grabItem.changePos)
                     }
                     this.grabItem.anchor2ID = anc.id
                     this.grabItem.node2Id = anc.parent.id
@@ -1050,7 +1127,7 @@ export class EditScence extends SGraphScene {
         let itemList = this.Nodes.concat(this.Markers);
         itemList.forEach(item => {
             if (
-                item instanceof STextMarkerItem || 
+                item instanceof STextMarkerItem ||
                 item instanceof SImageMarkerItem ||
                 item instanceof SZoneLegendItem ||
                 item instanceof SFHFQZoneLegendItem ||

+ 2 - 1
src/views/drafts.vue

@@ -221,7 +221,8 @@ export default {
       queryStatistic({
         projectId: this.projectId,
         flag: true,
-        graphId: this.graphId
+        graphId: this.graphId,
+        pub:false
       }).then(res => {
         console.log(res);
         this.legendLoading = false;