统一视图类型ViewKinds
This commit is contained in:
parent
7c4d544d62
commit
bca5a512cf
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using NewLife.Common;
|
using NewLife.Common;
|
||||||
using NewLife.Cube.Common;
|
using NewLife.Cube.Common;
|
||||||
using NewLife.Cube.Entity;
|
using NewLife.Cube.Entity;
|
||||||
|
using NewLife.Cube.ViewModels;
|
||||||
using NewLife.Data;
|
using NewLife.Data;
|
||||||
using NewLife.Log;
|
using NewLife.Log;
|
||||||
using NewLife.Web;
|
using NewLife.Web;
|
||||||
|
@ -410,7 +411,7 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
var list = SearchData(p);
|
var list = SearchData(p);
|
||||||
|
|
||||||
// Json输出
|
// Json输出
|
||||||
if (IsJsonRequest) return Json(0, null, OnFilter(list.Cast<IModel>(), "ListFields"), new { pager = p, stat = p.State });
|
if (IsJsonRequest) return Json(0, null, OnFilter(list.Cast<IModel>(), ViewKinds.List), new { pager = p, stat = p.State });
|
||||||
|
|
||||||
return Json(0, null, list, new { pager = p, stat = p.State });
|
return Json(0, null, list, new { pager = p, stat = p.State });
|
||||||
}
|
}
|
||||||
|
@ -430,7 +431,7 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
Valid(entity, DataObjectMethodType.Select, false);
|
Valid(entity, DataObjectMethodType.Select, false);
|
||||||
|
|
||||||
// Json输出
|
// Json输出
|
||||||
if (IsJsonRequest) return Json(0, null, OnFilter(entity, "Detail"));
|
if (IsJsonRequest) return Json(0, null, OnFilter(entity, ViewKinds.Detail));
|
||||||
|
|
||||||
return Json(0, null, entity);
|
return Json(0, null, entity);
|
||||||
}
|
}
|
||||||
|
@ -1203,7 +1204,7 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
#region 列表字段和表单字段
|
#region 列表字段和表单字段
|
||||||
private static FieldCollection _ListFields;
|
private static FieldCollection _ListFields;
|
||||||
/// <summary>列表字段过滤</summary>
|
/// <summary>列表字段过滤</summary>
|
||||||
protected static FieldCollection ListFields => _ListFields ??= new FieldCollection(Factory, "List");
|
protected static FieldCollection ListFields => _ListFields ??= new FieldCollection(Factory, ViewKinds.List);
|
||||||
|
|
||||||
//private static FieldCollection _FormFields;
|
//private static FieldCollection _FormFields;
|
||||||
///// <summary>表单字段过滤</summary>
|
///// <summary>表单字段过滤</summary>
|
||||||
|
@ -1212,31 +1213,30 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
|
|
||||||
private static FieldCollection _AddFormFields;
|
private static FieldCollection _AddFormFields;
|
||||||
/// <summary>表单字段过滤</summary>
|
/// <summary>表单字段过滤</summary>
|
||||||
protected static FieldCollection AddFormFields => _AddFormFields ??= new FieldCollection(Factory, "AddForm");
|
protected static FieldCollection AddFormFields => _AddFormFields ??= new FieldCollection(Factory, ViewKinds.AddForm);
|
||||||
|
|
||||||
private static FieldCollection _EditFormFields;
|
private static FieldCollection _EditFormFields;
|
||||||
/// <summary>表单字段过滤</summary>
|
/// <summary>表单字段过滤</summary>
|
||||||
protected static FieldCollection EditFormFields => _EditFormFields ??= new FieldCollection(Factory, "EditForm");
|
protected static FieldCollection EditFormFields => _EditFormFields ??= new FieldCollection(Factory, ViewKinds.EditForm);
|
||||||
|
|
||||||
private static FieldCollection _DetailFields;
|
private static FieldCollection _DetailFields;
|
||||||
/// <summary>表单字段过滤</summary>
|
/// <summary>表单字段过滤</summary>
|
||||||
protected static FieldCollection DetailFields => _DetailFields ??= new FieldCollection(Factory, "Detail");
|
protected static FieldCollection DetailFields => _DetailFields ??= new FieldCollection(Factory, ViewKinds.Detail);
|
||||||
|
|
||||||
/// <summary>获取字段信息。支持用户重载并根据上下文定制界面</summary>
|
/// <summary>获取字段信息。支持用户重载并根据上下文定制界面</summary>
|
||||||
/// <param name="kind">字段类型:详情-Detail、编辑-EditForm、添加-AddForm、列表-List</param>
|
/// <param name="kind">字段类型:详情-Detail、编辑-EditForm、添加-AddForm、列表-List</param>
|
||||||
/// <param name="entity"></param>
|
/// <param name="model"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual FieldCollection OnGetFields(String kind, TEntity entity)
|
protected virtual FieldCollection OnGetFields(ViewKinds kind, IModel model)
|
||||||
{
|
{
|
||||||
var fields = kind switch
|
var fields = kind switch
|
||||||
{
|
{
|
||||||
"Detail" => DetailFields,
|
ViewKinds.List => ListFields,
|
||||||
"EditForm" => EditFormFields,
|
ViewKinds.Detail => DetailFields,
|
||||||
"AddForm" => AddFormFields,
|
ViewKinds.AddForm => AddFormFields,
|
||||||
"List" => ListFields,
|
ViewKinds.EditForm => EditFormFields,
|
||||||
_ => ListFields
|
_ => ListFields,
|
||||||
};
|
};
|
||||||
|
|
||||||
return fields.Clone();
|
return fields.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,11 +1244,10 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
/// 获取字段
|
/// 获取字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kind">字段类型:详情-Detail、编辑-EditForm、添加-AddForm、列表-List</param>
|
/// <param name="kind">字段类型:详情-Detail、编辑-EditForm、添加-AddForm、列表-List</param>
|
||||||
/// <param name="formatType">Name和ColumnName的值的格式。0-小驼峰,1-小写,2-保持默认。默认0</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public virtual ActionResult GetFields(String kind, FormatType formatType = FormatType.CamelCase)
|
public virtual ActionResult GetFields(ViewKinds kind)
|
||||||
{
|
{
|
||||||
var fields = OnGetFields(kind, null);
|
var fields = OnGetFields(kind, null);
|
||||||
|
|
||||||
|
@ -1263,12 +1262,12 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
/// <param name="kind"></param>
|
/// <param name="kind"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual IDictionary<String, Object> OnFilter(IModel model, String kind)
|
protected virtual IDictionary<String, Object> OnFilter(IModel model, ViewKinds kind)
|
||||||
{
|
{
|
||||||
if (model == null) return null;
|
if (model == null) return null;
|
||||||
|
|
||||||
var dic = new Dictionary<String, Object>();
|
var dic = new Dictionary<String, Object>();
|
||||||
var fields = OnGetFields(kind, null);
|
var fields = OnGetFields(kind, model);
|
||||||
if (fields != null)
|
if (fields != null)
|
||||||
{
|
{
|
||||||
var names = Factory.FieldNames;
|
var names = Factory.FieldNames;
|
||||||
|
@ -1288,13 +1287,13 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
/// <param name="models"></param>
|
/// <param name="models"></param>
|
||||||
/// <param name="kind"></param>
|
/// <param name="kind"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual IEnumerable<IDictionary<String, Object>> OnFilter(IEnumerable<IModel> models, String kind)
|
protected virtual IEnumerable<IDictionary<String, Object>> OnFilter(IEnumerable<IModel> models, ViewKinds kind)
|
||||||
{
|
{
|
||||||
if (models == null) yield break;
|
if (models == null) yield break;
|
||||||
|
|
||||||
foreach (var item in models)
|
foreach (var item in models)
|
||||||
{
|
{
|
||||||
yield return OnFilter(item, null);
|
yield return OnFilter(item, kind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
<Compile Include="..\NewLife.CubeNC\ViewModels\LoginConfigModel.cs" Link="ViewModels\LoginConfigModel.cs" />
|
<Compile Include="..\NewLife.CubeNC\ViewModels\LoginConfigModel.cs" Link="ViewModels\LoginConfigModel.cs" />
|
||||||
<Compile Include="..\NewLife.CubeNC\ViewModels\MenuTree.cs" Link="ViewModels\MenuTree.cs" />
|
<Compile Include="..\NewLife.CubeNC\ViewModels\MenuTree.cs" Link="ViewModels\MenuTree.cs" />
|
||||||
<Compile Include="..\NewLife.CubeNC\ViewModels\SelectUserModel.cs" Link="ViewModels\SelectUserModel.cs" />
|
<Compile Include="..\NewLife.CubeNC\ViewModels\SelectUserModel.cs" Link="ViewModels\SelectUserModel.cs" />
|
||||||
|
<Compile Include="..\NewLife.CubeNC\ViewModels\ViewKinds.cs" Link="ViewModels\ViewKinds.cs" />
|
||||||
<Compile Include="..\NewLife.CubeNC\WebMiddleware\TenantMiddleware.cs" Link="WebMiddleware\TenantMiddleware.cs" />
|
<Compile Include="..\NewLife.CubeNC\WebMiddleware\TenantMiddleware.cs" Link="WebMiddleware\TenantMiddleware.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -7,6 +7,8 @@ using NewLife.Common;
|
||||||
using NewLife.Cube.Areas.Admin.Models;
|
using NewLife.Cube.Areas.Admin.Models;
|
||||||
using NewLife.Cube.Entity;
|
using NewLife.Cube.Entity;
|
||||||
using NewLife.Cube.Services;
|
using NewLife.Cube.Services;
|
||||||
|
using NewLife.Cube.ViewModels;
|
||||||
|
using NewLife.Data;
|
||||||
using NewLife.Log;
|
using NewLife.Log;
|
||||||
using NewLife.Reflection;
|
using NewLife.Reflection;
|
||||||
using NewLife.Web;
|
using NewLife.Web;
|
||||||
|
@ -88,53 +90,34 @@ public class UserController : EntityController<User, UserModel>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FieldCollection OnGetFields(String kind, User entity)
|
protected override FieldCollection OnGetFields(ViewKinds kind, IModel model)
|
||||||
{
|
{
|
||||||
switch (kind.ToLower())
|
var fields = base.OnGetFields(kind, model);
|
||||||
{
|
if (fields == null) return fields;
|
||||||
case "addform":
|
|
||||||
case "editform":
|
|
||||||
{
|
|
||||||
var CurrUser = ManageProvider.User;//理论上肯定大于0
|
|
||||||
var RoleData = Role.FindAllWithCache().Where(w => w.IsSystem == false).OrderByDescending(e => e.Sort).ToDictionary(e => e.ID, e => e.Name);
|
|
||||||
if (CurrUser != null)
|
|
||||||
{
|
|
||||||
if (CurrUser.Role.IsSystem)
|
|
||||||
{
|
|
||||||
RoleData = Role.FindAllWithCache().OrderByDescending(e => e.Sort).ToDictionary(e => e.ID, e => e.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (kind.ToLower() == "addform")
|
|
||||||
{
|
|
||||||
var AddRoleIDField = AddFormFields.GetField("RoleID");
|
|
||||||
if (AddRoleIDField != null)
|
|
||||||
{
|
|
||||||
AddRoleIDField.DataSource = entity => RoleData;
|
|
||||||
}
|
|
||||||
var AddRoleIDsField = AddFormFields.GetField("RoleIds");
|
|
||||||
if (AddRoleIDsField != null)
|
|
||||||
{
|
|
||||||
AddRoleIDsField.DataSource = entity => RoleData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (kind.ToLower() == "editform")
|
|
||||||
{
|
|
||||||
var EditRoleIDField = EditFormFields.GetField("RoleID");
|
|
||||||
if (EditRoleIDField != null)
|
|
||||||
{
|
|
||||||
EditRoleIDField.DataSource = entity => RoleData;
|
|
||||||
}
|
|
||||||
var EditRoleIDsField = EditFormFields.GetField("RoleIds");
|
|
||||||
if (EditRoleIDsField != null)
|
|
||||||
{
|
|
||||||
EditRoleIDsField.DataSource = entity => RoleData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
var user = ManageProvider.User;//理论上肯定大于0
|
||||||
}
|
var roles = Role.FindAllWithCache().Where(w => w.IsSystem == false).OrderByDescending(e => e.Sort).ToDictionary(e => e.ID, e => e.Name);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
if (user.Role.IsSystem)
|
||||||
|
{
|
||||||
|
roles = Role.FindAllWithCache().OrderByDescending(e => e.Sort).ToDictionary(e => e.ID, e => e.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return base.OnGetFields(kind, entity);
|
|
||||||
|
switch (kind)
|
||||||
|
{
|
||||||
|
case ViewKinds.AddForm:
|
||||||
|
case ViewKinds.EditForm:
|
||||||
|
var df = fields.GetField("RoleID");
|
||||||
|
if (df != null) df.DataSource = entity => roles;
|
||||||
|
|
||||||
|
var df2 = fields.GetField("RoleIds");
|
||||||
|
if (df2 != null) df2.DataSource = entity => roles;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -13,6 +13,7 @@ using NewLife.Cube.Common;
|
||||||
using NewLife.Cube.Entity;
|
using NewLife.Cube.Entity;
|
||||||
using NewLife.Cube.Extensions;
|
using NewLife.Cube.Extensions;
|
||||||
using NewLife.Cube.ViewModels;
|
using NewLife.Cube.ViewModels;
|
||||||
|
using NewLife.Data;
|
||||||
using NewLife.IO;
|
using NewLife.IO;
|
||||||
using NewLife.Log;
|
using NewLife.Log;
|
||||||
using NewLife.Reflection;
|
using NewLife.Reflection;
|
||||||
|
@ -1240,7 +1241,7 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
#region 列表字段和表单字段
|
#region 列表字段和表单字段
|
||||||
private static FieldCollection _ListFields;
|
private static FieldCollection _ListFields;
|
||||||
/// <summary>列表字段过滤</summary>
|
/// <summary>列表字段过滤</summary>
|
||||||
protected static FieldCollection ListFields => _ListFields ??= new FieldCollection(Factory, "List");
|
protected static FieldCollection ListFields => _ListFields ??= new FieldCollection(Factory, ViewKinds.List);
|
||||||
|
|
||||||
//private static FieldCollection _FormFields;
|
//private static FieldCollection _FormFields;
|
||||||
///// <summary>表单字段过滤</summary>
|
///// <summary>表单字段过滤</summary>
|
||||||
|
@ -1249,31 +1250,30 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
|
|
||||||
private static FieldCollection _AddFormFields;
|
private static FieldCollection _AddFormFields;
|
||||||
/// <summary>表单字段过滤</summary>
|
/// <summary>表单字段过滤</summary>
|
||||||
protected static FieldCollection AddFormFields => _AddFormFields ??= new FieldCollection(Factory, "AddForm");
|
protected static FieldCollection AddFormFields => _AddFormFields ??= new FieldCollection(Factory, ViewKinds.AddForm);
|
||||||
|
|
||||||
private static FieldCollection _EditFormFields;
|
private static FieldCollection _EditFormFields;
|
||||||
/// <summary>表单字段过滤</summary>
|
/// <summary>表单字段过滤</summary>
|
||||||
protected static FieldCollection EditFormFields => _EditFormFields ??= new FieldCollection(Factory, "EditForm");
|
protected static FieldCollection EditFormFields => _EditFormFields ??= new FieldCollection(Factory, ViewKinds.EditForm);
|
||||||
|
|
||||||
private static FieldCollection _DetailFields;
|
private static FieldCollection _DetailFields;
|
||||||
/// <summary>表单字段过滤</summary>
|
/// <summary>表单字段过滤</summary>
|
||||||
protected static FieldCollection DetailFields => _DetailFields ??= new FieldCollection(Factory, "Detail");
|
protected static FieldCollection DetailFields => _DetailFields ??= new FieldCollection(Factory, ViewKinds.Detail);
|
||||||
|
|
||||||
/// <summary>获取字段信息。支持用户重载并根据上下文定制界面</summary>
|
/// <summary>获取字段信息。支持用户重载并根据上下文定制界面</summary>
|
||||||
/// <param name="kind">字段类型:详情-Detail、编辑-EditForm、添加-AddForm、列表-List</param>
|
/// <param name="kind">字段类型:详情-Detail、编辑-EditForm、添加-AddForm、列表-List</param>
|
||||||
/// <param name="entity"></param>
|
/// <param name="model"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual FieldCollection OnGetFields(String kind, TEntity entity)
|
protected virtual FieldCollection OnGetFields(ViewKinds kind, IModel model)
|
||||||
{
|
{
|
||||||
var fields = kind switch
|
var fields = kind switch
|
||||||
{
|
{
|
||||||
"Detail" => DetailFields,
|
ViewKinds.List => ListFields,
|
||||||
"EditForm" => EditFormFields,
|
ViewKinds.Detail => DetailFields,
|
||||||
"AddForm" => AddFormFields,
|
ViewKinds.AddForm => AddFormFields,
|
||||||
"List" => ListFields,
|
ViewKinds.EditForm => EditFormFields,
|
||||||
_ => ListFields
|
_ => ListFields,
|
||||||
};
|
};
|
||||||
|
|
||||||
return fields.Clone();
|
return fields.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,7 +1284,7 @@ public class ReadOnlyEntityController<TEntity> : ControllerBaseX where TEntity :
|
||||||
/// <param name="formatType">Name和ColumnName的值的格式。0-小驼峰,1-小写,2-保持默认。默认0</param>
|
/// <param name="formatType">Name和ColumnName的值的格式。0-小驼峰,1-小写,2-保持默认。默认0</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public virtual ActionResult GetFields(String kind, FormatType formatType = FormatType.CamelCase)
|
public virtual ActionResult GetFields(ViewKinds kind)
|
||||||
{
|
{
|
||||||
var fields = OnGetFields(kind, null);
|
var fields = OnGetFields(kind, null);
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Remove="Areas\Cube\Controllers\ModelColumnController.cs" />
|
||||||
|
<Compile Remove="Areas\Cube\Controllers\ModelTableController.cs" />
|
||||||
<Compile Remove="Extensions\ItemsExtend.cs" />
|
<Compile Remove="Extensions\ItemsExtend.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class FieldCollection : List<DataField>
|
||||||
{
|
{
|
||||||
#region 属性
|
#region 属性
|
||||||
/// <summary>类型</summary>
|
/// <summary>类型</summary>
|
||||||
public String Kind { get; set; }
|
public ViewKinds Kind { get; set; }
|
||||||
|
|
||||||
/// <summary>工厂</summary>
|
/// <summary>工厂</summary>
|
||||||
public IEntityFactory Factory { get; set; }
|
public IEntityFactory Factory { get; set; }
|
||||||
|
@ -31,12 +31,12 @@ public class FieldCollection : List<DataField>
|
||||||
#region 构造
|
#region 构造
|
||||||
/// <summary>实例化一个字段集合</summary>
|
/// <summary>实例化一个字段集合</summary>
|
||||||
/// <param name="kind"></param>
|
/// <param name="kind"></param>
|
||||||
public FieldCollection(String kind) => Kind = kind;
|
public FieldCollection(ViewKinds kind) => Kind = kind;
|
||||||
|
|
||||||
/// <summary>使用工厂实例化一个字段集合</summary>
|
/// <summary>使用工厂实例化一个字段集合</summary>
|
||||||
/// <param name="factory"></param>
|
/// <param name="factory"></param>
|
||||||
/// <param name="kind"></param>
|
/// <param name="kind"></param>
|
||||||
public FieldCollection(IEntityFactory factory, String kind)
|
public FieldCollection(IEntityFactory factory, ViewKinds kind)
|
||||||
{
|
{
|
||||||
Kind = kind;
|
Kind = kind;
|
||||||
Factory = factory;
|
Factory = factory;
|
||||||
|
@ -51,21 +51,22 @@ public class FieldCollection : List<DataField>
|
||||||
|
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case "AddForm":
|
case ViewKinds.List:
|
||||||
|
SetRelation(false);
|
||||||
|
break;
|
||||||
|
case ViewKinds.Detail:
|
||||||
|
SetRelation(true);
|
||||||
|
break;
|
||||||
|
case ViewKinds.AddForm:
|
||||||
SetRelation(true);
|
SetRelation(true);
|
||||||
//RemoveCreateField();
|
//RemoveCreateField();
|
||||||
RemoveUpdateField();
|
RemoveUpdateField();
|
||||||
break;
|
break;
|
||||||
case "EditForm":
|
case ViewKinds.EditForm:
|
||||||
SetRelation(true);
|
SetRelation(true);
|
||||||
break;
|
break;
|
||||||
case "Detail":
|
case ViewKinds.Search:
|
||||||
SetRelation(true);
|
|
||||||
break;
|
break;
|
||||||
case "Form":
|
|
||||||
SetRelation(true);
|
|
||||||
break;
|
|
||||||
case "List":
|
|
||||||
default:
|
default:
|
||||||
SetRelation(false);
|
SetRelation(false);
|
||||||
break;
|
break;
|
||||||
|
@ -82,11 +83,8 @@ public class FieldCollection : List<DataField>
|
||||||
{
|
{
|
||||||
DataField df = Kind switch
|
DataField df = Kind switch
|
||||||
{
|
{
|
||||||
"AddForm" => new FormField(),
|
ViewKinds.List => new ListField(),
|
||||||
"EditForm" => new FormField(),
|
ViewKinds.Detail or ViewKinds.AddForm or ViewKinds.EditForm => new FormField(),
|
||||||
"Detail" => new FormField(),
|
|
||||||
"Form" => new FormField(),
|
|
||||||
"List" => new ListField(),
|
|
||||||
_ => throw new NotImplementedException(),
|
_ => throw new NotImplementedException(),
|
||||||
};
|
};
|
||||||
//df.Sort = Count + 1;
|
//df.Sort = Count + 1;
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace NewLife.Cube.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>视图类型。如List/Detail/AddForm/EditForm/Search等</summary>
|
||||||
|
public enum ViewKinds
|
||||||
|
{
|
||||||
|
/// <summary>列表</summary>
|
||||||
|
[Description("列表")]
|
||||||
|
List = 1,
|
||||||
|
|
||||||
|
/// <summary>详情</summary>
|
||||||
|
[Description("详情")]
|
||||||
|
Detail = 2,
|
||||||
|
|
||||||
|
/// <summary>添加表单</summary>
|
||||||
|
[Description("添加表单")]
|
||||||
|
AddForm = 3,
|
||||||
|
|
||||||
|
/// <summary>编辑表单</summary>
|
||||||
|
[Description("编辑表单")]
|
||||||
|
EditForm = 4,
|
||||||
|
|
||||||
|
/// <summary>搜索</summary>
|
||||||
|
[Description("搜索")]
|
||||||
|
Search = 5,
|
||||||
|
}
|
Loading…
Reference in New Issue