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;" /> <img src="/images/temperature.png" style="width:48px;height:48px;margin:20px;" />
</div> </div>
<div class="col-md-4" style="height:88px;"> <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>
<div class="col-md-4" style="height:88px;"> <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> </div>
</div> </div>
@ -34,10 +34,10 @@
<img src="/images/humidity.png" style="width:48px;height:48px;margin:20px;" /> <img src="/images/humidity.png" style="width:48px;height:48px;margin:20px;" />
</div> </div>
<div class="col-md-4" style="height:88px;"> <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>
<div class="col-md-4" style="height:88px;"> <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> </div>
</div> </div>
@ -51,10 +51,10 @@
<img src="/images/light.png" style="width:48px;height:48px;margin:20px;" /> <img src="/images/light.png" style="width:48px;height:48px;margin:20px;" />
</div> </div>
<div class="col-md-4" style="height:88px;"> <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>
<div class="col-md-4" style="height:88px;"> <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> </div>
</div> </div>
@ -66,10 +66,10 @@
<img src="/images/light.png" style="width:48px;height:48px;margin:20px;" /> <img src="/images/light.png" style="width:48px;height:48px;margin:20px;" />
</div> </div>
<div class="col-md-4" style="height:88px;"> <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>
<div class="col-md-4" style="height:88px;"> <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> </div>
</div> </div>
@ -83,10 +83,10 @@
<img src="/images/person.png" style="width:48px;height:48px;margin:20px;" /> <img src="/images/person.png" style="width:48px;height:48px;margin:20px;" />
</div> </div>
<div class="col-md-4" style="height:88px;"> <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>
<div class="col-md-4" style="height:88px;"> <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> </div>
</div> </div>
@ -98,10 +98,10 @@
<img src="/images/person.png" style="width:48px;height:48px;margin:20px;" /> <img src="/images/person.png" style="width:48px;height:48px;margin:20px;" />
</div> </div>
<div class="col-md-4" style="height:88px;"> <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>
<div class="col-md-4" style="height:88px;"> <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> </div>
</div> </div>
@ -527,22 +527,22 @@
}); });
}, },
methods: { methods: {
GetData(name, attr) { GetData(deviceName, displayName, tag, dataName, attr) {
var data = Enumerable var query = Enumerable.from(vm.ViewModel.Devices).where(function (o) { return o.Name === deviceName; });
.from(vm.ViewModel.Devices) if (displayName != null) {
.selectMany(function (o) { return o.Data; }) query = query.where(o => o.DisplayName === displayName);
.where(function (o) { return o.Name === name; }) }
.firstOrDefault(); if (tag != null) {
return data == null ? null : data[attr]; query = query.where(o => o.Tag === tag);
}, }
GetDataByTag(tag, name, attr) { var device = query.firstOrDefault();
var data = Enumerable if (device) {
.from(vm.ViewModel.Devices) var data = Enumerable.from(device.Data).where(o => o.Name === dataName).firstOrDefault();
.where(function (o) { return o.Tag === tag; }) if (data != null) {
.selectMany(function (o) { return o.Data; }) return data[attr];
.where(function (o) { return o.Name === name; }) }
.firstOrDefault(); }
return data == null ? null : data[attr]; return null;
}, },
GetCameras() { GetCameras() {
return Enumerable return Enumerable

Loading…
Cancel
Save