Commit 68ee4849 by zhaochengxiang

模型全文检索

parent dcd2fb22
......@@ -34,7 +34,7 @@ const ResizeableHeaderCell = 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 [ columns, setColumns ] = useState([
......@@ -120,11 +120,18 @@ const ModelTable = (props) => {
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([]);
onSelect && onSelect([]);
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [ catalogId, keyword ]);
}, [ catalogId, keyword, offset ]);
useEffect(() => {
......
......@@ -67,15 +67,16 @@ const ModelTree = (props) => {
id
},
callback: data => {
getDirTreeData(data.easyDataModelerDataModelCatalogId||'');
getDirTreeData(data.easyDataModelerDataModelCatalogId||'', data.offset);
},
error: () => {
setLoading(false);
getDirTreeData();
}
});
}
const getDirTreeData = (defaultSelectedId='') => {
const getDirTreeData = (defaultSelectedId='', offset=null) => {
setLoading(true);
dispatch({
......@@ -127,7 +128,7 @@ const ModelTree = (props) => {
setAutoExpandParent(true);
setItem(defaultItem);
onSelect && onSelect(defaultItem.key||'');
onSelect && onSelect(defaultItem.key||'', offset);
} else if (refrence === '') {
......
......@@ -48,6 +48,7 @@ class Model extends React.Component {
currentView: '',
exportDDLModalReference: 'exportDDL',
currentModel: {},
offset: null
}
}
......@@ -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==='') {
this.setState({ tableData: [], filterTableData: [] });
} else {
......@@ -385,7 +386,7 @@ class Model extends React.Component {
}
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 = (
<ModelTable
......@@ -397,6 +398,7 @@ class Model extends React.Component {
modelStates={modelStates}
currentModelState={currentModelState}
keyword={keyword}
offset={offset}
onChange={this.onTableChange}
onSelect={this.onTableSelect}
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