wyh 1 anno fa
parent
commit
cf48bf51ac

+ 14 - 0
src/views/module_ems/baseSpace/baseSpaceList.vue

@@ -23,6 +23,8 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+      <!-- <a-button @click="expandClose" type="primary" :icon="tableTreeStatus == 1 ? 'down-circle' : 'up-circle'">{{tableTreeStatus == 1 ? '一键展开':'一键折叠'}}</a-button> -->
+      <a-button @click="expandClose" type="primary">{{tableTreeStatus == 1 ? '一键展开':'一键折叠'}}</a-button>
       <!-- <a-button type="primary" icon="download" @click="handleExportXls('空间管理')">导出</a-button>
       <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
@@ -192,6 +194,8 @@
         dictOptions: {},
         loadParent: false,
         superFieldList:[],
+        // 展开/折叠
+        tableTreeStatus: 1,
       }
     },
     created() {
@@ -400,6 +404,16 @@
         fieldList.push({type:'int',value:'aircondarea',text:'空调面积',dictCode:''})
         fieldList.push({type:'int',value:'heatarea',text:'采暖面积',dictCode:''})
         this.superFieldList = fieldList
+      },
+      expandClose(){
+        this.tableTreeStatus = - this.tableTreeStatus
+        if (this.tableTreeStatus == 1) {
+          this.expandedRowKeys = []
+        } else {
+          this.expandedRowKeys = this.dataSource.map(item =>{
+            return item.id
+          })
+        }
       }
     }
   }

+ 13 - 0
src/views/module_ems/tpmEquipmentTree/TpmEquipmentTreeList.vue

@@ -33,6 +33,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+      <a-button @click="expandClose" type="primary">{{tableTreeStatus == 1 ? '一键展开':'一键折叠'}}</a-button>
       <!-- <a-button type="primary" icon="download" @click="handleExportXls('设备树定义')">导出</a-button>
       <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
@@ -161,6 +162,8 @@
         dictOptions: {},
         loadParent: false,
         superFieldList:[],
+        // 展开/折叠
+        tableTreeStatus: 1,
       }
     },
     created() {
@@ -361,6 +364,16 @@
         fieldList.push({type:'string',value:'name',text:'设备分类名称',dictCode:''})
         fieldList.push({type:'string',value:'parentid',text:'上级ID',dictCode:"ems_tpm_equipment_tree,name,id"})
         this.superFieldList = fieldList
+      },
+      expandClose(){
+        this.tableTreeStatus = - this.tableTreeStatus
+        if (this.tableTreeStatus == 1) {
+          this.expandedRowKeys = []
+        } else {
+          this.expandedRowKeys = this.dataSource.map(item =>{
+            return item.id
+          })
+        }
       }
     }
   }