react+antd pro中获取后台数据传参

react+antd pro中获取后台数据传参

获取后台数据并渲染到页面中
// 这个是前端渲染
render: (convertStatusName: any, item: MailExtListItem) => {
        const menuDetail = (
           {
            console.log('domEvent:',domEvent,'item:',key)
            // key 为什么是mailUkid convertAction????
            domEvent.stopPropagation();
            this.onConvertClick(item.mailUkid, key)
          }}>
            {this.state.typeList.map((actionItem) => {
              return {actionItem.definedName};
            })}
          
        );
        return (
          
             {
                e.stopPropagation();
              }}
            >
              转化
              
            
          
        );
      }
 onConvertClick = (mailUkid: string, convertAction: string) => {
    console.log('mailUkid convertAction:::', mailUkid, convertAction);
    this.sendDoConvertRequest({
      mailUkid,
      convertAction
    })
  };
  sendDoConvertRequest = async (params: {
    mailUkid: string,
    convertAction: string,
  }) => {
    try {
      const res = await doConvertRequest({ ...params, convertActionSrc: 'CUSTOM' });
      if (res.success) {
        this.ref.reload();
      }

    } catch (error) {
      console.error(error);
    }
  };
// 这个是后台的接口
export async function doConvertRequest(params: {
  mailUkid: string,
  convertAction: string,
  convertActionSrc: string
}) {
  return request>('/billapi/eMail/doConvert', {
    method: 'POST',
    data: params,
  });
}
// 这个是命名空间的
declare namespace API_OBJ {
  interface ResponseDataType {
    data: T;
    errorCode: number;
    errorMessage: string;
    success: boolean;
  }

  type ResponsePageDataType = ResponseDataType<{
    list: T[];
    current?: number;
    pageSize?: number;
    total?: number;
  }>;

  type QueryPageParamType1 = {
    baseQuery: {
      current: string;
      pageSize: string;
    };
  };
// 这个是定义了后台需求column的类型
export type MailExtListItem = {
  sender: string;
  receiverGroup: string;
  emailTitle: string;
  emailContent: string;
  attatchmentNum: number;
  sendTime: string;
  receivedTime: string;
  timeSpent: string;
  mailTitle: string;
  convertStatus: number;
  convertStatusName: string;
  mailUkid: string;   // 后端要的数据
  convertAction: string; // 后端要的数据
  convertActionSrc: string; // 后端要的数据
}; 

你可能感兴趣的:(react,reactjs)