Commit 56809f2a by zhaochengxiang

分页bug修改

parent 0648f3d2
......@@ -177,7 +177,7 @@ tr.drop-over-upward td {
.tooltip-common {
max-width: 450px;
max-height: 300px;
max-height: 350px;
.yy-popover-inner-content {
padding: 8px !important;
......
......@@ -128,7 +128,7 @@ const ResizeableHeaderCell = props => {
const ModelTable = (props) => {
const { data, onChange, onItemAction, onSelect, onHistory, catalogId, keyword, onAutoCreateTable, offset = null, modelId = null, view, selectModelerIds, onSubSelect } = props;
const { data, onChange, onItemAction, onSelect, onHistory, catalogId, keyword, onAutoCreateTable, offset = null, modelId = null, view, selectModelerIds, onSubSelect, modelState } = props;
const MENU_ID = (((modelId||'') !== '') ? `model-table-contextmenu-${modelId}` : 'model-table-contextmenu');
......@@ -287,21 +287,24 @@ const ModelTable = (props) => {
useEffect(() => {
if (offset !== null) {
const _pageNum = parseInt(offset/pageSize + ((offset%pageSize===0)?0:1));
setPagination({...pagination, pageNum: _pageNum });
} else if ((modelId||'')!=='') {
getDataModel();
} else {
setPagination({...pagination, pageNum: 1 });
}
if ((modelId||'') === '') {
onSelect && onSelect([]);
if ((keyword||'') === '') {
if (offset !== null) {
const _pageNum = parseInt(offset/pageSize + ((offset%pageSize===0)?0:1));
setPagination({...pagination, pageNum: _pageNum });
} else {
setPagination({...pagination, pageNum: 1 });
}
} else {
setPagination({...pagination, pageNum: 1 });
}
} else {
getDataModel();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [ catalogId, keyword, offset ]);
}, [ catalogId, keyword, offset, modelState ]);
useEffect(() => {
if ((selectModelerIds||[]).length === 0) {
......@@ -713,13 +716,13 @@ const ModelTable = (props) => {
setPagination({ pageNum: _pageNum, pageSize: _pageSize || 20 });
}}
onShowSizeChange={(_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum || 1, pageSize: _pageSize });
setPagination({ pageNum: 1, pageSize: _pageSize });
}}
current={pageNum}
pageSize={pageSize}
defaultCurrent={1}
total={(data||[]).length}
pageSizeOptions={[10,20]}
pageSizeOptions={[10,20,50]}
showTotal={total => `共 ${total} 条`}
/>
}
......
......@@ -90,7 +90,7 @@ class Model extends React.Component {
}
onModelStateChange = (value) => {
this.setState({ currentModelState: value }, () => {
this.setState({ currentModelState: value, offset: null }, () => {
this.onTableChange();
})
}
......@@ -420,6 +420,7 @@ class Model extends React.Component {
catalogId={catalogId}
view={currentView}
data={filterTableData}
modelState={currentModelState}
offset={offset}
keyword={keyword}
selectModelerIds={selectModelerIds}
......
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