|
@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' |
|
|
import { connect } from 'react-redux'; |
|
|
import { connect } from 'react-redux'; |
|
|
import moment from 'moment'; |
|
|
import moment from 'moment'; |
|
|
import { RouteRequest } from '@peace/utils'; |
|
|
import { RouteRequest } from '@peace/utils'; |
|
|
import { RouteTable } from '$utils' |
|
|
import { Func } from '$utils' |
|
|
|
|
|
|
|
|
import { Tabs, Form, Input, Space, Button, Table, Popconfirm, message } from 'antd'; |
|
|
import { Tabs, Form, Input, Space, Button, Table, Popconfirm, message } from 'antd'; |
|
|
const { Search } = Input; |
|
|
const { Search } = Input; |
|
@ -10,7 +10,7 @@ const { Search } = Input; |
|
|
import EditModal from '../components/editModal'; |
|
|
import EditModal from '../components/editModal'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) { |
|
|
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 }); |
|
@ -53,19 +53,21 @@ function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) { |
|
|
dataIndex: 'handle', |
|
|
dataIndex: 'handle', |
|
|
width: '250px', |
|
|
width: '250px', |
|
|
// ellipsis: true,
|
|
|
// ellipsis: true,
|
|
|
render: (text, record) => <div style={{ width: 200, display: 'flex', justifyContent: 'space-evenly' }}> |
|
|
render: (text, record) => { |
|
|
|
|
|
const isCurrentOrg = Func?.isOrgOrSuperAdmin(record?.resourceCatalog?.organization?.id) |
|
|
|
|
|
return <div style={{ width: 200, display: 'flex', justifyContent: 'space-evenly' }}> |
|
|
<a onClick={() => { |
|
|
<a onClick={() => { |
|
|
setEditData(record) |
|
|
setEditData(record) |
|
|
setEditModal(true) |
|
|
setEditModal(true) |
|
|
setViewDetails(true) |
|
|
setViewDetails(true) |
|
|
}}>查看详情</a> |
|
|
}}>查看详情</a> |
|
|
<a onClick={() => { |
|
|
{isCurrentOrg && <a onClick={() => { |
|
|
setEditData(record) |
|
|
setEditData(record) |
|
|
setEditModal(true) |
|
|
setEditModal(true) |
|
|
}}>编辑</a> |
|
|
}}>编辑</a> |
|
|
|
|
|
} |
|
|
{/* {record?.enabled ? */} |
|
|
{/* {record?.enabled ? */} |
|
|
{record?.resourceConsumptions?.length > 0 ? <a onClick={() => { |
|
|
{!isCurrentOrg ? '' : record?.resourceConsumptions?.length > 0 ? <a onClick={() => { |
|
|
message.warning('已有关联数据,无法删除') |
|
|
message.warning('已有关联数据,无法删除') |
|
|
}}>删除</a> |
|
|
}}>删除</a> |
|
|
: <Popconfirm |
|
|
: <Popconfirm |
|
@ -83,7 +85,7 @@ function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) { |
|
|
</Popconfirm>} |
|
|
</Popconfirm>} |
|
|
|
|
|
|
|
|
{/* // } */} |
|
|
{/* // } */} |
|
|
{record?.enabled ? |
|
|
{!isCurrentOrg ? '' : record?.enabled ? |
|
|
<Popconfirm |
|
|
<Popconfirm |
|
|
title="禁用后该服务将不可用" |
|
|
title="禁用后该服务将不可用" |
|
|
onConfirm={() => { |
|
|
onConfirm={() => { |
|
@ -110,6 +112,7 @@ function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
</div > |
|
|
</div > |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
@ -174,7 +177,7 @@ function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) { |
|
|
|
|
|
|
|
|
</> |
|
|
</> |
|
|
} |
|
|
} |
|
|
function mapStateToProps (state) { |
|
|
function mapStateToProps(state) { |
|
|
const { global, auth, resourceCatalog } = state; |
|
|
const { global, auth, resourceCatalog } = state; |
|
|
return { |
|
|
return { |
|
|
user: auth.user, |
|
|
user: auth.user, |
|
|