|
|
@@ -46,6 +46,7 @@
|
|
|
size="lg fixed"
|
|
|
>
|
|
|
<div class="l-flex__none l-flex c-sibling-item--v">
|
|
|
+ <div class="l-flex--row u-bold">总时长:{{ total }}小时</div>
|
|
|
<div class="l-flex__fill" />
|
|
|
<el-select
|
|
|
v-if="power"
|
|
|
@@ -71,6 +72,7 @@
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"
|
|
|
:picker-options="pickerOptions"
|
|
|
+ :clearable="false"
|
|
|
@change="getOnlineDurationReport"
|
|
|
/>
|
|
|
</div>
|
|
|
@@ -151,6 +153,14 @@ export default {
|
|
|
map[data.sumDate] = seconds ? (seconds / 3600).toFixed(1) : '0'
|
|
|
}
|
|
|
return this.xData.map(date => map[date] || '0')
|
|
|
+ },
|
|
|
+ total () {
|
|
|
+ const val = this.valueData.reduce((total, val) => total + Number(val), 0)
|
|
|
+ const integer = val | 0
|
|
|
+ if (integer === val) {
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ return val.toFixed(1)
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -175,32 +185,36 @@ export default {
|
|
|
if (!this.$running) {
|
|
|
return
|
|
|
}
|
|
|
- getOnlineDurationByDevice(this.device.id).then(({ data }) => {
|
|
|
- if (data) {
|
|
|
- const amounts = []
|
|
|
- if (data.onlineSecondsUpdateTime) {
|
|
|
- amounts.push({
|
|
|
- key: 'online',
|
|
|
- label: '播控器在线时长',
|
|
|
- value: this.transformDuration(data.onlineSeconds),
|
|
|
- timestamp: data.onlineSecondsUpdateTime
|
|
|
- })
|
|
|
- }
|
|
|
- if (data.powerSecondsUpdateTime) {
|
|
|
- amounts.push({
|
|
|
- key: 'power',
|
|
|
- label: '电源开启时长',
|
|
|
- value: this.transformDuration(data.powerSeconds),
|
|
|
- timestamp: data.powerSecondsUpdateTime
|
|
|
- })
|
|
|
+ getOnlineDurationByDevice(this.device.id).then(
|
|
|
+ ({ data }) => {
|
|
|
+ if (data) {
|
|
|
+ const amounts = []
|
|
|
+ if (data.onlineSeconds) {
|
|
|
+ amounts.push({
|
|
|
+ key: 'online',
|
|
|
+ label: '播控器在线时长',
|
|
|
+ value: this.transformDuration(data.onlineSeconds),
|
|
|
+ timestamp: data.onlineSecondsUpdateTime
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (data.powerSeconds && data.powerSeconds !== '0') {
|
|
|
+ amounts.push({
|
|
|
+ key: 'power',
|
|
|
+ label: '电源开启时长',
|
|
|
+ value: this.transformDuration(data.powerSeconds),
|
|
|
+ timestamp: data.powerSecondsUpdateTime
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.amounts = amounts
|
|
|
+ } else {
|
|
|
+ this.amounts = []
|
|
|
}
|
|
|
- this.amounts = amounts
|
|
|
- } else {
|
|
|
- this.amounts = []
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
+ return 60000
|
|
|
+ },
|
|
|
+ () => 2000
|
|
|
+ ).then(delay => {
|
|
|
if (this.$running) {
|
|
|
- this.$timer = setTimeout(this.startRun, 60000)
|
|
|
+ this.$timer = setTimeout(this.startRun, delay)
|
|
|
}
|
|
|
})
|
|
|
},
|