You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.6 KiB
C#
35 lines
1.6 KiB
C#
|
2 days ago
|
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<BaseDeviceParam>
|
||
|
|
{
|
||
|
|
public DeviceParamViewModel(IBaseDeviceParamService service) : base(service)
|
||
|
|
{
|
||
|
|
PageTitle = "设备参数管理";
|
||
|
|
}
|
||
|
|
|
||
|
|
public override List<FieldConfig> 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<Func<BaseDeviceParam, bool>>? 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();
|
||
|
|
}
|