From d910888181365139684deae21382526d21e84da1 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期四, 07 四月 2022 10:56:40 +0800 Subject: [PATCH] 代码生成树表新增(展开/折叠) --- ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index a95916f..9d29ace 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -78,14 +78,24 @@ v-hasPermi="['${moduleName}:${businessName}: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="${businessName}List" row-key="${treeCode}" - default-expand-all + :default-expand-all="isExpandAll" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" > #foreach($column in $columns) @@ -293,6 +303,10 @@ title: "", // 是否显示弹出层 open: false, + // 是否展开,默认全部展开 + isExpandAll: true, + // 重新渲染表格状态 + refreshTable: true, #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) @@ -423,6 +437,14 @@ this.open = true; this.title = "添加${functionName}"; }, + /** 展开/折叠操作 */ + toggleExpandAll() { + this.refreshTable = false; + this.isExpandAll = !this.isExpandAll; + this.$nextTick(() => { + this.refreshTable = true; + }); + }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); -- Gitblit v1.9.2