Commit cfa6132f by zhaochengxiang

重点关注

parent e39ed6a6
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Spin } from 'antd'; import { Spin } from 'antd';
import LocalStorage from 'local-storage';
import ImportActionHeader from './ImportActionHeader'; import ImportActionHeader from './ImportActionHeader';
import ImportActionTable from './ImportActionTable'; import ImportActionTable from './ImportActionTable';
...@@ -9,7 +10,7 @@ import ImportActionPartition from './ImportActionPartition'; ...@@ -9,7 +10,7 @@ import ImportActionPartition from './ImportActionPartition';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
const ImportAction = (props) => { const ImportAction = (props) => {
const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, stateId, versionId } = props; const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, stateId, versionId, permitCheckOut } = props;
const [ constraints, setConstraints ] = useState([]); const [ constraints, setConstraints ] = useState([]);
const [ constraint, setConstraint ] = useState({}); const [ constraint, setConstraint ] = useState({});
...@@ -144,16 +145,21 @@ const ImportAction = (props) => { ...@@ -144,16 +145,21 @@ const ImportAction = (props) => {
versionId versionId
} }
} }
} else { } else if (action==='edit' && permitCheckOut==='true') {
params.stateId = stateId||''; type = 'datamodel.getCheckOutDataModel';
} else if ((stateId||'') !=='') {
params.stateId = stateId;
} }
dispatch({ dispatch({
type, type,
payload: params, payload: params,
callback: data => { callback: data => {
setLoading(false); if (action==='edit' && permitCheckOut==='true') {
LocalStorage.set('modelChange', !(LocalStorage.get('modelChange')||false));
}
setLoading(false);
getExtraData(data); getExtraData(data);
}, },
error: () => { error: () => {
......
...@@ -283,6 +283,7 @@ const ImportActionTable = (props) => { ...@@ -283,6 +283,7 @@ const ImportActionTable = (props) => {
nullable: null, nullable: null,
partOfPrimaryKey: null, partOfPrimaryKey: null,
partOfDistributionKey: null, partOfDistributionKey: null,
needAttention: null,
remark: '', remark: '',
defaultValue: '', defaultValue: '',
definition: '', definition: '',
...@@ -608,6 +609,25 @@ const ImportActionTable = (props) => { ...@@ -608,6 +609,25 @@ const ImportActionTable = (props) => {
} }
}, },
{ {
title: '重点关注',
width: 80,
dataIndex: 'needAttention',
editable: (type==='model'?true:false),
render: (needAttention, record, index) => {
if (!needAttention) {
return (
<CloseOutlined />
);
} else if (needAttention === true) {
return (
<CheckOutlined />
)
}
return '';
}
},
{
title: '默认值', title: '默认值',
dataIndex: 'defaultValue', dataIndex: 'defaultValue',
editable: true, editable: true,
...@@ -834,7 +854,7 @@ const ImportActionTable = (props) => { ...@@ -834,7 +854,7 @@ const ImportActionTable = (props) => {
onCell: (record) => ({ onCell: (record) => ({
record, record,
dataIndex: col.dataIndex, dataIndex: col.dataIndex,
inputType: (col.dataIndex==='nullable' || col.dataIndex==='partOfDistributionKey' || col.dataIndex==='partOfPrimaryKey') ? 'check' : 'text', inputType: (col.dataIndex==='nullable' || col.dataIndex==='partOfDistributionKey' || col.dataIndex==='partOfPrimaryKey' || col.dataIndex==='needAttention') ? 'check' : 'text',
colTitle: col.title, colTitle: col.title,
editing: isEditing(record), editing: isEditing(record),
datatypes: supportedDatatypes, datatypes: supportedDatatypes,
......
...@@ -85,13 +85,10 @@ const ModelTable = (props) => { ...@@ -85,13 +85,10 @@ const ModelTable = (props) => {
{ {
<React.Fragment> <React.Fragment>
<Tooltip placement='bottom' title={'修改'}> <Tooltip placement='bottom' title={'修改'}>
<Button icon={<EditOutlined />} size='small' disabled={!record.editable} onClick={() => { editItem(record); }} /> <Button icon={<EditOutlined />} size='small' disabled={!record?.editable&&!record?.permitCheckOut} onClick={() => { editItem(record); }} />
</Tooltip>
<Tooltip placement='bottom' title={'检出'}>
<Button icon={<PullRequestOutlined />} size='small' disabled={!record.permitCheckOut} onClick={() => { checkoutItem(record); }} />
</Tooltip> </Tooltip>
<Tooltip placement='bottom' title={'删除'}> <Tooltip placement='bottom' title={'删除'}>
<Button icon={<DeleteOutlined />} size='small' disabled={!record.deletable} onClick={() => { deleteItem(record); }} /> <Button icon={<DeleteOutlined />} size='small' disabled={!record?.deletable} onClick={() => { deleteItem(record); }} />
</Tooltip> </Tooltip>
<Tooltip placement='bottom' title={'版本历史'}> <Tooltip placement='bottom' title={'版本历史'}>
<Button icon={<HistoryOutlined />} size='small' onClick={() => { historyItem(record); }} /> <Button icon={<HistoryOutlined />} size='small' onClick={() => { historyItem(record); }} />
...@@ -205,19 +202,6 @@ const ModelTable = (props) => { ...@@ -205,19 +202,6 @@ const ModelTable = (props) => {
onItemAction && onItemAction(record, 'edit'); onItemAction && onItemAction(record, 'edit');
} }
const checkoutItem = (record) => {
dispatchLatest({
type: 'datamodel.getCheckOutDataModel',
payload: {
id: record.id||''
},
callback: () => {
showMessage('success', `检出${record.cnName||''}成功`);
onChange && onChange();
}
})
}
const detailItem = (record) => { const detailItem = (record) => {
onItemAction && onItemAction(record, 'detail'); onItemAction && onItemAction(record, 'detail');
} }
...@@ -325,25 +309,26 @@ const ModelTable = (props) => { ...@@ -325,25 +309,26 @@ const ModelTable = (props) => {
rowKey={'id'} rowKey={'id'}
dataSource={modelId?(subData||[]):(_data||[])} dataSource={modelId?(subData||[]):(_data||[])}
pagination={false} pagination={false}
size={modelId?'small':'default'}
onRow={(record) => { onRow={(record) => {
return { return {
id: `data-model-${record.id}`, id: `data-model-${record?.id}`,
style: { backgroundColor: (record.id===anchorId)?'#e7f7ff':'transparent' } style: { backgroundColor: (record?.id===anchorId)?'#e7f7ff':'transparent' }
} }
}} }}
expandable={{ expandable={{
expandedRowRender: record => <ModelTable expandedRowRender: record => <ModelTable
modelId={record.id} modelId={record?.id}
{...props} {...props}
/>, />,
expandIcon: ({ expanded, onExpand, record }) => { expandIcon: ({ expanded, onExpand, record }) => {
if (!record.alreadyCheckedOut) return null; if (!record?.alreadyCheckedOut) return null;
return expanded ? <UpOutlined onClick={e => onExpand(record, e)} /> : <DownOutlined onClick={e => onExpand(record, e)} /> return expanded ? <UpOutlined onClick={e => onExpand(record, e)} /> : <DownOutlined onClick={e => onExpand(record, e)} />
}, },
rowExpandable: record => { rowExpandable: record => {
return record.alreadyCheckedOut; return record?.alreadyCheckedOut;
} }
}} }}
sticky={!modelId} sticky={!modelId}
......
import React, { useState, useEffect, useRef } from "react"; import React, { useState, useEffect, useRef } from "react";
import { Tooltip, Tree, Modal, Spin } from "antd"; import { Tooltip, Tree, Modal, Spin, Dropdown, Menu } from "antd";
import { PlusOutlined, EditOutlined, SyncOutlined, DeleteOutlined, ImportOutlined } from '@ant-design/icons'; import { PlusOutlined, EditOutlined, SyncOutlined, DeleteOutlined, ImportOutlined, UnorderedListOutlined } from '@ant-design/icons';
import classnames from 'classnames'; import classnames from 'classnames';
import UpdateTreeItemModal from './UpdateTreeItemModal'; import UpdateTreeItemModal from './UpdateTreeItemModal';
...@@ -224,20 +224,20 @@ const ModelTree = (props) => { ...@@ -224,20 +224,20 @@ const ModelTree = (props) => {
setAutoExpandParent(false); setAutoExpandParent(false);
}; };
// const onViewClick = ({ key }) => { const onViewClick = ({ key }) => {
// if (viewSelectedKey && viewSelectedKey===key ) return; if (viewSelectedKey && viewSelectedKey===key ) return;
// itemRef.current = null; itemRef.current = null;
// setViewSelectedKey(key); setViewSelectedKey(key);
// onViewChange && onViewChange(key); onViewChange && onViewChange(key);
// if (key === 'dir') { if (key === 'dir') {
// getDirTreeData(); getDirTreeData();
// } else { } else {
// getStateTreeData(); getStateTreeData();
// } }
// } }
const onTreeSelect = (keys,data) => { const onTreeSelect = (keys,data) => {
...@@ -316,17 +316,17 @@ const ModelTree = (props) => { ...@@ -316,17 +316,17 @@ const ModelTree = (props) => {
setVisible(false); setVisible(false);
} }
// const exportMenu = ( const exportMenu = (
// <Menu selectedKeys={[viewSelectedKey]} onClick={onViewClick}> <Menu selectedKeys={[viewSelectedKey]} onClick={onViewClick}>
// { {
// viewModes && viewModes.map(item => { viewModes && viewModes.map(item => {
// return ( return (
// <Menu.Item key={item.key} value={item.key} >{item.name}</Menu.Item> <Menu.Item key={item.key} value={item.key} >{item.name}</Menu.Item>
// ) )
// }) })
// } }
// </Menu> </Menu>
// ); );
const classes = classnames('model-tree', { const classes = classnames('model-tree', {
'model-tree-recatalog': (refrence === 'recatalog') 'model-tree-recatalog': (refrence === 'recatalog')
...@@ -344,6 +344,12 @@ const ModelTree = (props) => { ...@@ -344,6 +344,12 @@ const ModelTree = (props) => {
alignItems: 'center' alignItems: 'center'
}} }}
> >
<Dropdown overlay={exportMenu} placement="bottomLeft">
<Tooltip title="视角">
<UnorderedListOutlined style={{ fontSize:16,cursor:'pointer' }} />
</Tooltip>
</Dropdown>
{ {
viewSelectedKey==='dir' && ( viewSelectedKey==='dir' && (
<Tooltip title="新增目录" className='ml-4'> <Tooltip title="新增目录" className='ml-4'>
......
...@@ -77,7 +77,7 @@ class Model extends React.Component { ...@@ -77,7 +77,7 @@ class Model extends React.Component {
loadingStates: false, loadingStates: false,
// modelStates: [{ name: 'all', id: '', cnName: '所有状态' }, ...(data?.subCatalogs||[])] // modelStates: [{ name: 'all', id: '', cnName: '所有状态' }, ...(data?.subCatalogs||[])]
modelStates: data?.subCatalogs||[], modelStates: data?.subCatalogs||[],
currentModelState: (data?.subCatalogs||[]).length>1?data?.subCatalogs[0].id:'' currentModelState: '4',
}); });
}, },
error: () => { error: () => {
...@@ -88,7 +88,7 @@ class Model extends React.Component { ...@@ -88,7 +88,7 @@ class Model extends React.Component {
} }
onViewChange = (value) => { onViewChange = (value) => {
this.setState({ currentView: value, currentModelState: '' }); this.setState({ currentView: value });
} }
onModelStateChange = (value) => { onModelStateChange = (value) => {
...@@ -221,6 +221,13 @@ class Model extends React.Component { ...@@ -221,6 +221,13 @@ class Model extends React.Component {
} }
onImportWordBtnClick = () => { onImportWordBtnClick = () => {
const { catalogId } = this.state;
if ((catalogId||'') === '') {
showMessage('info', '请先选择模型目录');
return;
}
this.setState({ importWordModalVisible: true }); this.setState({ importWordModalVisible: true });
} }
...@@ -406,6 +413,13 @@ class Model extends React.Component { ...@@ -406,6 +413,13 @@ class Model extends React.Component {
} }
importStockModel = () => { importStockModel = () => {
const { catalogId } = this.state;
if ((catalogId||'') === '') {
showMessage('info', '请先选择模型目录');
return;
}
this.setState({ importStockWordDrawerVisible: true }); this.setState({ importStockWordDrawerVisible: true });
} }
...@@ -550,7 +564,7 @@ class Model extends React.Component { ...@@ -550,7 +564,7 @@ class Model extends React.Component {
</Space> </Space>
{ {
currentView==='dir' && <Space className='mr-3'> (currentView==='dir'||keyword!=='') && <Space className='mr-3'>
<Select <Select
style={{ width: 120 }} style={{ width: 120 }}
onChange={(value) => { onChange={(value) => {
...@@ -573,13 +587,11 @@ class Model extends React.Component { ...@@ -573,13 +587,11 @@ class Model extends React.Component {
</Space> </Space>
<Space> <Space>
{ <Space>
currentView==='dir' && <Space> <Dropdown overlay={createModelMenu} placement="bottomLeft">
<Dropdown overlay={createModelMenu} placement="bottomLeft"> <Button type='primary'>模型创建<DownOutlined /></Button>
<Button type='primary'>模型创建<DownOutlined /></Button> </Dropdown>
</Dropdown> </Space>
</Space>
}
<Space> <Space>
<Dropdown overlay={exportModelMenu} placement="bottomLeft"> <Dropdown overlay={exportModelMenu} placement="bottomLeft">
<Button type='primary'>模型导出<DownOutlined /></Button> <Button type='primary'>模型导出<DownOutlined /></Button>
......
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