优化机构管理删除

This commit is contained in:
yubaolee 2016-10-14 17:50:44 +08:00
parent e68555e976
commit 62f3885380
3 changed files with 13 additions and 10 deletions

View File

@ -75,12 +75,13 @@ namespace OpenAuth.App
/// <summary>
/// 删除指定ID的部门及其所有子部门
/// </summary>
public void DelOrg(Guid id)
public void DelOrg(Guid[] ids)
{
var delOrg = _repository.FindSingle(u => u.Id == id);
if (delOrg == null) return;
_repository.Delete(u => u.CascadeId.Contains(delOrg.CascadeId));
var delOrg = _repository.Find(u => ids.Contains(u.Id)).ToList();
foreach (var org in delOrg)
{
_repository.Delete(u => u.CascadeId.Contains(org.CascadeId));
}
}

View File

@ -224,10 +224,11 @@ var editDlg = function () {
//删除
function del() {
var selected = list.getSelectedObj();
var selected = list.getSelectedProperties("Id");
if (selected == null) return;
$.post('/OrgManager/DelOrg?Id=' + selected.Id, function (data) {
$.post('/OrgManager/DelOrg',
{ ids: selected }, function (data) {
if (data.Status) {
list.reload();
ztree.reload();

View File

@ -75,11 +75,12 @@ namespace OpenAuth.Mvc.Controllers
/// <para>Id为逗号分开的字符串</para>
/// </summary>
/// <returns>System.String.</returns>
public string DelOrg(Guid Id)
[HttpPost]
public string DelOrg(Guid[] ids)
{
try
{
_orgApp.DelOrg(Id);
_orgApp.DelOrg(ids);
}
catch (Exception e)
{