Commit 4fede455 authored by GuanHua's avatar GuanHua
parents 6df65374 74b32fdb
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-11-30 20:08:50
* @LastEditTime: 2021-12-03 15:08:15
* @Description:
*/
import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd';
......@@ -262,15 +262,15 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
const { value } = state;
const releaseTimeEndValue = value?.[1];
const effectiveTime = getFieldValue('[effectiveTimeStart, effectiveTimeEnd]'); // 券有效期
const effectiveTimeStartValue = effectiveTime?.[0];
const effectiveTimeEndValue = effectiveTime?.[1];
if (
releaseTimeEndValue
&& effectiveTimeStartValue
&& moment(releaseTimeEndValue) > moment(effectiveTimeStartValue)
&& effectiveTimeEndValue
&& moment(releaseTimeEndValue) >= moment(effectiveTimeEndValue)
) {
setFieldState('[releaseTimeStart, releaseTimeEnd]', fieldState => {
FormPath.setIn(fieldState, 'errors', '领(发)券截止时间应该小于券有效期起始时间');
FormPath.setIn(fieldState, 'errors', '领(发)券截止时间应该小于券有效期截止时间');
});
} else {
actions.clearErrors('[releaseTimeStart, releaseTimeEnd]');
......@@ -280,17 +280,17 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
// 券有效期始时间
onFieldValueChange$('[effectiveTimeStart, effectiveTimeEnd]').subscribe(state => {
const { value } = state;
const effectiveTimeStartValue = value?.[0];
const effectiveTimeEndValue = value?.[1];
const releaseTime = getFieldValue('[releaseTimeStart, releaseTimeEnd]'); // 券有效期
const releaseTimeEndValue = releaseTime?.[1];
if (
effectiveTimeStartValue
effectiveTimeEndValue
&& releaseTimeEndValue
&& moment(effectiveTimeStartValue) < moment(releaseTimeEndValue)
&& moment(effectiveTimeEndValue) <= moment(releaseTimeEndValue)
) {
setFieldState('[effectiveTimeStart, effectiveTimeEnd]', fieldState => {
FormPath.setIn(fieldState, 'errors', '券有效期起始时间应该大于等于领(发)券截止时间');
FormPath.setIn(fieldState, 'errors', '券有效期截止时间应该大于领(发)券截止时间');
});
} else {
actions.clearErrors('[effectiveTimeStart, effectiveTimeEnd]');
......
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