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.Base; public class MaterialInfoViewModel : CrudPageViewModel { public MaterialInfoViewModel(IBaseMaterialInfoService service) : base(service) { PageTitle = "物料信息管理"; } public override List FieldConfigs => new() { new() { PropertyName = "materialCode", DisplayName = "物料编号", IsRequired = true }, new() { PropertyName = "materialName", DisplayName = "物料名称" }, new() { PropertyName = "materialType", DisplayName = "物料类型" }, new() { PropertyName = "materialBarcode", DisplayName = "物料条码" }, new() { PropertyName = "minStorageCycle", DisplayName = "最短存放周期", FieldType = FieldType.Number }, new() { PropertyName = "maxStorageCycle", DisplayName = "最长存放周期", FieldType = FieldType.Number }, new() { PropertyName = "isFlag", DisplayName = "启用", FieldType = FieldType.CheckBox }, new() { PropertyName = "remark", DisplayName = "备注" }, }; protected override Expression>? BuildSearchExpression(string search) => x => x.materialCode.Contains(search) || (x.materialName != null && x.materialName.Contains(search)); public override Avalonia.Controls.Control CreateView() => new Sln.Wcs.UI.Views.Base.MaterialInfoListView(); }