From 91020f7b604eddc03d9b30d9a854918d5ddb88aa Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期一, 25 四月 2022 10:26:53 +0800 Subject: [PATCH] 修改代码生成树选择组件 --- src/main/resources/vm/vue/v3/index-tree.vue.vm | 40 +++++++++++++++++++++++++++++++--------- 1 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/resources/vm/vue/v3/index-tree.vue.vm b/src/main/resources/vm/vue/v3/index-tree.vue.vm index 0a0f90d..237d899 100644 --- a/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ b/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) @@ -165,11 +174,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") @@ -283,6 +294,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)}) @@ -343,8 +356,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}"); @@ -393,9 +406,9 @@ } /** 鏂板鎸夐挳鎿嶄綔 */ -async function handleAdd(row) { +function handleAdd(row) { reset(); - await getTreeselect(); + getTreeselect(); if (row != null && row.${treeCode}) { form.value.${treeParentCode} = row.${treeCode}; } else { @@ -405,6 +418,15 @@ title.value = "娣诲姞${functionName}"; } +/** 灞曞紑/鎶樺彔鎿嶄綔 */ +function toggleExpandAll() { + refreshTable.value = false; + isExpandAll.value = !isExpandAll.value; + nextTick(() => { + refreshTable.value = true; + }); +} + /** 淇敼鎸夐挳鎿嶄綔 */ async function handleUpdate(row) { reset(); -- Gitblit v1.9.3