更新航次登记页面 voyageReg

This commit is contained in:
80937518651731347 2026-06-29 13:21:18 +08:00
parent b4c8296d75
commit 8da4829da3
1 changed files with 31 additions and 13 deletions

View File

@ -320,7 +320,7 @@
<el-table-column prop="member_sex" label="性别" width="50" /> <el-table-column prop="member_sex" label="性别" width="50" />
<el-table-column prop="member_birthday" label="出生年月" width="100"> <el-table-column prop="member_birthday" label="出生年月" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.member_birthday.slice(0,10) }}</span> <span>{{ formatBirthday(scope.row.member_birthday) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="年龄" width="50"> <el-table-column label="年龄" width="50">
@ -719,20 +719,38 @@ export default {
this.paramsPeople.limit = val this.paramsPeople.limit = val
this.getPeopleList() this.getPeopleList()
}, },
formatAge(birthDateString) { /**
if (birthDateString) { * 格式化出生日期显示
const today = new Date() * @param {string|null|undefined} birthDateString - 出生日期
const birthDate = new Date(birthDateString) * @returns {string}
let age = today.getFullYear() - birthDate.getFullYear() */
// formatBirthday(birthDateString) {
const m = today.getMonth() - birthDate.getMonth() if (!birthDateString || !String(birthDateString).trim()) {
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--
}
return age
} else {
return '' return ''
} }
return String(birthDateString).slice(0, 10)
},
/**
* 根据出生日期计算年龄出生信息为空时不计算
* @param {string|null|undefined} birthDateString - 出生日期
* @returns {string|number}
*/
formatAge(birthDateString) {
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()
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--
}
return age
}, },
cancelPeople() { cancelPeople() {
this.openPeople = false this.openPeople = false