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 DeviceParamViewModel : CrudPageViewModel { public DeviceParamViewModel(IBaseDeviceParamService service) : base(service) { PageTitle = "设备参数管理"; } public override List FieldConfigs => new() { new() { PropertyName = "paramCode", DisplayName = "参数编号", IsRequired = true }, new() { PropertyName = "deviceCode", DisplayName = "设备编号", IsRequired = true }, new() { PropertyName = "paramName", DisplayName = "参数名称" }, new() { PropertyName = "paramAddress", DisplayName = "参数地址" }, new() { PropertyName = "paramType", DisplayName = "参数类型" }, new() { PropertyName = "paramValue", DisplayName = "参数值", FieldType = FieldType.Number }, new() { PropertyName = "operationType", DisplayName = "操作类型" }, new() { PropertyName = "operationFrequency", DisplayName = "操作频率(ms)" }, new() { PropertyName = "isFlag", DisplayName = "启用", FieldType = FieldType.CheckBox }, new() { PropertyName = "remark", DisplayName = "备注" }, }; protected override Expression>? BuildSearchExpression(string search) => x => x.paramCode.Contains(search) || x.paramName.Contains(search); public override Avalonia.Controls.Control CreateView() => new Sln.Wcs.UI.Views.Device.DeviceParamListView(); }