You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/IoTNode/Views/Home/Index.cshtml

60 lines
2.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

@model Node
@{
HtmlTitle = "设备";
var index = 0;
}
<div class="row">
@Model.Name:@Model.Number<a class="btn btn-info btn-sm" href="@Url.Action("Upload","Home")">上传数据</a>
</div>
<div class="row">
<table class="table">
<tr>
<td>#</td>
<td>产品</td>
<td>设备</td>
<td>显示名称</td>
<td>在线</td>
<td>操作</td>
</tr>
@foreach (var item in Model.Devices)
{
<tr>
<td>@(++index)</td>
<td>@item.Product.Number@item.Product.Name</td>
<td>@item.Number@item.Name</td>
<td>@item.DisplayName</td>
<td>@Html.DisplayFor(o => item.IsOnline)</td>
<td>
@if (item.Product.Number.Contains("fbee") && !item.Product.Number.Contains("gateway"))
{
var values = item.Number.Split('-');
var gateway = values[0];
var number = values[1];
<a class="api ajax btn btn-info btn-sm" href="@Url.Action("X95","Gateway",new { gateway = gateway,number=number})" data-number="@item.Number">从网关移除</a>
}
else if (item.Product.Name == "摄像头")
{
<a class="api ajax btn btn-info btn-sm" href="@Url.Action("StartPush","Onvif",new {number=item.Number})" data-number="@item.Number">开始推流</a>
<a class="api ajax btn btn-info btn-sm" href="@Url.Action("StopPush","Onvif",new {number=item.Number})" data-number="@item.Number">停止推流</a>
}
else if (item.Product.Number.Contains("gateway"))
{
<a class="api ajax btn btn-info btn-sm" href="@Url.Action("X95","Gateway",new { number=item.Number})" data-number="@item.Number">查询网关设备</a>
}
</td>
</tr>
}
</table>
</div>
@section scripts{
<script>
$('a.ajax.api').click(function () {
if (confirm('确认操作编号为:' + $(this).attr('data-number') + '的设备吗?')) {
$.get($(this).attr('href'), function () {
window.location.href = window.location.href;
});
};
return false;
});
</script>
}