Merge pull request 'main' (#105) from 616036448/Admin.NET.Pro:main into main
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/105
This commit is contained in:
commit
308a78d08c
@ -86,7 +86,7 @@ if (@column.WhetherAddUpdate == "Y"){
|
||||
@if(@column.WhetherRequired=="Y"){
|
||||
@:[Required(ErrorMessage = "@(@column.ColumnComment)不能为空")]
|
||||
}
|
||||
@if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")){
|
||||
@if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")&&@column.ColumnLength>0){
|
||||
@:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")]
|
||||
}
|
||||
@if(@column.AnyRule){
|
||||
@ -143,7 +143,7 @@ if (@column.WhetherAddUpdate == "Y"){
|
||||
@if(@column.WhetherRequired=="Y"){
|
||||
@:[Required(ErrorMessage = "@(@column.ColumnComment)不能为空")]
|
||||
}
|
||||
@if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")){
|
||||
@if(@column.NetType.StartsWith("string")&&!@column.RuleItems.Any(t=>t.Type=="length")&&@column.ColumnLength>0){
|
||||
@:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")]
|
||||
}
|
||||
@if(@column.AnyRule){
|
||||
|
||||
@ -116,7 +116,11 @@ if (@column.QueryWhether == "Y"){
|
||||
} else {
|
||||
@:.Select<@(@Model.ClassName)Output>();
|
||||
}
|
||||
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "fk")){
|
||||
@:return await query.OrderBuilder(input,"[u].","[@(PKName)]").ToPagedListAsync(input.Page, input.PageSize);
|
||||
} else {
|
||||
@:return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -214,7 +218,7 @@ if(@column.EffectType == "fk" && (@column.WhetherAddUpdate == "Y" || column.Quer
|
||||
@:/// 获取@(@column.ColumnComment)列表
|
||||
@:/// </summary>
|
||||
@:/// <returns></returns>
|
||||
@:[ApiDescriptionSettings(Name = "@(@column.FkEntityName)@(@column.PropertyName)Dropdown", Description = "获取@(@column.ColumnComment)列表"), HttpGet]
|
||||
@:[ApiDescriptionSettings(Name = "@(LowerFirstLetter(@column.FkEntityName))@(@column.PropertyName)Dropdown", Description = "获取@(@column.ColumnComment)列表", Order = 940), HttpGet]
|
||||
@:[DisplayName("获取@(@column.ColumnComment)列表")]
|
||||
@:public async Task<List<LabelValueOutput>> @(@column.FkEntityName)@(@column.PropertyName)Dropdown()
|
||||
@:{
|
||||
@ -236,7 +240,7 @@ if(@column.EffectType == "Upload"){
|
||||
@:/// </summary>
|
||||
@:/// <param name="file"></param>
|
||||
@:/// <returns></returns>
|
||||
@:[ApiDescriptionSettings(Name = "Upload@(@column.PropertyName)", Description = "上传@(@column.ColumnComment)", HttpPost]
|
||||
@:[ApiDescriptionSettings(Name = "upload@(@column.PropertyName)", Description = "上传@(@column.ColumnComment)", Order = 930), HttpPost]
|
||||
@:[DisplayName("上传@(@column.ColumnComment)")]
|
||||
@:public async Task<SysFile> Upload@(@column.PropertyName)([Required] IFormFile file)
|
||||
@:{
|
||||
@ -249,7 +253,7 @@ if(@column.EffectType == "Upload"){
|
||||
@foreach (var column in Model.TableField){
|
||||
if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("@(@column.FkEntityName)Tree")){
|
||||
@{definedObjects.Add("@(@column.FkEntityName)Tree", 1);}
|
||||
@:[ApiDescriptionSettings(Name = ""@(@column.FkEntityName)Tree"", Description = "获取@(@column.ColumnComment)列表", HttpGet]
|
||||
@:[ApiDescriptionSettings(Name = "@(LowerFirstLetter(@column.FkEntityName))Tree", Description = "获取@(@column.ColumnComment)列表", Order = 920), HttpGet]
|
||||
@:[DisplayName("获取@(@column.FkEntityName)Tree")]
|
||||
@:public async Task<dynamic> @(@column.FkEntityName)Tree()
|
||||
@:{
|
||||
@ -264,7 +268,7 @@ if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("@(@colu
|
||||
@:/// </summary>
|
||||
@:/// <param name="param">检查字段参数</param>
|
||||
@:/// <returns></returns>
|
||||
@:[ApiDescriptionSettings(Name = "exists@(RemoteField)",Description = "检查@(RemoteField)字段是否可用", Order = 940), HttpPost]
|
||||
@:[ApiDescriptionSettings(Name = "exists@(RemoteField)",Description = "检查@(RemoteField)字段是否可用", Order = 910), HttpPost]
|
||||
@:[DisplayName("检查@(RemoteField)字段是否可用")]
|
||||
@:public async Task<bool> Exists@(RemoteField)Async(Exists@(RemoteField)Input param)
|
||||
@:{
|
||||
@ -286,3 +290,10 @@ if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("@(@colu
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@{
|
||||
string LowerFirstLetter(string text)
|
||||
{
|
||||
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,10 +23,10 @@ enum Api {
|
||||
}
|
||||
@foreach (var column in Model.TableField){
|
||||
if(@column.EffectType == "fk" && (@column.WhetherAddUpdate == "Y" || column.QueryWhether == "Y")){
|
||||
@:Get@(@column.FkEntityName)@(@column.PropertyName)Dropdown = '/api/@(@Model.LowerClassName)/@(@column.FkEntityName)@(@column.PropertyName)Dropdown',
|
||||
@:Get@(@column.FkEntityName)@(@column.PropertyName)Dropdown = '/api/@(@Model.LowerClassName)/@(LowerFirstLetter(@column.FkEntityName))@(@column.PropertyName)Dropdown',
|
||||
}else if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("Get@(@column.FkEntityName)Tree")){
|
||||
@{definedObjects.Add("Get@(@column.FkEntityName)Tree", 1);}
|
||||
@:Get@(@column.FkEntityName)Tree = '/api/@(@Model.LowerClassName)/@(@column.FkEntityName)Tree',
|
||||
@:Get@(@column.FkEntityName)Tree = '/api/@(@Model.LowerClassName)/@(LowerFirstLetter(@column.FkEntityName))Tree',
|
||||
}else if(@column.EffectType == "Upload"){
|
||||
@:Upload@(@column.PropertyName) = '/api/@(@Model.LowerClassName)/upload@(@column.PropertyName)',
|
||||
}
|
||||
@ -136,4 +136,11 @@ if(@column.EffectType == "Upload"){
|
||||
@:method: 'post',
|
||||
@:data: params,
|
||||
@:});
|
||||
}
|
||||
|
||||
@{
|
||||
string LowerFirstLetter(string text)
|
||||
{
|
||||
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,11 @@
|
||||
}else if(@column.EffectType == "InputTextArea"){
|
||||
@:<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
@:<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||
@:<el-input v-model="state.ruleForm.@(@column.LowerPropertyName)" placeholder="请输入@(@column.ColumnComment)" type="textarea" maxlength="@(@column.ColumnLength)" show-word-limit clearable />
|
||||
@:<el-input v-model="state.ruleForm.@(@column.LowerPropertyName)" placeholder="请输入@(@column.ColumnComment)" type="textarea"
|
||||
@if(@column.ColumnLength>0){
|
||||
@:maxlength="@(@column.ColumnLength)"
|
||||
}
|
||||
@:show-word-limit clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
}else if(@column.EffectType == "Select"){
|
||||
@ -94,7 +98,11 @@
|
||||
}else if(@column.EffectType == "Switch"){
|
||||
@:<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
@:<el-form-item label="@column.ColumnComment" prop="@(@column.LowerPropertyName)">
|
||||
@:<el-switch v-model="state.ruleForm.@(@column.LowerPropertyName)" active-text="是" inactive-text="否" />
|
||||
@:<el-switch v-model="state.ruleForm.@(@column.LowerPropertyName)"
|
||||
@if(@column.NetType.StartsWith("int")){
|
||||
@:active-value="1" inactive-value="0"
|
||||
}
|
||||
@:active-text="是" inactive-text="否" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
}else if(@column.EffectType == "DatePicker"){
|
||||
|
||||
@ -228,7 +228,7 @@ const handleConfig = (row: any) => {
|
||||
|
||||
// 开始生成代码
|
||||
const handleGenerate = (row: any) => {
|
||||
ElMessageBox.confirm(`确定要生成吗?`, '提示', {
|
||||
ElMessageBox.confirm(`确定要生成【${row.tableName}】表吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user