Commit ab456ed2 by YG8999

设备日志信息完善

parent e5e24a7c
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="设备mac" prop="devMac"> <!-- <el-form-item label="设备mac" prop="devMac">-->
<el-input <!-- <el-input-->
v-model="queryParams.devMac" <!-- v-model="queryParams.devMac"-->
placeholder="请输入设备mac" <!-- placeholder="请输入设备mac"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="设备id" prop="devId"> <el-form-item label="设备id" prop="devId">
<el-input <el-input
v-model="queryParams.devId" v-model="queryParams.devId"
...@@ -96,15 +96,17 @@ ...@@ -96,15 +96,17 @@
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />--> <!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="主键" align="center" prop="id" />--> <!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="设备mac" align="center" prop="devMac" /> <!-- <el-table-column label="设备mac" align="center" prop="devMac" />-->
<el-table-column label="设备id" align="center" prop="devId" /> <el-table-column label="设备id" align="center" prop="devId" />
<el-table-column label="请求的序列号" align="center" prop="seq" /> <el-table-column label="门店名称" align="center" prop="storeName" />
<el-table-column label="消息类型" align="center" prop="mqttType" /> <el-table-column label="房间名称" align="center" prop="roomName" />
<el-table-column label="请求序列号" align="center" prop="seq" width="180"/>
<el-table-column label="消息类型" align="center" prop="mqttType" :formatter="(row) => filedFormatter(row.mqttType)"/>
<el-table-column label="消息描述" align="center" prop="mqttDescribe" /> <el-table-column label="消息描述" align="center" prop="mqttDescribe" />
<!-- <el-table-column label="消息主体参数" align="center" prop="payload" />--> <!-- <el-table-column label="消息主体参数" align="center" prop="payload" />-->
<el-table-column label="消息主题" align="center" prop="topic" /> <el-table-column label="消息主题" align="center" prop="topic" width="180"/>
<el-table-column label="操作人" align="center" prop="createBy" /> <el-table-column label="操作人" align="center" prop="createBy" />
<el-table-column label="记录时间" align="center" prop="createTime" > <el-table-column label="记录时间" align="center" prop="createTime" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
...@@ -137,21 +139,45 @@ ...@@ -137,21 +139,45 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改设备操作日志对话框 --> <!-- 查看设备操作日志对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body> <el-dialog :title="title" :visible.sync="open" width="55%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="设备mac" prop="devMac"> <el-row :gutter="20">
<el-input v-model="form.devMac" placeholder="请输入设备mac" /> <el-col :span="12">
</el-form-item> <el-form-item label="设备mac" prop="devMac">
<el-form-item label="设备id" prop="devId"> <el-input v-model="form.devMac" placeholder="请输入设备mac" />
<el-input v-model="form.devId" placeholder="请输入设备id" /> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="请求的序列号" prop="seq"> <el-col :span="12">
<el-input v-model="form.seq" placeholder="请输入请求的序列号" /> <el-form-item label="设备id" prop="devId">
</el-form-item> <el-input v-model="form.devId" placeholder="请输入设备id" />
<el-form-item label="消息描述" prop="mqttDescribe"> </el-form-item>
<el-input v-model="form.mqttDescribe" /> </el-col>
</el-form-item> </el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="操作人" prop="createBy">
<el-input v-model="form.createBy" placeholder="操作人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作时间" prop="createTime">
<el-input v-model="form.createTime" placeholder="操作时间" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="请求的序列号" prop="seq">
<el-input v-model="form.seq" placeholder="请输入请求的序列号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="消息描述" prop="mqttDescribe">
<el-input v-model="form.mqttDescribe" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="消息参数" prop="payload"> <el-form-item label="消息参数" prop="payload">
<el-input v-model="form.payload" type="textarea" :rows="5" /> <el-input v-model="form.payload" type="textarea" :rows="5" />
</el-form-item> </el-form-item>
...@@ -170,7 +196,7 @@ ...@@ -170,7 +196,7 @@
</template> </template>
<script> <script>
import { listLog, getLog, delLog, addLog, updateLog } from "@/api/system/log"; import { listLog, getLog, delLog } from "@/api/system/log";
export default { export default {
name: "Log", name: "Log",
...@@ -210,6 +236,10 @@ export default { ...@@ -210,6 +236,10 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
},
mqttTypeOptions: {
'1': '下发',
'2': '上报'
} }
}; };
}, },
...@@ -317,6 +347,9 @@ export default { ...@@ -317,6 +347,9 @@ export default {
this.download('system/log/export', { this.download('system/log/export', {
...this.queryParams ...this.queryParams
}, `log_${new Date().getTime()}.xlsx`) }, `log_${new Date().getTime()}.xlsx`)
},
filedFormatter(value) {
return this.mqttTypeOptions[value];
} }
} }
}; };
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-form-item label="设备id" prop="devId"> <el-form-item label="设备id" prop="devId">
<el-input <el-input
v-model="queryParams.devId" v-model="queryParams.devId"
placeholder="请输入设备id" placeholder="请输入设备ID"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
...@@ -12,14 +12,22 @@ ...@@ -12,14 +12,22 @@
<el-form-item label="是否异常" prop="isAbnormal"> <el-form-item label="是否异常" prop="isAbnormal">
<el-select v-model="queryParams.isAbnormal" placeholder="请选择"> <el-select v-model="queryParams.isAbnormal" placeholder="请选择">
<el-option lable="是" :value="1"></el-option> <el-option
<el-option lable="否" :value="0"></el-option> v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否发送短信" prop="isSendSms"> <el-form-item label="是否发送短信" prop="isSendSms">
<el-select v-model="queryParams.isSendSms" placeholder="请选择"> <el-select v-model="queryParams.isSendSms" placeholder="请选择">
<el-option lable="是" :value="1"></el-option> <el-option
<el-option lable="否" :value="0"></el-option> v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -34,7 +42,7 @@ ...@@ -34,7 +42,7 @@
<el-table v-loading="loading" :data="logList" > <el-table v-loading="loading" :data="logList" >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="设备id" align="center" prop="devId" /> <el-table-column label="设备ID" align="center" prop="devId" />
<el-table-column label="设备mac" align="center" prop="devMac" /> <el-table-column label="设备mac" align="center" prop="devMac" />
<el-table-column label="是否异常变更" align="center" prop="isAbnormal" :formatter="(row) => filedFormatter(row.isAbnormal)"/> <el-table-column label="是否异常变更" align="center" prop="isAbnormal" :formatter="(row) => filedFormatter(row.isAbnormal)"/>
<el-table-column label="变更前状态" align="center" prop="previousStatus" > <el-table-column label="变更前状态" align="center" prop="previousStatus" >
...@@ -47,12 +55,24 @@ ...@@ -47,12 +55,24 @@
<dict-tag :options="dict.type.device_status" :value="scope.row.status"/> <dict-tag :options="dict.type.device_status" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="房间ID" align="center" prop="roomId" /> <el-table-column label="门店名称" align="center" prop="storeName" />
<el-table-column label="电量、电压" align="center" prop="voltage" /> <el-table-column label="房间名称" align="center" prop="roomName" />
<el-table-column label="电量\电压" align="center" prop="voltage" />
<el-table-column label="信号值" align="center" prop="signalValue" /> <el-table-column label="信号值" align="center" prop="signalValue" />
<!-- <el-table-column label="备注" align="center" prop="remark" />--> <!-- <el-table-column label="备注" align="center" prop="remark" />-->
<el-table-column label="变更操作记录id" align="center" prop="operateLogId" /> <el-table-column label="操作记录" align="center" prop="operateLogId" >
<el-table-column label="是否已发送短信" align="center" prop="isSendSms" :formatter="(row) => filedFormatter(row.isSendSms)"/> <template slot-scope="scope" v-if="scope.row.operateLogId">
<el-button type="primary" size="mini" @click="handleQueryOperateLog(scope.row)" plain>
{{scope.row.operateLogId}}
</el-button>
</template>
</el-table-column>
<el-table-column label="是否发送短信" align="center" prop="isSendSms" :formatter="(row) => filedFormatter(row.isSendSms)"/>
<el-table-column label="记录时间" align="center" prop="createTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
...@@ -63,11 +83,66 @@ ...@@ -63,11 +83,66 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 查看设备操作日志对话框 -->
<el-dialog :title="title" :visible.sync="open" width="55%" append-to-body>
<el-form ref="form" :model="operateLogForm" :rules="rules" label-width="110px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备mac" prop="devMac">
<el-input v-model="operateLogForm.devMac" placeholder="请输入设备mac" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备id" prop="devId">
<el-input v-model="operateLogForm.devId" placeholder="请输入设备id" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="操作人" prop="createBy">
<el-input v-model="operateLogForm.createBy" placeholder="操作人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作时间" prop="createTime">
<el-input v-model="operateLogForm.createTime" placeholder="操作时间" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="请求的序列号" prop="seq">
<el-input v-model="operateLogForm.seq" placeholder="请输入请求的序列号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="消息描述" prop="mqttDescribe">
<el-input v-model="operateLogForm.mqttDescribe" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="消息参数" prop="payload">
<el-input v-model="operateLogForm.payload" type="textarea" :rows="5" />
</el-form-item>
<el-form-item label="消息主题" prop="topic">
<el-input v-model="operateLogForm.topic" placeholder="请输入消息主题" />
</el-form-item>
<el-form-item label="回复信息" prop="remark">
<el-input v-model="operateLogForm.remark" type="textarea" :rows="5" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listLog } from "@/api/system/statusLog"; import { listLog } from "@/api/system/statusLog";
import { getLog } from "@/api/system/log";
export default { export default {
name: "sLog", name: "sLog",
...@@ -106,9 +181,17 @@ export default { ...@@ -106,9 +181,17 @@ export default {
}, },
// 表单参数 // 表单参数
form: {}, form: {},
operateLogForm: {},
// 表单校验 // 表单校验
rules: { rules: {
} },
options: [{
value: '1',
label: '是'
}, {
value: '0',
label: '否'
}]
}; };
}, },
created() { created() {
...@@ -149,6 +232,25 @@ export default { ...@@ -149,6 +232,25 @@ export default {
}; };
this.resetForm("form"); this.resetForm("form");
}, },
// 表单重置
resetOperateLog() {
this.operateLogForm = {
id: null,
devMac: null,
devId: null,
seq: null,
mqttType: null,
mqttDescribe: null,
payload: null,
topic: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("operateLogForm");
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
...@@ -161,6 +263,15 @@ export default { ...@@ -161,6 +263,15 @@ export default {
}, },
filedFormatter(value) { filedFormatter(value) {
return value === 1 ? '是' : '否'; return value === 1 ? '是' : '否';
},
handleQueryOperateLog(row) {
this.resetOperateLog();
const id = row.operateLogId;
getLog(id).then(response => {
this.operateLogForm = response.data;
this.open = true;
this.title = "设备操作日志";
});
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment