feat:代码生成模板新增清空操作
This commit is contained in:
parent
c6aecf2c76
commit
b8b323a090
@ -157,6 +157,26 @@ $if(replaceDto.ShowBtnExport)
|
||||
}
|
||||
$end
|
||||
|
||||
$if(replaceDto.ShowBtnTruncate)
|
||||
/// <summary>
|
||||
/// 清空${genTable.FunctionName}
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Log(Title = "${genTable.FunctionName}", BusinessType = BusinessType.CLEAN)]
|
||||
[ActionPermissionFilter(Permission = "${replaceDto.PermissionPrefix}:delete")]
|
||||
[HttpDelete("clean")]
|
||||
public ApiResult Clear()
|
||||
{
|
||||
if (!HttpContextExtension.IsAdmin(HttpContext))
|
||||
{
|
||||
return ApiResult.Error("操作失败");
|
||||
}
|
||||
_${replaceDto.ModelTypeName}Service.Truncate${replaceDto.ModelTypeName}();
|
||||
|
||||
return ToJson(1);
|
||||
}
|
||||
$end
|
||||
|
||||
$if(showCustomInput)
|
||||
/// <summary>
|
||||
/// 保存排序
|
||||
|
||||
@ -22,5 +22,7 @@ $end
|
||||
int Add${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm);
|
||||
|
||||
int Update${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm);
|
||||
|
||||
void Truncate${replaceDto.ModelTypeName}();
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +119,15 @@ ${end}
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空${genTable.FunctionName}
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void Truncate${replaceDto.ModelTypeName}()
|
||||
{
|
||||
Truncate();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -72,6 +72,14 @@ export function del${genTable.BusinessName}(pid) {
|
||||
})
|
||||
}
|
||||
|
||||
// 清空${genTable.functionName}
|
||||
export function clear${genTable.BusinessName}() {
|
||||
return request({
|
||||
url: '${genTable.ModuleName}/${genTable.BusinessName}/clean',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出${genTable.functionName}
|
||||
export function export${genTable.BusinessName}(query) {
|
||||
return request({
|
||||
|
||||
@ -84,6 +84,13 @@ $if(replaceDto.ShowBtnDelete)
|
||||
</el-button>
|
||||
</el-col>
|
||||
$end
|
||||
$if(replaceDto.ShowBtnTruncate)
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" v-hasPermi="['${replaceDto.PermissionPrefix}:delete']" plain icon="delete" @click="handleClear">
|
||||
清空
|
||||
</el-button>
|
||||
</el-col>
|
||||
$end
|
||||
$if(replaceDto.ShowBtnExport)
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['${replaceDto.PermissionPrefix}:export']">
|
||||
@ -270,9 +277,12 @@ $end
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup name="${genTable.BusinessName.ToLower()}">
|
||||
import { list${genTable.BusinessName}, add${genTable.BusinessName}, del${genTable.BusinessName}, update${genTable.BusinessName}, get${genTable.BusinessName},$if(replaceDto.ShowBtnExport) export${genTable.BusinessName}, $end $if(showCustomInput) changeSort $end } from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js'
|
||||
import { list${genTable.BusinessName}, add${genTable.BusinessName}, del${genTable.BusinessName}, update${genTable.BusinessName}, get${genTable.BusinessName},
|
||||
$if(replaceDto.ShowBtnExport) export${genTable.BusinessName}, $end
|
||||
$if(replaceDto.ShowBtnTruncate) clear${genTable.BusinessName}, $end
|
||||
$if(showCustomInput) changeSort $end }
|
||||
from '@/api/${tool.FirstLowerCase(genTable.ModuleName)}/${genTable.BusinessName.ToLower()}.js'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
// 选中${replaceDto.FistLowerPk}数组数组
|
||||
@ -542,6 +552,26 @@ function handlePreview(row) {
|
||||
form.value = row
|
||||
}
|
||||
$end
|
||||
$if(replaceDto.ShowBtnTruncate)
|
||||
/**
|
||||
* 清空
|
||||
*/
|
||||
function handleClear() {
|
||||
proxy
|
||||
.${confirm}confirm("是否确认清空所有数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return clear${genTable.BusinessName}()
|
||||
})
|
||||
.then(() => {
|
||||
handleQuery()
|
||||
proxy.${modal}modal.msgSuccess('清空成功')
|
||||
})
|
||||
}
|
||||
$end
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.${replaceDto.FistLowerPk});
|
||||
|
||||
@ -59,7 +59,8 @@ namespace ZR.CodeGenerator
|
||||
ShowBtnEdit = dto.GenTable.Options.CheckedBtn.Any(f => f == 2),
|
||||
ShowBtnDelete = dto.GenTable.Options.CheckedBtn.Any(f => f == 3),
|
||||
ShowBtnExport = dto.GenTable.Options.CheckedBtn.Any(f => f == 4),
|
||||
ShowBtnView = dto.GenTable.Options.CheckedBtn.Any(f => f == 5)
|
||||
ShowBtnView = dto.GenTable.Options.CheckedBtn.Any(f => f == 5),
|
||||
ShowBtnTruncate = dto.GenTable.Options.CheckedBtn.Any(f => f == 6),
|
||||
};
|
||||
|
||||
//循环表字段信息
|
||||
|
||||
@ -48,6 +48,7 @@ namespace ZR.CodeGenerator.Model
|
||||
public bool ShowBtnEdit { get; set; }
|
||||
public bool ShowBtnDelete { get; set; }
|
||||
public bool ShowBtnView { get; set; }
|
||||
public bool ShowBtnTruncate { get; set; }
|
||||
/// <summary>
|
||||
/// 上传URL data
|
||||
/// </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user