You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.4 KiB
63 lines
2.4 KiB
<template>
|
|
<div class="col-sm-3">
|
|
<div class="card device">
|
|
<div class="card-header">
|
|
{{model.displayName}}
|
|
<span class="float-right text-success" v-if="model.isOnline"><i class="ion ion-ios-wifi"></i></span>
|
|
<span class="float-right text-danger" v-else><i class="ion ion-ios-wifi"></i></span>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-sm-12 align-self-center">
|
|
<img class="icon" :src="model.ioTProduct.image" />
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-4 align-self-center">
|
|
<template v-if="isSmart">
|
|
<label>电功:{{electricity}} kW‧h</label>
|
|
</template>
|
|
</div>
|
|
<div class="col-sm-4 align-self-center">
|
|
<label>
|
|
状态:
|
|
<template v-if="getIoTValueByName(model,'状态')==='1'">
|
|
开
|
|
</template>
|
|
<template v-if="getIoTValueByName(model,'状态')==='0'">
|
|
关
|
|
</template>
|
|
</label>
|
|
</div>
|
|
<div class="col-sm-4 align-self-center">
|
|
<template v-if="isSmart">
|
|
<label>功率:{{power}} W</label>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer">
|
|
{{model.number}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: ['model'],
|
|
mouted: function () {
|
|
console.log(this.model);
|
|
},
|
|
computed: {
|
|
isSmart: function () {
|
|
return Enumerable.from(this.model.data).any(function (o) { return o.name === "电量"; });
|
|
},
|
|
electricity: function () {
|
|
return getIoTValueByName(this.model, '电量');
|
|
},
|
|
power: function () {
|
|
return getIoTValueByName(this.model, '功率');
|
|
}
|
|
}
|
|
};
|
|
</script> |