From 06cda3fb18a3241deff404f6948b02cc0d9a75a5 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 07 十二月 2022 19:13:58 +0800 Subject: [PATCH] update 优化 使用 spring 事件机制 重构 OssConfig 缓存更新 --- ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm | 62 +++++++++++++++++------------- 1 files changed, 35 insertions(+), 27 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm index 629b931..01a7367 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -76,14 +76,23 @@ v-hasPermi="['${moduleName}:${businessName}:add']" >鏂板</el-button> </el-col> + <el-col :span="1.5"> + <el-button + type="info" + plain + icon="Sort" + @click="toggleExpandAll" + >灞曞紑/鎶樺彔</el-button> + </el-col> <right-toolbar v-model:showSearch="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) @@ -127,24 +136,9 @@ #end <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template #default="scope"> - <el-button - type="text" - icon="Edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >淇敼</el-button> - <el-button - type="text" - icon="Plus" - @click="handleAdd(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:add']" - >鏂板</el-button> - <el-button - type="text" - icon="Delete" - @click="handleDelete(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >鍒犻櫎</el-button> + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">淇敼</el-button> + <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">鏂板</el-button> + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">鍒犻櫎</el-button> </template> </el-table-column> </el-table> @@ -164,11 +158,13 @@ #set($dictType=$column.dictType) #if("" != $treeParentCode && $column.javaField == $treeParentCode) <el-form-item label="${comment}" prop="${treeParentCode}"> - <tree-select - v-model:value="form.${treeParentCode}" - :options="${businessName}Options" - :objMap="{ value: '${treeCode}', label: '${treeName}', children: 'children' }" + <el-tree-select + v-model="form.${treeParentCode}" + :data="${businessName}Options" + :props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }" + value-key="${treeCode}" placeholder="璇烽�夋嫨${comment}" + check-strictly /> </el-form-item> #elseif($column.htmlType == "input") @@ -282,6 +278,8 @@ const loading = ref(true); const showSearch = ref(true); const title = ref(""); +const isExpandAll = ref(true); +const refreshTable = ref(true); #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) @@ -342,8 +340,8 @@ } /** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */ -async function getTreeselect() { - await list${BusinessName}().then(response => { +function getTreeselect() { + list${BusinessName}().then(response => { ${businessName}Options.value = []; const data = { ${treeCode}: 0, ${treeName}: '椤剁骇鑺傜偣', children: [] }; data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); @@ -392,9 +390,9 @@ } /** 鏂板鎸夐挳鎿嶄綔 */ -async function handleAdd(row) { +function handleAdd(row) { reset(); - await getTreeselect(); + getTreeselect(); if (row != null && row.${treeCode}) { form.value.${treeParentCode} = row.${treeCode}; } else { @@ -402,6 +400,15 @@ } open.value = true; title.value = "娣诲姞${functionName}"; +} + +/** 灞曞紑/鎶樺彔鎿嶄綔 */ +function toggleExpandAll() { + refreshTable.value = false; + isExpandAll.value = !isExpandAll.value; + nextTick(() => { + refreshTable.value = true; + }); } /** 淇敼鎸夐挳鎿嶄綔 */ @@ -465,6 +472,7 @@ loading.value = false; getList(); proxy.#[[$modal]]#.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => { }).finally(() => { loading.value = false; }); -- Gitblit v1.9.3