有效期页面的生效失效时间判断修改

This commit is contained in:
Daisy 2023-12-15 15:03:38 +08:00
parent 4950c8d8fe
commit 99b5327280

View File

@ -229,12 +229,30 @@ class _ElectronicKeyPeriodValidityPageState
if ((state.selectIndexList.value.isNotEmpty && if ((state.selectIndexList.value.isNotEmpty &&
state.isHaveEffectiveDate.value == true && state.isHaveEffectiveDate.value == true &&
state.isHaveFailureDate.value == true)) { state.isHaveFailureDate.value == true)) {
DateTime startDateTime = DateTime(
state.effectiveDateTime.value.year,
state.effectiveDateTime.value.month,
state.effectiveDateTime.value.day,
state.effectiveDateTime.value.hour,
state.effectiveDateTime.value.minute);
DateTime endDateTime = DateTime(
state.failureDateTime.value.year,
state.failureDateTime.value.month,
state.failureDateTime.value.day,
state.failureDateTime.value.hour,
state.failureDateTime.value.minute);
//
if (!startDateTime.isBefore(endDateTime) ||
startDateTime.isAtSameMomentAs(endDateTime)) {
Toast.show(msg: '失效时间需大于生效时间');
} else {
Map<String, dynamic> resultMap = {}; Map<String, dynamic> resultMap = {};
resultMap['validityValue'] = state.selectIndexList.value; resultMap['validityValue'] = state.selectIndexList.value;
resultMap['starDate'] = state.effectiveDateTime.value; resultMap['starDate'] = state.effectiveDateTime.value;
resultMap['endDate'] = state.failureDateTime.value; resultMap['endDate'] = state.failureDateTime.value;
Navigator.pop(context, resultMap); Navigator.pop(context, resultMap);
} }
}
})), })),
], ],
); );