解决表格页码tab切换bug

This commit is contained in:
red-deng-deng 2021-11-25 13:42:15 +08:00
parent b693366f8d
commit 70dd51d1cd
4 changed files with 35 additions and 13 deletions

View File

@ -28,6 +28,7 @@ export default class menu extends React.Component {
isShowPageBar:true, //是否显示页码
isMultiple: true,
isSwitch: true,
page:'',
headBackgroud: "",
spliteColor: "#f9fafc",
countbarVisible:true,
@ -255,10 +256,8 @@ export default class menu extends React.Component {
}
componentWillReceiveProps(nextProps) {
this.setState({tableData: nextProps.tableData});
this.setState({page: nextProps.page});
this.setState( {dataCount:nextProps.dataCount})
}
@ -302,6 +301,9 @@ export default class menu extends React.Component {
this.setState({pageLoading:false})
},500)
}
pageShow(e){
console.log('page',e);
}
gridEditChange(e){
}
@ -567,6 +569,8 @@ export default class menu extends React.Component {
this.props.pageChange(e);
}
}
page={this.props.page}
pageFn={(e)=>this.setState({page:e})}
onNextClick = {
(e) => {
console.log("下一页页码",e)

View File

@ -10,13 +10,14 @@ import _ from "lodash";
super(props);
this.state = {
count:10,
page:1, //当前页
page:props.page|1, //当前页
visible:false,
jump_page:"",
page_num:"",
dataCount:this.props.data
}
}
}
}
getPageArr(pages, current, viewsize){
@ -89,6 +90,7 @@ import _ from "lodash";
}
this.setState({page:e})
this.props.pageFn(e);
this.props.onJumpPage(e)
}
onInputChange(e,page_num){
@ -131,6 +133,12 @@ import _ from "lodash";
}
this.setState({ visible: false })
}
componentWillMount(){
}
componentWillReceiveProps(nextProps) {
this.setState({page: nextProps.page});
}
render() {
const { data} = this.props;
let page_num =Math.ceil( data.count / this.state.count);

View File

@ -171,7 +171,11 @@ export default class acclist extends React.Component{
}
tabFn(index){
this.setState({tabIndex:index})
this.getCodeListFn({},index);
this.setState({page:1})
setTimeout(() => {
this.getCodeListFn({},index);
}, 10);
}
//page
pageChange(e){
@ -344,10 +348,10 @@ componentDidUpdate(prevProps,prevState){
maxheight={this.state.tableHeight}
countbarVisible={false}
isSwitch={false}
page={this.state.page}
dataCount={this.state.total}
isMultiple={false}
pageChange={(e)=>{
pageChange={(e)=>{
this.pageChange(e)
}}
countChange={

View File

@ -135,7 +135,9 @@ export default class edittemplate extends React.Component{
putMyTheme(this.state.model.id,formdata).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("保存成功")
Notify.success("保存成功")
},(err)=>{
Notify.error(err)
})
@ -150,7 +152,11 @@ export default class edittemplate extends React.Component{
addTheme(formdata).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("保存成功")
Notify.success("保存213213成功")
setTimeout(() => {
let link = window.location.href.replace(window.location.hash,"#/home/myexchangetemplate");
window.open(link, "_blank")
}, 2000);
},(err)=>{
Notify.error(err)