74 lines
1.7 KiB
Vue
74 lines
1.7 KiB
Vue
<template>
|
|
<view class="device-log">
|
|
<view class="cell-group">
|
|
<u-cell-group :border="false">
|
|
<u-cell icon="file-text" :title="$tt('home.eventLog')" :isLink="true" size="large"
|
|
@click="handleEventLogClick"></u-cell>
|
|
<u-cell icon="bookmark" :title="$tt('home.Instructionlog')" :isLink="true" size="large"
|
|
@click="handleOrderLogClick"></u-cell>
|
|
</u-cell-group>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'deviceLog',
|
|
props: {
|
|
device: {
|
|
type: Object,
|
|
default: null,
|
|
required: true
|
|
}
|
|
},
|
|
watch: {
|
|
// 兼容小程序
|
|
device: function (newVal, oldVal) {
|
|
this.deviceInfo = newVal;
|
|
this.deviceId = newVal.deviceId;
|
|
this.serialNumber = newVal.serialNumber;
|
|
this.productId = newVal.productId;
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
deviceId: 0,
|
|
serialNumber: '',
|
|
productId: '',
|
|
thingsModel: {}, // 物模型
|
|
deviceInfo: {} // 设备信息
|
|
};
|
|
},
|
|
created () {
|
|
// 获取设备状态(兼容H5和APP)
|
|
if (this.device.serialNumber) {
|
|
this.deviceInfo = this.device;
|
|
this.deviceId = this.device.deviceId;
|
|
this.serialNumber = this.device.serialNumber;
|
|
this.productId = this.device.productId;
|
|
}
|
|
},
|
|
methods: {
|
|
handleEventLogClick () {
|
|
uni.navigateTo({
|
|
url: `/pagesB/home/device/log/event?serialNumber=${this.serialNumber}&productId=${this.productId}`
|
|
});
|
|
},
|
|
handleOrderLogClick () {
|
|
uni.navigateTo({
|
|
url: `/pagesB/home/device/log/order?deviceId=${this.deviceId}&serialNumber=${this.serialNumber}`
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.device-log {
|
|
.cell-group {
|
|
margin: 20rpx;
|
|
background: #ffffff;
|
|
border-radius: 10rpx;
|
|
}
|
|
}
|
|
</style> |