ifishSystem/src/main/webapp/WEB-INF/view/roleAdmin/userDetail.jsp

546 lines
22 KiB
Plaintext

<%@page import="com.ifish.enums.SysUserEnum"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>用户详情</title>
<!-- css and js -->
<%@ include file="../htm/script.jsp" %>
<script type="text/javascript">
var dataTable = null;
$(function(){
$("#saveBtn").attr("disabled",false);
//模态框
$('.modal').modal({
backdrop:'static',
show:false
});
//关闭
$(".closeBtn").click(function(){
$('.modal').modal("hide");
});
//分页
dataTable = $('#sample-table-2').dataTable({
"sPaginationType": "bootstrap",
"bLengthChange": false,
"bFilter": false,
//"bProcessing": true,
"bServerSide": true,//指定从服务器端获取数据
"sAjaxSource": "<%=basePath%>page/grade/gradeRecordInf.do",
"fnServerData": returnServerData,
"aoColumns": [
{ "mData": "recordId","bSortable": false },
{ "mData": "ruleType","bSortable": false },
{ "mData": "addValue","bSortable": false },
{ "mData": "recordRemark","bSortable": false },
{ "mData": "createTime","bSortable": false }
],
"oLanguage": {
"sLengthMenu": "每页显示 _MENU_条",
"sZeroRecords": "没有找到符合条件的数据",
"sInfo": "当前第 _START_ - _END_ 条 共计 _TOTAL_ 条",
"sProcessing": "<img src='<%=basePath%>static/css/images/loading.gif'>",
"sInfoEmpty": "木有记录",
"sInfoFiltered": "(从 _MAX_ 条记录中过滤)",
"sSearch": "<select id='searchField' style='height:25px'><option value='userId'>用户ID</option><option value='phoneNumber'>手机号</option><option value='remarks'>备注</option></select>:",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "前一页",
"sNext": "后一页",
"sLast": "尾页"
}
}
});
//绑定设备
$("#bindDeviceBtn").click(function(){
$("#bindDeviceModal").modal("show");
});
$("#bindDeviceModalBtn").click(function(){
if($("#macAddress").val()==""){
jAlert("设备Mac不能为空", '提示');
return false;
}
$("#bindDeviceModalBtn").attr("disabled",true);
$('#form-bindDevice').submit();
});
$('#form-bindDevice').ajaxForm(function(data){
if(data==true){
location.reload();
jAlert('绑定成功', '提示');
}
else{
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(){
$("#bindCameraModal").modal("show");
});
$("#bindCameraModalBtn").click(function(){
if($("#cameraId").val()==""){
jAlert("摄像头ID不能为空", '提示');
return false;
}
$("#bindCameraModalBtn").attr("disabled",true);
$('#form-bindCamera').submit();
});
$('#form-bindCamera').ajaxForm(function(data){
if(data==true){
location.reload();
jAlert('绑定成功', '提示');
}
else{
jAlert('绑定失败或出错啦!', '提示');
}
$("#bindCameraModalBtn").attr("disabled",false);
});
});
//服务器返回数据
function returnServerData(sSource, aoData, fnCallback){
//查询参数
var searchClass = $(".searchClass");
for (var i = 0; i < searchClass.length; i++) {
var id = $(searchClass[i]).attr("id");
var value = $(searchClass[i]).val();
aoData.push({"name":id,"value":value});
}
$.ajax({
"url": sSource,
"type": "POST",
"data": aoData,
"dataType": "json",
"cache": false,
"success": function(json){
fnCallback(json);
}
});
}
//刷新当前页
function refreshTable(){
var iDisplayStart = dataTable.fnSettings()._iDisplayStart;
var iDisplayLength = dataTable.fnSettings()._iDisplayLength;
var pageNum = (iDisplayStart+iDisplayLength)/iDisplayLength;
dataTable.fnPageChange(--pageNum,true);
}
//解除绑定
function unbind(userId,deviceId,isdevice){
var r = confirm("确定要解除绑定吗?");
if (r == true) {
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;
}
}
}
//授权
function deviceLicense(userId,deviceId,isBlacklist){
var r = confirm("确定要执行该操作吗?");
if (r == true) {
location.href="<%=basePath%>page/admin/deviceLicense.do?sign=1&userId="+userId+"&deviceId="+deviceId+"&isBlacklist="+isBlacklist;
}
}
</script>
</head>
<body>
<!-- 头部 -->
<%@ include file="../htm/header.jsp" %>
<!-- 主体 -->
<div class="main-container" id="main-container">
<script type="text/javascript">
try{ace.settings.check('main-container' , 'fixed')}catch(e){}
</script>
<div class="main-container-inner">
<!-- 侧边栏 -->
<%@ include file="../htm/sidebar.jsp" %>
<!-- 主体内容 -->
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<script type="text/javascript">
try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
</script>
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="<%=basePath%>page/public/index.do">首页</a>
</li>
<li>
<a href="<%=basePath%>page/admin/userList.do">用户列表</a>
</li>
<li class="active">用户详情</li>
</ul>
</div>
<div class="page-content">
<c:set var="success100" value="<%=SysUserEnum.success100.getKey()%>"></c:set>
<c:set var="failed101" value="<%=SysUserEnum.failed101.getKey()%>"></c:set>
<c:if test="${status == success100}">
<div class="alert alert-block alert-success">
<i class="icon-ok green">操作<%=SysUserEnum.success100.getValue()%></i>
</div>
</c:if>
<c:if test="${status == failed101}">
<div class="alert alert-block alert-danger">
<i class="icon-remove red">操作<%=SysUserEnum.failed101.getValue()%></i>
</div>
</c:if>
<div class="row">
<div class="col-xs-12">
<div class="table-responsive">
<h4 class="header smaller lighter blue">用户信息</h4>
<table class="table table-striped table-bordered table-hover">
<col>
<thead>
<tr>
<th class="center">ID</th>
<th>用户昵称</th>
<th>性别</th>
<th>手机号</th>
<th>累计登陆次数</th>
<th>注册时间</th>
<th>技威code1</th>
<th>技威code2</th>
<th>技威用户ID</th>
<th>云信token</th>
</tr>
</thead>
<tbody>
<tr>
<td class="center">${user.userId}</td>
<td>${user.nickName}</td>
<c:if test="${user.userSex == null || user.userSex == ''}">
<td></td>
</c:if>
<c:if test="${user.userSex == '0'}">
<td>女</td>
</c:if>
<c:if test="${user.userSex == '1'}">
<td>男</td>
</c:if>
<td>${user.phoneNumber}</td>
<td>${user.loginCount}</td>
<td>${user.createTime}</td>
<td>${user.p2PVerifyCode1}</td>
<td>${user.p2PVerifyCode2}</td>
<td>${user.gwellUserID}</td>
<td>${user.neteaseToken}</td>
</tr>
</tbody>
</table>
<div class="space"></div>
<h4 class="header smaller lighter blue">拥有设备&nbsp;&nbsp;&nbsp;&nbsp;<button class="btn btn-xs btn-primary" id="bindDeviceBtn"><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="${deviceUserList}" 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.showName}</td>
<td>${deviceUser.isMaster==1?"<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>
<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">
<col>
<thead>
<tr>
<th class="center">摄像头ID</th>
<th>显示名称</th>
<th>是否主控</th>
<th>是否看护</th>
<th>是否直播</th>
<th>绑定时间</th>
<th>激活时间</th>
</tr>
</thead>
<tbody>
<c:forEach items="${cameraUserList}" var="cameraUser">
<tr>
<td class="center">${cameraUser.cameraUserId.cameraId}</td>
<td>${cameraUser.showName}</td>
<td>${cameraUser.isMaster==1?"<span class='badge label-success'>是</span>":"<span class='badge label-danger'>否</span>"}</td>
<td>${cameraUser.isLook==1?"<span class='badge label-success'>是</span>":"<span class='badge label-danger'>否</span>"}</td>
<td>${cameraUser.isLive==1?"<span class='badge label-success'>是</span>":"<span class='badge label-danger'>否</span>"}</td>
<td>${cameraUser.createTime}</td>
<td>${cameraUser.camera.activeTime!=null?cameraUser.camera.activeTime:"<span class='badge label-danger'>未激活</span>"}</td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="space"></div>
<h4 class="header smaller lighter blue">设备-摄像头</h4>
<table class="table table-striped table-bordered table-hover">
<col>
<thead>
<tr>
<th class="center">摄像头ID</th>
<th class="center">设备ID</th>
</tr>
</thead>
<tbody>
<c:forEach items="${deviceCameraList}" var="deviceCamera">
<tr>
<td class="center">${deviceCamera.deviceCameraId.cameraId}</td>
<td class="center">${deviceCamera.deviceCameraId.deviceId}</td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="space"></div>
<h4 class="header smaller lighter blue">获取经验记录</h4>
<input type="hidden" id="sSearch1" value="${user.userId }" class="searchClass" min="1">
<table id="sample-table-2" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>记录ID</th>
<th>规则类型</th>
<th>经验值</th>
<th>记录描述</th>
<th>时间</th>
</tr>
</thead>
</table>
<form action="<%=basePath%>page/admin/bindDevice.do" class="form-horizontal" method="post" id="form-bindDevice">
<div class="modal fade" id="bindDeviceModal">
<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="macAddress" 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="bindDeviceModalBtn" type="submit" class="btn btn-primary">确定</button>
</div>
</div>
</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">
<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">摄像头ID<span style="color:red;">*</span></label>
<div class="col-xs-8">
<input type="text" id="cameraId" name="cameraId" 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="bindCameraModalBtn" type="submit" class="btn btn-primary">确定</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- 设置工具 -->
<%@ include file="../htm/setting.jsp" %>
</div>
</div>
</div>
</body>
</html>