diff --git a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java index 9a7af7278..6fdcf18ab 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/dfm/controller/UserController.java @@ -167,19 +167,21 @@ public class UserController extends com.ruoyi.common.core.controller.BaseControl * @return * @throws Exception */ - @RequestMapping("/deleteUser") - public ModelAndView deleteUser(HttpServletRequest req, + @RequestMapping("/remove") + @ResponseBody + public AjaxResult deleteUser(HttpServletRequest req, HttpServletResponse res) throws Exception { try { String delProject = req.getParameter("delProject"); int uid = Integer.parseInt(req.getParameter("uid")); userService.deleteUser(uid,delProject); - outputMsg(res, ""); +// outputMsg(res, ""); + return toAjax(1); } catch (Exception e) { logger.error("删除用户失败", e); - outputMsg(res, ""); +// outputMsg(res, ""); + return toAjax(0); } - return null; } @@ -191,20 +193,23 @@ public class UserController extends com.ruoyi.common.core.controller.BaseControl * @throws Exception */ @RequestMapping("/changeUserState") - public ModelAndView changeUserState(HttpServletRequest req, + @ResponseBody + public AjaxResult changeUserState(HttpServletRequest req, HttpServletResponse res) throws Exception { try { int uid = Integer.parseInt(req.getParameter("uid")); int state = Integer.parseInt(req.getParameter("state")); //构造分页参数 - String currentPage = req.getParameter("currentPage"); +// String currentPage = req.getParameter("currentPage"); userService.changeUserState(uid , state); - outputMsg(res, ""); +// outputMsg(res, ""); + return toAjax(1); } catch (Exception e) { logger.error("暂停用户失败", e); - outputMsg(res, ""); +// outputMsg(res, ""); + return toAjax(0); } - return null; +// return null; } /** @@ -222,9 +227,11 @@ public class UserController extends com.ruoyi.common.core.controller.BaseControl if(ustr == null || "".equals(ustr)) { uid = ShiroUtils.getLoginUser().getId(); + mmap.put("editSelf", true); }else { uid = Integer.parseInt(ustr); + mmap.put("editSelf", false); } UserInfo user = userService.getUserById(uid); diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 2898fa4d7..07652e0f0 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -983,6 +983,36 @@ var table = { }); }, + removeUser: function(id) { + table.set(); + $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗?", function() { + var delProject; + if (confirm("是否删除该账户下的所有项目?")) { + delProject = "yes"; + } else { + delProject = "no"; + } + var url = table.options.removeUrl; + var data = { "uid": id, "delProject": delProject }; + $.operate.submit(url, "post", "json", data); + }); + }, + // 删除信息 + pauseUser: function(uid, state) { + table.set(); + // $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗?", function() { + // var url = $.common.isEmpty(id) ? table.options.removeUrl : table.options.removeUrl.replace("{id}", id); + // if(table.options.type == table_type.bootstrapTreeTable) { + // $.operate.get(url); + // } else { + // var data = { "ids": id }; + // $.operate.submit(url, "post", "json", data); + // } + // }); + + var data = { "uid": uid, "state": state }; + $.operate.submit(table.options.pauseUrl, "post", "json", data); + }, // 批量删除信息 removeAll: function() { table.set(); diff --git a/ruoyi-admin/src/main/resources/templates/dfm/editUser.html b/ruoyi-admin/src/main/resources/templates/dfm/editUser.html index acdcf3577..1d41a5c39 100644 --- a/ruoyi-admin/src/main/resources/templates/dfm/editUser.html +++ b/ruoyi-admin/src/main/resources/templates/dfm/editUser.html @@ -9,6 +9,7 @@