|
@@ -11,6 +11,7 @@ import {
|
|
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
|
import { registerFormFields } from '@/validation/patient/registerSchema';
|
|
|
import NumberWithUnit from '@/components/NumberWithUnit';
|
|
|
+import moment from 'moment';
|
|
|
|
|
|
const genderOptions = [
|
|
|
{
|
|
@@ -68,6 +69,8 @@ interface BasicInfoFormProps {
|
|
|
form?: FormInstance;
|
|
|
}
|
|
|
const BasicInfoForm: React.FC<BasicInfoFormProps> = ({ style, form }) => {
|
|
|
+ // 或者使用moment获取今天的日期
|
|
|
+ const todayMoment = moment();
|
|
|
const patient_age = Form.useWatch('patient_age', form);
|
|
|
React.useEffect(() => {
|
|
|
console.log('patient_age 变化了:', patient_age); // 每次 NumberWithUnit onChange 都会触发
|
|
@@ -194,7 +197,11 @@ const BasicInfoForm: React.FC<BasicInfoFormProps> = ({ style, form }) => {
|
|
|
validateTrigger={registerFormFields.patient_dob.trigger}
|
|
|
rules={registerFormFields.patient_dob.validation}
|
|
|
>
|
|
|
- <DatePicker format="YYYY-MM-DD" style={{ width: '100%' }} />
|
|
|
+ <DatePicker
|
|
|
+ format="YYYY-MM-DD"
|
|
|
+ defaultValue={todayMoment}
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ />
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
label={
|