From ce39fd6f0b2a474ee120f309af6ae42567a0feec Mon Sep 17 00:00:00 2001 From: dell3501 <84315016@qq.com> Date: Mon, 21 Oct 2024 21:42:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=9A=E5=88=86=E9=85=8D=E5=8A=9F=E8=83=BD=E5=92=8C?= =?UTF-8?q?=E5=88=86=E9=85=8D=E6=8C=89=E9=92=AE=E7=AA=97=E5=8F=A3=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=A2=9E=E5=8A=A0=E8=A7=92=E8=89=B2=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserBusinessController.java | 12 ++++++++++ jshERP-web/src/views/system/RoleList.vue | 22 ++++++++++++++----- .../system/modules/RoleFunctionModal.vue | 3 ++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/UserBusinessController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/UserBusinessController.java index 8fcfc3da2..80d51d985 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/UserBusinessController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/UserBusinessController.java @@ -1,7 +1,9 @@ package com.jsh.erp.controller; import com.alibaba.fastjson.JSONObject; +import com.jsh.erp.datasource.entities.Role; import com.jsh.erp.datasource.entities.UserBusiness; +import com.jsh.erp.service.role.RoleService; import com.jsh.erp.service.userBusiness.UserBusinessService; import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.ErpInfo; @@ -9,6 +11,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -31,6 +34,9 @@ public class UserBusinessController { @Resource private UserBusinessService userBusinessService; + @Resource + private RoleService roleService; + /** * 获取信息 * @param keyId @@ -75,6 +81,12 @@ public class UserBusinessController { Map objectMap = new HashMap(); Long id = userBusinessService.checkIsValueExist(type, keyId); objectMap.put("id", id); + if("RoleFunctions".equals(type)){ + List roles = roleService.getRoleListByIds(keyId); + if(!CollectionUtils.isEmpty(roles)){ + objectMap.put("name", roles.get(0).getName()); + } + } return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); } diff --git a/jshERP-web/src/views/system/RoleList.vue b/jshERP-web/src/views/system/RoleList.vue index 99e3ed2f8..c76a21d2c 100644 --- a/jshERP-web/src/views/system/RoleList.vue +++ b/jshERP-web/src/views/system/RoleList.vue @@ -50,7 +50,7 @@ 分配功能 - 分配按钮 + 分配按钮 编辑 @@ -115,6 +115,7 @@ roleModalVisible: false, roleFunctionModalVisible: false, currentRoleId: '', + currentRoleName: '', labelCol: { span: 5 }, @@ -181,12 +182,20 @@ methods: { handleSetFunction(record) { this.$refs.roleFunctionModal.edit(record); - this.$refs.roleFunctionModal.title = "分配功能【分配之后请继续分配按钮】"; + if(record.name){ + this.$refs.roleFunctionModal.title = "为角色<" + record.name + ">分配功能【分配之后请继续分配按钮】"; + }else{ + this.$refs.roleFunctionModal.title = "分配功能【分配之后请继续分配按钮】"; + } this.$refs.roleFunctionModal.disableSubmit = false; }, - handleSetPushBtn(roleId) { + handleSetPushBtn(roleId,name) { this.$refs.rolePushBtnModal.edit(roleId); - this.$refs.rolePushBtnModal.title = "分配按钮"; + if(name){ + this.$refs.rolePushBtnModal.title = "为角色<" + name + ">分配按钮"; + }else{ + this.$refs.rolePushBtnModal.title = "分配按钮"; + } this.$refs.rolePushBtnModal.disableSubmit = false; }, roleModalFormOk() { @@ -194,11 +203,12 @@ this.loadData() this.roleModalVisible = true }, - roleFunctionModalFormOk(id) { + roleFunctionModalFormOk(id,name) { //重载列表 this.loadData() this.roleFunctionModalVisible = true this.currentRoleId = id + this.currentRoleName = name }, handleRoleTip(record) { if(record) { @@ -209,7 +219,7 @@ handleRoleFunctionTip() { if(this.currentRoleId) { this.roleFunctionModalVisible = false - this.handleSetPushBtn(this.currentRoleId) + this.handleSetPushBtn(this.currentRoleId, this.currentRoleName) } }, handleAdd: function () { diff --git a/jshERP-web/src/views/system/modules/RoleFunctionModal.vue b/jshERP-web/src/views/system/modules/RoleFunctionModal.vue index b57a243b3..d931bfd2f 100644 --- a/jshERP-web/src/views/system/modules/RoleFunctionModal.vue +++ b/jshERP-web/src/views/system/modules/RoleFunctionModal.vue @@ -115,13 +115,14 @@ checkUserBusiness({'type': 'RoleFunctions','keyId': this.roleId}).then((res)=>{ if(res.data && res.data.id) { formData.id=res.data.id + formData.name=res.data.name obj=editUserBusiness(formData); } else { obj=addUserBusiness(formData); } obj.then((res)=>{ if(res.code === 200){ - that.$emit('ok', this.roleId); + that.$emit('ok', this.roleId, this.model.name); }else{ that.$message.warning(res.data.message); }