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 { public PathInfoViewModel(IBasePathInfoService service) : base(service) { PageTitle = "路径信息管理"; } public override List 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>? 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(); }