Commit 1c8b104a authored by XieZhiXiong's avatar XieZhiXiong

chore: 展示资质证明

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