Former-commit-id: 5424adf3ecd88a32e9493c32c86e46ac672c9d54
Former-commit-id: f78173802124e52d36b84a9e189d5b0fb1a66ec3
1.0
wanggang 5 years ago
parent bad856647d
commit e0b9665866

@ -13,17 +13,17 @@ namespace IoT.Shared.Application.Models
[ReadOnlyForEdit]
[Display(Name = "产品")]
[SelectList]
public Guid? ProductId { get; set; }
public Guid? IoTProductId { get; set; }
[Display(Name = "网关")]
[ReadOnlyForEdit]
[SelectList(nameof(DeviceId), nameof(AjaxBaseController.GetIoTDevice))]
[SelectList(nameof(IoTDeviceId), nameof(AjaxBaseController.GetIoTDevice))]
public Guid? IoTGatewayId { get; set; }
[Display(Name = "设备")]
[ReadOnlyForEdit]
[SelectList]
public Guid? DeviceId { get; set; }
public Guid? IoTDeviceId { get; set; }
[Display(Name = "键")]
[ReadOnlyForEdit]

@ -36,9 +36,9 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
public override IQueryable<IoTData> Query(PagedListModel<EditIoTDataModel> model, IQueryable<IoTData> query)
{
return query
.WhereIf(model.Query.ProductId.HasValue, o => o.IoTDevice.IoTProductId == model.Query.ProductId.Value)
.WhereIf(model.Query.IoTProductId.HasValue, o => o.IoTDevice.IoTProductId == model.Query.IoTProductId.Value)
.WhereIf(model.Query.IoTGatewayId.HasValue, o => o.IoTDevice.IoTGatewayId == model.Query.IoTGatewayId.Value)
.WhereIf(model.Query.DeviceId.HasValue, o => o.IoTDeviceId == model.Query.DeviceId.Value)
.WhereIf(model.Query.IoTDeviceId.HasValue, o => o.IoTDeviceId == model.Query.IoTDeviceId.Value)
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
.WhereIf(!string.IsNullOrEmpty(model.Query.Key), o => o.Key.Contains(model.Query.Key))
.WhereIf(!string.IsNullOrEmpty(model.Query.Value), o => o.Value.Contains(model.Query.Value))
@ -54,16 +54,16 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
{
if(entity!=null)
{
model.ProductId = entity.IoTDevice.IoTProductId;
model.IoTProductId = entity.IoTDevice.IoTProductId;
model.IoTGatewayId = entity.IoTDevice.IoTGatewayId;
}
if(model.ProductId.HasValue)
if(model.IoTProductId.HasValue)
{
ViewData.Add(model.ProductId, entity.IoTDevice.IoTProduct.Name);
ViewData.Add(model.IoTProductId, entity.IoTDevice.IoTProduct.Name);
}
if(model.DeviceId.HasValue)
if(model.IoTDeviceId.HasValue)
{
ViewData.Add(model.DeviceId, entity.IoTDevice.Name);
ViewData.Add(model.IoTDeviceId, entity.IoTDevice.Name);
}
if(model.IoTGatewayId.HasValue)
{
@ -74,11 +74,11 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
public override void ToEditModel(IoTData entity, EditIoTDataModel model)
{
model.IoTGatewayId = entity?.IoTDevice?.IoTGatewayId;
ViewData.SelectList(o => model.ProductId, () => this._ajax.GetIoTProduct(model.ProductId).SelectList());
ViewData.SelectList(o => model.IoTProductId, () => this._ajax.GetIoTProduct(model.IoTProductId).SelectList());
ViewData.SelectList(o => model.IoTGatewayId, () => this._ajax.GetIoTGateway(model.IoTGatewayId).SelectList());
if (model.IoTGatewayId.HasValue)
{
ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetIoTDevice(model.IoTGatewayId.Value, model.DeviceId).SelectList());
ViewData.SelectList(o => model.IoTDeviceId, () => this._ajax.GetIoTDevice(model.IoTGatewayId.Value, model.IoTDeviceId).SelectList());
}
}
}

@ -20,7 +20,7 @@ namespace Platform.Application.Models.IoTCenter
[Display(Name = "分类")]
[ReadOnlyForEdit]
[SelectList(nameof(ProductId), nameof(AjaxController.GetIoTProductByCategory))]
[SelectList(nameof(IoTProductId), nameof(AjaxController.GetIoTProductByCategory))]
public Guid? CategoryId { get; set; }
}
}

@ -61,8 +61,8 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
.WhereIf(model.Query.BuildingId.HasValue, o => o.IoTDevice.IoTGateway.BuildingId == model.Query.BuildingId.Value)
.WhereIf(model.Query.IoTGatewayId.HasValue, o => o.IoTDevice.IoTGatewayId == model.Query.IoTGatewayId.Value)
.WhereIf(model.Query.CategoryId.HasValue, o => o.IoTDevice.IoTProduct.IoTProductCategoryId == model.Query.CategoryId.Value)
.WhereIf(model.Query.ProductId.HasValue, o => o.IoTDevice.IoTProductId == model.Query.ProductId.Value)
.WhereIf(model.Query.DeviceId.HasValue, o => o.IoTDeviceId == model.Query.DeviceId.Value)
.WhereIf(model.Query.IoTProductId.HasValue, o => o.IoTDevice.IoTProductId == model.Query.IoTProductId.Value)
.WhereIf(model.Query.IoTDeviceId.HasValue, o => o.IoTDeviceId == model.Query.IoTDeviceId.Value)
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
.WhereIf(!string.IsNullOrEmpty(model.Query.Key), o => o.Key.Contains(model.Query.Key))
.WhereIf(!string.IsNullOrEmpty(model.Query.Value), o => o.Value.Contains(model.Query.Value))
@ -76,7 +76,7 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
public override void EntityToModel(IoTData entity, EditPlatformIoTDataModel model)
{
model.ProductId = entity.IoTDevice?.IoTProductId;
model.IoTProductId = entity.IoTDevice?.IoTProductId;
model.CategoryId = entity.IoTDevice?.IoTProduct?.IoTProductCategoryId;
model.IoTGatewayId = entity.IoTDevice?.IoTGatewayId;
model.BuildingId = entity.IoTDevice?.IoTGateway?.BuildingId;
@ -105,9 +105,9 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
.FirstOrDefault(o => o.Id == entity.IoTDevice.IoTGateway.Building.OrganId)?.GetDisplayName();
ViewData.Add(model.OrganId, name);
}
if (model.ProductId.HasValue)
if (model.IoTProductId.HasValue)
{
ViewData.Add(model.ProductId, entity.IoTDevice.IoTProduct.Name);
ViewData.Add(model.IoTProductId, entity.IoTDevice.IoTProduct.Name);
}
if (model.CategoryId.HasValue)
{
@ -119,9 +119,9 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
.FirstOrDefault(o => o.Id == model.CategoryId.Value)?.GetDisplayName();
ViewData.Add(model.CategoryId, name);
}
if (model.DeviceId.HasValue)
if (model.IoTDeviceId.HasValue)
{
ViewData.Add(model.DeviceId, entity.IoTDevice.Name);
ViewData.Add(model.IoTDeviceId, entity.IoTDevice.Name);
}
if (model.IoTGatewayId.HasValue)
{
@ -134,9 +134,9 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
ViewData.SelectList(o => model.OrganId, () => this._ajax.GetOrgan(model.OrganId).SelectList());
ViewData.SelectList(o => model.BuildingId, () => this._ajax.GetBuilding(model.OrganId.Value, model.BuildingId).SelectList(), model.OrganId.HasValue);
ViewData.SelectList(o => model.IoTGatewayId, () => this._ajax.GetIoTGatewayByBuilding(model.BuildingId.Value, model.IoTGatewayId).SelectList(), model.BuildingId.HasValue);
ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetIoTDevice(model.IoTGatewayId.Value, model.DeviceId).SelectList(), model.IoTGatewayId.HasValue);
ViewData.SelectList(o => model.IoTDeviceId, () => this._ajax.GetIoTDevice(model.IoTGatewayId.Value, model.IoTDeviceId).SelectList(), model.IoTGatewayId.HasValue);
ViewData.SelectList(o => model.CategoryId, () => this._ajax.GetIoTProductCategory(model.CategoryId).SelectList());
ViewData.SelectList(o => model.ProductId, () => this._ajax.GetIoTProductByCategory(model.CategoryId.Value, model.ProductId).SelectList(), model.CategoryId.HasValue);
ViewData.SelectList(o => model.IoTProductId, () => this._ajax.GetIoTProductByCategory(model.CategoryId.Value, model.IoTProductId).SelectList(), model.CategoryId.HasValue);
}
public override string GetNodeNumber(EditPlatformIoTDataModel model)

Loading…
Cancel
Save