mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-24 07:22:55 +08:00
优化部分JS前端模块,后期统一按此结构调整
This commit is contained in:
parent
587726951b
commit
fa4b890965
@ -1,140 +0,0 @@
|
|||||||
<%--
|
|
||||||
Name: 添加界面
|
|
||||||
Author: yubaolee
|
|
||||||
Description: 任务对象界面
|
|
||||||
--%>
|
|
||||||
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Encoding="utf-8" Description="添加模块" %>
|
|
||||||
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context"
|
|
||||||
Description="连接的数据库" %>
|
|
||||||
<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
|
|
||||||
<%@ Property Name="NeedViewModel" Type="Boolean" Category="Context" Default="False" Description="是否需要ViewModel" %>
|
|
||||||
<%@ Property Name="CascadeId" Type="String" Category="" Default="ParentId" Description="级联字段" %>
|
|
||||||
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
|
|
||||||
<%@ Assembly Name="SchemaExplorer" %>
|
|
||||||
<%@ Import Namespace="SchemaExplorer" %>
|
|
||||||
<script runat="template">
|
|
||||||
public String GetModelName() {
|
|
||||||
if (NeedViewModel)
|
|
||||||
return ModuleName + "View";
|
|
||||||
else
|
|
||||||
return ModuleName;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<%if(NeedViewModel){ %>
|
|
||||||
@model OpenAuth.App.ViewModel.<%=GetModelName()%>
|
|
||||||
<%} else{ %>
|
|
||||||
@model OpenAuth.Domain.<%=GetModelName()%>
|
|
||||||
<%} %>
|
|
||||||
@{
|
|
||||||
ViewBag.Title = "<%=GetModelName()%>编辑界面";
|
|
||||||
Layout = null;
|
|
||||||
}
|
|
||||||
<div class="bjui-pageContent">
|
|
||||||
<form action="/<%=ModuleName%>Manager/Add" class="pageForm" data-toggle="validate">
|
|
||||||
<table class="table table-condensed table-hover">
|
|
||||||
<tbody>
|
|
||||||
<% foreach (ColumnSchema column in this.SourceTable.Columns) {
|
|
||||||
if(column.Name == "CascadeId") continue; //cascadeId字段需要程序控制
|
|
||||||
%>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<%if(column.IsPrimaryKeyMember){ %>
|
|
||||||
@Html.HiddenFor(m =>m.<%=column.Name%>)
|
|
||||||
<% } else if(column.Name == CascadeId) {%>
|
|
||||||
@Html.HiddenFor(m =>m.<%=CascadeId %>)
|
|
||||||
@if (Model.Id == 0) //添加
|
|
||||||
{
|
|
||||||
//这个只用于显示使用,并不会进行提交处理,真正提交的是cascadeId
|
|
||||||
<label for="CascadeName" class="control-label x120">父节点流水号:</label>
|
|
||||||
<input type="text" name="CascadeName" id="CascadeName"
|
|
||||||
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('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);
|
|
||||||
$('#<%=CascadeId%>').val(ids);
|
|
||||||
}
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
|
||||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
}
|
|
||||||
else //编辑
|
|
||||||
{
|
|
||||||
<label for="CascadeId" class="control-label x120">节点语义ID:</label>
|
|
||||||
<input type="text" name="CascadeId" id="CascadeId" value="@Model.CascadeId"
|
|
||||||
data-rule="required" size="20">
|
|
||||||
}
|
|
||||||
<% } else if(CSharpAlias[column.SystemType.FullName] == "bool") {%>
|
|
||||||
<label for="<%=column.Name%>" class="control-label x120"><%=column.Description%>:</label>
|
|
||||||
<select name="<%=column.Name%>" id="<%=column.Name%>" data-toggle="selectpicker" data-rule="required">
|
|
||||||
<option value="0" @if (Model.<%=column.Name%>) { <text> selected="selected" </text> }>否</option>
|
|
||||||
<option value="1" @if (!Model.<%=column.Name%>) { <text> selected="selected" </text> }>是</option>
|
|
||||||
</select>
|
|
||||||
<%} else{%>
|
|
||||||
<label for="<%=column.Name%>" class="control-label x120"><%=column.Description%>:</label>
|
|
||||||
<input type="text" name="<%=column.Name%>" id="<%=column.Name%>" value="@Model.<%=column.Name%>"
|
|
||||||
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>
|
|
@ -1,148 +1,93 @@
|
|||||||
<%--
|
<%--
|
||||||
Name: Database Table Properties
|
Name: 列表页面
|
||||||
Author: yubaolee
|
Author: yubaolee
|
||||||
Description: Create a list of properties from a database table
|
Description: 列表页面
|
||||||
--%>
|
--%>
|
||||||
<%@ CodeTemplate Language="C#" Encoding="utf-8" TargetLanguage="C#" Debug="True" Description="Create a list of properties from database table." %>
|
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Encoding="utf-8" Description="添加模块" %>
|
||||||
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the object is based on." %>
|
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context"
|
||||||
|
Description="连接的数据库" %>
|
||||||
<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
|
<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
|
||||||
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
|
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
|
||||||
<%@ Assembly Name="SchemaExplorer" %>
|
<%@ Assembly Name="SchemaExplorer" %>
|
||||||
<%@ Import Namespace="SchemaExplorer" %>
|
<%@ Import Namespace="SchemaExplorer" %>
|
||||||
|
<%@ Assembly Src="Util.cs" %>
|
||||||
|
<%@ Import Namespace="Util" %>
|
||||||
@{
|
@{
|
||||||
string _prefix = "<%=ModuleName%>";
|
Layout = "~/Views/Shared/_BjuiLayout.cshtml";
|
||||||
var _treeId = _prefix + "Tree";
|
|
||||||
var _gridId = _prefix + "Grid";
|
|
||||||
var _treeDetail = _prefix + "Detail";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||||
<div class="bjui-pageContent tableContent">
|
<div class="bjui-pageContent tableContent" style="position: relative">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
||||||
<ul id="@_treeId" class="ztree"></ul>
|
<ul id="tree" class="ztree"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="@_treeDetail" style="margin-left: 225px;">
|
<div id="detail" style="margin-left: 225px;">
|
||||||
|
<table id="maingrid" class="table table-bordered"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--编辑对话框-->
|
||||||
<script type="text/javascript">
|
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||||
var selectedId = 0;
|
<div class="bjui-pageContent">
|
||||||
$(document).ready(function () {
|
<form action="/<%=ModuleName%>/Add" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||||
initZtree();
|
|
||||||
loadDataGrid();
|
<table class="table table-condensed table-hover">
|
||||||
});
|
<tbody>
|
||||||
//加载数据到datagrid
|
<% foreach (ColumnSchema column in this.SourceTable.Columns) {
|
||||||
function loadDataGrid() {
|
if(column.IsPrimaryKeyMember){%>
|
||||||
//b-jui的datagrid需要重新处理HTML
|
<input type="text" id="<%=column.Name%>" name="<%=column.Name%>" value="" class="hidden" />
|
||||||
$('#@_treeDetail').empty()
|
<%}else if(CSharpAlias[column.SystemType.FullName] == "bool"
|
||||||
.append('<table id="@_gridId" class="table table-bordered table-hover table-striped table-top"></table>');
|
||(CSharpAlias[column.SystemType.FullName] == "int" && Tools.GetDescription(column).Contains("下拉选择"))) {%>
|
||||||
|
<tr>
|
||||||
$('#@_gridId').datagrid({
|
<td>
|
||||||
showToolbar: false,
|
<label for="<%=column.Name%>" class="control-label x120"><%=Tools.GetDescription(column)%>:</label>
|
||||||
filterThead: false,
|
<select name="<%=column.Name%>" id="<%=column.Name%>" data-toggle="selectpicker" data-rule="required">
|
||||||
columns: [
|
<option value="0">默认</option>
|
||||||
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
<option value="1">禁用</option>
|
||||||
{
|
</select>
|
||||||
name: '<%=column.Name%>',
|
</td>
|
||||||
label: '<%=column.Description%>',
|
</tr>
|
||||||
width: 100
|
<%}else if(CSharpAlias[column.SystemType.FullName].Contains("DateTime")) {%>
|
||||||
<%if(column.IsPrimaryKeyMember){ %>
|
<tr>
|
||||||
, hide: true
|
<td>
|
||||||
|
<label for="<%=column.Name%>" class="control-label x120"><%=Tools.GetDescription(column)%>:</label>
|
||||||
|
<input type="text" id="<%=column.Name%>" name="<%=column.Name%>" value="" data-toggle="datepicker"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<%} else {%>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="<%=column.Name%>" class="control-label x120"><%=Tools.GetDescription(column)%>:</label>
|
||||||
|
<input type="text" id="<%=column.Name%>" name="<%=column.Name%>" value=""/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<%} %>
|
||||||
|
<%} %>
|
||||||
|
<%if(Tools.NeedCascade(SourceTable)){ %>
|
||||||
|
<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>
|
||||||
<%} %>
|
<%} %>
|
||||||
<%else if(CSharpAlias[column.SystemType.FullName] == "System.DateTime") {%>
|
</tbody>
|
||||||
, type: 'date',
|
</table>
|
||||||
pattern: 'yyyy-MM-dd HH:mm:ss'
|
</form>
|
||||||
<%} %>
|
</div>
|
||||||
<%else if(CSharpAlias[column.SystemType.FullName] == "bool") {%>
|
<div class="bjui-pageFooter">
|
||||||
,type: 'select',
|
<ul>
|
||||||
align: 'center',
|
<li><button type="button" class="btn btn-close">关闭</button></li>
|
||||||
items: [{ '0': '否' }, { '1': '是' }],
|
<li><button type="button" class="btn btn-primary" id="btnSave">保存</button></li>
|
||||||
<%} %>
|
</ul>
|
||||||
<%else if(CSharpAlias[column.SystemType.FullName] == "int") {%>
|
</div>
|
||||||
,type: 'select',
|
</div>
|
||||||
align: 'center',
|
|
||||||
items: [{ '0': '默认' }, { '1': '状态1' }],
|
|
||||||
<%} %>
|
|
||||||
},
|
|
||||||
<% } %>
|
|
||||||
],
|
|
||||||
dataUrl: '<%=ModuleName%>Manager/Load?parentId=' + selectedId,
|
|
||||||
fullGrid: true,
|
|
||||||
showLinenumber: true,
|
|
||||||
showCheckboxcol: true,
|
|
||||||
paging: true,
|
|
||||||
filterMult: false,
|
|
||||||
showTfoot: true,
|
|
||||||
height: '700'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
<script src="~/BllScripts/grid.js"></script>
|
||||||
selectedId = treeNode.Id;
|
<script src="~/BllScripts/<%=ModuleName%>.js"></script>
|
||||||
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('<%=ModuleName%>Manager/LoadForTree', function (json) {
|
|
||||||
var zTreeObj = $.fn.zTree.init($('#@_treeId'), setting, json);
|
|
||||||
zTreeObj.expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除
|
|
||||||
function del<%=ModuleName%>() {
|
|
||||||
var selected = getSelected('#@_gridId',2);
|
|
||||||
if (selected == null) return;
|
|
||||||
|
|
||||||
$.getJSON('<%=ModuleName%>Manager/Delete?Id=' + selected, function (data) {
|
|
||||||
if (data.statusCode == "200")
|
|
||||||
loadDataGrid();
|
|
||||||
else {
|
|
||||||
$(this).alertmsg('warn', data.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自定义的编辑按钮
|
|
||||||
function edit<%=ModuleName%>() {
|
|
||||||
var selected = getSelected('#@_gridId',2);
|
|
||||||
if (selected == null) return;
|
|
||||||
|
|
||||||
$(this).dialog({
|
|
||||||
id: 'editDialog',
|
|
||||||
url: '/<%=ModuleName%>Manager/Add?id=' + selected,
|
|
||||||
title: '编辑',
|
|
||||||
onClose:function() {
|
|
||||||
refresh<%=ModuleName%>Grid();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh<%=ModuleName%>Grid() {
|
|
||||||
$('#@_gridId').datagrid('refresh');
|
|
||||||
// loadDataGrid();
|
|
||||||
}
|
|
||||||
//@@ sourceURL=<%=ModuleName%>ManagerIndex.js
|
|
||||||
</script>
|
|
24
CodeSmith/Util.cs
Normal file
24
CodeSmith/Util.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using CodeSmith.Engine;
|
||||||
|
using SchemaExplorer;
|
||||||
|
|
||||||
|
namespace Util{
|
||||||
|
public class Tools{
|
||||||
|
public static String GetDescription(ColumnSchema column) { //得到字段的描述
|
||||||
|
if(string.IsNullOrEmpty(column.Description))
|
||||||
|
return column.Name;
|
||||||
|
else
|
||||||
|
return column.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool NeedCascade(TableSchema SourceTable){ //判断表中是否需要下拉选择树
|
||||||
|
return SourceTable.Columns.Contains("ParentId")
|
||||||
|
|| SourceTable.Columns.Contains("CascadeId") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
250
CodeSmith/editDlg.js.cst
Normal file
250
CodeSmith/editDlg.js.cst
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
<%--
|
||||||
|
Name: 编辑修改JS
|
||||||
|
Author: yubaolee
|
||||||
|
Description: 编辑修改JS
|
||||||
|
--%>
|
||||||
|
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Encoding="utf-8" Description="添加模块" %>
|
||||||
|
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context"
|
||||||
|
Description="连接的数据库" %>
|
||||||
|
<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
|
||||||
|
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
|
||||||
|
<%@ Assembly Name="SchemaExplorer" %>
|
||||||
|
<%@ Import Namespace="SchemaExplorer" %>
|
||||||
|
<%@ Assembly Src="Util.cs" %>
|
||||||
|
<%@ Import Namespace="Util" %>
|
||||||
|
|
||||||
|
|
||||||
|
//grid列表模块
|
||||||
|
function MainGrid() {
|
||||||
|
var url = '/<%=ModuleName%>/Load?parentId=';
|
||||||
|
var selectedId = 0; //ztree选中的模块
|
||||||
|
this.maingrid = $('#maingrid').datagrid({
|
||||||
|
showToolbar: false,
|
||||||
|
filterThead: false,
|
||||||
|
target: $(this),
|
||||||
|
columns: [
|
||||||
|
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
||||||
|
{
|
||||||
|
name: '<%=column.Name%>',
|
||||||
|
label: '<%=Tools.GetDescription(column)%>',
|
||||||
|
width: 100
|
||||||
|
<%if(column.IsPrimaryKeyMember){ %>
|
||||||
|
, hide: true
|
||||||
|
<%} %>
|
||||||
|
<%else if(CSharpAlias[column.SystemType.FullName] == "bool") {%>
|
||||||
|
,type: 'select',
|
||||||
|
align: 'center',
|
||||||
|
items: [{ '0': '否' }, { '1': '是' }],
|
||||||
|
<%} %>
|
||||||
|
<%else if(CSharpAlias[column.SystemType.FullName] == "int") {%>
|
||||||
|
,type: 'select',
|
||||||
|
align: 'center',
|
||||||
|
items: [{ '0': '默认' }, { '1': '状态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();
|
||||||
|
|
||||||
|
//左边分类导航树
|
||||||
|
var ztree = function () {
|
||||||
|
var url = '/<%=ModuleName%>/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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
<%if(Tools.NeedCascade(SourceTable)){ %>
|
||||||
|
//编辑时,选择上级弹出的树
|
||||||
|
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('/<%=ModuleName%>/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);
|
||||||
|
|
||||||
|
<%if(Tools.NeedCascade(SourceTable)){
|
||||||
|
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("下拉选择"))) {%>
|
||||||
|
$('#<%=column.Name%>').selectpicker('val', ret.<%=column.Name%>);
|
||||||
|
<%} else{ %>
|
||||||
|
$('#<%=column.Name%>').val(ret.<%=column.Name%>);
|
||||||
|
<%} %>
|
||||||
|
<% } %>
|
||||||
|
<%if(Tools.NeedCascade(SourceTable)){
|
||||||
|
Response.WriteLine("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('/moduleManager/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=<%=ModuleName%>.js
|
@ -27,7 +27,7 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return _repository.GetCategoryCntInOrgs(GetSubOrgIds(orgId));
|
return _repository.GetCategoryCntInOrgs(GetSubCategories(orgId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,19 +39,19 @@ namespace OpenAuth.App
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载一个部门及子部门全部Categorys
|
/// 加载一个部门及子部门全部Categorys
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public dynamic Load(int orgId, int pageindex, int pagesize)
|
public dynamic Load(int parentId, int pageindex, int pagesize)
|
||||||
{
|
{
|
||||||
IEnumerable<Category> Categorys;
|
IEnumerable<Category> Categorys;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
if (orgId == 0)
|
if (parentId == 0)
|
||||||
{
|
{
|
||||||
Categorys = _repository.LoadCategorys(pageindex, pagesize);
|
Categorys = _repository.LoadCategorys(pageindex, pagesize);
|
||||||
total = _repository.GetCount();
|
total = _repository.GetCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Categorys = _repository.LoadInOrgs(pageindex, pagesize, GetSubOrgIds(orgId));
|
Categorys = _repository.LoadInOrgs(pageindex, pagesize, GetSubCategories(parentId));
|
||||||
total = _repository.GetCategoryCntInOrgs(orgId);
|
total = _repository.GetCategoryCntInOrgs(parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new
|
return new
|
||||||
@ -65,11 +65,11 @@ namespace OpenAuth.App
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前组织的所有下级组织
|
/// 获取当前组织的所有下级组织
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int[] GetSubOrgIds(int orgId)
|
private int[] GetSubCategories(int orgId)
|
||||||
{
|
{
|
||||||
var org = _orgRepository.FindSingle(u => u.Id == orgId);
|
var category = Find(orgId);
|
||||||
var orgs = _orgRepository.Find(u => u.CascadeId.Contains(org.CascadeId)).Select(u => u.Id).ToArray();
|
var categories = _repository.Find(u => u.CascadeId.Contains(category.CascadeId)).Select(u => u.Id).ToArray();
|
||||||
return orgs;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Category Find(int id)
|
public Category Find(int id)
|
||||||
@ -89,9 +89,10 @@ namespace OpenAuth.App
|
|||||||
{
|
{
|
||||||
Category category = new Category();
|
Category category = new Category();
|
||||||
model.CopyTo(category);
|
model.CopyTo(category);
|
||||||
|
ChangeModuleCascade(category);
|
||||||
|
|
||||||
if (category.Id == 0)
|
if (category.Id == 0)
|
||||||
{
|
{
|
||||||
ChangeModuleCascade(category);
|
|
||||||
_repository.Add(category);
|
_repository.Add(category);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -97,18 +97,24 @@ namespace OpenAuth.App
|
|||||||
_repository.Delete(u =>delIds.Contains(u.Id));
|
_repository.Delete(u =>delIds.Contains(u.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AssignForRole(int roleId,int moduleId, int[] menuIds)
|
public void AssignForRole(int roleId, int[] menuIds)
|
||||||
{
|
{
|
||||||
var elements = _repository.Find(u => u.ModuleId == moduleId).Select(u =>u.Id).ToArray();
|
|
||||||
_relevanceRepository.Delete(u =>elements.Contains(u.SecondId) &&u.Key =="RoleElement" && u.FirstId == roleId);
|
|
||||||
_relevanceRepository.AddRelevance("RoleElement", menuIds.ToLookup(u => roleId));
|
_relevanceRepository.AddRelevance("RoleElement", menuIds.ToLookup(u => roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AssignForUser(int userId, int moduleId, int[] ids)
|
public void CancelForRole(int roleId, int[] ids)
|
||||||
|
{
|
||||||
|
_relevanceRepository.Delete(u => ids.Contains(u.SecondId) && u.Key == "RoleElement" && u.FirstId == roleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AssignForUser(int userId, int[] ids)
|
||||||
{
|
{
|
||||||
var elements = _repository.Find(u => u.ModuleId == moduleId).Select(u => u.Id).ToArray();
|
|
||||||
_relevanceRepository.Delete(u => elements.Contains(u.SecondId) && u.Key == "UserElement" && u.FirstId == userId);
|
|
||||||
_relevanceRepository.AddRelevance("UserElement", ids.ToLookup(u => userId));
|
_relevanceRepository.AddRelevance("UserElement", ids.ToLookup(u => userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CancelForUser(int userId, int[] ids)
|
||||||
|
{
|
||||||
|
_relevanceRepository.Delete(u => ids.Contains(u.SecondId) && u.Key == "UserElement" && u.FirstId == userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,9 @@ namespace OpenAuth.App
|
|||||||
{
|
{
|
||||||
Module model = new Module();
|
Module model = new Module();
|
||||||
vm.CopyTo(model); //copy一次,防止成员为null的情况
|
vm.CopyTo(model); //copy一次,防止成员为null的情况
|
||||||
|
ChangeModuleCascade(model);
|
||||||
if (model.Id == 0)
|
if (model.Id == 0)
|
||||||
{
|
{
|
||||||
ChangeModuleCascade(model);
|
|
||||||
_repository.Add(model);
|
_repository.Add(model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -16,7 +16,7 @@ var moduleId = $.CurrentDialog.find("#selectedModuleId").val(); //外部传递
|
|||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.CurrentDialog.find('#btnAddElement').on('click', function () {
|
$.CurrentDialog.find('#btnAddElement').on('click', function () {
|
||||||
editDlg.add();
|
editEleDlg.add();
|
||||||
});
|
});
|
||||||
|
|
||||||
$.CurrentDialog.find('#btnEditElement').on('click', function () {
|
$.CurrentDialog.find('#btnEditElement').on('click', function () {
|
||||||
@ -24,7 +24,7 @@ $(document).ready(function () {
|
|||||||
if (selected == null) {
|
if (selected == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
editDlg.update(selected);
|
editEleDlg.update(selected);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.CurrentDialog.find('#btnDelElement').on('click', function () {
|
$.CurrentDialog.find('#btnDelElement').on('click', function () {
|
||||||
@ -48,32 +48,67 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
//本对话框
|
//本对话框
|
||||||
var thisDlg = function () {
|
var thisDlg = function () {
|
||||||
var maingrid = $.CurrentDialog.find('#maingrid').datagrid({
|
var maingrid = $('#moduleEleList').datagrid({
|
||||||
showToolbar: false,
|
showToolbar: false,
|
||||||
filterThead: false,
|
filterThead: false,
|
||||||
target: $(this),
|
target: $(this),
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'Id',
|
name: 'Id',
|
||||||
label: '功能模块流水号',
|
label: '流水号',
|
||||||
hide: true
|
width: 100
|
||||||
},
|
, hide: true
|
||||||
{
|
},
|
||||||
name: 'DomId',
|
{
|
||||||
label: 'DOM标识',
|
name: 'DomId',
|
||||||
},
|
label: 'DOM ID',
|
||||||
{
|
width: 100
|
||||||
name: 'Name',
|
},
|
||||||
label: '功能模块名称',
|
{
|
||||||
},
|
name: 'Name',
|
||||||
{
|
label: '名称',
|
||||||
name: 'Icon',
|
width: 100
|
||||||
label: '图标',
|
},
|
||||||
},
|
{
|
||||||
{
|
name: 'Type',
|
||||||
name: 'SortNo',
|
label: '类型',
|
||||||
label: '排序号'
|
width: 100
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
name: 'ModuleId',
|
||||||
|
label: '功能模块Id',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Attr',
|
||||||
|
label: '元素附加属性',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Script',
|
||||||
|
label: '元素调用脚本',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Icon',
|
||||||
|
label: '元素图标',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Class',
|
||||||
|
label: '元素样式',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Remark',
|
||||||
|
label: '备注',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Sort',
|
||||||
|
label: '排序字段',
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
],
|
],
|
||||||
dataUrl: '/ModuleElementManager/Get?moduleId=' + moduleId,
|
dataUrl: '/ModuleElementManager/Get?moduleId=' + moduleId,
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
@ -82,7 +117,7 @@ var thisDlg = function () {
|
|||||||
paging: false,
|
paging: false,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: 'auto'
|
height: '100%'
|
||||||
});
|
});
|
||||||
|
|
||||||
var getSelectDatas = function () {
|
var getSelectDatas = function () {
|
||||||
@ -110,36 +145,50 @@ var thisDlg = function () {
|
|||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
var editDlg = function () {
|
//添加(编辑)对话框
|
||||||
|
var editEleDlg = function () {
|
||||||
var update = false;
|
var update = false;
|
||||||
//在B-JUI中,不能在这里获取DOM,否则下面赋值会不成功
|
|
||||||
//只能直接 $("#Id").val(ret.Id);
|
|
||||||
// Id = $("#Id");
|
|
||||||
var show = function () {
|
var show = function () {
|
||||||
BJUI.dialog({ id: 'editDlg', title: '菜单编辑', target: '#editDlg' });
|
BJUI.dialog({ id: 'editEleDlg', title: '菜单编辑', target: '#editEleDlg' });
|
||||||
|
$("#btnEleChange").on("click", function () {
|
||||||
|
editEleDlg.save();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
add: function () {
|
add: function () { //弹出添加
|
||||||
|
update = false;
|
||||||
show();
|
show();
|
||||||
$("#editElementForm")[0].reset(); //reset方法只能通过dom调用
|
$("#editElementForm")[0].reset(); //reset方法只能通过dom调用
|
||||||
$("#Id").val(0);
|
$.CurrentDialog.find("#Id").val(0);
|
||||||
$("#Sort").val('0');
|
$.CurrentDialog.find("#Sort").val('0');
|
||||||
$("#ModuleId").val(moduleId);
|
$.CurrentDialog.find("#ModuleId").val(moduleId);
|
||||||
|
|
||||||
},
|
},
|
||||||
update: function (ret) {
|
update: function (ret) { //弹出编辑框
|
||||||
update = true;
|
update = true;
|
||||||
show();
|
show();
|
||||||
$("#Id").val(ret.Id);
|
$.CurrentDialog.find('#Id').val(ret.Id);
|
||||||
$("#DomId").val(ret.DomId);
|
$.CurrentDialog.find('#DomId').val(ret.DomId);
|
||||||
$("#Name").val(ret.Name);
|
$.CurrentDialog.find('#Name').val(ret.Name);
|
||||||
$("#Type").val(ret.Type);
|
$.CurrentDialog.find('#Type').selectpicker('val', ret.Type);
|
||||||
$("#ModuleId").val(ret.ModuleId);
|
$.CurrentDialog.find('#ModuleId').val(ret.ModuleId);
|
||||||
$("#Attr").val(ret.Attr);
|
$.CurrentDialog.find('#Attr').val(ret.Attr);
|
||||||
$("#Script").val(ret.Script);
|
$.CurrentDialog.find('#Script').val(ret.Script);
|
||||||
$("#Icon").val(ret.Icon);
|
$.CurrentDialog.find('#Icon').selectpicker('val', ret.Icon);
|
||||||
$("#Class").val(ret.Class);
|
$.CurrentDialog.find('#Class').selectpicker('val', ret.Class);
|
||||||
$("#Remark").val(ret.Remark);
|
$.CurrentDialog.find('#Remark').val(ret.Remark);
|
||||||
$("#Sort").val(ret.Sort);
|
$.CurrentDialog.find('#Sort').val(ret.Sort);
|
||||||
|
},
|
||||||
|
save: function () { //编辑-->保存
|
||||||
|
$('#editElementForm').isValid(function (v) {
|
||||||
|
if (!v) return; //验证没通过
|
||||||
|
$("#editElementForm").bjuiajax('ajaxForm', {
|
||||||
|
reload: false,
|
||||||
|
callback: function (json) {
|
||||||
|
thisDlg.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
|
@ -12,12 +12,114 @@
|
|||||||
// <summary>模块管理脚本</summary>
|
// <summary>模块管理脚本</summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
$(document).ready(function () {
|
//grid列表模块
|
||||||
});
|
function MainGrid() {
|
||||||
|
var url = '/ModuleManager/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: 'CascadeId',
|
||||||
|
label: '节点语义ID',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Name',
|
||||||
|
label: '功能模块名称',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Url',
|
||||||
|
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: '是否叶子节点',
|
||||||
|
width: 100
|
||||||
|
, type: 'select',
|
||||||
|
align: 'center',
|
||||||
|
items: [{ 'false': '否' }, { 'true': '是' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'IsAutoExpand',
|
||||||
|
label: '是否自动展开',
|
||||||
|
width: 100
|
||||||
|
, type: 'select',
|
||||||
|
align: 'center',
|
||||||
|
items: [{ 'false': '否' }, { 'true': '是' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'IconName',
|
||||||
|
label: '节点图标文件名称',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Status',
|
||||||
|
label: '当前状态',
|
||||||
|
width: 100
|
||||||
|
, type: 'select',
|
||||||
|
align: 'center',
|
||||||
|
items: [{ '0': '默认' }, { '1': '状态1' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ParentName',
|
||||||
|
label: '父节点名称',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Vector',
|
||||||
|
label: '矢量图标',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'SortNo',
|
||||||
|
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();
|
||||||
|
|
||||||
//ztree模块
|
//左边分类导航树
|
||||||
var ztree = function () {
|
var ztree = function () {
|
||||||
var zTreeObj = undefined;
|
var url = '/ModuleManager/LoadModuleWithRoot';
|
||||||
var setting = {
|
var setting = {
|
||||||
view: { selectedMulti: false },
|
view: { selectedMulti: false },
|
||||||
data: {
|
data: {
|
||||||
@ -34,115 +136,150 @@ var ztree = function () {
|
|||||||
},
|
},
|
||||||
callback: { onClick: zTreeOnClick }
|
callback: { onClick: zTreeOnClick }
|
||||||
};
|
};
|
||||||
$.getJSON('/ModuleManager/LoadModuleWithRoot', function (json) {
|
$.getJSON(url, function (json) {
|
||||||
zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
|
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||||
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: '功能模块流水号',
|
|
||||||
hide: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'CascadeId',
|
|
||||||
label: '节点语义ID',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Name',
|
|
||||||
label: '功能模块名称',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Url',
|
|
||||||
label: '主页面URL',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ParentId',
|
|
||||||
label: '父节点流水号',
|
|
||||||
hide: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'IconName',
|
|
||||||
width: 80,
|
|
||||||
label: '节点图标文件名称'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Status',
|
|
||||||
width: 80,
|
|
||||||
label: '当前状态'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ParentName',
|
|
||||||
width: 80,
|
|
||||||
label: '父节点名称'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Vector',
|
|
||||||
width: 80,
|
|
||||||
label: '矢量图标'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'SortNo',
|
|
||||||
width: 80,
|
|
||||||
label: '排序号'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
dataUrl: '/ModuleManager/Load?orgId=' + selectedId,
|
|
||||||
fullGrid: true,
|
|
||||||
showLinenumber: true,
|
|
||||||
showCheckboxcol: true,
|
|
||||||
paging: true,
|
|
||||||
filterMult: false,
|
|
||||||
showTfoot: false,
|
|
||||||
height: 'auto'
|
|
||||||
});
|
});
|
||||||
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
reload: function (id) {
|
reload: function () {
|
||||||
if (id != undefined) selectedId = id;
|
$.getJSON(url, function (json) {
|
||||||
maingrid.datagrid('reload', { dataUrl: '/ModuleManager/Load?orgId=' + selectedId });
|
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
//编辑时,选择上级弹出的树
|
||||||
|
var parentTree = function () {
|
||||||
|
var nameDom = "#ParentName";
|
||||||
|
var idDom = "#ParentId";
|
||||||
|
var zTreeObj;
|
||||||
|
var setting = {
|
||||||
|
view: {
|
||||||
|
selectedMulti: false
|
||||||
},
|
},
|
||||||
getSelectedObj: function () { //选择单行
|
check: {
|
||||||
var selectedDatas = maingrid.data('selectedDatas');
|
enable: true,
|
||||||
if (selectedDatas == undefined || selectedDatas.length == 0) {
|
chkStyle: "radio", //单选
|
||||||
$(this).alertmsg('warn', '至少选择一个对象', {
|
radioType: "all"
|
||||||
displayMode: 'slide',
|
},
|
||||||
title: '重要提示'
|
data: {
|
||||||
});
|
key: {
|
||||||
return null;
|
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('/moduleManager/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);
|
||||||
|
$('#CascadeId').val(ret.CascadeId);
|
||||||
|
$('#Name').val(ret.Name);
|
||||||
|
$('#Url').val(ret.Url);
|
||||||
|
$('#HotKey').val(ret.HotKey);
|
||||||
|
$('#ParentId').val(ret.ParentId);
|
||||||
|
$('#IsLeaf').selectpicker('val', ret.IsLeaf?"true":"false");
|
||||||
|
$('#IsAutoExpand').selectpicker('val', ret.IsAutoExpand?"true":"false");
|
||||||
|
$('#IconName').val(ret.IconName);
|
||||||
|
$('#Status').val(ret.Status);
|
||||||
|
$('#ParentName').val(ret.ParentName);
|
||||||
|
$('#Vector').val(ret.Vector);
|
||||||
|
$('#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 zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
grid.reload(treeNode.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除
|
//删除
|
||||||
function delModule() {
|
function del() {
|
||||||
var selected = grid.getSelectedObj();
|
var selected = list.getSelectedObj();
|
||||||
if (selected == null) return;
|
if (selected == null) return;
|
||||||
|
|
||||||
$.getJSON('/ModuleManager/Delete?Id=' + selected.Id, function (data) {
|
$.getJSON('/moduleManager/Delete?Id=' + selected.Id, function (data) {
|
||||||
if (data.statusCode == "200")
|
if (data.statusCode == "200") {
|
||||||
grid.reload();
|
list.reload();
|
||||||
|
ztree.reload();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$(this).alertmsg('warn', data.message);
|
$(this).alertmsg('warn', data.message);
|
||||||
}
|
}
|
||||||
@ -150,23 +287,25 @@ function delModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//自定义的编辑按钮
|
//自定义的编辑按钮
|
||||||
function editModule() {
|
function edit() {
|
||||||
var selected = grid.getSelectedObj();
|
var selected = list.getSelectedObj();
|
||||||
if (selected == null) return;
|
if (selected == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editDlg.update(selected);
|
||||||
|
}
|
||||||
|
|
||||||
$(this).dialog({
|
function add() {
|
||||||
id: 'editDialog',
|
editDlg.add();
|
||||||
url: '/ModuleManager/Add?id=' + selected.Id,
|
}
|
||||||
title: '编辑',
|
|
||||||
onClose: function () {
|
function refresh() {
|
||||||
grid.reload();
|
list.reload();
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//为模块分配按钮
|
//为模块分配按钮
|
||||||
function assignButton() {
|
function assignButton() {
|
||||||
var selected = grid.getSelectedObj();
|
var selected = list.getSelectedObj();
|
||||||
if (selected == null) return;
|
if (selected == null) return;
|
||||||
|
|
||||||
//BJUI.dialog({ id: 'assignDialog', title: '菜单编辑', target: '#moduleElementManager' });
|
//BJUI.dialog({ id: 'assignDialog', title: '菜单编辑', target: '#moduleElementManager' });
|
||||||
@ -175,10 +314,10 @@ function assignButton() {
|
|||||||
id: 'assignDialog',
|
id: 'assignDialog',
|
||||||
mask: true,
|
mask: true,
|
||||||
url: '/ModuleElementManager/Index?id=' + selected.Id,
|
url: '/ModuleElementManager/Index?id=' + selected.Id,
|
||||||
title: '为模块分配按钮'
|
title: '为模块分配按钮',
|
||||||
|
width: '800',
|
||||||
|
height:'600'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshModuleGrid() {
|
//@@ sourceURL=moduleManager.js
|
||||||
grid.reload();
|
|
||||||
}
|
|
116
OpenAuth.Mvc/BllScripts/userModuleElement.js
Normal file
116
OpenAuth.Mvc/BllScripts/userModuleElement.js
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
// ***********************************************************************
|
||||||
|
// Assembly : OpenAuth.Mvc
|
||||||
|
// Author : yubaolee
|
||||||
|
// Created : 04-13-2016
|
||||||
|
//
|
||||||
|
// Last Modified By : yubaolee
|
||||||
|
// Last Modified On : 04-13-2016
|
||||||
|
// ***********************************************************************
|
||||||
|
// <copyright file="userModuleElement.js" company="www.cnblogs.com/yubaolee">
|
||||||
|
// 版权所有(C) 2015
|
||||||
|
// </copyright>
|
||||||
|
// <summary>为用户分配模块菜单</summary>
|
||||||
|
// ***********************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||||
|
var ids = list.getSelectedProperties('Id');
|
||||||
|
if (ids == null) return;
|
||||||
|
|
||||||
|
$.post("/ModuleElementManager/AssignForUser",
|
||||||
|
{
|
||||||
|
userId: $('#userId').val(),
|
||||||
|
menuIds: ids,
|
||||||
|
}, function (json) {
|
||||||
|
list.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
||||||
|
var ids = list.getSelectedProperties('Id');
|
||||||
|
if (ids == null) return;
|
||||||
|
|
||||||
|
$.post("/ModuleElementManager/CancelForUser",{
|
||||||
|
userId: $('#userId').val(),
|
||||||
|
menuIds: ids,
|
||||||
|
}, function (json) {
|
||||||
|
list.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//grid列表模块
|
||||||
|
function UserMEGrid() {
|
||||||
|
var selectedId = 0; //ztree选中的模块
|
||||||
|
this.maingrid = $.CurrentDialog.find('#maingrid').datagrid({
|
||||||
|
showToolbar: false,
|
||||||
|
filterThead: false,
|
||||||
|
target: $(this),
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'Id',
|
||||||
|
label: '元素名称',
|
||||||
|
hide: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Name',
|
||||||
|
label: '元素名称',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ModuleName',
|
||||||
|
label: '所属模块',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Accessed',
|
||||||
|
label: '是否已经授权',
|
||||||
|
type: 'select',
|
||||||
|
align: 'center',
|
||||||
|
items: [{ 'false': '未授权', 'true': '已授权' }],
|
||||||
|
width: 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
dataUrl: '/ModuleElementManager/LoadForUser?moduleId=' + selectedId + '&userId=' + $('#userId').val(),
|
||||||
|
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: '/ModuleElementManager/LoadForUser?moduleId=' + selectedId + '&userId=' + $('#userId').val() });
|
||||||
|
};
|
||||||
|
};
|
||||||
|
UserMEGrid.prototype = new Grid();
|
||||||
|
var list = new UserMEGrid();
|
||||||
|
|
||||||
|
var ztree = function () {
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: { onClick: zTreeOnClick }
|
||||||
|
};
|
||||||
|
$.getJSON('/ModuleManager/LoadForUser?userId=' + $('#userId').val(), function (json) {
|
||||||
|
var zTreeObj = $.fn.zTree.init($.CurrentDialog.find("#tree"), setting, json);
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
}();
|
||||||
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
//@@ sourceURL=userModuleElement.js
|
@ -1,4 +1,19 @@
|
|||||||
$(document).ready(function () {
|
// ***********************************************************************
|
||||||
|
// Assembly : OpenAuth.Mvc
|
||||||
|
// Author : yubaolee
|
||||||
|
// Created : 04-13-2016
|
||||||
|
//
|
||||||
|
// Last Modified By : yubaolee
|
||||||
|
// Last Modified On : 04-13-2016
|
||||||
|
// ***********************************************************************
|
||||||
|
// <copyright file="userRoleManager.js" company="www.cnblogs.com/yubaolee">
|
||||||
|
// 版权所有(C) 2015
|
||||||
|
// </copyright>
|
||||||
|
// <summary>用户分配角色模块</summary>
|
||||||
|
// ***********************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||||
var ids = userRolesList.getSelectedProperties('Id');
|
var ids = userRolesList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
@ -62,7 +77,7 @@ function UserRolesList() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: 'auto'
|
height: '100%'
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
@ -97,4 +112,4 @@ var ztree = function () {
|
|||||||
function zTreeOnClick(event, treeId, treeNode) {
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
userRolesList.reload(treeNode.Id);
|
userRolesList.reload(treeNode.Id);
|
||||||
}
|
}
|
||||||
//@@ sourceURL=RoleLookup.js
|
//@@ sourceURL=userRoleManager.js
|
||||||
|
@ -104,7 +104,7 @@ var grid = function () {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: 'auto'
|
height: '100%'
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -675,12 +675,12 @@ span.tmpzTreeMove_arrow,.ztree .tree_add, .ztree .tree_del,
|
|||||||
.ztree li span.button.chk{margin:0 3px 0 0; width:18px; height:20px; cursor:auto;}
|
.ztree li span.button.chk{margin:0 3px 0 0; width:18px; height:20px; cursor:auto;}
|
||||||
.ztree li span.button.chk.checkbox_false_full{background-position:0 -2px;}
|
.ztree li span.button.chk.checkbox_false_full{background-position:0 -2px;}
|
||||||
.ztree li span.button.chk.checkbox_false_full_focus{background-position:0 -24px;}
|
.ztree li span.button.chk.checkbox_false_full_focus{background-position:0 -24px;}
|
||||||
.ztree li span.button.chk.checkbox_false_part{background-position:-19px -46px;}
|
.ztree li span.button.chk.checkbox_false_part{background-position: 0px -46px;}
|
||||||
.ztree li span.button.chk.checkbox_false_part_focus{background-position:-19px -24px;}
|
.ztree li span.button.chk.checkbox_false_part_focus{background-position:0px -46px;}
|
||||||
.ztree li span.button.chk.checkbox_false_disable{background-position:0 -68px;}
|
.ztree li span.button.chk.checkbox_false_disable{background-position:0 -68px;}
|
||||||
.ztree li span.button.chk.checkbox_true_full{background-position:-19px -2px;}
|
.ztree li span.button.chk.checkbox_true_full{background-position:-19px -2px;}
|
||||||
.ztree li span.button.chk.checkbox_true_full_focus{background-position:-19px -24px;}
|
.ztree li span.button.chk.checkbox_true_full_focus{background-position:-19px -24px;}
|
||||||
.ztree li span.button.chk.checkbox_true_part{background-position:-19px -46px;}
|
.ztree li span.button.chk.checkbox_true_part{background-position: -19px -24px;}
|
||||||
.ztree li span.button.chk.checkbox_true_part_focus{background-position:-19px -24px;}
|
.ztree li span.button.chk.checkbox_true_part_focus{background-position:-19px -24px;}
|
||||||
.ztree li span.button.chk.checkbox_true_disable{background-position:-19px -68px;}
|
.ztree li span.button.chk.checkbox_true_disable{background-position:-19px -68px;}
|
||||||
.ztree li span.button.chk.radio_false_full{background-position:-40px -2px;}
|
.ztree li span.button.chk.radio_false_full{background-position:-40px -2px;}
|
||||||
|
@ -24,11 +24,11 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载组织下面的所有用户
|
/// 加载分类下面的所有分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
|
public string Load(int parentId, int pageCurrent = 1, int pageSize = 30)
|
||||||
{
|
{
|
||||||
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
|
return JsonHelper.Instance.Serialize(_app.Load(parentId, pageCurrent, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LoadForTree()
|
public string LoadForTree()
|
||||||
|
@ -92,12 +92,12 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
/// <param name="menuIds">菜单ID列表</param>
|
/// <param name="menuIds">菜单ID列表</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public string AssignForRole(int roleId,int moduleId, string menuIds)
|
public string AssignForRole(int roleId, string menuIds)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ids = menuIds.Split(',').Select(id => int.Parse(id)).ToArray();
|
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
||||||
_app.AssignForRole(roleId,moduleId, ids);
|
_app.AssignForRole(roleId, ids);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -107,9 +107,25 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LoadForRole(int roleId, int orgId)
|
[HttpPost]
|
||||||
|
public string CancelForRole(int roleId, string menuIds)
|
||||||
{
|
{
|
||||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess("RoleElement", roleId, orgId));
|
try
|
||||||
|
{
|
||||||
|
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
||||||
|
_app.CancelForRole(roleId, ids);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_bjuiResponse.statusCode = "300";
|
||||||
|
_bjuiResponse.message = e.Message;
|
||||||
|
}
|
||||||
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string LoadForRole(int roleId, int moduleId)
|
||||||
|
{
|
||||||
|
return JsonHelper.Instance.Serialize(_app.LoadWithAccess("RoleElement", roleId, moduleId));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -124,16 +140,30 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
/// 为用户分配菜单
|
/// 为用户分配菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">用户ID</param>
|
/// <param name="userId">用户ID</param>
|
||||||
/// <param name="moduleId">模块ID</param>
|
|
||||||
/// <param name="menuIds">菜单ID列表</param>
|
/// <param name="menuIds">菜单ID列表</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public string AssignForUser(int userId,int moduleId, string menuIds)
|
public string AssignForUser(int userId, string menuIds)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ids = menuIds.Split(',').Select(id => int.Parse(id)).ToArray();
|
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
||||||
_app.AssignForUser(userId,moduleId, ids);
|
_app.AssignForUser(userId, ids);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_bjuiResponse.statusCode = "300";
|
||||||
|
_bjuiResponse.message = e.Message;
|
||||||
|
}
|
||||||
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public string CancelForUser(int userId, string menuIds)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ids = JsonHelper.Instance.Deserialize<int[]>(menuIds);
|
||||||
|
_app.CancelForUser(userId, ids);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -143,9 +173,9 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LoadForUser(int userId, int orgId)
|
public string LoadForUser(int userId, int moduleId)
|
||||||
{
|
{
|
||||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess("UserElement", userId, orgId));
|
return JsonHelper.Instance.Serialize(_app.LoadWithAccess("UserElement", userId, moduleId));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -150,10 +150,13 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="BllScripts\categoryManager.js" />
|
||||||
<Content Include="BllScripts\grid.js" />
|
<Content Include="BllScripts\grid.js" />
|
||||||
<Content Include="BllScripts\moduleElementMan.js" />
|
<Content Include="BllScripts\moduleElementMan.js" />
|
||||||
<Content Include="BllScripts\modulemanager.js" />
|
<Content Include="BllScripts\modulemanager.js" />
|
||||||
<Content Include="BllScripts\usermanager.js" />
|
<Content Include="BllScripts\usermanager.js" />
|
||||||
|
<Content Include="BllScripts\roleModuleElement.js" />
|
||||||
|
<Content Include="BllScripts\userModuleElement.js" />
|
||||||
<Content Include="BllScripts\userRoleManager.js" />
|
<Content Include="BllScripts\userRoleManager.js" />
|
||||||
<Content Include="Content\BJUI\images\captcha.jpeg" />
|
<Content Include="Content\BJUI\images\captcha.jpeg" />
|
||||||
<Content Include="Content\BJUI\images\datagrid\AU.gif" />
|
<Content Include="Content\BJUI\images\datagrid\AU.gif" />
|
||||||
@ -586,7 +589,6 @@
|
|||||||
<Content Include="Content\BJUI\themes\purple\zTreeStandard.png" />
|
<Content Include="Content\BJUI\themes\purple\zTreeStandard.png" />
|
||||||
<Content Include="favicon.ico" />
|
<Content Include="favicon.ico" />
|
||||||
<Content Include="Global.asax" />
|
<Content Include="Global.asax" />
|
||||||
<Content Include="Views\CategoryManager\Add.cshtml" />
|
|
||||||
<Content Include="Views\CategoryManager\Index.cshtml" />
|
<Content Include="Views\CategoryManager\Index.cshtml" />
|
||||||
<None Include="Views\Error\NoAccess.cshtml" />
|
<None Include="Views\Error\NoAccess.cshtml" />
|
||||||
<None Include="Views\Home\git.cshtml" />
|
<None Include="Views\Home\git.cshtml" />
|
||||||
@ -666,7 +668,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\ModuleManager\Index.cshtml" />
|
<Content Include="Views\ModuleManager\Index.cshtml" />
|
||||||
<Content Include="Views\ModuleManager\Add.cshtml" />
|
|
||||||
<Content Include="Views\ModuleManager\LookupMultiForUser.cshtml" />
|
<Content Include="Views\ModuleManager\LookupMultiForUser.cshtml" />
|
||||||
<Content Include="Views\ModuleManager\LookupMultiForRole.cshtml" />
|
<Content Include="Views\ModuleManager\LookupMultiForRole.cshtml" />
|
||||||
<None Include="Views\Home\MenuHeader.cshtml" />
|
<None Include="Views\Home\MenuHeader.cshtml" />
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
@model OpenAuth.Domain.Category
|
|
||||||
@{
|
|
||||||
ViewBag.Title = "Category编辑界面";
|
|
||||||
Layout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="bjui-pageContent">
|
|
||||||
<form action="/CategoryManager/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.ParentId)
|
|
||||||
</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="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> }>禁用</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>
|
|
||||||
@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);
|
|
||||||
|
|
||||||
$('#ParentId').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 x90">节点语义ID:</label>
|
|
||||||
<input type="text" name="CascadeId" id="CascadeId" value="@Model.CascadeId"
|
|
||||||
data-rule="required" size="20">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
|
|
||||||
@*<tr>
|
|
||||||
<td>
|
|
||||||
<label for="RootKey" class="control-label x90">根节点标识:</label>
|
|
||||||
<input type="text" name="RootKey" id="RootKey" value="@Model.RootKey"
|
|
||||||
data-rule="required" size="20">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="RootName" class="control-label x90">根节点名称:</label>
|
|
||||||
<input type="text" name="RootName" id="RootName" value="@Model.RootName"
|
|
||||||
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,154 +3,79 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
<div class="bjui-pageContent tableContent" style="position: relative">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
<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>
|
||||||
|
|
||||||
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--编辑对话框-->
|
||||||
|
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||||
|
<div class="bjui-pageContent">
|
||||||
|
<form action="/CategoryManager/Add" class="pageForm" data-toggle="validate" data-reload="false" id="editForm">
|
||||||
|
<input type="text" id="Id" name="Id" value="" class="hidden" />
|
||||||
|
<table class="table table-condensed table-hover">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label x120">名称:</label>
|
||||||
|
<input type="text" name="Name" id="Name" data-rule="required" size="20">
|
||||||
|
</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" size="20" data-tree="#j_select_tree1">
|
||||||
|
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<tr>
|
||||||
var selectedId = 0;
|
<td>
|
||||||
$(document).ready(function () {
|
<label for="Status" class="control-label x120">当前状态:</label>
|
||||||
initZtree();
|
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||||||
loadDataGrid();
|
<option value="0">默认</option>
|
||||||
});
|
<option value="1">禁用</option>
|
||||||
//加载数据到datagrid
|
</select>
|
||||||
function loadDataGrid() {
|
</td>
|
||||||
//b-jui的datagrid需要重新处理HTML
|
</tr>
|
||||||
$('#detail').empty()
|
<tr>
|
||||||
.append('<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>');
|
<td>
|
||||||
|
<label for="SortNo" class="control-label x120">排序号:</label>
|
||||||
|
<input type="text" name="SortNo" id="SortNo" data-rule="required" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="RootName" class="control-label x120">从属行业(应用):</label>
|
||||||
|
<input type="text" name="RootName" id="RootName" size="20">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="RootKey" class="control-label x120">从属行业(应用)标识:</label>
|
||||||
|
<input type="text" name="RootKey" id="RootKey" size="20">
|
||||||
|
</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({
|
<script src="~/BllScripts/grid.js"></script>
|
||||||
showToolbar: false,
|
<script src="~/BllScripts/categoryManager.js"></script>
|
||||||
filterThead: false,
|
|
||||||
target:$(this),
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'Id',
|
|
||||||
label: '资源表ID',
|
|
||||||
width: 100
|
|
||||||
, hide: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'CascadeId',
|
|
||||||
label: '节点语义ID',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Name',
|
|
||||||
label: '名称',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ParentId',
|
|
||||||
label: '父节点流水号',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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: 'RootKey',
|
|
||||||
label: '根节点',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'RootName',
|
|
||||||
label: '根节点名称',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
],
|
|
||||||
dataUrl: '/CategoryManager/Load?orgId=' + selectedId,
|
|
||||||
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('/CategoryManager/LoadForTree', function (json) {
|
|
||||||
var zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
|
|
||||||
zTreeObj.expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除
|
|
||||||
function delCategory() {
|
|
||||||
var selected = getSelected('#maingrid',2);
|
|
||||||
if (selected == null) return;
|
|
||||||
|
|
||||||
$.getJSON('/CategoryManager/Delete?Id=' + selected, function (data) {
|
|
||||||
if (data.statusCode == "200")
|
|
||||||
loadDataGrid();
|
|
||||||
else {
|
|
||||||
$(this).alertmsg('warn', data.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自定义的编辑按钮
|
|
||||||
function editCategory() {
|
|
||||||
var selected = getSelected('#maingrid',2);
|
|
||||||
if (selected == null) return;
|
|
||||||
|
|
||||||
$(this).dialog({
|
|
||||||
id: 'editDialog',
|
|
||||||
url: '/CategoryManager/Add?id=' + selected,
|
|
||||||
title: '编辑',
|
|
||||||
onClose:function() {
|
|
||||||
refreshModuleGrid();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshCategoryGrid() {
|
|
||||||
$('#maingrid').datagrid('refresh');
|
|
||||||
// loadDataGrid();
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,18 +1,15 @@
|
|||||||
@{
|
<div class="bjui-pageHeader">
|
||||||
string _prefix = "assignForRole";
|
|
||||||
var _treeId = _prefix + "Tree";
|
|
||||||
var _gridId = _prefix + "Grid";
|
|
||||||
var _treeDetail = _prefix + "Detail";
|
|
||||||
}
|
|
||||||
<div class="bjui-pageHeader">
|
|
||||||
<div class="bjui-searchBar">
|
<div class="bjui-searchBar">
|
||||||
<input style="display: none" id="roleId" value="@ViewBag.RoleId" />
|
<input style="display: none" id="roleId" value="@ViewBag.RoleId" />
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div class="alert alert-info search-inline">
|
<div class="alert alert-info search-inline">
|
||||||
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn-green" data-num="1" data-icon="plus" onclick="assign()">
|
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
||||||
授权选中项目
|
授权选中
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
||||||
|
取消授权
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -21,114 +18,13 @@
|
|||||||
<div class="bjui-pageContent tableContent">
|
<div class="bjui-pageContent tableContent">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
||||||
<ul id="@_treeId" class="ztree"></ul>
|
<ul id="tree" class="ztree"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="@_treeDetail" style="margin-left: 225px;">
|
<div style="margin-left: 225px;">
|
||||||
|
<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="~/BllScripts/grid.js"></script>
|
||||||
<script type="text/javascript">
|
<script src="~/BllScripts/roleModuleElement.js"></script>
|
||||||
var gridid = '#@_gridId';
|
|
||||||
var selectedId = 0;
|
|
||||||
$(document).ready(function () {
|
|
||||||
initZtree();
|
|
||||||
loadDataGrid();
|
|
||||||
});
|
|
||||||
//加载数据到datagrid
|
|
||||||
function loadDataGrid() {
|
|
||||||
//b-jui的datagrid需要重新处理HTML
|
|
||||||
$('#@_treeDetail').empty()
|
|
||||||
.append('<table id="@_gridId" class="table table-bordered table-hover table-striped table-top"></table>');
|
|
||||||
|
|
||||||
$(gridid).datagrid({
|
|
||||||
showToolbar: false,
|
|
||||||
filterThead: false,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'Id',
|
|
||||||
label: '元素名称',
|
|
||||||
hide: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Name',
|
|
||||||
label: '元素名称',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ModuleName',
|
|
||||||
label: '所属模块',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Accessed',
|
|
||||||
label: '是否已经授权',
|
|
||||||
type: 'select',
|
|
||||||
align: 'center',
|
|
||||||
items: [{ 'false': '未授权', 'true': '已授权' }],
|
|
||||||
width: 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
dataUrl: '/ModuleElementManager/LoadForRole?orgId=' + selectedId +'&roleId='+$('#roleId').val(),
|
|
||||||
fullGrid: true,
|
|
||||||
showLinenumber: true,
|
|
||||||
showCheckboxcol: true,
|
|
||||||
paging: true,
|
|
||||||
filterMult: false,
|
|
||||||
showTfoot: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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('/ModuleManager/LoadForRole',
|
|
||||||
{ roleId: $('#roleId').val() },
|
|
||||||
function (json) {
|
|
||||||
var zTreeObj = $.fn.zTree.init($('#@_treeId'), setting, json);
|
|
||||||
zTreeObj.expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//授权选中的
|
|
||||||
function assign() {
|
|
||||||
var selected = getSelectedMany(gridid, 2);
|
|
||||||
if (selected == null) return;
|
|
||||||
|
|
||||||
$.post("/ModuleElementManager/AssignForRole",
|
|
||||||
{
|
|
||||||
roleId: $('#roleId').val(),
|
|
||||||
moduleId: selectedId,
|
|
||||||
menuIds: selected
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
refreshGrid();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshGrid() {
|
|
||||||
$('#@_gridId').datagrid('refresh');
|
|
||||||
// loadDataGrid();
|
|
||||||
}
|
|
||||||
//@@ sourceURL=ModuleManagerIndex.js
|
|
||||||
</script>
|
|
@ -1,18 +1,15 @@
|
|||||||
@{
|
<div class="bjui-pageHeader">
|
||||||
string _prefix = "assignForUser";
|
|
||||||
var _treeId = _prefix + "Tree";
|
|
||||||
var _gridId = _prefix + "Grid";
|
|
||||||
var _treeDetail = _prefix + "Detail";
|
|
||||||
}
|
|
||||||
<div class="bjui-pageHeader">
|
|
||||||
<div class="bjui-searchBar">
|
<div class="bjui-searchBar">
|
||||||
<input style="display: none" id="userId" value="@ViewBag.UserId" />
|
<input style="display: none" id="userId" value="@ViewBag.UserId" />
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div class="alert alert-info search-inline">
|
<div class="alert alert-info search-inline">
|
||||||
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
<i class="fa fa-info-circle"></i> 点击行为单选,点击复选框可多选统一授权
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn-green" data-num="1" data-icon="plus" onclick="assign()">
|
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
||||||
授权选中项目
|
授权选中
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
||||||
|
取消授权
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -21,111 +18,13 @@
|
|||||||
<div class="bjui-pageContent tableContent">
|
<div class="bjui-pageContent tableContent">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
||||||
<ul id="@_treeId" class="ztree"></ul>
|
<ul id="tree" class="ztree"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="@_treeDetail" style="margin-left: 225px;">
|
<div style="margin-left: 225px;">
|
||||||
|
<table id="maingrid" class="table table-bordered table-hover table-striped table-top"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="~/BllScripts/grid.js"></script>
|
||||||
<script type="text/javascript">
|
<script src="~/BllScripts/userModuleElement.js"></script>
|
||||||
var selectedId = 0;
|
|
||||||
$(document).ready(function () {
|
|
||||||
initZtree();
|
|
||||||
loadDataGrid();
|
|
||||||
});
|
|
||||||
//加载数据到datagrid
|
|
||||||
function loadDataGrid() {
|
|
||||||
//b-jui的datagrid需要重新处理HTML
|
|
||||||
$('#@_treeDetail').empty()
|
|
||||||
.append('<table id="@_gridId" class="table table-bordered table-hover table-striped table-top"></table>');
|
|
||||||
|
|
||||||
$('#@_gridId').datagrid({
|
|
||||||
showToolbar: false,
|
|
||||||
filterThead: false,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'Id',
|
|
||||||
label: '元素名称',
|
|
||||||
hide: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Name',
|
|
||||||
label: '元素名称',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ModuleName',
|
|
||||||
label: '所属模块',
|
|
||||||
width: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Accessed',
|
|
||||||
label: '是否已经授权',
|
|
||||||
type: 'select',
|
|
||||||
align: 'center',
|
|
||||||
items: [{ 'false': '未授权', 'true': '已授权' }],
|
|
||||||
width: 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
dataUrl: '/ModuleElementManager/LoadForUser?orgId=' + selectedId + '&userId=' + $('#userId').val(),
|
|
||||||
fullGrid: true,
|
|
||||||
showLinenumber: true,
|
|
||||||
showCheckboxcol: true,
|
|
||||||
paging: true,
|
|
||||||
filterMult: false,
|
|
||||||
showTfoot: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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('/ModuleManager/LoadForUser?userId=' + $('#userId').val(), function (json) {
|
|
||||||
var zTreeObj = $.fn.zTree.init($('#@_treeId'), setting, json);
|
|
||||||
zTreeObj.expandAll(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//授权选中的
|
|
||||||
function assign() {
|
|
||||||
var selected = getSelectedMany('#@_gridId', 2);
|
|
||||||
if (selected == null) return;
|
|
||||||
|
|
||||||
$.post("/ModuleElementManager/AssignForUser",
|
|
||||||
{
|
|
||||||
userId: $('#userId').val(),
|
|
||||||
moduleId:selectedId,
|
|
||||||
menuIds: selected
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
refreshGrid();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshGrid() {
|
|
||||||
$('#@_gridId').datagrid('refresh');
|
|
||||||
// loadDataGrid();
|
|
||||||
}
|
|
||||||
//@@ sourceURL=ModuleManagerIndex.js
|
|
||||||
</script>
|
|
@ -17,7 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="bjui-pageContent" style="padding-top: 30px">
|
<div class="bjui-pageContent" style="padding-top: 30px">
|
||||||
<input id="selectedModuleId" value="@ViewBag.ModuleId" style="display: none" />
|
<input id="selectedModuleId" value="@ViewBag.ModuleId" style="display: none" />
|
||||||
<table id="maingrid" class="table table-bordered"></table>
|
<table id="moduleEleList" class="table table-bordered"></table>
|
||||||
</div>
|
</div>
|
||||||
<div class="bjui-pageFooter">
|
<div class="bjui-pageFooter">
|
||||||
<ul>
|
<ul>
|
||||||
@ -27,12 +27,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--编辑对话框-->
|
<!--编辑对话框-->
|
||||||
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
<div class="bjui-dialog hidden bjui-dialog-container" id="editEleDlg" data-noinit="true">
|
||||||
<div class="bjui-pageContent">
|
<div class="bjui-pageContent">
|
||||||
|
|
||||||
<form class="pageForm" data-toggle="validate" id="editElementForm"
|
<form class="pageForm" data-toggle="validate" id="editElementForm"
|
||||||
action="/ModuleElementManager/AddOrEditButton">
|
action="/ModuleElementManager/AddOrEditButton">
|
||||||
<input type="text" id="Id" value="" class="hidden" />
|
<input type="text" id="Id" name="Id" value="" class="hidden" />
|
||||||
<input id="ModuleId" name="ModuleId" class="hidden" />
|
<input id="ModuleId" name="ModuleId" class="hidden" />
|
||||||
<table class="table table-condensed table-hover">
|
<table class="table table-condensed table-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Remark" class="control-label x120">备注:</label>
|
<label for="Remark" class="control-label x120">备注:</label>
|
||||||
<input type="text" id="Remark" name="Remark" value="" data-rule="required" size="20"/>
|
<input type="text" id="Remark" name="Remark" value="" size="20"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
<div class="bjui-pageFooter">
|
<div class="bjui-pageFooter">
|
||||||
<ul>
|
<ul>
|
||||||
<li><button type="button" class="btn-close">关闭</button></li>
|
<li><button type="button" class="btn-close">关闭</button></li>
|
||||||
<li><button type="submit" class="btn-primary">保存</button></li>
|
<li><button type="button" class="btn-primary" id="btnEleChange">保存</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,157 +0,0 @@
|
|||||||
@model OpenAuth.Domain.Module
|
|
||||||
@{
|
|
||||||
ViewBag.Title = "Module编辑界面";
|
|
||||||
Layout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="bjui-pageContent">
|
|
||||||
<form action="/ModuleManager/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.CascadeId)
|
|
||||||
</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="Url" class="control-label x120">主页面URL:</label>
|
|
||||||
<input type="text" name="Url" id="Url" value="@Model.Url" size="20">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="ParentId" class="control-label x120">上级功能模块:</label>
|
|
||||||
<input id="ParentId" name="ParentId" value="@Model.ParentId" style="display: none" />
|
|
||||||
<input type="text" name="ParentName" id="ParentName" size="20"
|
|
||||||
value="@Model.ParentName"
|
|
||||||
@if (Model.Id == 0)
|
|
||||||
{
|
|
||||||
<text> data-toggle="selectztree" data-tree="#j_select_tree1"</text>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//TODO:修改的时候暂不能修改结构,因为以下:
|
|
||||||
//如果在前台处理,不能处理自身的ID
|
|
||||||
//如果在后台处理,因为算法会找最大的级联ID进行计算,如果每次都执行算法,肯定不行
|
|
||||||
//如果判断前端是否修改组织,再到后台处理,会增加前端的复杂程序
|
|
||||||
<text>readonly="readonly"</text>
|
|
||||||
} />
|
|
||||||
|
|
||||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="IconName" class="control-label x120">节点图标文件名称:</label>
|
|
||||||
<input type="text" name="IconName" id="IconName" value="@Model.IconName" 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="Vector" class="control-label x120">矢量图标:</label>
|
|
||||||
<input type="text" name="Vector" id="Vector" value="@Model.Vector" size="20">
|
|
||||||
</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>
|
|
||||||
</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('/ModuleManager/LoadModuleWithRoot', 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,10 +3,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@{ Html.RenderAction("MenuHeader", "Home");}
|
@{ Html.RenderAction("MenuHeader", "Home");}
|
||||||
<div class="bjui-pageContent tableContent" style="position:relative">
|
<div class="bjui-pageContent tableContent" style="position: relative">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
|
<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>
|
||||||
|
|
||||||
<div id="detail" style="margin-left: 225px;">
|
<div id="detail" style="margin-left: 225px;">
|
||||||
@ -14,4 +14,95 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="~/BllScripts/modulemanager.js"></script>
|
|
||||||
|
<!--编辑对话框-->
|
||||||
|
<div class="bjui-dialog hidden bjui-dialog-container" id="editDlg" data-noinit="true">
|
||||||
|
<div class="bjui-pageContent">
|
||||||
|
<form action="/ModuleManager/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" />
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label x120">功能模块名称:</label>
|
||||||
|
<input type="text" id="Name" name="Name" value="" data-rule="required"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Url" class="control-label x120">主页面URL:</label>
|
||||||
|
<input type="text" id="Url" name="Url" 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>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="HotKey" class="control-label x120">热键:</label>
|
||||||
|
<input type="text" id="HotKey" name="HotKey" 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="true">是</option>
|
||||||
|
<option value="false">否</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="true">是</option>
|
||||||
|
<option value="false">否</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="IconName" class="control-label x120">节点图标文件名称:</label>
|
||||||
|
<input type="text" id="IconName" name="IconName" value="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Status" class="control-label x120">当前状态:</label>
|
||||||
|
<input type="text" id="Status" name="Status" value="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Vector" class="control-label x120">矢量图标:</label>
|
||||||
|
<input type="text" id="Vector" name="Vector" value="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="SortNo" class="control-label x120">排序号:</label>
|
||||||
|
<input type="text" id="SortNo" name="SortNo" value="" />
|
||||||
|
</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/ModuleManager.js"></script>
|
@ -8,11 +8,11 @@
|
|||||||
<form action="/UserManager/Add" class="pageForm" data-toggle="validate">
|
<form action="/UserManager/Add" class="pageForm" data-toggle="validate">
|
||||||
<table class="table table-condensed table-hover">
|
<table class="table table-condensed table-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@Html.HiddenFor(m =>m.CreateTime)
|
@Html.HiddenFor(m => m.CreateTime)
|
||||||
@Html.HiddenFor(m =>m.Id)
|
@Html.HiddenFor(m => m.Id)
|
||||||
<label for="Account" class="control-label x90">用户账号:</label>
|
<label for="Account" class="control-label x90">用户账号:</label>
|
||||||
<input type="text" name="Account" id="Account" value="@Model.Account"
|
<input type="text" name="Account" id="Account" value="@Model.Account"
|
||||||
data-rule="required" size="20">
|
data-rule="required" size="20">
|
||||||
@ -28,10 +28,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<label for="Organizations" class="control-label x90">所属机构:</label>
|
<label for="Organizations" class="control-label x90">所属机构:</label>
|
||||||
<input id="OrganizationIds" name="OrganizationIds" value="@Model.OrganizationIds" style="display: none" />
|
<input id="OrganizationIds" name="OrganizationIds" value="@Model.OrganizationIds" style="display: none" />
|
||||||
<input type="text" name="Organizations" id="Organizations"
|
<input type="text" name="Organizations" id="Organizations"
|
||||||
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="@Model.Organizations">
|
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="@Model.Organizations">
|
||||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree" >
|
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||||
</ul>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -39,8 +38,8 @@
|
|||||||
<label for="Status" class="control-label x85">设置状态:</label>
|
<label for="Status" class="control-label x85">设置状态:</label>
|
||||||
|
|
||||||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
<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="0" @if (Model.Status == 0) { <text> selected="selected" </text> }>正常</option>
|
||||||
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>禁用</option>
|
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>禁用</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -49,8 +48,8 @@
|
|||||||
<label for="Sex" class="control-label x85">性别:</label>
|
<label for="Sex" class="control-label x85">性别:</label>
|
||||||
|
|
||||||
<select name="Sex" id="Sex" data-toggle="selectpicker" data-rule="required">
|
<select name="Sex" id="Sex" data-toggle="selectpicker" data-rule="required">
|
||||||
<option value="0" @if (Model.Status == 0) { <text> selected="selected" </text> }>男</option>
|
<option value="0" @if (Model.Status == 0) { <text> selected="selected" </text> }>男</option>
|
||||||
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>女</option>
|
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>女</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -66,10 +65,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
|
||||||
Init();
|
var ztree = function () {
|
||||||
});
|
var orgName = $("#Organizations");
|
||||||
function Init() {
|
var orgIds = $("#OrganizationIds");
|
||||||
|
var zTreeObj;
|
||||||
var setting = {
|
var setting = {
|
||||||
view: {
|
view: {
|
||||||
selectedMulti: false
|
selectedMulti: false
|
||||||
@ -96,33 +96,33 @@
|
|||||||
onCheck: zTreeCheck
|
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(",");
|
||||||
|
|
||||||
|
orgName.val(names);
|
||||||
|
orgIds.val(ids);
|
||||||
|
}
|
||||||
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
$.getJSON('/OrgManager/LoadOrg', function (json) {
|
||||||
var zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||||
|
var orgstr = orgIds.val();
|
||||||
|
if (orgstr != '') {
|
||||||
|
var nodeIds = orgstr.split(',');
|
||||||
|
$.each(nodeIds, function () {
|
||||||
|
var node = zTreeObj.getNodeByParam("Id", this, null);
|
||||||
|
zTreeObj.checkNode(node, true, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
zTreeObj.expandAll(true);
|
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);
|
|
||||||
|
|
||||||
$('#OrganizationIds').val(ids);
|
|
||||||
}
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
|
||||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user