!93 回退 'Pull Request !92 : 角色管理页面:分配功能和分配按钮窗口标题增加角色名'

Merge pull request !93 from 季圣华/revert-merge-92-master
This commit is contained in:
季圣华
2024-11-01 15:58:58 +00:00
committed by Gitee
3 changed files with 7 additions and 30 deletions

View File

@@ -1,9 +1,7 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.datasource.entities.UserBusiness; 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.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.ErpInfo; import com.jsh.erp.utils.ErpInfo;
@@ -11,7 +9,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -34,9 +31,6 @@ public class UserBusinessController {
@Resource @Resource
private UserBusinessService userBusinessService; private UserBusinessService userBusinessService;
@Resource
private RoleService roleService;
/** /**
* 获取信息 * 获取信息
* @param keyId * @param keyId
@@ -81,12 +75,6 @@ public class UserBusinessController {
Map<String, Object> objectMap = new HashMap<String, Object>(); Map<String, Object> objectMap = new HashMap<String, Object>();
Long id = userBusinessService.checkIsValueExist(type, keyId); Long id = userBusinessService.checkIsValueExist(type, keyId);
objectMap.put("id", id); objectMap.put("id", id);
if("RoleFunctions".equals(type)){
List<Role> roles = roleService.getRoleListByIds(keyId);
if(!CollectionUtils.isEmpty(roles)){
objectMap.put("name", roles.get(0).getName());
}
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} }

View File

@@ -50,7 +50,7 @@
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleSetFunction(record)">分配功能</a> <a @click="handleSetFunction(record)">分配功能</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="handleSetPushBtn(record.id, record.name)">分配按钮</a> <a @click="handleSetPushBtn(record.id)">分配按钮</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" /> <a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
@@ -115,7 +115,6 @@
roleModalVisible: false, roleModalVisible: false,
roleFunctionModalVisible: false, roleFunctionModalVisible: false,
currentRoleId: '', currentRoleId: '',
currentRoleName: '',
labelCol: { labelCol: {
span: 5 span: 5
}, },
@@ -182,20 +181,12 @@
methods: { methods: {
handleSetFunction(record) { handleSetFunction(record) {
this.$refs.roleFunctionModal.edit(record); this.$refs.roleFunctionModal.edit(record);
if(record.name){ this.$refs.roleFunctionModal.title = "分配功能分配之后请继续分配按钮";
this.$refs.roleFunctionModal.title = "为角色<" + record.name + ">分配功能分配之后请继续分配按钮";
}else{
this.$refs.roleFunctionModal.title = "分配功能分配之后请继续分配按钮";
}
this.$refs.roleFunctionModal.disableSubmit = false; this.$refs.roleFunctionModal.disableSubmit = false;
}, },
handleSetPushBtn(roleId,name) { handleSetPushBtn(roleId) {
this.$refs.rolePushBtnModal.edit(roleId); this.$refs.rolePushBtnModal.edit(roleId);
if(name){ this.$refs.rolePushBtnModal.title = "分配按钮";
this.$refs.rolePushBtnModal.title = "为角色<" + name + ">分配按钮";
}else{
this.$refs.rolePushBtnModal.title = "分配按钮";
}
this.$refs.rolePushBtnModal.disableSubmit = false; this.$refs.rolePushBtnModal.disableSubmit = false;
}, },
roleModalFormOk() { roleModalFormOk() {
@@ -203,12 +194,11 @@
this.loadData() this.loadData()
this.roleModalVisible = true this.roleModalVisible = true
}, },
roleFunctionModalFormOk(id,name) { roleFunctionModalFormOk(id) {
//重载列表 //重载列表
this.loadData() this.loadData()
this.roleFunctionModalVisible = true this.roleFunctionModalVisible = true
this.currentRoleId = id this.currentRoleId = id
this.currentRoleName = name
}, },
handleRoleTip(record) { handleRoleTip(record) {
if(record) { if(record) {
@@ -219,7 +209,7 @@
handleRoleFunctionTip() { handleRoleFunctionTip() {
if(this.currentRoleId) { if(this.currentRoleId) {
this.roleFunctionModalVisible = false this.roleFunctionModalVisible = false
this.handleSetPushBtn(this.currentRoleId, this.currentRoleName) this.handleSetPushBtn(this.currentRoleId)
} }
}, },
handleAdd: function () { handleAdd: function () {

View File

@@ -115,14 +115,13 @@
checkUserBusiness({'type': 'RoleFunctions','keyId': this.roleId}).then((res)=>{ checkUserBusiness({'type': 'RoleFunctions','keyId': this.roleId}).then((res)=>{
if(res.data && res.data.id) { if(res.data && res.data.id) {
formData.id=res.data.id formData.id=res.data.id
formData.name=res.data.name
obj=editUserBusiness(formData); obj=editUserBusiness(formData);
} else { } else {
obj=addUserBusiness(formData); obj=addUserBusiness(formData);
} }
obj.then((res)=>{ obj.then((res)=>{
if(res.code === 200){ if(res.code === 200){
that.$emit('ok', this.roleId, this.model.name); that.$emit('ok', this.roleId);
}else{ }else{
that.$message.warning(res.data.message); that.$message.warning(res.data.message);
} }