Browse Source

ukey绑定/管理页面

master
孙伟人 9 months ago
parent
commit
7adb45a988
  1. 2
      Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/js/init.js
  2. 2
      Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/subitem/js/patrols.js
  3. 12
      Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj
  4. 36
      Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/OrgEmpList.js
  5. 214
      Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/UkeyBinDing.html
  6. 138
      Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/UKey/UKeyList.html
  7. 14
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs
  8. 1
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx
  9. 356
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx.cs
  10. BIN
      Code/智慧营区/DOCManageAPP(阿克苏)/images/ukeyBinding.png
  11. 2071
      Code/智慧营区/DOCManageAPP(阿克苏)/js/fiseckey.js

2
Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/js/init.js

@ -1,5 +1,5 @@
var _interfaceDocUrl="http://xzcamp.xfzn365.com/",//其他接口 var _interfaceDocUrl="",//其他接口
_interfaceMhUrl="",//摄像头 _interfaceMhUrl="",//摄像头
_interfaceImgUrl = "",//图片前缀 _interfaceImgUrl = "",//图片前缀
_interfaceDjUrl = "/political";//党建接口 _interfaceDjUrl = "/political";//党建接口

2
Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/subitem/js/patrols.js

@ -39,7 +39,7 @@ var getData = {
if(obj.EMP_PHOTO == null || obj.EMP_PHOTO == "") { if(obj.EMP_PHOTO == null || obj.EMP_PHOTO == "") {
picHtml += '<li class="cur"><img src="img/zanwutouxiang.png" alt="" /></li>'; picHtml += '<li class="cur"><img src="img/zanwutouxiang.png" alt="" /></li>';
} else { } else {
picHtml += '<li class="cur"><img src="' + _interfaceDocUrl + '//' + obj.EMP_PHOTO + '" alt="" /></li>'; picHtml += '<li class="cur"><img src="' + _interfaceDocUrl + '/' + obj.EMP_PHOTO + '" alt="" /></li>';
} }
if(index == 0) { if(index == 0) {

12
Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj

@ -2070,7 +2070,7 @@
<Content Include="Fire\WatSou\WatSouList.js" /> <Content Include="Fire\WatSou\WatSouList.js" />
<Content Include="FlowDesigner.aspx" /> <Content Include="FlowDesigner.aspx" />
<Content Include="FormDesigner.aspx" /> <Content Include="FormDesigner.aspx" />
<Content Include="Global.asax" /> <Content Include="Global.asax" />
<Content Include="healthEmpower\AuthorizationResults.html" /> <Content Include="healthEmpower\AuthorizationResults.html" />
<Content Include="healthEmpower\css\mui.min.css" /> <Content Include="healthEmpower\css\mui.min.css" />
<Content Include="healthEmpower\css\wangns.css" /> <Content Include="healthEmpower\css\wangns.css" />
@ -4280,6 +4280,7 @@
<Content Include="ashx\OaKnowledgeHandler.ashx" /> <Content Include="ashx\OaKnowledgeHandler.ashx" />
<Content Include="js\jquery.wordexport.js" /> <Content Include="js\jquery.wordexport.js" />
<Content Include="ashx\A_CommonHandler.ashx" /> <Content Include="ashx\A_CommonHandler.ashx" />
<Content Include="ashx\SysUsersUkeyHandler.ashx" />
<None Include="packages.config" /> <None Include="packages.config" />
<Content Include="OA\VehicleSocity\view.html" /> <Content Include="OA\VehicleSocity\view.html" />
<Content Include="OA\VisitorReg\AppOrgTree.html" /> <Content Include="OA\VisitorReg\AppOrgTree.html" />
@ -4652,6 +4653,7 @@
<Content Include="UISysManage\Emp\OrgSyncIccInfo.html" /> <Content Include="UISysManage\Emp\OrgSyncIccInfo.html" />
<Content Include="UISysManage\Emp\SYSUserAddEdit.html" /> <Content Include="UISysManage\Emp\SYSUserAddEdit.html" />
<Content Include="UISysManage\Emp\SYSUserAddEdit.js" /> <Content Include="UISysManage\Emp\SYSUserAddEdit.js" />
<Content Include="UISysManage\Emp\UkeyBinDing.html" />
<Content Include="UISysManage\Folder\FolderAddEdit.html" /> <Content Include="UISysManage\Folder\FolderAddEdit.html" />
<Content Include="UISysManage\Folder\FolderAddEdit.js" /> <Content Include="UISysManage\Folder\FolderAddEdit.js" />
<Content Include="UISysManage\Folder\FolderTreeList.html" /> <Content Include="UISysManage\Folder\FolderTreeList.html" />
@ -6166,6 +6168,9 @@
<Compile Include="ashx\SysUpdPartyEmpPhotoHandler.ashx.cs"> <Compile Include="ashx\SysUpdPartyEmpPhotoHandler.ashx.cs">
<DependentUpon>SysUpdPartyEmpPhotoHandler.ashx</DependentUpon> <DependentUpon>SysUpdPartyEmpPhotoHandler.ashx</DependentUpon>
</Compile> </Compile>
<Compile Include="ashx\SysUsersUkeyHandler.ashx.cs">
<DependentUpon>SysUsersUkeyHandler.ashx</DependentUpon>
</Compile>
<Compile Include="ashx\TblCameraGroupHandler.ashx.cs"> <Compile Include="ashx\TblCameraGroupHandler.ashx.cs">
<DependentUpon>TblCameraGroupHandler.ashx</DependentUpon> <DependentUpon>TblCameraGroupHandler.ashx</DependentUpon>
</Compile> </Compile>
@ -6370,10 +6375,9 @@
<Compile Include="FormDesigner.aspx.designer.cs"> <Compile Include="FormDesigner.aspx.designer.cs">
<DependentUpon>FormDesigner.aspx</DependentUpon> <DependentUpon>FormDesigner.aspx</DependentUpon>
</Compile> </Compile>
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
</Compile> </Compile> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Startup.cs" /> <Compile Include="Startup.cs" />
<Compile Include="WebCommon\WebThreadUtil.cs" /> <Compile Include="WebCommon\WebThreadUtil.cs" />
<Compile Include="WebModel\DutyDiyTemplateMo.cs" /> <Compile Include="WebModel\DutyDiyTemplateMo.cs" />

36
Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/OrgEmpList.js

@ -302,6 +302,7 @@ layui.config({
var retHtml = ""; var retHtml = "";
retHtml += '<a lay-event="edit"><img src="../../images/edit.png" style="height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="编辑" /></a>'; retHtml += '<a lay-event="edit"><img src="../../images/edit.png" style="height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="编辑" /></a>';
retHtml += '<a lay-event="account"><img src="../../images/account.png" style="height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="账号" /></a>'; retHtml += '<a lay-event="account"><img src="../../images/account.png" style="height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="账号" /></a>';
retHtml += '<a lay-event="ukey"><img src="../../images/ukeyBinding.png" style="height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="ueky绑定" /></a>';
//判断是否允许同步ICC //判断是否允许同步ICC
if (userInfo.IS_SYNC_ICC == "1") { if (userInfo.IS_SYNC_ICC == "1") {
@ -722,6 +723,37 @@ layui.config({
}) })
} }
function ukeyBinding(edit) {
var clientWidth = parseInt(document.body.clientWidth * 0.3) + 'px';
var clientHeight = parseInt(document.body.clientHeight * 0.4) + 'px';
var content = "UkeyBinDing.html";
content += "?empid=" + edit.ID + "&userUid=" + edit.USERS_UID + "&OrgID=" + edit.ORG_ID;
var index = layui.layer.open({
title: "ukey绑定",
type: 2,
area: [clientWidth, clientHeight],
shadeClose: true,
shade: false,
maxmin: false,
content: content,
success: function (layero, index) {
var body = layui.layer.getChildFrame('body', index);
console.log(edit);
body.find("#empId").val(edit.ID);
body.find("#usersUid").val(edit.USERS_UID);
body.find("#empName").val(edit.EMP_NAME);
body.find("#orgId").val(edit.ORG_ID);
form.render();
}
})
window.sessionStorage.setItem("index", index);
//改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
$(window).on("resize", function () {
layui.layer.full(window.sessionStorage.getItem("index"));
})
}
function adjustment(data) { function adjustment(data) {
var clientWidth = parseInt(document.body.clientWidth * 0.7) + 'px'; var clientWidth = parseInt(document.body.clientWidth * 0.7) + 'px';
var clientHeight = parseInt(document.body.clientHeight * 0.9) + 'px'; var clientHeight = parseInt(document.body.clientHeight * 0.9) + 'px';
@ -1418,6 +1450,10 @@ layui.config({
case "account": case "account":
Account(data); Account(data);
break; break;
//ukey绑定(用户)
case "ukey":
ukeyBinding(data);
break;
//ICC授权 //ICC授权
case "ICCSync": case "ICCSync":
//alert(data.ID); //alert(data.ID);

214
Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/UkeyBinDing.html

@ -0,0 +1,214 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>添加--菜单管理</title>
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../css/public.css" media="all" />
<link rel="stylesheet" href="../../iconfont/iconfont.css" media="all" />
<script type="text/javascript" src="../../js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="../../js/jq_extend.js"></script>
<script type="text/javascript" src="../../js/fiseckey.js"></script>
</head>
<body class="childrenBody" style="height:90%">
<form class="layui-form" style="width: 90%; margin-top:15px">
<input id="Action" class="layui-input" type="hidden" />
<input id="id" class="layui-input" type="hidden" />
<input id="empId" class="layui-input " type="hidden" />
<input id="usersUid" class="layui-input" type="hidden" />
<input id="orgId" class="layui-input" type="hidden" />
<div class="layui-form-item layui-row layui-col-xs12">
<label class="layui-form-label label-required-next">
人员姓名:
</label>
<div class="layui-input-inline">
<input class="layui-input" id="empName" disabled="disabled" />
</div>
</div>
<div class="layui-form-item layui-row layui-col-xs12" id="isShow" style="display: none">
<div class="layui-inline">
<label class="layui-form-label label-required-next">
现在绑定的ukey:
</label>
<div class="layui-input-inline">
<input class="layui-input" id="ukey" disabled="disabled" />
</div>
</div>
</div>
<div class="layui-form-item layui-row layui-col-xs12">
<div class="layui-inline">
<label class="layui-form-label label-required-next">
ukey:
</label>
<div class="layui-input-inline">
<select id="ukey_list" lay-filter="ukey_list" lay-search="">
</select>
</div>
</div>
</div>
<div class="layui-form-item layui-row layui-col-xs12">
<div class="layui-inline">
<label class="layui-form-label label-required-next">
密码输入5次失败后
</label>
<div class="layui-input-inline" style="width: 80px">
<input class="layui-input" id="lockTime" type="number" placeholder="请填写" value="1" />
</div>
<div class="layui-form-mid layui-word-aux" style="color: #fff !important">分钟以后可以再次登录</div>
</div>
</div>
<div class="layui-center">
<a class="layui-btn layui-btn-normal addNews_btn" lay-filter="AddEdit" lay-submit=lay-submit>提交</a>
</div>
</form>
<script type="text/javascript" src="../../layui/layui.js"></script>
<link rel="stylesheet" href="../../css/bulletframe.css" media="all" />
<script type="text/javascript">
layui.config({
base: './'
}).use(['form', 'layer'], function () {
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer;
var ukeyList = [], ukeyListStr = "", isAction = "Add";
try {
var keytype = "";
try {
keytype = devManage.deviceType.value;
} catch (e1) {
keytype = "F-OLD";
}
var result = SKFKEY.SKF_EnumDev(1, keytype);
var a = result.slice(6, result.length - 2);
ukeyList = a.split("|");
ukeyListStr = "";
ukeyList.forEach(function (obj, index, arr) {
ukeyListStr += "<option value='" + obj + "'>" + obj + "</option>";
});
console.log(ukeyListStr);
$("#ukey_list").append(ukeyListStr);
form.render('select');
} catch (e) {
console.log(e.message);
}
$.post("../../ashx/SysUsersUkeyHandler.ashx", {
Action: "getUserUkey",
usersUid: $.getUrlVar("userUid"),
random: new Date().getTime()//随机参数
}, function (res) {
if (res.code == '0') {
if (res.data.length > 0) {
var info = res.data[0];
isAction = "Edit";
$("#id").val(info.ID);
$("#ukey").val(info.UKEY);
$("#lockTime").val(info.LOCK_TIME);
$("#isShow").show();
}
} else {
layer.msg(res.msg, { icon: 7, time: 3000 });
}
})
function submitFun() {
//load提交
var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
$.post("../../ashx/SysUsersUkeyHandler.ashx", {
Action: isAction,
id: $("#id").val(),
empId: $("#empId").val(),
usersUid: $("#usersUid").val(),
empName: $("#empName").val(),
ukey: $("#ukey_list option:selected").text(),
lockTime: $("#lockTime").val(),
orgId: $("#orgId").val(),
random: new Date().getTime() //随机参数(员工表ID ","分割)
}, function (res) {
layer.close(index);
if (res.code == 1) {
top.layer.msg(res.msg, { icon: 1, time: 3000 });
parent.location.reload();
} else if (res.code == '-2') {
var index3 = layer.confirm(res.msg, {
btn: ['是', '否'],
icon: 3
}, function () {
//load提交
var index2 = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
$.post("../../ashx/SysUsersUkeyHandler.ashx", {
Action: "ForceEdit",
id: res.id,
empId: $("#empId").val(),
usersUid: $("#usersUid").val(),
empName: $("#empName").val(),
ukey: $("#ukey_list option:selected").text(),
lockTime: $("#lockTime").val(),
orgId: $("#orgId").val(),
random: new Date().getTime() //随机参数(员工表ID ","分割)
}, function (res) {
layer.close(index2);
layer.close(index3);
if (res.code == 1) {
top.layer.msg(res.msg, { icon: 1, time: 3000 });
parent.location.reload();
} else {
layer.msg(res.msg, { icon: 7, time: 3000 });
}
});
}, function () {
layer.close(index3);
return false;
});
} else {
layer.close(index);
layer.msg(res.msg, { icon: 7, time: 3000 });
}
});
layer.close(index);
return false;
}
form.on("submit(AddEdit)", function (data) {
if ($("#ukey_list option:selected").text() == "") {
layer.open({
content: 'ukey不能为空!',
icon: 7
})
return false;
}
if ($("#lockTime").val() == "") {
layer.open({
content: '密码输入5次失败后,账号锁定时长不能为空!',
icon: 7
})
return false;
}
if ($("#ukey").val() != "") {
var index = layer.confirm('是否要替换掉原有的ukey:' + $("#ukey").val(), {
icon: 3,
btn: ['是', '否']
}, function () {
submitFun();
}, function () {
layer.close(index);
return false;
});
} else {
submitFun();
}
})
})
</script>
</body>
</html>

138
Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/UKey/UKeyList.html

@ -0,0 +1,138 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>设备管理--科宁智慧安全社区后台管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../css/public.css" media="all" />
<link rel="stylesheet" href="../../css/ztree/metro/ztree.css">
<script src="../../js/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="../../js/jquery.cookie.js" type="text/javascript"></script>
</head>
<body style="border: 1px solid #0c6f89;
background: rgba(12, 70, 100, 0.8);
padding: 20px;
box-sizing: border-box;
">
<form class="layui-form">
<blockquote class="layui-elem-quote quoteBox" style="padding-left:0; padding-top:0;">
<form class="layui-form">
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" class="layui-input ukey" placeholder="请输入UKey序列号" />
</div>
<div class="layui-input-inline">
<input type="text" class="layui-input empName" placeholder="请输入姓名" />
</div>
<a class="layui-btn search_btn" data-type="reload">搜索</a>
</div>
<div class="layui-inline">
<a class="layui-btn layui-btn-danger layui-btn-normal delAll_btn">批量删除</a>
</div>
<div class="layui-inline">
<span style="color: red">* </span><span style="color: #ccc">如需ukey绑定,请前往【人员管理】页面进行ukey绑定操作</span>
</div>
</form>
</blockquote>
<table id="uKeyList" lay-filter="uKeyList"></table>
</form>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: '../../js/'
}).use(['ztree', 'form', 'layer', 'table', 'laytpl'], function () {
var layer = parent.layer === undefined ? layui.layer : top.layer,
$ = layui.jquery,
table = layui.table;
//系统列表
table.render({
elem: '#uKeyList',
url: '../../ashx/SysUsersUkeyHandler.ashx',
where: { Action: 'List', random: new Date().getTime() },
cellMinWidth: 95,
page: true,
height: "full-125",
limits: [10, 15, 20, 25],
limit: 20,
id: "uKeyListTable",
cols: [[
{ type: "checkbox", fixed: "left", width: 50 },
{ field: 'ORG_NAME', title: '所属单位', minWidth: 60, align: "center" },
{ field: 'EMP_NAME', title: '人员姓名', minWidth: 60, align: "center" },
{ field: 'UKEY', title: 'ukey', minWidth: 60, align: "center" },
{
field: 'LOCK_TIME', title: '登录失败锁定时长(分钟)', minWidth: 60, align: "center", templet: function (v) {
return v.LOCK_TIME + "(分钟)";
}
}
]]
});
//搜索
$(".search_btn").on("click", function () {
table.reload("uKeyListTable", {
page: {
curr: 1 //重新从第 1 页开始
},
where: {
Action: 'List',
ukey: $(".ukey").val(), //搜索的ukey序列号
empName: $(".empName").val(), //搜索的ukey序列号
random: new Date().getTime() //随机参数
}
});
});
//批量删除
$(".delAll_btn").click(function () {
var checkStatus = table.checkStatus('uKeyListTable'),
data = checkStatus.data,
UKeyList = [];
if (data.length > 0) {
for (var i in data) {
UKeyList.push(data[i].ID);
}
layer.confirm('确定删除选中的ukey绑定记录?', { icon: 3, title: '提示信息' }, function (index) {
//提交信息
$.post("../../ashx/SysUsersUkeyHandler.ashx", {
Action: "Del",
UIDList: UKeyList.join(","),
random: new Date().getTime() //随机参数
}, function (res) {
if (res.code == 1) {
top.layer.msg(res.msg, { icon: 1, time: 3000 });
table.reload("uKeyListTable", {
page: {
curr: 1 //重新从第 1 页开始
},
where: {
Action: 'List',
ukey: $(".ukey").val(), //搜索的ukey序列号
empName: $(".empName").val(), //搜索的ukey序列号
random: new Date().getTime() //随机参数
}
});
} else {
top.layer.msg(res.msg, { icon: 7, time: 3000 });
}
});
});
} else {
layer.msg("请选择需要删除的ukey绑定记录", { icon: 7, time: 3000 });
}
})
})
</script>
<link rel="stylesheet" href="../../css/right-list.css" media="all" />
<link rel="stylesheet" href="../../css/bulletframebg.css" media="all" />
</body>
</html>

14
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs

@ -2435,18 +2435,19 @@ namespace FangYar.WebUI.ashx
try try
{ {
string id = context.Request.Params["id"]; string id = context.Request.Params["id"];
string state = context.Request.Params["state"];
string OPINION = context.Request.Params["OPINION"]; string OPINION = context.Request.Params["OPINION"];
string sql = " update tbl_alarmdata set state='1',OPINION='"+ OPINION + "' where id='" + id + "' "; string sql = " update tbl_alarmdata set state='"+ state + "',OPINION='"+ OPINION + "' where id='" + id + "' ";
var n1 = FangYar.Common.MySqlHelper.Execute(sql); var n1 = FangYar.Common.MySqlHelper.Execute(sql);
if (n1 > 0) if (n1 > 0)
{ {
msg = "审批成功!"; msg = "操作成功!";
code = 1; code = 1;
} }
else else
{ {
msg = "审批失败!"; msg = "操作失败!";
} }
} }
catch(Exception e) catch(Exception e)
@ -2568,18 +2569,19 @@ namespace FangYar.WebUI.ashx
try try
{ {
string id = context.Request.Params["id"]; string id = context.Request.Params["id"];
string state = context.Request.Params["state"];
string OPINION = context.Request.Params["OPINION"]; string OPINION = context.Request.Params["OPINION"];
string sql = " update tbl_alarmdata set state='1',OPINION='"+ OPINION + "' where id='" + id + "' "; string sql = " update tbl_alarmdata set state='"+ state + "',OPINION='"+ OPINION + "' where id='" + id + "' ";
var n1 = FangYar.Common.MySqlHelper.Execute(sql); var n1 = FangYar.Common.MySqlHelper.Execute(sql);
if (n1 > 0) if (n1 > 0)
{ {
msg = "审批成功!"; msg = "操作成功!";
code = 1; code = 1;
} }
else else
{ {
msg = "审批失败!"; msg = "操作失败!";
} }
} }
catch(Exception e) catch(Exception e)

1
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx

@ -0,0 +1 @@
<%@ WebHandler Language="C#" CodeBehind="SysUsersUkeyHandler.ashx.cs" Class="FangYar.WebUI.ashx.SysUsersUkeyHandler" %>

356
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx.cs

@ -0,0 +1,356 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// SysUsersRulesHandler 的摘要说明
/// </summary>
public class SysUsersUkeyHandler : IHttpHandler
{
private FangYar.BLL.TBL.SysUSerRulesBLL bll = new BLL.TBL.SysUSerRulesBLL();
public void ProcessRequest(HttpContext context)
{
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "用户Ukey绑定操作请求", "");
context.Response.ContentType = "text/json";
string action = context.Request.Params["Action"];
string returnstr = "";
switch (action)
{
case "List":
returnstr = GetModelList(context);
break;
case "Add":
returnstr = AddModel(context);
break;
case "Edit":
returnstr = EditModel(context);
break;
case "ForceEdit":
returnstr = ForceEditModel(context);
break;
case "Del":
returnstr = DelModel(context);
break;
case "getUserUkey":
returnstr = getUserUkey(context);
break;
}
context.Response.Write(returnstr);
}
//查询
private string GetModelList(HttpContext context)
{
string returnstr = "";
try
{
string ukey = context.Request.Params["ukey"];
string empName = context.Request.Params["empName"];
string limit = context.Request.Params["limit"];
string page = context.Request.Params["page"];
int pageIndex = 1;
int pageSize = 10;
if (!string.IsNullOrEmpty(limit)) { pageIndex = int.Parse(page); }
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
string where = null;
if (!string.IsNullOrEmpty(ukey))
{
where = "u.ukey like '%" + ukey + "%'";
}
if (!string.IsNullOrEmpty(empName))
{
if (where != null)
{
where += " and ";
}
where += "u.emp_name like '%" + empName + "%' ";
}
returnstr = "{\"code\":0,\"data\":";
int startnum = (pageIndex - 1) * pageSize;
string sql = "select u.*,(select org_name from fire_org o where o.org_id = u.org_id) as org_name from tbl_sys_emp_ukey u ";
if (where != null && where != "")
{
sql += " where " + where;
}
sql += " order by u.updatetime desc";
startnum = startnum < 0 ? 0 : startnum;
sql += " limit " + startnum + ", " + pageSize;
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql);
if (dt.Rows.Count > 0)
{
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
}
else
{
returnstr += "[]";
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用户ukey操作请求", "查询");
return returnstr;
}
// 添加
private string AddModel(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string id = Guid.NewGuid().ToString("N");
string empId = context.Request.Params["empId"];
string usersUid = context.Request.Params["usersUid"];
string empName = context.Request.Params["empName"];
string ukey = context.Request.Params["ukey"];
string lockTime = context.Request.Params["lockTime"];
string orgId = context.Request.Params["orgId"];
if (string.IsNullOrEmpty(usersUid))
{
return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}";
}
if (string.IsNullOrEmpty(empId))
{
return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}";
}
string isOnlyUkeySql = "select id,emp_name from tbl_sys_emp_ukey where ukey = '" + ukey + "'";
DataTable isOnlyUkeyDt = FangYar.Common.MySqlHelper.QueryTable(isOnlyUkeySql);
if (isOnlyUkeyDt != null && isOnlyUkeyDt.Rows.Count > 0)
{
string emp_name = isOnlyUkeyDt.Rows[0]["emp_name"].ToString();
if (!string.IsNullOrEmpty(emp_name))
{
string editId = isOnlyUkeyDt.Rows[0]["id"].ToString();
return "{\"code\":-2,\"id\":\""+ editId + "\",\"msg\":\"当前ukey:" + ukey + ",已经绑定给了【" + emp_name + "】,是否替换\"}";
}
}
string sql = "insert into tbl_sys_emp_ukey(id,emp_id,users_uid,emp_name,ukey,lock_time,org_id) values ('" + id + "','" + empId + "','" + usersUid + "','" + empName + "','" + ukey + "','" + lockTime + "','" + orgId + "')";
if (FangYar.Common.MySqlHelper.Execute(sql) > 0)
{
msg = "添加成功!";
code = 1;
}
else
{
msg = "添加失败!";
}
}
catch (Exception e)
{
msg = "添加失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "添加异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "用户ukey操作请求", "添加");
return returnstr;
}
//修改
private string EditModel(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string id = context.Request.Params["id"];
string empId = context.Request.Params["empId"];
string usersUid = context.Request.Params["usersUid"];
string empName = context.Request.Params["empName"];
string ukey = context.Request.Params["ukey"];
string lockTime = context.Request.Params["lockTime"];
string orgId = context.Request.Params["orgId"];
if (string.IsNullOrEmpty(usersUid))
{
return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}";
}
if (string.IsNullOrEmpty(empId))
{
return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}";
}
string isOnlyUkeySql = "select id,emp_name from tbl_sys_emp_ukey where ukey = '" + ukey + "'";
DataTable isOnlyUkeyDt = FangYar.Common.MySqlHelper.QueryTable(isOnlyUkeySql);
if (isOnlyUkeyDt != null && isOnlyUkeyDt.Rows.Count > 0)
{
string emp_name = isOnlyUkeyDt.Rows[0]["emp_name"].ToString();
if (!string.IsNullOrEmpty(emp_name))
{
string editId = isOnlyUkeyDt.Rows[0]["id"].ToString();
return "{\"code\":-2,\"id\":\"" + editId + "\",\"msg\":\"当前ukey:" + ukey + ",已经绑定给了【"+ emp_name + "】,是否替换\"}";
}
}
string sql = "update tbl_sys_emp_ukey set emp_id = '" + empId+ "',users_uid = '" + usersUid + "',emp_name = '" + empName + "',ukey = '" + ukey + "',lock_time = '" + lockTime + "',org_id = '" + orgId + "' where id = '" + id + "'";
if (FangYar.Common.MySqlHelper.Execute(sql) > 0)
{
msg = "修改成功!";
code = 1;
}
else
{
msg = "修改失败!";
}
}
catch (Exception e)
{
msg = "修改失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "修改异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用户ukey操作请求", "修改");
return returnstr;
}
//强制修改
private string ForceEditModel(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string id = context.Request.Params["id"];
string empId = context.Request.Params["empId"];
string usersUid = context.Request.Params["usersUid"];
string empName = context.Request.Params["empName"];
string ukey = context.Request.Params["ukey"];
string lockTime = context.Request.Params["lockTime"];
string orgId = context.Request.Params["orgId"];
if (string.IsNullOrEmpty(usersUid))
{
return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}";
}
if (string.IsNullOrEmpty(empId))
{
return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}";
}
string sql = "update tbl_sys_emp_ukey set emp_id = '" + empId + "',users_uid = '" + usersUid + "',emp_name = '" + empName + "',ukey = '" + ukey + "',lock_time = '" + lockTime + "',org_id = '" + orgId + "' where id = '" + id + "'";
if (FangYar.Common.MySqlHelper.Execute(sql) > 0)
{
msg = "修改成功!";
code = 1;
}
else
{
msg = "修改失败!";
}
}
catch (Exception e)
{
msg = "修改失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "修改异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用户ukey操作请求", "修改");
return returnstr;
}
//删除
private string DelModel(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string UIDList = context.Request.Params["UIDList"];
UIDList = UIDList.Replace(",", "','");
string sql = "delete from tbl_sys_emp_ukey where ID in('" + UIDList + "')";
try
{
if (FangYar.Common.MySqlHelper.ExecuteSql(sql) > 0)
{
msg = "删除成功!";
code = 1;
}
else
{
msg = "删除失败!";
}
}
catch
{
msg = "删除失败!";
}
}
catch (Exception e)
{
msg = "删除失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "删除异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "用户ukey操作请求", "删除");
return returnstr;
}
//获取用户ukey(根据用户登录账号)
private string getUserUkey(HttpContext context)
{
string usersUid = context.Request.Params["usersUid"];
string returnstr = "";
try
{
returnstr = "{\"code\":0,\"data\":";
string sql = @"SELECT * FROM tbl_sys_emp_ukey WHERE users_uid = '" + usersUid + @"'";
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql);
if (dt.Rows.Count > 0)
{
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
}
else
{
returnstr += "[]";
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"操作失败!\",\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "获取当前用户ukey异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用户ukey操作请求", "获取当前用户ukey");
return returnstr;
}
public bool IsReusable
{
get
{
return false;
}
}
}
}

BIN
Code/智慧营区/DOCManageAPP(阿克苏)/images/ukeyBinding.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

2071
Code/智慧营区/DOCManageAPP(阿克苏)/js/fiseckey.js

File diff suppressed because it is too large
Loading…
Cancel
Save