From 77dbb08f9cbf0618e3090ee70a7241ef0b14451b Mon Sep 17 00:00:00 2001 From: jl-zhoujl2 Date: Sun, 23 Apr 2023 16:35:29 +0800 Subject: [PATCH] =?UTF-8?q?4.23=20=E9=A1=B9=E7=9B=AE=E7=9B=91=E7=9D=A3?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=99=90=E5=88=B6=E7=89=B9=E6=AE=8A=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E8=B5=8B=E4=BA=88=E5=85=AC=E5=BC=80=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Supervision/components/FavoritesList.tsx | 8 +++++--- .../Supervision/components/ProjectManage.tsx | 8 +++++--- .../ProjectManage/Supervision/index.tsx | 20 ++++++++++++++++--- .../ProjectManage/Supervision/service.ts | 12 +++++++++++ 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx b/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx index 6dd2b9e..eaa9387 100644 --- a/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx +++ b/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx @@ -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 = (props) => { - const { projectName, bidMethodDict, current, businessModule, isPublic, tabs } = props + const { projectName, bidMethodDict, current, businessModule, isPublic, tabs, publicShow } = props const [spin, spinSet] = useState(false); //查询分页数据 @@ -122,7 +123,8 @@ const FavoritesList: React.FC = (props) => { }, }, initialValue: tabs === 'favoritesList' ? isNotEmpty(isPublic) ? isPublic : null : null, - + hideInSearch: !publicShow, + hideInTable: !publicShow, }, { title: '操作', @@ -265,7 +267,7 @@ const FavoritesList: React.FC = (props) => { }} onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }} rowKey={"id"} - rowSelection={{ + rowSelection={publicShow && { columnWidth: '1px', fixed: true, selectedRowKeys: selectedRows, diff --git a/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx b/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx index d748899..a9c5a0c 100644 --- a/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx +++ b/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx @@ -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 = (props) => { - const { projectName, bidMethodDict, current, businessModule, isPublic, tabs } = props + const { projectName, bidMethodDict, current, businessModule, isPublic, tabs, publicShow } = props const [spin, spinSet] = useState(false); //查询分页数据 @@ -108,7 +109,8 @@ const ProjectManage: React.FC = (props) => { }, }, initialValue: tabs === 'projectList' ? isNotEmpty(isPublic) ? isPublic : null : null, - + hideInSearch: !publicShow, + hideInTable: !publicShow, }, { title: '操作', @@ -219,7 +221,7 @@ const ProjectManage: React.FC = (props) => { }} onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }} rowKey={"id"} - rowSelection={{ + rowSelection={publicShow && { columnWidth: '1px', fixed: true, selectedRowKeys: selectedRows, diff --git a/src/pages/Project/ProjectManage/Supervision/index.tsx b/src/pages/Project/ProjectManage/Supervision/index.tsx index 4669b8d..8d9e33e 100644 --- a/src/pages/Project/ProjectManage/Supervision/index.tsx +++ b/src/pages/Project/ProjectManage/Supervision/index.tsx @@ -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(isNotEmpty(tabs) ? String(tabs) : 'projectList'); + //show public true-展示 false-不展示 + const [publicShow, setPublicShow] = useState(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 ( @@ -36,9 +50,9 @@ const Index: React.FC<{}> = () => { { mode === 'projectList' ? ( - + ) : ( - + ) } diff --git a/src/pages/Project/ProjectManage/Supervision/service.ts b/src/pages/Project/ProjectManage/Supervision/service.ts index d2c6462..49e617c 100644 --- a/src/pages/Project/ProjectManage/Supervision/service.ts +++ b/src/pages/Project/ProjectManage/Supervision/service.ts @@ -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 + }); } \ No newline at end of file