Ver código fonte

水肥一体化新增详情

zhangsijie 2 anos atrás
pai
commit
8a0ee1c787

+ 18 - 0
pages.json

@@ -765,6 +765,24 @@
             }
             
         }
+        ,{
+            "path" : "pages/cb/shuifeiL/shuifeiL",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/cb/shuifeiL/history",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"condition": { //模式配置,仅开发期间生效
 		"current": 3, //当前激活的模式(list 的索引项)

+ 183 - 0
pages/cb/shuifeiL/history.vue

@@ -0,0 +1,183 @@
+<template>
+  <view>
+    <view class="realtime">
+      <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+        <table class="table">
+          <tr class="tr">
+            <th class="th" v-for="(item, index) in thdata" :key="'a' + index">{{ item }}</th>
+          </tr>
+          <tr class="tr" v-for="(items, indexs) in statusList" :key="'b' + indexs" v-if="statusList.length > 0">
+            <td class="td">{{ items.device_name }}</td>
+            <td class="td">{{ items.device_id }}</td>
+            <td class="td">{{ items.name }}</td>
+            <td class="td">{{ items.slave_index }}</td>
+            <td class="td">{{ items.slave_name }}</td>
+            <td class="td">{{ items.upltime | timeFormat() }}</td>
+            <td class="td">
+              <view v-if="type == 1">
+                {{ items.values == 1 ? '开' : '关' }}
+              </view>
+              <view v-else>
+                {{ items.values }}
+              </view>
+            </td>
+          </tr>
+          <tr class="tr" v-else>
+            <td class="td" v-for="item in 7">暂无数据</td>
+          </tr>
+        </table>
+      </scroll-view>
+      <view class="pagenumber">
+					<button @click="prev">上一页</button>
+					<view class="pagenumber_page">
+						第 {{page}} 页
+					</view>
+					<view class="pagenumber_page">
+						共 {{pagesum}} 页
+					</view>
+					<button @click="next" :disabled="forbidden">下一页</button>
+				</view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      device_id: {},
+      pagesum:1,
+      page:1,
+      type: '',
+      statusList: [],
+      thdata: [
+        '设备名称',
+        '设备ID',
+        '变量名称',
+        '从机序号',
+        '从机名称',
+        '时间',
+        '值',
+      ]
+    }
+  },
+  methods: {
+			prev() { //上一页
+				if (this.page > 1) {
+					this.page--
+					this.geDetail()
+				}
+			},
+			next() { //下一页
+				if (this.page < this.pagesum) {
+					this.page++
+					this.geDetail()
+				}
+			},
+    async geDetail() {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=irrigation_system.waterfertilizer.water_fer_history_data',
+        data: {
+          dataPointId: this.device_id,
+          page: this.page,
+          page_size: 10,
+        }
+      })
+      this.pagesum = Math.ceil(res.data.nums / 10) || 1
+      if (res.data.length > 0) {
+        this.statusList = res.data
+      }
+    },
+  },
+  onLoad(option) {
+    this.device_id = option.device_id;
+    this.type = option.type;
+    this.geDetail()
+  },
+}
+</script>
+
+<style lang='less'>
+page {
+  padding: 20rpx;
+  box-sizing: border-box;
+
+  .realtime {
+    display: flex;
+    flex-wrap: wrap;
+    width: 100%;
+    box-shadow: 0 0 10rpx #bcb9ca;
+    margin: 20rpx auto 30rpx;
+
+    .scroll-X {
+      width: 95%;
+      margin: 20rpx auto;
+
+      .tr {
+        display: flex;
+        overflow: hidden;
+
+        .th,
+        .td {
+          display: inline-block;
+          padding: 5rpx;
+          width: 300rpx;
+          text-align: center;
+          height: 52rpx;
+          line-height: 52rpx;
+          border: 2rpx solid #f1f1f1;
+        }
+      }
+
+      .tr:nth-child(2n-1) {
+        background-color: #f5fff8;
+      }
+
+      .tr:first-child {
+        background-color: #57c878;
+        color: #fff;
+      }
+    }
+    
+		.pagenumber {
+			display: flex;
+			margin: 20rpx auto;
+      width: 100%;
+      justify-content: space-around;
+
+			button {
+				width: 150rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+				background-color: #57c878;
+				color: #FFFFFF;
+			}
+
+			.pagenumber_page {
+				// width: 100rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+			}
+		}
+
+  }
+}
+
+.btn-box {
+  text-align: center;
+  padding: 20rpx 30rpx;
+}
+
+/deep/.u-calendar__action {
+  display: flex;
+  justify-content: space-around;
+
+  .u-calendar__action__text {
+    line-height: 25px;
+  }
+}
+</style>

+ 207 - 0
pages/cb/shuifeiL/shuifeiL.vue

@@ -0,0 +1,207 @@
+<template>
+  <view>
+    <view :class="['info', equipInfo.is_online == 1 ? 'on' : 'off']">
+      <view class="">
+        设备ID:{{ equipInfo.device_id }}
+      </view>
+      <view class="">
+        设备名称:{{ equipInfo.device_name == "" ? "无" : equipInfo.device_name }}水肥机
+      </view>
+      <view class="">
+        设备类型:{{ equipInfo.dver_num }}
+      </view>
+      <view class="">
+        设备地址:{{ equipInfo.city }}
+      </view>
+    </view>
+    <view class="infoText">设备变量</view>
+    <view class="realtime">
+      <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+        <table class="table">
+          <tr class="tr">
+            <th class="th" v-for="(item, index) in thdata" :key="'a' + index">{{ item }}</th>
+          </tr>
+          <tr class="tr" v-for="(items, indexs) in statusList" :key="'b' + indexs" v-if="statusList.length > 0">
+            <td class="td">{{ items.d_id }}</td>
+            <td class="td">{{ items.name }}</td>
+            <td class="td"><u-button type="success" size="mini" @click="goHistory(items)">历史记录</u-button></td>
+          </tr>
+          <tr class="tr" v-else>
+            <td class="td" v-for="item in 4">暂无数据</td>
+          </tr>
+        </table>
+      </scroll-view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      equipInfo: {},
+      statusList: [],
+      thdata: [
+        '变量ID',
+        '变量名称',
+        '操作'
+      ]
+    }
+  },
+  methods: {
+    copy(item) {
+      uni.setClipboardData({
+        data: item.imei || item.device_id,
+        success: function () {
+          console.log('success');
+        }
+      });
+    },
+    goHistory(items) {
+      uni.navigateTo({
+        url: `./history?device_id=${items.d_id}&type=${items.types}`
+      })
+    },
+    async geDetail() {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=irrigation_system.waterfertilizer.water_fertilizer_list',
+        data: {
+          content: this.equipInfo.device_id,
+        }
+      })
+      if (res.data.length > 0) {
+        this.equipInfo = res.data[0]
+      }
+    },
+    async geList() {
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=irrigation_system.waterfertilizer.water_fertilizer_data_list',
+        data: {
+          device_id: this.equipInfo.device_id,
+        }
+      })
+      if (res.length > 0) {
+        this.statusList = res
+      }
+    },
+  },
+  onLoad(option) {
+    var times = new Date()
+    this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
+    this.equipInfo = JSON.parse(option.detail);
+    this.geDetail()
+    this.geList()
+  },
+}
+</script>
+
+<style lang='less'>
+page {
+  padding: 20rpx;
+  box-sizing: border-box;
+
+  .infoText {
+    color: #0DC6B6;
+  }
+
+  .info {
+    padding: 20rpx 40rpx;
+    color: #fff;
+    line-height: 50rpx;
+    font-size: 26rpx;
+    background-size: 100% auto;
+    background-repeat: no-repeat;
+    background-color: #0DC6B6;
+    background-position: top left;
+    box-sizing: border-box;
+    width: 100%;
+    margin-bottom: 20rpx;
+
+    .tishi {
+      width: 28rpx;
+      height: 28rpx;
+      margin: 0rpx 0 0 20rpx;
+    }
+  }
+
+  .on {
+    background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png')
+  }
+
+  .off {
+    background-image: url('http://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png')
+  }
+
+  .caobox {
+    display: flex;
+    flex-wrap: wrap;
+    text-align: center;
+    font-size: 28rpx;
+    color: #666;
+    line-height: 50rpx;
+
+    image {
+      width: 52rpx;
+    }
+
+    .caobox_item {
+      padding: 20rpx 0;
+      box-sizing: border-box;
+      flex-basis: 25%;
+    }
+  }
+
+  .realtime {
+    display: flex;
+    flex-wrap: wrap;
+    width: 100%;
+    box-shadow: 0 0 10rpx #bcb9ca;
+    margin: 20rpx auto 30rpx;
+
+    .scroll-X {
+      width: 95%;
+      margin: 20rpx auto;
+
+      .tr {
+        display: flex;
+        overflow: hidden;
+
+        .th,
+        .td {
+          display: inline-block;
+          padding: 5rpx;
+          width: 300rpx;
+          text-align: center;
+          height: 52rpx;
+          line-height: 52rpx;
+          border: 2rpx solid #f1f1f1;
+        }
+      }
+
+      .tr:nth-child(2n-1) {
+        background-color: #f5fff8;
+      }
+
+      .tr:first-child {
+        background-color: #57c878;
+        color: #fff;
+      }
+    }
+
+  }
+}
+
+.btn-box {
+  text-align: center;
+  padding: 20rpx 30rpx;
+}
+
+/deep/.u-calendar__action {
+  display: flex;
+  justify-content: space-around;
+
+  .u-calendar__action__text {
+    line-height: 25px;
+  }
+}
+</style>

+ 1 - 1
pages/cb/sy/history.vue

@@ -29,7 +29,7 @@
 			</view>
 			<view class="condition">
 				<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
-					<table class="table" v-if="$QueryPermission(181)">
+					<table class="table">
 						<tr class="tr">
 							<th class="th" v-for="(item,index) in thdata" :key="'a'+index">{{item}}</th>
 						</tr>

+ 4 - 1
pages/disease/cmb.vue

@@ -507,7 +507,10 @@
 			} else if (this.basetype == 20) {
 				this.kongtf = this.$QueryPermission(253)
 				this.datatf = this.$QueryPermission(223)
-			}
+      } else if (this.basetype == 21) {
+				this.kongtf = this.$QueryPermission(280)
+				this.datatf = this.$QueryPermission(279)
+      }
 		},
 	};
 </script>

+ 9 - 3
pages/equipList/index.vue

@@ -18,8 +18,8 @@
       <view class="listbox">
         <view class="listbox_left">
           <view :class="currents == index
-              ? 'listbox_left_item_act listbox_left_item'
-              : 'listbox_left_item'
+            ? 'listbox_left_item_act listbox_left_item'
+            : 'listbox_left_item'
             " v-for="(item, index) in list" :key="index" @click="change(index)">
             {{ item.name }}
           </view>
@@ -324,6 +324,12 @@ export default {
         case 17:
           break;
         case 18:
+          var obj = {};
+          obj.device_id = item.imei;
+          obj.is_online = item.is_online;
+          uni.navigateTo({
+            url: "../cb/shuifeiL/shuifeiL?detail=" + JSON.stringify(obj),
+          });
           break;
         case 11:
           var obj = {};
@@ -370,7 +376,7 @@ export default {
             url: "../disease/cmb?shebei=" + JSON.stringify(obj),
           });
           break;
-          case 21:
+        case 21:
           var obj = {};
           obj.d_id = item.d_id;
           obj.device_id = item.imei;