Merge branch '20230423-项目监督管理限制特殊账号赋予公开项目权限' into 'master'

4.23 项目监督管理限制特殊账号赋予公开项目权限

See merge request eshop/fe_service_ebtp_frontend!217
This commit is contained in:
jl-zhoujl2
2023-04-25 00:44:29 +00:00
4 changed files with 39 additions and 9 deletions

View File

@ -13,6 +13,7 @@ interface FavoritesListProps {
isPublic?: string | null,
current?: string | null,
tabs: string | null,
publicShow: boolean,
}
/**
* 监督项目收藏列表
@ -20,7 +21,7 @@ interface FavoritesListProps {
* @returns
*/
const FavoritesList: React.FC<FavoritesListProps> = (props) => {
const { projectName, bidMethodDict, current, businessModule, isPublic, tabs } = props
const { projectName, bidMethodDict, current, businessModule, isPublic, tabs, publicShow } = props
const [spin, spinSet] = useState<boolean>(false);
//查询分页数据
@ -122,7 +123,8 @@ const FavoritesList: React.FC<FavoritesListProps> = (props) => {
},
},
initialValue: tabs === 'favoritesList' ? isNotEmpty(isPublic) ? isPublic : null : null,
hideInSearch: !publicShow,
hideInTable: !publicShow,
},
{
title: '操作',
@ -265,7 +267,7 @@ const FavoritesList: React.FC<FavoritesListProps> = (props) => {
}}
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
rowKey={"id"}
rowSelection={{
rowSelection={publicShow && {
columnWidth: '1px',
fixed: true,
selectedRowKeys: selectedRows,

View File

@ -13,6 +13,7 @@ interface ProjectManageProps {
businessModule?: string | null,
isPublic?: string | null,
tabs: string | null,
publicShow: boolean,
}
/**
* 项目管理列表
@ -20,7 +21,7 @@ interface ProjectManageProps {
* @returns
*/
const ProjectManage: React.FC<ProjectManageProps> = (props) => {
const { projectName, bidMethodDict, current, businessModule, isPublic, tabs } = props
const { projectName, bidMethodDict, current, businessModule, isPublic, tabs, publicShow } = props
const [spin, spinSet] = useState<boolean>(false);
//查询分页数据
@ -108,7 +109,8 @@ const ProjectManage: React.FC<ProjectManageProps> = (props) => {
},
},
initialValue: tabs === 'projectList' ? isNotEmpty(isPublic) ? isPublic : null : null,
hideInSearch: !publicShow,
hideInTable: !publicShow,
},
{
title: '操作',
@ -219,7 +221,7 @@ const ProjectManage: React.FC<ProjectManageProps> = (props) => {
}}
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
rowKey={"id"}
rowSelection={{
rowSelection={publicShow && {
columnWidth: '1px',
fixed: true,
selectedRowKeys: selectedRows,

View File

@ -1,8 +1,10 @@
import { getURLInformation, getUrlParam, isNotEmpty } from '@/utils/CommonUtils';
import { Card, Radio } from 'antd';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import FavoritesList from './components/FavoritesList';
import ProjectManage from './components/ProjectManage';
import { getSessionRoleData, getSessionUserData } from '@/utils/session';
import { isViewPublic } from './service';
/**
* 监督项目管理
* @returns
@ -22,11 +24,23 @@ const Index: React.FC<{}> = () => {
const tabs = getURLInformation("tabs");
//radio value
const [mode, setMode] = useState<string>(isNotEmpty(tabs) ? String(tabs) : 'projectList');
//show public true-展示 false-不展示
const [publicShow, setPublicShow] = useState<boolean>(false);
const handleModeChange = (e: any) => {
const mode = e.target.value;
setMode(mode);
};
const showPublic = async () => {
const userId = getSessionUserData().userId;
const roleCode = getSessionRoleData().roleCode;
const params = { key: userId, role: roleCode };
const result = await isViewPublic(params);
setPublicShow(result?.data);
}
useEffect(() => {
showPublic();
}, [])
return (
<Card style={{ borderRadius: 6 }} bodyStyle={{ padding: '16px 24px 0px' }}>
@ -36,9 +50,9 @@ const Index: React.FC<{}> = () => {
</Radio.Group>
{
mode === 'projectList' ? (
<ProjectManage projectName={projectName} bidMethodDict={bidMethodDict} current={current} businessModule={businessModule} isPublic={isPublic} tabs={tabs} />
<ProjectManage projectName={projectName} bidMethodDict={bidMethodDict} current={current} businessModule={businessModule} isPublic={isPublic} tabs={tabs} publicShow={publicShow} />
) : (
<FavoritesList projectName={projectName} bidMethodDict={bidMethodDict} current={current} businessModule={businessModule} isPublic={isPublic} tabs={tabs} />
<FavoritesList projectName={projectName} bidMethodDict={bidMethodDict} current={current} businessModule={businessModule} isPublic={isPublic} tabs={tabs} publicShow={publicShow} />
)
}
</Card>

View File

@ -52,4 +52,16 @@ export async function toPublic(params: any) {
method: 'POST',
data: params,
});
}
/**
* 是否展示公开项目
* @param params
* @returns
*/
export async function isViewPublic(params: any) {
return request('/api/biz-service-ebtp-extend/v1/userswitch/findUser', {
method: 'POST',
params
});
}