mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 23:13:40 +08:00
Routine Update
This commit is contained in:
parent
d4580051c6
commit
104866d83b
@ -21,6 +21,12 @@ namespace OpenAuth.App
|
||||
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)
|
||||
{
|
||||
string cascadeId;
|
||||
@ -61,5 +67,15 @@ namespace OpenAuth.App
|
||||
_repository.Save();
|
||||
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 Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
@ -26,19 +27,14 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public string LoadOrg()
|
||||
{
|
||||
var orgs = _orgApp.GetAll();
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
return JsonHelper.Instance.Serialize(_orgApp.GetAll());
|
||||
}
|
||||
|
||||
public JsonResult LoadTree()
|
||||
public string LoadChildren(int id)
|
||||
{
|
||||
return Json(_orgApp.GetAll().Select(o =>new
|
||||
{
|
||||
id = o.Id,
|
||||
pId = o.ParentId,
|
||||
name = o.Name,
|
||||
text = o.Name
|
||||
}), JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(_orgApp.LoadChildren(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -11,10 +11,6 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
alert(treeNode.tId + ", " + treeNode.name);
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var setting = {
|
||||
@ -22,10 +18,14 @@
|
||||
selectedMulti: false
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: "Name",
|
||||
title: "Name"
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: "id",
|
||||
pIdKey: "pId",
|
||||
idKey: "Id",
|
||||
pIdKey: "ParentId",
|
||||
rootPId: "null"
|
||||
}
|
||||
},
|
||||
@ -34,53 +34,58 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.getJSON("OrgManager/LoadTree", function (json) {
|
||||
$.getJSON("OrgManager/LoadOrg", function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($("#orgTree"), setting, json);
|
||||
});
|
||||
|
||||
$('#test-datagrid-array').datagrid({
|
||||
gridTitle: '机构列表显示',
|
||||
showToolbar: true,
|
||||
toolbarItem: 'all',
|
||||
addLocation: 'first',
|
||||
local: 'local',
|
||||
dataUrl: 'OrgManager/LoadOrg',
|
||||
dataType: 'json',
|
||||
columns: [
|
||||
{
|
||||
name: 'Type',
|
||||
label: '类型',
|
||||
type: 'select',
|
||||
items: [{ '0': '默认' }],
|
||||
align: 'center',
|
||||
width: 80,
|
||||
render: $.datagrid.renderItem
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
label: '机构名称',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
rule: 'required'
|
||||
},
|
||||
{
|
||||
name: 'CreateTime',
|
||||
label: '登记日期',
|
||||
type: 'date',
|
||||
pattern: 'yyyy-MM-dd HH:mm'
|
||||
}
|
||||
{ name: 'Name', width: '150', label: '机构名称' },
|
||||
{ name: 'CreateTime', width: '120', label: '登记日期' }
|
||||
],
|
||||
data: json,
|
||||
hiddenFields: ['Id'],
|
||||
editUrl: 'ajaxDone1.html',
|
||||
delUrl: 'ajaxDone1.html',
|
||||
paging: { total: 30, pageSize: 5 },
|
||||
showTfoot: true,
|
||||
editMode: 'dialog',
|
||||
fullGrid: true,
|
||||
showLinenumber: true,
|
||||
showCheckboxcol: true
|
||||
showCheckboxcol: true,
|
||||
paging: false,
|
||||
filterMult: false,
|
||||
showTfoot: 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
|
||||
</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