Commit a3da2db9 authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接完毕 会员规则流程配置 相关

parent 90e8fd53
......@@ -6,13 +6,11 @@
* @Description: 新建会员管理流程规则
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import FlowRuleForm from './components/FlowRuleForm';
const MemberFlowRuleAdd: React.FC = () => {
const { id, validateId } = usePageStatus();
return (
<FlowRuleForm id={id} validateId={validateId} isEdit />
<FlowRuleForm isEdit />
);
};
......
......@@ -2,27 +2,45 @@
* @Author: XieZhiXiong
* @Date: 2021-05-28 15:24:56
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 15:24:57
* @LastEditTime: 2021-06-01 14:44:31
* @Description:
*/
import React from 'react';
import { Popconfirm, Button } from 'antd';
import { Popconfirm, Button, Row, Col } from 'antd';
import theme from '../../../../../../../../config/lingxi.theme.config';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import ComingCtl, { ValueType as ComingCtlValueType } from '../ComingCtl';
import Search from '../Search';
const ComingConfigTable = (props) => {
const {
value = [],
mutators,
editable,
} = props;
const { roleId } = (props.props['x-component-props'] || {});
const handleDelete = (id: number) => {
const newData = [...value];
const index = newData.findIndex((item) => item.id === id);
if (index !== -1) {
newData.splice(index, 1);
}
mutators.change(newData);
};
const ComingConfigTable = () => {
const columns: EditableColumns[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
},
{
title: '中文名称',
dataIndex: 'name',
dataIndex: 'fieldLocalName',
},
{
title: '分组信息',
title: '分组名称',
dataIndex: 'groupName',
},
{
......@@ -30,51 +48,63 @@ const ComingConfigTable = () => {
dataIndex: 'option',
width: '20%',
align: 'center',
render: (text: any, record: any) => (
render: (_, record: any) => (
<>
<Popconfirm
title="确定要删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {}}
>
<Button
type="link"
danger
{editable && (
<Popconfirm
title="确定要删除吗?"
okText="是"
cancelText="否"
onConfirm={() => handleDelete(record.id)}
>
删除
</Button>
</Popconfirm>
<Button
type="link"
danger
>
删除
</Button>
</Popconfirm>
)}
</>
),
},
];
const handleConfirm = (value: ComingCtlValueType[]) => {
mutators.change(value);
};
return (
<PolymericTable
rowKey="id"
dataSource={[
{
id: 1,
name: '企业名称',
groupName: '营业执照信息',
},
{
id: 2,
name: '住所',
groupName: '营业执照信息',
},
{
id: 3,
name: '企业类型',
groupName: '营业执照信息',
},
]}
columns={columns}
loading={false}
pagination={null}
/>
<>
<Row
justify="space-between"
style={{
marginBottom: theme['@margin-md'],
}}
>
<Col span={16}>
<ComingCtl
value={value}
roleId={roleId}
onConfirm={handleConfirm}
isCanAdd={editable}
/>
</Col>
<Col span={6}>
<Search value={''} onChange={() => {}} onSearch={() => {}} />
</Col>
</Row>
<PolymericTable
rowKey="id"
dataSource={value}
columns={columns}
loading={false}
pagination={null}
/>
</>
);
};
ComingConfigTable.isFieldComponent = true;
export default ComingConfigTable;
......@@ -2,15 +2,15 @@
* @Author: XieZhiXiong
* @Date: 2021-05-28 15:19:56
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 15:48:37
* @LastEditTime: 2021-06-01 14:47:01
* @Description: 入库资料操作组
*/
import React, { useState, useRef } from 'react';
import React, { useState, useRef, useEffect } from 'react';
import { PlusOutlined } from '@ant-design/icons';
import { Space, Button, Drawer } from 'antd';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions, useSchemaProps } from '@formily/antd';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import NiceForm from '@/components/NiceForm';
......@@ -18,45 +18,52 @@ import querySchema from './schema';
const formActions = createFormActions();
const fetchListData = async (params: any) => {
const payload = { ...params };
const res = await PublicApi.getMemberAbilitySubPage(payload);
if (res.code === 1000) {
// return res.data;
return {
data: [
{
validateId: 1,
id: 1,
roleName: '白银会员',
roleType: '白银会员2',
},
{
validateId: 2,
id: 2,
roleName: '白银会员3',
roleType: '白银会员3',
},
{
validateId: 3,
id: 3,
roleName: '白银会员4',
roleType: '白银会员4',
},
],
totalCount: 3,
};
}
return [];
export type ValueType = {
/**
* 注册资料Id
*/
id: number,
/**
* 中文名称
*/
fieldLocalName: string,
/**
* 中文名称
*/
groupName: string,
};
const ComingCtl: React.FC = () => {
interface IProps {
/**
* 角色id
*/
roleId: number,
/**
* 点击确认事件触发
*/
onConfirm: (value: ValueType[]) => void,
/**
* 值
*/
value?: ValueType[],
/**
* 是否可新增的
*/
isCanAdd?: boolean,
}
const ComingCtl = (props: IProps) => {
const {
roleId,
onConfirm,
value,
isCanAdd,
} = props;
const [visibleDrawer, setVisibleDrawer] = useState(false);
const ref = useRef<any>({});
const schemaProps = useSchemaProps();
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'validateId' });
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const columns: ColumnType<any>[] = [
{
......@@ -64,42 +71,64 @@ const ComingCtl: React.FC = () => {
dataIndex: 'id',
},
{
title: '会员角色',
dataIndex: 'roleName',
},
{
title: '角色类型',
dataIndex: 'roleType',
title: '中文名称',
dataIndex: 'fieldLocalName',
},
{
title: '会员类型',
dataIndex: 'memberTypeName',
},
{
title: '业务类型',
dataIndex: 'memberTypeName',
title: '分组名称',
dataIndex: 'groupName',
},
];
const fetchListData = async (params: any) => {
if (!roleId) {
return {};
}
const payload = { ...params, roleId };
const res = await PublicApi.getMemberProcessRuleConfigPage(payload);
if (res.code === 1000) {
return res.data;
}
return {};
};
useEffect(() => {
if (ref && ref.current && ref.current.reload){
ref.current.reload({ roleId });
}
}, [props.roleId]);
useEffect(() => {
if ('value' in props) {
// 同步
RowCtl.setSelectRow(value);
RowCtl.setSelectedRowKeys(value.map((item) => item.id));
}
}, [value]);
const handleVisibleDrawer = (flag: boolean) => {
setVisibleDrawer(!!flag);
};
const handleConfirm = () => {
console.log('RowCtlRowCtlRowCtl', RowCtl);
// props.mutators.change([]);
if (onConfirm) {
onConfirm(RowCtl.selectRow);
handleVisibleDrawer(false);
}
};
return (
<div>
<Space size="middle">
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => handleVisibleDrawer(true)}
>
新建入库资料
</Button>
{isCanAdd && (
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => handleVisibleDrawer(true)}
>
新建入库资料
</Button>
)}
<Button>
预览入库资料
</Button>
......@@ -127,7 +156,7 @@ const ComingCtl: React.FC = () => {
>
<StandardTable
tableProps={{
rowKey: 'validateId',
rowKey: 'id',
}}
columns={columns}
currentRef={ref}
......@@ -149,4 +178,8 @@ const ComingCtl: React.FC = () => {
);
};
ComingCtl.defaultProps = {
isCanAdd: false,
};
export default ComingCtl;
......@@ -2,16 +2,16 @@
* @Author: XieZhiXiong
* @Date: 2021-05-28 11:20:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 14:59:42
* @LastEditTime: 2021-06-01 13:58:17
* @Description: 流程列表 Form Item
*/
import React, { useState } from 'react';
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
import classNames from 'classnames';
import StatusTag, { StatusTagProps } from '@/components/StatusTag';
import styles from './index.less';
interface AddressItem {
interface ListItem {
/**
* 数据id
*/
......@@ -19,11 +19,11 @@ interface AddressItem {
/**
* 标题
*/
title: string;
processName: string;
/**
* 流程
*/
flow: string;
processTypeName: string;
/**
* 描述
*/
......@@ -34,11 +34,11 @@ interface IProps extends Pick<StatusTagProps, 'type'> {
/**
* 值
*/
value: AddressItem;
value: string;
/**
* 列表数据
*/
dataSource: AddressItem[];
dataSource: ListItem[];
/**
* 默认展示的条数,默认值 3
*/
......@@ -77,7 +77,7 @@ const FlowListFormItem = (props: IProps) => {
const handleSelectItem = record => {
if (onChange && !disabled) {
onChange(record);
onChange(record.id);
}
};
......@@ -87,18 +87,18 @@ const FlowListFormItem = (props: IProps) => {
{showDataSource.map(item => (
<li
className={classNames(styles['list-item'], {
[styles.active]: item.id === (value && value.id),
[styles.active]: item.id === value,
[styles.disabled]: disabled,
[styles.hide]: readOnly && item.id !== (value && value.id),
[styles.hide]: readOnly && item.id !== value,
})}
onClick={() => handleSelectItem(item)}
key={item.id}
>
<div className={styles['list-item-head']}>
<div className={styles['list-item-title']}>
{item.title}
{item.processName}
</div>
<StatusTag title={item.flow} type={type} />
<StatusTag title={item.processTypeName} type={type} />
</div>
<div className={styles['list-item-desc']}>
{item.description}
......
......@@ -2,69 +2,73 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 17:12:55
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 11:16:25
* @LastEditTime: 2021-06-01 14:52:18
* @Description: 适用会员角色 Form Item
*/
import React, { useState, useRef } from 'react';
import { Button, Descriptions, Drawer } from 'antd';
import { Button, Descriptions, Drawer, message } from 'antd';
import {
PlusOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions, useSchemaProps } from '@formily/antd';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import NiceForm from '@/components/NiceForm';
import querySchema from './schema';
import styles from './index.less';
export type ValueType = {
/**
* 角色id
*/
roleId: number,
/**
* 角色名称
*/
roleName: string,
/**
* 角色类型
*/
roleTypeName: string,
/**
* 会员类型
*/
memberTypeName: string,
/**
* 业务类型
*/
businessTypeName: string,
};
const formActions = createFormActions();
const fetchListData = async (params: any) => {
const payload = { ...params };
const res = await PublicApi.getMemberAbilitySubPage(payload);
const res = await PublicApi.getMemberProcessRuleRolePage(payload);
if (res.code === 1000) {
// return res.data;
return {
data: [
{
validateId: 1,
id: 1,
roleName: '白银会员',
roleType: '白银会员2',
},
{
validateId: 2,
id: 2,
roleName: '白银会员3',
roleType: '白银会员3',
},
{
validateId: 3,
id: 3,
roleName: '白银会员4',
roleType: '白银会员4',
},
],
totalCount: 3,
};
return res.data;
}
return [];
};
const MemberRoleFormItem = (props) => {
const {
value,
mutators,
editable,
} = props;
const [visibleDrawer, setVisibleDrawer] = useState(false);
const ref = useRef<any>({});
const schemaProps = useSchemaProps();
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'validateId', type: 'radio' });
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'roleId', type: 'radio' });
const columns: ColumnType<any>[] = [
const columns: ColumnType<ValueType>[] = [
{
title: 'ID',
dataIndex: 'id',
dataIndex: 'roleId',
},
{
title: '会员角色',
......@@ -72,7 +76,7 @@ const MemberRoleFormItem = (props) => {
},
{
title: '角色类型',
dataIndex: 'roleType',
dataIndex: 'roleTypeName',
},
{
title: '会员类型',
......@@ -80,7 +84,7 @@ const MemberRoleFormItem = (props) => {
},
{
title: '业务类型',
dataIndex: 'memberTypeName',
dataIndex: 'businessTypeName',
},
];
......@@ -90,7 +94,11 @@ const MemberRoleFormItem = (props) => {
const handleConfirm = () => {
console.log('RowCtlRowCtlRowCtl', RowCtl);
// props.mutators.change([]);
if (!RowCtl.selectRow.length) {
message.warning('请选择会员角色');
}
mutators.change(RowCtl.selectRow[0]);
handleVisibleDrawer(false);
};
return (
......@@ -100,16 +108,17 @@ const MemberRoleFormItem = (props) => {
icon={<PlusOutlined />}
className={styles['memberRole-action']}
onClick={() => handleVisibleDrawer(true)}
disabled={!editable}
block
>
选择
</Button>
<div className={styles['memberRole-stamp']}>
<Descriptions column={1}>
<Descriptions.Item label="会员角色" labelStyle={{ width: 104 }}>供应商</Descriptions.Item>
<Descriptions.Item label="角色类型" labelStyle={{ width: 104 }}>服务消费者</Descriptions.Item>
<Descriptions.Item label="企业类型" labelStyle={{ width: 104 }}>企业会员</Descriptions.Item>
<Descriptions.Item label="业务类型" labelStyle={{ width: 104 }}>商品销售</Descriptions.Item>
<Descriptions.Item label="会员角色" labelStyle={{ width: 104 }}>{value?.roleName || ''}</Descriptions.Item>
<Descriptions.Item label="角色类型" labelStyle={{ width: 104 }}>{value?.roleTypeName || ''}</Descriptions.Item>
<Descriptions.Item label="会员类型" labelStyle={{ width: 104 }}>{value?.memberTypeName || ''}</Descriptions.Item>
<Descriptions.Item label="业务类型" labelStyle={{ width: 104 }}>{value?.businessTypeName || ''}</Descriptions.Item>
</Descriptions>
</div>
......@@ -135,7 +144,7 @@ const MemberRoleFormItem = (props) => {
>
<StandardTable
tableProps={{
rowKey: 'validateId',
rowKey: 'roleId',
}}
columns={columns}
currentRef={ref}
......
......@@ -2,14 +2,51 @@
* @Author: XieZhiXiong
* @Date: 2021-05-28 15:06:41
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 15:15:47
* @LastEditTime: 2021-06-01 10:59:23
* @Description: 平台注册资料
*/
import React from 'react';
import React, { useState, useEffect } from 'react';
import { Row, Col, Descriptions, Checkbox, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import theme from '../../../../../../../../config/lingxi.theme.config';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import Search from '../Search';
const PAGE_SIZE = 10;
interface FetchListParams {
/**
* 角色id
*/
roleId?: number,
/**
* 当前页
*/
current?: number,
/**
* 当前页数
*/
pageSize?: number,
}
interface IProps {
/**
* 角色id
*/
roleId: number,
}
const PlatformConfigTable = (props: IProps) => {
const {
roleId,
} = props;
const [page, setPage] = useState(1);
const [size, setSize] = useState(PAGE_SIZE);
const [loading, setLoading] = useState(false);
const [data, setData] = useState({ data: [], totalCount: 0 });
const PlatformConfigTable = () => {
const columns: EditableColumns[] = [
{
title: 'ID',
......@@ -18,7 +55,7 @@ const PlatformConfigTable = () => {
},
{
title: '中文名称',
dataIndex: 'name',
dataIndex: 'fieldLocalName',
},
{
title: '分组信息',
......@@ -26,30 +63,80 @@ const PlatformConfigTable = () => {
},
];
const getMemberProcessRuleRoleConfigPage = async (params?: FetchListParams) => {
if (!roleId) {
return;
}
setLoading(true);
const res = await PublicApi.getMemberProcessRuleRoleConfigPage({
roleId: `${roleId}`,
current: `${params?.current || page}`,
pageSize: `${params?.pageSize || size}`,
});
if (res.code === 1000) {
setData(res.data);
}
setLoading(false);
};
useEffect(() => {
getMemberProcessRuleRoleConfigPage();
}, [props.roleId]);
const handlePaginationChange = (current: number, pageSize: number) => {
setPage(current);
setSize(pageSize);
getMemberProcessRuleRoleConfigPage({
current,
pageSize,
});
};
return (
<PolymericTable
rowKey="id"
dataSource={[
{
id: 1,
name: '企业名称',
groupName: '营业执照信息',
},
{
id: 2,
name: '住所',
groupName: '营业执照信息',
},
{
id: 3,
name: '企业类型',
groupName: '营业执照信息',
},
]}
columns={columns}
loading={false}
pagination={null}
/>
<>
<Row
justify="space-between"
style={{
marginBottom: theme['@margin-md'],
}}
>
<Col span={16}>
<Descriptions column={1} colon={false}>
<Descriptions.Item
label={(
<div style={{ display: 'flex', alignItems: 'center' }}>
平台注册资料
<Tooltip title="会员在平台注册时已填写的资料">
<QuestionCircleOutlined
style={{ margin: '0 3px', cursor: 'default', marginLeft: 3 }}
size={16}
/>
</Tooltip>
</div>
)}
labelStyle={{ width: 180 }}
>
<Checkbox checked disabled>使用平台注册资料(默认)</Checkbox>
</Descriptions.Item>
</Descriptions>
</Col>
<Col span={6}>
<Search value={''} onChange={() => {}} onSearch={() => {}} />
</Col>
</Row>
<PolymericTable
rowKey="id"
dataSource={data.data}
columns={columns}
loading={loading}
pagination={{
current: page,
pageSize: size,
total: data.totalCount,
}}
onPaginationChange={handlePaginationChange}
/>
</>
);
};
......
/*
* @Author: XieZhiXiong
* @Date: 2021-05-31 16:24:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-31 16:24:45
* @Description:
*/
import { useBusinessEffects } from './useBusinessEffects';
import { PublicApi } from '@/services/api';
export const createEffects = (context, actions) => {
const { setFieldState } = actions;
useBusinessEffects(context, actions);
// 查询入库流程、变更流程列表
PublicApi.getMemberProcessRuleBaseList().then(res => {
if (res.code === 1000) {
setFieldState('depositoryProcessId', state => {
state.props['x-component-props'].dataSource = res.data.filter((item) => item.processType === 1);
});
setFieldState('changedProcessId', state => {
state.props['x-component-props'].dataSource = res.data.filter((item) => item.processType === 2);
});
}
});
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-05-31 16:24:22
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-01 14:39:50
* @Description:
*/
import { FormEffectHooks, FormPath, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
const {
onFieldValueChange$,
onFieldInputChange$,
} = FormEffectHooks;
export const useBusinessEffects = (context, actions: (ISchemaFormActions | ISchemaFormAsyncActions)) => {
const { setFieldState, setFieldValue } = actions;
// 适用会员联动 平台注册资料
onFieldValueChange$('memberRole').subscribe(fieldState => {
const { value } = fieldState;
setFieldState('*(platformConfigTable,configIds)', state => {
state.props['x-component-props'].roleId = value?.roleId || 0;
});
});
// 适用会员联动 平台注册资料
onFieldInputChange$('memberRole').subscribe(fieldState => {
// 清空
setFieldValue('configIds', []);
});
}
\ No newline at end of file
......@@ -2,37 +2,30 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 16:13:05
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 15:14:38
* @LastEditTime: 2021-06-01 14:56:14
* @Description:
*/
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import { history, Prompt } from 'umi';
import { Button, Card, Spin, Tooltip, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { SaveOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { Checkbox } from '@formily/antd-components';
import { merge } from 'rxjs';
import { usePageStatus } from '@/hooks/usePageStatus';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { PublicApi } from '@/services/api';
import { GetMemberAbilitySubGetResponse } from '@/services/MemberApi';
import { GetMemberProcessRuleGetResponse } from '@/services/MemberV2Api';
import formSchema from './schema';
import { createEffects } from './effects';
import MemberRoleFormItem from './components/MemberRoleFormItem';
import FlowListFormItem from './components/FlowListFormItem';
import Search from './components/Search';
import PlatformConfigTable from './components/PlatformConfigTable';
import ComingCtl from './components/ComingCtl';
import ComingConfigTable from './components/ComingConfigTable';
const formActions = createFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
onFormInputChange$,
} = FormEffectHooks;
......@@ -42,10 +35,6 @@ interface MemberFormProps {
*/
id?: number;
/**
* 数据 审核id
*/
validateId?: number;
/**
* 是否可编辑的
*/
isEdit?: boolean,
......@@ -53,17 +42,47 @@ interface MemberFormProps {
const FlowRuleForm: React.FC<MemberFormProps> = ({
id,
validateId,
isEdit = false,
}) => {
const areaRef = useRef<any[]>([])
const [memberItems, setMemberItems] = useState<any>({});
const [ruleInfo, setRuleInfo] = useState<GetMemberProcessRuleGetResponse>();
const [submitLoading, setSubmitLoading] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [unsaved, setUnsaved] = useState(false);
const getDetailedInfo = async () => {
if (!id) {
return;
}
setInfoLoading(true);
const res = await PublicApi.getMemberProcessRuleGet({
id: `${id}`,
});
if (res.code !== 1000) {
return;
}
const {
roleId,
roleName,
roleTypeName,
memberTypeName,
businessTypeName,
details,
...rest
} = res.data;
setRuleInfo({
memberRole: {
roleName,
businessTypeName,
memberTypeName,
roleId,
roleTypeName,
},
configIds: details,
...rest,
});
setInfoLoading(false);
};
useEffect(() => {
......@@ -72,42 +91,24 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
const handleSubmit = (values: any) => {
const {
memberTypeId,
roleId,
level,
countryCodeId,
phone,
email,
channelLevel,
channelTypeId,
areas = [],
remark,
outerStatus,
status,
statusName,
memberRole,
configIds,
usePlatformConfig,
...rest
} = values;
const filtered = areas.filter(item => item.pcode || item.ccode);
console.log('values', values);
if (!id && !isEdit) {
if (!id && isEdit) {
setSubmitLoading(true);
const msg = message.loading({
content: '正在添加,请稍候...',
duration: 0,
});
PublicApi.postMemberAbilitySubAdd({
memberTypeId,
roleId,
level,
countryCodeId,
phone,
email,
channelTypeId,
areas: filtered,
remark,
detail: rest,
PublicApi.postMemberProcessRuleAdd({
roleId: memberRole.roleId,
configIds: configIds.map((item) => item.id),
...rest,
}, {
timeout: 0,
}).then(res => {
......@@ -122,28 +123,19 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
msg();
setSubmitLoading(false);
});
return;
}
if (id && validateId && isEdit) {
if (id && isEdit) {
setSubmitLoading(true);
const msg = message.loading({
content: '正在保存,请稍候...',
duration: 0,
});
PublicApi.postMemberAbilitySubUpdate({
memberId: id,
validateId,
memberTypeId,
roleId,
level,
countryCodeId,
phone,
email,
channelTypeId,
areas: filtered,
remark,
detail: rest,
PublicApi.postMemberProcessRuleUpdate({
id,
roleId: memberRole.roleId,
configIds: configIds.map((item) => item.id),
...rest,
}, {
timeout: 0,
}).then(res => {
......@@ -161,24 +153,6 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
}
};
const createRichTextUtils = () => {
return {
text(...args) {
return React.createElement('span', {}, ...args)
},
help(text, offset = 3) {
return React.createElement(
Tooltip,
{ title: text },
<QuestionCircleOutlined
style={{ margin: '0 3px', cursor: 'default', marginLeft: offset }}
size={16}
/>
)
},
}
}
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......@@ -187,38 +161,37 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
}}
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={!id ? '新增会员管理流程规则' : '编辑会员管理流程规则会员'}
title={!id ? isEdit ? '新增会员管理流程规则' : '查看会员管理流程规则' : '编辑会员管理流程规则会员'}
extra={[
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
loading={submitLoading}
// onClick={() => formActions.submit()}
>
保存
</Button>,
(isEdit ? (
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
loading={submitLoading}
onClick={() => formActions.submit()}
>
保存
</Button>
) : null),
]}
>
<Card>
<NiceForm
onSubmit={handleSubmit}
actions={formActions}
initialValues={{}}
initialValues={ruleInfo}
components={{
MemberRoleFormItem,
FlowListFormItem,
MySearch: Search,
ComingCtl,
Checkbox,
CheckboxGroup: Checkbox.Group
}}
expressionScope={{
...createRichTextUtils(),
PlatformConfigTable: <PlatformConfigTable />,
ComingConfigTable: <ComingConfigTable />,
CheckboxGroup: Checkbox.Group,
PlatformConfigTable,
ComingConfigTable,
}}
effects={($, actions) => {
createEffects($, actions);
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
......@@ -238,7 +211,6 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
FlowRuleForm.defaultProps = {
id: 0,
validateId: 0,
isEdit: false,
};
......
......@@ -2,11 +2,10 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 16:13:26
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 15:45:23
* @LastEditTime: 2021-06-01 14:18:51
* @Description:
*/
import { ISchema } from '@formily/antd';
import { PATTERN_MAPS } from '@/constants/regExp';
const formSchema: ISchema = {
type: 'object',
......@@ -41,8 +40,14 @@ const formSchema: ISchema = {
'x-component-props': {
placeholder: '请输入',
},
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 48,
}
],
},
roleId: {
memberRole: {
type: 'string',
required: true,
title: '适用会员角色',
......@@ -71,32 +76,13 @@ const formSchema: ISchema = {
labelAlign: 'left',
},
properties: {
comingRule: {
depositoryProcessId: {
type: 'string',
required: true,
title: '流程选择',
'x-component': 'FlowListFormItem',
'x-component-props': {
dataSource: [
{
id: 1,
title: 'XGG1',
flow: '会员入库流程',
description: '1-确认入库',
},
{
id: 2,
title: 'XGG1',
flow: '会员入库流程',
description: '1-确认入库',
},
{
id: 3,
title: 'XGG1',
flow: '会员入库流程',
description: '1-确认入库',
},
],
dataSource: [],
type: 'success',
},
},
......@@ -111,39 +97,42 @@ const formSchema: ISchema = {
tab: '平台注册资料',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 8,
wrapperCol: 10,
labelAlign: 'left',
grid: true,
},
properties: {
usePlatformConfig: {
type: 'string',
title: "{{ text('平台注册资料', help('会员在平台注册时已填写的资料')) }}",
'x-component': 'CheckboxGroup',
default: '1',
enum: [
{ label: '使用平台注册资料(默认)', value: '1' },
]
},
searchPlatformConfig: {
type: 'object',
'x-component': 'MySearch',
'x-component-props': {
placeholder: '搜索',
},
},
},
},
// MEGA_LAYOUT1: {
// type: 'object',
// 'x-component': 'Mega-Layout',
// 'x-component-props': {
// labelCol: 8,
// wrapperCol: 10,
// labelAlign: 'left',
// grid: true,
// },
// properties: {
// usePlatformConfig: {
// type: 'string',
// title: "{{ text('平台注册资料', help('会员在平台注册时已填写的资料')) }}",
// 'x-component': 'CheckboxGroup',
// default: '1',
// enum: [
// { label: '使用平台注册资料(默认)', value: '1' },
// ],
// 'x-component-props': {
// disabled: true,
// },
// },
// searchPlatformConfig: {
// type: 'object',
// 'x-component': 'MySearch',
// 'x-component-props': {
// placeholder: '搜索',
// },
// },
// },
// },
platformConfigTable: {
type: 'object',
'x-component': 'Children',
'x-component': 'PlatformConfigTable',
'x-component-props': {
children: '{{PlatformConfigTable}}',
roleId: 0,
},
},
},
......@@ -155,31 +144,11 @@ const formSchema: ISchema = {
tab: '入库资料',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
comingCtl: {
type: 'object',
'x-component': 'ComingCtl',
},
searchComingConfig: {
type: 'object',
'x-component': 'MySearch',
'x-component-props': {
placeholder: '搜索',
},
},
},
},
comingConfigTable: {
type: 'object',
'x-component': 'Children',
configIds: {
type: 'string',
'x-component': 'ComingConfigTable',
'x-component-props': {
children: '{{ComingConfigTable}}',
},
},
},
......@@ -200,38 +169,13 @@ const formSchema: ISchema = {
labelAlign: 'left',
},
properties: {
changeRule: {
changedProcessId: {
type: 'string',
required: true,
title: '流程选择',
'x-component': 'FlowListFormItem',
'x-component-props': {
dataSource: [
{
id: 1,
title: 'XGG1',
flow: '会员表更流程',
description: '1-确认入库',
},
{
id: 2,
title: 'XGG1',
flow: '会员表更流程',
description: '1-确认入库',
},
{
id: 3,
title: 'XGG1',
flow: '会员表更流程',
description: '1-确认入库',
},
{
id: 4,
title: 'XGG4',
flow: '会员表更流程',
description: '1-确认入库',
},
],
dataSource: [],
type: 'warning',
},
},
......
......@@ -10,9 +10,9 @@ import { usePageStatus } from '@/hooks/usePageStatus';
import FlowRuleForm from './components/FlowRuleForm';
const MemberFlowRuleDetail: React.FC = () => {
const { id, validateId } = usePageStatus();
const { id } = usePageStatus();
return (
<FlowRuleForm id={id} validateId={validateId} />
<FlowRuleForm id={id} />
);
};
......
......@@ -6,11 +6,13 @@
* @Description: 编辑会员管理流程规则
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import FlowRuleForm from './components/FlowRuleForm';
const MemberFlowRuleEdit: React.FC = () => {
const { id } = usePageStatus();
return (
<FlowRuleForm isEdit />
<FlowRuleForm id={id} isEdit />
);
};
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 16:01:23
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-27 16:46:02
* @LastEditTime: 2021-06-01 14:35:51
* @Description: 会员管理流程规则配置
*/
import React, { useState, useRef } from 'react';
......@@ -21,22 +21,11 @@ import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
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 {
MEMBER_OUTER_STATUS_UNCOMMITTED,
MEMBER_OUTER_STATUS_FAILED,
} from '@/constants/member';
import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm';
import StatusSwitch from '@/components/StatusSwitch';
import StatusTag from '../components/StatusTag';
import { querySchema } from './schema';
import { coverColFiltersItem } from '../utils';
import { MEMBER_OUTER_STATUS_TYPE } from '../constant';
import styles from './index.less';
const formActions = createFormActions();
......@@ -50,7 +39,7 @@ const fetchListData = async (params: any) => {
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilitySubPage(payload);
const res = await PublicApi.getMemberProcessRulePage(payload);
if (res.code === 1000) {
return res.data;
......@@ -61,14 +50,13 @@ const fetchListData = async (params: any) => {
const MemberFlowRule: React.FC<[]> = () => {
const ref = useRef<any>({});
const handleDelete = (memberId: number, validateId: number) => {
const handleDelete = (id: number) => {
const mesInstance = message.loading({
content: '正在删除',
duration: 0,
});
PublicApi.postMemberAbilitySubDelete({
memberId,
validateId,
PublicApi.postMemberProcessRuleDelete({
id,
}).then(res => {
if (res.code !== 1000) {
return;
......@@ -78,23 +66,25 @@ const MemberFlowRule: React.FC<[]> = () => {
mesInstance();
});
};
const handleCommit = (memberId: number, validateId: number) => {
PublicApi.postMemberAbilitySubCommit({
memberId,
validateId,
const handleModify = (id: number, status: number) => {
const mesInstance = message.loading({
content: '正在修改',
duration: 0,
});
PublicApi.postMemberProcessRuleUpdateStatus({
id,
status: status === 0 ? 1 : 0,
}).then(res => {
if (res.code !== 1000) {
return;
}
ref.current.reload();
}).finally(() => {
mesInstance();
});
};
const handleModify = record => {
};
const defaultColumns: ColumnType<any>[] = [
{
title: 'ID',
......@@ -102,11 +92,11 @@ const MemberFlowRule: React.FC<[]> = () => {
},
{
title: '流程规则名称',
dataIndex: 'name ',
dataIndex: 'ruleName',
render: (text, record) => (
<>
<EyePreview
url={`/memberCenter/memberAbility/ruleConfiguration/memberFlowRule/detail?id=${record.memberId}&validateId=${record.validateId}`}
url={`/memberCenter/memberAbility/ruleConfiguration/memberFlowRule/detail?id=${record.id}`}
>
{text}
</EyePreview>
......@@ -119,7 +109,7 @@ const MemberFlowRule: React.FC<[]> = () => {
},
{
title: '角色类型',
dataIndex: 'roleName',
dataIndex: 'roleTypeName',
},
{
title: '会员类型',
......@@ -127,7 +117,7 @@ const MemberFlowRule: React.FC<[]> = () => {
},
{
title: '业务类型',
dataIndex: 'memberTypeName',
dataIndex: 'businessTypeName',
},
{
title: '操作时间',
......@@ -135,12 +125,12 @@ const MemberFlowRule: React.FC<[]> = () => {
},
{
title: '状态',
dataIndex: 'outerStatusName',
dataIndex: 'status',
filters: [],
render: (text, record) => (
render: (_, record) => (
<StatusSwitch
fieldNames="state"
handleConfirm={() => handleModify(record)}
fieldNames="status"
handleConfirm={() => handleModify(record.id, record.status)}
record={record}
/>
),
......@@ -155,7 +145,7 @@ const MemberFlowRule: React.FC<[]> = () => {
<Button
type="link"
onClick={() =>
history.push(`/memberCenter/memberAbility/ruleConfiguration/memberFlowRule/edit?id=${record.memberId}&validateId=${record.validateId}`)
history.push(`/memberCenter/memberAbility/ruleConfiguration/memberFlowRule/edit?id=${record.id}`)
}
>
编辑
......@@ -164,7 +154,7 @@ const MemberFlowRule: React.FC<[]> = () => {
title="确定要删除吗?"
okText="是"
cancelText="否"
onConfirm={() => handleDelete(record.memberId, record.validateId)}
onConfirm={() => handleDelete(record.id)}
>
<Button
type="link"
......@@ -200,7 +190,7 @@ const MemberFlowRule: React.FC<[]> = () => {
<Card>
<StandardTable
tableProps={{
rowKey: 'validateId',
rowKey: 'id',
}}
columns={columns}
currentRef={ref}
......
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