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 DeviceHostViewModel : CrudPageViewModel { public DeviceHostViewModel(IBaseDeviceHostService service) : base(service) { PageTitle = "设备主机管理"; System.Console.WriteLine("[VM] DeviceHostViewModel 构造, service 类型: " + service.GetType().FullName); } public override List FieldConfigs => new() { new() { PropertyName = "hostCode", DisplayName = "主机编号", IsRequired = true }, new() { PropertyName = "hostName", DisplayName = "主机名称" }, new() { PropertyName = "hostType", DisplayName = "主机类型", FieldType = FieldType.Number }, new() { PropertyName = "hostIP", DisplayName = "主机IP" }, new() { PropertyName = "hostPort", DisplayName = "主机端口", FieldType = FieldType.Number }, new() { PropertyName = "hostPath", DisplayName = "主机路径" }, new() { PropertyName = "isFlag", DisplayName = "启用", FieldType = FieldType.CheckBox }, new() { PropertyName = "remark", DisplayName = "备注" }, }; protected override Expression>? BuildSearchExpression(string search) => x => x.hostCode.Contains(search) || x.hostName.Contains(search); public override Avalonia.Controls.Control CreateView() => new Sln.Wcs.UI.Views.Device.DeviceHostListView(); }