|
|
|
@ -1,28 +1,6 @@
|
|
|
|
|
@model Platform.ViewModels.HomeModel
|
|
|
|
|
@{
|
|
|
|
|
HideBread = true;
|
|
|
|
|
|
|
|
|
|
var lightList = Model.Deviceses.SelectMany(o => o.Data).Where(o => o.Key == "Light")
|
|
|
|
|
.Select(o => string.IsNullOrEmpty(o.Value) ? 0 : int.Parse(o.Value))
|
|
|
|
|
.ToList();
|
|
|
|
|
var maxLight = lightList.Any() ? new Nullable<int>(lightList.Max()) : null;
|
|
|
|
|
var minLight = lightList.Any() ? new Nullable<int>(lightList.Min()) : null;
|
|
|
|
|
|
|
|
|
|
var temperatureList = Model.Deviceses.SelectMany(o => o.Data).Where(o => o.Key == "Temperature")
|
|
|
|
|
.Select(o => string.IsNullOrEmpty(o.Value) ? 0 : float.Parse(o.Value))
|
|
|
|
|
.ToList();
|
|
|
|
|
var maxTemperature = temperatureList.Any() ? new Nullable<float>(temperatureList.Max()) : null;
|
|
|
|
|
var minTemperature = temperatureList.Any() ? new Nullable<float>(temperatureList.Min()) : null;
|
|
|
|
|
|
|
|
|
|
var humidityList = Model.Deviceses.SelectMany(o => o.Data).Where(o => o.Key == "Humidity")
|
|
|
|
|
.Select(o => string.IsNullOrEmpty(o.Value) ? 0 : float.Parse(o.Value))
|
|
|
|
|
.ToList();
|
|
|
|
|
var maxHumidity = humidityList.Any() ? new Nullable<float>(humidityList.Max()) : null;
|
|
|
|
|
var minHhumidity = humidityList.Any() ? new Nullable<float>(humidityList.Min()) : null;
|
|
|
|
|
|
|
|
|
|
var elist = Model.Deviceses.Where(o => o.Name.Contains("开关") || o.Name.Contains("插座"));
|
|
|
|
|
var open = elist.Any() ? new Nullable<int>(elist.Where(o => o.Data.Any(o => o.Key == "State" && o.Value == "开")).Count()) : null;
|
|
|
|
|
var close = elist.Any() ? new Nullable<int>(elist.Where(o => o.Data.Any(o => o.Key == "State" && o.Value == "关")).Count()) : null;
|
|
|
|
|
}
|
|
|
|
|
<br />
|
|
|
|
|
<div class="row">
|
|
|
|
@ -51,7 +29,6 @@
|
|
|
|
|
<text> / @Model.Building.GetDisplayName()</text>
|
|
|
|
|
}
|
|
|
|
|
</h5>
|
|
|
|
|
<div class="card-tools"><label style="margin:0;">下级:@Html.CheckBoxFor(o => o.ShowAll)</label></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="row">
|
|
|
|
@ -62,8 +39,8 @@
|
|
|
|
|
光照
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>最大值:@(maxLight.HasValue?$"{maxLight.Value.ToString("f2")} Lux":"无设备")</p>
|
|
|
|
|
<p>最小值:@(minLight.HasValue?$"{minLight.Value.ToString("f2")} Lux":"无设备")</p>
|
|
|
|
|
<p>最大值:@(Model.MaxLight.HasValue?$"{Model.MaxLight.Value} Lux":"无设备")</p>
|
|
|
|
|
<p>最小值:@(Model.MinLight.HasValue?$"{Model.MinLight.Value} Lux":"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
@ -73,8 +50,8 @@
|
|
|
|
|
温度
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>最大值:@(maxTemperature.HasValue?$"{maxTemperature.Value.ToString("f2")} ℃":"无设备")</p>
|
|
|
|
|
<p>最小值:@(minTemperature.HasValue?$"{minTemperature.Value.ToString("f2")} ℃":"无设备")</p>
|
|
|
|
|
<p>最大值:@(Model.MaxTemperatures.HasValue?$"{Model.MaxTemperatures.Value.ToString("f2")} ℃":"无设备")</p>
|
|
|
|
|
<p>最小值:@(Model.MinTemperaturest.HasValue?$"{Model.MinTemperaturest.Value.ToString("f2")} ℃":"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
@ -84,8 +61,8 @@
|
|
|
|
|
湿度
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>最大值:@(maxTemperature.HasValue?$"{maxTemperature.Value.ToString("f2")} RH%" :"无设备")</p>
|
|
|
|
|
<p>最小值:@(minTemperature.HasValue?$"{minTemperature.Value.ToString("f2")} RH%" :"无设备")</p>
|
|
|
|
|
<p>最大值:@(Model.MaxHumidity.HasValue?$"{Model.MaxHumidity.Value.ToString("f2")} RH%" :"无设备")</p>
|
|
|
|
|
<p>最小值:@(Model.MinHumidity.HasValue?$"{Model.MinHumidity.Value.ToString("f2")} RH%" :"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
@ -95,8 +72,8 @@
|
|
|
|
|
用电
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>开:@(open.HasValue?$"{maxTemperature.Value}":"无设备")</p>
|
|
|
|
|
<p>关:@(close.HasValue?$"{minTemperature.Value}":"无设备")</p>
|
|
|
|
|
<p>开:@(Model.Open.HasValue?$"{Model.Open.Value}":"无设备")</p>
|
|
|
|
|
<p>关:@(Model.Close.HasValue?$"{Model.Close.Value}":"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -105,20 +82,17 @@
|
|
|
|
|
@if (Model.Scenes.Any())
|
|
|
|
|
{
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-header">场景</div>
|
|
|
|
|
<div class="card-header">当前建筑场景</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="row">
|
|
|
|
|
@foreach (var item in Model.Scenes)
|
|
|
|
|
{
|
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
<div class="info-box bg-gray ">
|
|
|
|
|
<span class="info-box-icon bg-white elevation-1"><img src="@Url.Content2(item.Image)" /></span>
|
|
|
|
|
<div class="info-box-content">
|
|
|
|
|
<span class="info-box-text">@item.Name</span>
|
|
|
|
|
<span class="info-box-number">
|
|
|
|
|
@Model.Building?.GetDisplayName()
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-1">
|
|
|
|
|
<div class="card bg-gray p-2">
|
|
|
|
|
<a class="card-body text-center" href="#" style="padding:0;">
|
|
|
|
|
<img class="card-img-top" src="@Url.Content2(item.Image)" alt="@item.Name">
|
|
|
|
|
<div>@item.Name</div>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -128,40 +102,59 @@
|
|
|
|
|
}
|
|
|
|
|
@if (Model.Buildings.Any())
|
|
|
|
|
{<div class="card">
|
|
|
|
|
<div class="card-header">建筑</div>
|
|
|
|
|
<div class="card-header">下级建筑</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="row">
|
|
|
|
|
@foreach (var item in Model.Buildings)
|
|
|
|
|
{
|
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
<a href="@Url.Action(null,null,new { buildingId = item.Id})">机构建筑:@item.Name</a>
|
|
|
|
|
<div class="card bg-gray">
|
|
|
|
|
<div class="card-body bg-gray text-center">
|
|
|
|
|
<img class="card-img-top" src="@Url.Content2(item.Image)" alt="@item.Name">
|
|
|
|
|
@*<div class="row">
|
|
|
|
|
<div class="col-sm-3"></div>
|
|
|
|
|
</div>*@
|
|
|
|
|
<a href="@Url.Action(null,null,new { buildingId = item.Id})">@item.Name</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
@if (Model.Deviceses.Any())
|
|
|
|
|
{<div class="card">
|
|
|
|
|
<div class="card-header">设备</div>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<h5 class="card-title">设备</h5>
|
|
|
|
|
<div class="card-tools">
|
|
|
|
|
<label style="margin:0;">
|
|
|
|
|
全部:@Html.CheckBoxFor(o => o.ShowAll, new { style = "width:20px;height:20px;vertical-align:bottom;margin-right:10px;" })
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@if (Model.Deviceses.Any())
|
|
|
|
|
{
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div>
|
|
|
|
|
<h2>此处分页显示设备,设备带快捷操作</h2>
|
|
|
|
|
<div class="row">
|
|
|
|
|
@foreach (var item in Model.Deviceses)
|
|
|
|
|
{
|
|
|
|
|
<div>
|
|
|
|
|
<a href="@Url.Action(null,null,new { buildingId = item.Id})">设备:@item.Name</a>
|
|
|
|
|
</div>
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
@await Html.PartialAsync($"/Views/Shared/Device/{item.Icon}.cshtml", item)
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
@Html.Raw(ex.Message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
@(await Html.PartialAsync("_Paged"))
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (Model.PageCount() > 1)
|
|
|
|
|
{
|
|
|
|
|
<div class="card-footer">@(await Html.PartialAsync("_Paged"))</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|