From fcf97c48bd17fc6c682827947c56fb54555002c8 Mon Sep 17 00:00:00 2001 From: wangxiaoxian <1094175543@qq.com> Date: Fri, 6 Mar 2026 00:07:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 10 + src/router/index.js | 10 + src/views/rental/RentalArchive.vue | 374 +++++++++++++++++++++++++++++ src/views/rental/WaterArchive.vue | 346 ++++++++++++++++++++++++++ src/views/statistics/House.vue | 12 +- 5 files changed, 749 insertions(+), 3 deletions(-) create mode 100644 src/views/rental/RentalArchive.vue create mode 100644 src/views/rental/WaterArchive.vue diff --git a/src/App.vue b/src/App.vue index a37892f..f8bc532 100644 --- a/src/App.vue +++ b/src/App.vue @@ -35,6 +35,14 @@ 租房管理 + + + 租赁档案 + + + + 水费档案 + 租金统计 @@ -75,6 +83,8 @@ export default { 'room-add': '/room/add', 'rental-list': '/rental/list', 'rental-add': '/rental/add', + 'rental-archive': '/rental/archive', + 'water-archive': '/water/archive', 'rent-statistics': '/statistics/rent', 'room-statistics': '/statistics/room' } diff --git a/src/router/index.js b/src/router/index.js index c73018a..c31d335 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -78,6 +78,16 @@ const routes = [ name: 'RentalDetail', component: () => import('../views/rental/Detail.vue') }, + { + path: '/rental/archive', + name: 'RentalArchive', + component: () => import('../views/rental/RentalArchive.vue') + }, + { + path: '/water/archive', + name: 'WaterArchive', + component: () => import('../views/rental/WaterArchive.vue') + }, // 统计分析 { path: '/statistics/rent', diff --git a/src/views/rental/RentalArchive.vue b/src/views/rental/RentalArchive.vue new file mode 100644 index 0000000..1f9d8b0 --- /dev/null +++ b/src/views/rental/RentalArchive.vue @@ -0,0 +1,374 @@ + + + + + diff --git a/src/views/rental/WaterArchive.vue b/src/views/rental/WaterArchive.vue new file mode 100644 index 0000000..0c5787b --- /dev/null +++ b/src/views/rental/WaterArchive.vue @@ -0,0 +1,346 @@ + + + + + diff --git a/src/views/statistics/House.vue b/src/views/statistics/House.vue index 32852dd..3115d75 100644 --- a/src/views/statistics/House.vue +++ b/src/views/statistics/House.vue @@ -33,7 +33,10 @@ export default { }, computed: { totalCount() { - return this.roomStatusData.reduce((sum, item) => sum + item.count, 0) + // 只计算在租和空房的数量 + return this.roomStatusData + .filter(item => item.status === '在租' || item.status === '空房') + .reduce((sum, item) => sum + item.count, 0) } }, mounted() { @@ -44,10 +47,13 @@ export default { try { const response = await statisticsApi.getRoomStatus() const data = response - const total = data.reduce((sum, item) => sum + item.count, 0) + // 只计算在租和空房的数量作为总数 + const total = data + .filter(item => item.status === '在租' || item.status === '空房') + .reduce((sum, item) => sum + item.count, 0) this.roomStatusData = data.map(item => ({ ...item, - percentage: `${((item.count / total) * 100).toFixed(2)}%` + percentage: total > 0 ? `${((item.count / total) * 100).toFixed(2)}%` : '0.00%' })) } catch (error) { this.$message.error('加载房间状态统计数据失败')