You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.5 KiB
C#

using System.Collections.Generic;
using System.Linq.Expressions;
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service;
using Sln.Wcs.UI.ViewModels.Base;
namespace Sln.Wcs.UI.ViewModels.Path;
public class PathInfoViewModel : CrudPageViewModel<BasePathInfo>
{
public PathInfoViewModel(IBasePathInfoService service) : base(service)
{
PageTitle = "路径信息管理";
}
public override List<FieldConfig> FieldConfigs => new()
{
new() { PropertyName = "pathCode", DisplayName = "路径编号" },
new() { PropertyName = "pathName", DisplayName = "路径名称" },
new() { PropertyName = "pathType", DisplayName = "路径类型", FieldType = FieldType.Number },
new() { PropertyName = "pathCategory", DisplayName = "路径类别", FieldType = FieldType.Number },
new() { PropertyName = "startPoint", DisplayName = "起点" },
new() { PropertyName = "endPoint", DisplayName = "终点" },
new() { PropertyName = "isFlag", DisplayName = "启用", FieldType = FieldType.CheckBox },
new() { PropertyName = "remark", DisplayName = "备注" },
};
protected override Expression<Func<BasePathInfo, bool>>? BuildSearchExpression(string search)
=> x => (x.pathCode != null && x.pathCode.Contains(search))
|| (x.pathName != null && x.pathName.Contains(search));
public override Avalonia.Controls.Control CreateView() => new Sln.Wcs.UI.Views.Path.PathInfoListView();
}