Commit 25918657 authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接 待会员入库考察 相关

parent a83ac814
......@@ -14,10 +14,59 @@ import { DatePicker } from '@formily/antd-components';
import NiceForm from '@/components/NiceForm';
import {
createFormActions,
FormEffectHooks,
} from '@formily/antd';
import {
schema,
} from './schema';
import { schema } from './schema';
export type FileType = {
/**
* 文件名
*/
name: string,
/**
* 状态
*/
status: string,
/**
* 缩略图
*/
thumbUrl: string,
/**
* uid
*/
uid: string,
/**
* 地址
*/
url: string,
}
export type ValueType = {
/**
* 考察日期
*/
inspectDay: string,
/**
* 考察评分
*/
score: number,
/**
* 考察结果
*/
result: string,
/**
* 考察报告
*/
reports: FileType[],
/**
* 提交审批的状态:0-不同意;1-同意
*/
agree: number,
/**
* 审核原因
*/
reason: string,
}
interface IProps {
/**
......@@ -27,20 +76,28 @@ interface IProps {
/**
* Form 确认事件
*/
onSubmit: (values: any) => void,
onSubmit: (values: ValueType) => void,
/**
* 抽屉关闭事件
*/
onClose: () => void,
/**
* 确认按钮 loading
*/
submitLoading: boolean,
}
const formActions = createFormActions();
const {
onFieldValueChange$,
} = FormEffectHooks;
const VerifyComingInvestigateDrawer: React.FC<IProps> = (props: IProps) => {
const {
visible,
onSubmit,
onClose,
submitLoading,
} = props;
const handleClose = () => {
......@@ -49,9 +106,10 @@ const VerifyComingInvestigateDrawer: React.FC<IProps> = (props: IProps) => {
}
};
const handleSubmit = (values: any) => {
const handleSubmit = (values: ValueType) => {
if (onSubmit) {
onSubmit(values);
const { score, ...rest } = values;
onSubmit({ score: +score, ...rest });
}
};
......@@ -70,7 +128,11 @@ const VerifyComingInvestigateDrawer: React.FC<IProps> = (props: IProps) => {
<Button onClick={handleClose} style={{ marginRight: 16 }}>
取 消
</Button>
<Button onClick={() => formActions.submit()} type="primary">
<Button
onClick={() => formActions.submit()}
type="primary"
loading={submitLoading}
>
确 定
</Button>
</div>
......@@ -81,8 +143,17 @@ const VerifyComingInvestigateDrawer: React.FC<IProps> = (props: IProps) => {
components={{
DatePicker,
}}
effects={() => {
effects={($, { setFieldState }) => {
onFieldValueChange$('agree').subscribe(fieldState => {
setFieldState('reason', state => {
state.title = fieldState.value === 0 ? '不通过原因' : '通过原因';
state.rules = fieldState.value === 0 ? [...state.rules, { required: true }] : [];
state.required = fieldState.value === 0;
setTimeout(() => {
formActions.validate('reason');
}, 0);
});
});
}}
actions={formActions}
schema={schema}
......
/*
* @Author: XieZhiXiong
* @Date: 2021-05-24 18:00:52
* @Date: 2021-06-02 20:10:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 09:59:12
* @LastEditTime: 2021-06-02 20:28:11
* @Description:
*/
import { ISchema } from '@formily/antd';
import {
UPLOAD_TYPE,
} from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp';
export const schema: ISchema = {
type: 'object',
......@@ -29,7 +30,7 @@ export const schema: ISchema = {
labelAlign: 'left',
},
properties: {
date: {
inspectDay: {
type: 'string',
title: '考察日期',
'x-component': 'DatePicker',
......@@ -40,17 +41,10 @@ export const schema: ISchema = {
},
},
required: true,
// 'x-rules': [
// {
// required: true,
// message: '请选择考察日期',
// },
// ],
},
score: {
type: 'string',
title: '考察评分',
'x-component': 'DatePicker',
'x-component-props': {
placeholder: '请选择',
style: {
......@@ -60,7 +54,11 @@ export const schema: ISchema = {
'x-rules': [
{
required: true,
message: '请选择考察评分',
message: '请输入考察评分',
},
{
pattern: PATTERN_MAPS.money,
message: '请输入两位小数',
},
],
},
......@@ -69,8 +67,7 @@ export const schema: ISchema = {
title: '考察结果',
'x-component': 'Textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
placeholder: '在此输入你的内容,最长60个字符,30个汉字',
rows: 5,
},
'x-rules': [
......@@ -80,17 +77,16 @@ export const schema: ISchema = {
}
],
},
files: {
reports: {
type: 'string',
title: '考察报告',
'x-component': 'AntUpload',
'x-component': 'FixUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/afterService/returnApplication/',
prefix: 'member_inspect_',
},
// beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
'x-rules': [
......
......@@ -13,7 +13,7 @@ import {
} from 'antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailBasicResponse } from '@/services/MemberApi';
import { GetMemberDepositInspectDetailResponse } from '@/services/MemberV2Api';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
......@@ -33,17 +33,16 @@ import MemberChannelInfo from '../components/MemberChannelInfo';
import PicWrap from '../components/PicWrap';
const MemberPrComingInvestigate: React.FC<{}> = () => {
const { id, validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailBasicResponse>(null);
const { validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberDepositInspectDetailResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false);
const getBasicInfo = () => {
if (!id || !validateId) {
if (!validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetailBasic({
memberId: id,
PublicApi.getMemberDepositInspectDetail({
validateId,
}).then(res => {
if (res.code === 1000) {
......@@ -77,8 +76,8 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
: null
),
...(
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({
memberInfo && memberInfo.registerDetails
? memberInfo.registerDetails.map((item, index) => ({
key: `group${index}`,
name: item.groupName,
}))
......@@ -131,7 +130,7 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.createTime,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
......@@ -159,14 +158,14 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
memberInfo && memberInfo.registerDetails
? memberInfo.registerDetails.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldCNName,
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
......
......@@ -30,7 +30,7 @@ const MemberPrComingInvestigate: React.FC<{}> = props => {
const ref = useRef<any>({});
const handleJumpAudit = record => {
history.push(`/memberCenter/memberAbility/manage/memberPrComingInvestigate/verify?id=${record.memberId}&validateId=${record.validateId}`);
history.push(`/memberCenter/memberAbility/manage/memberPrComingInvestigate/verify?validateId=${record.validateId}`);
};
const defaultColumns = verifyComingColumn('/memberCenter/memberAbility/manage/memberPrComingInvestigate/detail').concat([
......@@ -62,7 +62,7 @@ const MemberPrComingInvestigate: React.FC<{}> = props => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityMaintenancePage(payload);
const res = await PublicApi.getMemberDepositInspectPage(payload);
if (res.code === 1000) {
return res.data;
......@@ -72,7 +72,7 @@ const MemberPrComingInvestigate: React.FC<{}> = props => {
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await PublicApi.getMemberAbilityValidateCommitPageitems();
const res = await PublicApi.getMemberDepositPageConditions();
if (res.code === 1000) {
const { data = {} }: any = res;
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-25 14:03:05
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 14:03:05
* @LastEditTime: 2021-06-02 20:21:48
* @Description:
*/
import React, { useState, useEffect } from 'react';
......@@ -11,13 +11,15 @@ import {
Col,
Spin,
Button,
message,
} from 'antd';
import {
CheckCircleOutlined,
} from '@ant-design/icons';
import { history } from 'umi';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailBasicResponse } from '@/services/MemberApi';
import { GetMemberDepositInspectDetailResponse } from '@/services/MemberV2Api';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import AuditProcess from '@/components/AuditProcess';
......@@ -30,21 +32,21 @@ import {
} from '../constant';
import MemberBasicInfo from '../components/MemberBasicInfo';
import PicWrap from '../components/PicWrap';
import VerifyComingInvestigateDrawer from './components/VerifyComingInvestigateDrawer';
import VerifyComingInvestigateDrawer, { ValueType } from './components/VerifyComingInvestigateDrawer';
const MemberPrComingInvestigate: React.FC<{}> = () => {
const { id, validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailBasicResponse>(null);
const { validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberDepositInspectDetailResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false);
const [visibleVerifyDrawer, setVisibleVerifyDrawer] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const getBasicInfo = () => {
if (!id || !validateId) {
if (!validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetailBasic({
memberId: id,
PublicApi.getMemberDepositInspectDetail({
validateId,
}).then(res => {
if (res.code === 1000) {
......@@ -59,16 +61,38 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
getBasicInfo();
}, []);
const handleVerify = () => {
console.log('审核')
};
const handleVisibleVerifyDrawer = (flag?) => {
setVisibleVerifyDrawer(!!flag);
};
const handleSubmit = () => {
console.log('表单提交')
const handleSubmit = (value: ValueType) => {
setSubmitLoading(true);
const payload = {
validateId,
...value,
reports: value.reports.map((item) => ({
url: item.url,
name: item.name,
})),
};
const msg = message.loading({
content: '正在提交,请稍候...',
duration: 0,
});
PublicApi.postMemberDepositInspect(payload, {
timeout: 0,
}).then(res => {
if (res.code !== 1000) {
return;
}
handleVisibleVerifyDrawer(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
msg();
setSubmitLoading(false);
});
};
const anchorsArr = [
......@@ -81,8 +105,8 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
name: '基本信息',
},
...(
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({
memberInfo && memberInfo.registerDetails
? memberInfo.registerDetails.map((item, index) => ({
key: `group${index}`,
name: item.groupName,
}))
......@@ -144,7 +168,7 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.createTime,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
......@@ -152,14 +176,14 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
memberInfo && memberInfo.registerDetails
? memberInfo.registerDetails.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldCNName,
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
......@@ -195,6 +219,7 @@ const MemberPrComingInvestigate: React.FC<{}> = () => {
<VerifyComingInvestigateDrawer
visible={visibleVerifyDrawer}
onClose={() => handleVisibleVerifyDrawer(false)}
submitLoading={submitLoading}
onSubmit={handleSubmit}
/>
</Spin>
......
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