Commit 7f349518 authored by GuanHua's avatar GuanHua
parents da845132 33e9f5a0
......@@ -20,61 +20,52 @@ const MemberRoute = {
{
path: '/memberCenter/memberAbility/manage/import',
name: 'memberImport',
key: 'memberImport',
component: '@/pages/member/memberImport/index',
},
{
path: '/memberCenter/memberAbility/manage/importDetail',
name: 'importDetail',
key: 'importDetail',
hideInMenu: true,
component: '@/pages/member/memberImport/importDetail',
},
{
path: '/memberCenter/memberAbility/manage/addMember',
name: 'addMember',
key: 'addMember',
hideInMenu: true,
component: '@/pages/member/memberImport/addMember',
},
{
path: '/memberCenter/memberAbility/manage/maintain',
name: 'memberMaintain',
key: 'memberMaintain',
component: '@/pages/member/memberMaintain/index',
},
{
path: '/memberCenter/memberAbility/manage/maintainDetail',
name: 'maintainDetail',
key: 'maintainDetail',
hideInMenu: true,
component: '@/pages/member/memberMaintain/detailed',
routes: [
{
path: '/memberCenter/memberAbility/manage/maintainDetail/basicInfo',
name: 'basicInfo',
key: 'basicInfo',
component: '@/pages/member/memberMaintain/detailed/basicInfo',
hideInMenu: true,
},
{
path: '/memberCenter/memberAbility/manage/maintainDetail/levelInfo',
name: 'levelInfo',
key: 'levelInfo',
component: '@/pages/member/memberMaintain/detailed/levelInfo',
hideInMenu: true,
},
{
path: '/memberCenter/memberAbility/manage/maintainDetail/equityInfo',
name: 'equityInfo',
key: 'equityInfo',
component: '@/pages/member/memberMaintain/detailed/equityInfo',
hideInMenu: true,
},
{
path: '/memberCenter/memberAbility/manage/maintainDetail/sincerityInfo',
name: 'sincerityInfo',
key: 'sincerityInfo',
component: '@/pages/member/memberMaintain/detailed/sincerityInfo',
hideInMenu: true,
},
......@@ -83,78 +74,66 @@ const MemberRoute = {
{
path: '/memberCenter/memberAbility/manage/frozen',
name: 'maintainFrozen',
key: 'maintainFrozen',
hideInMenu: true,
component: '@/pages/member/memberMaintain/frozen',
},
{
path: '/memberCenter/memberAbility/manage/memberPrSubmit',
name: 'memberPrSubmit',
key: 'memberPrSubmit',
component: '@/pages/member/memberPrSubmit/index'
},
{
path: '/memberCenter/memberAbility/manage/auditPrSubmit',
name: 'auditPrSubmit',
key: 'auditPrSubmit',
hideInMenu: true,
component: '@/pages/member/memberPrSubmit/auditPrSubmit'
},
{
path: '/memberCenter/memberAbility/manage/memberPr1',
name: 'memberPr1',
key: 'memberPr1',
component: '@/pages/member/memberPr1/index'
},
{
path: '/memberCenter/memberAbility/manage/auditPr1',
name: 'auditPr1',
key: 'auditPr1',
hideInMenu: true,
component: '@/pages/member/memberPr1/auditPr1'
},
{
path: '/memberCenter/memberAbility/manage/memberPr2',
name: 'memberPr2',
key: 'memberPr2',
component: '@/pages/member/memberPr2/index'
},
{
path: '/memberCenter/memberAbility/manage/auditPr2',
name: 'auditPr2',
key: 'auditPr2',
hideInMenu: true,
component: '@/pages/member/memberPr2/auditPr2'
},
{
path: '/memberCenter/memberAbility/manage/memberPrConfirm',
name: 'memberPrConfirm',
key: 'memberPrConfirm',
component: '@/pages/member/memberPrConfirm/index'
},
{
path: '/memberCenter/memberAbility/manage/auditPrComfirm',
name: 'auditPrComfirm',
key: 'auditPrComfirm',
hideInMenu: true,
component: '@/pages/member/memberPrConfirm/auditPrComfirm'
},
{
path: '/memberCenter/memberAbility/manage/upgradeRule',
name: 'memberUpgradeRule',
key: 'memberUpgradeRule',
component: '@/pages/member/memberUpgradeRule/index',
},
{
path: '/memberCenter/memberAbility/manage/level',
name: 'memberLevel',
key: 'memberLevel',
component: '@/pages/member/memberLevel/index'
},
{
path: '/memberCenter/memberAbility/manage/level/addEquity',
name: 'addEquity',
key: 'addEquity',
hideInMenu: true,
component: '@/pages/member/memberLevel/addEquity',
},
......@@ -163,13 +142,11 @@ const MemberRoute = {
{
path: '/memberCenter/memberAbility/query',
name: 'memberQuery',
key: 'memberQuery',
component: '@/pages/member/memberQuery/index',
},
{
path: '/memberCenter/memberAbility/query/detailed',
name: 'memberQueryDetailed',
key: 'memberQueryDetailed',
component: '@/pages/member/memberQuery/detailed',
hideInMenu: true,
routes: [
......@@ -206,10 +183,15 @@ const MemberRoute = {
{
path: '/memberCenter/memberAbility/update',
name: 'memberUpdate',
key: 'memberUpdate',
hideInMenu: true,
component: '@/pages/member/memberQuery/update',
},
{
path: '/memberCenter/memberAbility/addSubRole',
name: 'addSubRole',
hideInMenu: true,
component: '@/pages/member/memberQuery/addSubRole',
},
]
}
......
/*
* @Author: LeeJiancong
* @Date: 2020-07-31 19:56:22
* @LastEditors: LeeJiancong
* @LastEditors: XieZhiXiong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-11 10:17:58
* @LastEditTime: 2020-09-14 19:37:53
*/
const TranactionRoute = {
......@@ -20,46 +20,39 @@ const TranactionRoute = {
{
path: '/memberCenter/tranactionAbility/stockSellStorage/warehouse',
name: 'warehouse',
key: 'warehouse',
component: '@/pages/transaction/stockSellStorage/warehouse/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/addWarehouse',
name: 'addWarehouse',
key: 'addWarehouse',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/warehouse/addWarehouse',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/billsType',
name: 'billsType',
key: 'billsType',
component: '@/pages/transaction/stockSellStorage/billsType/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/addBillsType',
name: 'addBillsType',
key: 'addBillsType',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/billsType/addBillsType',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/bills',
name: 'bills',
key: 'bills',
component: '@/pages/transaction/stockSellStorage/bills/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/addBills',
name: 'addBills',
key: 'addBills',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/bills/addBills',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/inventory',
name: 'inventory',
key: 'inventory',
component: '@/pages/transaction/stockSellStorage/inventory/index',
},
]
......
......@@ -49,6 +49,7 @@ const Search = props => {
<Button
onClick={() => {
props.form.reset();
props.form.submit();
}}
>
重置
......
/*
* @Author: XieZhiXiong
* @Date: 2020-08-06 11:20:13
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-14 20:46:56
* @Description:
*/
import { useValueLinkageEffect, FormPath, FormEffectHooks } from '@formily/antd'
......@@ -76,7 +83,12 @@ export const useLinkEnumEffect = (childKey, transformFn?, findKey = 'id') => {
if (state.value === undefined) {
} else {
if (originData.length > 0) {
const result = originData.find(v => v[findKey] === state.value)[childKey] || []
const current = originData.find(v => v[findKey] === state.value)
if (!current) {
return
}
const result = current[childKey] || []
if (state.modified) {
targetState.value = undefined
}
......@@ -86,7 +98,6 @@ export const useLinkEnumEffect = (childKey, transformFn?, findKey = 'id') => {
}
})
})
},
reject: ({ target }, { setFieldState, getFieldState }) => {
setFieldState(target, targetState => {
......
......@@ -236,6 +236,16 @@ export const MEMBER_OUTER_STATUS = {
[MEMBER_OUTER_STATUS_SUCCESS]: '审核通过',
};
// 会员等级类型枚举
export const MEMBER_LEVEL_TYPE_PLATFORM = 1; // 平台会员
export const MEMBER_LEVEL_TYPE_MERCHANT = 2; // 商户会员
export const MEMBER_LEVEL_TYPE_CHANNEL = 3; // 渠道会员
export const MEMBER_LEVEL_TYPE = {
[MEMBER_LEVEL_TYPE_PLATFORM]: '平台会员',
[MEMBER_LEVEL_TYPE_MERCHANT]: '商户会员',
[MEMBER_LEVEL_TYPE_CHANNEL]: '渠道会员',
};
export const ORDER_TYPE = ['',
'询价采购',
'需求采购',
......@@ -267,3 +277,19 @@ export const POSITION_STATUS = {
[POSITION_STATUS_EFFECTIVE]: '有效',
[POSITION_STATUS_INVALID]: '无效',
};
// 单据类型状态
export const DOC_TYPE_STATUS_EFFECTIVE = 1; // 有效的
export const DOC_TYPE_STATUS_INVALID = 0; // 无效的
export const DOC_TYPE_STATUS = {
[DOC_TYPE_STATUS_EFFECTIVE]: '有效',
[DOC_TYPE_STATUS_INVALID]: '无效',
};
// 单据类型方向
export const DOC_DIRECTION_WAREHOUSING = 1; // 入库
export const DOC_DIRECTION_OUTGOING = 2; // 出库
export const DOC_DIRECTION = {
[DOC_DIRECTION_WAREHOUSING]: '入库 + ',
[DOC_DIRECTION_OUTGOING]: '出库 - ',
};
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-09-12 18:01:48
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-15 11:48:29
*/
export default {
......@@ -97,6 +97,7 @@ export default {
'menu.memberAbility.memberQueryDetailed.equityInfo': '权益信息',
'menu.memberAbility.memberQueryDetailed.sincerityInfo': '诚信信息',
'menu.memberAbility.memberUpdate': '变更会员信息',
'menu.memberAbility.addSubRole': '新增会员角色',
// 店铺能力
'menu.shopAbility': '店铺',
......
......@@ -255,7 +255,15 @@ export const initDetailSchema = (props: any) => {
'x-component-props': {
label: '注册手机',
required: true,
inline: true,
wrapperCol: 24,
},
properties: {
MEGA_LAYOUT1_1_1: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
full: true,
},
properties: {
countryCodeId: {
......@@ -269,6 +277,9 @@ export const initDetailSchema = (props: any) => {
phone: {
type: 'string',
required: true,
'x-mega-props': {
span: 2,
},
'x-component-props': {
placeholder: '请输入你的手机号码',
maxLength: 11,
......@@ -282,6 +293,8 @@ export const initDetailSchema = (props: any) => {
},
},
},
},
},
email: {
type: 'string',
title: '邮箱',
......
......@@ -134,6 +134,7 @@ export const auditModalSchema: ISchema = {
type: 'string',
title: '审核不通过原因',
'x-component': 'textarea',
required: true,
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
......
......@@ -133,6 +133,7 @@ export const auditModalSchema: ISchema = {
reason: {
type: 'string',
title: '审核不通过原因',
required: true,
'x-component': 'textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
......
......@@ -16,6 +16,7 @@ import { PublicApi } from '@/services/api';
import { GetMemberAbilityValidateStep1DetailResponse } from '@/services/MemberApi';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import { MEMBER_INNER_STATUS_SUCCESS } from '@/constants';
import { MEMBER_INNER_STATUS_BADGE_COLOR, MEMBER_STATUS_TAG_MAP, MEMBER_OUTER_STATUS_TYPE } from '../constant';
import { auditModalSchema } from './schema';
import HeadInfo from '../components/HeadInfo';
......@@ -30,7 +31,7 @@ interface AreaItem {
children: AreaItem[];
};
interface MemberInfo extends GetMemberAbilityValidateStep1DetailResponse {
channelTypeName?: string;
channelTypeName: string;
areasInfo?: string[];
};
......@@ -85,6 +86,21 @@ const AuditPrComfirm: React.FC<{}> = () => {
}
setMemberInfo(res.data || null);
// 内部状态为 审核通过 才能选择 审核通过选项
if (res.data.innerStatus !== MEMBER_INNER_STATUS_SUCCESS) {
modalFormActions.setFieldState('agree', state => {
const newMenu =
state.props.enum.map(
(item: { label: string, value: any }) => ({
...item,
disabled: item.value === 1,
})
);
FormPath.setIn(state, 'props.enum', newMenu);
FormPath.setIn(state, 'value', 0);
});
}
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -124,8 +124,15 @@ export const auditModalSchema: ISchema = {
type: 'string',
default: 1,
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
{
label: '审核通过',
value: 1,
disabled: false,
},
{
label: '审核不通过',
value: 0,
},
],
'x-component': 'radio',
'x-component-props': {},
......@@ -133,6 +140,7 @@ export const auditModalSchema: ISchema = {
reason: {
type: 'string',
title: '审核不通过原因',
required: true,
'x-component': 'textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
......
......@@ -16,6 +16,10 @@ import { PublicApi } from '@/services/api';
import { GetMemberAbilityValidateCommitDetailResponse } from '@/services/MemberApi';
import { createAsyncFormActions, createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants';
import { MEMBER_INNER_STATUS_BADGE_COLOR, MEMBER_STATUS_TAG_MAP, MEMBER_OUTER_STATUS_TYPE } from '../constant';
import { channelSchema, auditModalSchema } from './schema';
import HeadInfo from '../components/HeadInfo';
......@@ -167,20 +171,27 @@ const AuditPrSubmit: React.FC<{}> = () => {
};
// 提交审核
const handleSubmit = values => {
const handleSubmit = async values => {
setConfirmLoading(true);
// 调用渠道 Form 的 submit
const promises: any = [
formActions.submit(),
PublicApi.postMemberAbilityValidateCommitSubmit({
// 存在渠道信息,则先修改渠道信息,在提交审核结果
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,
}),
];
});
Promise.all(promises).then(resArr => {
if (resArr.every((item: { code: number }) => item.code === 1000)) {
if (commitRes.code === 1000) {
setModalVisible(false);
setUnsaved(false);
setTimeout(() => {
......@@ -188,9 +199,6 @@ const AuditPrSubmit: React.FC<{}> = () => {
}, 800);
}
setConfirmLoading(false);
}).catch(err => {
setConfirmLoading(false);
});
};
return (
......
......@@ -218,18 +218,13 @@ export const auditModalSchema: ISchema = {
reason: {
type: 'string',
title: '审核不通过原因',
required: true,
'x-component': 'textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
// {
// required: true,
// message: '请填写审核不通过原因',
// }
],
},
},
},
......
import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { history, Prompt } from 'umi';
import { Badge, Button, Card, Spin, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { PublicApi } from '@/services/api';
import { GetMemberAbilitySubGetResponse } from '@/services/MemberApi';
import { initDetailSchema } from './schema';
const formActions = createFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
onFormInputChange$,
} = FormEffectHooks;
const AddSubRole: React.FC<any> = props => {
const areaRef = useRef<any[]>([])
const { memberTypeId, roleId } = usePageStatus();
const [memberItems, setMemberItems] = useState<any>({});
const [memberInfo, setMemberInfo] = useState<GetMemberAbilitySubGetResponse>(null);
const [submitLoading, setSubmitLoading] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [unsaved, setUnsaved] = useState(false);
const getDetailedInfo = async () => {
if (memberTypeId && roleId) {
setInfoLoading(true);
const infoRes = await PublicApi.getMemberAbilityInfoDetailByrole({
roleId,
});
setInfoLoading(false);
if (infoRes.code !== 1000) {
return;
}
const { groups = [] } = infoRes.data;
setMemberItems(groups);
}
};
useEffect(() => {
getDetailedInfo();
}, []);
const handleSubmit = (values: any) => {
if (!memberTypeId || !roleId) {
return;
}
setSubmitLoading(true);
const msg = message.loading({
content: '正在保存,请稍候...',
duration: 0,
});
PublicApi.postMemberAbilityInfoAddrole({
memberTypeId,
roleId,
detail: values,
}).then(res => {
if (res.code !== 1000) {
return;
}
setUnsaved(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
msg();
setSubmitLoading(false);
});
};
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title="填写会员资料"
extra={[
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
loading={submitLoading}
onClick={() => formActions.submit()}
>
保存
</Button>,
]}
>
<Card>
<NiceForm
onSubmit={handleSubmit}
actions={formActions}
initialValues={memberInfo || {}}
effects={($, actions) => {
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
}}
schema={initDetailSchema(memberItems)}
/>
</Card>
</PageHeaderWrapper>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</Spin>
);
};
export default AddSubRole;
\ No newline at end of file
......@@ -4,9 +4,6 @@ import {
Card,
Space,
Button,
Menu,
Popconfirm,
Dropdown,
Badge,
Modal,
} from 'antd';
......@@ -18,16 +15,22 @@ import {
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import NiceForm from '@/components/NiceForm';
import { PublicApi } from '@/services/api';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import {
MEMBER_LEVEL_TYPE_PLATFORM,
MEMBER_LEVEL_TYPE_MERCHANT,
MEMBER_LEVEL_TYPE_CHANNEL,
MEMBER_OUTER_STATUS_FAILED,
} from '@/constants';
import LevelBrand from '../components/LevelBrand';
import { maintianSchema } from './schema';
import { maintianSchema, addRoleSchema } from './schema';
import { coverColFiltersItem } from '../utils';
import {
MEMBER_STATUS_TAG_MAP,
......@@ -37,20 +40,40 @@ import {
} from '../constant';
const formActions = createFormActions();
const modalFormActions = createFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
onFormInputChange$,
onFormInit$,
} = FormEffectHooks;
const MemberQuery: React.FC<{}> = () => {
const ref = useRef<any>({});
const [modalVisible, setModalVisible] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const fetchData = async (params: any) => {
const fetchData = async (params: any) => {
let res = await PublicApi.getMemberAbilityInfoPage(params);
return res.data;
};
const MemberQuery: React.FC<[]> = () => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
};
const handleJumpUpdate = record => {
history.push(`/memberCenter/memberAbility/update?id=${record.memberId}&validateId=${record.validateId}`);
};
// 再次申请
const handleReapply = record => {
PublicApi.postMemberAbilityInfoValidateRecommit({
memberId: record.memberId,
validateId: record.validateId,
}).then(res => {
if (res.code === 1000) {
ref.current.reload();
}
});
};
const defaultColumns: ColumnType<any>[] = [
{
title: 'ID',
......@@ -120,36 +143,45 @@ const MemberQuery: React.FC<[]> = () => {
dataIndex: 'option',
align: 'center',
render: (text, record) => (
<>
{/* 渠道会员, 且外部审核状态为不通过才可以 变更信息 */}
{
(
record.levelTypeEnum === MEMBER_LEVEL_TYPE_PLATFORM &&
record.outerStatus === MEMBER_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => handleJumpUpdate(record)}
>
变更信息
</Button>
)
}
{/* 商户会员、渠道会员 且外部审核状态为不通过才可以 再次申请 */}
{
(
(
record.levelTypeEnum === MEMBER_LEVEL_TYPE_MERCHANT ||
record.levelTypeEnum === MEMBER_LEVEL_TYPE_CHANNEL
) &&
record.outerStatus === MEMBER_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => handleReapply(record)}
>
再次申请
</Button>
)
}
</>
),
},
];
const rowSelection = {
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectedRowKeys(selectedRowKeys);
},
selectedRowKeys: selectedRowKeys,
};
const [columns, setColumns] = useState<any[]>(defaultColumns);
// 更改会员状态
const handleModify = record => {
PublicApi.postMemberMaintenanceStatus({
memberId: record.memberId,
validateId: record.validateId,
status: record.status === 1 ? 0 : 1,
}).then(res => {
if (res.code === 1000) return ref.current.reload();
});
};
// 初始化高级筛选选项
const fetchSelectOptions = async () => {
const res = await PublicApi.getMemberAbilityInfoPageitems();
......@@ -178,6 +210,84 @@ const MemberQuery: React.FC<[]> = () => {
return {};
};
const handleSubmit = values => {
history.push({
pathname: `/memberCenter/memberAbility/addSubRole`,
query: {
...values,
},
});
};
const getMembertype = () => {
return new Promise((resolve, reject) => {
PublicApi.getMemberAbilityInfoMembertypeList().then(res => {
if (res.code === 1000) {
const options = res.data.map(item => ({ label: item.memberTypeName, value: item.memberTypeId }))
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
const getRoleByMemberType = memberTypeId => {
return new Promise((resolve, reject) => {
PublicApi.getMemberAbilityInfoRoleList({
memberTypeId,
}).then(res => {
if (res.code === 1000) {
const { roles = [], checkIds = [] } = res.data;
const options = roles.map(item => (
{
label: item.roleName,
value: item.roleId,
disabled: checkIds.find(id => id === item.roleId),
}
));
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
const useAsyncDataSource = (name, service) => {
const { dispatch, setFieldState } = createFormActions();
const linkage = useLinkageUtils();
onFormInit$().subscribe(() => {
setFieldState(name, state => {
FormPath.setIn(state, 'props.x-props.hasFeedback', true)
})
linkage.loading(name)
service().then(res => {
linkage.loaded(name)
linkage.enum(name, res)
// 请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch('requestAsyncDataSource', {
name,
payload: res
})
})
})
}
const controllerBtns = (
<Space>
<Button
type="primary"
onClick={() => setModalVisible(true)}
>
<PlusOutlined />
增加会员角色
</Button>
</Space>
);
return (
<Card>
<StandardTable
......@@ -187,10 +297,12 @@ const MemberQuery: React.FC<[]> = () => {
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
rowSelection={rowSelection}
controlRender={
<NiceForm
actions={formActions}
expressionScope={{
controllerBtns,
}}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
......@@ -208,6 +320,41 @@ const MemberQuery: React.FC<[]> = () => {
/>
}
/>
<Modal
title="新增会员角色"
visible={modalVisible}
confirmLoading={confirmLoading}
onOk={() => modalFormActions.submit()}
onCancel={() => setModalVisible(false)}
destroyOnClose
>
<NiceForm
effects={($, { setFieldState }) => {
const linkage = useLinkageUtils();
onFieldValueChange$('agree').subscribe(fieldState => {
setFieldState('reason', state => {
state.visible = !fieldState.value;
});
});
useAsyncDataSource('memberTypeId', getMembertype);
onFieldInputChange$('memberTypeId').subscribe(fieldState => {
linkage.loading('roleId');
getRoleByMemberType(fieldState.value)
.then(res => {
linkage.enum('roleId', res);
})
.finally(() => {
linkage.loaded('roleId');
});
});
}}
actions={modalFormActions}
schema={addRoleSchema}
onSubmit={handleSubmit}
/>
</Modal>
</Card>
);
};
......
......@@ -9,12 +9,27 @@ export const maintianSchema: ISchema = {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
align: 'flex-left',
},
},
},
},
[FORM_FILTER_PATH]: {
......@@ -70,6 +85,7 @@ const getXComponentProps = (type, item) => {
const MAP = {
'string': {
placeholder: item.fieldRemark,
disabled: item.disabled,
},
'upload': {
listType: 'card',
......@@ -77,6 +93,7 @@ const getXComponentProps = (type, item) => {
data: { fileType: UPLOAD_TYPE },
fileList: [],
onChange: file => console.log(file),
disabled: item.disabled,
},
};
return MAP[type];
......@@ -147,3 +164,49 @@ export const initDetailSchema = (props: any) => {
const maintianDetailSchema: ISchema = detailSchema;
return maintianDetailSchema;
};
export const addRoleSchema: ISchema = {
type: 'object',
properties: {
tip: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '您需要增加的会员角色是:',
},
},
MEGA_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
},
properties: {
memberTypeId: {
type: 'string',
title: '会员类型',
'x-component': "Radio",
'x-rules': [
{
required: true,
message: '请选择会员类型',
},
],
enum: [],
},
roleId: {
type: 'string',
title: '会员角色',
'x-component': "Radio",
'x-rules': [
{
required: true,
message: '请选择会员角色',
},
],
enum: [],
},
},
},
},
};
......@@ -36,14 +36,13 @@ const MemberUpdate: React.FC<any> = props => {
validateId,
});
setInfoLoading(false);
if (infoRes.code !== 1000) {
return;
}
const { groups = [] } = infoRes.data;
setMemberItems(groups);
setInfoLoading(false);
}
};
......@@ -52,24 +51,9 @@ const MemberUpdate: React.FC<any> = props => {
}, []);
const handleSubmit = (values: any) => {
const {
memberTypeId,
roleId,
levelId,
countryCodeId,
phone,
email,
channelLevel,
channelTypeId,
areas,
remark,
outerStatus,
status,
statusName,
...rest
} = values;
if (!id || !validateId) {
return;
}
setSubmitLoading(true);
const msg = message.loading({
content: '正在保存,请稍候...',
......@@ -93,25 +77,6 @@ const MemberUpdate: React.FC<any> = props => {
});
};
const useAsyncLinkageEffect = () => {
const linkage = useLinkageUtils();
// 根据会员角色,查询其他注册资料
onFieldValueChange$('roleId').subscribe(fieldState => {
if (!fieldState.value) {
return;
}
PublicApi.getMemberAbilitySubPageitemsDetail({
roleId: fieldState.value,
}).then(res => {
if (res.code === 1000) {
const { data = [] } = res;
setMemberItems(data);
}
});
});
}
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......
import React from 'react';
import { history } from 'umi';
import React, { useState, useEffect } from 'react';
import { Button, Card, Spin } from 'antd';
import { history, Prompt } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
import { Button, Card } from 'antd';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
......@@ -11,27 +11,68 @@ import { useInitValue } from '@/formSchema/effects/useInitValue';
import { PublicApi } from '@/services/api';
import { billsTypeDetailSchema } from './schema';
const addSchemaAction = createFormActions();
const formActions = createFormActions();
const {
onFormInputChange$,
} = FormEffectHooks;
const AddWarehouse: React.FC<{}> = props => {
const { pageStatus, preview, id } = usePageStatus();
const initValue = useInitValue(PublicApi.getWarehouseInvoicesTypeDetails);
const [info, setInfo] = useState({});
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const docTypeInfo = async () => {
if (!id) {
return;
}
setInfoLoading(true);
const infoRes = await PublicApi.getWarehouseInvoicesTypeDetails({
id,
});
if (infoRes.code === 1000) {
setInfo(infoRes.data);
}
setInfoLoading(false);
};
useEffect(() => {
docTypeInfo();
}, []);
const handleSubmit = value => {
if (pageStatus === 0) {
PublicApi.postWarehouseInvoicesTypeAdd({ ...value }).then(res => {
if (res.code === 1000) return history.goBack();
if (!id) {
setSubmitLoading(true);
PublicApi.postWarehouseInvoicesTypeAdd({ ...value })
.then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
}, 800);
};
})
.finally(() => {
setSubmitLoading(false);
});
} else {
setSubmitLoading(true);
PublicApi.postWarehouseInvoicesTypeUpdate({
id: id,
...value,
}).then(res => {
if (res.code === 1000) return history.goBack();
if (res.code === 1000) {
history.goBack();
}
});
}
setUnsaved(false);
};
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
......@@ -49,7 +90,8 @@ const AddWarehouse: React.FC<{}> = props => {
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
loading={submitLoading}
onClick={() => formActions.submit()}
>
保存
</Button>,
......@@ -61,14 +103,22 @@ const AddWarehouse: React.FC<{}> = props => {
<NiceForm
previewPlaceholder="' '"
editable={pageStatus !== PageStatus.PREVIEW}
effects={$ => {}}
initialValues={initValue}
effects={$ => {
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
}}
initialValues={info}
onSubmit={handleSubmit}
actions={addSchemaAction}
actions={formActions}
schema={billsTypeDetailSchema}
/>
</Card>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</PageHeaderWrapper>
</Spin>
);
};
......
import React, { useState, useEffect, useRef } from 'react';
import React, { useRef } from 'react';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
Tooltip,
Input,
Button,
Card,
Row,
Col,
Space,
Popconfirm,
} from 'antd';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { PlusOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api';
import NiceForm from '@/components/NiceForm';
import { DOC_TYPE_STATUS_EFFECTIVE, DOC_TYPE_STATUS_INVALID, DOC_DIRECTION } from '@/constants';
import { searchSchema } from './schema';
const formActions = createFormActions();
const billsType: React.FC<{}> = () => {
const ref = useRef<any>({});
const [searchKey, setSearchKey] = useState<any>({
name: '',
state: '',
});
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '单据类型编号',
dataIndex: 'number',
align: 'center',
key: 'number',
},
{
title: '单据名称',
dataIndex: 'name',
align: 'center',
key: 'name',
render: (text: any, record: any) => {
return (
<EyePreview
......@@ -57,25 +52,21 @@ const billsType: React.FC<{}> = () => {
title: '方向',
dataIndex: 'direction',
align: 'center',
key: 'direction',
render: (text: any, record: any) => {
return <span>{record.direction === 1 ? '入库 +' : '出库 -'}</span>;
render: text => {
return <span>{DOC_DIRECTION[text]}</span>;
},
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
key: 'status',
sorter: true,
render: (text: any, record: any) => {
return (
sorter: (a, b) => a.state - b.state,
render: (text: any, record: any) => (
<StatusSwitch
handleConfirm={() => handleModify(record)}
record={record}
/>
);
},
),
},
{
title: '操作',
......@@ -83,7 +74,7 @@ const billsType: React.FC<{}> = () => {
align: 'center',
render: (text: any, record: any) => (
<>
{record.state != 1 ? (
{record.state === DOC_TYPE_STATUS_INVALID && (
<>
<Button
type="link"
......@@ -96,32 +87,31 @@ const billsType: React.FC<{}> = () => {
编辑
</Button>
<Popconfirm
title="确定要执行这个操作?"
title="确定要删除该单据类型吗?"
onConfirm={() => handleDelete(record)}
onCancel={() => console.log('...')}
okText="是"
cancelText="否"
>
<Button type="link">删除</Button>
<Button type="link" danger>删除</Button>
</Popconfirm>
</>
) : (
''
)}
</>
),
},
];
// 模拟请求
const fetchData = (params: any) => {
const fetchListData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getWarehouseInvoicesTypeList({
...searchKey,
current: params.current,
pageSize: params.pageSize,
}).then(res => {
PublicApi.getWarehouseInvoicesTypeList(params)
.then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
})
.catch(() => {
reject();
});
});
};
......@@ -129,9 +119,11 @@ const billsType: React.FC<{}> = () => {
const handleModify = (record: any) => {
PublicApi.postWarehouseInvoicesTypeStateUpdate({
id: record.id,
state: record.state === 1 ? 0 : 1,
state: record.state === DOC_TYPE_STATUS_EFFECTIVE ? DOC_TYPE_STATUS_INVALID : DOC_TYPE_STATUS_EFFECTIVE,
}).then(res => {
if (res.code === 1000) return ref.current.reload();
if (res.code === 1000) {
ref.current.reload();
}
});
};
......@@ -139,77 +131,50 @@ const billsType: React.FC<{}> = () => {
PublicApi.postWarehouseInvoicesTypeDelete({
id: record.id,
}).then(res => {
if (res.code === 1000) return ref.current.reload();
if (res.code === 1000) {
ref.current.reload();
};
});
};
const handleJumpAdd = () => {
history.push(`/memberCenter/tranactionAbility/stockSellStorage/addBillsType`);
};
const Actions = (
<Space>
<Button
type="primary"
icon={<PlusOutlined />}
onClick={handleJumpAdd}
>
新建
</Button>
</Space>
);
return (
<PageHeaderWrapper>
<Card>
<StandardTable
tableProps={{
rowKey: 'id',
onChange: (pagination, filters, sorter) => {
let state =
sorter.order === 'ascend'
? 1
: sorter.order === 'descend'
? 0
: '';
setSearchKey({ ...searchKey, state: state });
},
}}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
fetchTableData={(params: any) => fetchListData(params)}
controlRender={
<Row justify="space-between" style={{ marginBottom: '16px' }}>
<Col>
<Space>
<Button
type="primary"
onClick={() =>
history.push(
'/memberCenter/tranactionAbility/stockSellStorage/addBillsType',
)
}
>
<PlusOutlined />
新建
</Button>
</Space>
</Col>
<Col>
<Space style={{ justifyContent: 'flex-end', width: '100%' }}>
<Tooltip
trigger={['focus']}
placement="top"
title={<span>输入单据名称进行搜索</span>}
>
<Input.Search
style={{ width: '232px' }}
value={searchKey.name}
placeholder="搜索"
onChange={e =>
setSearchKey({ ...searchKey, name: e.target.value })
}
onSearch={(val, e) => {
e.preventDefault();
ref.current.reload();
<NiceForm
actions={formActions}
expressionScope={{
Actions,
}}
/>
</Tooltip>
<Button
onClick={() => {
setSearchKey({ name: '', state: '' });
ref.current.reload();
effects={($, actions) => {
}}
>
重置
</Button>
</Space>
</Col>
</Row>
schema={searchSchema}
onSubmit={values => ref.current.reload(values)}
/>
}
/>
</Card>
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { DOC_DIRECTION_WAREHOUSING, DOC_DIRECTION_OUTGOING, DOC_DIRECTION } from '@/constants';
export const billsTypeSchema: ISchema = {
type: 'object',
......@@ -32,16 +33,27 @@ export const billsTypeDetailSchema: ISchema = {
title: '单据类型名称',
'x-component-props': {
placeholder: '最长20个字符,10个汉字',
maxLength: 10,
},
required: true,
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 20,
}
],
},
direction: {
type: 'string',
title: '仓库负责人',
title: '单据类型方向',
enum: [
{ label: '入库', value: 1 },
{ label: '出库', value: 2 },
{
label: DOC_DIRECTION[DOC_DIRECTION_WAREHOUSING],
value: DOC_DIRECTION_WAREHOUSING,
},
{
label: DOC_DIRECTION[DOC_DIRECTION_OUTGOING],
value: DOC_DIRECTION_OUTGOING,
},
],
'x-component-props': {
placeholder: '请选择',
......@@ -52,3 +64,33 @@ export const billsTypeDetailSchema: ISchema = {
},
},
};
export const searchSchema: ISchema = {
type: 'object',
properties: {
searchWrap: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
actions: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{Actions}}',
},
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
advanced: false,
},
},
},
},
},
};
import React from 'react';
import { history } from 'umi';
import React, { useState, useEffect } from 'react';
import { history, Prompt } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Button, Card } from 'antd';
import { Button, Card, Spin } from 'antd';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import { warehouseDetailSchema } from './schema';
import { useLinkEnumEffect } from '@/components/NiceForm/linkages/linkEnum';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useInitValue } from '@/formSchema/effects/useInitValue';
import { PublicApi } from '@/services/api';
const addSchemaAction = createFormActions();
const formActions = createFormActions();
const {
onFormInputChange$,
} = FormEffectHooks;
const AddWarehouse: React.FC<{}> = (props: any) => {
const { pageStatus, preview, id } = usePageStatus();
const initValue = useInitValue(PublicApi.getWarehouseWarehouseDetails);
const [info, setInfo] = useState({});
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const getWarehouseInfo = async () => {
if (!id) {
return;
}
setInfoLoading(true);
const infoRes = await PublicApi.getWarehouseWarehouseDetails({
id,
});
const areaRes = await PublicApi.getManageAreaAll();
if (areaRes.code === 1000) {
const { data } = areaRes;
formActions.setFieldState('provinceId', targetState => {
targetState.originData = data;
targetState.props.enum = data.map(v => ({
label: v.name,
value: v.id,
}));
});
}
if (infoRes.code === 1000) {
setInfo(infoRes.data);
}
setInfoLoading(false);
};
useEffect(() => {
getWarehouseInfo();
}, []);
// 获取手机code
const fetchTelCode = async () => {
......@@ -26,19 +62,37 @@ const AddWarehouse: React.FC<{}> = (props: any) => {
};
const handleSubmit = value => {
if (pageStatus === 0)
return PublicApi.postWarehouseWarehouseAdd({ ...value }).then(res => {
if (res.code === 1000) return history.goBack();
if (!id) {
setSubmitLoading(true);
PublicApi.postWarehouseWarehouseAdd({ ...value }).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
};
}).finally(() => {
setSubmitLoading(false);
});
else
return PublicApi.postWarehouseWarehouseUpdate({
} else {
setSubmitLoading(true);
PublicApi.postWarehouseWarehouseUpdate({
id: id,
...value,
}).then(res => {
if (res.code === 1000) return history.goBack();
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
};
}).finally(() => {
setSubmitLoading(false);
});
}
setUnsaved(false);
};
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
......@@ -56,7 +110,8 @@ const AddWarehouse: React.FC<{}> = (props: any) => {
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
loading={submitLoading}
onClick={() => formActions.submit()}
>
保存
</Button>,
......@@ -69,20 +124,6 @@ const AddWarehouse: React.FC<{}> = (props: any) => {
previewPlaceholder="' '"
editable={pageStatus !== PageStatus.PREVIEW}
effects={($, { setFieldState }) => {
$('onFormMount').subscribe(state => {
PublicApi.getManageAreaAll().then(res => {
if (res.code === 1000) {
const { data } = res;
setFieldState('provinceId', targetState => {
targetState.originData = data;
targetState.props.enum = data.map(v => ({
label: v.name,
value: v.id,
}));
});
}
});
});
useLinkEnumEffect('areaResponses', result =>
result.map(v => ({
label: v.name,
......@@ -90,14 +131,21 @@ const AddWarehouse: React.FC<{}> = (props: any) => {
})),
);
useAsyncSelect('telCode', fetchTelCode);
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
}}
initialValues={initValue}
initialValues={info}
onSubmit={handleSubmit}
actions={addSchemaAction}
actions={formActions}
schema={warehouseDetailSchema}
/>
</Card>
</PageHeaderWrapper>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</Spin>
);
};
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PATTERN_MAPS } from '@/constants/regExp';
export const warehouseSchema: ISchema = {
type: 'object',
......@@ -166,11 +167,18 @@ export const warehouseDetailSchema: ISchema = {
},
address: {
type: 'string',
required: true,
'x-component': 'TextArea',
'x-component-props': {
placeholder: '请输入详细地址(最长50个字符,25个汉字)',
rows: 5,
},
required: true,
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 50,
}
],
},
},
},
......@@ -199,16 +207,28 @@ export const warehouseDetailSchema: ISchema = {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '',
placeholder: '请选择',
},
},
tel: {
type: 'string',
'x-mega-props': { span: 3 },
'x-mega-props': {
span: 3,
},
'x-component-props': {
placeholder: '请输入你的手机号码',
maxLength: 11,
},
'x-rules': [
{
required: true,
message: '请输入你的手机号码',
},
{
pattern: PATTERN_MAPS.phone,
message: '请输入正确格式的手机号',
},
],
},
},
},
......
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