dedsudiyu 1 year ago
parent
commit
f8b1c6f55c

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

@@ -568,7 +568,22 @@ export function iotDeviceFindByType(data) {
     data: data
   })
 }
-
+//硬件设备-查询设备日志类型
+export function iotDeviceLogType(query) {
+  return request({
+    url: '/iot/device/log/type',
+    method: 'get',
+    params: query
+  })
+}
+//硬件设备-根据设备ID查询设备日志
+export function iotDeviceLogList(data) {
+  return request({
+    url: '/iot/device/log/list',
+    method: 'post',
+    data: data
+  })
+}
 /***********接收人*************/
 
 //获取接收人-列表

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

@@ -0,0 +1,126 @@
+<template>
+  <div class="page-container iotHardware-hardwareLog">
+    <div class="page-container iotHardwarePage">
+      <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-select>
+          </el-form-item>
+          <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
+          <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
+        </el-form>
+      </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">
+              <p class="clickCopy" @click="clickCopy(scope.row.reqBody)">{{scope.row.reqBody}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="响应" prop="respBody" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <p class="clickCopy" @click="clickCopy(scope.row.respBody)">{{scope.row.respBody}}</p>
+            </template>
+          </el-table-column>
+          <el-table-column label="状态"  prop="state" width="100" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{scope.row.state?'成功':'失败'}}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="时间" prop="createTime" width="200" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <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"
+                    :total="total"
+                    :page.sync="queryParams.page"
+                    :limit.sync="queryParams.pageSize"
+                    @pagination="getList"
+        />
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import { iotDeviceLogType,iotDeviceLogList } from "@/api/iotDevice/index";
+  export default {
+    name: 'hardwareLog',
+    props:{
+      hardwareLogPropsData:{},
+    },
+    data(){
+      return{
+        //类型下拉列表数据
+        optionList:[],
+        //查询条件
+        queryParams:{
+          page:1,
+          pageSize:10,
+          logType:null,
+        },
+        dataList:[],
+        total:0,
+      }
+    },
+    created(){
+
+    },
+    mounted(){
+      this.initialize();
+    },
+    methods:{
+      initialize(){
+        this.iotDeviceLogType();
+        this.getList();
+      },
+      iotDeviceLogType(){
+        iotDeviceLogType({}).then(response =>{
+          this.$set(this,'optionList',response.data);
+        })
+      },
+      //查询按钮
+      handleQuery(){
+        this.$set(this.queryParams,'page',1);
+        this.getList();
+      },
+      //重置按钮
+      resetQuery(){
+        this.$set(this,'dateRange',[])
+        this.$set(this,'queryParams',{
+          page:1,
+          pageSize:10,
+          logType:null,
+        });
+        this.getList();
+      },
+      getList(){
+        let obj = JSON.parse(JSON.stringify(this.queryParams))
+        obj.deviceId = this.hardwareLogPropsData.id;
+        iotDeviceLogList(obj).then(response =>{
+          this.$set(this,'dataList',response.data.records);
+          this.$set(this,'total',response.data.total);
+        })
+      },
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+  .iotHardware-hardwareLog{
+    overflow: hidden;
+  }
+</style>

+ 12 - 6
src/views/iotDevice/intelligenceIot/iotHardware/infoPage.vue

@@ -67,7 +67,7 @@
           <p></p>
         </div>
         <div class="table-button-box" @click="tableCheck(2)" :class="tableType==2?'check-table-box':''">
-          <p>运行记录</p>
+          <p>设备日志</p>
           <p></p>
         </div>
         <div class="table-button-box" @click="tableCheck(3)" :class="tableType==3?'check-table-box':''">
@@ -83,7 +83,7 @@
 
       </div>
       <div class="table-content-box" v-if="tableType == 2">
-
+        <hardware-log :hardwareLogPropsData="newData"></hardware-log>
       </div>
       <div class="table-content-box" v-if="tableType == 3">
 
@@ -93,12 +93,13 @@
 </template>
 
 <script>
-  //import { getDicts } from "@/api/commonality/noPermission";
-  //import { systemUserSelect } from "@/api/commonality/permission";
-  //import { getInfo } from "@/api/basicsModules/index";
+  import hardwareLog from "./hardwareLog.vue";
   import { iotTypeGetAllTypes,iotTypeGetParamByTypeId } from "@/api/iotDevice/index";
   export default {
     name: 'addPage',
+    components: {
+      hardwareLog,
+    },
     props:{
       propsData:{},
     },
@@ -107,6 +108,8 @@
         tableType:1,
         newData:{},
         models:[],
+        //设备日志组件传参
+        hardwareLogPropsData:{},
       }
     },
     created(){
@@ -314,7 +317,10 @@
         }
       }
       .table-content-box{
-
+        flex:1;
+        flex-direction: column;
+        display: flex;
+        overflow: hidden;
       }
     }
   }