menulist增加enter键快速修改sort功能
This commit is contained in:
@@ -2,6 +2,7 @@ package com.nis.web.controller.sys;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ public class MenuController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 批量修改菜单排序
|
* 批量修改菜单排序
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("sys:menu:edit")
|
/*@RequiresPermissions("sys:menu:edit")
|
||||||
@RequestMapping(value = "updateSort")
|
@RequestMapping(value = "updateSort")
|
||||||
public String updateSort(Long[] ids, Integer[] sorts, RedirectAttributes redirectAttributes) {
|
public String updateSort(Long[] ids, Integer[] sorts, RedirectAttributes redirectAttributes) {
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
@@ -106,7 +107,7 @@ public class MenuController extends BaseController {
|
|||||||
}
|
}
|
||||||
addMessage(redirectAttributes, "保存菜单排序成功!");
|
addMessage(redirectAttributes, "保存菜单排序成功!");
|
||||||
return "redirect:" + adminPath + "/sys/menu/";
|
return "redirect:" + adminPath + "/sys/menu/";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -140,4 +141,27 @@ public class MenuController extends BaseController {
|
|||||||
return mapList;
|
return mapList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isShowHide是否显示隐藏菜单
|
||||||
|
* @param extId
|
||||||
|
* @param isShowHidden
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping(value = "updateSort")
|
||||||
|
public boolean updateSort(@RequestParam(required=false) Long menuId,@RequestParam(required=false) Integer sort) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
SysMenu menu = new SysMenu(menuId);
|
||||||
|
menu.setSort(StringUtil.isEmpty(sort) ? 0:sort);
|
||||||
|
menuService.updateMenuSort(menu);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("update sort failed",e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,41 @@
|
|||||||
$("#treeTable").treeTable({
|
$("#treeTable").treeTable({
|
||||||
expandLevel : 3
|
expandLevel : 3
|
||||||
}).show();
|
}).show();
|
||||||
|
$("input[name=sorts]").each(function(){
|
||||||
|
$(this).keydown(function(event){
|
||||||
|
if(event.keyCode==13){
|
||||||
|
$.ajax({
|
||||||
|
type:'post',
|
||||||
|
async:false,
|
||||||
|
url:'${ctx}/sys/menu/updateSort',
|
||||||
|
data:{"menuId":$(this).attr("menuId"),"sort":$(this).val()},
|
||||||
|
success:function(data){
|
||||||
|
if(data){
|
||||||
|
top.$.jBox.tip("<spring:message code='update_success'/>", "<spring:message code='info'/>");
|
||||||
|
}else{
|
||||||
|
top.$.jBox.tip("<spring:message code='update_failed'/>", "<spring:message code='info'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
function updateSort() {
|
function updateSort() {
|
||||||
loading('onloading...');
|
loading('onloading...');
|
||||||
$("#listForm").attr("action", "${ctx}/sys/menu/updateSort");
|
$("#listForm").attr("action", "${ctx}/sys/menu/updateSort");
|
||||||
$("#listForm").submit();
|
$("#listForm").submit();
|
||||||
}
|
}
|
||||||
|
/* $("input[name=sorts]").each(function(){
|
||||||
|
$(this).bind("keyup",function(event){
|
||||||
|
alert($(this).attr("menuId"));
|
||||||
|
alert($(this).val());
|
||||||
|
if(event.keyCode==13){
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}); */
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -88,7 +117,7 @@
|
|||||||
<td style="text-align:center;"><shiro:hasPermission
|
<td style="text-align:center;"><shiro:hasPermission
|
||||||
name="sys:menu:edit">
|
name="sys:menu:edit">
|
||||||
<input type="hidden" name="ids" value="${menu.id}" />
|
<input type="hidden" name="ids" value="${menu.id}" />
|
||||||
<input name="sorts" type="text" value="${menu.sort}"
|
<input name="sorts" type="text" value="${menu.sort}" menuId="${menu.id}"
|
||||||
style="width:50px;margin:0;padding:0;text-align:center;border: 1px solid #ddd;">
|
style="width:50px;margin:0;padding:0;text-align:center;border: 1px solid #ddd;">
|
||||||
</shiro:hasPermission>
|
</shiro:hasPermission>
|
||||||
<shiro:lacksPermission name="sys:menu:edit">
|
<shiro:lacksPermission name="sys:menu:edit">
|
||||||
@@ -117,14 +146,6 @@
|
|||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<shiro:hasPermission name="sys:menu:edit">
|
|
||||||
<div class="form-actions pagination-left">
|
|
||||||
<button id="btnSubmit" class="btn btn-primary" type="button"
|
|
||||||
onclick="updateSort();">
|
|
||||||
<spring:message code="save_sort" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</shiro:hasPermission>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user