|
|
@@ -1,12 +1,20 @@
|
|
|
<template>
|
|
|
<div
|
|
|
class="o-device u-pointer"
|
|
|
+ :class="statusColorClass"
|
|
|
:data-id="device.id"
|
|
|
@click="onClick"
|
|
|
>
|
|
|
- <div class="l-flex__none l-flex--row c-sibling-item--v o-device__block u-font-size u-bold">
|
|
|
+ <div class="l-flex__none l-flex--row c-sibling-item--v o-device__block">
|
|
|
+ <div class="l-flex__none l-flex--row center c-sibling-item o-device__status u-font-size">
|
|
|
+ <template v-if="hasStatus">●</template>
|
|
|
+ <i
|
|
|
+ v-else
|
|
|
+ class="el-icon-loading"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<auto-text
|
|
|
- class="l-flex__fill c-sibling-item"
|
|
|
+ class="l-flex__fill c-sibling-item nearest u-color--black u-font-size--sm u-bold"
|
|
|
:text="name"
|
|
|
/>
|
|
|
<template v-if="hasStatus">
|
|
|
@@ -16,35 +24,30 @@
|
|
|
>
|
|
|
<template #content>{{ powerStatusTip }}</template>
|
|
|
<i
|
|
|
- class="l-flex__none c-sibling-item near o-device__status"
|
|
|
+ class="l-flex__none c-sibling-item near o-device__power"
|
|
|
:class="switchStatusClass"
|
|
|
@click.stop
|
|
|
/>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip placement="top">
|
|
|
- <template #content>{{ statusInfoTip }}</template>
|
|
|
- <div
|
|
|
- class="l-flex__none o-device__tip u-font-size--xs"
|
|
|
- :class="statusClass"
|
|
|
- >
|
|
|
- <span class="u-color--white">{{ statusTip }}</span>
|
|
|
- </div>
|
|
|
- </el-tooltip>
|
|
|
</template>
|
|
|
- <i
|
|
|
- v-else
|
|
|
- class="l-flex__none c-sibling-item near el-icon-loading"
|
|
|
- />
|
|
|
</div>
|
|
|
- <div class="l-flex__none l-flex--row c-sibling-item--v nearer o-device__block u-relative u-color--blue">
|
|
|
+ <div class="l-flex__none l-flex--row c-sibling-item--v nearest o-device__block u-relative u-color--blue">
|
|
|
<i class="l-flex__none c-sibling-item el-icon-location-outline u-font-size" />
|
|
|
<auto-text
|
|
|
class="l-flex__auto c-sibling-item nearest u-font-size--xs u-bold"
|
|
|
:text="address"
|
|
|
/>
|
|
|
+ </div>
|
|
|
+ <div class="l-flex__none l-flex--row c-sibling-item--v nearest u-font-size--xs">
|
|
|
+ <div
|
|
|
+ class="l-flex__fill c-sibling-item o-device__info"
|
|
|
+ :class="statusInfoColorClass"
|
|
|
+ >
|
|
|
+ {{ statusInfo }}
|
|
|
+ </div>
|
|
|
<div
|
|
|
v-if="isOnline && volume > -1"
|
|
|
- class="l-flex__none o-device__volume u-color--white u-font-size--sm has-active"
|
|
|
+ class="l-flex__none l-flex--row inline c-sibling-item near o-device__volume u-color--white has-active"
|
|
|
@click.stop="onVolume"
|
|
|
>
|
|
|
<template v-if="volume === 0">
|
|
|
@@ -99,7 +102,7 @@ export default {
|
|
|
return this.device.address
|
|
|
},
|
|
|
powerStatusTip () {
|
|
|
- return this.hasPower
|
|
|
+ return this.hasPower && this.hasPowerRealStatus
|
|
|
? this.powerStatus === Status.WARNING
|
|
|
? `电源状态异常,${this.switchStatus === Power.LOADING ? '检测' : '最后上报'}时间 ${this.timestamp}`
|
|
|
: this.isPowerOpened
|
|
|
@@ -116,32 +119,47 @@ export default {
|
|
|
isPowerOpened () {
|
|
|
return !this.hasPower || this.hasPowerRealStatus && (this.powerStatus === Status.OK && this.switchStatus !== Power.OFF)
|
|
|
},
|
|
|
- isRealOnline () {
|
|
|
- return this.hasStatus && this.isOnline && this.isPowerOpened
|
|
|
- },
|
|
|
- isRealOffline () {
|
|
|
- return this.hasStatus && !this.isRealOnline
|
|
|
- },
|
|
|
switchStatusClass () {
|
|
|
- if (this.powerStatus === Status.WARNING) {
|
|
|
- return 'el-icon-warning u-color--warning u-font-size--2xl'
|
|
|
- }
|
|
|
- return this.switchStatus === Power.ON ? 'on' : this.switchStatus === Power.OFF ? 'off' : 'other'
|
|
|
+ return this.powerStatus === Status.WARNING
|
|
|
+ ? 'el-icon-warning u-color--warning u-font-size--xl'
|
|
|
+ : this.switchStatus === Power.ON
|
|
|
+ ? 'on'
|
|
|
+ : this.switchStatus === Power.OFF
|
|
|
+ ? 'off'
|
|
|
+ : 'other'
|
|
|
},
|
|
|
- statusClass () {
|
|
|
- return this.isOnline ? 'u-color--success dark' : 'u-color--error dark'
|
|
|
+ statusColorClass () {
|
|
|
+ return this.hasStatus
|
|
|
+ ? this.isOnline
|
|
|
+ ? this.hasPower && this.hasPowerRealStatus && this.powerStatus === Status.WARNING
|
|
|
+ ? 'u-color--warning'
|
|
|
+ : 'u-color--success dark'
|
|
|
+ : 'u-color--error dark'
|
|
|
+ : 'u-color--info'
|
|
|
},
|
|
|
- statusTip () {
|
|
|
- return this.isOnline ? '在线' : '离线'
|
|
|
+ statusInfo () {
|
|
|
+ return this.hasStatus
|
|
|
+ ? this.hasPower && this.hasPowerRealStatus
|
|
|
+ ? this.powerStatus === Status.WARNING
|
|
|
+ ? '电源状态异常'
|
|
|
+ : this.isPowerOpened
|
|
|
+ ? '屏幕已开启'
|
|
|
+ : '屏幕未开启'
|
|
|
+ : this.device.lastOnline
|
|
|
+ ? this.isOnline
|
|
|
+ ? `${this.device.lastOnline} 上线`
|
|
|
+ : `${this.device.lastOnline} 离线`
|
|
|
+ : this.isOnline
|
|
|
+ ? '播控器正常运行中'
|
|
|
+ : '当前播控器已离线'
|
|
|
+ : '检测中...'
|
|
|
},
|
|
|
- statusInfoTip () {
|
|
|
- return this.device.lastOnline
|
|
|
- ? this.isOnline
|
|
|
- ? `${this.device.lastOnline} 上线`
|
|
|
- : `${this.device.lastOnline} 离线`
|
|
|
- : this.isOnline
|
|
|
- ? '播控器正常运行中'
|
|
|
- : '当前播控器离线了'
|
|
|
+ statusInfoColorClass () {
|
|
|
+ return this.hasPower && this.hasPowerRealStatus && !this.isPowerOpened
|
|
|
+ ? 'u-color--warning'
|
|
|
+ : this.isOnline && !this.hasPower
|
|
|
+ ? 'u-color--info'
|
|
|
+ : ''
|
|
|
},
|
|
|
volumeTip () {
|
|
|
if (this.volume > -1) {
|
|
|
@@ -205,9 +223,8 @@ export default {
|
|
|
display: inline-flex;
|
|
|
flex-direction: column;
|
|
|
padding: $padding--2xs $padding--xs;
|
|
|
- color: $black;
|
|
|
line-height: 1;
|
|
|
- border-radius: $radius;
|
|
|
+ border-radius: $radius--sm;
|
|
|
background-color: #fff;
|
|
|
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1), 0 2px 6px 0 rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
@@ -216,11 +233,15 @@ export default {
|
|
|
}
|
|
|
|
|
|
&__status {
|
|
|
+ width: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__power {
|
|
|
display: inline-flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
- width: 24px;
|
|
|
- height: 24px;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
|
|
|
&.on {
|
|
|
background: url("~@/assets/icon_on.svg") 0 0 / 100% 100% no-repeat;
|
|
|
@@ -231,26 +252,18 @@ export default {
|
|
|
}
|
|
|
|
|
|
&.other {
|
|
|
- width: 54px;
|
|
|
+ width: 40px;
|
|
|
background: url("~@/assets/icon_on_2.svg") 0 0 / 100% 100% no-repeat;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- &__tip {
|
|
|
- display: inline-block;
|
|
|
- position: relative;
|
|
|
- left: $padding--xs;
|
|
|
- padding: $padding--2xs $padding--sm $padding--2xs $padding;
|
|
|
- border-radius: $radius--sm 0 0 $radius--sm;
|
|
|
- background-color: currentColor;
|
|
|
+ &__info {
|
|
|
+ padding: $padding--2xs 0;
|
|
|
}
|
|
|
|
|
|
&__volume {
|
|
|
- display: inline-block;
|
|
|
- position: relative;
|
|
|
- left: $padding--xs;
|
|
|
padding: $padding--2xs;
|
|
|
- border-radius: $radius--sm 0 0 $radius--sm;
|
|
|
+ border-radius: $radius--sm;
|
|
|
background-color: $gray--dark;
|
|
|
}
|
|
|
}
|