This commit is contained in:
cun-nan 2024-03-18 17:40:39 +08:00
parent c4dda44f15
commit c25d20b87b
9 changed files with 66 additions and 8 deletions

View File

@ -70,7 +70,11 @@
<el-table-column label="角色类型" prop="type" :show-overflow-tooltip="true" width="200" />
<el-table-column label="状态" align="center" width="200">
<template slot-scope="scope">
<span v-if="roleList.length==3">
{{scope.row.status=='A'?'启用':'禁用'}}
</span>
<el-switch
v-else
v-model="scope.row.status"
active-value="A"
inactive-value="N"
@ -110,22 +114,23 @@
<el-dialog :title="title" :visible.sync="open" width="700px" class="common-dialog" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="角色名称" prop="roleName">
<el-input v-model="form.roleName" style="width: 300px" placeholder="请输入角色名称" />
<el-input :disabled="roleList.length==3" v-model="form.roleName" style="width: 300px" placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="角色类型" prop="roleType">
<el-select
:disabled="roleList.length==3"
v-model="form.roleType"
placeholder="角色类型"
style="width: 300px"
>
<el-option key="1" label="超级管理员" value="1"/>
<el-option key="2" label="普通管理员" value="2"/>
<!-- <el-option key="3" label="用户角色" value="3"/> -->
<el-option key="3" label="员工角色" value="3"/>
<el-option key="3" label="用户角色" value="3"/>
<el-option key="4" label="员工角色" value="4"/>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio-group v-model="form.status" :disabled="roleList.length==3">
<el-radio key="A" label="A" value="A">启用</el-radio>
<el-radio key="N" label="N" value="N">禁用</el-radio>
</el-radio-group>

View File

@ -9,7 +9,8 @@ package com.fuint.common.enums;
public enum AdminRoleEnum {
ADMIN("1", "超级管理员","admin"),
COMMON("2", "普通管理员","common"),
USER("3", "用户角色","user");
USER("3", "用户角色","user"),
STAFF("4", "员工角色","staff");
private String key;
private String name;

View File

@ -23,6 +23,13 @@ public interface SourceService extends IService<TSource> {
*/
List<TSource> getAvailableSources(Integer merchantId);
/**
* 获取有效的菜单集合
*
* @return
*/
List<TSource> getAvailableSources1(Integer merchantId);
/**
* 获取菜单的属性结构
*

View File

@ -2,8 +2,10 @@ package com.fuint.common.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.common.domain.TreeSelect;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.enums.StatusEnum;
import com.fuint.common.service.SourceService;
import com.fuint.common.util.TokenUtil;
import com.fuint.common.vo.MetaVo;
import com.fuint.common.vo.RouterVo;
import com.fuint.framework.annoation.OperationServiceLog;
@ -42,6 +44,11 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
return tSourceMapper.findByStatus(merchantId, StatusEnum.ENABLED.getKey());
}
@Override
public List<TSource> getAvailableSources1(Integer merchantId) {
return tSourceMapper.findByStatus1(merchantId, StatusEnum.ENABLED.getKey());
}
/**
* 获取菜单的属性结构
*
@ -49,7 +56,9 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
*/
@Override
public List<TreeNode> getSourceTree(Integer merchantId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<TSource> tSources = getAvailableSources(merchantId);
if (nowAccountInfo.getRoleIds().equals("14")) tSources = getAvailableSources1(1);
List<TreeNode> trees = new ArrayList<>();
if (tSources != null && tSources.size() > 0) {
TreeNode sourceTreeNode = null;
@ -100,7 +109,7 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
@Override
public List<TSource> getMenuListByUserId(Integer merchantId, Integer accountId) {
if (merchantId == null) {
merchantId = 0;
merchantId = 1;
}
List<TSource> sourceList = tSourceMapper.findSourcesByAccountId(merchantId, accountId);
return delRepeated(sourceList);

View File

@ -86,6 +86,7 @@ public class BackendDutyController extends BaseController {
}
paginationRequest.setSearchParams(searchParams);
paginationRequest.setRoleIds(accountInfo.getRoleIds());
PaginationResponse<TDuty> paginationResponse = tDutyService.findDutiesByPagination(paginationRequest);
List<RoleDto> content = new ArrayList<>();
if (paginationResponse.getContent().size() > 0) {

View File

@ -252,7 +252,17 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
}
lambdaQueryWrapper.orderByDesc(TDuty::getDutyId);
List<TDuty> dataList = tDutyMapper.selectList(lambdaQueryWrapper);
List<TDuty> dataList1 = tDutyMapper.selectList(lambdaQueryWrapper);
List<TDuty> dataList = new ArrayList<>();
if (paginationRequest.getRoleIds().equals("14")){
for (TDuty tDuty : dataList1) {
if (tDuty.getDutyId()==12) dataList.add(tDuty);
if (tDuty.getDutyId()==15) dataList.add(tDuty);
if (tDuty.getDutyId()==16) dataList.add(tDuty);
}
}else {
dataList = dataList1;
}
PageRequest pageRequest = PageRequest.of(paginationRequest.getCurrentPage(), paginationRequest.getPageSize());
PageImpl pageImpl = new PageImpl(dataList, pageRequest, pageHelper.getTotal());

View File

@ -1,5 +1,7 @@
package com.fuint.framework.pagination;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
@ -9,6 +11,7 @@ import java.util.Map;
* Created by FSQ
* CopyRight https://www.fuint.cn
*/
@Data
public class PaginationRequest implements Serializable {
/** */
@ -33,6 +36,10 @@ public class PaginationRequest implements Serializable {
* 分页查询参数
*/
private Map<String, Object> searchParams;
/**
* 角色id
*/
private String roleIds;
public int getCurrentPage() {
return currentPage;

View File

@ -19,4 +19,6 @@ public interface TSourceMapper extends BaseMapper<TSource> {
List<TSource> findByStatus(@Param("merchantId") Integer merchantId, @Param("status") String status);
List<TSource> findByStatus1(@Param("merchantId") Integer merchantId, @Param("status") String status);
}

View File

@ -2,7 +2,15 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.repository.mapper.TSourceMapper">
<select id="findSourcesByAccountId" resultType="com.fuint.repository.model.TSource">
SELECT s.* FROM `t_source` s WHERE s.status='A' AND (s.merchant_id = 0 OR s.merchant_id = #{merchantId}) AND source_id IN(SELECT source_id FROM `t_duty_source` WHERE duty_id IN(SELECT duty_id FROM `t_account_duty` WHERE acct_id = #{accountId})) ORDER BY s.source_style ASC
SELECT s.* FROM `t_source` s
WHERE s.status='A'
<if test="merchantId != null and merchantId > 0">
AND (s.merchant_id = 0 OR s.merchant_id = #{merchantId})
</if>
AND source_id IN(SELECT source_id FROM `t_duty_source`
WHERE duty_id IN(SELECT duty_id FROM `t_account_duty`
WHERE acct_id = #{accountId}))
ORDER BY s.source_style ASC
</select>
<select id="findByIdIn" resultType="com.fuint.repository.model.TSource">
@ -21,4 +29,12 @@
</if>
order by source_style asc
</select>
<select id="findByStatus1" resultType="com.fuint.repository.model.TSource">
select * from t_source s
where s.status = #{status}
<if test="merchantId != null and merchantId > 0">
and s.merchant_id = #{merchantId}
</if>
order by source_style asc
</select>
</mapper>