From ce841ddf85c48bae32f9e3068403fdfe98ac8711 Mon Sep 17 00:00:00 2001
From: zzw <228544128@qq.com>
Date: 星期三, 07 十月 2026 12:35:09 +0800
Subject: [PATCH] feat: add extension defaults for fault reporting
---
emergency-repair-web/src/views/report/ReportPage.vue | 41 +++++++++++++++++++++++++++--------------
1 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/emergency-repair-web/src/views/report/ReportPage.vue b/emergency-repair-web/src/views/report/ReportPage.vue
index 2ae5bae..8a3c474 100644
--- a/emergency-repair-web/src/views/report/ReportPage.vue
+++ b/emergency-repair-web/src/views/report/ReportPage.vue
@@ -11,7 +11,7 @@
<div v-if="type === 'overview'" class="stat-grid">
<div class="stat-card"><div class="label">宸ョ▼鎬绘暟</div><div class="value">{{ stats.engineeringTotal || 0 }}</div></div>
<div class="stat-card"><div class="label">閲嶅ぇ鏁呴殰</div><div class="value">{{ stats.majorFault || 0 }}</div></div>
- <div class="stat-card"><div class="label">娑塇缁熻</div><div class="value">{{ stats.hRelated || 0 }}</div></div>
+ <div class="stat-card"><div class="label">娑塺k_H缁熻</div><div class="value">{{ stats.hRelated || 0 }}</div></div>
<div class="stat-card"><div class="label">鐩戞祴椤圭洰</div><div class="value">{{ stats.monitorItem || 0 }}</div></div>
<div class="stat-card"><div class="label">鏈畬宸�</div><div class="value">{{ stats.unfinished || 0 }}</div></div>
<div class="stat-card"><div class="label">宸插畬宸�</div><div class="value">{{ stats.completed || 0 }}</div></div>
@@ -38,16 +38,18 @@
export default {
name: 'ReportPage',
+ props: {
+ type: { type: String, required: true }
+ },
data() {
- return { stats: {}, rows: [], chart: null }
+ return { stats: {}, rows: [], chart: null, loadSeq: 0 }
},
computed: {
- type() { return this.$route.params.type },
title() {
return {
- overview: '瑁呭鏁呴殰鎬讳綋鍒嗘瀽',
+ overview: '璁惧鏁呴殰鎬讳綋鍒嗘瀽',
'top-equipment': '鏁呴殰楂樺彂璁惧Top',
- 'by-team': '鎸塗缁熻',
+ 'by-team': 'rk_鎸塗缁熻',
contractors: '鍘傚缁翠慨鎯呭喌',
trend: '鏁呴殰鏁� / 澶囧搧澶囦欢娑堣�楀勾搴﹁秼鍔�'
}[this.type] || '缁熻鎶ヨ〃'
@@ -74,7 +76,7 @@
{ prop: 'value', label: '鏁呴殰鏁�', width: 100 }
]
if (this.type === 'by-team') return [
- { prop: 'name', label: 'T闃熶笓涓�', width: 150 },
+ { prop: 'name', label: 'rk_T闃熶笓涓�', width: 150 },
{ prop: 'faultCount', label: '鏁呴殰鏁�' },
{ prop: 'partsCount', label: '澶囧搧澶囦欢娑堣��' }
]
@@ -93,7 +95,7 @@
}
},
watch: {
- '$route.params.type': 'load'
+ type: 'load'
},
mounted() {
this.load()
@@ -105,14 +107,25 @@
},
methods: {
load() {
- const requests = {
- overview: api.get('/reports/overview').then(res => { this.stats = res.data || {}; this.rows = this.stats.chart || [] }),
- 'top-equipment': api.get('/reports/top-equipment').then(res => { this.rows = res.data || []; this.stats = {} }),
- 'by-team': api.get('/reports/by-team').then(res => { this.rows = res.data || []; this.stats = {} }),
- contractors: api.get('/reports/contractors').then(res => { this.rows = res.data || []; this.stats = {} }),
- trend: api.get('/reports/yearly-trend').then(res => { this.rows = res.data || []; this.stats = {} })
+ const loaders = {
+ overview: () => api.get('/reports/overview').then(res => ({
+ stats: res.data || {},
+ rows: (res.data && res.data.chart) || []
+ })),
+ 'top-equipment': () => api.get('/reports/top-equipment').then(res => ({ stats: {}, rows: res.data || [] })),
+ 'by-team': () => api.get('/reports/by-team').then(res => ({ stats: {}, rows: res.data || [] })),
+ contractors: () => api.get('/reports/contractors').then(res => ({ stats: {}, rows: res.data || [] })),
+ trend: () => api.get('/reports/yearly-trend').then(res => ({ stats: {}, rows: res.data || [] }))
}
- ;(requests[this.type] || Promise.resolve()).then(() => this.$nextTick(this.renderChart))
+ const seq = ++this.loadSeq
+ const loader = loaders[this.type]
+ const request = loader ? loader() : Promise.resolve({ stats: {}, rows: [] })
+ request.then(result => {
+ if (seq !== this.loadSeq) return
+ this.stats = result.stats
+ this.rows = result.rows
+ this.$nextTick(this.renderChart)
+ }).catch(() => {})
},
renderChart() {
if (!this.$refs.chart) return
--
Gitblit v1.9.1