peng.peng 12 months ago
parent
commit
cd981274cd
  1. 43
      web/client/src/sections/dataService/containers/serviceManagement.js
  2. 8
      web/client/src/sections/dataService/nav-item.js
  3. 2
      web/client/src/sections/metadataManagement/containers/databasesTable.js
  4. 4
      web/client/src/utils/func.js

43
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; const { Search } = Input;
import EditModal from '../components/editModal'; import EditModal from '../components/editModal';
import ResourceModal from '../components/resourceModal';
function ServiceManagement({ loading, clientHeight, actions, dispatch, user }) {
function ServiceManagement({ loading, clientHeight, actions, dispatch, }) {
const { dataService } = actions const { dataService } = actions
const [query, setQuery] = useState({ page: 0, limit: 10 }); const [query, setQuery] = useState({ page: 0, limit: 10 });
@ -19,6 +19,7 @@ function ServiceManagement({ loading, clientHeight, actions, dispatch, }) {
const [keyword, setKeyword] = useState() const [keyword, setKeyword] = useState()
const [tableList, setTableList] = useState({ rows: [], count: 0 }); const [tableList, setTableList] = useState({ rows: [], count: 0 });
const [viewDetails, setViewDetails] = useState(false) const [viewDetails, setViewDetails] = useState(false)
const [resourceModal, setResourceModal] = useState(false)
useEffect(() => { useEffect(() => {
resourceData() resourceData()
@ -110,7 +111,30 @@ function ServiceManagement({ loading, clientHeight, actions, dispatch, }) {
}) })
}}>启用</a> }}>启用</a>
} }
{!isCurrentOrg && <a onClick={() => {
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)
}
}}>申请资源</a>}
</div > </div >
} }
}, },
@ -173,7 +197,20 @@ function ServiceManagement({ loading, clientHeight, actions, dispatch, }) {
} }
/> : "" /> : ""
} }
{
resourceModal ?
<ResourceModal
editData={editData}
close={() => {
setResourceModal(false);
setEditData({})
}}
success={() => {
resourceData({ limit: 10, page: 0, keyword })
}
}
/> : ""
}
</> </>
} }

8
web/client/src/sections/dataService/nav-item.js

@ -8,12 +8,12 @@ export function getNavItem(user) {
return ( return (
<SubMenu key="dataService" icon={<CarryOutOutlined />} title='数据服务'> <SubMenu key="dataService" icon={<CarryOutOutlined />} title='数据服务'>
{user?.role == '系统管理员' && <Menu.Item key="serviceManagement"> <Menu.Item key="serviceManagement">
<Link to="/dataService/serviceManagement">服务管理</Link> <Link to="/dataService/serviceManagement">服务管理</Link>
</Menu.Item>} </Menu.Item>
{<Menu.Item key="serviceView"> {/* <Menu.Item key="serviceView">
<Link to="/dataService/serviceView">服务查看</Link> <Link to="/dataService/serviceView">服务查看</Link>
</Menu.Item>} </Menu.Item> */}
</ SubMenu > </ SubMenu >
); );
} }

2
web/client/src/sections/metadataManagement/containers/databasesTable.js

@ -179,7 +179,7 @@ const DatabaseTable = (props) => {
width: '8%', width: '8%',
render: (text, record) => { render: (text, record) => {
let resourceApplicationsRecords = metadataResourceApplications.filter(ra => 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 <ButtonGroup> return <ButtonGroup>
<a onClick={() => onView(record)}>查看</a> <a onClick={() => onView(record)}>查看</a>
{!isAdmin ? null : {!isAdmin ? null :

4
web/client/src/utils/func.js

@ -12,8 +12,8 @@ export default class Func {
static isOrgOrSuperAdmin(id) { static isOrgOrSuperAdmin(id) {
if (JSON.parse(sessionStorage.getItem('user'))) { if (JSON.parse(sessionStorage.getItem('user'))) {
const { username, orgId } = JSON.parse(sessionStorage.getItem('user')); const { username, orgId, role } = JSON.parse(sessionStorage.getItem('user'));
return username == 'SuperAdmin' || orgId == id; return username == 'SuperAdmin' || (orgId == id && role === '系统管理员');
} else { } else {
return false; return false;
} }

Loading…
Cancel
Save