OpenAuth.Net/OpenAuth.Mvc/Views/UserManager/Index.cshtml

237 lines
6.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@{
Layout = "~/Views/Shared/_BjuiLayout.cshtml";
}
@{ Html.RenderAction("MenuHeader", "Home");}
<div class="bjui-pageContent tableContent" style="position:relative">
<div class="clearfix">
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
<ul id="maintree" class="ztree"></ul>
</div>
<div id="detail" style="margin-left: 225px;">
</div>
</div>
</div>
<script type="text/javascript">
var selectedId = 0;
var grid;
$(document).ready(function () {
initZtree();
loadDataGrid();
});
//加载数据到datagrid
function loadDataGrid() {
//b-jui的datagrid需要重新处理HTML
$('#detail').empty()
.append('<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>');
$('#maingrid').datagrid({
showToolbar: false,
filterThead: false,
target: $(this),
columns: [
{
name: 'Id',
label: 'Id',
attrs: { readonly: 'readonly' },
hide: true
},
{
name: 'Account',
label: '用户账号',
width: 142,
attrs: { readonly: 'readonly' }
},
{
name: 'Name',
label: '姓名/昵称',
width: 226
},
{
name: 'Organizations',
label: '所属机构',
width: 150
},
{
name: 'Status',
label: '状态',
type: 'select',
align: 'center',
width: 80,
items: [{ '0': '正常' }, { '1': '禁用' }]
},
{
name: 'Sex',
label: '性别',
type: 'select',
align: 'center',
width: 80,
items: [{ '0': '男' }, { '1': '女' }]
},
{
name: 'CreateTime',
label: '登记日期',
type: 'date',
width: 180,
pattern: 'yyyy-MM-dd HH:mm:ss'
}
],
dataUrl: '/UserManager/Load?orgId=' + selectedId,
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true,
paging: true,
filterMult: false,
showTfoot: false,
height: '100%' //TODO这种高度如果记录数较少的时候看起有点怪这个可以根据自己爱好修改
});
}
function zTreeOnClick(event, treeId, treeNode) {
selectedId = treeNode.Id;
loadDataGrid();
}
function initZtree() {
var setting = {
view: { selectedMulti: false },
data: {
key: {
name: 'Name',
title: 'Name'
},
simpleData: {
enable: true,
idKey: 'Id',
pIdKey: 'ParentId',
rootPId: 'null'
}
},
callback: { onClick: zTreeOnClick }
};
$.getJSON('/OrgManager/LoadOrg', function (json) {
var zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
zTreeObj.expandAll(true);
});
}
//删除
function delUser() {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$.getJSON('/UserManager/Delete?Id=' + selected, function (data) {
if (data.statusCode == "200")
refreshGrid();
else {
$(this).alertmsg('warn', data.message);
}
});
}
//自定义的编辑按钮
function editUser() {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$(this).dialog({
id: 'editDialog',
url: '/UserManager/Add?id=' + selected,
title: '编辑',
onClose: function () {
refreshUserGrid();
}
});
}
function refreshUserGrid() {
$('#maingrid').datagrid('refresh');
}
//用户模块授权按钮
function openUserModuleAccess(obj) {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$(obj).dialog({
id: 'accessUserModule',
url: '/ModuleManager/LookupMultiForUser',
title: '为用户分配模块',
data: {
userId: selected
}
});
}
//用户可见组织授权按钮
function openUserOrgAccess(obj) {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$(obj).dialog({
id: 'accessUserOrg',
url: '/OrgManager/LookupMultiForUser',
title: '为用户分配可见部门',
data: {
userId: selected
}
});
}
//用户角色授权
function openUserRoleAccess(obj) {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$(obj).dialog({
id: 'accessUserRole',
url: '/RoleManager/LookupMulti',
title: '为用户分配角色',
width: 600,
height: 380,
data: {
userId: selected
}
});
}
//为用户分配资源
function openUserReourceAccess(obj) {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$(obj).dialog({
id: 'accessUserRole',
url: '/ResourceManager/LookupMultiForUser',
title: '为用户分配资源',
width: 600,
height: 380,
data: {
userId: selected
}
});
}
//分配菜单
function openAssignUserElement(obj) {
var selected = getSelected('#maingrid', 2);
if (selected == null) return;
$(obj).dialog({
id: 'assignElement',
url: '/ModuleElementManager/AssignForUser?userId=' + selected,
title: '为用户分配菜单',
width: 700,
height: 380
});
}
</script>