dedsudiyu 1 рік тому
батько
коміт
1cd41d2438

+ 8 - 1
src/api/iotDevice/index.js

@@ -130,7 +130,14 @@ export function iotDeviceAddBatch(data) {
     data: data
   })
 }
-
+//物联设备-查询传感器LOG日志
+export function iotDeviceDataList(data) {
+  return request({
+    url: '/iot/deviceData/list',
+    method: 'post',
+    data: data
+  })
+}
 /************物联分类************/
 //物联分类列表
 export function iotTypeList(data) {

+ 91 - 24
src/views/integratedManagement/laboratoryManagement/subject/infoPage.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="infoPage" v-if="subjectData.infoId">
+    <div class="subject-infoPage" v-if="subjectData.infoId">
       <!--左侧数据展示-->
       <div class="left-max-box scrollbar-box">
         <div class="all-title-box">
@@ -97,27 +97,27 @@
         <p class="sensor-box" v-for="(item,index) in sensorList" :key="index">{{item.deviceName}}:<span>{{item.deviceValue}}{{item.unit}}</span></p>
         <img class="null-data-img" src="@/assets/ZDimages/basicsModules/null-data.png" v-if="!sensorList[0]">
         <p class="null-p" v-if="!sensorList[0]" >暂无环境监测信息,请在更多操作-物联设备配置中进行添加</p>
-        <!--<div class="all-title-box" style="height:40px;margin-top:20px;">-->
-          <!--<p></p>-->
-          <!--<p>物联控制</p>-->
-        <!--</div>-->
-        <!--<div class="things-box" v-for="(item,index) in subjectData.labHardwareVOListTwo" :key="item.id" v-if="item.hardwareTypeEnum.enumName == 'SWITCH'">-->
-          <!--<div class="things-for-box">-->
-            <!--<p class="left-title">{{item.hardwareName}}</p>-->
-            <!--<el-switch-->
-              <!--v-if="item.state.code == 3||item.state.code == 4"-->
-              <!--class="switch"-->
-              <!--@click.native="changeIsNeedCaptcha(item)"-->
-              <!--v-model="item.state.code"-->
-              <!--:active-value="3"-->
-              <!--:inactive-value="4"-->
-              <!--active-text="开"-->
-              <!--inactive-text="关"-->
-              <!--disabled>-->
-            <!--</el-switch>-->
-            <!--<p class="switch-null-p" v-else>{{item.state.name}}</p>-->
-          <!--</div>-->
-        <!--</div>-->
+        <div class="all-title-box" style="height:40px;margin-top:20px;">
+          <p></p>
+          <p>物联控制</p>
+        </div>
+        <div class="things-box" v-for="(item,index) in hardwareList" :key="item.id">
+          <div class="things-for-box">
+            <p class="left-title">{{item.hardwareName}}</p>
+            <el-switch
+              v-if="item.online"
+              class="switch"
+              @click.native="changeIsNeedCaptcha(item)"
+              v-model="item.operatingState"
+              :active-value="true"
+              :inactive-value="false"
+              active-text="开"
+              inactive-text="关"
+              disabled>
+            </el-switch>
+            <p class="switch-null-p" v-else>离线</p>
+          </div>
+        </div>
         <!--<div class="things-box" v-for="(item,index) in subjectData.labHardwareVOListTwo" :key="item.id" v-if="item.hardwareTypeEnum.enumName == 'AI_VENTILATION'">-->
           <!--<div class="things-for-box">-->
             <!--<p class="left-title">{{item.hardwareName}}</p>-->
@@ -229,7 +229,8 @@
   //                                  V3
   import qrCodeDialog from "@/components/qrCodeDialog/index.vue"
   import {
-    iotSensorFindBySubId
+    iotSensorFindBySubId,
+    iotHardwareFindBySubId
   } from '@/api/commonality/permission'
   export default {
       name: "infoPage",
@@ -268,6 +269,8 @@
           },
           //传感器数据
           sensorList:[],
+          //硬件数据
+          hardwareList:[],
         }
       },
       created() {
@@ -311,6 +314,9 @@
           iotSensorFindBySubId({subId:this.subjectData.subId}).then(response => {
             this.$set(this,'sensorList',response.data);
           })
+          iotHardwareFindBySubId({subId:this.subjectData.subId}).then(response => {
+            this.$set(this,'hardwareList',response.data);
+          })
         },
         //播放文字
         handleAdd() {
@@ -384,7 +390,7 @@
 </script>
 
 <style lang="scss" scoped>
-  .infoPage{
+  .subject-infoPage{
     flex:1;
     display: flex;
     overflow: hidden;
@@ -691,3 +697,64 @@
     }
   }
 </style>
+<style lang="scss">
+  .subject-infoPage{
+    .el-switch{
+      display: block;
+      width:50px!important;
+      height:20px!important;
+      margin-top: 5px!important;
+    }
+    .switch .el-switch__label {
+      position: absolute;
+      display: none;
+      color: #fff !important;
+    }
+    .switch .el-switch__label.is-active {
+      display: block;
+    }
+    .switch.el-switch .el-switch__core,
+    .el-switch .el-switch__label {
+      width: 50px !important;
+      height:20px!important;
+      line-height:20px!important;
+      -webkit-border-radius: 20px!important;
+      -moz-border-radius: 20px!important;
+      border-radius: 20px!important;
+      margin: 0;
+      position: absolute;
+      top: 0;
+    }
+    .switch .el-switch__label--left {
+      z-index: 1;
+    }
+    .switch .el-switch__label--left span{
+      margin-left:19px;
+      font-size: 12px;
+      color:#fff;
+    }
+    .switch .el-switch__label--right {
+      z-index: 1;
+    }
+    .switch .el-switch__label--right span{
+      margin-left:6px;
+      font-size: 12px;
+      color:#fff;
+    }
+    .el-switch__core{
+      background-color: #999;
+    }
+    .el-switch__core:after{
+      height:14px!important;
+      width:14px!important;
+      top:2px!important;
+      left:2px;
+    }
+    .el-switch.is-checked .el-switch__core{
+      background-color: #1890ff;
+    }
+    .el-switch.is-checked .el-switch__core::after{
+      margin-left: -16px!important;
+    }
+  }
+</style>

+ 0 - 1
src/views/iotDevice/intelligenceIot/iotHardware/bottomModule/hardwareLog.vue

@@ -103,7 +103,6 @@
       },
       //重置按钮
       resetQuery(){
-        this.$set(this,'dateRange',[])
         this.$set(this,'queryParams',{
           page:1,
           pageSize:10,

+ 36 - 37
src/views/iotDevice/intelligenceIot/iotHardware/bottomModule/hardwareReportedData.vue

@@ -4,21 +4,24 @@
       <div class="page-form-title-box">
         <el-form :model="queryParams" class="form-box" ref="queryForm"
                  :inline="true" style="width:100%;">
-          <el-form-item label="" prop="logType">
-            <el-select v-model="queryParams.logType" clearable placeholder="请选择类型" style="width: 200px">
-              <el-option
-                v-for="dict in optionList"
-                :key="dict.code"
-                :label="dict.name"
-                :value="dict.code"
-              />
+          <el-form-item label="" prop="dataType">
+            <el-select v-model="queryParams.dataType" clearable placeholder="请选择状态" style="width: 200px">
+              <el-option label="正常数据" :value="1"/>
+              <el-option label="风险数据" :value="2"/>
             </el-select>
           </el-form-item>
-          <el-form-item label="" prop="state">
-            <el-select v-model="queryParams.state" clearable placeholder="请选择状态" style="width: 200px">
-              <el-option label="成功" :value="true"/>
-              <el-option label="失败" :value="false"/>
-            </el-select>
+          <el-form-item label="" prop="dateRange">
+            <el-date-picker
+              :clearable="false"
+              v-model="dateRange"
+              size="small"
+              style="width: 240px"
+              value-format="yyyy-MM-dd"
+              type="daterange"
+              range-separator="-"
+              start-placeholder="上报时间"
+              end-placeholder="上报时间"
+            ></el-date-picker>
           </el-form-item>
           <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
           <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
@@ -26,20 +29,17 @@
       </div>
       <div class="page-content-box">
         <el-table class="table-box" border :data="dataList">
-          <el-table-column label="类型" prop="logTypeName" width="160"  show-overflow-tooltip/>
-          <el-table-column label="请求" prop="reqBody" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <span class="clickCopy" @click="clickCopy(scope.row.reqBody)">{{scope.row.reqBody}}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="响应" prop="respBody" show-overflow-tooltip>
+          <el-table-column label="名称" prop="deviceName" width="240"  show-overflow-tooltip/>
+          <el-table-column label="编号" prop="deviceNo" width="240" show-overflow-tooltip/>
+          <el-table-column label="数值" prop="deviceValue" show-overflow-tooltip/>
+          <el-table-column label="在线/离线"  prop="online" width="200" show-overflow-tooltip>
             <template slot-scope="scope">
-              <span class="clickCopy" @click="clickCopy(scope.row.respBody)">{{scope.row.respBody}}</span>
+              <span>{{scope.row.online?'在线':'离线'}}</span>
             </template>
           </el-table-column>
-          <el-table-column label="状态"  prop="state" width="100" show-overflow-tooltip>
+          <el-table-column label="状态"  prop="dataType" width="200" show-overflow-tooltip>
             <template slot-scope="scope">
-              <span>{{scope.row.state?'成功':'失败'}}</span>
+              <span>{{scope.row.dataType == 1 ?'正常数据':'风险数据'}}</span>
             </template>
           </el-table-column>
           <el-table-column label="时间" prop="createTime" width="200" show-overflow-tooltip>
@@ -47,7 +47,6 @@
               <span>{{ parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="备注" prop="remark" width="200" show-overflow-tooltip/>
         </el-table>
         <pagination :page-sizes="[10, 20, 30, 40]"
                     v-show="total>0"
@@ -62,19 +61,19 @@
 </template>
 
 <script>
-  import { iotDeviceLogType,iotDeviceLogList } from "@/api/iotDevice/index";
+  import { iotDeviceDataList } from "@/api/iotDevice/index";
   export default {
     name: 'hardwareReportedData',
     data(){
       return{
         //类型下拉列表数据
         optionList:[],
+        dateRange:[],
         //查询条件
         queryParams:{
           page:1,
           pageSize:10,
-          logType:null,
-          state:null,
+          dataType:null,
         },
         dataList:[],
         total:0,
@@ -88,14 +87,8 @@
     },
     methods:{
       initialize(){
-        this.iotDeviceLogType();
         this.getList();
       },
-      iotDeviceLogType(){
-        iotDeviceLogType({}).then(response =>{
-          this.$set(this,'optionList',response.data);
-        })
-      },
       //查询按钮
       handleQuery(){
         this.$set(this.queryParams,'page',1);
@@ -107,15 +100,21 @@
         this.$set(this,'queryParams',{
           page:1,
           pageSize:10,
-          logType:null,
-          state:null,
+          dataType:null,
         });
         this.getList();
       },
       getList(){
         let obj = JSON.parse(JSON.stringify(this.queryParams))
-        obj.deviceId = this.$parent.propsData.id;
-        iotDeviceLogList(obj).then(response =>{
+        if(this.dateRange[0]){
+          obj.startTime = this.dateRange[0]+'T00:00:00'
+          obj.endTime = this.dateRange[1]+'T23:59:59'
+        }else{
+          obj.startTime = "";
+          obj.endTime = "";
+        }
+        obj.deviceNo = this.$parent.propsData.deviceNo;
+        iotDeviceDataList(obj).then(response =>{
           this.$set(this,'dataList',response.data.records);
           this.$set(this,'total',response.data.total);
         })

+ 1 - 1
src/views/iotDevice/intelligenceIot/iotHardware/index.vue

@@ -88,7 +88,7 @@
           <el-table-column label="设备类型" prop="typeName" width="120" show-overflow-tooltip/>
           <!--<el-table-column label="网关" align="left" prop="gatewayNo" width="140" show-overflow-tooltip/>-->
           <el-table-column label="位置" width="300" show-overflow-tooltip>
-            <template slot-scope="scope">{{scope.row.collegeName}}{{scope.row.buildName}}{{scope.row.floorName}}{{scope.row.subjectName}}{{scope.row.room}}</template>
+            <template slot-scope="scope">{{scope.row.collegeName}} {{scope.row.buildName}} {{scope.row.floorName}} {{scope.row.subjectName}} {{scope.row.room}}</template>
           </el-table-column>
           <el-table-column label="是否在线" align="left" prop="online" width="100" show-overflow-tooltip>
             <template slot-scope="scope">{{scope.row.online?'在线':'离线'}}</template>