|
|
|
@ -1,6 +1,28 @@
|
|
|
|
|
@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">
|
|
|
|
@ -29,9 +51,55 @@
|
|
|
|
|
<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-header">
|
|
|
|
|
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div class="position-relative p-3 bg-gray">
|
|
|
|
|
<div class="ribbon-wrapper">
|
|
|
|
|
<div class="ribbon bg-primary">
|
|
|
|
|
光照
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>最大值:@(maxLight.HasValue?$"{maxLight.Value.ToString("f2")} Lux":"无设备")</p>
|
|
|
|
|
<p>最小值:@(minLight.HasValue?$"{minLight.Value.ToString("f2")} Lux":"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div class="position-relative p-3 bg-gray">
|
|
|
|
|
<div class="ribbon-wrapper">
|
|
|
|
|
<div class="ribbon bg-primary">
|
|
|
|
|
温度
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>最大值:@(maxTemperature.HasValue?$"{maxTemperature.Value.ToString("f2")} ℃":"无设备")</p>
|
|
|
|
|
<p>最小值:@(minTemperature.HasValue?$"{minTemperature.Value.ToString("f2")} ℃":"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div class="position-relative p-3 bg-gray">
|
|
|
|
|
<div class="ribbon-wrapper">
|
|
|
|
|
<div class="ribbon bg-primary">
|
|
|
|
|
湿度
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>最大值:@(maxTemperature.HasValue?$"{maxTemperature.Value.ToString("f2")} RH%" :"无设备")</p>
|
|
|
|
|
<p>最小值:@(minTemperature.HasValue?$"{minTemperature.Value.ToString("f2")} RH%" :"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
|
<div class="position-relative p-3 bg-gray">
|
|
|
|
|
<div class="ribbon-wrapper">
|
|
|
|
|
<div class="ribbon bg-primary">
|
|
|
|
|
用电
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>开:@(open.HasValue?$"{maxTemperature.Value}":"无设备")</p>
|
|
|
|
|
<p>关:@(close.HasValue?$"{minTemperature.Value}":"无设备")</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card">
|
|
|
|
@ -142,9 +210,14 @@
|
|
|
|
|
|
|
|
|
|
@section scripts{
|
|
|
|
|
<script>
|
|
|
|
|
$('#ShowAll').click(function () {
|
|
|
|
|
var url = new URI(window.location.href).removeSearch('showAll').addSearch('showAll', $('#ShowAll:checked').val() ? true : false);
|
|
|
|
|
window.location.href = url;
|
|
|
|
|
});
|
|
|
|
|
var tree = $('.jstree').on('changed.jstree', function (e, data) {
|
|
|
|
|
if (data.event) {
|
|
|
|
|
window.location.href = data.event.currentTarget.href;
|
|
|
|
|
var url = new URI(data.event.currentTarget.href).removeSearch('showAll').addSearch('showAll', $('#ShowAll:checked').val() ? true : false);
|
|
|
|
|
window.location.href = url;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var parents = data.instance.get_node(data.selected).parents;
|
|
|
|
|