mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
完成所有主列表JS模块化
This commit is contained in:
parent
25bb5bf07c
commit
2f0a9a3719
@ -39,14 +39,24 @@ Description="连接的数据库" %>
|
||||
<% foreach (ColumnSchema column in this.SourceTable.Columns) {
|
||||
if(column.IsPrimaryKeyMember){%>
|
||||
<input type="text" id="<%=column.Name%>" name="<%=column.Name%>" value="" class="hidden" />
|
||||
<%}else if(CSharpAlias[column.SystemType.FullName] == "bool"
|
||||
||(CSharpAlias[column.SystemType.FullName] == "int" && Tools.GetDescription(column).Contains("下拉选择"))) {%>
|
||||
<%}else if(CSharpAlias[column.SystemType.FullName] == "bool") {%>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="<%=column.Name%>" class="control-label x120"><%=Tools.GetDescription(column)%>:</label>
|
||||
<select name="<%=column.Name%>" id="<%=column.Name%>" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="false">否</option>
|
||||
<option value="true">是</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<%}else if(CSharpAlias[column.SystemType.FullName] == "int" ) {%>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="<%=column.Name%>" class="control-label x120"><%=Tools.GetDescription(column)%>:</label>
|
||||
<select name="<%=column.Name%>" id="<%=column.Name%>" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">默认</option>
|
||||
<option value="1">禁用</option>
|
||||
<option value="1">状态1</option>
|
||||
<option value="2">状态2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -32,13 +32,11 @@ function MainGrid() {
|
||||
, hide: true
|
||||
<%} %>
|
||||
<%else if(CSharpAlias[column.SystemType.FullName] == "bool") {%>
|
||||
,type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '否' }, { '1': '是' }],
|
||||
,align: 'center',
|
||||
items: [{ 'false': '否' }, { 'true': '是' }],
|
||||
<%} %>
|
||||
<%else if(CSharpAlias[column.SystemType.FullName] == "int") {%>
|
||||
,type: 'select',
|
||||
align: 'center',
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
<%} %>
|
||||
},
|
||||
@ -181,22 +179,25 @@ var editDlg = function () {
|
||||
$("#Id").val(0);
|
||||
|
||||
<%if(Tools.NeedCascade(SourceTable)){
|
||||
Response.WriteLine("parentTree.show()");
|
||||
Response.WriteLine("parentTree.show();");
|
||||
}%>
|
||||
},
|
||||
update: function (ret) { //弹出编辑框
|
||||
update = true;
|
||||
show();
|
||||
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
||||
<%if(CSharpAlias[column.SystemType.FullName] == "bool"
|
||||
||(CSharpAlias[column.SystemType.FullName] == "int" && Tools.GetDescription(column).Contains("下拉选择"))) {%>
|
||||
<%if(column.IsPrimaryKeyMember){%>
|
||||
$('#<%=column.Name%>').val(ret.<%=column.Name%>);
|
||||
<%}else if(CSharpAlias[column.SystemType.FullName] == "bool") {%>
|
||||
$('#<%=column.Name%>').selectpicker('val', ret.<%=column.Name%>?"true":"false");
|
||||
<%}else if(CSharpAlias[column.SystemType.FullName] == "int") {%>
|
||||
$('#<%=column.Name%>').selectpicker('val', ret.<%=column.Name%>);
|
||||
<%} else{ %>
|
||||
$('#<%=column.Name%>').val(ret.<%=column.Name%>);
|
||||
<%} %>
|
||||
<% } %>
|
||||
<%if(Tools.NeedCascade(SourceTable)){
|
||||
Response.WriteLine("parentTree.show()");
|
||||
Response.WriteLine("parentTree.show();");
|
||||
}%>
|
||||
},
|
||||
save: function() { //编辑-->保存
|
||||
@ -219,7 +220,7 @@ function del() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/moduleManager/Delete?Id=' + selected.Id, function (data) {
|
||||
$.getJSON('/<%=ModuleName%>/Delete?Id=' + selected.Id, function (data) {
|
||||
if (data.statusCode == "200") {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
|
@ -50,9 +50,9 @@ namespace OpenAuth.App
|
||||
/// <exception cref="System.Exception">未能找到该组织的父节点信息</exception>
|
||||
public int AddOrUpdate(Org org)
|
||||
{
|
||||
ChangeModuleCascade(org);
|
||||
if (org.Id == 0)
|
||||
{
|
||||
ChangeModuleCascade(org);
|
||||
_repository.Add(org);
|
||||
}
|
||||
else
|
||||
|
@ -56,7 +56,9 @@ namespace OpenAuth.App
|
||||
foreach (var user in users)
|
||||
{
|
||||
UserView uv = user;
|
||||
uv.Organizations = string.Join(",", _orgRepository.LoadByUser(user.Id).Select(u => u.Name).ToList());
|
||||
var orgs = _orgRepository.LoadByUser(user.Id);
|
||||
uv.Organizations = string.Join(",", orgs.Select(u => u.Name).ToList());
|
||||
uv.OrganizationIds = string.Join(",", orgs.Select(u => u.Id).ToList());
|
||||
userviews.Add(uv);
|
||||
}
|
||||
|
||||
@ -105,16 +107,17 @@ namespace OpenAuth.App
|
||||
public void AddOrUpdate(UserView view)
|
||||
{
|
||||
User user = view;
|
||||
user.CreateTime = DateTime.Now;
|
||||
if (user.Id == 0)
|
||||
{
|
||||
user.CreateTime = DateTime.Now;
|
||||
|
||||
user.Password = user.Account; //初始密码与账号相同
|
||||
_repository.Add(user);
|
||||
view.Id = user.Id; //要把保存后的ID存入view
|
||||
}
|
||||
else
|
||||
{
|
||||
_repository.Update(user);
|
||||
_repository.Update(u=>u.Id, user);
|
||||
}
|
||||
int[] orgIds = view.OrganizationIds.Split(',').Select(id => int.Parse(id)).ToArray();
|
||||
|
||||
|
@ -241,7 +241,7 @@ function del() {
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
//编辑
|
||||
function edit() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) {
|
||||
@ -250,10 +250,12 @@ function edit() {
|
||||
editDlg.update(selected);
|
||||
}
|
||||
|
||||
//添加
|
||||
function add() {
|
||||
editDlg.add();
|
||||
}
|
||||
|
||||
//刷新
|
||||
function refresh() {
|
||||
list.reload();
|
||||
}
|
||||
|
@ -15,11 +15,11 @@
|
||||
var moduleId = $.CurrentDialog.find("#selectedModuleId").val(); //外部传递的moduleId
|
||||
|
||||
$(document).ready(function () {
|
||||
$.CurrentDialog.find('#btnAddElement').on('click', function () {
|
||||
$.CurrentDialog.find('#btnAddElement').on('click', function () { //添加菜单
|
||||
editEleDlg.add();
|
||||
});
|
||||
|
||||
$.CurrentDialog.find('#btnEditElement').on('click', function () {
|
||||
$.CurrentDialog.find('#btnEditElement').on('click', function () { //编辑菜单
|
||||
var selected = thisDlg.getSelectedObj();
|
||||
if (selected == null) {
|
||||
return;
|
||||
@ -27,7 +27,7 @@ $(document).ready(function () {
|
||||
editEleDlg.update(selected);
|
||||
});
|
||||
|
||||
$.CurrentDialog.find('#btnDelElement').on('click', function () {
|
||||
$.CurrentDialog.find('#btnDelElement').on('click', function () { //删除菜单
|
||||
var selected = thisDlg.getSelectedMany(); //可以一次删除多个
|
||||
if (selected == null) {
|
||||
return;
|
||||
|
@ -42,19 +42,7 @@ function MainGrid() {
|
||||
label: '主页面URL',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'HotKey',
|
||||
label: '热键',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'ParentId',
|
||||
label: '父节点流水号',
|
||||
width: 100
|
||||
, type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
|
||||
{
|
||||
name: 'IsLeaf',
|
||||
label: '是否叶子节点',
|
||||
@ -71,11 +59,6 @@ function MainGrid() {
|
||||
align: 'center',
|
||||
items: [{ 'false': '否' }, { 'true': '是' }],
|
||||
},
|
||||
{
|
||||
name: 'IconName',
|
||||
label: '节点图标文件名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '当前状态',
|
||||
|
256
OpenAuth.Mvc/BllScripts/orgManager.js
Normal file
256
OpenAuth.Mvc/BllScripts/orgManager.js
Normal file
@ -0,0 +1,256 @@
|
||||
|
||||
//grid列表模块
|
||||
function MainGrid() {
|
||||
var url = '/OrgManager/LoadChildren?Id=';
|
||||
var selectedId = 0; //ztree选中的模块
|
||||
this.maingrid = $('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: '流水号',
|
||||
width: 100
|
||||
, hide: true
|
||||
},
|
||||
{
|
||||
name: 'CascadeId',
|
||||
label: '节点语义ID',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '组织名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'ParentName',
|
||||
label: '父节点名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'IsLeaf',
|
||||
label: '是否叶子节点',
|
||||
width: 100
|
||||
,
|
||||
align: 'center',
|
||||
items: [{ 'false': '否' }, { 'true': '是' }],
|
||||
},
|
||||
{
|
||||
name: 'IsAutoExpand',
|
||||
label: '是否自动展开',
|
||||
width: 100
|
||||
,
|
||||
align: 'center',
|
||||
items: [{ 'false': '否' }, { 'true': '是' }],
|
||||
},
|
||||
{
|
||||
name: 'IconName',
|
||||
label: '节点图标文件名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'SortNo',
|
||||
label: '排序号',
|
||||
width: 100 ,
|
||||
align: 'center'
|
||||
},
|
||||
],
|
||||
dataUrl: url + selectedId,
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
this.reload = function (id) {
|
||||
if (id != undefined) selectedId = id;
|
||||
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
||||
};
|
||||
};
|
||||
MainGrid.prototype = new Grid();
|
||||
var list = new MainGrid();
|
||||
|
||||
//左边分类导航树
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: { onClick: zTreeOnClick }
|
||||
};
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
list.reload(treeNode.Id);
|
||||
}
|
||||
|
||||
return {
|
||||
reload: function () {
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
//编辑时,选择上级弹出的树
|
||||
var parentTree = function () {
|
||||
var nameDom = "#ParentName";
|
||||
var idDom = "#ParentId";
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio", //单选
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
|
||||
function zTreeCheck(event, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
var ids = nodes.map(function (e) { return e.Id; }).join(",");
|
||||
var names = nodes.map(function (e) { return e.Name; }).join(",");
|
||||
|
||||
$(nameDom).val(names);
|
||||
$(idDom).val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return {
|
||||
show: function () {
|
||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
var orgstr = $(idDom).val();
|
||||
var name = '';
|
||||
if (orgstr != '') {
|
||||
var nodeIds = orgstr.split(',');
|
||||
$.each(nodeIds, function () {
|
||||
var node = zTreeObj.getNodeByParam("Id", this, null);
|
||||
name += ',' + node.Name;
|
||||
zTreeObj.checkNode(node, true, true);
|
||||
});
|
||||
$(nameDom).val(name.substr(1)); //显示名称
|
||||
}
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
var update = false;
|
||||
var show = function () {
|
||||
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
||||
$("#btnSave").on("click", function () {
|
||||
editDlg.save();
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function () { //弹出添加
|
||||
update = false;
|
||||
show();
|
||||
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
||||
$("#Id").val(0);
|
||||
|
||||
parentTree.show()
|
||||
},
|
||||
update: function (ret) { //弹出编辑框
|
||||
update = true;
|
||||
show();
|
||||
$('#Id').val(ret.Id);
|
||||
$('#Name').val(ret.Name);
|
||||
$('#ParentId').val(ret.ParentId);
|
||||
$('#ParentName').val(ret.ParentName);
|
||||
$('#IsLeaf').selectpicker('val', ret.IsLeaf?"true":"false");
|
||||
$('#IsAutoExpand').selectpicker('val', ret.IsAutoExpand?"true":"false");
|
||||
$('#SortNo').val(ret.SortNo);
|
||||
parentTree.show();
|
||||
},
|
||||
save: function () { //编辑-->保存
|
||||
$('#editForm').isValid(function (v) {
|
||||
if (!v) return; //验证没通过
|
||||
$("#editForm").bjuiajax('ajaxForm', {
|
||||
reload: false,
|
||||
callback: function (json) {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//删除
|
||||
function del() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/OrgManager/DelOrg?Id=' + selected.Id, function (data) {
|
||||
if (data.statusCode == "200") {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function edit() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) {
|
||||
return;
|
||||
}
|
||||
editDlg.update(selected);
|
||||
}
|
||||
|
||||
function add() {
|
||||
editDlg.add();
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
list.reload();
|
||||
}
|
||||
|
||||
//@@ sourceURL=OrgManager.js
|
246
OpenAuth.Mvc/BllScripts/resourceManager.js
Normal file
246
OpenAuth.Mvc/BllScripts/resourceManager.js
Normal file
@ -0,0 +1,246 @@
|
||||
|
||||
//grid列表模块
|
||||
function MainGrid() {
|
||||
var url = '/ResourceManager/Load?categoryId=';
|
||||
var selectedId = 0; //ztree选中的模块
|
||||
this.maingrid = $('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: '资源表ID',
|
||||
width: 100
|
||||
, hide: true
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Key',
|
||||
label: 'Key',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '名称',
|
||||
width: 100
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Status',
|
||||
label: '当前状态',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'SortNo',
|
||||
label: '排序号',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Description',
|
||||
label: '描述',
|
||||
width: 100
|
||||
},
|
||||
],
|
||||
dataUrl: url + selectedId,
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
this.reload = function (id) {
|
||||
if (id != undefined) selectedId = id;
|
||||
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
||||
};
|
||||
};
|
||||
MainGrid.prototype = new Grid();
|
||||
var list = new MainGrid();
|
||||
|
||||
//左边分类导航树
|
||||
var ztree = function () {
|
||||
var url = '/CategoryManager/LoadForTree';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: { onClick: zTreeOnClick }
|
||||
};
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
list.reload(treeNode.Id);
|
||||
}
|
||||
|
||||
return {
|
||||
reload: function () {
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
//编辑时,选择上级弹出的树
|
||||
var parentTree = function () {
|
||||
var nameDom = "#CategoryName";
|
||||
var idDom = "#CategoryId";
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio", //单选
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
|
||||
function zTreeCheck(event, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
var ids = nodes.map(function (e) { return e.Id; }).join(",");
|
||||
var names = nodes.map(function (e) { return e.Name; }).join(",");
|
||||
|
||||
$(nameDom).val(names);
|
||||
$(idDom).val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return {
|
||||
show: function () {
|
||||
$.getJSON('/CategoryManager/LoadForTree', function (json) {
|
||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
var orgstr = $(idDom).val();
|
||||
var name = '';
|
||||
if (orgstr != '') {
|
||||
var nodeIds = orgstr.split(',');
|
||||
$.each(nodeIds, function () {
|
||||
var node = zTreeObj.getNodeByParam("Id", this, null);
|
||||
name += ',' + node.Name;
|
||||
zTreeObj.checkNode(node, true, true);
|
||||
});
|
||||
$(nameDom).val(name.substr(1)); //显示名称
|
||||
}
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
var update = false;
|
||||
var show = function () {
|
||||
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
||||
$("#btnSave").on("click", function () {
|
||||
editDlg.save();
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function () { //弹出添加
|
||||
update = false;
|
||||
show();
|
||||
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
||||
$("#Id").val(0);
|
||||
|
||||
parentTree.show();
|
||||
},
|
||||
update: function (ret) { //弹出编辑框
|
||||
update = true;
|
||||
show();
|
||||
$('#Id').val(ret.Id);
|
||||
$('#Key').val(ret.Key);
|
||||
$('#Name').val(ret.Name);
|
||||
$('#Status').selectpicker('val', ret.Status);
|
||||
$('#SortNo').val(ret.SortNo);
|
||||
$('#CategoryId').val(ret.CategoryId);
|
||||
$('#Description').val(ret.Description);
|
||||
parentTree.show();
|
||||
},
|
||||
save: function () { //编辑-->保存
|
||||
$('#editForm').isValid(function (v) {
|
||||
if (!v) return; //验证没通过
|
||||
$("#editForm").bjuiajax('ajaxForm', {
|
||||
reload: false,
|
||||
callback: function (json) {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//删除
|
||||
function del() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/ResourceManager/Delete?Id=' + selected.Id, function (data) {
|
||||
if (data.statusCode == "200") {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function edit() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) {
|
||||
return;
|
||||
}
|
||||
editDlg.update(selected);
|
||||
}
|
||||
|
||||
function add() {
|
||||
editDlg.add();
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
list.reload();
|
||||
}
|
||||
|
||||
//@@ sourceURL=ResourceManager.js
|
299
OpenAuth.Mvc/BllScripts/roleManager.js
Normal file
299
OpenAuth.Mvc/BllScripts/roleManager.js
Normal file
@ -0,0 +1,299 @@
|
||||
|
||||
//grid列表模块
|
||||
function MainGrid() {
|
||||
var url = '/RoleManager/Load?orgId=';
|
||||
var selectedId = 0; //ztree选中的模块
|
||||
this.maingrid = $('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: '流水号',
|
||||
width: 100
|
||||
, hide: true
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '角色名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '当前状态',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
label: '角色类型',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'OrgName',
|
||||
label: '所属部门名称',
|
||||
width: 100
|
||||
},
|
||||
],
|
||||
dataUrl: url + selectedId,
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
this.reload = function (id) {
|
||||
if (id != undefined) selectedId = id;
|
||||
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
||||
};
|
||||
};
|
||||
MainGrid.prototype = new Grid();
|
||||
var list = new MainGrid();
|
||||
|
||||
//左边分类导航树
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: { onClick: zTreeOnClick }
|
||||
};
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
list.reload(treeNode.Id);
|
||||
}
|
||||
|
||||
return {
|
||||
reload: function () {
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
//编辑时,选择上级弹出的树
|
||||
var parentTree = function () {
|
||||
var nameDom = "#OrgName";
|
||||
var idDom = "#OrgId";
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio", //单选
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
|
||||
function zTreeCheck(event, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
var ids = nodes.map(function (e) { return e.Id; }).join(",");
|
||||
var names = nodes.map(function (e) { return e.Name; }).join(",");
|
||||
|
||||
$(nameDom).val(names);
|
||||
$(idDom).val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return {
|
||||
show: function () {
|
||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
var orgstr = $(idDom).val();
|
||||
var name = '';
|
||||
if (orgstr != '') {
|
||||
var nodeIds = orgstr.split(',');
|
||||
$.each(nodeIds, function () {
|
||||
var node = zTreeObj.getNodeByParam("Id", this, null);
|
||||
name += ',' + node.Name;
|
||||
zTreeObj.checkNode(node, true, true);
|
||||
});
|
||||
$(nameDom).val(name.substr(1)); //显示名称
|
||||
}
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
var update = false;
|
||||
var show = function () {
|
||||
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
||||
$("#btnSave").on("click", function () {
|
||||
editDlg.save();
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function () { //弹出添加
|
||||
update = false;
|
||||
show();
|
||||
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
||||
$("#Id").val(0);
|
||||
parentTree.show();
|
||||
|
||||
},
|
||||
update: function (ret) { //弹出编辑框
|
||||
update = true;
|
||||
show();
|
||||
$('#Id').val(ret.Id);
|
||||
$('#Name').val(ret.Name);
|
||||
$('#Status').selectpicker('val', ret.Status);
|
||||
$('#Type').selectpicker('val', ret.Type);
|
||||
$('#OrgId').val(ret.OrgId);
|
||||
$('#OrgName').val(ret.OrgName);
|
||||
parentTree.show();
|
||||
},
|
||||
save: function () { //编辑-->保存
|
||||
$('#editForm').isValid(function (v) {
|
||||
if (!v) return; //验证没通过
|
||||
$("#editForm").bjuiajax('ajaxForm', {
|
||||
reload: false,
|
||||
callback: function (json) {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//删除
|
||||
function del() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/RoleManager/Delete?Id=' + selected.Id, function (data) {
|
||||
if (data.statusCode == "200") {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function edit() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) {
|
||||
return;
|
||||
}
|
||||
editDlg.update(selected);
|
||||
}
|
||||
|
||||
function add() {
|
||||
editDlg.add();
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
list.reload();
|
||||
}
|
||||
|
||||
//为角色分配模块
|
||||
function assignRoleModule(obj) {
|
||||
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessRoleModule',
|
||||
url: '/ModuleManager/LookupMultiForRole',
|
||||
title: '为角色分配模块',
|
||||
data: {
|
||||
roleid: selected.Id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配可见机构
|
||||
function assignRoleOrg(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessRoleOrg',
|
||||
url: '/OrgManager/LookupMultiForRole',
|
||||
title: '为角色分配可见机构',
|
||||
data: {
|
||||
roleid: selected.Id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配资源
|
||||
function openRoleReourceAccess(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessUserRole',
|
||||
url: '/ResourceManager/LookupMultiForRole',
|
||||
title: '为角色分配资源',
|
||||
width: 600,
|
||||
height: 380,
|
||||
data: {
|
||||
roleId: selected.Id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配菜单
|
||||
function assignRoleElement(obj) {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'assignElement',
|
||||
url: '/ModuleElementManager/AssignForRole?roleId=' + selected.Id,
|
||||
title: '为角色分配菜单',
|
||||
width: 700,
|
||||
height: 380
|
||||
});
|
||||
}
|
||||
|
||||
//@@ sourceURL=RoleManager.js
|
@ -1,22 +1,72 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.Mvc
|
||||
// Author : yubaolee
|
||||
// Created : 04-12-2016
|
||||
//
|
||||
// Last Modified By : yubaolee
|
||||
// Last Modified On : 04-12-2016
|
||||
// ***********************************************************************
|
||||
// <copyright file="usermanager.js" company="www.cnblogs.com/yubaolee">
|
||||
// 版权所有(C) 2015
|
||||
// </copyright>
|
||||
// <summary>用户管理前端模块</summary>
|
||||
// ***********************************************************************
|
||||
|
||||
//grid列表模块
|
||||
function MainGrid() {
|
||||
var url = '/UserManager/Load?orgId=';
|
||||
var selectedId = 0; //ztree选中的模块
|
||||
this.maingrid = $('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: 'Id',
|
||||
width: 100
|
||||
, hide: true
|
||||
},
|
||||
{
|
||||
name: 'Account',
|
||||
label: '账号',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Sex',
|
||||
label: '性别',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '男' }, { '1': '女' }],
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '状态',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
label: '用户类型',
|
||||
width: 100
|
||||
, align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '类型' }],
|
||||
}
|
||||
|
||||
],
|
||||
dataUrl: url + selectedId,
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
this.reload = function (id) {
|
||||
if (id != undefined) selectedId = id;
|
||||
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
||||
};
|
||||
};
|
||||
MainGrid.prototype = new Grid();
|
||||
var list = new MainGrid();
|
||||
|
||||
$(function () {
|
||||
});
|
||||
|
||||
//ztree模块
|
||||
//左边分类导航树
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
@ -31,112 +81,147 @@ var ztree = function () {
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
grid.reload(treeNode.Id);
|
||||
}
|
||||
}
|
||||
callback: { onClick: zTreeOnClick }
|
||||
};
|
||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}();
|
||||
|
||||
//grid列表模块
|
||||
var grid = function () {
|
||||
var selectedId = 0; //选中的ID
|
||||
var maingrid = $('#maingrid', '#detail').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%'
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
list.reload(treeNode.Id);
|
||||
}
|
||||
|
||||
return {
|
||||
reload: function (id) {
|
||||
if (id != undefined) selectedId = id;
|
||||
maingrid.datagrid('reload', { dataUrl: '/UserManager/Load?orgId=' + selectedId });
|
||||
reload: function () {
|
||||
$.getJSON(url, function (json) {
|
||||
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
//编辑时,选择上级弹出的树
|
||||
var parentTree = function () {
|
||||
var nameDom = "#Organizations";
|
||||
var idDom = "#OrganizationIds";
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
getSelectedObj: function () { //选择单行
|
||||
var selectedDatas = maingrid.data('selectedDatas');
|
||||
if (selectedDatas == undefined || selectedDatas.length == 0) {
|
||||
$(this).alertmsg('warn', '至少选择一个对象', {
|
||||
displayMode: 'slide',
|
||||
title: '重要提示'
|
||||
});
|
||||
return null;
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox",
|
||||
chkboxType: { "Y": "", "N": "" } //去掉勾选时级联
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
return selectedDatas[0];
|
||||
},
|
||||
getSelectedMany: function () { //选择多行
|
||||
return maingrid.data('selectedDatas');
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function zTreeCheck(event, treeId, treeNode) {
|
||||
var nodes = zTreeObj.getCheckedNodes(true);
|
||||
var ids = nodes.map(function (e) { return e.Id; }).join(",");
|
||||
var names = nodes.map(function (e) { return e.Name; }).join(",");
|
||||
|
||||
$(nameDom).val(names);
|
||||
$(idDom).val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return {
|
||||
show: function () {
|
||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
var orgstr = $(idDom).val();
|
||||
var name = '';
|
||||
if (orgstr != '') {
|
||||
var nodeIds = orgstr.split(',');
|
||||
$.each(nodeIds, function () {
|
||||
var node = zTreeObj.getNodeByParam("Id", this, null);
|
||||
name += ',' + node.Name;
|
||||
zTreeObj.checkNode(node, true, true);
|
||||
});
|
||||
$(nameDom).val(name.substr(1)); //显示名称
|
||||
}
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
var update = false;
|
||||
var show = function () {
|
||||
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
||||
$("#btnSave").on("click", function () {
|
||||
editDlg.save();
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function () { //弹出添加
|
||||
update = false;
|
||||
show();
|
||||
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
||||
$("#Id").val(0);
|
||||
parentTree.show();
|
||||
|
||||
},
|
||||
update: function (ret) { //弹出编辑框
|
||||
update = true;
|
||||
show();
|
||||
$('#Id').val(ret.Id);
|
||||
$('#Account').val(ret.Account);
|
||||
$('#Password').val(ret.Password);
|
||||
$('#Name').val(ret.Name);
|
||||
$('#Sex').selectpicker('val', ret.Sex);
|
||||
$('#Status').selectpicker('val', ret.Status);
|
||||
$('#Type').selectpicker('val', ret.Type);
|
||||
$("#OrganizationIds").val(ret.OrganizationIds);
|
||||
parentTree.show();
|
||||
},
|
||||
save: function () { //编辑-->保存
|
||||
$('#editForm').isValid(function (v) {
|
||||
if (!v) return; //验证没通过
|
||||
$("#editForm").bjuiajax('ajaxForm', {
|
||||
reload: false,
|
||||
callback: function (json) {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//删除
|
||||
function delUser() {
|
||||
var selected = grid.getSelectedObj();
|
||||
function del() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/UserManager/Delete?Id=' + selected.Id, function (data) {
|
||||
if (data.statusCode == "200")
|
||||
grid.reload();
|
||||
if (data.statusCode == "200") {
|
||||
list.reload();
|
||||
ztree.reload();
|
||||
}
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
@ -144,27 +229,26 @@ function delUser() {
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function editUser() {
|
||||
var selected = grid.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(this).dialog({
|
||||
id: 'editDialog',
|
||||
url: '/UserManager/Add?id=' + selected.Id,
|
||||
title: '编辑',
|
||||
onClose: function () {
|
||||
grid.reload();
|
||||
}
|
||||
});
|
||||
function edit() {
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) {
|
||||
return;
|
||||
}
|
||||
editDlg.update(selected);
|
||||
}
|
||||
|
||||
function refreshUserGrid() {
|
||||
grid.reload();
|
||||
function add() {
|
||||
editDlg.add();
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
list.reload();
|
||||
}
|
||||
|
||||
|
||||
//用户模块授权按钮
|
||||
function openUserModuleAccess(obj) {
|
||||
var selected = grid.getSelectedObj();
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
@ -179,7 +263,7 @@ function openUserModuleAccess(obj) {
|
||||
|
||||
//用户可见组织授权按钮
|
||||
function openUserOrgAccess(obj) {
|
||||
var selected = grid.getSelectedObj();
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
@ -194,7 +278,7 @@ function openUserOrgAccess(obj) {
|
||||
|
||||
//用户角色授权
|
||||
function openUserRoleAccess(obj) {
|
||||
var selected = grid.getSelectedObj();
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
@ -211,7 +295,7 @@ function openUserRoleAccess(obj) {
|
||||
|
||||
//为用户分配资源
|
||||
function openUserReourceAccess(obj) {
|
||||
var selected = grid.getSelectedObj();
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
@ -228,7 +312,7 @@ function openUserReourceAccess(obj) {
|
||||
|
||||
//分配菜单
|
||||
function openAssignUserElement(obj) {
|
||||
var selected = grid.getSelectedObj();
|
||||
var selected = list.getSelectedObj();
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
@ -238,4 +322,6 @@ function openAssignUserElement(obj) {
|
||||
width: 700,
|
||||
height: 380
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//@@ sourceURL=UserManager.js
|
@ -55,11 +55,20 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回当前登录用户可访问到的部门
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public string LoadForTree()
|
||||
{
|
||||
var orgs = SessionHelper.GetSessionUser<LoginUserVM>().AccessedOrgs;
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回带有根节点的全部部门,不受用户权限影响
|
||||
/// <para>可以匿名访问</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
[Anonymous]
|
||||
public string LoadOrg()
|
||||
{
|
||||
@ -150,21 +159,6 @@ namespace OpenAuth.Mvc.Controllers
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public string EditOrg(string json)
|
||||
{
|
||||
try
|
||||
{
|
||||
var org = JsonHelper.Instance.Deserialize<Org>(json);
|
||||
_orgApp.AddOrUpdate(org);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BjuiResponse.statusCode = "300";
|
||||
BjuiResponse.message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public string LoadChildren(int id)
|
||||
{
|
||||
|
@ -23,11 +23,6 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Add(int id = 0)
|
||||
{
|
||||
return View(_app.Find(id));
|
||||
}
|
||||
|
||||
//添加或修改Resource
|
||||
[HttpPost]
|
||||
public string Add(Resource model)
|
||||
|
@ -23,11 +23,6 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Add(int id = 0)
|
||||
{
|
||||
return View(_app.Find(id));
|
||||
}
|
||||
|
||||
//添加或修改组织
|
||||
[HttpPost]
|
||||
public string Add(UserView view)
|
||||
|
@ -154,6 +154,10 @@
|
||||
<Content Include="BllScripts\grid.js" />
|
||||
<Content Include="BllScripts\moduleElementMan.js" />
|
||||
<Content Include="BllScripts\modulemanager.js" />
|
||||
<Content Include="BllScripts\orgManager.js" />
|
||||
<Content Include="BllScripts\resourceManager.js" />
|
||||
<Content Include="BllScripts\roleManager.js" />
|
||||
<Content Include="BllScripts\stockManager.js" />
|
||||
<Content Include="BllScripts\usermanager.js" />
|
||||
<Content Include="BllScripts\roleModuleElement.js" />
|
||||
<Content Include="BllScripts\userModuleElement.js" />
|
||||
@ -603,13 +607,11 @@
|
||||
<Content Include="Views\_ViewStart.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Views\Home\Index.cshtml" />
|
||||
<Content Include="Views\ResourceManager\Add.cshtml" />
|
||||
<Content Include="Views\ResourceManager\Index.cshtml" />
|
||||
<Content Include="Views\RoleManager\LookupMulti.cshtml" />
|
||||
<Content Include="Views\ResourceManager\LookupMultiForUser.cshtml" />
|
||||
<Content Include="Views\ResourceManager\LookupMultiForRole.cshtml" />
|
||||
<Content Include="Views\StockManager\Index.cshtml" />
|
||||
<Content Include="Views\StockManager\Add.cshtml" />
|
||||
<Content Include="Views\OrgManager\LookupMultiForRole.cshtml" />
|
||||
<Content Include="Views\OrgManager\LookupMultiForUser.cshtml" />
|
||||
<Content Include="Views\Shared\_BjuiLayout.cshtml" />
|
||||
@ -674,11 +676,8 @@
|
||||
<Content Include="Views\ModuleElementManager\AssignForUser.cshtml" />
|
||||
<None Include="Views\ModuleElementManager\Index.cshtml" />
|
||||
<Content Include="Views\ModuleElementManager\AssignForRole.cshtml" />
|
||||
<None Include="Views\OrgManager\AddOrg.cshtml" />
|
||||
<Content Include="Views\OrgManager\LookupParent.cshtml" />
|
||||
<Content Include="Views\UserManager\Index.cshtml" />
|
||||
<Content Include="Views\UserManager\Add.cshtml" />
|
||||
<Content Include="Views\RoleManager\Add.cshtml" />
|
||||
<Content Include="Views\RoleManager\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
|
@ -26,46 +26,3 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function getDatagridRow(gridid) {
|
||||
var selected = $(gridid).data('selectedTrs');
|
||||
if (selected == null || selected.length == 0) {
|
||||
$(this).alertmsg('warn', '至少选择一个对象', {
|
||||
displayMode: 'slide',
|
||||
title: '重要提示'
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
//获取勾选的值
|
||||
//column:为从0开始的列标识
|
||||
function getSelected(gridid, column) {
|
||||
|
||||
var selected = getDatagridRow(gridid);
|
||||
if (selected == null) return null;
|
||||
|
||||
var records = new Array();
|
||||
$.each(selected, function (i) {
|
||||
console.log($(this).children().eq(column).text());
|
||||
records[records.length] = $(this).children().eq(column).text();
|
||||
});
|
||||
|
||||
return records[0];
|
||||
}
|
||||
//返回选择的多条记录,用逗号隔开
|
||||
function getSelectedMany(gridid, column) {
|
||||
var selected = getDatagridRow(gridid);
|
||||
if (selected == null) return null;
|
||||
|
||||
var results = '';
|
||||
$.each(selected, function (i) {
|
||||
console.log($(this).children().eq(column).text());
|
||||
results += ',' + $(this).children().eq(column).text();
|
||||
});
|
||||
|
||||
results = results.substr(1); //去掉第一个逗号
|
||||
return results;
|
||||
}
|
||||
</script>
|
@ -98,7 +98,12 @@
|
||||
<select id="Icon" name="Icon" data-toggle="selectpicker">
|
||||
<option value="pencil" selected>pencil</option>
|
||||
<option value="plus">plus</option>
|
||||
<option value="del">del</option>
|
||||
<option value="trash">trash</option>
|
||||
<option value="bank">bank</option>
|
||||
<option value="bar">bar</option>
|
||||
<option value="refresh">refresh</option>
|
||||
<option value="user">user</option>
|
||||
<option value="key">key</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,107 +0,0 @@
|
||||
@{
|
||||
ViewBag.Title = "title";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/OrgManager/AddOrg" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x90">机构名称:</label>
|
||||
<input type="text" name="Name" id="Name" value=""
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input id="ParentId" name="ParentId" type="hidden">
|
||||
<label for="ParentName" class="control-label x90">上级机构:</label>
|
||||
<input type="text" name="ParentName" id="ParentName" data-toggle="selectztree" size="20" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x85">设置状态:</label>
|
||||
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">正常</option>
|
||||
<option value="1">禁用</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn-close">关闭</button></li>
|
||||
<li><button type="submit" class="btn-green">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
});
|
||||
function Init() {
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio",
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||||
nodes = zTree.getCheckedNodes(true);
|
||||
var ids = '', names = '';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
ids += ',' + nodes[i].Id;
|
||||
names += ',' + nodes[i].Name;
|
||||
}
|
||||
if (ids.length > 0) { //去掉第一个逗号
|
||||
ids = ids.substr(1);
|
||||
names = names.substr(1);
|
||||
}
|
||||
|
||||
var $from = $('#' + treeId).data('fromObj');
|
||||
if ($from && $from.length) $from.val(names);
|
||||
|
||||
$('#ParentId').val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
</script>
|
@ -3,142 +3,75 @@
|
||||
}
|
||||
|
||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||
|
||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
||||
<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>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</div>
|
||||
|
||||
<div id="detail" style="margin-left: 225px; ">
|
||||
<div id="detail" style="margin-left: 225px;">
|
||||
<table id="maingrid" class="table table-bordered"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var selectedId = 0;
|
||||
var grid;
|
||||
$(document).ready(function () {
|
||||
initZtree();
|
||||
LoadOrg();
|
||||
});
|
||||
//加载数据到datagrid
|
||||
function LoadOrg() {
|
||||
//b-jui的datagrid需要重新处理HTML
|
||||
$('#detail').empty()
|
||||
.append('<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>');
|
||||
grid = $('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: 'Id',
|
||||
attrs: { readonly: 'readonly' },
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
name: 'ParentId',
|
||||
label: '上级机构ID',
|
||||
attrs: { readonly: 'readonly'},
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
name: 'CascadeId',
|
||||
label: '唯一标识',
|
||||
attrs: { readonly: 'readonly'}
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '机构名称'
|
||||
},
|
||||
{
|
||||
name: 'ParentName',
|
||||
label: '上级机构',
|
||||
edit: false,
|
||||
attrs: { readonly: 'readonly' }
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '状态',
|
||||
type: 'select',
|
||||
align: 'center',
|
||||
items:[{'0':'正常'}, {'1':'禁用'}]
|
||||
},
|
||||
{
|
||||
name: 'CreateTime',
|
||||
label: '登记日期',
|
||||
type: 'date',
|
||||
pattern: 'yyyy-MM-dd HH:mm:ss'
|
||||
}
|
||||
],
|
||||
dataUrl: '/OrgManager/LoadChildren?Id=' + selectedId,
|
||||
editUrl: 'OrgManager/EditOrg',
|
||||
editMode: 'dialog',
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: false,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height:700,
|
||||
editCallback: function (delResult) {
|
||||
if (delResult.statusCode == "200")
|
||||
Init(selectedId);
|
||||
else {
|
||||
$(this).alertmsg('warn', delResult.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
selectedId = treeNode.Id;
|
||||
LoadOrg();
|
||||
}
|
||||
<!--编辑对话框-->
|
||||
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/OrgManager/AddOrg" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<input type="text" id="Id" name="Id" value="" class="hidden" />
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">组织名称:</label>
|
||||
<input type="text" id="Name" name="Name" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="IsLeaf" class="control-label x120">是否叶子节点:</label>
|
||||
<select name="IsLeaf" id="IsLeaf" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="false">否</option>
|
||||
<option value="true">是</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="IsAutoExpand" class="control-label x120">是否自动展开:</label>
|
||||
<select name="IsAutoExpand" id="IsAutoExpand" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="false">否</option>
|
||||
<option value="true">是</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="SortNo" class="control-label x120">排序号:</label>
|
||||
<input type="text" id="SortNo" name="SortNo" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ParentName" class="control-label x120">上级机构:</label>
|
||||
<input id="ParentId" name="ParentId" style="display: none" />
|
||||
<input type="text" name="ParentName" id="ParentName"
|
||||
data-toggle="selectztree" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn btn-close">关闭</button></li>
|
||||
<li><button type="button" class="btn btn-primary" id="btnSave">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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 refreshOrgGrid() {
|
||||
$('#maingrid').datagrid('refresh');
|
||||
}
|
||||
|
||||
//删除
|
||||
function delOrg() {
|
||||
var selected = getSelected('#maingrid',2);
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/OrgManager/DelOrg?Id=' + selected, function (data) {
|
||||
if (data.statusCode == "200")
|
||||
refreshOrgGrid();
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/OrgManager.js"></script>
|
||||
|
@ -1,157 +0,0 @@
|
||||
@model OpenAuth.Domain.Resource
|
||||
@{
|
||||
ViewBag.Title = "Resource编辑界面";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/ResourceManager/Add" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m => m.Id)
|
||||
@Html.HiddenFor(m => m.CategoryId)
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Key" class="control-label x120">资源标识:</label>
|
||||
<input type="text" name="Key" id="Key" value="@Model.Key"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">名称:</label>
|
||||
<input type="text" name="Name" id="Name" value="@Model.Name"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
@if (Model.Id == 0) //添加
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ParentName" class="control-label x120">所属分类:</label>
|
||||
<input type="text" name="ParentName" id="ParentName"
|
||||
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
});
|
||||
function Init() {
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio",
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.getJSON('/CategoryManager/LoadForTree', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||||
nodes = zTree.getCheckedNodes(true);
|
||||
var ids = '', names = '';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
ids += ',' + nodes[i].Id;
|
||||
names += ',' + nodes[i].Name;
|
||||
}
|
||||
if (ids.length > 0) { //去掉第一个逗号
|
||||
ids = ids.substr(1);
|
||||
names = names.substr(1);
|
||||
}
|
||||
|
||||
var $from = $('#' + treeId).data('fromObj');
|
||||
if ($from && $from.length) $from.val(names);
|
||||
|
||||
$('#CategoryId').val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
</script>
|
||||
}
|
||||
else //编辑
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<label for="CascadeId" class="control-label x120">节点语义ID:</label>
|
||||
<input type="text" name="CascadeId" id="CascadeId" value="@Model.CascadeId"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x120">当前状态:</label>
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0" @if (Model.Status == 0) { <text> selected="selected" </text> }>默认</option>
|
||||
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>状态1</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="SortNo" class="control-label x120">排序号:</label>
|
||||
<select name="SortNo" id="SortNo" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0" @if (Model.SortNo == 0) { <text> selected="selected" </text> }>默认</option>
|
||||
<option value="1" @if (Model.SortNo == 1) { <text> selected="selected" </text> }>状态1</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="CategoryId" class="control-label x120">资源分类标识:</label>
|
||||
<select name="CategoryId" id="CategoryId" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0" @if (Model.CategoryId == 0) { <text> selected="selected" </text> }>默认</option>
|
||||
<option value="1" @if (Model.CategoryId == 1) { <text> selected="selected" </text> }>状态1</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Description" class="control-label x120">描述:</label>
|
||||
<input type="text" name="Description" id="Description" value="@Model.Description"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn-close">关闭</button></li>
|
||||
<li><button type="submit" class="btn-green">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
@ -3,166 +3,83 @@
|
||||
}
|
||||
|
||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
||||
<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>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</div>
|
||||
|
||||
<div id="detail" style="margin-left: 225px;">
|
||||
<table id="maingrid" class="table table-bordered"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--编辑对话框-->
|
||||
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/ResourceManager/Add" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||
|
||||
<script type="text/javascript">
|
||||
var selectedId = 0;
|
||||
$(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>');
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<input type="text" id="Id" name="Id" value="" class="hidden" />
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Key" class="control-label x120">资源标识:</label>
|
||||
<input type="text" id="Key" name="Key" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">名称:</label>
|
||||
<input type="text" id="Name" name="Name" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x120">当前状态:</label>
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">默认</option>
|
||||
<option value="1">状态1</option>
|
||||
<option value="2">状态2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="SortNo" class="control-label x120">排序号:</label>
|
||||
<input type="text" id="SortNo" name="SortNo" value=""/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Description" class="control-label x120">描述:</label>
|
||||
<input type="text" id="Description" name="Description" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="CategoryName" class="control-label x120">所属分类:</label>
|
||||
<input id="CategoryId" name="CategoryId" style="display: none" />
|
||||
<input type="text" name="CategoryName" id="CategoryName"
|
||||
data-toggle="selectztree" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn btn-close">关闭</button></li>
|
||||
<li><button type="button" class="btn btn-primary" id="btnSave">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
$('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: '资源表ID',
|
||||
width: 100
|
||||
, hide: true
|
||||
},
|
||||
{
|
||||
name: 'CascadeId',
|
||||
label: '节点语义ID',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Key',
|
||||
label: '',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'ParentId',
|
||||
label: '父节点流水号',
|
||||
width: 100
|
||||
,type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '当前状态',
|
||||
width: 100
|
||||
,type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'SortNo',
|
||||
label: '排序号',
|
||||
width: 100
|
||||
,type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'CategoryId',
|
||||
label: '资源分类标识',
|
||||
width: 100
|
||||
,type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||
},
|
||||
{
|
||||
name: 'Description',
|
||||
label: '描述',
|
||||
width: 100
|
||||
},
|
||||
],
|
||||
dataUrl: '/ResourceManager/Load?categoryId=' + selectedId,
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
}
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/ResourceManager.js"></script>
|
||||
|
||||
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('/CategoryManager/LoadForTree', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
//删除
|
||||
function delResource() {
|
||||
var selected = getSelected('#maingrid',2);
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/ResourceManager/Delete?Id=' + selected, function (data) {
|
||||
if (data.statusCode == "200")
|
||||
loadDataGrid();
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function editResource() {
|
||||
var selected = getSelected('#maingrid',2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(this).dialog({
|
||||
id: 'editDialog',
|
||||
url: '/ResourceManager/Add?id=' + selected,
|
||||
title: '编辑',
|
||||
onClose:function() {
|
||||
refreshResourceGrid();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function refreshResourceGrid() {
|
||||
$('#maingrid').datagrid('refresh');
|
||||
// loadDataGrid();
|
||||
}
|
||||
//@@ sourceURL=ResourceManagerIndex.js
|
||||
</script>
|
||||
|
@ -1,137 +0,0 @@
|
||||
@model OpenAuth.Domain.Role
|
||||
@{
|
||||
ViewBag.Title = "title";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/RoleManager/Add" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m => m.Id)
|
||||
@Html.HiddenFor(m => m.CreateTime)
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<label for="Name" class="control-label x90">角色名称:</label>
|
||||
<input type="text" name="Name" id="Name" value="@Model.Name"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<label for="Status" class="control-label x90">当前状态:</label>
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0" @if (Model.Status == 0) { <text> selected="selected" </text> }>正常</option>
|
||||
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>禁用</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<label for="Type" class="control-label x90">角色类型:</label>
|
||||
<select name="Type" id="Type" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0" @if (Model.Type == 0) { <text> selected="selected" </text> }>管理员</option>
|
||||
<option value="1" @if (Model.Type == 1) { <text> selected="selected" </text> }>普通角色</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="OrgName" class="control-label x90">所属机构:</label>
|
||||
<input id="OrgId" name="OrgId" value="" style="display: none"/>
|
||||
<input type="text" name="OrgName" id="OrgName"
|
||||
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="@Model.OrgName">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<label for="OrgCascadeId" class="control-label x90">机构级联ID:</label>
|
||||
<input type="text" name="OrgCascadeId" id="OrgCascadeId" value="@Model.OrgCascadeId"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn-close">关闭</button></li>
|
||||
<li><button type="submit" class="btn-green">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
});
|
||||
function Init() {
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio",
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||||
nodes = zTree.getCheckedNodes(true);
|
||||
var ids = '', names = '', cascadeids='';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
ids += ',' + nodes[i].Id;
|
||||
names += ',' + nodes[i].Name;
|
||||
cascadeids += ',' + nodes[i].CascadeId;
|
||||
}
|
||||
if (ids.length > 0) { //去掉第一个逗号
|
||||
ids = ids.substr(1);
|
||||
names = names.substr(1);
|
||||
cascadeids = cascadeids.substr(1);
|
||||
}
|
||||
|
||||
var $from = $('#' + treeId).data('fromObj');
|
||||
if ($from && $from.length) $from.val(names);
|
||||
|
||||
$('#OrgId').val(ids);
|
||||
$('#OrgCascadeId').val(cascadeids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
</script>
|
@ -3,215 +3,73 @@
|
||||
}
|
||||
|
||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||
|
||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
||||
<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>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</div>
|
||||
|
||||
<div id="detail" style="margin-left: 225px;">
|
||||
<table id="maingrid" class="table table-bordered"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--编辑对话框-->
|
||||
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/RoleManager/Add" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||
|
||||
<script type="text/javascript">
|
||||
var selectedId = 0;
|
||||
$(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>');
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<input type="text" id="Id" name="Id" value="" class="hidden" />
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">角色名称:</label>
|
||||
<input type="text" id="Name" name="Name" value=""/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="OrgName" class="control-label x120">所属组织:</label>
|
||||
<input id="OrgId" name="OrgId" style="display: none" />
|
||||
<input type="text" name="OrgName" id="OrgName"
|
||||
data-toggle="selectztree" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x120">当前状态:</label>
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">默认</option>
|
||||
<option value="1">状态1</option>
|
||||
<option value="2">状态2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Type" class="control-label x120">角色类型:</label>
|
||||
<select name="Type" id="Type" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">默认</option>
|
||||
<option value="1">状态1</option>
|
||||
<option value="2">状态2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn btn-close">关闭</button></li>
|
||||
<li><button type="button" class="btn btn-primary" id="btnSave">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
$('#maingrid').datagrid({
|
||||
showToolbar:false,
|
||||
filterThead: false,
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: '流水号'
|
||||
, hide: true
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '角色名称',
|
||||
width:100
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '当前状态',
|
||||
type: 'select',
|
||||
align: 'center',
|
||||
items:[{'0':'正常','1':'禁用'}],
|
||||
width:50
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
label: '角色类型',
|
||||
type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '管理员','1':'普通角色' }],
|
||||
width:50
|
||||
},
|
||||
{
|
||||
name: 'CreateTime',
|
||||
label: '创建时间'
|
||||
, type: 'date',
|
||||
width: 150,
|
||||
pattern: 'yyyy-MM-dd HH:mm:ss'
|
||||
},
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/RoleManager.js"></script>
|
||||
|
||||
{
|
||||
name: 'OrgCascadeId',
|
||||
label: '所属部门节点语义ID',
|
||||
width:100
|
||||
},
|
||||
{
|
||||
name: 'OrgName',
|
||||
label: '所属部门名称',
|
||||
width:100
|
||||
}
|
||||
],
|
||||
dataUrl: '/RoleManager/Load?orgId=' + selectedId,
|
||||
target:$(this),
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
}
|
||||
|
||||
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 delRole() {
|
||||
var selected = getSelected('#maingrid', 2);
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/RoleManager/Delete?Id=' + selected, function (data) {
|
||||
if (data.statusCode == "200")
|
||||
refreshRoleGrid();
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function editRole() {
|
||||
var selected = getSelected('#maingrid',2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(this).dialog({
|
||||
id: 'editDialog',
|
||||
url: '/RoleManager/Add?id=' + selected,
|
||||
title: '编辑',
|
||||
onClose:function() {
|
||||
refreshRoleGrid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function refreshRoleGrid() {
|
||||
$('#maingrid').datagrid('refresh');
|
||||
// loadDataGrid();
|
||||
}
|
||||
|
||||
//为角色分配模块
|
||||
function assignRoleModule(obj) {
|
||||
|
||||
var selected = getSelected('#maingrid',2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessRoleModule',
|
||||
url: '/ModuleManager/LookupMultiForRole',
|
||||
title: '为角色分配模块',
|
||||
data: {
|
||||
roleid: selected
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配可见机构
|
||||
function assignRoleOrg(obj) {
|
||||
var selected = getSelected('#maingrid', 2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessRoleOrg',
|
||||
url: '/OrgManager/LookupMultiForRole',
|
||||
title: '为角色分配可见机构',
|
||||
data: {
|
||||
roleid: selected
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配资源
|
||||
function openRoleReourceAccess(obj) {
|
||||
var selected = getSelected('#maingrid', 2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessUserRole',
|
||||
url: '/ResourceManager/LookupMultiForRole',
|
||||
title: '为角色分配资源',
|
||||
width: 600,
|
||||
height: 380,
|
||||
data: {
|
||||
roleId: selected
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//为角色分配菜单
|
||||
function assignRoleElement(obj) {
|
||||
var selected = getSelected('#maingrid', 2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'assignElement',
|
||||
url: '/ModuleElementManager/AssignForRole?roleId=' + selected,
|
||||
title: '为角色分配菜单',
|
||||
width: 700,
|
||||
height:380
|
||||
});
|
||||
}
|
||||
|
||||
//@@ sourceURL=RoleManagerIndex.js
|
||||
</script>
|
||||
|
@ -1,131 +0,0 @@
|
||||
@model OpenAuth.Domain.Stock
|
||||
@{
|
||||
ViewBag.Title = "Stock编辑界面";
|
||||
Layout = null;
|
||||
}
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/StockManager/Add" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m =>m.Id)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">产品名称:</label>
|
||||
<input type="text" name="Name" id="Name" value="@Model.Name"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Number" class="control-label x120">产品数量:</label>
|
||||
<input type="text" name="Number" id="Number" value="@Model.Number"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Price" class="control-label x120">产品单价:</label>
|
||||
<input type="text" name="Price" id="Price" value="@Model.Price"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x120">出库/入库:</label>
|
||||
<input type="text" name="Status" id="Status" value="@Model.Status"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Time" class="control-label x120">操作时间:</label>
|
||||
<input type="text" name="Time" id="Time" value="@Model.Time"
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m =>m.OrgId)
|
||||
@if (Model.Id == 0) //添加
|
||||
{
|
||||
//这个只用于显示使用,并不会进行提交处理,真正提交的是OrgId
|
||||
<label for="OrgName" class="control-label x120">所属部门:</label>
|
||||
<input type="text" name="OrgName" id="OrgName"
|
||||
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
});
|
||||
function Init() {
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "radio",
|
||||
radioType: "all"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||||
nodes = zTree.getCheckedNodes(true);
|
||||
var ids = '', names = '';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
ids += ',' + nodes[i].Id;
|
||||
names += ',' + nodes[i].Name;
|
||||
}
|
||||
if (ids.length > 0) { //去掉第一个逗号
|
||||
ids = ids.substr(1);
|
||||
names = names.substr(1);
|
||||
}
|
||||
var $from = $('#' + treeId).data('fromObj');
|
||||
if ($from && $from.length) $from.val(names);
|
||||
$('#OrgId').val(ids);
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn-close">关闭</button></li>
|
||||
<li><button type="submit" class="btn-green">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
@ -3,154 +3,85 @@
|
||||
}
|
||||
|
||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
||||
<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>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</div>
|
||||
|
||||
<div id="detail" style="margin-left: 225px;">
|
||||
<table id="maingrid" class="table table-bordered"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var selectedId = 0;
|
||||
$(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>');
|
||||
<!--编辑对话框-->
|
||||
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/StockManager/Add" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||
|
||||
$('#maingrid').datagrid({
|
||||
showToolbar: false,
|
||||
filterThead: false,
|
||||
target: $(this),
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
label: '数据ID',
|
||||
width: 100,
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '产品名称',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Number',
|
||||
label: '产品数量',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Price',
|
||||
label: '产品单价',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
label: '出库/入库',
|
||||
width: 100
|
||||
, type: 'select',
|
||||
align: 'center',
|
||||
items: [{ '0': '入库' }, { '1': '出库' }],
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
label: '操作人',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
name: 'Time',
|
||||
label: '操作时间',
|
||||
width: 100
|
||||
, type: 'date',
|
||||
pattern: 'yyyy-MM-dd HH:mm:ss'
|
||||
},
|
||||
{
|
||||
name: 'OrgId',
|
||||
label: '所属部门',
|
||||
width: 100,
|
||||
hide: true
|
||||
}
|
||||
],
|
||||
dataUrl: '/StockManager/Load?parentId=' + selectedId,
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true,
|
||||
paging: true,
|
||||
filterMult: false,
|
||||
showTfoot: false,
|
||||
height: '100%'
|
||||
});
|
||||
}
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<input type="text" id="Id" name="Id" value="" class="hidden" />
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">产品名称:</label>
|
||||
<input type="text" id="Name" name="Name" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Number" class="control-label x120">产品数量:</label>
|
||||
<input type="text" id="Number" name="Number" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Price" class="control-label x120">产品单价:</label>
|
||||
<input type="text" id="Price" name="Price" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x120">出库/入库:</label>
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">出库</option>
|
||||
<option value="1">入库</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="User" class="control-label x120">操作人:</label>
|
||||
<input type="text" id="User" name="User" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Time" class="control-label x120">操作时间:</label>
|
||||
<input type="text" id="Time" name="Time" value="" data-toggle="datepicker" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ParentName" class="control-label x120">部门:</label>
|
||||
<input id="OrgId" name="OrgId" style="display: none" />
|
||||
<input type="text" name="ParentName" id="ParentName"
|
||||
data-toggle="selectztree" size="20" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn btn-close">关闭</button></li>
|
||||
<li><button type="button" class="btn btn-primary" id="btnSave">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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 delStock() {
|
||||
var selected = getSelected('#maingrid', 2);
|
||||
if (selected == null) return;
|
||||
|
||||
$.getJSON('/StockManager/Delete?Id=' + selected, function (data) {
|
||||
if (data.statusCode == "200")
|
||||
loadDataGrid();
|
||||
else {
|
||||
$(this).alertmsg('warn', data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自定义的编辑按钮
|
||||
function editStock() {
|
||||
var selected = getSelected('#maingrid', 2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(this).dialog({
|
||||
id: 'editDialog',
|
||||
url: '/StockManager/Add?id=' + selected,
|
||||
title: '编辑',
|
||||
onClose: function () {
|
||||
refreshStockGrid();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function refreshStockGrid() {
|
||||
$('#maingrid').datagrid('refresh');
|
||||
// loadDataGrid();
|
||||
}
|
||||
//@@ sourceURL=StockManagerIndex.js
|
||||
</script>
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/StockManager.js"></script>
|
||||
|
@ -1,18 +1,89 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/_BjuiLayout.cshtml";
|
||||
}
|
||||
|
||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||
|
||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
||||
<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>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</div>
|
||||
|
||||
<div id="detail" style="margin-left: 225px;">
|
||||
<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>
|
||||
<table id="maingrid" class="table table-bordered"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="~/BllScripts/usermanager.js"></script>
|
||||
<!--编辑对话框-->
|
||||
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||
<div class="bjui-pageContent">
|
||||
<form action="/UserManager/Add" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<input type="text" id="Id" name="Id" value="" class="hidden"/>
|
||||
<input type="text" id="Password" name="Password" class="hidden" />
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Account" class="control-label x120">账号:</label>
|
||||
<input type="text" id="Account" name="Account" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x120">姓名:</label>
|
||||
<input type="text" id="Name" name="Name" value=""/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Organizations" class="control-label x120">所属机构:</label>
|
||||
<input id="OrganizationIds" name="OrganizationIds" value="" style="display: none" />
|
||||
<input type="text" name="Organizations" id="Organizations"
|
||||
data-toggle="selectztree" data-tree="#j_select_tree1" >
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Sex" class="control-label x120">用户性别:</label>
|
||||
<select name="Sex" id="Sex" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">男</option>
|
||||
<option value="1">女</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Status" class="control-label x120">用户状态:</label>
|
||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">默认</option>
|
||||
<option value="1">状态1</option>
|
||||
<option value="2">状态2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Type" class="control-label x120">用户类型:</label>
|
||||
<select name="Type" id="Type" data-toggle="selectpicker" data-rule="required">
|
||||
<option value="0">默认</option>
|
||||
<option value="1">状态1</option>
|
||||
<option value="2">状态2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn btn-close">关闭</button></li>
|
||||
<li><button type="button" class="btn btn-primary" id="btnSave">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/UserManager.js"></script>
|
@ -87,5 +87,22 @@ namespace OpenAuth.UnitTest
|
||||
Console.WriteLine(user.Name + " \t用户ID:" + user.Id);
|
||||
return user;
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestEditExist()
|
||||
{
|
||||
var user = new UserView
|
||||
{
|
||||
Id = 1,
|
||||
|
||||
Account = "admin",
|
||||
Name = "管理员",
|
||||
OrganizationIds = "1,2",
|
||||
Organizations = "集团总部,研发部",
|
||||
Status = 1
|
||||
|
||||
};
|
||||
_app.AddOrUpdate(user);
|
||||
Console.WriteLine(user.Name + " \t用户ID:" + user.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user