diff --git a/src/api/prison/dashboard/index.ts b/src/api/prison/dashboard/index.ts index 08768d15..1ec6c9bf 100644 --- a/src/api/prison/dashboard/index.ts +++ b/src/api/prison/dashboard/index.ts @@ -217,7 +217,6 @@ export interface PrisonerDashboardStatsRespVO { imprisonmentDate: string // 入狱时间 releaseDate: string // 出狱时间 servedDays: number // 已服刑天数 - remainingDays: number // 剩余刑期天数 age: number // 年龄 nativePlace: string // 籍贯 education: string // 文化程度 diff --git a/src/views/Dashboard/Index.vue b/src/views/Dashboard/Index.vue index 876a759b..f9f8eaed 100644 --- a/src/views/Dashboard/Index.vue +++ b/src/views/Dashboard/Index.vue @@ -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;