父部门不能选择&选择树自适应

master
RuoYi 6 years ago committed by Limy
parent cb3df4b324
commit c6b772cafe

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
@ -79,7 +80,12 @@ public class DeptController extends BaseController
@GetMapping("/edit/{deptId}")
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
mmap.put("dept", deptService.selectDeptById(deptId));
SysDept dept = deptService.selectDeptById(deptId);
if (StringUtils.isNotNull(dept) && 100L == deptId)
{
dept.setParentName("无");
}
mmap.put("dept", dept);
return prefix + "/edit";
}

@ -31,7 +31,7 @@
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export"><i class="fa fa-download"></i>&nbsp;导出</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
@ -45,6 +45,9 @@
<a class="btn btn-danger" onclick="$.operate.clean()" shiro:hasPermission="monitor:job:remove">
<i class="fa fa-trash"></i> 清空
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">

@ -31,7 +31,7 @@
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:logininfor:export"><i class="fa fa-download"></i>&nbsp;导出</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
@ -45,6 +45,9 @@
<a class="btn btn-danger" onclick="$.operate.clean()" shiro:hasPermission="monitor:logininfor:remove">
<i class="fa fa-trash"></i> 清空
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:logininfor:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">

@ -31,7 +31,7 @@
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:logininfor:export"><i class="fa fa-download"></i>&nbsp;导出</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
@ -45,6 +45,9 @@
<a class="btn btn-danger" onclick="$.operate.clean()" shiro:hasPermission="monitor:logininfor:remove">
<i class="fa fa-trash"></i> 清空
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:logininfor:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">

@ -107,7 +107,6 @@
var options = {
title: '部门选择',
width: "380",
height: "380",
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
callBack: doSubmit
};

@ -108,14 +108,18 @@
/*部门管理-修改-选择部门树*/
function selectDeptTree() {
var options = {
title: '部门选择',
width: "380",
height: "380",
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
var deptId = $("#treeId").val();
if(deptId > 0) {
var options = {
title: '部门选择',
width: "380",
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
} else {
$.modal.alertError("父部门不能选择");
}
}
function doSubmit(index, layero){

@ -151,7 +151,6 @@
var options = {
title: '菜单选择',
width: "380",
height: "380",
url: url,
callBack: doSubmit
};

@ -164,8 +164,7 @@
if(menuId > 0) {
var url = prefix + "/selectMenuTree/" + menuId;
$.modal.open("选择菜单", url, '380', '380');
}
else {
} else {
$.modal.alertError("主菜单不能选择");
}
}
@ -177,13 +176,11 @@
var options = {
title: '菜单选择',
width: "380",
height: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
else {
} else {
$.modal.alertError("主菜单不能选择");
}
}

@ -216,7 +216,6 @@
var options = {
title: '选择部门',
width: "380",
height: "380",
url: ctx + "system/dept/selectDeptTree/" + deptId,
callBack: doSubmit
};

@ -189,7 +189,6 @@
var options = {
title: '选择部门',
width: "380",
height: "380",
url: url,
callBack: doSubmit
};

@ -173,9 +173,12 @@ public class SysDeptServiceImpl implements ISysDeptService
public int updateDept(SysDept dept)
{
SysDept info = deptMapper.selectDeptById(dept.getParentId());
String ancestors = info.getAncestors() + "," + dept.getParentId();
dept.setAncestors(ancestors);
updateDeptChildren(dept.getDeptId(), ancestors);
if (StringUtils.isNotNull(info))
{
String ancestors = info.getAncestors() + "," + dept.getParentId();
dept.setAncestors(ancestors);
updateDeptChildren(dept.getDeptId(), ancestors);
}
return deptMapper.updateDept(dept);
}

Loading…
Cancel
Save