Please take a look at this for me. Why did you report it wrong?

Let"s take a look at this for me. Why did you report it wrong?

import React, { Component, Fragment } from "react";
import {bindActionCreators} from "redux";
import {getApplyAudit} from "./actions/approve-actions";
import {connect} from "react-redux";
import {Steps} from "antd";
import moment from "moment";
const Step = Steps.Step;

class ApproveSituation extends Component {
    constructor() {
        super();
        this.state={
            status: "",

        };
    }

    componentWillMount(record) {
        const {busiType} = this.props;
        let busi_type = busiType?busiType:"";
        this.props.getApplyAudit(record.id,busi_type=="container"?"container":"apply");

    }

    componentDidMount() {

    }
    checkStatus = (record) => {
        switch (record) {
            case "1":
                return "wait";
            case "2":
                return "process";
            case "3":
                return "finish";
            case "4":
                return "error";
            default: return null;
        }
    }

    getStatus(data){
        let status = [];
        if(data){
            for(let i = 1;i < data.length;iPP){
                if(data[i].state != 3){
                    status.push(i);
                    status.push(data[i].state);
                    return status;
                }
            }
        }
    }

    render(){
        const {auditStateList} = this.props;
        console.log(auditStateList);
        const state = this.getStatus(auditStateList ? auditStateList.result ? auditStateList.result : [] : []);
        console.log("state:",state)
        const dataSource = auditStateList ? (auditStateList.result && Array.isArray(auditStateList.result))?
            auditStateList.result.map((item)=>
                <Step key={item.id} value={item.state} title={item.name}
                      description={<div style={{ display: "flex", justifyContent: "center" }}>
                          {item.time ? moment(item.time).format("YYYY/MM/DD"):""}</div>}/>) :[]:[];

        return (
            <Steps progressDot current={state ? state[0] ? state[0] : null : null}
                   status={this.checkStatus(state ? state[1] ? state[1] : null : null)}>
                {dataSource}
            </Steps>

        )
    }

}
function mapStateToProps(state) {
    return {
        auditRuleList:state.auditStateList
    }
}

function mapDispatchToProps(dispatch){
    return{
        getApplyAudit : bindActionCreators(getApplyAudit, dispatch),

    }
}
export default connect(mapDispatchToProps,mapStateToProps)(ApproveSituation);


//action
export function getApplyAudit(id,type,state) {
    const path="/auditing/getApplyAuditInfo";
    return{
    type:"APPLY_AUDIT_INFO",
        payload: {
            promise: api.get(path, {
                params:{
                    id,
                    type,
                    state
                }
            })
        }
    }
}
//reducer
case "APPLY_AUDIT_INFO_PENDING":
    return {...state,auditStateList:{loading:true}};
case "APPLY_AUDIT_INFO_SUCCESS":
    return {...state,auditStateList:{result:action.payload, loading:false}};
case "APPLY_AUDIT_INFO_ERROR":
    return {...state,auditStateList:{loading:false}};
Apr.15,2021

from the code you posted, I don't see whether state.approveReducer is defined

.
function mapStateToProps(state) {
    return {
        auditRuleList:state.approveReducer.auditStateList
    }
}

if state.approveReducer in this function is empty, you will report this error by using state.approveReducer.auditStateList directly.


change componentWillMount to componentWillReceiveProps

componentWillMount function has no formal parameter

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e444f2-44ab9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e444f2-44ab9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?