|
|
@model List<FBeeDevice>
|
|
|
@{
|
|
|
this.HtmlTitle = "设备列表";
|
|
|
var index = 0;
|
|
|
}
|
|
|
<div class="box">
|
|
|
<table class="table table-bordered">
|
|
|
<tr>
|
|
|
<th></th>
|
|
|
<th>IEEE地址</th>
|
|
|
<th>地址</th>
|
|
|
<th>名称</th>
|
|
|
<th>电压</th>
|
|
|
<th>电量</th>
|
|
|
<th>在线状态</th>
|
|
|
<th>设备状态</th>
|
|
|
<th>操作</th>
|
|
|
<th>删除</th>
|
|
|
</tr>
|
|
|
@foreach (var item in Model)
|
|
|
{
|
|
|
<tr>
|
|
|
<th>@(++index)</th>
|
|
|
<td>@item.IEEE</td>
|
|
|
<td>@item.Address</td>
|
|
|
<td>@item.Name</td>
|
|
|
<td>@item.Voltage</td>
|
|
|
<td>@item.Battery</td>
|
|
|
<td><input type="checkbox" readonly disabled @Html.Raw(item.IsOnline.Equals(0) ? "" : "checked") /></td>
|
|
|
<td>
|
|
|
@if (new int[] { 0x0002, 0x0009, 0x0081, 0x0202, 0x0220, 0x0051 }.Contains(item.DeviceId))
|
|
|
{
|
|
|
if (item.SwitchState == 0)
|
|
|
{
|
|
|
<text>关</text>
|
|
|
}
|
|
|
else if (item.SwitchState == 1)
|
|
|
{
|
|
|
<text>开</text>
|
|
|
}
|
|
|
else if (item.SwitchState == 2)
|
|
|
{
|
|
|
<text>停</text>
|
|
|
}
|
|
|
}
|
|
|
@if (item.DeviceId == 0x0106)
|
|
|
{
|
|
|
<text>@item.Light</text>
|
|
|
}
|
|
|
else if (item.DeviceId == 0x0402)
|
|
|
{
|
|
|
<span>@(item.IsWarning ? "报警" : "正常")</span>
|
|
|
}
|
|
|
else if (item.DeviceId == 0x0309)
|
|
|
{
|
|
|
<span>温度:@item.Temperature</span>
|
|
|
<span>湿度:@item.Humidity</span>
|
|
|
<span>PM 1.0:@item.PM10</span>
|
|
|
<span>PM 2.5:@item.PM25</span>
|
|
|
<span>PM 10:@item.PM100</span>
|
|
|
}
|
|
|
else if (item.DeviceId == 0x0220)
|
|
|
{
|
|
|
<span>亮度:@item.Brightness</span>
|
|
|
<span>色调:@item.Hue </span>
|
|
|
<span>饱和度:@item.Saturation</span>
|
|
|
<span>色温:@item.ColorTemperature</span>
|
|
|
}
|
|
|
else if (item.DeviceId == 0x0163)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(item.IRVersion))
|
|
|
{
|
|
|
<span>版本:@item.IRVersion</span>
|
|
|
}
|
|
|
}
|
|
|
</td>
|
|
|
<td>
|
|
|
@if (new int[] { 0x0002, 0x0009, 0x0081, 0x0202, 0x0220, 0x0051 }.Contains(item.DeviceId))
|
|
|
{
|
|
|
<a class="btn btn-primary cmd" href="/api/x82?sn=@item.Sn&ieee=@item.IEEE&status=1">开</a>
|
|
|
<a class="btn btn-primary cmd" href="/api/x82?sn=@item.Sn&ieee=@item.IEEE&status=0">关</a>
|
|
|
}
|
|
|
@if (item.DeviceId == 0x0202)
|
|
|
{
|
|
|
<a class="btn btn-primary cmd" href="/api/x82?sn=@item.Sn&ieee=@item.IEEE&status=2">停</a>
|
|
|
}
|
|
|
@if (item.DeviceId == 0x0163)
|
|
|
{
|
|
|
<a class="btn btn-primary cmd" href="/ir/version?sn=@item.Sn&id=@item.IEEE">版本</a>
|
|
|
}
|
|
|
@if (item.DeviceId == 0x0220)
|
|
|
{
|
|
|
<form action="/colorlight/23setbrightness">
|
|
|
<input type="hidden" name="sn" value="@item.Sn" />
|
|
|
<input type="hidden" name="id" value="@item.IEEE" />
|
|
|
<label>亮度:<input name="Brightness" type="range" step="1" min="0" max="255" value="@item.Brightness" class="ajax" /></label>
|
|
|
</form>
|
|
|
<form action="/colorlight/24setcolor">
|
|
|
<input type="hidden" name="sn" value="@item.Sn" />
|
|
|
<input type="hidden" name="id" value="@item.IEEE" />
|
|
|
<label>色度:<input name="Hue" type="range" step="1" min="0" max="255" value="@item.Hue" class="ajax" /></label>
|
|
|
<label>饱和度:<input name="Saturation" type="range" step="1" min="0" max="255" value="@item.Saturation" class="ajax" /></label>
|
|
|
</form>
|
|
|
<form action="/colorlight/25setcolortemperature">
|
|
|
<input type="hidden" name="sn" value="@item.Sn" />
|
|
|
<input type="hidden" name="id" value="@item.IEEE" />
|
|
|
<label>色温:<input name="ColorTemperature" type="range" step="1" min="2700" max="6500" value="@item.ColorTemperature" class="ajax" /></label>
|
|
|
</form>
|
|
|
}
|
|
|
</td>
|
|
|
<td><a class="btn btn-primary cmd" href="/api/x95?sn=@item.Sn&ieee=@item.IEEE">删除设备</a></td>
|
|
|
</tr>
|
|
|
}
|
|
|
</table>
|
|
|
</div>
|
|
|
@section scripts{
|
|
|
<script>
|
|
|
$('body').on('change', '.ajax', function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var url = form.attr('action') + '?' + form.serialize();
|
|
|
$.getJSON(url, function (response) {
|
|
|
console.log(response);
|
|
|
}).fail(function (jqxhr, textStatus, error) {
|
|
|
var err = textStatus + ", " + error;
|
|
|
alert(err);
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
</script>
|
|
|
} |