From 3cd3275236e4739a66a205ee38373a37816a17c3 Mon Sep 17 00:00:00 2001 From: chenze <1824191732@qq.com> Date: Mon, 19 Aug 2024 09:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/admin/repair/repairStats.js | 8 ++ src/views/admin/repair/RepairStatistics.vue | 108 +++++++++++++++----- 2 files changed, 93 insertions(+), 23 deletions(-) diff --git a/src/api/admin/repair/repairStats.js b/src/api/admin/repair/repairStats.js index 9e6a651..65b2230 100644 --- a/src/api/admin/repair/repairStats.js +++ b/src/api/admin/repair/repairStats.js @@ -70,6 +70,14 @@ export function selectDeviceStats (parameter) { }) } +export function selectFailureStats (parameter) { + return axios({ + url: api.repairStats + '/failureStats', + method: 'get', + params: parameter + }) +} + export function deviceTypeStats (parameter) { return axios({ url: api.repairStats + '/deviceTypeStats', diff --git a/src/views/admin/repair/RepairStatistics.vue b/src/views/admin/repair/RepairStatistics.vue index 1a84bcb..ac0a441 100644 --- a/src/views/admin/repair/RepairStatistics.vue +++ b/src/views/admin/repair/RepairStatistics.vue @@ -149,11 +149,23 @@
故障类型
- + 按月 按年 - + + +
@@ -209,7 +221,8 @@ import { repairStats, floorStats, deviceTypeStats, - selectDeviceStats + selectDeviceStats, + selectFailureStats } from '@/api/admin/repair/repairStats' export default { @@ -229,6 +242,7 @@ export default { selectedRowKeys: [], selectedRows: [], faultStatsCount: [], + selectFaultStatsCount: [], deviceType: { type: '', time: '', @@ -246,6 +260,11 @@ export default { time: '', open: false }, + faultType: { + type: '', + time: '', + open: false + }, // 表头 columns: [ { @@ -291,23 +310,8 @@ export default { this.getfloorStats() this.deviceStats() this.faultStats() + this.selectFailureStats() - // this.createEchartCake('echart2', { - // bottom: 10, - // left: 'right', - // orient: 'vertical' - // }) - // this.createEchartCake('echart3', { - // bottom: 10, - // left: 'right', - // orient: 'vertical' - // }) - - this.createEchartCake('echart6', { - bottom: 'center', - right: '10%', - orient: 'vertical' - }) }, methods: { // 使用openChange事件控制日期下拉面板显示与收起 @@ -345,6 +349,10 @@ export default { // 接收panelChange返回的值 this.fault.time = value const date1 = new Date(this.fault.time).getFullYear() + selectDeviceStats({ date: date1 }).then(res => { + this.faultStatsCount = res.data + this.createColumnEcharrt('echart5', res.data) + }) this.fault.open = false }, // 选择-楼层负责人情况 @@ -353,9 +361,51 @@ export default { }, clickFault (a, c) { this.fault.time = c - console.log(c) + selectDeviceStats({ date: c }).then(res => { + this.faultStatsCount = res.data + this.createColumnEcharrt('echart5', res.data) + }) }, + // 故障类型 使用openChange事件控制日期下拉面板显示与收起 + openFaultTypeChange (open) { + this.faultType.open = open + }, + // 使用panelChange事件控制选中年份的方法 + panelFaultTypeChange (value) { + // 接收panelChange返回的值 + this.faultType.time = value + const date1 = new Date(this.faultType.time).getFullYear() + selectFailureStats({ date: date1 }).then(res => { + console.log(res) + this.selectFaultStatsCount = res.data + this.createEchartCake('echart6', { + bottom: 10, + left: 'right', + orient: 'vertical' + }, this.selectFaultStatsCount) + }) + this.faultType.open = false + + }, + // 选择-楼层负责人情况 + selectFaultType (value, option) { + this.faultType.type = value + }, + clickFaultType (a, c) { + this.faultType.time = c + selectFailureStats({ date: c }).then(res => { + console.log(res) + this.selectFaultStatsCount = res.data + this.createEchartCake('echart6', { + bottom: 10, + left: 'right', + orient: 'vertical' + }, this.selectFaultStatsCount) + }) + }, + + // 使用openChange事件控制日期下拉面板显示与收起 openDeviceTypeChange (open) { this.deviceType.open = open @@ -394,12 +444,26 @@ export default { }) }, faultStats () { - selectDeviceStats({ date: '2024-08' }).then(res => { + let date = this.formatDate() + + selectDeviceStats({ date: date }).then(res => { this.faultStatsCount = res.data this.createColumnEcharrt('echart5', res.data) }) }, + selectFailureStats () { + let date = this.formatDate() + selectFailureStats({ date: date }).then(res => { + console.log(res) + this.selectFaultStatsCount = res.data + this.createEchartCake('echart6', { + bottom: 10, + left: 'right', + orient: 'vertical' + }, this.selectFaultStatsCount) + }) + }, getYearCount () { this.type = 'year' repairStats().then(res => { @@ -620,8 +684,6 @@ export default { } } } - -