Przeglądaj źródła

更新设备类型模块的操作消息提示,设备温湿度 模块完成

linan 5 lat temu
rodzic
commit
7e0b457d95

+ 13 - 3
src/views/deviceManagement/DeviceInfo.vue

@@ -209,6 +209,16 @@ export default {
         // 获取设备信息 树
         this.getTreeByCode(deviceTypeCode);
         this.getTreeByCode(arearCode);
+
+        if (this.formData.categoryId) {
+            let categoryId = this.formData.categoryId;
+            let data = {
+                categoryId: categoryId[categoryId.length - 1],
+                pageSize,
+                page: this.page
+            };
+            this.getDeviceList(data);
+        }
     },
     methods: {
         ...mapActions(["fetch"]),
@@ -314,12 +324,12 @@ export default {
                 }
             });
         },
-        // 
+        //
         look(row) {
             this.$router.push({
                 path: "deviceHumiture",
                 query: row
-            })
+            });
         },
 
         // 请求 区域树
@@ -461,7 +471,7 @@ export default {
             this.isShowDialog = true;
             this.formData = row;
             if (this.formData.meta instanceof Object) {
-                this.formData.meta = JSON.stringify(row.meta,null,2);
+                this.formData.meta = JSON.stringify(row.meta, null, 2);
             }
         },
         // 删除

+ 2 - 2
src/views/deviceManagement/DeviceType.vue

@@ -160,7 +160,7 @@ export default {
                 data: this.form,
                 success: res => {
                     this.getSubNodeList(this.id);
-                    this.$message.success("编辑节点成功!");
+                    this.$message.success(this.title.title +"成功!");
                     // this.showDialog = false;
                 },
                 fail: err => {
@@ -205,7 +205,7 @@ export default {
             this.showDialog = true;
             this.dialogStatus = 1;
             this.title = {
-                title: data.nodeName + ":添加目录",
+                title: data.nodeName + ":添加子节点",
                 nodeName: "子节点名称",
                 code: "子节点代号"
             };

+ 5 - 10
src/views/deviceManagement/deviceHumiture/charts/chart_a.vue

@@ -1,6 +1,5 @@
 <template>
     <div class="chart_a">
-        
         <div id="chart_a" style="width: 80%;height:400px;"></div>
     </div>
 </template>
@@ -8,20 +7,16 @@
 <script>
 export default {
     data() {
-        return {
-            orgOptions: {},
-            // subtext: "副标题"
-        };
+        return {};
     },
     props: {
-         dateArr:{type:Array},
-         data:{type:Array}
+         data:{type:Array},
+         time:{type:Array}
      },
     created() {
-        
     },
     watch: {
-        dateArr(nVal,oVal) {
+        data(nVal,oVal) {
             this.drawChart();
         }
     },
@@ -76,7 +71,7 @@ export default {
                 xAxis: {
                     type: "category",
                     boundaryGap: false,
-                    data: this.dateArr
+                    data: this.time
                 },
                 yAxis: {
                     type: "value",

+ 6 - 10
src/views/deviceManagement/deviceHumiture/charts/chart_b.vue

@@ -7,22 +7,18 @@
 <script>
 export default {
     data() {
-        return {
-            orgOptions: {},
-            // subtext: "副标题"
-        };
+        return {};
     },
     created() {},
     props: {
-        dateArr:{type:Array},
-        data:{type:Array}
+        data:{type:Array},
+        time:{type:Array}
     },
     watch: {
-        dateArr(nVal,oVal) {
+        data(nVal,oVal) {
             this.drawChart();
         }
     },
-
     mounted() {
         this.drawChart();
     },
@@ -72,12 +68,12 @@ export default {
                 xAxis: {
                     type: "category",
                     boundaryGap: false,
-                    data: this.dateArr || []
+                    data: this.time 
                 },
                 yAxis: {
                     type: "value",
                     axisLabel: {
-                        formatter: "{value} °C"
+                        formatter: "{value}%"
                     },
                     scale: true
                 },

+ 48 - 63
src/views/deviceManagement/deviceHumiture/deviceHumiture.vue

@@ -1,46 +1,16 @@
 <template>
     <div class="UnityTrace">
         <header class="header">
-            <h5>基本信息</h5>
+            <h5>设备信息</h5>
             <ul>
                 <el-row type="flex" class="row">
                     <el-col :span="8" class="col">
-                        <span class="title">猪编号:</span>
-                        <span class="content">1540</span>
+                        <span class="title">设备名字:</span>
+                        <span class="content">{{ mainInfo.name }}</span>
                     </el-col>
                     <el-col class="col">
-                        <span class="title">出生天数:</span>
-                        <span class="content">51</span>
-                    </el-col>
-                </el-row>
-                <el-row type="flex" class="row">
-                    <el-col :span="8" class="col">
-                        <span class="title">出生日期:</span>
-                        <span class="content">2020-05-01</span>
-                    </el-col>
-                    <el-col class="col">
-                        <span class="title">耳标号:</span>
-                        <span class="content">A3525DF3542</span>
-                    </el-col>
-                </el-row>
-                <el-row type="flex" class="row">
-                    <el-col :span="8" class="col">
-                        <span class="title">批次:</span>
-                        <span class="content">13543</span>
-                    </el-col>
-                    <el-col class="col">
-                        <span class="title">当前位置:</span>
-                        <span class="content">育肥舍四栋</span>
-                    </el-col>
-                </el-row>
-                <el-row type="flex" class="row">
-                    <el-col :span="8" class="col">
-                        <span class="title">品种:</span>
-                        <span class="content">大白</span>
-                    </el-col>
-                    <el-col class="col">
-                        <span class="title">饲养员:</span>
-                        <span class="content">某某某</span>
+                        <span class="title">设备描述:</span>
+                        <span class="content">{{ mainInfo.description }}</span>
                     </el-col>
                 </el-row>
             </ul>
@@ -57,13 +27,14 @@
                 align="right"
                 class="date-picker"
             ></el-date-picker>
-            <article v-if="dateArr.length > 0">
-                <chart-a :dateArr="dateArr" :data="animalTempArr" class="charts"></chart-a>
-                <chart-b :dateArr="dateArr" :data="envTempArr" class="charts"></chart-b>
+            <article v-if="temperatureData || humidityData">
+                <chart-a v-if="temperatureData" :data="temperatureData" :time="temperatureTime" class="charts"></chart-a>
+                <p v-else class="hint">当前时间段无温度数据...</p>
+                <chart-b v-if="humidityData" :data="humidityData" :time="humidityTime" class="charts"></chart-b>
+                <p v-else class="hint">当前时间段无温度数据...</p>
             </article>
-            <p v-else class="hint"> 当前时间段无数据... </p>
+            
         </section>
-        
     </div>
 </template>
 
@@ -94,7 +65,7 @@ const pickerOptions = {
                 picker.$emit("pick", [start, end]);
             }
         },
-         {
+        {
             text: "最近一天",
             onClick(picker) {
                 const end = new Date();
@@ -133,46 +104,60 @@ export default {
     data() {
         return {
             mainInfo: {},
-            dateArr: [],
-            animalTempArr: [],
-            envTempArr: [],
-            batteryArr: [],
+            temperatureData: [],
+            temperatureTime: [],
+            humidityData: [],
+            humidityTime: [],
+
             pickerOptions,
             value2: null,
-            SData: Math.floor(( new Date().getTime() - 3600 * 1000 * 6 ) / 1000), // 默认最近六小时 
+            SData: Math.floor((new Date().getTime() - 3600 * 1000 * 6) / 1000), // 默认最近六小时
             EData: Math.ceil(new Date().getTime() / 1000)
         };
     },
     created() {
-        console.log(this.$route.query)
-        this.mainInfo = this.$route.query
+        this.mainInfo = this.$route.query;
         // 一分钟更新一次   后端10分钟更新一次数据
-        this.getHumitureList(1)
-        this.getHumitureList(2)
-       
+        this.getHumitureList(1);
+        this.getHumitureList(2);
     },
     mounted() {},
-    
+
     methods: {
         ...mapActions(["fetch"]),
         // 事件选择器值改变
         pickerChange(value) {
-            console.log(value)
-            this.SData = Math.floor(new Date(value[0]).getTime() / 1000)
-            this.EData = Math.ceil(new Date(value[1]).getTime() / 1000)
-            console.log(this.SData, this.EData)
-            this.getHumitureList(1)
-            this.getHumitureList(2)
+            console.log(value);
+            this.SData = Math.floor(new Date(value[0]).getTime() / 1000);
+            this.EData = Math.ceil(new Date(value[1]).getTime() / 1000);
+            console.log(this.SData, this.EData);
+            this.getHumitureList(1);
+            this.getHumitureList(2);
         },
         // 请求温湿度
         getHumitureList(type) {
             // type:1-温度 2-湿度
             this.fetch({
-                api: "/hm/device/history/by-device-id",
+                api: "/analyse/hm/device/history/by-device-id",
                 method: "GET",
-                data: { deviceId: this.mainInfo.id, type}, //目前只有一个组织,其他参数调整钟
+                data: { deviceId: this.mainInfo.id, type, date: "2020-07-20" },
+                // data: { deviceId: 666, type },
                 success: res => {
-                   console.log(res)
+                    console.log(res);
+                    console.log(type);
+                    if (type == 1) {
+                        res.forEach(item => {
+                            this.temperatureData.push(item.value);
+                            this.temperatureTime.push(item.created);
+                        });
+                        console.log(this.temperature);
+                    } else if (type == 2) {
+                        res.forEach(item => {
+                            this.humidityData.push(item.value);
+                            this.humidityTime.push(item.created);
+                        });
+                        console.log(this.temperature);
+                    }
                 },
                 fail: err => {
                     console.log(err);
@@ -184,7 +169,7 @@ export default {
                     }
                 }
             });
-        },
+        }
     }
 };
 </script>
@@ -218,7 +203,7 @@ export default {
             margin-top: 30px;
             margin-bottom: 20px;
         }
-        .charts{
+        .charts {
             border-top: 1px solid #ccc;
             padding-top: 25px;
         }

+ 1 - 1
src/views/gateMachineManagement/EnterOut.vue

@@ -51,7 +51,7 @@ import { mapActions } from "vuex";
 // 每页数据条数
 const pageSize = 10;
 // 照片根地址
-const userImgUrlBase = "http://121.36.134.218:88/";
+const userImgUrlBase = "http://dgs.ifarmcloud.com/dgs-picture/";
 
 export default {
     name: "EnterOut",