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.
33 lines
1.4 KiB
C#
33 lines
1.4 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 DeviceHostViewModel : CrudPageViewModel<BaseDeviceHost>
|
||
|
|
{
|
||
|
|
public DeviceHostViewModel(IBaseDeviceHostService service) : base(service)
|
||
|
|
{
|
||
|
|
PageTitle = "设备主机管理";
|
||
|
|
}
|
||
|
|
|
||
|
|
public override List<FieldConfig> 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<Func<BaseDeviceHost, bool>>? 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();
|
||
|
|
}
|