宠物笼设备

This commit is contained in:
易焱
2021-01-06 23:38:23 +08:00
parent 956227c10c
commit 665ba949a6
8 changed files with 362 additions and 90 deletions
@@ -73,6 +73,28 @@
jAlert('绑定失败或出错啦!', '提示');
}
$("#bindDeviceModalBtn").attr("disabled",false);
});
//绑定设备
$("#bindPetDeviceBtn").click(function(){
$("#bindPetDeviceModal").modal("show");
});
$("#bindPetDeviceModalBtn").click(function(){
if($("#petMacAddress").val()==""){
jAlert("设备Mac不能为空", '提示');
return false;
}
$("#bindPetDeviceModalBtn").attr("disabled",true);
$('#form-bindPetDevice').submit();
});
$('#form-bindPetDevice').ajaxForm(function(data){
if(data==true){
location.reload();
jAlert('绑定成功', '提示');
}
else{
jAlert('绑定失败或出错啦!', '提示');
}
$("#bindPetDeviceModalBtn").attr("disabled",false);
});
//绑定摄像头
$("#bindCameraBtn").click(function(){
@@ -125,10 +147,14 @@
dataTable.fnPageChange(--pageNum,true);
}
//解除绑定
function unbind(userId,deviceId){
function unbind(userId,deviceId,isdevice){
var r = confirm("确定要解除绑定吗?");
if (r == true) {
location.href="<%=basePath%>page/admin/unbind.do?priId.userId="+userId+"&priId.deviceId="+deviceId;
if (isdevice) {
location.href="<%=basePath%>page/admin/unbind.do?priId.userId="+userId+"&priId.deviceId="+deviceId;
} else {
location.href="<%=basePath%>page/admin/unbindPet.do?priId.userId="+userId+"&priId.deviceId="+deviceId;
}
}
}
//授权
@@ -284,6 +310,64 @@
</c:forEach>
</tbody>
</table>
<h4 class="header smaller lighter blue">拥有宠物笼&nbsp;&nbsp;&nbsp;&nbsp;<button class="btn btn-xs btn-primary" id="bindPetDeviceBtn"><i class="icon-edit"></i>新增</button></h4>
<table class="table table-striped table-bordered table-hover">
<col>
<thead>
<tr>
<th class="center">ID</th>
<th>硬件mac</th>
<th>方案名称</th>
<th>厂家名称</th>
<th>连接次数</th>
<th>最后一次登陆时间</th>
<th>显示名称</th>
<th>是否主控</th>
<th>绑定时间</th>
<th>首次激活时间</th>
<th>出厂时间</th>
<th>授权</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${devicePetUserList}" var="deviceUser">
<tr>
<td class="center">${deviceUser.priId.deviceId}</td>
<td>${deviceUser.device.macAddress}</td>
<c:if test="${deviceUser.device.hardwareType==null }">
<td><p style="color:red">...</p></td>
</c:if>
<c:if test="${deviceUser.device.hardwareType!=null }">
<td>${deviceUser.device.hardwareType.hardwareName}</td>
</c:if>
<td>${deviceUser.device.venderList.brandName}</td>
<td>${deviceUser.device.loginCount}</td>
<td>${deviceUser.device.loginTime}</td>
<td>${deviceUser.storeName}<br/>${deviceUser.showName}</td>
<td>${deviceUser.isMaster==0?"<span class='badge label-success'>是</span>":"<span class='badge label-danger'>否</span>"}</td>
<td>${deviceUser.createTime}</td>
<td>${deviceUser.device.firstActivate}</td>
<td>${deviceUser.device.createTime}</td>
<td>${deviceUser.device.isBlacklist==1?"<span class='badge label-danger'>NO</span>":"<span class='badge label-success'>OK</span>"}</td>
<td class="center">
<a href="javascript:void(0);" onclick="unbind('${deviceUser.user.userId}','${deviceUser.device.deviceId}')" class="btn btn-xs btn-danger"><i class="icon-remove">解除绑定</i></a>
<c:if test="${deviceUser.device.isBlacklist==1}">
<a href="javascript:void(0);" onclick="deviceLicense('${deviceUser.user.userId}','${deviceUser.device.deviceId}','0')" class="btn btn-xs btn-primary"><i class="icon-ok">授予权限</i></a>
</c:if>
<c:if test="${deviceUser.device.isBlacklist==0}">
<c:if test="${deviceUser.device.isCharge==1}">
<a href="javascript:void(0);" title="[禁用]" class="btn btn-xs btn-default"><i class="icon-remove">取消授权</i></a>
</c:if>
<c:if test="${deviceUser.device.isCharge==0}">
<a href="javascript:void(0);" onclick="deviceLicense('${deviceUser.user.userId}','${deviceUser.device.deviceId}','1')" class="btn btn-xs btn-danger"><i class="icon-remove">取消授权</i></a>
</c:if>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="space"></div>
<h4 class="header smaller lighter blue">拥有摄像头&nbsp;&nbsp;&nbsp;&nbsp;<button class="btn btn-xs btn-primary" id="bindCameraBtn"><i class="icon-edit"></i>新增</button></h4>
<table class="table table-striped table-bordered table-hover">
@@ -380,6 +464,40 @@
</div>
</div>
</form>
<form action="<%=basePath%>page/admin/bindPetDevice.do" class="form-horizontal" method="post" id="form-bindPetDevice">
<div class="modal fade" id="bindPetDeviceModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closeBtn close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">绑定设备</h4>
</div>
<div class="modal-body row">
<div class="col-xs-12">
<div class="form-group">
<label class="col-xs-2 control-label no-padding-right">用户ID<span style="color:red;">*</span></label>
<div class="col-xs-8">
<input type="number" name="userId" value="${user.userId}" readonly="readonly" class="input-medium" required="required">
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label no-padding-right">设备Mac<span style="color:red;">*</span></label>
<div class="col-xs-8">
<input type="text" id="petMacAddress" name="macAddress" class="input-medium" required="required" maxlength="20">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="closeBtn btn btn-default">关闭</button>
<button id="bindPetDeviceModalBtn" type="submit" class="btn btn-primary">确定</button>
</div>
</div>
</div>
</div>
</form>
<form action="<%=basePath%>page/admin/bindCamera.do" class="form-horizontal" method="post" id="form-bindCamera">
<div class="modal fade" id="bindCameraModal">
<div class="modal-dialog">