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; }