change - 代码生成显示隐藏列

master
yinq 1 year ago
parent 52ce78c311
commit a46bc9e7e8

@ -83,6 +83,8 @@ public class ${ClassName}Controller extends BaseController {
@Log(title = "${functionName}" , businessType = BusinessType.INSERT) @Log(title = "${functionName}" , businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ${ClassName} ${className}) { public AjaxResult add(@RequestBody ${ClassName} ${className}) {
${className}.setCreatedBy(getUsername());
${className}.setCreatedTime(DateUtils.getNowDate());
return toAjax(${className}Service.insert${ClassName}(${className})); return toAjax(${className}Service.insert${ClassName}(${className}));
} }
@ -93,6 +95,8 @@ public class ${ClassName}Controller extends BaseController {
@Log(title = "${functionName}" , businessType = BusinessType.UPDATE) @Log(title = "${functionName}" , businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ${ClassName} ${className}) { public AjaxResult edit(@RequestBody ${ClassName} ${className}) {
${className}.setUpdatedBy(getUsername());
${className}.setUpdatedTime(DateUtils.getNowDate());
return toAjax(${className}Service.update${ClassName}(${className})); return toAjax(${className}Service.update${ClassName}(${className}));
} }

@ -110,7 +110,7 @@
v-hasPermi="['${moduleName}:${businessName}:export']" v-hasPermi="['${moduleName}:${businessName}:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
@ -124,21 +124,21 @@
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($column.pk) #if($column.pk)
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="columns[${foreach.index}].visible"/>
#elseif($column.list && $column.htmlType == "datetime") #elseif($column.list && $column.htmlType == "datetime")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> <el-table-column label="${comment}" align="center" prop="${javaField}" width="180" v-if="columns[${foreach.index}].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
#elseif($column.list && $column.htmlType == "imageUpload") #elseif($column.list && $column.htmlType == "imageUpload")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> <el-table-column label="${comment}" align="center" prop="${javaField}" width="100" v-if="columns[${foreach.index}].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
</template> </template>
</el-table-column> </el-table-column>
#elseif($column.list && "" != $column.dictType) #elseif($column.list && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}"> <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="columns[${foreach.index}].visible">
<template slot-scope="scope"> <template slot-scope="scope">
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
@ -148,7 +148,7 @@
</template> </template>
</el-table-column> </el-table-column>
#elseif($column.list && "" != $javaField) #elseif($column.list && "" != $javaField)
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="columns[${foreach.index}].visible"/>
#end #end
#end #end
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -422,7 +422,18 @@ export default {
]#if($foreach.count != $columns.size()),#end ]#if($foreach.count != $columns.size()),#end
#end #end
#end #end
} },
columns: [
#foreach ($column in $columns)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else
#set($comment=$column.columnComment)
#end
{ key: ${foreach.index}, label: `${comment}`, visible: true },
#end
]
}; };
}, },
created() { created() {

Loading…
Cancel
Save