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.Device; public class DeviceInfoViewModel : CrudPageViewModel { public DeviceInfoViewModel(IBaseDeviceInfoService service) : base(service) { PageTitle = "设备信息管理"; } public override List FieldConfigs => new() { new() { PropertyName = "deviceCode", DisplayName = "设备编号", IsRequired = true }, new() { PropertyName = "deviceName", DisplayName = "设备名称" }, new() { PropertyName = "deviceAlias", DisplayName = "设备别名" }, new() { PropertyName = "deviceSerialNo", DisplayName = "设备序号", FieldType = FieldType.Number }, new() { PropertyName = "deviceType", DisplayName = "设备类型", FieldType = FieldType.Number }, new() { PropertyName = "deviceStatus", DisplayName = "设备状态", FieldType = FieldType.Number }, new() { PropertyName = "hostCode", DisplayName = "主机编号", IsRequired = true }, new() { PropertyName = "isFlag", DisplayName = "启用", FieldType = FieldType.CheckBox }, new() { PropertyName = "remark", DisplayName = "备注" }, }; protected override Expression>? BuildSearchExpression(string search) => x => x.deviceCode.Contains(search) || (x.deviceName != null && x.deviceName.Contains(search)); public override Avalonia.Controls.Control CreateView() => new Sln.Wcs.UI.Views.Device.DeviceInfoListView(); }