You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
339 lines
16 KiB
Plaintext
339 lines
16 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RoleInfoList.aspx.cs" Inherits="TradeManage.SysManage.RoleInfoList" %>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head runat="server">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title></title>
|
|
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
|
|
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
|
|
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
|
|
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
|
|
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" />
|
|
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
|
|
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
|
|
<script src="../Scripts/Global.js" type="text/javascript"></script>
|
|
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
|
|
<script src="../Scripts/Custom_UserInfo.js" type="text/javascript"></script>
|
|
<script src="../Scripts/JSLINQ.js" type="text/javascript"></script>
|
|
<script src="../Scripts/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
|
var WindowLoadModel = new WindowLoad();
|
|
var Custom_UserInfo1 = new Custom_UserInfo();
|
|
|
|
var Custom_UserInfo2 = new Custom_UserInfo();
|
|
var ListMenu = null;
|
|
var Model = null;
|
|
$(document).ready(function () {
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
WindowLoadModel.Isbgiframe = true;
|
|
WindowLoadModel.Load();
|
|
ajaxInit(WindowLoadModel);
|
|
|
|
Custom_UserInfo1.Load();
|
|
Custom_UserInfo1.Save(function (ListModel) {
|
|
Array.clear(Model.ListRoleUser);
|
|
var html = new Sys.StringBuilder();
|
|
$(ListModel).each(function () {
|
|
var model = new Object();
|
|
model.UserId = this.ID;
|
|
model.UserName = this.Name;
|
|
Array.add(Model.ListRoleUser, model);
|
|
html.append("," + this.Name);
|
|
});
|
|
$('#txtRoleUser').html(html.toString().substr(1));
|
|
});
|
|
|
|
Custom_UserInfo2.ControlID = "Window_Custom_UserInfo2";
|
|
Custom_UserInfo2.Load();
|
|
Custom_UserInfo2.Save(function (ListModel) {
|
|
Array.clear(Model.ListRoleUser);
|
|
var html = new Sys.StringBuilder();
|
|
$(ListModel).each(function () {
|
|
var model = new Object();
|
|
model.UserId = this.ID;
|
|
model.UserName = this.Name;
|
|
Array.add(Model.ListRoleUser, model);
|
|
html.append("," + this.Name);
|
|
});
|
|
$('#txtRoleUser').html(html.toString().substr(1));
|
|
});
|
|
|
|
//var height = $("#listRole").removeAttr("size").innerHeight();
|
|
//var maxheight = $("#leftdiv").height();
|
|
//var size = parseInt(maxheight / height) + 3;
|
|
//$("#listRole").attr("size", size);
|
|
|
|
BindCompany();
|
|
BindRole();
|
|
GetParentMenuList();
|
|
|
|
$('#select_listCompany').change(function () {
|
|
BindRole();
|
|
GetParentMenuList();
|
|
});
|
|
|
|
$("#cmdAddRole").click(function () {
|
|
Save();
|
|
$("#txtRoleName").val("");
|
|
});
|
|
$("#cmdDelRole").click(function () {
|
|
var RoleId = $("#listRole").val();
|
|
if (RoleId == null || RoleId == undefined) { alert("没有可以删除的角色"); return; }
|
|
Delete(RoleId);
|
|
Model = null;
|
|
$('#txtRoleUser').html("");
|
|
$("#txtRoleMenu").html("");
|
|
});
|
|
$("#listRole").change(function () {
|
|
GetModel();
|
|
});
|
|
|
|
$("#txtRoleMenu img").live("click",function () {
|
|
var State = $(this).attr("State");
|
|
if (State == "1") {
|
|
$(this).attr("State", "0").attr("src", "../themes/icons/tree1.jpg");
|
|
$(this).parent().next().hide();
|
|
} else {
|
|
$(this).attr("State", "1").attr("src", "../themes/icons/tree2.jpg");
|
|
$(this).parent().next().show();
|
|
}
|
|
});
|
|
|
|
$("#txtRoleMenu div[Hearer] :radio").live("click", function () {
|
|
var PopedomType=$(this).parent().find(":checked").attr("PopedomType");
|
|
$(this).parent().next().find("input[PopedomType='" + PopedomType + "']").attr("checked","checked");
|
|
});
|
|
|
|
$("#cmdAddUser").click(function () {
|
|
if (Model == null) { alert("请选择一个角色"); return; }
|
|
var ListModel = new Array();
|
|
if (Model.ListRoleUser != null && Model.ListRoleUser.length > 0) {
|
|
$(Model.ListRoleUser).each(function () {
|
|
var model = new Object();
|
|
model.ID = this.UserId;
|
|
model.Name = this.UserName;
|
|
Array.add(ListModel, model);
|
|
});
|
|
}
|
|
var CompanyID = $("#select_listCompany").val();
|
|
Custom_UserInfo2.Show(CompanyID, ListModel);
|
|
});
|
|
|
|
$("#cmdSave").click(function () {
|
|
SaveDetail();
|
|
});
|
|
|
|
});
|
|
|
|
//#region 读取机构
|
|
function BindCompany() {
|
|
$.ajax({
|
|
url: "../UserService.asmx/GetListCompany",
|
|
async: false,
|
|
success: function (data) {
|
|
if (data.d == null) { alert("机构不存在,请先添加机构"); return; }
|
|
var html = new Sys.StringBuilder();
|
|
//html.append("<option value='0'>全部</option>");
|
|
$(data.d).each(function () {
|
|
html.append("<option value='" + this.ID + "'>" + this.Name + "</option>");
|
|
});
|
|
$('#select_listCompany').html(html.toString());
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 读取角色
|
|
function BindRole() {
|
|
var param = new Object();
|
|
param.CompanyID = $("#select_listCompany").val();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/GetList_JC_RoleInfo",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
async: false,
|
|
success: function (data) {
|
|
var html = new Sys.StringBuilder();
|
|
$(data.d).each(function () {
|
|
html.append("<option value='" + this.RoleID + "'>" + this.RoleName + "</option>");
|
|
});
|
|
$('#listRole').html(html.toString());
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 删除角色
|
|
function Delete(RoleId) {
|
|
if (window.confirm("确定要删除吗?") == false) return;
|
|
var param = new Object();
|
|
param.RoleId = RoleId;
|
|
$.ajax({
|
|
url: "SysManageService.asmx/Delete_JC_RoleInfo",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
BindRole();
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 保存角色
|
|
function Save() {
|
|
var param = new Object();
|
|
param.RoleID = 0;
|
|
param.CompanyID = $("#select_listCompany").val();
|
|
param.RoleName = $("#txtRoleName").val();
|
|
if (param.RoleName == "") { alert("请输入要新增的角色名称"); return;}
|
|
$.ajax({
|
|
url: "SysManageService.asmx/Save_JC_RoleInfo",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
BindRole();
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 读取菜单父节点
|
|
function GetParentMenuList() {
|
|
var param = new Object();
|
|
param.CompanyID = $("#select_listCompany").val();
|
|
$.ajax({
|
|
url: "SysManageService.asmx/GetParentMenuList",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
ListMenu = data.d;
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 读取角色对象
|
|
function GetModel() {
|
|
var param = new Object();
|
|
param.RoleID = $("#listRole").val();
|
|
param.CompanyID = $("#select_listCompany").val();
|
|
if (param.RoleID == null || param.RoleID == undefined) return;
|
|
$.ajax({
|
|
url: "SysManageService.asmx/GetModel_JC_RoleInfo",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
Model = data.d;
|
|
if (Model.ListRoleUser == null) Model.ListRoleUser = new Array();
|
|
if (Model.ListRoleMenu == null) Model.ListRoleMenu = new Array();
|
|
if (Model.ListRoleUser.length > 0) {
|
|
var html = new Sys.StringBuilder();
|
|
$(Model.ListRoleUser).each(function () {
|
|
html.append("," + this.UserName);
|
|
});
|
|
$('#txtRoleUser').html(html.toString().substr(1));
|
|
} else { $('#txtRoleUser').html(""); }
|
|
if (Model.ListRoleMenu.length > 0) {
|
|
var html = new Sys.StringBuilder();
|
|
$(ListMenu).each(function () {
|
|
html.append("<div>");
|
|
html.append("<div Hearer='0'>");
|
|
html.append("<img State='1' src='../themes/icons/tree2.jpg' style='width:16px;heigth:16px;cursor:pointer;' />");
|
|
html.append(this.ModuleName);
|
|
html.append(" 全选<input id='Radio_C_" + this.ModuleNo + "' PopedomType='0' type='radio' name='A_" + this.ModuleNo + "' /><label for='Radio_C_" + this.ModuleNo + "' >无</label>");
|
|
html.append(" <input id='Radio_D_" + this.ModuleNo + "' PopedomType='2' type='radio' name='A_" + this.ModuleNo + "' /><label for='Radio_D_" + this.ModuleNo + "'>管理</label>");
|
|
html.append("</div>");
|
|
var No = this.ModuleNo;
|
|
html.append("<div>");
|
|
$(Model.ListRoleMenu).each(function (i) {
|
|
if (this.ParentModuleNo != No) return true;
|
|
html.append("<div ModuleNo='" + this.ModuleNo + "' style='left: 20px; position: relative;width:90%'>");
|
|
html.append(this.ModuleName);
|
|
if (this.PopedomType == 0) {
|
|
html.append(" <input id='Radio_A_" + this.ModuleNo + "' PopedomType='0' type='radio' name='" + this.ModuleNo + "' checked /><label for='Radio_A_" + this.ModuleNo + "' >无</label>");
|
|
html.append(" <input id='Radio_B_" + this.ModuleNo + "' PopedomType='2' type='radio' name='" + this.ModuleNo + "' /><label for='Radio_B_" + this.ModuleNo + "'>管理</label>");
|
|
} else {
|
|
html.append(" <input id='Radio_A_" + this.ModuleNo + "' PopedomType='0' type='radio' name='" + this.ModuleNo + "' /><label for='Radio_A_" + this.ModuleNo + "' >无</label>");
|
|
html.append(" <input id='Radio_B_" + this.ModuleNo + "' PopedomType='2' type='radio' name='" + this.ModuleNo + "' checked /><label for='Radio_B_" + this.ModuleNo + "' >管理</label>");
|
|
}
|
|
html.append("</div>");
|
|
});
|
|
html.append("</div>");
|
|
html.append("</div>");
|
|
$("#txtRoleMenu").html(html.toString());
|
|
});
|
|
} else {$("#txtRoleMenu").html(""); }
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
//#region 保存角色明细
|
|
function SaveDetail() {
|
|
if (Model == null) { alert("请选择一个角色"); return;}
|
|
Array.clear(Model.ListRoleMenu);
|
|
$("#txtRoleMenu div[ModuleNo]").each(function () {
|
|
var model = new Object();
|
|
model.ModuleNo=$(this).attr("ModuleNo");
|
|
model.PopedomType = $(this).find("input:checked").attr("PopedomType");
|
|
Array.add(Model.ListRoleMenu, model);
|
|
});
|
|
var param = new Object();
|
|
param.CompanyID = $("#select_listCompany").val();
|
|
param.Model = Model;
|
|
$.ajax({
|
|
url: "SysManageService.asmx/SaveDetail_JC_RoleInfo",
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
success: function (data) {
|
|
alert("保存成功");
|
|
}
|
|
});
|
|
}
|
|
//#endregion
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="title_ico">
|
|
角色信息
|
|
</div>
|
|
<table class="tableAll" style="width: 100%;">
|
|
<colgroup>
|
|
<col style="width: 270px;" />
|
|
</colgroup>
|
|
<tr>
|
|
<td style="vertical-align:top;">
|
|
<div class="easyui-panel" title="角色列表" style="width: 100%; height: auto; padding: 10px; background: #fafafa;"
|
|
data-options="iconCls:'icon-man',closable:false,collapsible:true,minimizable:false,maximizable:false">
|
|
<div id="leftdiv_home">
|
|
<input id="txtRoleName" type="text" class="editTextbox" style="width: 120px; vertical-align: middle;" />
|
|
<input id="cmdAddRole" class="btnClass btnClassAdd" type="button" value="新增" />
|
|
<input id="cmdDelRole" class='btnClass btnClassDel' type='button' value='删除' />
|
|
</div>
|
|
<div>
|
|
<select id="listRole" size="40" style="width: 100%;"></select>
|
|
</div>
|
|
|
|
</div>
|
|
</td>
|
|
<td style="vertical-align:top;">
|
|
<table>
|
|
<tr>
|
|
<td style="width:60px;">机构</td>
|
|
<td style="width:225px;"><select id="select_listCompany" class="selectClass" style="width: 225px;"></select></td>
|
|
<td>
|
|
<input id="cmdSave" class='btnClass btnClassSave' type='button' value='保存' />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<div class="easyui-panel" title="角色所属员工" style="width: 100%; height: auto; padding: 10px; background: #fafafa;"
|
|
data-options="iconCls:'icon-man',closable:false,collapsible:true,minimizable:false,maximizable:false">
|
|
<input id="cmdAddUser" class="btnClass btnClassAdd" type="button" value="选择" />
|
|
<div id="txtRoleUser" style="position: relative;"></div>
|
|
</div>
|
|
<div class="easyui-panel" title="菜单权限" style="width: 100%; height: auto; padding: 10px; background: #fafafa;"
|
|
data-options="iconCls:'icon-man',closable:false,collapsible:true,minimizable:false,maximizable:false">
|
|
<div id="txtRoleMenu"></div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
</body>
|
|
</html>
|