feat:代码生成显示按钮新增批量删除配置

This commit is contained in:
不做码农 2023-05-08 18:28:49 +08:00
parent a89762e070
commit 5a3e513a6b
3 changed files with 12 additions and 7 deletions

View File

@ -73,14 +73,12 @@ $if(replaceDto.ShowBtnAdd)
</el-button>
</el-col>
$end
$if(replaceDto.ShowBtnEdit)
$if(replaceDto.ShowBtnMultiDel)
<el-col :span="1.5">
<el-button type="success" :disabled="single" v-hasPermi="['${replaceDto.PermissionPrefix}:edit']" plain icon="edit" @click="handleUpdate">
{{ ${t}t('btn.edit') }}
</el-button>
</el-col>
$end
$if(replaceDto.ShowBtnDelete)
<el-col :span="1.5">
<el-button type="danger" :disabled="multiple" v-hasPermi="['${replaceDto.PermissionPrefix}:delete']" plain icon="delete" @click="handleDelete">
{{ ${t}t('btn.delete') }}
@ -112,8 +110,13 @@ $end
border
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange">
$if(replaceDto.ShowBtnMultiDel)
@selection-change="handleSelectionChange"
$end
>
$if(replaceDto.ShowBtnMultiDel)
<el-table-column type="selection" width="50" align="center"/>
$end
$if(null != genTable.SubTableName && "" != genTable.SubTableName && genTable.TplCategory == "subNav")
<el-table-column type="expand">
<template #default="props">
@ -453,14 +456,14 @@ $end
proxy.resetForm("queryRef")
handleQuery()
}
$if(replaceDto.ShowBtnMultiDel)
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map((item) => item.${replaceDto.FistLowerPk});
single.value = selection.length != 1
multiple.value = !selection.length;
}
$end
// 自定义排序
function sortChange(column) {
var sort = undefined

View File

@ -49,6 +49,7 @@ namespace ZR.CodeGenerator
ShowBtnExport = dto.GenTable.Options.CheckedBtn.Any(f => f == 4),
ShowBtnView = dto.GenTable.Options.CheckedBtn.Any(f => f == 5),
ShowBtnTruncate = dto.GenTable.Options.CheckedBtn.Any(f => f == 6),
ShowBtnMultiDel = dto.GenTable.Options.CheckedBtn.Any(f => f == 7),
};
var columns = dto.GenTable.Columns;

View File

@ -49,6 +49,7 @@ namespace ZR.CodeGenerator.Model
public bool ShowBtnDelete { get; set; }
public bool ShowBtnView { get; set; }
public bool ShowBtnTruncate { get; set; }
public bool ShowBtnMultiDel { get; set; }
/// <summary>
/// 上传URL data
/// </summary>