Revert "fix(dashboard): 修复剩余刑期天数计算逻辑不一致问题"

This reverts commit ae0493428efbb553fa9573cd632187bf2d013a0b.
This commit is contained in:
tangweijie 2026-01-27 11:57:32 +08:00
parent ae0493428e
commit 0ba25e3492
2 changed files with 7 additions and 2 deletions

View File

@ -217,7 +217,6 @@ export interface PrisonerDashboardStatsRespVO {
imprisonmentDate: string // 入狱时间
releaseDate: string // 出狱时间
servedDays: number // 已服刑天数
remainingDays: number // 剩余刑期天数
age: number // 年龄
nativePlace: string // 籍贯
education: string // 文化程度

View File

@ -285,7 +285,13 @@ const loadData = async (prisonerId: number) => {
//
const servedDaysValue = res.servedDays || 0;
servedDays.value = servedDaysValue
remainingDays.value = res.remainingDays || 0;
remainingDays.value = 0;
if (res.imprisonmentDate && res.releaseDate) {
const startDate = new Date(res.imprisonmentDate);
const endDate = new Date(res.releaseDate);
const totalDays = Math.floor((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));
remainingDays.value = Math.max(0, totalDays - servedDaysValue);
}
// -
let totalPenaltyCount = 0;