Commit 68ee4849 by zhaochengxiang

模型全文检索

parent dcd2fb22
...@@ -34,7 +34,7 @@ const ResizeableHeaderCell = props => { ...@@ -34,7 +34,7 @@ const ResizeableHeaderCell = props => {
const ModelTable = (props) => { const ModelTable = (props) => {
const { data, onChange, onItemAction, onSelect, catalogId, onSearchInputChange, onModelStateChange, loadingStates, currentModelState, modelStates, view, keyword, onRecatalog, onAutoCreateTable } = props; const { data, onChange, onItemAction, onSelect, catalogId, onSearchInputChange, onModelStateChange, loadingStates, currentModelState, modelStates, view, keyword, onRecatalog, onAutoCreateTable, offset = null } = props;
const [ selectedRowKeys, setSelectedRowKeys ] = useState([]); const [ selectedRowKeys, setSelectedRowKeys ] = useState([]);
const [ columns, setColumns ] = useState([ const [ columns, setColumns ] = useState([
...@@ -120,11 +120,18 @@ const ModelTable = (props) => { ...@@ -120,11 +120,18 @@ const ModelTable = (props) => {
useEffect(() => { useEffect(() => {
setPagination({ pageNum: 1, pageSize: 20 }); if (offset !== null) {
const _pageNum = parseInt(offset/pageSize + ((offset%pageSize===0)?0:1));
setPagination({...pagination, pageNum: _pageNum });
} else {
setPagination({...pagination, pageNum: 1 });
}
setSelectedRowKeys([]); setSelectedRowKeys([]);
onSelect && onSelect([]); onSelect && onSelect([]);
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [ catalogId, keyword ]); }, [ catalogId, keyword, offset ]);
useEffect(() => { useEffect(() => {
......
...@@ -67,15 +67,16 @@ const ModelTree = (props) => { ...@@ -67,15 +67,16 @@ const ModelTree = (props) => {
id id
}, },
callback: data => { callback: data => {
getDirTreeData(data.easyDataModelerDataModelCatalogId||''); getDirTreeData(data.easyDataModelerDataModelCatalogId||'', data.offset);
}, },
error: () => { error: () => {
setLoading(false); setLoading(false);
getDirTreeData();
} }
}); });
} }
const getDirTreeData = (defaultSelectedId='') => { const getDirTreeData = (defaultSelectedId='', offset=null) => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -127,7 +128,7 @@ const ModelTree = (props) => { ...@@ -127,7 +128,7 @@ const ModelTree = (props) => {
setAutoExpandParent(true); setAutoExpandParent(true);
setItem(defaultItem); setItem(defaultItem);
onSelect && onSelect(defaultItem.key||''); onSelect && onSelect(defaultItem.key||'', offset);
} else if (refrence === '') { } else if (refrence === '') {
......
...@@ -48,6 +48,7 @@ class Model extends React.Component { ...@@ -48,6 +48,7 @@ class Model extends React.Component {
currentView: '', currentView: '',
exportDDLModalReference: 'exportDDL', exportDDLModalReference: 'exportDDL',
currentModel: {}, currentModel: {},
offset: null
} }
} }
...@@ -82,9 +83,9 @@ class Model extends React.Component { ...@@ -82,9 +83,9 @@ class Model extends React.Component {
}) })
} }
onTreeSelect = (key) => { onTreeSelect = (key, offset) => {
this.setState({ catalogId: key, keyword: '' }, () => { this.setState({ catalogId: key, keyword: '', offset }, () => {
if (!key || key==='') { if (!key || key==='') {
this.setState({ tableData: [], filterTableData: [] }); this.setState({ tableData: [], filterTableData: [] });
} else { } else {
...@@ -385,7 +386,7 @@ class Model extends React.Component { ...@@ -385,7 +386,7 @@ class Model extends React.Component {
} }
render() { render() {
const { importModalVisible, catalogId, loadingTableData, selectModelerIds, keyword, filterTableData, selectModelerNames, importModalAddMode, exportErwinLoading, exportDDLModalVisible, templateCURDDrawerVisible, wordTemplateModalVisible, constraintDetailDrawerVisible, importWordModalVisible, loadingStates, modelStates, currentModelState, currentView, recatalogModalVisible, exportDDLModalReference, currentModel, importWordModalReference } = this.state; const { importModalVisible, catalogId, loadingTableData, selectModelerIds, keyword, filterTableData, selectModelerNames, importModalAddMode, exportErwinLoading, exportDDLModalVisible, templateCURDDrawerVisible, wordTemplateModalVisible, constraintDetailDrawerVisible, importWordModalVisible, loadingStates, modelStates, currentModelState, currentView, recatalogModalVisible, exportDDLModalReference, currentModel, importWordModalReference, offset } = this.state;
const content = ( const content = (
<ModelTable <ModelTable
...@@ -397,6 +398,7 @@ class Model extends React.Component { ...@@ -397,6 +398,7 @@ class Model extends React.Component {
modelStates={modelStates} modelStates={modelStates}
currentModelState={currentModelState} currentModelState={currentModelState}
keyword={keyword} keyword={keyword}
offset={offset}
onChange={this.onTableChange} onChange={this.onTableChange}
onSelect={this.onTableSelect} onSelect={this.onTableSelect}
onItemAction={this.onTableItemAction} onItemAction={this.onTableItemAction}
......
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