空设备组支持删除

This commit is contained in:
王海东 2022-03-22 22:35:33 +08:00
parent e3ed081a59
commit bb28946f19
8 changed files with 17 additions and 6 deletions

View File

@ -135,7 +135,17 @@
"ProjectGuid": "89de240e-5393-4dd4-87c9-3ad9d44b6e7e", "ProjectGuid": "89de240e-5393-4dd4-87c9-3ad9d44b6e7e",
"DisplayName": "WalkingTec.Mvvm.Core", "DisplayName": "WalkingTec.Mvvm.Core",
"ColorIndex": 9 "ColorIndex": 9
},
"e63c22d5-5f9b-4671-b115-40721b27f09f": {
"ProjectGuid": "e63c22d5-5f9b-4671-b115-40721b27f09f",
"DisplayName": "IoTGateway.ViewModel",
"ColorIndex": 10
},
"44619988-9f09-4714-9532-a44faf8275fe": {
"ProjectGuid": "44619988-9f09-4714-9532-a44faf8275fe",
"DisplayName": "IoTGateway.Model",
"ColorIndex": 11
} }
}, },
"NextColorIndex": 10 "NextColorIndex": 12
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -29,7 +29,7 @@ namespace IoTGateway.Model
public ProtectTypeEnum ProtectType { get; set; } public ProtectTypeEnum ProtectType { get; set; }
public Device Device { get; set; } public Device Device { get; set; }
[Display(Name = "采集点")] [Display(Name = "设备")]
public Guid? DeviceId { get; set; } public Guid? DeviceId { get; set; }
} }
} }

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using WalkingTec.Mvvm.Core; using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions; using WalkingTec.Mvvm.Core.Extensions;
using IoTGateway.Model; using IoTGateway.Model;
using Microsoft.EntityFrameworkCore;
namespace IoTGateway.ViewModel.BasicData.DeviceVMs namespace IoTGateway.ViewModel.BasicData.DeviceVMs
{ {
@ -19,7 +20,7 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVMs
{ {
try try
{ {
var daps = DC.Set<Device>().Where(x => Ids.Contains(x.ID)).ToList(); var daps = DC.Set<Device>().Include(x => x.Children).Where(x => Ids.Contains(x.ID)).ToList();
foreach (var dap in daps) foreach (var dap in daps)
{ {
@ -28,9 +29,9 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVMs
deleteRet.Message = "采集点不存在,可能已经被删除了"; deleteRet.Message = "采集点不存在,可能已经被删除了";
return deleteRet; return deleteRet;
} }
else if (dap.DeviceTypeEnum == DeviceTypeEnum.Group) else if (dap.DeviceTypeEnum == DeviceTypeEnum.Group && dap.Children.Count() != 0)
{ {
deleteRet.Message = "有风险,暂不支持组删除"; deleteRet.Message = "组内还有设备,暂不支持组删除";
return deleteRet; return deleteRet;
} }
else else

View File

@ -3,11 +3,11 @@
<wt:form vm="@Model"> <wt:form vm="@Model">
<wt:row items-per-row="ItemsPerRowEnum.Two"> <wt:row items-per-row="ItemsPerRowEnum.Two">
<wt:combobox field="Entity.DeviceId" items="AllDevices"/>
<wt:textbox field="Entity.DeviceConfigName" /> <wt:textbox field="Entity.DeviceConfigName" />
<wt:textbox field="Entity.Description" /> <wt:textbox field="Entity.Description" />
<wt:textbox field="Entity.Value" /> <wt:textbox field="Entity.Value" />
<wt:textbox field="Entity.EnumInfo" /> <wt:textbox field="Entity.EnumInfo" />
<wt:combobox field="Entity.DeviceId" items="AllDevices"/>
</wt:row> </wt:row>
<wt:row align="AlignEnum.Right"> <wt:row align="AlignEnum.Right">
<wt:submitbutton /> <wt:submitbutton />