Commit 61ba864a authored by XieZhiXiong's avatar XieZhiXiong

chore: 删除无用的文件

parent af4ab061
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from './components/DetailInfo';
const AuditPrSubmit: React.FC = () => {
const { id, validateId } = usePageStatus();
return (
<DetailInfo id={id} validateId={validateId} isEdit />
);
};
export default AuditPrSubmit;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { history, Prompt } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
PageHeader,
Tag,
Descriptions,
Button,
Badge,
Spin,
Modal,
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityValidateCommitDetailResponse } from '@/services/MemberApi';
import { createAsyncFormActions, createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import AvatarWrap from '@/components/AvatarWrap';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import { MEMBER_INNER_STATUS_BADGE_COLOR, MEMBER_STATUS_TAG_MAP, MEMBER_OUTER_STATUS_TYPE } from '../../../constant';
import { channelSchema } from './schema';
import { auditModalSchema } from '../../../schema/auditSchema';
import AuditProcess from '../../../components/AuditProcess';
import BasicInfo from '../../../components/BasicInfo';
import StatusTag from '../../../components/StatusTag';
import styles from './index.less';
interface AreaItem {
name: string;
code: string;
children: AreaItem[];
};
interface MemberInfo extends GetMemberAbilityValidateCommitDetailResponse {
channelTypeName: string;
areasInfo: string[];
};
interface DetailInfoProps {
id?: string;
validateId?: string;
// 是否是编辑的
isEdit?: boolean;
};
const formActions = createAsyncFormActions();
const modalFormActions = createFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
onFormInputChange$,
} = FormEffectHooks;
const DetailInfo: React.FC<DetailInfoProps> = ({
id,
validateId,
isEdit = false,
}) => {
const [memberInfo, setMemberInfo] = useState<MemberInfo>(null);
const [modalVisible, setModalVisible] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const [unsaved, setUnsaved] = useState(false);
// 获取渠道代理 区域信息
const getAreasInfo = (
vals: { pcode: string, ccode: string }[] = [],
source: AreaItem[] = []
) => {
const ret = [];
vals.forEach(val => {
const { pcode, ccode } = val;
const province = source.find(item => item.code === pcode);
if (province) {
let str = province.name;
// 存在 市级
if (ccode && province && province.children) {
const city = province.children.find(item => item.code === ccode);
if (city) {
str += `/${city.name}`;
}
}
ret.push(str);
}
});
return ret;
};
const getDetailedInfo = () => {
if (id && validateId) {
setInfoLoading(true);
PublicApi.getMemberAbilityValidateCommitDetail({
memberId: id,
validateId,
}).then(res => {
if (res.code !== 1000) {
return;
}
const {
areaCodes = [],
areas = [],
channelTypes = [],
channelTypeId,
} = (res.data || {});
const areasOptions = areas.map(item => ({ label: item.name, value: item.code }));
const channelType = channelTypes.map(item => ({ label: item.channelTypeName, value: item.channelTypeId }));
const channelTypeVal = channelTypes.find(item => item.channelTypeId === channelTypeId);
const areasInfo = getAreasInfo(areaCodes, areas as any);
if (areasOptions.length) {
formActions.setFieldState('areas.*.pcode', state => {
FormPath.setIn(state, 'props.enum', areasOptions);
});
}
formActions.setFieldState('channelTypeId', state => {
FormPath.setIn(state, 'props.enum', channelType);
});
setMemberInfo({
...res.data,
channelTypeName: channelTypeVal ? channelTypeVal.channelTypeName : '',
areasInfo,
});
}).finally(() => {
setInfoLoading(false);
});
}
};
useEffect(() => {
getDetailedInfo();
}, []);
const useInitEffect = () => {
// 主动的渠道信息省级变化,重置市级 value
onFieldInputChange$('areas.*.pcode').subscribe(fieldState => {
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areas.${$1}.ccode`),
state => {
FormPath.setIn(state, 'value', undefined);
}
);
});
// 渠道信息省级变化,筛选出对应的市级数据
onFieldValueChange$('areas.*.pcode').subscribe(fieldState => {
const province: AreaItem =
(memberInfo.areas || []).find(item => item.code === fieldState.value) as AreaItem;
if (!province) {
return;
}
const city = (province.children || []).map(item => ({ label: item.name, value: item.code }));
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areas.${$1}.ccode`),
state => {
FormPath.setIn(state, 'props.enum', city);
}
);
});
}
// 修改渠道信息
const handleChannelSubmit = value => {
if (!isEdit) {
return;
}
const { channelLevel, areas = [], ...rest } = value;
const filtered = areas.filter(item => item.pcode || item.ccode);
return PublicApi.postMemberAbilityValidateCommitChannelUpdate({
memberId: id,
validateId,
areas: filtered,
...rest,
}, {
ctlType: 'none',
});
};
// 提交审核
const handleSubmit = async values => {
if (!isEdit) {
return;
}
setConfirmLoading(true);
// 存在渠道信息,则先修改渠道信息,在提交审核结果
if (
memberInfo.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE ||
memberInfo.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
) {
const updatedRes: any = await formActions.submit();
if (updatedRes.payload.code !== 1000) {
setConfirmLoading(false);
return;
}
}
const commitRes = await PublicApi.postMemberAbilityValidateCommitSubmit({
memberId: id,
validateId: validateId,
...values,
});
if (commitRes.code === 1000) {
setModalVisible(false);
setUnsaved(false);
setTimeout(() => {
history.goBack();
}, 800);
}
setConfirmLoading(false);
};
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
style={{
padding: 24,
}}
title={
<>
<PageHeader
style={{ padding: 0 }}
onBack={() => history.goBack()}
title={
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<span style={{ fontSize: 12, fontWeight: 'normal' }}>{memberInfo?.levelTag}</span>
)}
/>
}
extra={(
<>
{isEdit && (
<Button
type="primary"
icon={<FormOutlined />}
onClick={() => setModalVisible(true)}
>
提交审核
</Button>
)}
</>
)}
>
<Descriptions
size="small"
column={3}
style={{
padding: '0 32px',
}}
>
<Descriptions.Item label="会员类型">{memberInfo?.memberTypeName}</Descriptions.Item>
<Descriptions.Item label="会员角色" span={2}>{memberInfo?.roleName}</Descriptions.Item>
<Descriptions.Item label="会员状态">
<StatusTag type={MEMBER_STATUS_TAG_MAP[memberInfo?.status]} title={memberInfo?.statusName} />
</Descriptions.Item>
<Descriptions.Item label="外部状态">
<StatusTag type={MEMBER_OUTER_STATUS_TYPE[memberInfo?.outerStatus]} title={memberInfo?.outerStatusName} />
</Descriptions.Item>
<Descriptions.Item label="内部状态">
<Badge color={MEMBER_INNER_STATUS_BADGE_COLOR[memberInfo?.innerStatus]} text={memberInfo?.innerStatusName} />
</Descriptions.Item>
</Descriptions>
</PageHeader>
</>
}
>
<div
style={{
marginBottom: 24,
}}
>
<AuditProcess
outerVerifySteps={memberInfo?.outerVerifySteps}
innerVerifySteps={memberInfo?.innerVerifySteps}
outerVerifyCurrent={
memberInfo && memberInfo.currentOuterStep > 0 ?
memberInfo.currentOuterStep - 1 :
0
}
innerVerifyCurrent={
memberInfo && memberInfo.currentInnerStep > 0 ?
memberInfo.currentInnerStep -1 :
0
}
/>
</div>
<BasicInfo
basic={{
account: memberInfo?.account,
phone: memberInfo?.phone,
email: memberInfo?.email,
created: memberInfo?.registerTime,
}}
channel={{
memberType: memberInfo?.memberTypeEnum,
level: memberInfo?.channelLevelTag,
type: memberInfo?.channelTypeName,
areas: memberInfo?.areasInfo,
desc: memberInfo?.remark,
}}
extra={memberInfo?.groups}
outerHistory={memberInfo?.outerHistory}
innerHistory={memberInfo?.innerHistory}
channelRender={isEdit ? (
<NiceForm
onSubmit={handleChannelSubmit}
actions={formActions}
initialValues={{
channelLevel: memberInfo?.channelLevelTag,
channelTypeId: memberInfo?.channelTypeId,
areas: memberInfo?.areaCodes,
remark: memberInfo?.remark,
}}
effects={($, actions) => {
useInitEffect();
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
}}
schema={channelSchema}
/>
): null}
/>
<Modal
title="提交审核"
visible={modalVisible}
confirmLoading={confirmLoading}
onOk={() => modalFormActions.submit()}
onCancel={() => setModalVisible(false)}
destroyOnClose
>
<NiceForm
effects={($, { setFieldState }) => {
onFieldValueChange$('agree').subscribe(fieldState => {
setFieldState('reason', state => {
state.visible = !fieldState.value;
});
});
}}
actions={modalFormActions}
schema={auditModalSchema}
onSubmit={handleSubmit}
/>
</Modal>
</PageHeaderWrapper>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</Spin>
);
};
export default DetailInfo;
/*
* @Author: XieZhiXiong
* @Date: 2020-09-07 16:33:12
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-21 17:39:44
* @Description:
*/
import { ISchema } from '@formily/antd';
export const channelSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelWidth: 128,
labelAlign: 'left',
full: true,
grid: true,
autoRow: true,
columns: 2,
},
properties: {
channelLevel: {
type: 'text',
title: '渠道级别',
},
channelTypeId: {
type: 'string',
enum: [],
title: '渠道类型',
required: true,
},
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
inline: true,
},
properties: {
areas: {
type: 'array',
title: '代理城市',
required: true,
'x-component': 'CustomAddArray',
default: [],
items: {
type: 'object',
properties: {
pcode: {
type: 'string',
enum: [],
'x-component-props': {
allowClear: true,
},
},
ccode: {
type: 'string',
enum: [],
'x-component-props': {
allowClear: true,
},
}
}
}
},
},
},
remark: {
type: 'string',
title: '渠道描述',
'x-component': 'TextArea',
'x-component-props': {
rows: 5,
placeholder: '最大200个字符,100个汉字',
},
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 200,
}
],
},
},
},
},
};
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import { Card, Space, Button, Badge, Modal, message } from 'antd';
import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api';
import { auditSchema } from '../schema/auditSchema';
import {
MEMBER_STATUS_TAG_MAP,
MEMBER_INNER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_TYPE,
} from '../constant';
import { coverColFiltersItem } from '../utils';
import StatusTag from '../components/StatusTag';
import LevelBrand from '../../../components/LevelBrand';
const { confirm } = Modal;
const formActions = createFormActions();
const MemberPrSubmit: React.FC<{}> = props => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [selectedList, setSelectList] = useState<any>([]);
const handleJumpAudit = record => {
history.push(`/memberCenter/memberAbility/manage/memberPrSubmit/verify?id=${record.memberId}&validateId=${record.validateId}`);
};
const defaultColumns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'memberId',
align: 'center',
},
{
title: '会员名称',
dataIndex: 'name',
align: 'center',
render: (text: any, record: any) => (
<>
<EyePreview
url={`/memberCenter/memberAbility/manage/memberPrSubmit/detail?id=${record.memberId}&validateId=${record.validateId}`}
>
{text}
</EyePreview>
<div>
<LevelBrand level={record.level} />
</div>
</>
),
},
{
title: '会员类型',
dataIndex: 'memberTypeName',
align: 'center',
render: (text: any, record: any) => <span>{text}</span>,
},
{
title: '会员角色',
dataIndex: 'roleName',
align: 'center',
render: (text: any, record: any) => <span>{text}</span>,
},
{
title: '申请来源/时间',
dataIndex: 'sourceName',
align: 'center',
render: (text, record) => (
<>
<div>{text}</div>
<div>
<ClockCircleOutlined /> {record.registerTime}
</div>
</>
),
},
{
title: '会员状态',
dataIndex: 'statusName',
align: 'center',
filters: [],
onFilter: (value, record) => record.status === value,
render: (text, record) => (
<StatusTag type={MEMBER_STATUS_TAG_MAP[record.status]} title={text} />
),
},
{
title: '外部状态',
dataIndex: 'outerStatusName',
align: 'center',
render: (text, record) => (
<StatusTag type={MEMBER_OUTER_STATUS_TYPE[record.outerStatus]} title={text} />
),
},
{
title: '内部状态',
dataIndex: 'innerStatusName',
align: 'center',
render: (text, record) => <Badge color={MEMBER_INNER_STATUS_BADGE_COLOR[record.innerStatus]} text={text} />,
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text: any, record: any) => (
<Button
type="link"
onClick={() => handleJumpAudit(record)}
>
提交审核
</Button>
),
},
];
const [columns, setColumns] = useState<any[]>(defaultColumns);
const rowSelection = {
onChange: (keys: any, rows: {}[]) => {
setSelectedRowKeys(keys);
setSelectList(rows);
},
selectedRowKeys: selectedRowKeys,
};
const fetchListData = async (params: any) => {
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityValidateCommitPage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const handleBatch = () => {
if (!selectedList.length) {
message.warning('未选择任何会员');
return;
}
confirm({
title: '提示',
icon: <QuestionCircleOutlined />,
content: '确定要审核通过选中的会员吗?',
onOk() {
const members = selectedList.map(item => ({ memberId: item.memberId, validateId: item.validateId }));
return new Promise((resolve, reject) => {
PublicApi.postMemberAbilityValidateCommitBatch(members)
.then(res => {
if (res.code === 1000) {
ref.current.reload();
setSelectedRowKeys([]);
resolve();
}
reject();
})
.catch(() => {
reject();
});
});
},
});
};
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await PublicApi.getMemberAbilityValidateCommitPageitems();
if (res.code === 1000) {
const { data = {} }: any = res;
const {
memberTypes = [],
status = [],
roles = [],
levels = [],
sources = [],
} = data;
const newColumns = columns.slice();
// filter 0 过滤掉全部选项
coverColFiltersItem(
newColumns,
'statusName',
status.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
);
setColumns(newColumns);
return {
memberTypeId: memberTypes.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
status: status.map(item => ({ label: item.text, value: item.id })),
roleId: roles.map(item => ({ label: item.roleName, value: item.roleId })),
level: levels.map(item => ({ label: item.levelTag, value: item.level })),
source: sources.map(item => ({ label: item.text, value: item.id })),
};
}
return {};
};
const controllerBtns = (
<Space>
<Button onClick={handleBatch}>
批量审核通过
</Button>
</Space>
);
return (
<Card>
<StandardTable
tableProps={{
rowKey: 'validateId',
}}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchListData(params)}
rowSelection={rowSelection}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
useAsyncInitSelect(
['memberTypeId', 'status', 'level', 'roleId', 'level', 'source'],
fetchSearchItems,
);
}}
schema={auditSchema}
/>
}
/>
</Card>
);
};
export default MemberPrSubmit;
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from './components/DetailInfo';
const PrSubmitDetail: React.FC = () => {
const { id, validateId, pageStatus } = usePageStatus();
return (
<DetailInfo id={id} validateId={validateId} />
);
};
export default PrSubmitDetail;
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2020-09-07 16:33:12
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-08 14:24:08
* @Description:
*/
import { ISchema } from '@formily/antd';
export const channelSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelWidth: 128,
labelAlign: 'left',
full: true,
grid: true,
autoRow: true,
columns: 2,
},
properties: {
channelLevel: {
type: 'text',
title: '渠道级别',
},
channelTypeId: {
type: 'string',
enum: [],
title: '渠道类型',
required: true,
},
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
inline: true,
},
properties: {
areas: {
type: 'array',
title: '代理城市',
required: true,
'x-component': 'CustomAddArray',
default: [],
items: {
type: 'object',
properties: {
pcode: {
type: 'string',
enum: [],
'x-component-props': {
allowClear: true,
},
},
ccode: {
type: 'string',
enum: [],
'x-component-props': {
allowClear: true,
},
}
}
}
},
},
},
remark: {
type: 'string',
title: '渠道描述',
'x-component': 'TextArea',
'x-component-props': {
rows: 5,
placeholder: '最大200个字符,100个汉字',
},
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 200,
}
],
},
},
},
},
};
\ No newline at end of file
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