Commit 1c8b104a authored by XieZhiXiong's avatar XieZhiXiong

chore: 展示资质证明

parent 84841277
......@@ -2,10 +2,10 @@
* @Author: XieZhiXiong
* @Date: 2021-06-01 20:03:23
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-15 13:54:42
* @LastEditTime: 2021-07-05 16:15:48
* @Description: 补充资质证明抽屉
*/
import React from 'react';
import React, { useMemo } from 'react';
import {
Drawer,
Button,
......@@ -13,7 +13,8 @@ import {
import {
createFormActions,
} from '@formily/antd';
import { DatePicker, Checkbox } from '@formily/antd-components'
import { DatePicker, Checkbox } from '@formily/antd-components';
import { normalizeFiledata } from '@/utils';
import NiceForm from '@/components/NiceForm';
import { schema } from './schema';
import { useBusinessEffects } from '../../../components/QualitiesUploadFormItem/effects';
......@@ -43,7 +44,7 @@ export type FileType = {
url: string,
}
export type ValueType = {
export type SubmitValueType = {
/**
* 文件
*/
......@@ -58,15 +59,38 @@ export type ValueType = {
permanent: number[],
}
export type ValueType = {
/**
* 文件name
*/
name: string,
/**
* 文件url
*/
url: string,
/**
* 到期日
*/
expireDay: string,
/**
* 有效期
*/
permanent: number,
}
interface IProps {
/**
* 值
*/
value: ValueType[],
/**
* 是否可见
*/
visible: boolean,
/**
* Form 确认事件
*/
onSubmit: (values: ValueType[]) => void,
onSubmit: (values: SubmitValueType[]) => void,
/**
* 抽屉关闭事件
*/
......@@ -77,6 +101,7 @@ const formActions = createFormActions();
const UploadQualificationsDrawer: React.FC<IProps> = (props: IProps) => {
const {
value = [],
visible,
onSubmit,
onClose,
......@@ -88,12 +113,20 @@ const UploadQualificationsDrawer: React.FC<IProps> = (props: IProps) => {
}
};
const handleSubmit = (values: { qualities: ValueType[] }) => {
const handleSubmit = (values: { qualities: SubmitValueType[] }) => {
if (onSubmit) {
onSubmit(values.qualities);
}
};
const initialValues = useMemo(() => ({
qualities: value.map((item) => ({
file: item.url ? [normalizeFiledata(item.url)] : [],
expireDay: item.expireDay,
permanent: item.permanent === 1 ? [item.permanent] : [],
})),
}), [value]);
return (
<Drawer
title="补充资质证明"
......@@ -117,6 +150,7 @@ const UploadQualificationsDrawer: React.FC<IProps> = (props: IProps) => {
>
<NiceForm
previewPlaceholder=" "
initialValues={initialValues}
components={{
DatePicker,
Checkbox,
......
......@@ -36,7 +36,7 @@ import DepositDetailsCard from './components/DepositDetailsCard';
import PicWrap from '../components/PicWrap';
import VerifyComingDataDrawer, { ValueType as VerifyData } from './components/VerifyComingDataDrawer';
import ChangeComingDataDrawer, { ValueType as ComingData, RefHandle } from './components/ChangeComingDataDrawer';
import UploadQualificationsDrawer, { ValueType as QualificationData } from './components/UploadQualificationsDrawer';
import UploadQualificationsDrawer, { SubmitValueType as QualificationData } from './components/UploadQualificationsDrawer';
const MemberPrVerifyComingDataVerify: React.FC<{}> = () => {
const { validateId } = usePageStatus();
......@@ -314,6 +314,7 @@ const MemberPrVerifyComingDataVerify: React.FC<{}> = () => {
/>
<UploadQualificationsDrawer
value={memberInfo?.qualities}
visible={visibleQualificationsDrawer}
onClose={() => handleVisibleQualificationsDrawer(false)}
onSubmit={handleQualificationsSubmit}
......
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