From fa6105963a731de766cb232423735c2aff8d2aba Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Mon, 6 Nov 2023 17:13:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?(*)=20=E6=9C=8D=E5=8A=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E6=9C=8D=E5=8A=A1=E6=9F=A5=E7=9C=8B=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/serviceManagement.js | 43 +++++++++++++++++-- .../src/sections/dataService/nav-item.js | 8 ++-- web/client/src/utils/func.js | 4 +- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/web/client/src/sections/dataService/containers/serviceManagement.js b/web/client/src/sections/dataService/containers/serviceManagement.js index 9aeffcf..b247be1 100644 --- a/web/client/src/sections/dataService/containers/serviceManagement.js +++ b/web/client/src/sections/dataService/containers/serviceManagement.js @@ -8,9 +8,9 @@ import { Tabs, Form, Input, Space, Button, Table, Popconfirm, message } from 'an const { Search } = Input; import EditModal from '../components/editModal'; +import ResourceModal from '../components/resourceModal'; - -function ServiceManagement({ loading, clientHeight, actions, dispatch, }) { +function ServiceManagement({ loading, clientHeight, actions, dispatch, user }) { const { dataService } = actions const [query, setQuery] = useState({ page: 0, limit: 10 }); @@ -19,6 +19,7 @@ function ServiceManagement({ loading, clientHeight, actions, dispatch, }) { const [keyword, setKeyword] = useState() const [tableList, setTableList] = useState({ rows: [], count: 0 }); const [viewDetails, setViewDetails] = useState(false) + const [resourceModal, setResourceModal] = useState(false) useEffect(() => { resourceData() @@ -110,7 +111,30 @@ function ServiceManagement({ loading, clientHeight, actions, dispatch, }) { }) }}>启用 } + {!isCurrentOrg && { + let result + record?.resourceConsumptions + ?.filter(v => v.applyBy == user?.id) + ?.map(v => { + if (result != '已有申请成功的资源' && result != '资源审批中') { + if (v.token) { + result = '已有申请成功的资源' + } else if (v.approveState == '审批中') { + result = '资源审批中' + } + } + }) + if (result) { + message.warning({ + duration: 1, + content: result, + }) + } else { + setEditData(record) + setResourceModal(true) + } + }}>申请资源} } }, @@ -173,7 +197,20 @@ function ServiceManagement({ loading, clientHeight, actions, dispatch, }) { } /> : "" } - + { + resourceModal ? + { + setResourceModal(false); + setEditData({}) + }} + success={() => { + resourceData({ limit: 10, page: 0, keyword }) + } + } + /> : "" + } } diff --git a/web/client/src/sections/dataService/nav-item.js b/web/client/src/sections/dataService/nav-item.js index ae5192c..ae89e48 100644 --- a/web/client/src/sections/dataService/nav-item.js +++ b/web/client/src/sections/dataService/nav-item.js @@ -8,12 +8,12 @@ export function getNavItem(user) { return ( } title='数据服务'> - {user?.role == '系统管理员' && + 服务管理 - } - { + + {/* 服务查看 - } + */} ); } \ No newline at end of file diff --git a/web/client/src/utils/func.js b/web/client/src/utils/func.js index ac049ab..4a6abd9 100644 --- a/web/client/src/utils/func.js +++ b/web/client/src/utils/func.js @@ -12,8 +12,8 @@ export default class Func { static isOrgOrSuperAdmin(id) { if (JSON.parse(sessionStorage.getItem('user'))) { - const { username, orgId } = JSON.parse(sessionStorage.getItem('user')); - return username == 'SuperAdmin' || orgId == id; + const { username, orgId, role } = JSON.parse(sessionStorage.getItem('user')); + return username == 'SuperAdmin' || (orgId == id && role === '系统管理员'); } else { return false; } From 6fd767127473d678abed94da18a5583b1e90a42c Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Mon, 6 Nov 2023 17:44:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?(fix)=20=E5=85=83=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=A1=A8=E7=94=B3=E8=AF=B7=E5=A4=B1=E8=B4=A5=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E9=87=8D=E6=96=B0=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/metadataManagement/containers/databasesTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/metadataManagement/containers/databasesTable.js b/web/client/src/sections/metadataManagement/containers/databasesTable.js index 2099041..e94d3e2 100644 --- a/web/client/src/sections/metadataManagement/containers/databasesTable.js +++ b/web/client/src/sections/metadataManagement/containers/databasesTable.js @@ -179,7 +179,7 @@ const DatabaseTable = (props) => { width: '8%', render: (text, record) => { let resourceApplicationsRecords = metadataResourceApplications.filter(ra => - ra.applyBy == user.id && ra.resourceName === record.name && ra.resourceId == record.id); + ra.applyBy == user.id && ra.resourceName === record.name && ra.resourceId == record.id && !ra.approveRemarks); return onView(record)}>查看 {!isAdmin ? null :