mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
修改添加用户对话框
This commit is contained in:
parent
2f2aedc432
commit
d19eee3c36
@ -1,42 +1,42 @@
|
||||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain.Service;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载用户所有可访问的资源/机构/模块
|
||||
/// <para>李玉宝新增于2016-07-19 10:53:30</para>
|
||||
/// </summary>
|
||||
public class AuthorizeApp
|
||||
{
|
||||
private readonly AuthoriseFactory _factory;
|
||||
|
||||
public AuthorizeApp(AuthoriseFactory service)
|
||||
{
|
||||
_factory = service;
|
||||
}
|
||||
|
||||
public UserWithAccessedCtrls GetAccessedControls(string username)
|
||||
{
|
||||
var service = _factory.Create(username);
|
||||
var user = new UserWithAccessedCtrls
|
||||
{
|
||||
User = service.User,
|
||||
Orgs = service.Orgs,
|
||||
Modules = service.Modules.OrderBy(u => u.SortNo).ToList().MapToList<ModuleView>(),
|
||||
Resources = service.Resources,
|
||||
Roles = service.Roles
|
||||
};
|
||||
|
||||
foreach (var moduleView in user.Modules)
|
||||
{
|
||||
moduleView.Elements =
|
||||
service.ModuleElements.Where(u => u.ModuleId == moduleView.Id).OrderBy(u => u.Sort).ToList();
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain.Service;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
/// <summary>
|
||||
/// 加载用户所有可访问的资源/机构/模块
|
||||
/// <para>李玉宝新增于2016-07-19 10:53:30</para>
|
||||
/// </summary>
|
||||
public class AuthorizeApp
|
||||
{
|
||||
private readonly AuthoriseFactory _factory;
|
||||
|
||||
public AuthorizeApp(AuthoriseFactory service)
|
||||
{
|
||||
_factory = service;
|
||||
}
|
||||
|
||||
public UserWithAccessedCtrls GetAccessedControls(string username)
|
||||
{
|
||||
var service = _factory.Create(username);
|
||||
var user = new UserWithAccessedCtrls
|
||||
{
|
||||
User = service.User,
|
||||
Orgs = service.Orgs,
|
||||
Modules = service.Modules.OrderBy(u => u.SortNo).ToList().MapToList<ModuleView>(),
|
||||
Resources = service.Resources,
|
||||
Roles = service.Roles
|
||||
};
|
||||
|
||||
foreach (var moduleView in user.Modules)
|
||||
{
|
||||
moduleView.Elements =
|
||||
service.ModuleElements.Where(u => u.ModuleId == moduleView.Id).OrderBy(u => u.Sort).ToList();
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +1,47 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.App
|
||||
// Author : Yubao Li
|
||||
// Created : 12-01-2015
|
||||
//
|
||||
// Last Modified By : Yubao Li
|
||||
// Last Modified On : 12-01-2015
|
||||
// ***********************************************************************
|
||||
// <copyright file="LoginUserVM.cs" company="">
|
||||
// Copyright (c) . All rights reserved.
|
||||
// </copyright>
|
||||
// <summary>用户及权限视图模型</summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
|
||||
namespace OpenAuth.App.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 视图模型
|
||||
/// <para>包括用户及用户可访问的机构/资源/模块</para>
|
||||
/// <para>李玉宝修改于2016-07-19 10:57:31</para>
|
||||
/// </summary>
|
||||
public class UserWithAccessedCtrls
|
||||
{
|
||||
public User User { get; set; }
|
||||
/// <summary>
|
||||
/// 用户可以访问到的模块(包括所属角色与自己的所有模块)
|
||||
/// </summary>
|
||||
public List<ModuleView> Modules { get; set; }
|
||||
|
||||
//用户可以访问的资源
|
||||
public List<Resource> Resources { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户所属机构
|
||||
/// </summary>
|
||||
public List<Org> Orgs { get; set; }
|
||||
|
||||
|
||||
public List<Role> Roles { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.App
|
||||
// Author : Yubao Li
|
||||
// Created : 12-01-2015
|
||||
//
|
||||
// Last Modified By : Yubao Li
|
||||
// Last Modified On : 12-01-2015
|
||||
// ***********************************************************************
|
||||
// <copyright file="LoginUserVM.cs" company="">
|
||||
// Copyright (c) . All rights reserved.
|
||||
// </copyright>
|
||||
// <summary>用户及权限视图模型</summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
|
||||
namespace OpenAuth.App.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 视图模型
|
||||
/// <para>包括用户及用户可访问的机构/资源/模块</para>
|
||||
/// <para>李玉宝修改于2016-07-19 10:57:31</para>
|
||||
/// </summary>
|
||||
public class UserWithAccessedCtrls
|
||||
{
|
||||
public User User { get; set; }
|
||||
/// <summary>
|
||||
/// 用户可以访问到的模块(包括所属角色与自己的所有模块)
|
||||
/// </summary>
|
||||
public List<ModuleView> Modules { get; set; }
|
||||
|
||||
//用户可以访问的资源
|
||||
public List<Resource> Resources { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户所属机构
|
||||
/// </summary>
|
||||
public List<Org> Orgs { get; set; }
|
||||
|
||||
|
||||
public List<Role> Roles { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,124 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
/// <summary>
|
||||
/// 流程设计服务
|
||||
/// <para>李玉宝新增于2017-01-16 16:18:35</para>
|
||||
/// </summary>
|
||||
public class WFSchemeService
|
||||
{
|
||||
protected IUnitWork _unitWork;
|
||||
|
||||
public WFSchemeService(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存流程
|
||||
/// </summary>
|
||||
/// <param name="entity">表单模板实体类</param>
|
||||
/// <param name="keyValue">主键</param>
|
||||
/// <returns></returns>
|
||||
public int SaveForm(string keyValue, WFSchemeInfo entity, WFSchemeContent modelentity)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyValue))
|
||||
{
|
||||
entity.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
_unitWork.Add(entity);
|
||||
|
||||
modelentity.SchemeInfoId = entity.Id;
|
||||
modelentity.SchemeVersion = entity.SchemeVersion;
|
||||
_unitWork.Add(modelentity);
|
||||
}
|
||||
else
|
||||
{
|
||||
Guid schemeid = Guid.Parse(keyValue);
|
||||
WFSchemeContent modelentityold =
|
||||
_unitWork.FindSingle<WFSchemeContent>(u => u.SchemeVersion == entity.SchemeVersion
|
||||
&& u.SchemeInfoId == schemeid);
|
||||
|
||||
if (modelentityold.SchemeContent != modelentity.SchemeContent)
|
||||
{
|
||||
if (modelentity.SchemeVersion == "cg")
|
||||
{
|
||||
modelentityold.SchemeContent = modelentity.SchemeContent;
|
||||
modelentityold.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
modelentity.SchemeVersion = modelentityold.SchemeVersion;
|
||||
_unitWork.Update(modelentityold);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelentity.SchemeInfoId = schemeid;
|
||||
modelentity.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
_unitWork.Add(modelentity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
modelentity.SchemeVersion = modelentityold.SchemeVersion;
|
||||
}
|
||||
entity.Id = Guid.Parse(keyValue);
|
||||
entity.SchemeVersion = modelentity.SchemeVersion;
|
||||
_unitWork.Update(entity);
|
||||
}
|
||||
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveForm(Guid[] keyValue)
|
||||
{
|
||||
_unitWork.Delete<WFSchemeInfo>(u =>keyValue.Contains(u.Id));
|
||||
_unitWork.Delete<WFSchemeContent>(u =>keyValue.Contains(u.SchemeInfoId));
|
||||
}
|
||||
|
||||
public WFSchemeInfo GetEntity(Guid keyValue)
|
||||
{
|
||||
return _unitWork.FindSingle<WFSchemeInfo>(u => u.Id == keyValue);
|
||||
}
|
||||
|
||||
public WFSchemeContent GetSchemeEntity(Guid schemeinfoId, string schemeinfoSchemeVersion)
|
||||
{
|
||||
return _unitWork.FindSingle<WFSchemeContent>(u =>
|
||||
u.SchemeInfoId == schemeinfoId && u.SchemeVersion == schemeinfoSchemeVersion);
|
||||
}
|
||||
|
||||
public void UpdateState(string keyValue, int state)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<WFSchemeInfo> GetList()
|
||||
{
|
||||
return _unitWork.Find<WFSchemeInfo>(null).ToList();
|
||||
}
|
||||
|
||||
public GridData Load(int pageCurrent, int pageSize)
|
||||
{
|
||||
var result = new GridData
|
||||
{
|
||||
page = pageCurrent
|
||||
};
|
||||
|
||||
int cnt = _unitWork.Find<WFSchemeInfo>(null).Count();
|
||||
result.total = cnt%pageSize ==0?cnt/pageSize:cnt/pageSize+1;
|
||||
result.data = _unitWork.Find<WFSchemeInfo>(pageCurrent, pageSize, "ModifyDate descending", null).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
/// <summary>
|
||||
/// 流程设计服务
|
||||
/// <para>李玉宝新增于2017-01-16 16:18:35</para>
|
||||
/// </summary>
|
||||
public class WFSchemeService
|
||||
{
|
||||
protected IUnitWork _unitWork;
|
||||
|
||||
public WFSchemeService(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存流程
|
||||
/// </summary>
|
||||
/// <param name="entity">表单模板实体类</param>
|
||||
/// <param name="keyValue">主键</param>
|
||||
/// <returns></returns>
|
||||
public int SaveForm(string keyValue, WFSchemeInfo entity, WFSchemeContent modelentity)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyValue))
|
||||
{
|
||||
entity.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
_unitWork.Add(entity);
|
||||
|
||||
modelentity.SchemeInfoId = entity.Id;
|
||||
modelentity.SchemeVersion = entity.SchemeVersion;
|
||||
_unitWork.Add(modelentity);
|
||||
}
|
||||
else
|
||||
{
|
||||
Guid schemeid = Guid.Parse(keyValue);
|
||||
WFSchemeContent modelentityold =
|
||||
_unitWork.FindSingle<WFSchemeContent>(u => u.SchemeVersion == entity.SchemeVersion
|
||||
&& u.SchemeInfoId == schemeid);
|
||||
|
||||
if (modelentityold.SchemeContent != modelentity.SchemeContent)
|
||||
{
|
||||
if (modelentity.SchemeVersion == "cg")
|
||||
{
|
||||
modelentityold.SchemeContent = modelentity.SchemeContent;
|
||||
modelentityold.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
modelentity.SchemeVersion = modelentityold.SchemeVersion;
|
||||
_unitWork.Update(modelentityold);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelentity.SchemeInfoId = schemeid;
|
||||
modelentity.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
_unitWork.Add(modelentity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
modelentity.SchemeVersion = modelentityold.SchemeVersion;
|
||||
}
|
||||
entity.Id = Guid.Parse(keyValue);
|
||||
entity.SchemeVersion = modelentity.SchemeVersion;
|
||||
_unitWork.Update(entity);
|
||||
}
|
||||
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveForm(Guid[] keyValue)
|
||||
{
|
||||
_unitWork.Delete<WFSchemeInfo>(u =>keyValue.Contains(u.Id));
|
||||
_unitWork.Delete<WFSchemeContent>(u =>keyValue.Contains(u.SchemeInfoId));
|
||||
}
|
||||
|
||||
public WFSchemeInfo GetEntity(Guid keyValue)
|
||||
{
|
||||
return _unitWork.FindSingle<WFSchemeInfo>(u => u.Id == keyValue);
|
||||
}
|
||||
|
||||
public WFSchemeContent GetSchemeEntity(Guid schemeinfoId, string schemeinfoSchemeVersion)
|
||||
{
|
||||
return _unitWork.FindSingle<WFSchemeContent>(u =>
|
||||
u.SchemeInfoId == schemeinfoId && u.SchemeVersion == schemeinfoSchemeVersion);
|
||||
}
|
||||
|
||||
public void UpdateState(string keyValue, int state)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<WFSchemeInfo> GetList()
|
||||
{
|
||||
return _unitWork.Find<WFSchemeInfo>(null).ToList();
|
||||
}
|
||||
|
||||
public GridData Load(int pageCurrent, int pageSize)
|
||||
{
|
||||
var result = new GridData
|
||||
{
|
||||
page = pageCurrent
|
||||
};
|
||||
|
||||
int cnt = _unitWork.Find<WFSchemeInfo>(null).Count();
|
||||
result.total = cnt%pageSize ==0?cnt/pageSize:cnt/pageSize+1;
|
||||
result.data = _unitWork.Find<WFSchemeInfo>(pageCurrent, pageSize, "ModifyDate descending", null).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
$(function () {
|
||||
//modal滚动条置顶
|
||||
$('.modal').on('shown.bs.modal', function () { //modal加载完毕后处理数据
|
||||
var scroll = $(".modal-body").scrollTop();
|
||||
$(".modal-body").scrollTop(0 - scroll);
|
||||
});
|
||||
|
||||
//resize to fit page size
|
||||
$(window).on('resize.jqGrid', function () {
|
||||
$("#maingrid").jqGrid('setGridWidth', $(".gridwidth").width()-10);
|
||||
$("#maingrid").removeAttr("style"); //我擦,不去掉style="width:xxx",jqgrid就会有横向滚动条
|
||||
});
|
||||
|
||||
//resize on sidebar collapse/expand
|
||||
// var parentColumn = $("#maingrid").closest('[class*="col-"]');
|
||||
$(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) {
|
||||
if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
|
||||
//setTimeout is for webkit only to give time for DOM changes and then redraw!!!
|
||||
setTimeout(function () {
|
||||
// $("#maingrid").jqGrid('setGridWidth', parentColumn.width());
|
||||
$("#maingrid").jqGrid('setGridWidth', $(".gridwidth").width()-10);
|
||||
$("#maingrid").removeAttr("style"); //我擦,不去掉style="width:xxx",jqgrid就会有横向滚动条
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
$(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size
|
||||
|
||||
$(document).one('ajaxloadstart.page', function (e) {
|
||||
$("#maingrid").jqGrid('GridUnload');
|
||||
$('.ui-jqdialog').remove();
|
||||
});
|
||||
});
|
||||
|
||||
//replace icons with FontAwesome icons like above
|
||||
function updatePagerIcons(table) {
|
||||
var replacement =
|
||||
{
|
||||
'ui-icon-seek-first': 'ace-icon fa fa-angle-double-left bigger-140',
|
||||
'ui-icon-seek-prev': 'ace-icon fa fa-angle-left bigger-140',
|
||||
'ui-icon-seek-next': 'ace-icon fa fa-angle-right bigger-140',
|
||||
'ui-icon-seek-end': 'ace-icon fa fa-angle-double-right bigger-140'
|
||||
};
|
||||
$('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () {
|
||||
var icon = $(this);
|
||||
var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
|
||||
|
||||
if ($class in replacement) icon.attr('class', 'ui-icon ' + replacement[$class]);
|
||||
});
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
|
||||
//左边导航
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
@ -118,7 +118,7 @@ var vm = new Vue({
|
||||
});
|
||||
|
||||
//上级机构选择框
|
||||
var parent = new ParentTree("/OrgManager/LoadOrg","ParentName", "ParentId");
|
||||
var parent = new ParentTree("/UserSession/GetOrgs","ParentName", "ParentId");
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
//左边导航
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
@ -106,7 +106,7 @@ var vm = new Vue({
|
||||
});
|
||||
|
||||
//上级机构选择框
|
||||
var parent = new ParentTreeMultiple("/OrgManager/LoadOrg", "Organizations", "OrganizationIds");
|
||||
var parent = new ParentTreeMultiple("/UserSession/GetOrgs", "Organizations", "OrganizationIds");
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
//左边导航
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
@ -117,7 +117,7 @@ var vm = new Vue({
|
||||
});
|
||||
|
||||
//上级机构选择框
|
||||
var parent = new ParentTree("/OrgManager/LoadOrg", "ParentName", "OrgId");
|
||||
var parent = new ParentTree("/UserSession/GetOrgs", "ParentName", "OrgId");
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
|
@ -70,7 +70,7 @@ var list = function () {
|
||||
}();
|
||||
//左边导航
|
||||
var ztree = function () {
|
||||
var url = "/OrgManager/LoadOrg";
|
||||
var url = "/UserSession/GetOrgs";
|
||||
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
//左边导航
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
@ -117,7 +117,7 @@ var vm = new Vue({
|
||||
});
|
||||
|
||||
//上级机构选择框
|
||||
var parent = new ParentTreeMultiple("/OrgManager/LoadOrg","Organizations","OrganizationIds");
|
||||
var parent = new ParentTreeMultiple("/UserSession/GetOrgs","Organizations","OrganizationIds");
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function () {
|
||||
|
@ -4,7 +4,6 @@ using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc.Models;
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using OpenAuth.App.SSO;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
@ -26,11 +25,6 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public string LoadOrg()
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(AuthUtil.GetCurrentUser().Orgs);
|
||||
}
|
||||
|
||||
public string LoadForUser(Guid firstId)
|
||||
{
|
||||
var orgs = OrgApp.LoadForUser(firstId);
|
||||
|
@ -21,10 +21,10 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 获取登陆用户可访问的所有部门
|
||||
/// </summary>
|
||||
public string GetOrgsTree()
|
||||
public string GetOrgs()
|
||||
{
|
||||
var user = AuthUtil.GetCurrentUser();
|
||||
return JsonHelper.Instance.Serialize(user.Orgs.GenerateTree(u => u.Id, u => u.ParentId));
|
||||
return JsonHelper.Instance.Serialize(user.Orgs);
|
||||
}
|
||||
}
|
||||
}
|
@ -174,7 +174,6 @@
|
||||
<Content Include="BllScripts\assignModuleElement.js" />
|
||||
<Content Include="BllScripts\categoryManager.js" />
|
||||
<Content Include="BllScripts\formDesign.js" />
|
||||
<Content Include="BllScripts\jqEvent.js" />
|
||||
<Content Include="BllScripts\login.js" />
|
||||
<Content Include="BllScripts\parentTreeMultiple.js" />
|
||||
<Content Include="BllScripts\parentTree.js" />
|
||||
|
@ -10,38 +10,70 @@
|
||||
</div>
|
||||
<button class="layui-btn" data-type="search">搜索</button>
|
||||
</div>
|
||||
|
||||
<button class="layui-btn " data-type="addData">添加用户</button>
|
||||
<button class="layui-btn layui-btn-danger" data-type="del">批量删除</button>
|
||||
</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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th lay-data="{checkbox:true, fixed: true}"></th>
|
||||
<th lay-data="{field:'Account', width:150, sort: 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="{field:'Id', width:180}">ID</th>
|
||||
<th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#barList'}"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th lay-data="{checkbox:true, fixed: true}"></th>
|
||||
<th lay-data="{field:'Account', width:150, sort: 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="{field:'Id', width:180}">ID</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>
|
||||
<a class="layui-btn layui-btn-mini" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del">删除</a>
|
||||
</script>
|
||||
|
||||
<!--用户添加/编辑窗口-->
|
||||
<form class="layui-form" action="" style="display: none" id="formEdit">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="Account" 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 type="text" name="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 type="radio" name="Sex" value="1" title="男" checked>
|
||||
<input type="radio" name="Sex" value="0" title="女" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否可用</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="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="formEdit">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/users.js"></script>
|
@ -1,96 +1,96 @@
|
||||
/*-------------------------------------
|
||||
zTree Style
|
||||
|
||||
version: 3.4
|
||||
author: Hunter.z
|
||||
email: hunter.z@263.net
|
||||
website: http://code.google.com/p/jquerytree/
|
||||
|
||||
-------------------------------------*/
|
||||
|
||||
.ztree * {padding:0; margin:0; /*font-size:12px;*/ font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
|
||||
.ztree {margin:0; padding:5px; color:#333}
|
||||
.ztree li{padding:0; margin:0; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:0}
|
||||
.ztree li ul{ margin:0; padding:0 0 0 18px}
|
||||
.ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;}
|
||||
|
||||
.ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; vertical-align:top; display: inline-block}
|
||||
.ztree li a:hover {text-decoration:underline}
|
||||
.ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;}
|
||||
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;}
|
||||
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid;
|
||||
opacity:0.8; filter:alpha(opacity=80)}
|
||||
.ztree li a.tmpTargetNode_prev {}
|
||||
.ztree li a.tmpTargetNode_next {}
|
||||
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
|
||||
font-size:12px; border:1px #585956 solid; *border:0px}
|
||||
.ztree li span {line-height:21px; margin-right:2px}
|
||||
.ztree li span.button {line-height:0; margin:0; padding: 0; width:21px; height:21px; display: inline-block; vertical-align:middle;
|
||||
border:0 none; cursor: pointer;outline:none;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
|
||||
|
||||
.ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto}
|
||||
.ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;}
|
||||
.ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;}
|
||||
.ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;}
|
||||
.ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;}
|
||||
.ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;}
|
||||
.ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;}
|
||||
.ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;}
|
||||
.ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;}
|
||||
.ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;}
|
||||
.ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;}
|
||||
.ztree li span.button.chk.radio_false_full {background-position: -47px -5px;}
|
||||
.ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;}
|
||||
.ztree li span.button.chk.radio_false_part {background-position: -47px -47px;}
|
||||
.ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;}
|
||||
.ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;}
|
||||
.ztree li span.button.chk.radio_true_full {background-position: -68px -5px;}
|
||||
.ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;}
|
||||
.ztree li span.button.chk.radio_true_part {background-position: -68px -47px;}
|
||||
.ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;}
|
||||
.ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;}
|
||||
|
||||
.ztree li span.button.switch {width:21px; height:21px}
|
||||
.ztree li span.button.root_open{background-position:-105px -63px}
|
||||
.ztree li span.button.root_close{background-position:-126px -63px}
|
||||
.ztree li span.button.roots_open{background-position: -105px 0;}
|
||||
.ztree li span.button.roots_close{background-position: -126px 0;}
|
||||
.ztree li span.button.center_open{background-position: -105px -21px;}
|
||||
.ztree li span.button.center_close{background-position: -126px -21px;}
|
||||
.ztree li span.button.bottom_open{background-position: -105px -42px;}
|
||||
.ztree li span.button.bottom_close{background-position: -126px -42px;}
|
||||
.ztree li span.button.noline_open{background-position: -105px -84px;}
|
||||
.ztree li span.button.noline_close{background-position: -126px -84px;}
|
||||
.ztree li span.button.root_docu{ background:none;}
|
||||
.ztree li span.button.roots_docu{background-position: -84px 0;}
|
||||
.ztree li span.button.center_docu{background-position: -84px -21px;}
|
||||
.ztree li span.button.bottom_docu{background-position: -84px -42px;}
|
||||
.ztree li span.button.noline_docu{ background:none;}
|
||||
|
||||
.ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.edit:hover {
|
||||
background-position: -168px -21px;
|
||||
}
|
||||
.ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.remove:hover {
|
||||
background-position: -168px -42px;
|
||||
}
|
||||
.ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.add:hover {
|
||||
background-position: -168px 0;
|
||||
}
|
||||
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
|
||||
|
||||
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
|
||||
|
||||
span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
|
||||
|
||||
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
|
||||
.ztreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
|
||||
/*-------------------------------------
|
||||
zTree Style
|
||||
|
||||
version: 3.4
|
||||
author: Hunter.z
|
||||
email: hunter.z@263.net
|
||||
website: http://code.google.com/p/jquerytree/
|
||||
|
||||
-------------------------------------*/
|
||||
|
||||
.ztree * {padding:0; margin:0; /*font-size:12px;*/ font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
|
||||
.ztree {margin:0; padding:5px; color:#333}
|
||||
.ztree li{padding:0; margin:0; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:0}
|
||||
.ztree li ul{ margin:0; padding:0 0 0 18px}
|
||||
.ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;}
|
||||
|
||||
.ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; vertical-align:top; display: inline-block}
|
||||
.ztree li a:hover {text-decoration:underline}
|
||||
.ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;}
|
||||
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;}
|
||||
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid;
|
||||
opacity:0.8; filter:alpha(opacity=80)}
|
||||
.ztree li a.tmpTargetNode_prev {}
|
||||
.ztree li a.tmpTargetNode_next {}
|
||||
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
|
||||
font-size:12px; border:1px #585956 solid; *border:0px}
|
||||
.ztree li span {line-height:21px; margin-right:2px}
|
||||
.ztree li span.button {line-height:0; margin:0; padding: 0; width:21px; height:21px; display: inline-block; vertical-align:middle;
|
||||
border:0 none; cursor: pointer;outline:none;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
|
||||
|
||||
.ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto}
|
||||
.ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;}
|
||||
.ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;}
|
||||
.ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;}
|
||||
.ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;}
|
||||
.ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;}
|
||||
.ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;}
|
||||
.ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;}
|
||||
.ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;}
|
||||
.ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;}
|
||||
.ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;}
|
||||
.ztree li span.button.chk.radio_false_full {background-position: -47px -5px;}
|
||||
.ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;}
|
||||
.ztree li span.button.chk.radio_false_part {background-position: -47px -47px;}
|
||||
.ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;}
|
||||
.ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;}
|
||||
.ztree li span.button.chk.radio_true_full {background-position: -68px -5px;}
|
||||
.ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;}
|
||||
.ztree li span.button.chk.radio_true_part {background-position: -68px -47px;}
|
||||
.ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;}
|
||||
.ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;}
|
||||
|
||||
.ztree li span.button.switch {width:21px; height:21px}
|
||||
.ztree li span.button.root_open{background-position:-105px -63px}
|
||||
.ztree li span.button.root_close{background-position:-126px -63px}
|
||||
.ztree li span.button.roots_open{background-position: -105px 0;}
|
||||
.ztree li span.button.roots_close{background-position: -126px 0;}
|
||||
.ztree li span.button.center_open{background-position: -105px -21px;}
|
||||
.ztree li span.button.center_close{background-position: -126px -21px;}
|
||||
.ztree li span.button.bottom_open{background-position: -105px -42px;}
|
||||
.ztree li span.button.bottom_close{background-position: -126px -42px;}
|
||||
.ztree li span.button.noline_open{background-position: -105px -84px;}
|
||||
.ztree li span.button.noline_close{background-position: -126px -84px;}
|
||||
.ztree li span.button.root_docu{ background:none;}
|
||||
.ztree li span.button.roots_docu{background-position: -84px 0;}
|
||||
.ztree li span.button.center_docu{background-position: -84px -21px;}
|
||||
.ztree li span.button.bottom_docu{background-position: -84px -42px;}
|
||||
.ztree li span.button.noline_docu{ background:none;}
|
||||
|
||||
.ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.edit:hover {
|
||||
background-position: -168px -21px;
|
||||
}
|
||||
.ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.remove:hover {
|
||||
background-position: -168px -42px;
|
||||
}
|
||||
.ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.add:hover {
|
||||
background-position: -168px 0;
|
||||
}
|
||||
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
|
||||
|
||||
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
|
||||
|
||||
span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
|
||||
|
||||
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
|
||||
.ztreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
|
||||
|
@ -7,9 +7,9 @@ layui.config({
|
||||
var dataurl = '/UserManager/Load';
|
||||
var table = layui.table;
|
||||
|
||||
|
||||
//左边树状机构列表
|
||||
var ztree = function () {
|
||||
var url = '/OrgManager/LoadOrg';
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
@ -63,10 +63,18 @@ layui.config({
|
||||
table.on('tool(list)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'detail') {
|
||||
layer.msg('ID:' + data.id + ' 的查看操作');
|
||||
} else if (obj.event === 'del') {
|
||||
layer.confirm('真的删除行么', function (index) {
|
||||
obj.del();
|
||||
layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||
|
||||
} else if (obj.event === 'del') { //删除
|
||||
layer.confirm('真的删除么', function (index) {
|
||||
$.post("/UserManager/Delete", { ids: data.Id },
|
||||
function (data) {
|
||||
if (data.Status) {
|
||||
obj.del();
|
||||
} else {
|
||||
layer.msg(data.Message);
|
||||
}
|
||||
},"json");
|
||||
layer.close(index);
|
||||
});
|
||||
} else if (obj.event === 'edit') {
|
||||
@ -83,22 +91,10 @@ layui.config({
|
||||
}, addData: function () { //添加
|
||||
var index = layui.layer.open({
|
||||
title: "添加",
|
||||
type: 2,
|
||||
content: "addUser.html",
|
||||
success: function (layero, index) {
|
||||
setTimeout(function () {
|
||||
layui.layer.tips('点击此处返回列表',
|
||||
'.layui-layer-setwin .layui-layer-close', {
|
||||
tips: 3
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
area: ["500px", "400px"],
|
||||
type: "1",
|
||||
content: $('#formEdit')
|
||||
});
|
||||
//改变窗口大小时,重置弹窗的高度,防止超出可视区域(如F12调出debug的操作)
|
||||
$(window).resize(function () {
|
||||
layui.layer.full(index);
|
||||
});
|
||||
layui.layer.full(index);
|
||||
}, search: function () { //搜索
|
||||
var key = $('#key');
|
||||
|
||||
@ -115,4 +111,17 @@ layui.config({
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
//监听页面主按钮操作 end
|
||||
|
||||
//编辑或添加对话框
|
||||
form.on('submit(formEdit)', function (data) {
|
||||
$.post("/UserManager/Add", data.field, function (data) {
|
||||
layer.msg(data.Message);
|
||||
if (data.Status) {
|
||||
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
})
|
Loading…
Reference in New Issue
Block a user