Browse Source

(*)元数据检索功能完善

master
peng.peng 2 years ago
parent
commit
19c381245e
  1. 2
      api/app/lib/controllers/backups/index.js
  2. 9
      web/client/src/sections/backups/containers/backupTask.js
  3. 4
      web/client/src/sections/backups/nav-item.js
  4. 2
      web/client/src/sections/backups/routes.js
  5. 4
      web/client/src/sections/memberManagement/nav-item.js
  6. 8
      web/client/src/sections/resourceRetrieval/containers/retrieval.js

2
api/app/lib/controllers/backups/index.js

@ -8,7 +8,7 @@ function getBackupsList(opts) {
let errMsg = { message: '获取数据备份失败' } let errMsg = { message: '获取数据备份失败' }
try { try {
let searchWhere = { let searchWhere = {
} }
let option = { let option = {
where: searchWhere, where: searchWhere,

9
web/client/src/sections/backups/containers/backupTask.js

@ -10,7 +10,8 @@ function Member(props) {
const { loading, clientHeight, actions, dispatch, backups, user, dataSources } = props; const { loading, clientHeight, actions, dispatch, backups, user, dataSources } = props;
const [pageSize, setPageSize] = useState(10); const [pageSize, setPageSize] = useState(10);
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [searchValue, setSearchValue] = useState('') const [searchValue, setSearchValue] = useState('');
const [addLoading, setAddLoading] = useState(false)
const queryData = (search) => { const queryData = (search) => {
const query = { const query = {
limit: search ? 10 : pageSize || 10, limit: search ? 10 : pageSize || 10,
@ -59,8 +60,6 @@ function Member(props) {
valueType: 'option', valueType: 'option',
render: (text, record) => { render: (text, record) => {
const options = []; const options = [];
options.push( options.push(
<Popconfirm <Popconfirm
key="del" key="del"
@ -102,9 +101,11 @@ function Member(props) {
}; };
const onFinish = async (values, editData) => { const onFinish = async (values, editData) => {
setAddLoading(true)
return dispatch(actions.backups.addBackups({ return dispatch(actions.backups.addBackups({
...values, ...values,
})).then(res => { })).then(res => {
setAddLoading(false)
if (res.success) { if (res.success) {
queryData(); queryData();
return true; return true;
@ -114,7 +115,7 @@ function Member(props) {
}); });
}; };
return <Spin spinning={loading}> return <Spin spinning={loading || addLoading}>
<Row className='protable-title'> <Row className='protable-title'>
<Col span={12}> <Col span={12}>
<BackupsModal <BackupsModal

4
web/client/src/sections/backups/nav-item.js

@ -1,13 +1,13 @@
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Menu } from 'antd'; import { Menu } from 'antd';
import { BarChartOutlined } from '@ant-design/icons'; import { ControlOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
export function getNavItem(user) { export function getNavItem(user) {
return ( return (
user?.role == '系统管理员' && <SubMenu key="数据备份恢复" icon={<BarChartOutlined />} title='数据备份恢复'> user?.role == '系统管理员' && <SubMenu key="数据备份恢复" icon={<ControlOutlined />} title='数据备份恢复'>
<Menu.Item key="backups"> <Menu.Item key="backups">
<Link to="/backups/restore">备份恢复</Link> <Link to="/backups/restore">备份恢复</Link>
</Menu.Item> </Menu.Item>

2
web/client/src/sections/backups/routes.js

@ -5,7 +5,7 @@ export default [{
route: { route: {
path: '/backups', path: '/backups',
key: 'backups', key: 'backups',
breadcrumb: '用户管理', breadcrumb: '数据备份恢复',
// 不设置 component 则面包屑禁止跳转 // 不设置 component 则面包屑禁止跳转
childRoutes: [{ childRoutes: [{
path: '/restore', path: '/restore',

4
web/client/src/sections/memberManagement/nav-item.js

@ -1,13 +1,13 @@
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Menu } from 'antd'; import { Menu } from 'antd';
import { BarChartOutlined } from '@ant-design/icons'; import { UserOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
export function getNavItem(user) { export function getNavItem(user) {
return ( return (
user?.role == '系统管理员' && <SubMenu key="memberManagement" icon={<BarChartOutlined />} title='用户管理'> user?.role == '系统管理员' && <SubMenu key="memberManagement" icon={<UserOutlined />} title='用户管理'>
<Menu.Item key="auth"> <Menu.Item key="auth">
<Link to="/memberManagement/auth">用户权限</Link> <Link to="/memberManagement/auth">用户权限</Link>
</Menu.Item> </Menu.Item>

8
web/client/src/sections/resourceRetrieval/containers/retrieval.js

@ -181,7 +181,11 @@ function Retrieval(props) {
</div> : </div> :
<> <>
<Input.Search defaultValue={keywords} style={{ width: '30%', marginLeft: 10, marginBottom: 30 }} <Input.Search defaultValue={keywords} style={{ width: '30%', marginLeft: 10, marginBottom: 30 }}
onSearch={value => { setKeywords(value) }}
onSearch={value => {
setPage(1)
setKeywords(value)
}}
/> />
{result?.rows?.slice((page - 1) * 10, (page - 1) * 10 + 10).map(s => { {result?.rows?.slice((page - 1) * 10, (page - 1) * 10 + 10).map(s => {
const catalogText = renderCatalog(s?.catalog).split('/').reverse().toString().replaceAll(',', '/') const catalogText = renderCatalog(s?.catalog).split('/').reverse().toString().replaceAll(',', '/')
@ -212,9 +216,11 @@ function Retrieval(props) {
</div> </div>
})} })}
{result?.rows?.length > 0 && <Pagination {result?.rows?.length > 0 && <Pagination
key={keywords}
defaultCurrent={1} total={result?.rows?.length} defaultCurrent={1} total={result?.rows?.length}
style={{ float: 'right', paddingRight: '5%' }} style={{ float: 'right', paddingRight: '5%' }}
showTotal={total => `${total} 条数据`} showTotal={total => `${total} 条数据`}
showSizeChanger={false}
onChange={(page, pageSize) => { onChange={(page, pageSize) => {
setPage(page) setPage(page)
}} }}

Loading…
Cancel
Save