| | |
| | | var html = []; |
| | | $.each(result.Message.Table, function(i) { |
| | | html.push("<tr>"); |
| | | html.push("<td>" + this.Account + "</td>"); |
| | | html.push("<td>" + this.Account + "</td>"); |
| | | html.push("<td>" + this.UserName + "</td>"); |
| | | html.push("<td>" + this.RoleNames + "</td>"); |
| | | |
| | | //if (this.UserType == 1) { |
| | | // html.push("<td>" + "管理员" + "</td>"); |
| | | //} |
| | | //else if (this.UserType == 2) { |
| | | // html.push("<td>" + "业务员" + "</td>"); |
| | | //} |
| | | //else if (this.UserType == 3) { |
| | | // html.push("<td>" + "业务主管" + "</td>"); |
| | | //} |
| | | //else if (this.UserType == 4) { |
| | | // html.push("<td>" + "业务总监" + "</td>"); |
| | | //} |
| | | //else if (this.UserType == 5) { |
| | | // html.push("<td>" + "客服人员" + "</td>"); |
| | | //} |
| | | //else if (this.UserType == 6) { |
| | | // html.push("<td>" + "财务人员" + "</td>"); |
| | | //} |
| | | //else if (this.UserType == 99) { |
| | | // html.push("<td>" + "其他" + "</td>"); |
| | | //} |
| | | //else { |
| | | // html.push("<td>" + "" + "</td>"); |
| | | //} |
| | | |
| | | html.push("<td>" + this.Mobile + "</td>"); |
| | | html.push("<td>" + formatFlagIcon(this.MobileFlag) + "</td>"); |
| | | |
| | |
| | | html.push("<td>" + this.ClientIp + "</td>"); |
| | | html.push("<td>" + (this.IsVerification == 1 ? "<span class='label label-primary'>开启</span>" : "<span class='label label-default'>关闭</span>") + "</td>"); |
| | | html.push("<td>" + this.CreateTime + "</td>"); |
| | | html.push("<td >"); |
| | | html.push("<a href='javascript:;' class='btn btn-success btn-xs action-edit' data-id='" + this.UserID + "'><i class='fa fa-edit'></i> 编辑</a> "); |
| | | html.push("<a href='javascript:;' data-id='" + this.UserID + "' class='action-permission btn btn-info btn-xs'><i class='fa fa-edit'></i> 权限</a> "); |
| | | html.push("<td>" + (this.Status == 1 ? "<span class='label label-primary'>启用</span>" : "<span class='label label-default'>停用</span>") + "</td>"); |
| | | //html.push("<td>" + (this.Status == 1 ? "<a href='javascript:;' class='btn btn-primary btn-xs action-update-status' data-id=" + this.UserID + " data-status=0 ><i class='fa fa-toggle-off'></i> 启用</a>" : "<a href='javascript:;' class='btn btn-default btn-xs action-update-status' data-id=" + this.UserID + " data-status=1 ><i class='fa fa-toggle-on'></i>停用</a>") + "</td>"); |
| | | html.push("<td class='text-right' >"); |
| | | if (this.Status == 0) { |
| | | html.push("<a href='javascript:;' class='btn btn-primary btn-xs action-update-status' data-id=" + this.UserID + " data-status=1 ><i class='fa fa-toggle-off'></i>启用</a> " ); |
| | | } |
| | | else { |
| | | html.push("<a href='javascript:;' class='btn btn-default btn-xs action-update-status' data-id=" + this.UserID + " data-status=0 ><i class='fa fa-toggle-on'></i>停用</a> "); |
| | | } |
| | | html.push("<a href='javascript:;' class='btn btn-success btn-xs action-edit' data-id='" + this.UserID + "'><i class='fa fa-edit'></i> 编辑</a> "); |
| | | html.push("<a href='javascript:;' data-id='" + this.Account + "' class='action-modal-updatePwd btn btn-primary btn-xs'><i class='fa fa-edit'></i> 修改密码</a> "); |
| | | html.push("<a href='javascript:;' data-id='" + this.UserID + "' class='action-permission btn btn-info btn-xs'><i class='fa fa-edit'></i> 权限</a> "); |
| | | html.push("<a href='javascript:;' data-id='" + this.UserID + "' class='action-delete btn btn-default btn-xs'><i class='fa fa-trash'></i> 删除</a>"); |
| | | html.push("</td>"); |
| | | html.push("</tr>"); |
| | | }); |
| | | if (result.Message.TotalCount == 0) { |
| | | html.push("<tr><td colspan=\"10\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"); |
| | | html.push("<tr><td colspan=\"11\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"); |
| | | } |
| | | |
| | | $("#mainTable>tbody").html(html.join("")); |
| | |
| | | }); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-update-status", function () { |
| | | //data的属性参数不能含有大写字母。 |
| | | var userId = $(this).data("id"); |
| | | var status = $(this).data("status"); |
| | | mytek.confirm("是否更新信息状态?", "请谨慎操作!", function (b) { |
| | | if (b) { |
| | | $.post("sysuser.ashx", { "action": "updateStatus", userId: userId, status: status }, function (r) { |
| | | mytek.alert(r.Message, r.OK, function () { |
| | | loadUserList(); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-save", function() { |
| | | var userid = $("#userDialog").data("id"); |
| | | var account = $("#userDialog #account").val(); |
| | | var password = $("#userDialog #password").val(); |
| | | var userName = $("#userDialog #userName").val(); |
| | | var userType = $("#userDialog #userType").val(); |
| | | var mobile = $("#userDialog #mobile").val(); |
| | | var email = $("#userDialog #email").val(); |
| | | var emailFlag = $("#userDialog #emailFlag").val(); |
| | |
| | | var isVerification = $("#userDialog #isVerification").prop("checked"); |
| | | |
| | | var clientIp = $("#userDialog #clientIp").val(); |
| | | var userRoleArray = []; |
| | | $("#userDialog #_UserRole").each(function () { |
| | | if ($(this).is(":checked")) { |
| | | userRoleArray.push($(this).val()); |
| | | } |
| | | }); |
| | | userType = $.toJSON(userRoleArray); |
| | | |
| | | $.post("sysuser.ashx", { action: "saveUser", userid: userid, account: account, password: password, mobile: mobile, email: email, mobileFlag: mobileFlag, emailFlag: emailFlag, isVerification: isVerification, clientIp: clientIp }, |
| | | $.post("sysuser.ashx", { action: "saveUser", userid: userid, account: account, password: password, userName: userName, userType: userType, mobile: mobile, email: email, mobileFlag: mobileFlag, emailFlag: emailFlag, isVerification: isVerification, clientIp: clientIp }, |
| | | function(result) { |
| | | mytek.alert(result.Message, result.OK, function() { |
| | | if (result.OK) { |
| | |
| | | $("#userDialog .modal-title").html("创建账户"); |
| | | $("#userDialog").data("id", 0); |
| | | $("#userDialog #account").val(""); |
| | | $("#userDialog #password").val(""); |
| | | //$("#userDialog #password").val(""); |
| | | $("#userDialog #userName").val(""); |
| | | //$("#userDialog #userType").val(""); |
| | | $("#userDialog #_UserRole").iCheck("uncheck"); |
| | | |
| | | $("#userDialog #mobile").val(""); |
| | | $("#userDialog #email").val(""); |
| | | $("#userDialog input[name=isVerification]").iCheck("uncheck"); |
| | | $("#userDialog #clientIp").val(""); |
| | | |
| | | //刷新一次随机密码 |
| | | $("#userDialog #password").val(randomString(8)); |
| | | $(".pwdCss").show(); |
| | | |
| | | $("#userDialog").modal("show"); |
| | | }); |
| | | |
| | |
| | | } |
| | | else { |
| | | $("#permissionDialog").data("id", id); |
| | | $("#permissionDialog #MenuID").prop("checked", false); |
| | | $("#permissionDialog #MenuID").prop("checked", false).attr("disabled", "disabled"); |
| | | $.each(result.Message, function(i) { |
| | | $("#permissionDialog #MenuID[value='" + this + "']").prop("checked", true); |
| | | $("#permissionDialog #MenuID[value='" + this + "']").prop("checked", true).attr("disabled", "disabled"); |
| | | }); |
| | | } |
| | | $("#permissionDialog").modal("show"); |
| | |
| | | var user = result.Message; |
| | | $("#userDialog").data("id", id); |
| | | $("#userDialog #account").val(user.Account); |
| | | $("#userDialog #password").val(user.Password); |
| | | //$("#userDialog #password").val(user.Password); |
| | | $("#userDialog #password").val(""); |
| | | //编辑时密码框隐藏 |
| | | $(".pwdCss").hide(); |
| | | $("#userDialog #userName").val(user.UserName); |
| | | //$("#userDialog #userType").val(user.UserType); |
| | | $.get("sysuser.ashx", { action: "arrayStrToDict", "userId": id, "userType": user.UserType }, function (r) { |
| | | if (!r.OK) { |
| | | mytek.alert(r.Message, r.OK); |
| | | } |
| | | else { |
| | | $("#userDialog #_UserRole").prop("checked", false); |
| | | $.each(r.Message, function (i) { |
| | | $("#userDialog #_UserRole[value='" + this + "']").prop("checked", true); |
| | | }); |
| | | } |
| | | }, "json"); |
| | | |
| | | $("#userDialog #mobile").val(user.Mobile); |
| | | $("#userDialog #email").val(user.Email); |
| | | $("#userDialog #emailFlag").val(user.EmailFlag); |
| | | $("#userDialog #mobileFlag").val(user.MobileFlag); |
| | | $("#userDialog #isVerification").iCheck(user.IsVerification == 1 ? "check" : "uncheck"); |
| | | $("#userDialog #clientIp").val(user.ClientIp); |
| | | |
| | | $("#userDialog").modal("show"); |
| | | }, "json"); |
| | | }); |
| | | |
| | | loadUserList(); |
| | | |
| | | }); |
| | | |
| | | //生成随机码 |
| | | function randomString(len) { |
| | | len = len || 32; |
| | | var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/ |
| | | var maxPos = $chars.length; |
| | | var pwd = ''; |
| | | for (i = 0; i < len; i++) { |
| | | pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); |
| | | } |
| | | return pwd; |
| | | } |
| | | |
| | | //添加系统账号:生成密码 |
| | | $(document).on("click", ".action-generate-password", function () { |
| | | $("#password").val(randomString(8)); |
| | | }); |
| | | |
| | | //添加系统账号:复制密码 |
| | | $(document).on("click", ".action-copyPwd", function () { |
| | | var value = $("#password").val(); |
| | | if (value == "") { |
| | | mytek.alert("请生成密码!"); |
| | | return false; |
| | | } |
| | | // for ie |
| | | if (window.clipboardData) { |
| | | window.clipboardData.clearData(); |
| | | window.clipboardData.setData('text', value); |
| | | } |
| | | // for modern browser |
| | | else if (document.execCommand) { |
| | | var element = document.createElement('SPAN'); |
| | | element.textContent = value; |
| | | document.body.appendChild(element); |
| | | if (document.selection) { |
| | | var range = document.body.createTextRange(); |
| | | range.moveToElementText(element); |
| | | range.select(); |
| | | } else if (window.getSelection) { |
| | | var range = document.createRange(); |
| | | range.selectNode(element); |
| | | window.getSelection().removeAllRanges(); |
| | | window.getSelection().addRange(range); |
| | | } |
| | | document.execCommand('copy'); |
| | | element.remove ? element.remove() : element.removeNode(true); |
| | | } |
| | | mytek.alert("复制成功!", false); |
| | | |
| | | }); |
| | | |
| | | //修改密码:打开界面 |
| | | $(document).on("click", ".action-modal-updatePwd", function () { |
| | | //$("#updatePwdDialog .modal-title").text("修改客户资料"); |
| | | $("#updatePwdDialog input[name=action]").val("updatePwd"); |
| | | var account = $(this).data("id"); |
| | | |
| | | $("#updatePwdDialog input[name='account']").val(account); |
| | | $("#updatePwdDialog #newPwd").val(""); |
| | | |
| | | $("#updatePwdDialog").modal("show"); |
| | | |
| | | }); |
| | | |
| | | //修改密码:生成密码 |
| | | $(document).on("click", ".action-generate-newPwd", function () { |
| | | $("#newPwd").val(randomString(8)); |
| | | }); |
| | | |
| | | //修改密码:复制密码 |
| | | $(document).on("click", ".action-copyNewPwd", function () { |
| | | var value = $("#newPwd").val(); |
| | | if (value == "") { |
| | | mytek.alert("请生成密码!"); |
| | | return false; |
| | | } |
| | | |
| | | // for ie |
| | | if (window.clipboardData) { |
| | | window.clipboardData.clearData(); |
| | | window.clipboardData.setData('text', value); |
| | | } |
| | | // for modern browser |
| | | else if (document.execCommand) { |
| | | var element = document.createElement('SPAN'); |
| | | element.textContent = value; |
| | | document.body.appendChild(element); |
| | | if (document.selection) { |
| | | var range = document.body.createTextRange(); |
| | | range.moveToElementText(element); |
| | | range.select(); |
| | | } else if (window.getSelection) { |
| | | var range = document.createRange(); |
| | | range.selectNode(element); |
| | | window.getSelection().removeAllRanges(); |
| | | window.getSelection().addRange(range); |
| | | } |
| | | document.execCommand('copy'); |
| | | element.remove ? element.remove() : element.removeNode(true); |
| | | } |
| | | mytek.alert("复制成功!", false); |
| | | |
| | | }); |
| | | |
| | | /** |
| | | //面板页提交:隐藏面板(白名单,黑名单,修改密码) |
| | | $("#blackForm, #whiteForm").ajaxForm({ |
| | | success: function (r) { |
| | | mytek.alert(r.Message, r.OK, function () { |
| | | $("#whiteDialog, #blackDialog").modal("hide"); |
| | | }); |
| | | } |
| | | }); |
| | | **/ |
| | | |
| | | //面板页提交:重新加载列表 |
| | | $("#updatePwdForm").ajaxForm({ |
| | | success: function (r) { |
| | | mytek.alert(r.Message, r.OK, function () { |
| | | r.OK && (window.location.reload()); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | </script> |
| | |
| | | <div class="modal-body"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 账户</label> |
| | | 账户 <span style="color:red">*</span></label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" name="account" id="account" value="" class="form-control" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group pwdCss"> |
| | | <label class="col-sm-2 control-label"> |
| | | 密码 <span style="color:red">*</span></label> |
| | | <div class="col-sm-4"> |
| | | <input type="password" name="password" id="password" value="" class="form-control" /> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <a class="btn btn-xs btn-primary action-generate-password ">生成密码</a> |
| | | <a class="btn btn-xs btn-success action-copyPwd " >复制密码</a> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 密码</label> |
| | | 账户名称 <span style="color:red">*</span></label> |
| | | <div class="col-sm-10"> |
| | | <input type="password" name="password" id="password" value="" class="form-control" /> |
| | | <input type="text" name="userName" id="userName" value="" class="form-control" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 账户类型 <span style="color:red">*</span> |
| | | </label> |
| | | <div class="col-sm-10"> |
| | | <%=UserRoleList() %> |
| | | <!-- |
| | | <select name="userType" id="userType" class="form-control"> |
| | | <option value=""></option> |
| | | <option value="1">管理员</option> |
| | | <option value="2">业务员</option> |
| | | <option value="3">客户经理</option> |
| | | <option value="4">客服人员</option> |
| | | <option value="5">财务人员</option> |
| | | </select> |
| | | --> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | |
| | | <div class="modal-dialog"> |
| | | <div class="modal-content animated bounceInRight"> |
| | | <div class="modal-header"> |
| | | <span class="title">设置账户权限</span><a class="close" data-dismiss="modal" aria-hidden="true">×</a></div> |
| | | <span class="title">查看账户权限</span><a class="close" data-dismiss="modal" aria-hidden="true">×</a></div> |
| | | <div class="modal-body"> |
| | | |
| | | <%=RenderFunctionTree() %> |
| | |
| | | <div class="modal-footer"> |
| | | <button class="btn-default btn" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <!-- |
| | | <button class="btn btn-primary action-update-permission"> |
| | | 保存</button> |
| | | --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <form name="DefaultForm" method="post" action="GwSpUpdate.aspx" id="DefaultForm"> |
| | | <div class="listCanvas"> |
| | | |
| | | |
| | | <!--重置密码或修改密码 --> |
| | | <div class="modal inmodal fade" id="updatePwdDialog" tabindex="-1" role="dialog" aria-hidden="true"> |
| | | <form name="updatePwdForm" method="post" action="sysuser.ashx?action=updatePwd" id="updatePwdForm" |
| | | class="form-horizontal"> |
| | | <div class="modal-dialog modal-lg"> |
| | | <div class="modal-content "> |
| | | <div class="modal-header"> |
| | | <button type="button" class="close" data-dismiss="modal"> |
| | | <span aria-hidden="true">×</span><span class="sr-only">Close</span></button> |
| | | <h4 class="modal-title">系统账号密码修改 |
| | | </h4> |
| | | 请先执行【生成密码】后,再执行【复制密码】。 |
| | | </div> |
| | | <div class="modal-body"> |
| | | <input type="hidden" value="" name="account" /> |
| | | <div class="form-group"> |
| | | <label class="control-label col-sm-2"> |
| | | 登录密码 <span style="color:red">*</span> |
| | | </label> |
| | | <div class="col-sm-4"> |
| | | <input type="password" name="newPwd" id="newPwd" value="" class="form-control" /> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <a class="btn btn-xs btn-primary action-generate-newPwd ">生成密码</a> |
| | | <a class="btn btn-xs btn-success action-copyNewPwd " >复制密码</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="modal-footer"> |
| | | <button class="btn btn-warning" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <button class="btn btn-primary action-save-pwd"> |
| | | 保存</button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <!--form name="DefaultForm" method="post" action="GwSpUpdate.aspx" id="DefaultForm" --> |
| | | <div class="listCanvas"> |
| | | <button class="btn btn-warning action-create "> 创建账户</button> |
| | | <table id="mainTable" class="table table-striped table-bordered table-hover"> |
| | | <thead> |
| | | <tr> |
| | | <th> |
| | | 账号 |
| | | </th> |
| | | <th> |
| | | 用户名称 |
| | | </th> |
| | | <th> |
| | | 用户类型 |
| | | </th> |
| | | <th> |
| | | 手机 |
| | |
| | | <th> |
| | | 创建时间 |
| | | </th> |
| | | <th style="width: 200px;"> |
| | | <th> |
| | | 状态 |
| | | </th> |
| | | <th style="width: 320px;"> |
| | | 操作 |
| | | </th> |
| | | </tr> |
| | |
| | | </div> |
| | | <div id="pagination"> |
| | | </div> |
| | | </form> |
| | | <!-- |
| | | <div class="row"> |
| | | <div class="col-sm-7"> |
| | | <div class="ibox float-e-margins"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | --> |
| | | <div> |
| | | <h5> |
| | | </h5> |
| | |
| | | |
| | | <div id="mask" class="mask"> |
| | | <span></span> |
| | | <img src="img/spinning-circles.svg" alt="载入中..." /></div> |
| | | </div> |
| | | <img src="img/spinning-circles.svg" alt="载入中..." /> |
| | | |
| | | </div> |
| | | </asp:Content> |