Commit e7fb8f33 by zhaochengxiang

新增项目

parent baf74eea
......@@ -9,6 +9,7 @@ import { dispatch } from '../../../../model';
import { showMessage, getQueryParam, highlightSearchContentByTerms } from '../../../../util';
import { AnchorDirId, AnchorId, AnchorTimestamp, DataModelerRoleAdmin } from '../../../../util/constant';
import { AppContext } from "../../../../App";
import UpdateBranch from './update-branch';
import './ModelTree.less';
import 'react-contexify/dist/ReactContexify.css';
......@@ -592,8 +593,8 @@ const ModelTree = (props) => {
</Dropdown>
{
(viewSelectedKey==='dir' && isAdmin) && (
<Tooltip title="新增目录">
((viewSelectedKey==='dir'&&isAdmin) || viewSelectedKey==='branch') && (
<Tooltip title={(viewSelectedKey==='dir')?"新增目录":'新增项目'}>
<PlusOutlined className='default' onClick={add} style={{ fontSize:16,cursor:'pointer' }} />
</Tooltip>
)
......@@ -689,14 +690,23 @@ const ModelTree = (props) => {
/>
</Spin>
</div>
<UpdateTreeItemModal
{
viewSelectedKey === 'dir' ? <UpdateTreeItemModal
visible={visible}
type={type}
item={(type==='add')?item:currentRightClickDir}
rootId={rootId}
onOk={onUpdateTreeItemModalOk}
onCancel={onUpdateTreeItemModalCancel}
/> : <UpdateBranch
visible={visible}
type={type}
item={(type==='add')?item:currentRightClickDir}
onCancel={() => {
setVisible(false)
}}
/>
}
{
(refrence!=='recatalog') && <RcMenu id={MENU_ID}>
<RcItem id="edit" onClick={update}>
......
import React from 'react'
import { Modal, Button, Spin } from 'antd'
const FC = (props) => {
const { visible, type, item, onCancel} = props
const [waiting, setWaiting] = React.useState(false)
const title = React.useMemo(() => {
if (type === 'add') return '新增项目'
if (type === 'edit') return '编辑项目'
return ''
}, [type])
const close = () => {
setWaiting(false)
onCancel?.()
}
const save = async () => {
try {
} catch (e) {
}
}
const footer = React.useMemo(() => {
return [
<Button key={'cancel'}
onClick={() => close()}
>取消</Button>,
<Button key={'save'} type='primary'
disabled={waiting}
onClick={() => save()}
>保存</Button>
]
}, [close, save, waiting])
return (
<Modal
visible={visible}
footer={footer}
width='90%'
bodyStyle={{ padding: '15px', overflowX: 'auto', maxHeight: '80vh' }}
title={title}
centered destroyOnClose
onCancel={() => { close() }}
>
<Spin spinning={waiting}>
</Spin>
</Modal>
)
}
export default FC
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment