mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-24 16:18:45 +08:00
Routine Update
This commit is contained in:
parent
55f334004e
commit
5fc7dd3466
@ -62,6 +62,7 @@
|
|||||||
<Compile Include="LogHelper.cs" />
|
<Compile Include="LogHelper.cs" />
|
||||||
<Compile Include="PredicateBuilder.cs" />
|
<Compile Include="PredicateBuilder.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Response.cs" />
|
||||||
<Compile Include="SessionHelper.cs" />
|
<Compile Include="SessionHelper.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
15
Infrastructure/Response.cs
Normal file
15
Infrastructure/Response.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Infrastructure
|
||||||
|
{
|
||||||
|
public class Response
|
||||||
|
{
|
||||||
|
public bool Status = true;
|
||||||
|
public string Message = "操作成功";
|
||||||
|
public dynamic Result;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
public class OrgManagerController : BaseController
|
public class OrgManagerController : BaseController
|
||||||
{
|
{
|
||||||
private OrgManagerApp _orgApp;
|
private OrgManagerApp _orgApp;
|
||||||
|
private Response _response = new Response();
|
||||||
|
|
||||||
public OrgManagerController()
|
public OrgManagerController()
|
||||||
{
|
{
|
||||||
@ -35,13 +36,23 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
return JsonHelper.Instance.Serialize(_orgApp.LoadAllChildren(id));
|
return JsonHelper.Instance.Serialize(_orgApp.LoadAllChildren(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DelOrg(string json)
|
public string DelOrg(string json)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var delObj = JsonHelper.Instance.Deserialize<Org[]>(json);
|
var delObj = JsonHelper.Instance.Deserialize<Org[]>(json);
|
||||||
foreach (var obj in delObj)
|
foreach (var obj in delObj)
|
||||||
{
|
{
|
||||||
_orgApp.DelOrg(obj.Id);
|
_orgApp.DelOrg(obj.Id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_response.Status = false;
|
||||||
|
_response.Message = e.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonHelper.Instance.Serialize(_response);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
<div style="float: left; width: 220px; height: 240px; overflow: auto;" class="table table-bordered">
|
<div style="float: left; width: 220px; height: 240px; overflow: auto;" class="table table-bordered">
|
||||||
<ul id="orgTree" class="ztree"></ul>
|
<ul id="orgTree" class="ztree"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="ztree-detail" style="margin-left: 225px; width: auto;">
|
<div id="ztree-detail" style="margin-left: 225px; width: auto;">
|
||||||
<table id="test-datagrid-array" data-width="100%" data-height="100%" class="table table-bordered"></table>
|
<table id="test-datagrid-array" data-width="100%" data-height="100%" class="table table-bordered"></table>
|
||||||
</div>
|
</div>
|
||||||
@ -10,70 +12,109 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var selectedId = 0;
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
Init(0);
|
||||||
var setting = {
|
|
||||||
view: {
|
|
||||||
selectedMulti: false
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
key: {
|
|
||||||
name: "Name",
|
|
||||||
title: "Name"
|
|
||||||
},
|
|
||||||
simpleData: {
|
|
||||||
enable: true,
|
|
||||||
idKey: "Id",
|
|
||||||
pIdKey: "ParentId",
|
|
||||||
rootPId: "null"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: {
|
|
||||||
onClick: zTreeOnClick
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$.getJSON("OrgManager/LoadOrg", function (json) {
|
|
||||||
var zTreeObj = $.fn.zTree.init($("#orgTree"), setting, json);
|
|
||||||
zTreeObj.expandAll(true);
|
|
||||||
loadDataGrid(json);
|
|
||||||
});
|
});
|
||||||
|
//加载数据到datagrid
|
||||||
});
|
|
||||||
|
|
||||||
function loadDataGrid(data) {
|
function loadDataGrid(data) {
|
||||||
|
|
||||||
$('#test-datagrid-array').datagrid({
|
$('#test-datagrid-array').datagrid({
|
||||||
gridTitle: '机构列表显示',
|
gridTitle: '机构列表显示',
|
||||||
showToolbar: true,
|
showToolbar: true,
|
||||||
toolbarItem: 'all',
|
toolbarItem: 'add, edit, refresh, |, del',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'Name', width: '150', label: '机构名称' },
|
{
|
||||||
{ name: 'CreateTime', width: '120', label: '登记日期' }
|
name: 'Id',
|
||||||
|
hide: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Name',
|
||||||
|
width: '150',
|
||||||
|
label: '机构名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CreateTime',
|
||||||
|
width: '120',
|
||||||
|
label: '登记日期'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
data: data,
|
data: data,
|
||||||
hiddenFields: ['Id'],
|
addUrl: 'OrgManager/AddOrg',
|
||||||
editUrl: 'OrgManager/AddOrg',
|
|
||||||
delUrl: 'OrgManager/DelOrg',
|
delUrl: 'OrgManager/DelOrg',
|
||||||
|
editUrl: 'OrgManager/EditOrg',
|
||||||
editMode: 'dialog',
|
editMode: 'dialog',
|
||||||
fullGrid: true,
|
fullGrid: true,
|
||||||
showLinenumber: true,
|
showLinenumber: true,
|
||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
paging: false,
|
paging: false,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: true
|
showTfoot: true,
|
||||||
|
delCallback: function (delResult) {
|
||||||
|
if (delResult.Status == true)
|
||||||
|
Init(selectedId);
|
||||||
|
else {
|
||||||
|
$(this).alertmsg('warn', delResult.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
$.getJSON("OrgManager/LoadChildren", { id: treeNode.Id }, function (json) {
|
selectedId = treeNode.Id;
|
||||||
|
$.getJSON('OrgManager/LoadChildren', {
|
||||||
|
id: treeNode.Id
|
||||||
|
}, function (json) {
|
||||||
$('#ztree-detail').empty().append('<table id="test-datagrid-array" data-width="100%" data-height="100%" class="table table-bordered"></table>');
|
$('#ztree-detail').empty().append('<table id="test-datagrid-array" data-width="100%" data-height="100%" class="table table-bordered"></table>');
|
||||||
loadDataGrid(json);
|
loadDataGrid(json);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
function Init(selectedId) {
|
||||||
|
var setting = {
|
||||||
|
view: {
|
||||||
|
selectedMulti: false
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: zTreeOnClick
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$.getJSON('OrgManager/LoadOrg', function (json) {
|
||||||
|
var zTreeObj = $.fn.zTree.init($('#orgTree'), setting, json);
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
if (selectedId == 0) {
|
||||||
|
loadDataGrid(json);
|
||||||
|
} else {
|
||||||
|
//TODO:设置ztree选中,不过没看到效果..
|
||||||
|
var selectedNod = zTreeObj.getNodesByParam('Id', selectedId, null);
|
||||||
|
zTreeObj.selectNode(selectedNod, false);
|
||||||
|
$.getJSON('OrgManager/LoadChildren', {
|
||||||
|
id: selectedId
|
||||||
|
}, function (data) {
|
||||||
|
$('#ztree-detail').empty().append('<table id="test-datagrid-array" data-width="100%" data-height="100%" class="table table-bordered"></table>');
|
||||||
|
loadDataGrid(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function getSelected() {
|
||||||
|
var selected = $('#test-datagrid-array').data('selectedTrs');
|
||||||
|
if (selected == null) {
|
||||||
|
$(this).alertmsg('warn', '至少选择一个对象', {
|
||||||
|
displayMode: 'slide',
|
||||||
|
title: '重要提示'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return selected;
|
||||||
}
|
}
|
||||||
//@@ sourceURL=orgIndex.js
|
//@@ sourceURL=orgIndex.js
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user