mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-19 07:44:59 +08:00
调整数据库菜单表结构,可以动态加载按钮,注意更新数据库结构并重新初始化数据库
This commit is contained in:
parent
135723f563
commit
af5e04d62f
@ -6,12 +6,12 @@ using System.Linq;
|
|||||||
namespace OpenAuth.Domain
|
namespace OpenAuth.Domain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系统模块
|
/// 用户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Module
|
public partial class Module
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模块ID
|
/// 用户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
@ -29,10 +29,10 @@ namespace OpenAuth.Domain
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 组织类型
|
/// 元素的类型(如:button/a)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 功能模块Id
|
/// 功能模块Id
|
||||||
@ -40,6 +40,30 @@ namespace OpenAuth.Domain
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 元素附加属性
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Attr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 元素调用脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Script { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 元素图标
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 元素样式
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Class { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注
|
/// 备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -52,9 +76,13 @@ namespace OpenAuth.Domain
|
|||||||
this.Id= 0;
|
this.Id= 0;
|
||||||
this.DomId= string.Empty;
|
this.DomId= string.Empty;
|
||||||
this.Name= string.Empty;
|
this.Name= string.Empty;
|
||||||
this.Type= 0;
|
this.Type = string.Empty;
|
||||||
this.ModuleId= 0;
|
this.ModuleId= 0;
|
||||||
this.Remark= string.Empty;
|
this.Attr= string.Empty;
|
||||||
|
this.Script= string.Empty;
|
||||||
|
this.Icon= string.Empty;
|
||||||
|
this.Class= string.Empty;
|
||||||
|
this.Remark= string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenAuth.Domain
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户ID
|
|
||||||
/// </summary>
|
|
||||||
public partial class ModuleElementGrant
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户ID
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 元素流水号
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int ElementId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户流水号
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 角色流水号
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int RoleId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 权限类型
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int GrantType { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public ModuleElementGrant()
|
|
||||||
{
|
|
||||||
this.Id= 0;
|
|
||||||
this.ElementId= 0;
|
|
||||||
this.UserId= 0;
|
|
||||||
this.RoleId= 0;
|
|
||||||
this.GrantType= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -51,7 +51,6 @@
|
|||||||
<Compile Include="Interface\IUserRepository.cs" />
|
<Compile Include="Interface\IUserRepository.cs" />
|
||||||
<Compile Include="Module.cs" />
|
<Compile Include="Module.cs" />
|
||||||
<Compile Include="ModuleElement.cs" />
|
<Compile Include="ModuleElement.cs" />
|
||||||
<Compile Include="ModuleElementGrant.cs" />
|
|
||||||
<Compile Include="Org.cs" />
|
<Compile Include="Org.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Relevance.cs" />
|
<Compile Include="Relevance.cs" />
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenAuth.Domain
|
namespace OpenAuth.Domain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户ID
|
/// 用户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Relevance
|
public partial class Relevance
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户ID
|
/// 用户ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 第一个表主键ID
|
/// 第一个表主键ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int FirstId { get; set; }
|
public int FirstId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 第二个表主键ID
|
/// 第二个表主键ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int SecondId { get; set; }
|
public int SecondId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 描述
|
/// 描述
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态
|
/// 状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int Status { get; set; }
|
public int Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 授权时间
|
/// 授权时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public System.DateTime OperateTime { get; set; }
|
public System.DateTime OperateTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 授权人
|
/// 授权人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int OperatorId { get; set; }
|
public int OperatorId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public Relevance()
|
public Relevance()
|
||||||
{
|
{
|
||||||
this.Id= 0;
|
this.Id= 0;
|
||||||
this.FirstId= 0;
|
this.FirstId= 0;
|
||||||
this.SecondId= 0;
|
this.SecondId= 0;
|
||||||
this.Description= string.Empty;
|
this.Description= string.Empty;
|
||||||
this.Key= string.Empty;
|
this.Key= string.Empty;
|
||||||
this.Status= 0;
|
this.Status= 0;
|
||||||
this.OperateTime= DateTime.Now;
|
this.OperateTime= DateTime.Now;
|
||||||
this.OperatorId= 0;
|
this.OperatorId= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,69 +1,72 @@
|
|||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : OpenAuth.Mvc
|
// Assembly : OpenAuth.Mvc
|
||||||
// Author : Yubao Li
|
// Author : Yubao Li
|
||||||
// Created : 12-02-2015
|
// Created : 12-02-2015
|
||||||
//
|
//
|
||||||
// Last Modified By : Yubao Li
|
// Last Modified By : Yubao Li
|
||||||
// Last Modified On : 12-02-2015
|
// Last Modified On : 12-02-2015
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="ModuleElementManagerController.cs" company="">
|
// <copyright file="ModuleElementManagerController.cs" company="">
|
||||||
// Copyright (c) . All rights reserved.
|
// Copyright (c) . All rights reserved.
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary>模块元素管理,无需权限控制</summary>
|
// <summary>模块元素管理,无需权限控制</summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Web.Mvc;
|
using System.Data.Entity.Validation;
|
||||||
using Infrastructure;
|
using System.Web.Mvc;
|
||||||
using OpenAuth.App;
|
using Infrastructure;
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.App;
|
||||||
using OpenAuth.Mvc.Models;
|
using OpenAuth.Domain;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
namespace OpenAuth.Mvc.Controllers
|
|
||||||
{
|
namespace OpenAuth.Mvc.Controllers
|
||||||
public class ModuleElementManagerController : Controller
|
{
|
||||||
{
|
public class ModuleElementManagerController : Controller
|
||||||
private readonly BjuiResponse _bjuiResponse = new BjuiResponse();
|
{
|
||||||
private ModuleElementManagerApp _app;
|
private readonly BjuiResponse _bjuiResponse = new BjuiResponse();
|
||||||
|
private ModuleElementManagerApp _app;
|
||||||
public ModuleElementManagerController()
|
|
||||||
{
|
public ModuleElementManagerController()
|
||||||
_app = (ModuleElementManagerApp) DependencyResolver.Current.GetService(typeof (ModuleElementManagerApp));
|
{
|
||||||
}
|
_app = (ModuleElementManagerApp) DependencyResolver.Current.GetService(typeof (ModuleElementManagerApp));
|
||||||
|
}
|
||||||
public ActionResult Index(int id = 0)
|
|
||||||
{
|
public ActionResult Index(int id = 0)
|
||||||
ViewBag.ModuleId = id;
|
{
|
||||||
return View(_app.LoadByModuleId(id));
|
ViewBag.ModuleId = id;
|
||||||
}
|
return View(_app.LoadByModuleId(id));
|
||||||
|
}
|
||||||
[HttpPost]
|
|
||||||
public string AddOrEditButton(ModuleElement button)
|
[HttpPost]
|
||||||
{
|
public string AddOrEditButton(ModuleElement button)
|
||||||
try
|
{
|
||||||
{
|
try
|
||||||
_app.AddOrUpdate(button);
|
{
|
||||||
}
|
var newbtn = new ModuleElement();
|
||||||
catch (Exception e)
|
button.CopyTo(newbtn);
|
||||||
{
|
_app.AddOrUpdate(newbtn);
|
||||||
_bjuiResponse.statusCode = "300";
|
}
|
||||||
_bjuiResponse.message = e.Message;
|
catch (DbEntityValidationException e)
|
||||||
}
|
{
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
_bjuiResponse.statusCode = "300";
|
||||||
}
|
_bjuiResponse.message = e.Message;
|
||||||
|
}
|
||||||
public string DelButton(int id)
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
{
|
}
|
||||||
try
|
|
||||||
{
|
public string DelButton(int id)
|
||||||
_app.Delete(id);
|
{
|
||||||
}
|
try
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
_app.Delete(id);
|
||||||
_bjuiResponse.statusCode = "300";
|
}
|
||||||
_bjuiResponse.message = e.Message;
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
_bjuiResponse.statusCode = "300";
|
||||||
}
|
_bjuiResponse.message = e.Message;
|
||||||
}
|
}
|
||||||
|
return JsonHelper.Instance.Serialize(_bjuiResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,61 +1,69 @@
|
|||||||
@model IEnumerable<OpenAuth.Domain.ModuleElement>
|
@model IEnumerable<OpenAuth.Domain.ModuleElement>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
//删除回调
|
//删除回调
|
||||||
$('#tableButtons').on('afterdelete.bjui.tabledit', function(e) {
|
$('#tableButtons').on('afterdelete.bjui.tabledit', function(e) {
|
||||||
var $tbody = $(e.relatedTarget);
|
var $tbody = $(e.relatedTarget);
|
||||||
console.log('你删除了一条数据,还有['+ $tbody.find('> tr').length +']条数据!');
|
console.log('你删除了一条数据,还有['+ $tbody.find('> tr').length +']条数据!');
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<div class="bjui-pageHeader">
|
<div class="bjui-pageHeader">
|
||||||
<div class="bjui-searchBar">
|
<div class="bjui-searchBar">
|
||||||
<div class="alert alert-info search-inline"><i class="fa fa-info-circle"></i> 双击行可编辑</div>
|
<div class="alert alert-info search-inline"><i class="fa fa-info-circle"></i> 双击行可编辑</div>
|
||||||
<button type="button" class="btn-green" data-toggle="tableditadd" data-target="#tableButtons" data-num="1" data-icon="plus">
|
<button type="button" class="btn-green" data-toggle="tableditadd" data-target="#tableButtons" data-num="1" data-icon="plus">
|
||||||
添加新按钮
|
添加新按钮
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bjui-pageContent tableContent">
|
<div class="bjui-pageContent tableContent">
|
||||||
<form id="j_custom_form" class="pageForm" data-toggle="validate" method="post">
|
<form id="j_custom_form" class="pageForm" data-toggle="validate" method="post">
|
||||||
<table id="tableButtons" class="table table-bordered table-hover table-striped table-top"
|
<table id="tableButtons" class="table table-bordered table-hover table-striped table-top"
|
||||||
data-toggle="tabledit" data-initnum="0" data-action="/ModuleElementManager/AddOrEditButton" data-single-noindex="true">
|
data-toggle="tabledit" data-initnum="0" data-action="/ModuleElementManager/AddOrEditButton" data-single-noindex="true">
|
||||||
<thead>
|
<thead>
|
||||||
<tr data-idname="Id">
|
<tr data-idname="Id">
|
||||||
<th width="80" title="按钮标识"><input type="text" name="DomId" data-rule="required" value="" size="5"></th>
|
<th width="80" title="元素类型"><input type="text" name="Type" data-rule="required" value="button" size="5"></th>
|
||||||
<th width="80" title="按钮显示"><input type="text" name="Name" data-rule="required" value="" size="5"></th>
|
<th width="80" title="按钮标识"><input type="text" name="DomId" data-rule="required" value="" size="5"></th>
|
||||||
<th title="备注"><textarea name="Remark" data-toggle="autoheight"></textarea></th>
|
<th width="80" title="按钮显示"><input type="text" name="Name" data-rule="required" value="" size="5"></th>
|
||||||
<th width="80" title="所属模块ID"><input readonly="readonly" type="text" value="@ViewBag.ModuleId" name="ModuleId"/></th>
|
<th width="120" title="按钮样式"><input type="text" name="Class" data-rule="required" value="btn-green btn-nm" size="5"></th>
|
||||||
<th title="操作" width="100">
|
<th width="80" title="按钮图标"><input type="text" name="Icon" data-rule="required" value="pencil" size="5"></th>
|
||||||
<a href="javascript:;" class="btn btn-green" data-toggle="dosave">增加</a>
|
<th width="120" title="按钮脚本"><textarea name="Script" data-toggle="autoheight" value="javascript:;"></textarea></th>
|
||||||
<a href="javascript:;" class="btn btn-red row-del">取消</a>
|
<th width="120" title="附加属性"><textarea name="Attr" data-toggle="autoheight"></textarea></th>
|
||||||
</th>
|
<th width="80" title="所属模块ID"><input readonly="readonly" type="text" value="@ViewBag.ModuleId"
|
||||||
</tr>
|
name="ModuleId"/></th>
|
||||||
</thead>
|
<th title="操作" width="100">
|
||||||
<tbody>
|
<a href="javascript:;" class="btn btn-green" data-toggle="dosave">增加</a>
|
||||||
@foreach (var element in Model)
|
<a href="javascript:;" class="btn btn-red row-del">取消</a>
|
||||||
{
|
</th>
|
||||||
<tr data-id="@element.Id">
|
</tr>
|
||||||
|
</thead>
|
||||||
<td>@element.DomId</td>
|
<tbody>
|
||||||
<td>@element.Name</td>
|
@foreach (var element in Model)
|
||||||
<td>@element.Remark</td>
|
{
|
||||||
<td>@ViewBag.ModuleId</td>
|
<tr data-id="@element.Id">
|
||||||
<td data-noedit="true">
|
<td>@element.Type</td>
|
||||||
<input type="text" style="display: none" value="@element.Id" id="element_@element.Id" />
|
<td>@element.DomId</td>
|
||||||
<button type="button" class="btn-green" data-toggle="doedit">编辑</button>
|
<td>@element.Name</td>
|
||||||
<a href="/ModuleElementManager/DelButton?id={#element_@element.Id}" class="btn btn-red row-del"
|
<td>@element.Class</td>
|
||||||
data-confirm-msg="确定要删除该行信息吗?">删</a>
|
<td>@element.Icon</td>
|
||||||
</td>
|
<td>@element.Script</td>
|
||||||
</tr>
|
<td>@element.Attr</td>
|
||||||
}
|
<td>@ViewBag.ModuleId</td>
|
||||||
|
<td data-noedit="true">
|
||||||
</tbody>
|
<input type="text" style="display: none" value="@element.Id" id="element_@element.Id"/>
|
||||||
</table>
|
<button type="button" class="btn-green" data-toggle="doedit">编辑</button>
|
||||||
</form>
|
<a href="/ModuleElementManager/DelButton?id={#element_@element.Id}" class="btn btn-red row-del"
|
||||||
</div>
|
data-confirm-msg="确定要删除该行信息吗?">删</a>
|
||||||
<div class="bjui-pageFooter">
|
</td>
|
||||||
<ul>
|
</tr>
|
||||||
<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
|
}
|
||||||
</ul>
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="bjui-pageFooter">
|
||||||
|
<ul>
|
||||||
|
<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
@ -186,6 +186,9 @@
|
|||||||
|
|
||||||
$(this).dialog({
|
$(this).dialog({
|
||||||
id: 'editDialog',
|
id: 'editDialog',
|
||||||
|
width: 820,
|
||||||
|
height: 500,
|
||||||
|
mask:true,
|
||||||
url: '/ModuleElementManager/Index?id=' + selected,
|
url: '/ModuleElementManager/Index?id=' + selected,
|
||||||
title: '为模块分配按钮'
|
title: '为模块分配按钮'
|
||||||
});
|
});
|
||||||
|
@ -1,15 +1,37 @@
|
|||||||
@{
|
@using System.Text
|
||||||
|
@{
|
||||||
string _prefix = "user";
|
string _prefix = "user";
|
||||||
var _treeId = _prefix + "Tree";
|
var _treeId = _prefix + "Tree";
|
||||||
var _gridId = _prefix + "Grid";
|
var _gridId = _prefix + "Grid";
|
||||||
var _treeDetail = _prefix + "Detail";
|
var _treeDetail = _prefix + "Detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="bjui-pageContent">
|
<div class="bjui-pageContent">
|
||||||
<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="@_treeId" class="ztree"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="bjui-pageHeader" style="margin-left: 225px">
|
||||||
|
<div class="bjui-searchBar">
|
||||||
|
<div class="bjui-searchBar">
|
||||||
|
@{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
foreach (var element in ViewBag.Module.Elements)
|
||||||
|
{
|
||||||
|
sb.Append("<" + element.Type
|
||||||
|
+" data-icon='" + element.Icon+"' "
|
||||||
|
+" class='" + element.Class+"' "
|
||||||
|
+" onclick='" + element.Script+"' " + element.Attr
|
||||||
|
+ ">"+element.Name +"</" + element.Type +">");
|
||||||
|
}
|
||||||
|
@Html.Raw(sb.ToString())
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="@_treeDetail" style="margin-left: 225px;">
|
<div id="@_treeDetail" style="margin-left: 225px;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -29,25 +51,15 @@
|
|||||||
$('#@_treeDetail').empty()
|
$('#@_treeDetail').empty()
|
||||||
.append('<table id="@_gridId" class="table table-bordered"></table>');
|
.append('<table id="@_gridId" class="table table-bordered"></table>');
|
||||||
|
|
||||||
@{
|
|
||||||
string strBtns = string.Empty;
|
|
||||||
foreach (var element in ViewBag.Module.Elements)
|
|
||||||
{
|
|
||||||
strBtns +="<button type=\"button\" class =\"btn btn-green\">"+element.Name +"</button>";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grid = $(gridid).datagrid({
|
grid = $(gridid).datagrid({
|
||||||
gridTitle: '用户列表',
|
showToolbar: false,
|
||||||
showToolbar: true,
|
|
||||||
filterThead: false,
|
filterThead: false,
|
||||||
toolbarItem: 'refresh, |, del',
|
toolbarItem: 'refresh, |, del',
|
||||||
toolbarCustom: '<a href="/UserManager/Add" class="btn btn-green" data-icon ="plus" ' +
|
toolbarCustom: '<a href="/UserManager/Add" class="btn btn-green" data-icon ="plus" ' +
|
||||||
'data-toggle="dialog" data-id="dialog-mask" data-mask="true" data-on-close="refreshGrid">添加</a>' +
|
'data-toggle="dialog" data-id="dialog-mask" data-mask="true" data-on-close="refreshGrid">添加</a>' +
|
||||||
'<button class=" btn-green" onclick="editOrg()" data-icon="pencil" type="button">编辑</button>' +
|
'<button class=" btn-green" onclick="editOrg()" data-icon="pencil" type="button">编辑</button>' +
|
||||||
'<button type="button" class="btn btn-green" onclick="openModuleAccess(this)">为用户分配模块</button>' +
|
'<button type="button" class="btn btn-green" onclick="openModuleAccess(this)">为用户分配模块</button>' +
|
||||||
'<button type="button" class ="btn btn-green" onclick="openRoleAccess(this)">为用户分配角色</button>' + '@strBtns',
|
'<button type="button" class ="btn btn-green" onclick="openRoleAccess(this)">为用户分配角色</button>',
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'Id',
|
name: 'Id',
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Data.Entity.ModelConfiguration;
|
|
||||||
using OpenAuth.Domain;
|
|
||||||
|
|
||||||
namespace OpenAuth.Repository.Models.Mapping
|
|
||||||
{
|
|
||||||
public class ModuleElementGrantMap : EntityTypeConfiguration<ModuleElementGrant>
|
|
||||||
{
|
|
||||||
public ModuleElementGrantMap()
|
|
||||||
{
|
|
||||||
// Primary Key
|
|
||||||
this.HasKey(t => t.Id);
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
// Table & Column Mappings
|
|
||||||
this.ToTable("ModuleElementGrant");
|
|
||||||
this.Property(t => t.Id).HasColumnName("Id");
|
|
||||||
this.Property(t => t.ElementId).HasColumnName("ElementId");
|
|
||||||
this.Property(t => t.UserId).HasColumnName("UserId");
|
|
||||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
|
||||||
this.Property(t => t.GrantType).HasColumnName("GrantType");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,9 +20,25 @@ namespace OpenAuth.Repository.Models.Mapping
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(255);
|
.HasMaxLength(255);
|
||||||
|
|
||||||
|
this.Property(t => t.Attr)
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(500);
|
||||||
|
|
||||||
|
this.Property(t => t.Script)
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(500);
|
||||||
|
|
||||||
|
this.Property(t => t.Icon)
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(255);
|
||||||
|
|
||||||
|
this.Property(t => t.Class)
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(255);
|
||||||
|
|
||||||
this.Property(t => t.Remark)
|
this.Property(t => t.Remark)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(4000);
|
.HasMaxLength(200);
|
||||||
|
|
||||||
// Table & Column Mappings
|
// Table & Column Mappings
|
||||||
this.ToTable("ModuleElement");
|
this.ToTable("ModuleElement");
|
||||||
@ -31,6 +47,10 @@ namespace OpenAuth.Repository.Models.Mapping
|
|||||||
this.Property(t => t.Name).HasColumnName("Name");
|
this.Property(t => t.Name).HasColumnName("Name");
|
||||||
this.Property(t => t.Type).HasColumnName("Type");
|
this.Property(t => t.Type).HasColumnName("Type");
|
||||||
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
|
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
|
||||||
|
this.Property(t => t.Attr).HasColumnName("Attr");
|
||||||
|
this.Property(t => t.Script).HasColumnName("Script");
|
||||||
|
this.Property(t => t.Icon).HasColumnName("Icon");
|
||||||
|
this.Property(t => t.Class).HasColumnName("Class");
|
||||||
this.Property(t => t.Remark).HasColumnName("Remark");
|
this.Property(t => t.Remark).HasColumnName("Remark");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Data.Entity.ModelConfiguration;
|
using System.Data.Entity.ModelConfiguration;
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.Domain;
|
||||||
|
|
||||||
namespace OpenAuth.Repository.Models.Mapping
|
namespace OpenAuth.Repository.Models.Mapping
|
||||||
{
|
{
|
||||||
public class RelevanceMap : EntityTypeConfiguration<Relevance>
|
public class RelevanceMap : EntityTypeConfiguration<Relevance>
|
||||||
{
|
{
|
||||||
public RelevanceMap()
|
public RelevanceMap()
|
||||||
{
|
{
|
||||||
// Primary Key
|
// Primary Key
|
||||||
this.HasKey(t => t.Id);
|
this.HasKey(t => t.Id);
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
this.Property(t => t.Description)
|
this.Property(t => t.Description)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100);
|
.HasMaxLength(100);
|
||||||
|
|
||||||
this.Property(t => t.Key)
|
this.Property(t => t.Key)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100);
|
.HasMaxLength(100);
|
||||||
|
|
||||||
// Table & Column Mappings
|
// Table & Column Mappings
|
||||||
this.ToTable("Relevance");
|
this.ToTable("Relevance");
|
||||||
this.Property(t => t.Id).HasColumnName("Id");
|
this.Property(t => t.Id).HasColumnName("Id");
|
||||||
this.Property(t => t.FirstId).HasColumnName("FirstId");
|
this.Property(t => t.FirstId).HasColumnName("FirstId");
|
||||||
this.Property(t => t.SecondId).HasColumnName("SecondId");
|
this.Property(t => t.SecondId).HasColumnName("SecondId");
|
||||||
this.Property(t => t.Description).HasColumnName("Description");
|
this.Property(t => t.Description).HasColumnName("Description");
|
||||||
this.Property(t => t.Key).HasColumnName("Key");
|
this.Property(t => t.Key).HasColumnName("Key");
|
||||||
this.Property(t => t.Status).HasColumnName("Status");
|
this.Property(t => t.Status).HasColumnName("Status");
|
||||||
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
|
||||||
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ namespace OpenAuth.Repository.Models
|
|||||||
|
|
||||||
public DbSet<Module> Modules { get; set; }
|
public DbSet<Module> Modules { get; set; }
|
||||||
public DbSet<ModuleElement> ModuleElements { get; set; }
|
public DbSet<ModuleElement> ModuleElements { get; set; }
|
||||||
public DbSet<ModuleElementGrant> ModuleElementGrants { get; set; }
|
|
||||||
public DbSet<Org> Orgs { get; set; }
|
public DbSet<Org> Orgs { get; set; }
|
||||||
public DbSet<Relevance> Relevances { get; set; }
|
public DbSet<Relevance> Relevances { get; set; }
|
||||||
public DbSet<Role> Roles { get; set; }
|
public DbSet<Role> Roles { get; set; }
|
||||||
@ -31,7 +30,6 @@ namespace OpenAuth.Repository.Models
|
|||||||
{
|
{
|
||||||
modelBuilder.Configurations.Add(new ModuleMap());
|
modelBuilder.Configurations.Add(new ModuleMap());
|
||||||
modelBuilder.Configurations.Add(new ModuleElementMap());
|
modelBuilder.Configurations.Add(new ModuleElementMap());
|
||||||
modelBuilder.Configurations.Add(new ModuleElementGrantMap());
|
|
||||||
modelBuilder.Configurations.Add(new OrgMap());
|
modelBuilder.Configurations.Add(new OrgMap());
|
||||||
modelBuilder.Configurations.Add(new RelevanceMap());
|
modelBuilder.Configurations.Add(new RelevanceMap());
|
||||||
modelBuilder.Configurations.Add(new RoleMap());
|
modelBuilder.Configurations.Add(new RoleMap());
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BaseRepository.cs" />
|
<Compile Include="BaseRepository.cs" />
|
||||||
<Compile Include="Models\Mapping\ModuleElementGrantMap.cs" />
|
|
||||||
<Compile Include="Models\Mapping\ModuleElementMap.cs" />
|
<Compile Include="Models\Mapping\ModuleElementMap.cs" />
|
||||||
<Compile Include="Models\Mapping\ModuleMap.cs" />
|
<Compile Include="Models\Mapping\ModuleMap.cs" />
|
||||||
<Compile Include="Models\Mapping\OrgMap.cs" />
|
<Compile Include="Models\Mapping\OrgMap.cs" />
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user