Commit 0b7d2410 authored by XieZhiXiong's avatar XieZhiXiong

chore: 手动添加 无 选项

parent e308c27c
......@@ -7,11 +7,16 @@
*/
import React, { useState, useEffect } from 'react';
export type ResponseType<P> = {
data: P,
code: number
}
export interface IConfig<P> {
/**
* 请求详情方法
*/
fetchDetail: () => Promise<{ data: P }>;
fetchDetail: () => Promise<ResponseType<P>>;
/**
* fetch callback
*/
......@@ -27,8 +32,10 @@ const FetchDetailHoc = <P, T extends {}>(config: IConfig<P>, WrapComponent: Reac
if (fetchDetail) {
setLoading(true);
fetchDetail().then((res) => {
setDetail(res.data);
fetchCallback?.(res.data);
if (res.code === 1000) {
setDetail(res.data);
fetchCallback?.(res.data);
}
}).finally(() => {
setLoading(false);
});
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-24 17:01:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-14 11:43:28
* @LastEditTime: 2021-07-26 11:44:28
* @Description: 审核入库资料
*/
import React, { useState, useRef } from 'react';
......@@ -23,8 +23,8 @@ import { normalizeFiledata } from '@/utils';
import VerifyComingDataDrawer, { ValueType as VerifyData } from './components/VerifyComingDataDrawer';
import ChangeComingDataDrawer, { ValueType as ComingData, RefHandle } from './components/ChangeComingDataDrawer';
import UploadQualificationsDrawer, { SubmitValueType as QualificationData } from './components/UploadQualificationsDrawer';
import fetchDetailHoc from '../common/hoc/fetchDetailHoc';
import MemberProfile, { AreaCodeType } from '../components/MemberProfile';
import fetchDetailHoc, { ResponseType } from '../common/hoc/fetchDetailHoc';
import MemberProfile, { AreaCodeType, DetailType } from '../components/MemberProfile';
const MemberPrVerifyComingDataVerify: React.FC<{}> = () => {
const { validateId } = usePageStatus();
......@@ -105,10 +105,29 @@ const MemberPrVerifyComingDataVerify: React.FC<{}> = () => {
});
};
const fetchDetail = (): Promise<ResponseType<DetailType>> => {
return new Promise((resolve, reject) => {
PublicApi.getMemberDepositVerifyDetail({
validateId,
}).then((res) => {
const newUpperMembers = res.data?.upperMembers;
// 手动添加一个选项
if (newUpperMembers.findIndex((item) => item.upperRelationId === 0) === -1) {
newUpperMembers.unshift({
upperRelationId: 0,
name: '无',
});
}
resolve(res);
}).catch(err => {
reject(err);
});
});
};
const MemberProfilePro = fetchDetailHoc({
fetchDetail: () => PublicApi.getMemberDepositVerifyDetail({
validateId,
}),
fetchDetail: fetchDetail,
fetchCallback: (info) => {
// 要手动将旧数据带过去
const depositDetails = {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment