Sfoglia il codice sorgente

更新弹窗的联动

xiebeibei 4 anni fa
parent
commit
244fbddb03

+ 2 - 2
src/components/baseEditer.vue

@@ -434,9 +434,9 @@ export default {
       })
       // 更改图例数据工程化数据
        bus.$on('changeAttachObjectIds', arr => {
-        this.scene.upadatAttachObjectIds(arr);
+         console.log(arr);
+         this.scene.upadatAttachObjectIds(arr);
       })
-
     },
     // 读取数据
     readGroup() {

+ 22 - 9
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"
             />
@@ -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: {
@@ -476,6 +477,7 @@ export default {
   watch: {
     focusItemList: function(newval) {
       const Item = newval.itemList[0];
+      this.getmajorId = Item.data.Properties.GraphCategoryId;
       if (Item.data && Item.data.SubType) {
         this.SubType = Item.data.SubType;
       }else{
@@ -514,26 +516,37 @@ export default {
           }
         }
       }
-      const  location =[];
+      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>

+ 1 - 0
src/components/mapClass/EditScence.ts

@@ -668,6 +668,7 @@ export class EditScence extends SGraphScene {
      * @param AttachObjectIds Array
      */
     upadatAttachObjectIds(AttachObjectIds: []): void {
+        console.log('AttachObjectIds',AttachObjectIds)
         if (this.focusItem) {
             this.focusItem.data.AttachObjectIds = AttachObjectIds;
         }

+ 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;