Former-commit-id: 33ef90576a2b54380579207619cf978ccd082610
TangShanKaiPing
wanggang 6 years ago
parent 1a7748fdef
commit d6d131918f

@ -19,10 +19,10 @@
<img src="/images/temperature.png" style="width:48px;height:48px;margin:20px;" />
</div>
<div class="col-md-4" style="height:88px;">
<h3 style="line-height:88px;margin:0;">{{GetData('温度','Description')}}</h3>
<h3 style="line-height:88px;margin:0;">{{GetData('温湿度传感器',null,null,'温度','Description')}}</h3>
</div>
<div class="col-md-4" style="height:88px;">
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">温度:{{GetData('温度','Value') }} {{GetData('温度','Unit')}}</span>
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">温度:{{GetData('温湿度传感器',null,null,'温度','Value')}}{{ GetData('温湿度传感器',null,null,'温度','Unit')}}</span>
</div>
</div>
</div>
@ -34,10 +34,10 @@
<img src="/images/humidity.png" style="width:48px;height:48px;margin:20px;" />
</div>
<div class="col-md-4" style="height:88px;">
<h3 style="line-height:88px;margin:0;">{{GetData('湿度','Description')}}</h3>
<h3 style="line-height:88px;margin:0;">{{GetData('温湿度传感器',null,null,'湿度','Description')}}</h3>
</div>
<div class="col-md-4" style="height:88px;">
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">湿度:{{GetData('湿度','Value') }} {{GetData('湿度','Unit')}}</span>
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">湿度:{{GetData('温湿度传感器',null,null,'湿度','Value')}}{{ GetData('湿度传感器',null,null,'温度','Unit')}}</span>
</div>
</div>
</div>
@ -51,10 +51,10 @@
<img src="/images/light.png" style="width:48px;height:48px;margin:20px;" />
</div>
<div class="col-md-4" style="height:88px;">
<h3 style="line-height:88px;margin:0;">{{GetDataByTag('前门','光照度','Description')}}</h3>
<h3 style="line-height:88px;margin:0;">{{GetData('光强检测器',null,'前门','光照度','Description')}}</h3>
</div>
<div class="col-md-4" style="height:88px;">
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">前门光照:{{GetDataByTag('前门','光照度','Value') }} {{GetDataByTag('前门','光照度','Unit')}}</span>
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">前门光照:{{GetData('光强检测器',null,'前门','光照度','Value')}}{{ GetData('光强检测器',null,'前门','光照度','Unit')}}</span>
</div>
</div>
</div>
@ -66,10 +66,10 @@
<img src="/images/light.png" style="width:48px;height:48px;margin:20px;" />
</div>
<div class="col-md-4" style="height:88px;">
<h3 style="line-height:88px;margin:0;">{{GetDataByTag('后门','光照度','Description')}}</h3>
<h3 style="line-height:88px;margin:0;">{{GetData('光强检测器',null,'后门','光照度','Description')}}</h3>
</div>
<div class="col-md-4" style="height:88px;">
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">后门光照:{{GetDataByTag('后门','光照度','Value') }} {{GetDataByTag('后门','光照度','Unit')}}</span>
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">后门光照:{{GetData('光强检测器',null,'后门','光照度','Value') }}{{ GetData('光强检测器',null,'后门','光照度','Value')}}</span>
</div>
</div>
</div>
@ -83,10 +83,10 @@
<img src="/images/person.png" style="width:48px;height:48px;margin:20px;" />
</div>
<div class="col-md-4" style="height:88px;">
<img src="/images/warn.png" style="width:36px;height:36px;margin:32px 0 0 0;" v-if="GetDataByTag('前门','状态','Value')==='警报'" />
<img src="/images/warn.png" style="width:36px;height:36px;margin:32px 0 0 0;" v-if="GetData('红外感应器',null,'前门','状态','Value')==='警报'" />
</div>
<div class="col-md-4" style="height:88px;">
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">前门人体:{{GetDataByTag('前门','状态','Value') }}</span>
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">前门人体:{{GetData('红外感应器',null,'前门','状态','Value') }}</span>
</div>
</div>
</div>
@ -98,10 +98,10 @@
<img src="/images/person.png" style="width:48px;height:48px;margin:20px;" />
</div>
<div class="col-md-4" style="height:88px;">
<img src="/images/warn.png" style="width:36px;height:36px;margin:32px 0 0 0;" v-if="GetDataByTag('后门','状态','Value')==='警报'" />
<img src="/images/warn.png" style="width:36px;height:36px;margin:32px 0 0 0;" v-if="GetData('红外感应器',null,'后门','状态','Value')==='警报'" />
</div>
<div class="col-md-4" style="height:88px;">
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">后门人体:{{GetDataByTag('后门','状态','Value') }}</span>
<span style="display:inline-block;position:absolute;right:20px;bottom:5px;white-space: nowrap;">后门人体:{{GetData('红外感应器',null,'后门','状态','Value') }}</span>
</div>
</div>
</div>
@ -527,22 +527,22 @@
});
},
methods: {
GetData(name, attr) {
var data = Enumerable
.from(vm.ViewModel.Devices)
.selectMany(function (o) { return o.Data; })
.where(function (o) { return o.Name === name; })
.firstOrDefault();
return data == null ? null : data[attr];
},
GetDataByTag(tag, name, attr) {
var data = Enumerable
.from(vm.ViewModel.Devices)
.where(function (o) { return o.Tag === tag; })
.selectMany(function (o) { return o.Data; })
.where(function (o) { return o.Name === name; })
.firstOrDefault();
return data == null ? null : data[attr];
GetData(deviceName, displayName, tag, dataName, attr) {
var query = Enumerable.from(vm.ViewModel.Devices).where(function (o) { return o.Name === deviceName; });
if (displayName != null) {
query = query.where(o => o.DisplayName === displayName);
}
if (tag != null) {
query = query.where(o => o.Tag === tag);
}
var device = query.firstOrDefault();
if (device) {
var data = Enumerable.from(device.Data).where(o => o.Name === dataName).firstOrDefault();
if (data != null) {
return data[attr];
}
}
return null;
},
GetCameras() {
return Enumerable

Loading…
Cancel
Save