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

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

上级 5bf00c96
...@@ -9,20 +9,21 @@ ...@@ -9,20 +9,21 @@
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) {
super(props); super(props);
const value = props.value || {}; const value = props.value || {};
this.otherProps = {}; this.otherProps = {};
if (props.json.otherProps && props.json.otherProps.length) { if (props.json.otherProps && props.json.otherProps.length) {
try { try {
this.otherProps = new Function(props.json.otherProps)(); this.otherProps = new Function(props.json.otherProps)();
} catch (e) { } catch (e) {
console.log('Table 列表组件 otherProps 获取失败'); console.log('Table 列表组件 otherProps 获取失败');
} }
} }
// console.log(this.otherProps); // console.log(this.otherProps);
this.state = { this.state = {
isAll: value.isAll, isAll: value.isAll,
querys: value.querys, querys: value.querys,
...@@ -40,38 +41,43 @@ export default class TableList extends React.Component { ...@@ -40,38 +41,43 @@ 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);
showNo: true, this.setState(
}, () => { {
setTimeout(()=>{ showNo: true,
this.setState({ },
showNo: false, () => {
}); setTimeout(() => { // 如果两次的表头不同 重新渲染组件
}, 1000); this.setState({
}); showNo: false,
} });
} }, 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);
return null; if (showNo) {
} return null;
}
return isTree ? ( return isTree ? (
<TreeList <TreeList
otherProps={this.otherProps} otherProps={this.otherProps}
json={json} json={json}
onSelectRow={this.props.value.onSelectRow} onSelectRow={this.props.value.onSelectRow}
istableCom={true} istableCom={true}
showHeader={this.props.showHeader} showHeader={this.props.showHeader}
...@@ -84,26 +90,26 @@ export default class TableList extends React.Component { ...@@ -84,26 +90,26 @@ export default class TableList extends React.Component {
rights={this.props.rights || []} rights={this.props.rights || []}
objCode={this.props.objCode} objCode={this.props.objCode}
isFormCom={true} isFormCom={true}
uuid={uuid} uuid={uuid}
sql={this.props.sql} sql={this.props.sql}
/> />
) : ( ) : (
<FormList <FormList
otherProps={this.otherProps} otherProps={this.otherProps}
json={json} json={json}
onSelectRow={this.props.value.onSelectRow} onSelectRow={this.props.value.onSelectRow}
getCheckboxProps={this.props.value.getCheckboxProps} getCheckboxProps={this.props.value.getCheckboxProps}
istableCom={true} istableCom={true}
showHeader={this.props.showHeader} showHeader={this.props.showHeader}
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}
isFormCom={true} isFormCom={true}
uuid={uuid} uuid={uuid}
sql={this.props.sql} sql={this.props.sql}
/> />
); );
......
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论