From ab4b75fe30f9a3cf08e3ced667c3ec8c711ca939 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 06 九月 2021 09:59:28 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

---
 ruoyi-ui/src/views/system/dept/index.vue |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue
index edb8d7c..037c998 100644
--- a/ruoyi-ui/src/views/system/dept/index.vue
+++ b/ruoyi-ui/src/views/system/dept/index.vue
@@ -37,14 +37,24 @@
           v-hasPermi="['system:dept:add']"
         >鏂板</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="info"
+          plain
+          icon="el-icon-sort"
+          size="mini"
+          @click="toggleExpandAll"
+        >灞曞紑/鎶樺彔</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table
+      v-if="refreshTable"
       v-loading="loading"
       :data="deptList"
       row-key="deptId"
-      default-expand-all
+      :default-expand-all="isExpandAll"
       :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
     >
       <el-table-column prop="deptName" label="閮ㄩ棬鍚嶇О" width="260"></el-table-column>
@@ -164,6 +174,12 @@
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
+      // 鏄惁灞曞紑锛岄粯璁ゅ叏閮ㄥ睍寮�
+      isExpandAll: true,
+      // 閲嶆柊娓叉煋琛ㄦ牸鐘舵��
+      refreshTable: true,
+      // 鏄惁灞曞紑
+      expand: false,
       // 鐘舵�佹暟鎹瓧鍏�
       statusOptions: [],
       // 鏌ヨ鍙傛暟
@@ -267,6 +283,14 @@
 	        this.deptOptions = this.handleTree(response.data, "deptId");
       });
     },
+    /** 灞曞紑/鎶樺彔鎿嶄綔 */
+    toggleExpandAll() {
+      this.refreshTable = false;
+      this.isExpandAll = !this.isExpandAll;
+      this.$nextTick(() => {
+        this.refreshTable = true;
+      });
+    },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
       this.reset();

--
Gitblit v1.9.3