修改了对应统计页面

This commit is contained in:
chenze 2024-08-19 09:14:39 +08:00
parent f527157896
commit 3cd3275236
2 changed files with 93 additions and 23 deletions

View File

@ -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',

View File

@ -149,11 +149,23 @@
<div class="headView">
<div class="titleView">故障类型</div>
<div class="conditionView">
<a-select default-value="week" style="width: 120px;margin-right: 10px">
<a-select :value="faultType.type" @select="selectFaultType" style="width: 120px;margin-right: 10px">
<a-select-option value="month">按月</a-select-option>
<a-select-option value="year">按年</a-select-option>
</a-select>
<a-date-picker placeholder="请选择时间" />
<a-date-picker
v-if="faultType.type == 'year' || faultType.type == ''"
format="YYYY"
mode="year"
:value="faultType.time"
placeholder="选择年份"
:open="faultType.open"
@openChange="openFaultTypeChange"
@panelChange="panelFaultTypeChange"
>
</a-date-picker>
<a-month-picker v-if='faultType.type =="month"' @change="clickFaultType" :value="faultType.time"
placeholder="请选择月" />
</div>
</div>
<div class="contentView">
@ -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 {
}
}
}
</script>
<style scoped>