mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-16 07:59:54 +08:00
Routine Update
This commit is contained in:
parent
d4580051c6
commit
104866d83b
@ -21,6 +21,12 @@ namespace OpenAuth.App
|
|||||||
return _repository.LoadOrgs();
|
return _repository.LoadOrgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加部门
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="org">The org.</param>
|
||||||
|
/// <returns>System.Int32.</returns>
|
||||||
|
/// <exception cref="System.Exception">未能找到该组织的父节点信息</exception>
|
||||||
public int AddOrg(Org org)
|
public int AddOrg(Org org)
|
||||||
{
|
{
|
||||||
string cascadeId;
|
string cascadeId;
|
||||||
@ -61,5 +67,15 @@ namespace OpenAuth.App
|
|||||||
_repository.Save();
|
_repository.Save();
|
||||||
return org.Id;
|
return org.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 部门的直接子部门
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orgId">The org unique identifier.</param>
|
||||||
|
/// <returns>IEnumerable{Org}.</returns>
|
||||||
|
public IEnumerable<Org> LoadChildren(int orgId)
|
||||||
|
{
|
||||||
|
return _repository.Find(u => u.ParentId == orgId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Web;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
|
using OpenAuth.Domain;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
@ -26,19 +27,14 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
|
|
||||||
public string LoadOrg()
|
public string LoadOrg()
|
||||||
{
|
{
|
||||||
var orgs = _orgApp.GetAll();
|
return JsonHelper.Instance.Serialize(_orgApp.GetAll());
|
||||||
return JsonHelper.Instance.Serialize(orgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonResult LoadTree()
|
public string LoadChildren(int id)
|
||||||
{
|
{
|
||||||
return Json(_orgApp.GetAll().Select(o =>new
|
return JsonHelper.Instance.Serialize(_orgApp.LoadChildren(id));
|
||||||
{
|
|
||||||
id = o.Id,
|
|
||||||
pId = o.ParentId,
|
|
||||||
name = o.Name,
|
|
||||||
text = o.Name
|
|
||||||
}), JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,10 +11,6 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
|
||||||
alert(treeNode.tId + ", " + treeNode.name);
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
var setting = {
|
var setting = {
|
||||||
@ -22,10 +18,14 @@
|
|||||||
selectedMulti: false
|
selectedMulti: false
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
key: {
|
||||||
|
name: "Name",
|
||||||
|
title: "Name"
|
||||||
|
},
|
||||||
simpleData: {
|
simpleData: {
|
||||||
enable: true,
|
enable: true,
|
||||||
idKey: "id",
|
idKey: "Id",
|
||||||
pIdKey: "pId",
|
pIdKey: "ParentId",
|
||||||
rootPId: "null"
|
rootPId: "null"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -34,53 +34,58 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.getJSON("OrgManager/LoadTree", function (json) {
|
$.getJSON("OrgManager/LoadOrg", function (json) {
|
||||||
var zTreeObj = $.fn.zTree.init($("#orgTree"), setting, json);
|
var zTreeObj = $.fn.zTree.init($("#orgTree"), setting, json);
|
||||||
});
|
|
||||||
|
|
||||||
$('#test-datagrid-array').datagrid({
|
$('#test-datagrid-array').datagrid({
|
||||||
gridTitle: '机构列表显示',
|
gridTitle: '机构列表显示',
|
||||||
showToolbar: true,
|
showToolbar: true,
|
||||||
toolbarItem: 'all',
|
toolbarItem: 'all',
|
||||||
addLocation: 'first',
|
columns: [
|
||||||
local: 'local',
|
{ name: 'Name', width: '150', label: '机构名称' },
|
||||||
dataUrl: 'OrgManager/LoadOrg',
|
{ name: 'CreateTime', width: '120', label: '登记日期' }
|
||||||
dataType: 'json',
|
],
|
||||||
columns: [
|
data: json,
|
||||||
{
|
hiddenFields: ['Id'],
|
||||||
name: 'Type',
|
editUrl: 'ajaxDone1.html',
|
||||||
label: '类型',
|
delUrl: 'ajaxDone1.html',
|
||||||
type: 'select',
|
editMode: 'dialog',
|
||||||
items: [{ '0': '默认' }],
|
fullGrid: true,
|
||||||
align: 'center',
|
showLinenumber: true,
|
||||||
width: 80,
|
showCheckboxcol: true,
|
||||||
render: $.datagrid.renderItem
|
paging: false,
|
||||||
},
|
filterMult: false,
|
||||||
{
|
showTfoot: true
|
||||||
name: 'Name',
|
});
|
||||||
label: '机构名称',
|
|
||||||
align: 'center',
|
|
||||||
width: 100,
|
|
||||||
rule: 'required'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'CreateTime',
|
|
||||||
label: '登记日期',
|
|
||||||
type: 'date',
|
|
||||||
pattern: 'yyyy-MM-dd HH:mm'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
hiddenFields: ['Id'],
|
|
||||||
editUrl: 'ajaxDone1.html',
|
|
||||||
delUrl: 'ajaxDone1.html',
|
|
||||||
paging: { total: 30, pageSize: 5 },
|
|
||||||
showTfoot: true,
|
|
||||||
editMode: 'dialog',
|
|
||||||
fullGrid: true,
|
|
||||||
showLinenumber: true,
|
|
||||||
showCheckboxcol: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
$.getJSON("OrgManager/LoadChildren", { id: treeNode.Id }, function (json) {
|
||||||
|
$('#test-datagrid-array').destroy();
|
||||||
|
$('#test-datagrid-array').datagrid({
|
||||||
|
gridTitle: '机构列表显示',
|
||||||
|
showToolbar: true,
|
||||||
|
toolbarItem: 'all',
|
||||||
|
columns: [
|
||||||
|
{ name: 'Name', width: '150', label: '机构名称' },
|
||||||
|
{ name: 'CreateTime', width: '120', label: '登记日期' }
|
||||||
|
],
|
||||||
|
data: json,
|
||||||
|
hiddenFields: ['Id'],
|
||||||
|
editUrl: 'ajaxDone1.html',
|
||||||
|
delUrl: 'ajaxDone1.html',
|
||||||
|
editMode: 'dialog',
|
||||||
|
fullGrid: true,
|
||||||
|
showLinenumber: true,
|
||||||
|
showCheckboxcol: true,
|
||||||
|
paging: false,
|
||||||
|
filterMult: false,
|
||||||
|
showTfoot: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
//@@ sourceURL=orgIndex.js
|
//@@ sourceURL=orgIndex.js
|
||||||
</script>
|
</script>
|
7
OpenAuth.Repository/App.config
Normal file
7
OpenAuth.Repository/App.config
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True"
|
||||||
|
providerName="System.Data.SqlClient" />
|
||||||
|
</connectionStrings>
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue
Block a user