Commit cfa6132f by zhaochengxiang

重点关注

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