提交 3eeb325a authored 作者: 钟是志's avatar 钟是志

31266 发费数据上报--数据比对页面跳转有误

上级 5bf00c96
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import React from 'react'; import React from 'react';
import FormList from './formList'; import FormList from './formList';
import TreeList from './formList/TreeList'; import TreeList from './formList/TreeList';
import { Spin } from 'antd';
export default class TableList extends React.Component { export default class TableList extends React.Component {
constructor(props) { constructor(props) {
...@@ -42,30 +43,35 @@ export default class TableList extends React.Component { ...@@ -42,30 +43,35 @@ export default class TableList extends React.Component {
static getDerivedStateFromProps(nextProps, prevState) { static getDerivedStateFromProps(nextProps, prevState) {
// ... // ...
if('value' in nextProps){ if ('value' in nextProps) {
return {...nextProps.value}; // 更新state return { ...nextProps.value }; // 更新state
} }
return null; //不需要更新任何state return null; //不需要更新任何state
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if(prevState?.columns !== this.state.columns){ if (prevState?.columns !== this.state.columns) {
this.setState({ console.log(prevState.columns, this.state.columns);
this.setState(
{
showNo: true, showNo: true,
}, () => { },
setTimeout(()=>{ () => {
setTimeout(() => { // 如果两次的表头不同 重新渲染组件
this.setState({ this.setState({
showNo: false, showNo: false,
}); });
}, 1000); }, 10);
}); },
);
} }
} }
render() { render() {
const { isTree, json, uuid } = this.props; const { isTree, json, uuid } = this.props;
const { showNo } = this.state; const { showNo } = this.state;
if(showNo){ // console.log(showNo);
if (showNo) {
return null; return null;
} }
return isTree ? ( return isTree ? (
...@@ -98,7 +104,7 @@ export default class TableList extends React.Component { ...@@ -98,7 +104,7 @@ export default class TableList extends React.Component {
get={this.props.get} get={this.props.get}
isHiddenPage={this.props.isHiddenPage != null ? this.props.isHiddenPage : false} isHiddenPage={this.props.isHiddenPage != null ? this.props.isHiddenPage : false}
pageSize={this.props.pageSize || 10} pageSize={this.props.pageSize || 10}
value={{...this.state}} value={{ ...this.state }}
notShowBack={true} notShowBack={true}
rights={this.props.rights || []} rights={this.props.rights || []}
objCode={this.props.objCode} objCode={this.props.objCode}
......
...@@ -293,6 +293,7 @@ class FormList extends React.Component { ...@@ -293,6 +293,7 @@ class FormList extends React.Component {
if (Number(objCode) === 1) { if (Number(objCode) === 1) {
this.initColumn(); this.initColumn();
} else { } else {
console.log('componentDidMount-296');
dispatch({ dispatch({
type: 'DataObj/findByCode', type: 'DataObj/findByCode',
payload: { objCode: this.props.objCode }, payload: { objCode: this.props.objCode },
...@@ -442,7 +443,6 @@ class FormList extends React.Component { ...@@ -442,7 +443,6 @@ class FormList extends React.Component {
if(this.props.json?.isDiy){ // 2022年11月8日 姚鑫国说的 开起了这个 自定义模式 就不调接口查表头了. 也不调接口查枚举项那些 if(this.props.json?.isDiy){ // 2022年11月8日 姚鑫国说的 开起了这个 自定义模式 就不调接口查表头了. 也不调接口查枚举项那些
this.getPage(); this.getPage();
return undefined; return undefined;
} }
dispatch({ dispatch({
type: 'formList/getHead', type: 'formList/getHead',
...@@ -638,7 +638,7 @@ class FormList extends React.Component { ...@@ -638,7 +638,7 @@ class FormList extends React.Component {
getPage = (params, values, callPage, pageNo) => { getPage = (params, values, callPage, pageNo) => {
const { objCode } = this.props; const { objCode } = this.props;
if (this.columns == null || this.columns.length === 0) { if (!this.columns || !Array.isArray(this.columns) || this.columns.length === 0) {
return; return;
} }
const { dispatch } = this.props; const { dispatch } = this.props;
...@@ -1159,7 +1159,6 @@ class FormList extends React.Component { ...@@ -1159,7 +1159,6 @@ class FormList extends React.Component {
render() { render() {
const { modalVisible, selectedRows, rights, data, isReady } = this.state; const { modalVisible, selectedRows, rights, data, isReady } = this.state;
if (!isReady) { if (!isReady) {
return ( return (
<div <div
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论