From 2448dc73f7325ae3c07c5777921cbda806ff8894 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期五, 13 八月 2021 14:48:12 +0800 Subject: [PATCH] 代码生成主子表多选行数据 --- src/main/resources/vm/vue/index-tree.vue.vm | 63 +++++++++++-------------------- 1 files changed, 22 insertions(+), 41 deletions(-) diff --git a/src/main/resources/vm/vue/index-tree.vue.vm b/src/main/resources/vm/vue/index-tree.vue.vm index 501de87..f7105cb 100644 --- a/src/main/resources/vm/vue/index-tree.vue.vm +++ b/src/main/resources/vm/vue/index-tree.vue.vm @@ -73,7 +73,7 @@ <el-col :span="1.5"> <el-button type="primary" - plain + plain icon="el-icon-plus" size="mini" @click="handleAdd" @@ -108,7 +108,11 @@ #elseif($column.list && "" != $column.dictType) <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> #elseif($column.list && "" != $javaField) +#if(${foreach.index} == 1) + <el-table-column label="${comment}" prop="${javaField}" /> +#else <el-table-column label="${comment}" align="center" prop="${javaField}" /> +#end #end #end <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> @@ -120,6 +124,13 @@ @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']" >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-plus" + @click="handleAdd(scope.row)" + v-hasPermi="['${moduleName}:${businessName}:add']" + >鏂板</el-button> <el-button size="mini" type="text" @@ -247,45 +258,10 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "imageUpload") -import ImageUpload from '@/components/ImageUpload'; -#break -#end -#end -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload") -import FileUpload from '@/components/FileUpload'; -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor") -import Editor from '@/components/Editor'; -#break -#end -#end export default { name: "${BusinessName}", components: { -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "imageUpload") - ImageUpload, -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload") - FileUpload, -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "editor") - Editor, -#break -#end -#end Treeselect }, data() { @@ -393,7 +369,7 @@ children: node.children }; }, - /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */ + /** 鏌ヨ${functionName}涓嬫媺鏍戠粨鏋� */ getTreeselect() { list${BusinessName}().then(response => { this.${businessName}Options = []; @@ -455,16 +431,21 @@ this.handleQuery(); }, /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { + handleAdd(row) { this.reset(); - this.getTreeselect(); + this.getTreeselect(); + if (row != null && row.${treeCode}) { + this.form.${treeParentCode} = row.${treeCode}; + } else { + this.form.${treeParentCode} = 0; + } this.open = true; this.title = "娣诲姞${functionName}"; }, /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { this.reset(); - this.getTreeselect(); + this.getTreeselect(); if (row != null) { this.form.${treeParentCode} = row.${treeCode}; } @@ -515,7 +496,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); } } }; -- Gitblit v1.9.3