更新航次登记页面 voyageReg
This commit is contained in:
parent
b4c8296d75
commit
8da4829da3
|
|
@ -320,7 +320,7 @@
|
|||
<el-table-column prop="member_sex" label="性别" width="50" />
|
||||
<el-table-column prop="member_birthday" label="出生年月" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.member_birthday.slice(0,10) }}</span>
|
||||
<span>{{ formatBirthday(scope.row.member_birthday) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="年龄" width="50">
|
||||
|
|
@ -719,10 +719,31 @@ export default {
|
|||
this.paramsPeople.limit = val
|
||||
this.getPeopleList()
|
||||
},
|
||||
/**
|
||||
* 格式化出生日期显示
|
||||
* @param {string|null|undefined} birthDateString - 出生日期
|
||||
* @returns {string}
|
||||
*/
|
||||
formatBirthday(birthDateString) {
|
||||
if (!birthDateString || !String(birthDateString).trim()) {
|
||||
return ''
|
||||
}
|
||||
return String(birthDateString).slice(0, 10)
|
||||
},
|
||||
/**
|
||||
* 根据出生日期计算年龄,出生信息为空时不计算
|
||||
* @param {string|null|undefined} birthDateString - 出生日期
|
||||
* @returns {string|number}
|
||||
*/
|
||||
formatAge(birthDateString) {
|
||||
if (birthDateString) {
|
||||
const today = new Date()
|
||||
if (!birthDateString || !String(birthDateString).trim()) {
|
||||
return ''
|
||||
}
|
||||
const birthDate = new Date(birthDateString)
|
||||
if (isNaN(birthDate.getTime())) {
|
||||
return ''
|
||||
}
|
||||
const today = new Date()
|
||||
let age = today.getFullYear() - birthDate.getFullYear()
|
||||
// 检查是否已过今年的生日
|
||||
const m = today.getMonth() - birthDate.getMonth()
|
||||
|
|
@ -730,9 +751,6 @@ export default {
|
|||
age--
|
||||
}
|
||||
return age
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
cancelPeople() {
|
||||
this.openPeople = false
|
||||
|
|
|
|||
Loading…
Reference in New Issue