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

@ -110,7 +110,7 @@
v-hasPermi="['${moduleName}:${businessName}:export']"
>导出</el-button>
</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-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
@ -124,21 +124,21 @@
#set($comment=$column.columnComment)
#end
#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")
<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">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
#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">
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
</template>
</el-table-column>
#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">
#if($column.htmlType == "checkbox")
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
@ -148,7 +148,7 @@
</template>
</el-table-column>
#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
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -422,7 +422,18 @@ export default {
]#if($foreach.count != $columns.size()),#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() {

Loading…
Cancel
Save