diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/MenuController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/MenuController.java index c7eb176..30083e1 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/MenuController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/MenuController.java @@ -64,14 +64,6 @@ public class MenuController { public ResponseEntity query(@RequestParam String pid) { return new ResponseEntity<>(menuService.getMenus(pid), HttpStatus.OK); } - - @ApiOperation("菜单子系统级联选择") - @GetMapping(value = "/getSelectList") - @SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND) - public ResponseEntity getSelectList() { - return new ResponseEntity<>(menuService.getSelectList(), HttpStatus.OK); - } - @ApiOperation("获取菜单列表") @PostMapping(value = "/getMenusByRole") @SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java index 71c1645..9788afb 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java @@ -1,37 +1,15 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.nl.modules.system.rest; import cn.dev33.satoken.annotation.SaCheckPermission; -import cn.dev33.satoken.annotation.SaMode; -import cn.dev33.satoken.stp.StpUtil; -import cn.hutool.core.lang.Dict; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.logging.annotation.Log; import org.nl.modules.system.domain.Role; import org.nl.modules.system.domain.vo.RoleVo; import org.nl.modules.system.service.RoleService; -import org.nl.modules.system.service.dto.RoleDto; -import org.nl.modules.system.service.dto.RoleQueryCriteria; -import org.nl.modules.system.service.dto.RoleSmallDto; import org.nl.modules.wql.core.bean.WQLObject; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; @@ -39,13 +17,9 @@ import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; /** * @author Zheng Jie @@ -83,35 +57,26 @@ public class RoleController { return new ResponseEntity<>(roleService.queryAll(criteria, pageable), HttpStatus.OK); } - @ApiOperation("获取用户级别") - @GetMapping(value = "/level") - public ResponseEntity getLevel() { - return new ResponseEntity<>(Dict.create().set("level", getLevels(null)), HttpStatus.OK); - } @Log("新增角色") @ApiOperation("新增角色") @PostMapping @SaCheckPermission("roles:add") public ResponseEntity create(@Validated @RequestBody Role resources) { - if (resources.getId() != null) { - throw new BadRequestException("A new " + ENTITY_NAME + " cannot already have an ID"); - } - getLevels(resources.getLevel()); // roleService.create(resources); return new ResponseEntity<>(HttpStatus.CREATED); } - /* @Log("修改角色") - @ApiOperation("修改角色") - @PutMapping - @SaCheckPermission("roles:edit") - public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources) { - getLevels(resources.getLevel()); - roleService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } -*/ + /* @Log("修改角色") + @ApiOperation("修改角色") + @PutMapping + @SaCheckPermission("roles:edit") + public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources) { + getLevels(resources.getLevel()); + roleService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + */ @Log("修改角色菜单") @ApiOperation("修改角色菜单") @PutMapping(value = "/menu") @@ -140,20 +105,4 @@ public class RoleController { roleService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } - - /** - * 获取用户的角色级别 - * - * @return / - */ - private int getLevels(Integer level) { - /* List levels = roleService.findByUsersId(StpUtil.getLoginIdAsLong()).stream().map(Role::getLevel).collect(Collectors.toList()); - int min = Collections.min(levels); - if(level != null){ - if(level < min){ - throw new BadRequestException("权限不足,你的角色级别:" + min + ",低于操作的角色级别:" + level); - } - }*/ - return 2; - } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/MenuService.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/MenuService.java index ea09c15..d8b016c 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/MenuService.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/MenuService.java @@ -41,13 +41,6 @@ public interface MenuService { JSONObject queryAll(JSONObject param, Pageable page) throws Exception; - /** - * 构建菜单子系统与菜单类类别的级联选择下拉框 - * - * @return - */ - JSONArray getSelectList(); - /** * 1、根据子系统、菜单类别获取菜单列表,并判断对应的角色ID是否拥有该菜单 * diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java index 18299a1..1c6ecf2 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java @@ -35,7 +35,7 @@ public class MenuServiceImpl implements MenuService { @Override public JSONObject queryAll(JSONObject param, Pageable page) throws Exception { - JSONObject json = WQL.getWO("QSYS_MENU01").addParam("flag", "0").addParam("pid", param.getString("pid")).pageQuery(WqlUtil.getHttpContext(page), ""); + JSONObject json = WQL.getWO("QSYS_MENU01").addParam("flag", "1").addParam("pid", param.getString("pid")).pageQuery(WqlUtil.getHttpContext(page), ""); JSONArray content = json.getJSONArray("content"); JSONArray res = new JSONArray(); @@ -60,37 +60,6 @@ public class MenuServiceImpl implements MenuService { return json; } - @Override - public JSONArray getSelectList() { - JSONArray arr = WQL.getWO("QSYS_MENU01").addParam("flag", "1").process().getResultJSONArray(0); - - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject json = arr.getJSONObject(i); - JSONObject item = new JSONObject(); - String system_type = json.getString("system_type"); - item.put("label", system_type); - item.put("value", system_type); - - //构建字级节点 - JSONArray children = WQL.getWO("QSYS_MENU01").addParam("flag", "2").addParam("system_type", system_type).process().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(children)) { - JSONArray childNodes = new JSONArray(); - for (int j = 0; j < children.size(); j++) { - JSONObject childJson = children.getJSONObject(j); - JSONObject childItem = new JSONObject(); - String category = childJson.getString("category"); - childItem.put("label", category); - childItem.put("value", category); - childNodes.add(childItem); - } - item.put("children", childNodes); - } - - result.add(item); - } - return result; - } @Override public JSONArray getMenusByRole(String role_id, String system_type, String category) { diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/wql/QSYS_MENU01.wql b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/wql/QSYS_MENU01.wql index c5ed8b2..557242d 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/wql/QSYS_MENU01.wql +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/wql/QSYS_MENU01.wql @@ -43,7 +43,7 @@ # 3、业务主过程 # ########################################## - IF 输入.flag = "0" + IF 输入.flag = "1" PAGEQUERY SELECT * , @@ -62,14 +62,6 @@ ENDIF - - IF 输入.flag = "1" - QUERY - SELECT system_type from sys_menu GROUP BY system_type - ENDSELECT - ENDQUERY - ENDIF - IF 输入.flag = "2" QUERY SELECT category from sys_menu diff --git a/nladmin-ui/src/api/system/menu.js b/nladmin-ui/src/api/system/menu.js index 11c9454..17e59fb 100644 --- a/nladmin-ui/src/api/system/menu.js +++ b/nladmin-ui/src/api/system/menu.js @@ -23,13 +23,6 @@ export function getMenusByRole(params) { }) } -export function getSelectList() { - return request({ - url: 'api/menus/getSelectList', - method: 'get' - }) -} - export function getMenuSuperior(ids) { // const data = ids.length || ids.length === 0 ? ids : Array.of(ids) const data = { @@ -80,4 +73,4 @@ export function edit(data) { }) } -export default { add, edit, del, getMenusTree, getMenuSuperior, getMenus, getChild, getSelectList, getMenusByRole } +export default { add, edit, del, getMenusTree, getMenuSuperior, getMenus, getChild, getMenusByRole } diff --git a/nladmin-ui/src/components/Crud/crud.js b/nladmin-ui/src/components/Crud/crud.js index 523fd18..a307e48 100644 --- a/nladmin-ui/src/components/Crud/crud.js +++ b/nladmin-ui/src/components/Crud/crud.js @@ -50,7 +50,7 @@ function CRUD(options) { // 主页操作栏显示哪些按钮 optShow: { add: true, - edit: true, + edit: false, del: true, download: false, reset: true @@ -160,6 +160,16 @@ function CRUD(options) { }) }) }, + /** + * 格式化是否1-是,0-否 + */ + formatIsOrNot(row, column) { + if (!row[column.property]) { + return '否' + } + return row[column.property] == '1' ? '是' : '否' + }, + /** * 格式化数据,保留0位小数 */ diff --git a/nladmin-ui/src/views/system/menu/index.vue b/nladmin-ui/src/views/system/menu/index.vue index b69078f..ff0c196 100644 --- a/nladmin-ui/src/views/system/menu/index.vue +++ b/nladmin-ui/src/views/system/menu/index.vue @@ -35,7 +35,7 @@ 按钮 - + - + @@ -67,7 +67,7 @@ - + @@ -83,10 +83,10 @@ - + - + @@ -137,44 +137,25 @@ @selection-change="crud.selectionChangeHandler" > - - - - + + + - + - - - - - - - - - - - - - - + + + + + + + - - { - this.options = res - }) }, methods: { getMenuDatas(node, resolve) { diff --git a/nladmin-ui/src/views/system/user/index.vue b/nladmin-ui/src/views/system/user/index.vue index 2bc99ba..62c5b42 100644 --- a/nladmin-ui/src/views/system/user/index.vue +++ b/nladmin-ui/src/views/system/user/index.vue @@ -2,7 +2,7 @@
- +
- +
@@ -143,52 +143,43 @@ @selection-change="crud.selectionChangeHandler" > - - - - - - - - - - - - + + + + + + + + -