Commit e12fcc8f authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞 fix(平台营销活动管理): 修复新增选择会员筛选条件

parent 856b02ac
......@@ -70,7 +70,7 @@
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"crypto-js": "^4.0.0",
"god": "^0.2.9",
"god": "^0.2.11",
"lingxi-design-ui": "^2.0.19",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
......
......@@ -54,7 +54,7 @@ const ModalBox: React.FC<ModalBoxProps> = ({
}
setConfirmLoading(false)
onConfirm();
}).catch(err => {})
}).catch(err => { })
} catch (errInfo) { }
}
......@@ -92,10 +92,14 @@ const ModalBox: React.FC<ModalBoxProps> = ({
<Space style={{ display: 'flex' }} align='baseline'>
<Form.Item
name='startTime'
dependencies={['signUpStartTime', 'endTime', 'signUpEndTime']}
rules={[
{ required: true, message: '请选择活动开始时间!' }, () => ({
() => ({
async validator(_, value) {
let _exVal = await form.getFieldValue('endTime');
if (!value) {
return Promise.reject(new Error('请选择活动开始时间!'));
}
if (_exVal && moment(value).isAfter(_exVal)) {
return Promise.reject(new Error('活动开始时间需要早于活动结束时间'));
}
......@@ -105,6 +109,7 @@ const ModalBox: React.FC<ModalBoxProps> = ({
]}>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
const _endTime = form.getFieldValue('endTime');
......@@ -118,10 +123,14 @@ const ModalBox: React.FC<ModalBoxProps> = ({
~
<Form.Item
name='endTime'
dependencies={['signUpStartTime', 'startTime', 'signUpEndTime']}
rules={[
{ required: true, message: '请选择活动结束时间!' }, () => ({
() => ({
async validator(_, value) {
let _exVal = await form.getFieldValue('startTime');
if (!value) {
return Promise.reject(new Error('请选择活动结束时间!'));
}
if (_exVal && moment(value).isBefore(_exVal)) {
return Promise.reject(new Error('活动结束时间需要晚于活动开始时间'));
}
......@@ -131,6 +140,7 @@ const ModalBox: React.FC<ModalBoxProps> = ({
]}>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
const _startTime = form.getFieldValue('startTime');
......@@ -152,10 +162,14 @@ const ModalBox: React.FC<ModalBoxProps> = ({
<Space style={{ display: 'flex' }} align='baseline'>
<Form.Item
name='signUpStartTime'
dependencies={['endTime', 'startTime', 'signUpEndTime']}
rules={[
{ required: true, message: '请选择要求报名时间!' }, () => ({
() => ({
async validator(_, value) {
let _exVal = await form.getFieldValue('signUpEndTime');
if (!value) {
return Promise.reject(new Error('请选择要求报名时间!'));
}
if (_exVal && moment(value).isAfter(_exVal)) {
return Promise.reject(new Error('要求报名时间需要早于活动结束时间'));
}
......@@ -165,6 +179,7 @@ const ModalBox: React.FC<ModalBoxProps> = ({
]}>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
const _endTime = form.getFieldValue('signUpEndTime');
......@@ -178,10 +193,14 @@ const ModalBox: React.FC<ModalBoxProps> = ({
~
<Form.Item
name='signUpEndTime'
dependencies={['endTime', 'startTime', 'signUpStartTime']}
rules={[
{ required: false, message: '请选择活动结束时间!' }, () => ({
() => ({
async validator(_, value) {
let _exVal = await form.getFieldValue('signUpStartTime');
if (!value) {
return Promise.reject(new Error('活请选择活动结束时间!'));
}
if (_exVal && moment(value).isBefore(_exVal)) {
return Promise.reject(new Error('活动结束时间需要晚于要求报名时间'));
}
......@@ -191,6 +210,7 @@ const ModalBox: React.FC<ModalBoxProps> = ({
]}>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
const _startTime = form.getFieldValue('signUpStartTime');
......
......@@ -8,6 +8,9 @@ import { PublicApi } from '@/services/api';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { isEmpty } from '@/components/NiceForm/components/AntUpload/shared';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { FormEffectHooks } from '@formily/antd';
const { onFormMount$ } = FormEffectHooks;
interface ApplyMemberLayoutProps {
/** getInviteList */
......@@ -75,7 +78,7 @@ const ApplyMemberLayout: React.FC<ApplyMemberLayoutProps> = (props: any) => {
setVisible(flag)
}
const handleFetchData = useCallback((params: any) => {
const handleFetchData = (params: any) => {
return new Promise(resolve => {
PublicApi.postMemberManagePlatformMarketingInvitePage({ ...params }, { ctlType: 'none' }).then(res => {
if (res.code !== 1000) {
......@@ -101,7 +104,7 @@ const ApplyMemberLayout: React.FC<ApplyMemberLayoutProps> = (props: any) => {
console.warn(error)
})
})
}, [])
}
const handleOk = (selectRowKeys: string[] | number[], selectRowRecord: any) => {
SetDataSource(selectRowRecord)
......@@ -116,6 +119,23 @@ const ApplyMemberLayout: React.FC<ApplyMemberLayoutProps> = (props: any) => {
}
}, [dataView])
const useStateEffects = () => {
const linkage = useLinkageUtils();
onFormMount$().subscribe(() => {
/** 活动类型 */
PublicApi.postMemberManagePlatformMarketingInvitePageItems({}, { ctlType: 'none' }).then(res => {
const memberTypes = res.data.memberTypes.map((item) => { return { label: item.name, value: item.value } });
const levels = res.data.levels.map((item) => { return { label: item.levelTag, value: item.level } });
const roles = res.data.roles.map((item) => { return { label: item.roleName, value: item.roleId } });
linkage.enum('memberType', memberTypes);
linkage.enum('level', levels);
linkage.enum('roleId', roles);
}).catch(err => {
console.warn(err)
})
})
}
return (
<CardLayout
id="applyMemberLayout"
......@@ -193,7 +213,7 @@ const ApplyMemberLayout: React.FC<ApplyMemberLayoutProps> = (props: any) => {
onClose={() => toggle(false)}
onOk={handleOk}
effects={($, actions) => {
actions.reset()
useStateEffects()
useStateFilterSearchLinkageEffect($, actions, "name", FORM_FILTER_PATH)
}}
schema={{
......
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