This commit is contained in:
齐天大圣 2024-03-29 16:58:57 +08:00
parent bc01b68b65
commit efa9d6057f
4 changed files with 91 additions and 8 deletions

View File

@ -26,6 +26,14 @@ export function treeselect(params) {
})
}
export function treeselects(params) {
return request({
url: 'backendApi/source/treeselects',
method: 'get',
params: params
})
}
// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
return request({

View File

@ -152,7 +152,7 @@
<script>
import {dutyDelete, dutyEdit, dutyList} from "@/api/duty/duty";
import {addRole, getRole, updateRole} from "@/api/system/role";
import {treeselect} from "@/api/system/menu";
import {treeselects} from "@/api/system/menu";
export default {
data(){
@ -197,10 +197,10 @@ export default {
changeMenu(){
console.log(this.form1.roleType)
if (this.form1.roleType == '4'){
this.getMenuTreeselect(2);
this.getMenuTreeselect();
}
if (this.form1.roleType == '3'){
this.getMenuTreeselect(1);
this.getMenuTreeselect();
}
},
//
@ -280,13 +280,13 @@ export default {
},
handleAdd1(){
this.reset1();
this.getMenuTreeselect(3);
this.getMenuTreeselect();
this.openDuty = true;
this.title = "添加角色";
},
//
getMenuTreeselect(merchantId) {
return treeselect({merchantId:merchantId}).then(response => {
getMenuTreeselect() {
return treeselects().then(response => {
this.menuOptions = response.data;
return response
});
@ -305,7 +305,7 @@ export default {
let val = null;
if (data.dutyType == '3') val = 1;
if (data.dutyType == '4') val = 2;
const roleMenu = this.getMenuTreeselect(val);
const roleMenu = this.getMenuTreeselect();
const roleId = data.dutyId
getRole(roleId).then(response => {
this.form1.roleName = response.data.roleInfo.name;

View File

@ -391,11 +391,14 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
@Override
public LJStaff selectStaffByStoreId(int storeId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id",storeId);
queryWrapper.eq("status","qy");
queryWrapper.eq("if_delete","0");
queryWrapper.eq("role_id","12");
//queryWrapper.eq("role_id","12");
queryWrapper.orderByAsc("create_time");
List<LJStaff> list = baseMapper.selectList(queryWrapper);
LJStaff staff = null;

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.fuint.common.domain.TreeNode;
import com.fuint.common.domain.TreeSelect;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.RoleDto;
import com.fuint.common.dto.SourceDto;
import com.fuint.common.enums.StatusEnum;
import com.fuint.common.service.SourceService;
@ -14,6 +15,8 @@ import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import com.fuint.repository.model.TAccount;
import com.fuint.repository.model.TSource;
import com.fuint.system.role.entity.TDuty;
import com.fuint.system.role.service.DutyService;
import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -22,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -249,6 +254,8 @@ public class BackendSourceController extends BaseController {
return getSuccessResult(true);
}
@Autowired
private DutyService tDutyService;
/**
* 获取菜单下拉树列表
* */
@ -269,5 +276,70 @@ public class BackendSourceController extends BaseController {
List<TreeSelect> data = sourceService.buildMenuTreeSelect(sources);
return getSuccessResult(data);
/*String token = request.getHeader("Access-Token");
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
TDuty htDuty = tDutyService.getRoleById(Long.parseLong(accountInfo.getRoleIds()));
Map<String, Object> result = new HashMap<>();
RoleDto roleInfo = new RoleDto();
roleInfo.setMerchantId(htDuty.getStoreId());
roleInfo.setId(htDuty.getDutyId().longValue());
roleInfo.setName(htDuty.getDutyName());
roleInfo.setType(htDuty.getDutyType());
roleInfo.setStatus(htDuty.getStatus());
roleInfo.setDescription(htDuty.getDescription());
result.put("roleInfo", roleInfo);
return getSuccessResult(result);*/
}
/**
* 获取菜单下拉树列表
* */
@ApiOperation(value = "获取菜单下拉树列表")
@RequestMapping(value = "/treeselects", method = RequestMethod.GET)
public ResponseObject treeselects(HttpServletRequest request) {
String token = request.getHeader("Access-Token");
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
if (accountInfo == null) {
return getFailureResult(1001, "请先登录");
}
List<Long> checkedKeys = tDutyService.getSourceIdsByDutyId(Integer.parseInt(accountInfo.getRoleIds()));
ArrayList<TreeNode> longArrayList = new ArrayList<>();
List<TreeNode> sources = sSourceService.getSourceTree(null);
for (TreeNode source : sources) {
for (Long checkedKey : checkedKeys) {
if (source.getId() == checkedKey) {
longArrayList.add(source);
}
}
}
List<TreeSelect> data = sourceService.buildMenuTreeSelect(longArrayList);
return getSuccessResult(data);
/*String token = request.getHeader("Access-Token");
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
TDuty htDuty = tDutyService.getRoleById(Long.parseLong(accountInfo.getRoleIds()));
Map<String, Object> result = new HashMap<>();
RoleDto roleInfo = new RoleDto();
roleInfo.setMerchantId(htDuty.getStoreId());
roleInfo.setId(htDuty.getDutyId().longValue());
roleInfo.setName(htDuty.getDutyName());
roleInfo.setType(htDuty.getDutyType());
roleInfo.setStatus(htDuty.getStatus());
roleInfo.setDescription(htDuty.getDescription());
result.put("roleInfo", roleInfo);
return getSuccessResult(result);*/
}
}