Commit 5a8fb662 authored by baixian's avatar baixian

ERP年龄计算优化

parent c2b662e1
......@@ -18,5 +18,5 @@
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="https://cdn.s.shangjiadao.cn/qingxiao/biz/dist/main.d6563c.js"></script></body>
<script type="text/javascript" src="https://cdn.s.shangjiadao.cn/qingxiao/biz/dist/main.4a8467.js"></script></body>
</html>
......@@ -896,7 +896,7 @@ class StudentMgt extends React.Component {
return (
<div>
{/* { new Date(Date(record.birthday)).getFullYear()} */}
{record.birthday ? `${(new Date().getFullYear() + 1) - new Date(record.birthday).getFullYear()}` : ''}
{record.birthday ? `${((new Date().getFullYear()) - new Date(record.birthday).getFullYear()) == 0 ? 1 : ((new Date().getFullYear()) - new Date(record.birthday).getFullYear())}` : ''}
</div>
);
},
......
......@@ -96,15 +96,15 @@ class StudentAddForm extends React.Component {
const { getFieldDecorator } = this.props.form;
let cAge = 0;
if (!selectYear == '') {
const toyear = new Date().getFullYear() + 1;
cAge = toyear - selectYear;
const toyear = new Date().getFullYear();
cAge = ((toyear - selectYear) == 0) ? 1 : toyear - selectYear;
} else {
if (!studentsdetail.birthday) {
cAge = 0;
} else {
const year = new Date(studentsdetail.birthday.replace(/-/g, '-')).getFullYear();
const toyear = new Date().getFullYear() + 1;
cAge = toyear - year;
const toyear = new Date().getFullYear();
cAge = ((toyear - year) == 0) ? 1 : toyear - year;
}
}
// const cage = toyear - Number(dateString ? dateString.format('YYYY') : 0);
......
......@@ -775,7 +775,7 @@ class StudentMgt extends React.Component {
</Descriptions>
<Descriptions>
<Descriptions.Item label="状态">{studentsdetail.student_courses && studentsdetail.student_courses.length == 0 ? '未在读' : '在读'}</Descriptions.Item>
<Descriptions.Item label="年龄">{(new Date().getFullYear() + 1) - new Date(studentsdetail.birthday).getFullYear()}</Descriptions.Item>
<Descriptions.Item label="年龄">{((new Date().getFullYear()) - new Date(studentsdetail.birthday).getFullYear() == 0 ? 1 : (new Date().getFullYear()) - new Date(studentsdetail.birthday).getFullYear())}</Descriptions.Item>
<Descriptions.Item label="备注">{studentsdetail.remark}</Descriptions.Item>
</Descriptions>
</Col>
......
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