|
|
@@ -16,14 +16,14 @@
|
|
|
>
|
|
|
<template v-if="amounts">
|
|
|
<div
|
|
|
- v-if="amounts.length === 0"
|
|
|
+ v-if="amountList.length === 0"
|
|
|
class="u-font-size--lg u-text--center"
|
|
|
>
|
|
|
暂无统计数据
|
|
|
</div>
|
|
|
<template v-else>
|
|
|
<div
|
|
|
- v-for="amount in amounts"
|
|
|
+ v-for="amount in amountList"
|
|
|
:key="amount.key"
|
|
|
class="c-sibling-item--v far"
|
|
|
>
|
|
|
@@ -48,7 +48,7 @@
|
|
|
<div class="l-flex__none l-flex c-sibling-item--v">
|
|
|
<div class="l-flex__fill" />
|
|
|
<el-select
|
|
|
- v-if="hasPowerData"
|
|
|
+ v-if="power"
|
|
|
v-model="type"
|
|
|
class="c-sibling-item u-width--sm"
|
|
|
>
|
|
|
@@ -96,6 +96,10 @@ export default {
|
|
|
device: {
|
|
|
type: Object,
|
|
|
required: true
|
|
|
+ },
|
|
|
+ power: {
|
|
|
+ type: [Boolean, String],
|
|
|
+ default: false
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
@@ -113,11 +117,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- hasPowerData () {
|
|
|
- return this.amounts?.some(({ key }) => key === 'power')
|
|
|
+ amountList () {
|
|
|
+ if (this.power) {
|
|
|
+ return this.amounts
|
|
|
+ }
|
|
|
+ return this.amounts.filter(({ key }) => key !== 'power')
|
|
|
},
|
|
|
hasMore () {
|
|
|
- return this.amounts?.length > 1
|
|
|
+ return this.amountList?.length > 1
|
|
|
},
|
|
|
pickerOptions () {
|
|
|
return { disabledDate: this.disabledDate }
|
|
|
@@ -171,7 +178,7 @@ export default {
|
|
|
getOnlineDurationByDevice(this.device.id).then(({ data }) => {
|
|
|
if (data) {
|
|
|
const amounts = []
|
|
|
- if (data.onlineSeconds) {
|
|
|
+ if (data.onlineSecondsUpdateTime) {
|
|
|
amounts.push({
|
|
|
key: 'online',
|
|
|
label: '播控器在线时长',
|
|
|
@@ -179,7 +186,7 @@ export default {
|
|
|
timestamp: data.onlineSecondsUpdateTime
|
|
|
})
|
|
|
}
|
|
|
- if (data.powerSeconds && data.powerSeconds !== '0') {
|
|
|
+ if (data.powerSecondsUpdateTime) {
|
|
|
amounts.push({
|
|
|
key: 'power',
|
|
|
label: '电源开启时长',
|
|
|
@@ -198,6 +205,9 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
transformDuration (duration) {
|
|
|
+ if (!duration) {
|
|
|
+ return '0秒'
|
|
|
+ }
|
|
|
duration = Number(duration)
|
|
|
return [
|
|
|
{ value: duration / (24 * 3600) | 0, unit: '天' },
|