Commit 56809f2a by zhaochengxiang

分页bug修改

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