mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 18:34:44 +08:00
角色板块
This commit is contained in:
@@ -114,10 +114,12 @@
|
|||||||
<Compile Include="Request\IdPageReq.cs" />
|
<Compile Include="Request\IdPageReq.cs" />
|
||||||
<Compile Include="Request\PageReq.cs" />
|
<Compile Include="Request\PageReq.cs" />
|
||||||
<Compile Include="Request\QueryCategoriesReq.cs" />
|
<Compile Include="Request\QueryCategoriesReq.cs" />
|
||||||
|
<Compile Include="Request\QueryRoleListReq.cs" />
|
||||||
<Compile Include="Request\QueryUserListReq.cs" />
|
<Compile Include="Request\QueryUserListReq.cs" />
|
||||||
<Compile Include="Response\TableData.cs" />
|
<Compile Include="Response\TableData.cs" />
|
||||||
<Compile Include="RevelanceManagerApp.cs" />
|
<Compile Include="RevelanceManagerApp.cs" />
|
||||||
<Compile Include="SystemAuthService.cs" />
|
<Compile Include="SystemAuthService.cs" />
|
||||||
|
<Compile Include="RoleApp.cs" />
|
||||||
<Compile Include="WFFormService.cs" />
|
<Compile Include="WFFormService.cs" />
|
||||||
<Compile Include="WFProcessInstanceService.cs" />
|
<Compile Include="WFProcessInstanceService.cs" />
|
||||||
<Compile Include="WFSchemeService.cs" />
|
<Compile Include="WFSchemeService.cs" />
|
||||||
@@ -137,7 +139,7 @@
|
|||||||
<Compile Include="Response\UserWithAccessedCtrls.cs" />
|
<Compile Include="Response\UserWithAccessedCtrls.cs" />
|
||||||
<Compile Include="Response\ModuleElementVM.cs" />
|
<Compile Include="Response\ModuleElementVM.cs" />
|
||||||
<Compile Include="Response\ModuleView.cs" />
|
<Compile Include="Response\ModuleView.cs" />
|
||||||
<Compile Include="Response\RoleVM.cs" />
|
<Compile Include="Response\RoleView.cs" />
|
||||||
<Compile Include="Response\UserView.cs" />
|
<Compile Include="Response\UserView.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
7
OpenAuth.App/Request/QueryRoleListReq.cs
Normal file
7
OpenAuth.App/Request/QueryRoleListReq.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace OpenAuth.App.Request
|
||||||
|
{
|
||||||
|
public class QueryRoleListReq : PageReq
|
||||||
|
{
|
||||||
|
public string orgId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ using OpenAuth.Repository.Domain;
|
|||||||
|
|
||||||
namespace OpenAuth.App.Response
|
namespace OpenAuth.App.Response
|
||||||
{
|
{
|
||||||
public partial class RoleVM
|
public partial class RoleView
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户ID
|
/// 用户ID
|
||||||
@@ -56,12 +56,12 @@ namespace OpenAuth.App.Response
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Checked { get; set; }
|
public bool Checked { get; set; }
|
||||||
|
|
||||||
public static implicit operator RoleVM(Role role)
|
public static implicit operator RoleView(Role role)
|
||||||
{
|
{
|
||||||
return role.MapTo<RoleVM>();
|
return role.MapTo<RoleView>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator Role(RoleVM rolevm)
|
public static implicit operator Role(RoleView rolevm)
|
||||||
{
|
{
|
||||||
return rolevm.MapTo<Role>();
|
return rolevm.MapTo<Role>();
|
||||||
}
|
}
|
||||||
101
OpenAuth.App/RoleApp.cs
Normal file
101
OpenAuth.App/RoleApp.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenAuth.App.Request;
|
||||||
|
using OpenAuth.App.Response;
|
||||||
|
using OpenAuth.App.SSO;
|
||||||
|
using OpenAuth.Repository.Domain;
|
||||||
|
|
||||||
|
|
||||||
|
namespace OpenAuth.App
|
||||||
|
{
|
||||||
|
public class RoleApp : BaseApp<Role>
|
||||||
|
{
|
||||||
|
public RevelanceManagerApp ReleManagerApp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载当前登录用户可访问的一个部门及子部门全部角色
|
||||||
|
/// </summary>
|
||||||
|
public TableData Load(QueryRoleListReq request)
|
||||||
|
{
|
||||||
|
var loginUser = AuthUtil.GetCurrentUser();
|
||||||
|
|
||||||
|
string cascadeId = ".0.";
|
||||||
|
if (!string.IsNullOrEmpty(request.orgId))
|
||||||
|
{
|
||||||
|
var org = loginUser.Orgs.SingleOrDefault(u => u.Id == request.orgId);
|
||||||
|
cascadeId = org.CascadeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ids = loginUser.Orgs.Where(u => u.CascadeId.Contains(cascadeId)).Select(u => u.Id).ToArray();
|
||||||
|
var roleIds = ReleManagerApp.Get(Define.ROLEORG, false, ids);
|
||||||
|
|
||||||
|
var roles = UnitWork.Find<Role>(u => roleIds.Contains(u.Id))
|
||||||
|
.OrderBy(u => u.Name)
|
||||||
|
.Skip((request.page - 1) * request.limit)
|
||||||
|
.Take(request.limit);
|
||||||
|
|
||||||
|
var records = Repository.GetCount(u => roleIds.Contains(u.Id));
|
||||||
|
|
||||||
|
|
||||||
|
var userviews = new List<RoleView>();
|
||||||
|
foreach (var role in roles)
|
||||||
|
{
|
||||||
|
RoleView uv = role;
|
||||||
|
var orgs = LoadByRole(role.Id);
|
||||||
|
uv.Organizations = string.Join(",", orgs.Select(u => u.Name).ToList());
|
||||||
|
uv.OrganizationIds = string.Join(",", orgs.Select(u => u.Id).ToList());
|
||||||
|
userviews.Add(uv);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TableData
|
||||||
|
{
|
||||||
|
count = records,
|
||||||
|
data = userviews,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddOrUpdate(RoleView view)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(view.OrganizationIds))
|
||||||
|
throw new Exception("请为用户分配机构");
|
||||||
|
Role role = view;
|
||||||
|
if (string.IsNullOrEmpty(view.Id))
|
||||||
|
{
|
||||||
|
if (UnitWork.IsExist<User>(u => u.Account == view.Name))
|
||||||
|
{
|
||||||
|
throw new Exception("用户账号已存在");
|
||||||
|
}
|
||||||
|
role.CreateTime = DateTime.Now;
|
||||||
|
Repository.Add(role);
|
||||||
|
view.Id = role.Id; //要把保存后的ID存入view
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UnitWork.Update<User>(u => u.Id == view.Id, u => new User
|
||||||
|
{
|
||||||
|
Name = role.Name,
|
||||||
|
Status = role.Status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
string[] orgIds = view.OrganizationIds.Split(',').ToArray();
|
||||||
|
|
||||||
|
ReleManagerApp.DeleteBy(Define.ROLEORG, role.Id);
|
||||||
|
ReleManagerApp.AddRelevance(Define.ROLEORG, orgIds.ToLookup(u => role.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载角色的所有机构
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<Org> LoadByRole(string roleId)
|
||||||
|
{
|
||||||
|
var result = from userorg in UnitWork.Find<Relevance>(null)
|
||||||
|
join org in UnitWork.Find<Org>(null) on userorg.SecondId equals org.Id
|
||||||
|
where userorg.FirstId == roleId && userorg.Key == Define.ROLEORG
|
||||||
|
select org;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
66
OpenAuth.Mvc/Controllers/RoleManagerController.cs
Normal file
66
OpenAuth.Mvc/Controllers/RoleManagerController.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Web.Http;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Infrastructure;
|
||||||
|
using OpenAuth.App;
|
||||||
|
using OpenAuth.App.Request;
|
||||||
|
using OpenAuth.App.Response;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
|
||||||
|
namespace OpenAuth.Mvc.Controllers
|
||||||
|
{
|
||||||
|
public class RoleManagerController : BaseController
|
||||||
|
{
|
||||||
|
public RoleApp App { get; set; }
|
||||||
|
|
||||||
|
//
|
||||||
|
// GET: /UserManager/
|
||||||
|
[Authenticate]
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加或修改组织
|
||||||
|
[System.Web.Mvc.HttpPost]
|
||||||
|
public string AddOrUpdate(RoleView view)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
App.AddOrUpdate(view);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Result.Code = 500;
|
||||||
|
Result.Message = ex.Message;
|
||||||
|
}
|
||||||
|
return JsonHelper.Instance.Serialize(Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载组织下面的所有用户
|
||||||
|
/// </summary>
|
||||||
|
public string Load([FromUri]QueryRoleListReq request)
|
||||||
|
{
|
||||||
|
return JsonHelper.Instance.Serialize(App.Load(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Web.Mvc.HttpPost]
|
||||||
|
public string Delete(string[] ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
App.Delete(ids);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Result.Code = 500;
|
||||||
|
Result.Message = e.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonHelper.Instance.Serialize(Result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -155,6 +155,7 @@
|
|||||||
<Compile Include="Controllers\ModuleManagerController.cs" />
|
<Compile Include="Controllers\ModuleManagerController.cs" />
|
||||||
<Compile Include="Controllers\OrgManagerController.cs" />
|
<Compile Include="Controllers\OrgManagerController.cs" />
|
||||||
<Compile Include="Controllers\RelevanceManagerController.cs" />
|
<Compile Include="Controllers\RelevanceManagerController.cs" />
|
||||||
|
<Compile Include="Controllers\RoleManagerController.cs" />
|
||||||
<Compile Include="Controllers\UserManagerController.cs" />
|
<Compile Include="Controllers\UserManagerController.cs" />
|
||||||
<Compile Include="Controllers\UserSessionController.cs" />
|
<Compile Include="Controllers\UserSessionController.cs" />
|
||||||
<Compile Include="Models\JobjectModelBinder.cs" />
|
<Compile Include="Models\JobjectModelBinder.cs" />
|
||||||
@@ -194,6 +195,7 @@
|
|||||||
<Content Include="js\modules.js" />
|
<Content Include="js\modules.js" />
|
||||||
<Content Include="js\queryString.js" />
|
<Content Include="js\queryString.js" />
|
||||||
<Content Include="js\orgs.js" />
|
<Content Include="js\orgs.js" />
|
||||||
|
<Content Include="js\roles.js" />
|
||||||
<Content Include="js\users.js" />
|
<Content Include="js\users.js" />
|
||||||
<Content Include="js\bodyTab.js" />
|
<Content Include="js\bodyTab.js" />
|
||||||
<Content Include="js\index.js" />
|
<Content Include="js\index.js" />
|
||||||
@@ -351,6 +353,7 @@
|
|||||||
<Content Include="Views\Home\MenuHeader.cshtml" />
|
<Content Include="Views\Home\MenuHeader.cshtml" />
|
||||||
<Content Include="Views\Categories\Index.cshtml" />
|
<Content Include="Views\Categories\Index.cshtml" />
|
||||||
<Content Include="Views\ModuleManager\Assign.cshtml" />
|
<Content Include="Views\ModuleManager\Assign.cshtml" />
|
||||||
|
<Content Include="Views\RoleManager\Index.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Areas\FlowManage\Models\" />
|
<Folder Include="Areas\FlowManage\Models\" />
|
||||||
|
|||||||
69
OpenAuth.Mvc/Views/RoleManager/Index.cshtml
Normal file
69
OpenAuth.Mvc/Views/RoleManager/Index.cshtml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
@section header
|
||||||
|
{
|
||||||
|
<link rel="stylesheet" href="/css/treetable.css" />
|
||||||
|
}
|
||||||
|
<blockquote class="layui-elem-quote news_search toolList">
|
||||||
|
@Html.Action("MenuHeader", "Home")
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<div style="display: flex;">
|
||||||
|
<ul id="tree" class="ztree" style="display: inline-block; width: 180px; padding: 10px; border: 1px solid #ddd; overflow: auto;"></ul>
|
||||||
|
<table class="layui-table"
|
||||||
|
lay-data="{height: 'full-80', page:true, id:'mainList'}"
|
||||||
|
lay-filter="list" lay-size="sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th lay-data="{checkbox:true, fixed: true}"></th>
|
||||||
|
<th lay-data="{field:'Name', width:150}">角色名称</th>
|
||||||
|
<th lay-data="{field:'Organizations', width:135}">所属部门</th>
|
||||||
|
<th lay-data="{field:'CreateTime', width:180}">创建时间</th>
|
||||||
|
<th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#barList'}"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<script type="text/html" id="barList">
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-mini" lay-event="detail">查看</a>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--角色添加/编辑窗口-->
|
||||||
|
<div id="divEdit" style="display: none">
|
||||||
|
<form class="layui-form" action="" id="formEdit">
|
||||||
|
|
||||||
|
<input type="hidden" name="Id" v-model="Id" />
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">角色名称</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="Name" v-model="Name" required lay-verify="required"
|
||||||
|
placeholder="请输入角色名称" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">所属部门</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input id="Organizations" name="Organizations" v-model="Organizations" required lay-verify="required" class="layui-input" />
|
||||||
|
<input id="OrganizationIds" name="OrganizationIds" v-model="OrganizationIds" required lay-verify="required" type="hidden" />
|
||||||
|
<div id="menuContent" class="menuContent" style="display: none;">
|
||||||
|
<ul id="org" class="ztree"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">是否可用</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="checkbox" name="Status" v-model="Status" lay-skin="switch" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
||||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||||
|
<script type="text/javascript" src="/js/roles.js"></script>
|
||||||
167
OpenAuth.Mvc/js/roles.js
Normal file
167
OpenAuth.Mvc/js/roles.js
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
layui.config({
|
||||||
|
base: "/js/"
|
||||||
|
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||||
|
var form = layui.form,
|
||||||
|
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||||
|
layer = layui.layer,
|
||||||
|
$ = layui.jquery;
|
||||||
|
var table = layui.table;
|
||||||
|
var openauth = layui.openauth;
|
||||||
|
layui.droptree("/UserSession/GetOrgs", "#Organizations", "#OrganizationIds");
|
||||||
|
|
||||||
|
//主列表加载,可反复调用进行刷新
|
||||||
|
var config= {}; //table的参数,如搜索key,点击tree的id
|
||||||
|
var mainList = function (options) {
|
||||||
|
if (options != undefined) {
|
||||||
|
$.extend(config, options);
|
||||||
|
}
|
||||||
|
table.reload('mainList', {
|
||||||
|
url: '/RoleManager/Load',
|
||||||
|
where: config
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//左边树状机构列表
|
||||||
|
var ztree = function () {
|
||||||
|
var url = '/UserSession/GetOrgs';
|
||||||
|
var zTreeObj;
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: function (event, treeId, treeNode) {
|
||||||
|
mainList({ orgId: treeNode.Id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var load = function () {
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||||
|
var newNode = { Name: "根节点", Id: null,ParentId:"" };
|
||||||
|
json.push(newNode);
|
||||||
|
zTreeObj.addNodes(null, json);
|
||||||
|
mainList({ orgId: "" });
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
load();
|
||||||
|
return {
|
||||||
|
reload: load
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
//添加(编辑)对话框
|
||||||
|
var editDlg = function() {
|
||||||
|
var vm = new Vue({
|
||||||
|
el: "#formEdit"
|
||||||
|
});
|
||||||
|
var update = false; //是否为更新
|
||||||
|
var show = function (data) {
|
||||||
|
var title = update ? "编辑信息" : "添加";
|
||||||
|
layer.open({
|
||||||
|
title: title,
|
||||||
|
area: ["500px", "400px"],
|
||||||
|
type: 1,
|
||||||
|
content: $('#divEdit'),
|
||||||
|
success: function() {
|
||||||
|
vm.$set('$data', data);
|
||||||
|
},
|
||||||
|
end: mainList
|
||||||
|
});
|
||||||
|
var url = "/RoleManager/AddOrUpdate";
|
||||||
|
if (update) {
|
||||||
|
url = "/RoleManager/AddOrUpdate"; //暂时和添加一个地址
|
||||||
|
}
|
||||||
|
//提交数据
|
||||||
|
form.on('submit(formSubmit)',
|
||||||
|
function(data) {
|
||||||
|
$.post(url,
|
||||||
|
data.field,
|
||||||
|
function(data) {
|
||||||
|
layer.msg(data.Message);
|
||||||
|
},
|
||||||
|
"json");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
add: function() { //弹出添加
|
||||||
|
update = false;
|
||||||
|
show({
|
||||||
|
Id: ''
|
||||||
|
});
|
||||||
|
},
|
||||||
|
update: function(data) { //弹出编辑框
|
||||||
|
update = true;
|
||||||
|
show(data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
//监听表格内部按钮
|
||||||
|
table.on('tool(list)', function (obj) {
|
||||||
|
var data = obj.data;
|
||||||
|
if (obj.event === 'detail') { //查看
|
||||||
|
layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//监听页面主按钮操作
|
||||||
|
var active = {
|
||||||
|
btnDel: function () { //批量删除
|
||||||
|
var checkStatus = table.checkStatus('mainList')
|
||||||
|
, data = checkStatus.data;
|
||||||
|
openauth.del("/RoleManager/Delete",
|
||||||
|
data.map(function (e) { return e.Id; }),
|
||||||
|
mainList);
|
||||||
|
}
|
||||||
|
, btnAdd: function () { //添加
|
||||||
|
editDlg.add();
|
||||||
|
}
|
||||||
|
, btnEdit: function () { //编辑
|
||||||
|
var checkStatus = table.checkStatus('mainList')
|
||||||
|
, data = checkStatus.data;
|
||||||
|
if (data.length != 1) {
|
||||||
|
layer.msg("请选择编辑的行,且同时只能编辑一行");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editDlg.update(data[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
, search: function () { //搜索
|
||||||
|
mainList({ key: $('#key').val() });
|
||||||
|
}
|
||||||
|
, btnRefresh: function() {
|
||||||
|
mainList();
|
||||||
|
}
|
||||||
|
, btnAccessModule: function () {
|
||||||
|
var index = layer.open({
|
||||||
|
title: "为用户分配模块",
|
||||||
|
type: 2,
|
||||||
|
area: ['800px', '500px'],
|
||||||
|
content: "/ModuleManager/Assign",
|
||||||
|
success: function(layero, index) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$('.toolList .layui-btn').on('click', function () {
|
||||||
|
var type = $(this).data('type');
|
||||||
|
active[type] ? active[type].call(this) : '';
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听页面主按钮操作 end
|
||||||
|
})
|
||||||
@@ -1,47 +1,47 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.Repository.Domain;
|
using OpenAuth.Repository.Domain;
|
||||||
|
|
||||||
namespace OpenAuth.UnitTest
|
namespace OpenAuth.UnitTest
|
||||||
{
|
{
|
||||||
[TestClass]
|
[TestClass]
|
||||||
public class TestOrg : TestBase
|
public class TestOrg : TestBase
|
||||||
{
|
{
|
||||||
private OrgManagerApp _app;
|
private OrgManagerApp _app;
|
||||||
|
|
||||||
public TestOrg()
|
public TestOrg()
|
||||||
{
|
{
|
||||||
_app = AutofacExt.GetFromFac<OrgManagerApp>();
|
_app = AutofacExt.GetFromFac<OrgManagerApp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Add()
|
public void Add()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
var random = new Random();
|
var random = new Random();
|
||||||
int val = random.Next();
|
int val = random.Next();
|
||||||
_app.Add(new Org
|
_app.Add(new Org
|
||||||
{
|
{
|
||||||
Id = string.Empty,
|
Id = string.Empty,
|
||||||
Name = "test" + val,
|
Name = "test" + val,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
ParentId = null,
|
ParentId = null,
|
||||||
ParentName = "",
|
ParentName = "",
|
||||||
SortNo = 1
|
SortNo = 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.Message);
|
Console.WriteLine(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user