| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <view>
- <view style="position: fixed;z-index: 100;width: 100%;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
- </view>
- <view class="info">
- <view class="info_item">
- <image :src="eqinfo.item.is_online==1?'../../static/image/cb/onBg.png':'../../static/image/cb/offBg.png'" mode=""
- class="bgi"></image>
- <p style="font-size: 32rpx;">设备 ID:{{eqinfo.item.equip_id}}</p>
- <p>设备名称:{{eqinfo.item.equip_name?eqinfo.item.equip_name:"无"}}</p>
- <p>最近上报时间:{{eqinfo.item.uptime|timeFormat()}}</p>
- </view>
- </view>
- <view class="control">
- <view class="control_item" @click="control">
- <image src="../../static/image/prevention/8.png" mode=""></image>
- <p>设备控制</p>
- </view>
- <view class="control_item" @click="information">
- <image src="../../static/image/environment/9.png" mode=""></image>
- <p>24小时数据</p>
- </view>
- <view class="control_item" @click="charts">
- <image src="../../static/image/environment/10.png" mode=""></image>
- <p>历史数据</p>
- </view>
- </view>
- <view class="realtime">
- <p class="realtime_title">实时数据</p>
- <view class="realtime_text">
- <view class="realtime_text_item">
- <view class="realtime_text_item_info" v-for="(item,index) in olddata.conf" :key="index" v-if="item">
- <view class="item_info_img" :style="{'background-color':olddatas[Math.floor(Math.random()*(5-0+1))]}">
- <image :src="'../../static/image/environment/icon_'+olddata.dat[index][1]+'.png'" mode=""></image>
- </view>
- <view class="item_info_text">
- <p>{{item}}</p>
- <p style="margin-top: 20rpx;">{{parseFloat(olddata.dat[index][0]) == -99.99 ?'N/A':parseFloat(olddata.dat[index])}}</p>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- eqinfo: {},
- olddata: {},
- olddatas: ["#fba825","#53d67c","#008cf2","#fb504d","#d87ffc","#4ec5f0"],
- }
- },
- methods: {
- clickLeft(){
- uni.navigateBack({
- delta:1
- })
- },
- async history() { //设备列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=weather.weather.qxz_status',
- data: {
- device_id: this.eqinfo.item.equip_id
- }
- })
- this.olddata = res
- for(var key in this.olddata.conf){
- if(this.olddata.conf[key].indexOf("#")!=-1){
- this.olddata.conf[key] = this.olddata.conf[key].replace("#","(")+")"
- }
- this.olddata.dat[key] = this.olddata.dat[key].split("#")
- }
- console.log(this.olddata)
- },
- control(){//设备控制
- uni.navigateTo({
- url:"./contros?id="+this.eqinfo.item.d_id
- })
- },
- information(){//24小时数据
- uni.navigateTo({
- url:"./onedaythedata?id="+this.eqinfo.item.equip_id
- })
- },
- charts(){//历史数据
- uni.navigateTo({
- url:"./history?device_id="+this.eqinfo.item.equip_id
- })
- }
- },
- onLoad(option) {
- this.$forceUpdate()
- this.eqinfo.item = JSON.parse(option.shebei)
- console.log(this.eqinfo)
- this.history()
- }
- }
- </script>
- <style lang="scss">
- .info {
- width: 100%;
- position: absolute;
- top: 44px;
- .info_item {
- width: 90%;
- margin: 0 auto;
- height: 260rpx;
- padding: 26rpx 50rpx;
- position: relative;
- .bgi {
- width: 100%;
- height: 260rpx;
- position: absolute;
- top: 0;
- left: 0;
- z-index: -1;
- }
- p {
- font-size: 24rpx;
- color: #FFFFFF;
- margin-bottom: 10rpx;
- }
- }
- }
- .control {
- width: 90%;
- position: absolute;
- top: 372rpx;
- left: 5%;
- display: flex;
- justify-content: space-between;
- text-align: center;
- padding: 0 30rpx;
-
- .control_item {
- width: 128rpx;
- height: 120rpx;
-
- image {
- width: 70rpx;
- height: 70rpx;
- }
-
- p {
- font-size: 24rpx;
- }
- }
- }
- .realtime {
- width: 100%;
- position: absolute;
- top: 500rpx;
- .realtime_title{
- font-weight: 700;
- width: 90%;
- margin: 0 auto;
- }
- .realtime_text {
- width: 90%;
- margin: 0 auto;
-
- .realtime_text_item {
- width: 100%;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- margin-bottom: 50rpx;
-
- .realtime_text_item_info {
- width: 48%;
- box-shadow: 0 0 10rpx #bcb9ca;
- margin-top: 20rpx;
- display: flex;
- padding: 20rpx 20rpx;
-
- .item_info_img {
- width: 30%;
- text-align: center;
- margin-right: 30rpx;
- border-radius: 50%;
- image {
- width: 64rpx;
- height: 64rpx;
- margin-top: 10rpx
- }
- }
-
- .item_info_text {
- font-size: 24rpx;
-
- }
- }
- }
- }
-
- }
- </style>
|