Sfoglia il codice sorgente

更新左侧树的接口

xiebeibei 4 anni fa
parent
commit
b5924bab3f

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

@@ -283,8 +283,8 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
-    <editDialog ref="dialog" :typeEdit="1" :getmajorId="'1001'" :sysNum="5" />
-    <!--    <editDialog ref="dialog" :typeEdit="2" :getmajorId="'设备间'" :sysNum="5" />-->
+    <editDialog ref="dialog" :typeEdit="type" :getmajorId="'1001'" :sysNum="imageNum" :key="Date.now()"/>
+    <!--    <editDialog ref="dialog" :typeEdit="2" :getmajorId="'1001'" :sysNum="5" />-->
   </div>
 </template>
 
@@ -471,6 +471,7 @@ export default {
   },
   watch: {
     focusItemList: function(newval) {
+      console.log(newval);
       const Item = newval.itemList[0];
       if (Item.data && Item.data.SubType) {
         this.SubType = Item.data.SubType;

+ 14 - 13
src/components/edit/edit-dialog.vue

@@ -41,7 +41,7 @@
           <searchTree  @getTreeId="getTreeId" :treeData="treeData"/>
         </div>
         <div class="checkbox">
-          <a-table :pagination="false" row-key='id' :columns="typeEdit==1?columnsSys:columnsLocal" :data-source="tableData"  :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }" :scroll="{ y: 340 }"  :loading="loading"/>
+          <a-table :pagination="false" row-key='id' :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>
@@ -69,7 +69,7 @@
         name: "edit-dialog",
         components: {searchTree},
       props:{
-        typeEdit:Number , //用于区分是设备 还是  位置
+        typeEdit:String , //用于区分是设备 还是  位置
         getmajorId:String, //专业Id
         sysNum:Number //设备总数
       },
@@ -172,9 +172,9 @@
             },
             //获取treeId --classstructureid
             getTreeId(id) {
-              if(this.typeEdit==1){
+              if(this.typeEdit=='Image'){
                 this.classstructureid = id;
-              }else if(this.typeEdit==2){
+              }else if(this.typeEdit=='Zone'){
                 this.locfl = id;
               }
 
@@ -188,12 +188,12 @@
               size: this.size,//条数
             }
             if( this.keyword){
-              data.keyword = this.typeEdit==1? `${this.keyword}:brand`:`${this.keyword}:wzjc`
+              data.keyword = this.typeEdit=='Image'? `${this.keyword}:brand`:`${this.keyword}:wzjc`
             }
             let paramData =  {classstructureid: this.classstructureid,gname:this.floorId};
             let paramDataLocal =  {locfl: this.locfl,gname:this.floorId};
             this.loading = true;
-            if(this.typeEdit==1){
+            if(this.typeEdit=='Image'){
               queryGlsmsasset(data,paramData).then(res => {
                 this.loading = false;
                 if(res.data.result == 'success'){
@@ -212,7 +212,7 @@
                   this.$message.error('数据请求失败')
                 }
               })
-            }else if(this.typeEdit==2){
+            }else if(this.typeEdit=='Zone'){
               queryGlsmsLocation(data,paramDataLocal).then(res => {
                 this.loading = false;
                 if(res.data.result == 'success'){
@@ -291,7 +291,7 @@
           },
           //获取设备大类和位置大类
           getQuerySmsxt(){
-              if (this.typeEdit==1){
+              if (this.typeEdit=='Image'){
                 getQuerySmsxt({}).then(res =>{
                   if(res.result == 'success'){
                     if(res.data){
@@ -304,8 +304,9 @@
                     }
                   }
                 })
-              }else if(this.typeEdit ==2){
-              queryWzfldl({}).then(res =>{
+              }else if(this.typeEdit =='Zone'){
+
+                queryWzfldl({}).then(res =>{
                 if(res.result == 'success'){
                   if(res.data){
                     let data = res.data;
@@ -322,7 +323,7 @@
           },
          // 获取设备大类下的分类和位置大类下的分类
           getQuerySmsxtBy(smsxt){
-              if(this.typeEdit==1){
+              if(this.typeEdit=='Image'){
               let data = {
                 smsxt:smsxt
               }
@@ -347,7 +348,7 @@
                   this.$message.error('获取失败');
                 }
               })
-            }else if(this.typeEdit==2){
+            }else if(this.typeEdit=='Zone'){
                 let data = {
                   dl:smsxt
                 }
@@ -378,7 +379,7 @@
           this.getQuerySmsxt();
           //如果有专业就带过来
           this.getQuerySmsxtBy(this.majorId)
-
+          console.log(this.typeEdit);
 
 
           this.getPlazaFloor();

+ 17 - 3
src/components/edit/left_toolbar.vue

@@ -58,7 +58,7 @@
 
     <a-popover trigger="click" placement="rightBottom" v-model="drawerVisible" >
       <template slot="content" >
-        <itemTree @getSelectId="getSelectId" :drawerVisible="drawerVisible" :categoryIdS="categoryIdS"  :categoryId="categoryId"></itemTree>
+        <itemTree @getSelectId="getSelectId" :drawerVisible="drawerVisible" :categoryIdS="categoryIdS"  ></itemTree>
       </template>
       <div class="bottom-item">
         <a-icon type="ellipsis" />
@@ -128,7 +128,7 @@
 </template>
 <script>
 import itemTree from "./leftbar_components/itemTree";
-import { graphElementGroup} from "@/api/editer.js";
+import {graphElementGroup} from "@/api/editer.js";
 import bus from "@/bus";
 import { queryGroup } from "@/api/editer.js";
 import { mapState, mapActions } from "vuex";
@@ -312,16 +312,30 @@ export default {
         }
         // 打开侧边框
         // 接口请求
+        this.itemList = [];
         this.spinning = true;
+        const data = {
+          GraphCategoryIds: this.categoryId,
+          Type: item.type
+        };
+
+        queryGroup(data).then(res=>{
+          this.itemList = res.Data;
+        });
         const arr = {
           InfoSystems: this.categoryIdS,
           Type: item.type
         };
+
         graphElementGroup(arr).then(res => {
           this.spinning = false;
-          this.itemList = res.Data;
+          res.Data.map(item=>{
+            this.itemList.push(item);
+          })
+
         });
       }
+      console.log(this.itemList);
     },
     getSelectId(data){
       this.categoryIdS=data;

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

@@ -33,7 +33,7 @@ export default {
     return {
       expandedKeys: ["", ""],
       autoExpandParent: true,
-      checkedKeys: ["1-1"],
+      checkedKeys: [],
       selectedKeys: [],
       treeData,
       spinning:false
@@ -41,7 +41,7 @@ export default {
   },
   props:{
     categoryIdS:Array,
-    categoryId:String,
+    // categoryId:String,
     drawerVisible:Boolean
   },
   watch: {
@@ -114,7 +114,8 @@ export default {
       if(data == 'cancel'){
         this.checkedKeys = this.categoryIdS;
       }else if(data == 'rest'){
-        this.checkedKeys = [this.categoryId];
+        // this.checkedKeys = [this.categoryId];
+        this.checkedKeys = [];
       }else{
         this.checkedKeys =data;
       }