Commit ab456ed2 by YG8999

设备日志信息完善

parent e5e24a7c
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="设备mac" prop="devMac">
<el-input
v-model="queryParams.devMac"
placeholder="请输入设备mac"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="设备mac" prop="devMac">-->
<!-- <el-input-->
<!-- v-model="queryParams.devMac"-->
<!-- placeholder="请输入设备mac"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="设备id" prop="devId">
<el-input
v-model="queryParams.devId"
......@@ -96,15 +96,17 @@
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <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="请求的序列号" align="center" prop="seq" />
<el-table-column label="消息类型" align="center" prop="mqttType" />
<el-table-column label="门店名称" align="center" prop="storeName" />
<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="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="createTime" >
<el-table-column label="记录时间" align="center" prop="createTime" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
......@@ -137,21 +139,45 @@
@pagination="getList"
/>
<!-- 添加或修改设备操作日志对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<!-- 查看设备操作日志对话框 -->
<el-dialog :title="title" :visible.sync="open" width="55%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备mac" prop="devMac">
<el-input v-model="form.devMac" placeholder="请输入设备mac" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备id" prop="devId">
<el-input v-model="form.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="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-input v-model="form.payload" type="textarea" :rows="5" />
</el-form-item>
......@@ -170,7 +196,7 @@
</template>
<script>
import { listLog, getLog, delLog, addLog, updateLog } from "@/api/system/log";
import { listLog, getLog, delLog } from "@/api/system/log";
export default {
name: "Log",
......@@ -210,6 +236,10 @@ export default {
form: {},
// 表单校验
rules: {
},
mqttTypeOptions: {
'1': '下发',
'2': '上报'
}
};
},
......@@ -317,6 +347,9 @@ export default {
this.download('system/log/export', {
...this.queryParams
}, `log_${new Date().getTime()}.xlsx`)
},
filedFormatter(value) {
return this.mqttTypeOptions[value];
}
}
};
......
......@@ -4,7 +4,7 @@
<el-form-item label="设备id" prop="devId">
<el-input
v-model="queryParams.devId"
placeholder="请输入设备id"
placeholder="请输入设备ID"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -12,14 +12,22 @@
<el-form-item label="是否异常" prop="isAbnormal">
<el-select v-model="queryParams.isAbnormal" placeholder="请选择">
<el-option lable="是" :value="1"></el-option>
<el-option lable="否" :value="0"></el-option>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否发送短信" prop="isSendSms">
<el-select v-model="queryParams.isSendSms" placeholder="请选择">
<el-option lable="是" :value="1"></el-option>
<el-option lable="否" :value="0"></el-option>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -34,7 +42,7 @@
<el-table v-loading="loading" :data="logList" >
<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="是否异常变更" align="center" prop="isAbnormal" :formatter="(row) => filedFormatter(row.isAbnormal)"/>
<el-table-column label="变更前状态" align="center" prop="previousStatus" >
......@@ -47,12 +55,24 @@
<dict-tag :options="dict.type.device_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="房间ID" align="center" prop="roomId" />
<el-table-column label="电量、电压" align="center" prop="voltage" />
<el-table-column label="门店名称" align="center" prop="storeName" />
<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="remark" />-->
<el-table-column label="变更操作记录id" align="center" prop="operateLogId" />
<el-table-column label="是否已发送短信" align="center" prop="isSendSms" :formatter="(row) => filedFormatter(row.isSendSms)"/>
<el-table-column label="操作记录" align="center" prop="operateLogId" >
<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>
<pagination
......@@ -63,11 +83,66 @@
@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>
</template>
<script>
import { listLog } from "@/api/system/statusLog";
import { getLog } from "@/api/system/log";
export default {
name: "sLog",
......@@ -106,9 +181,17 @@ export default {
},
// 表单参数
form: {},
operateLogForm: {},
// 表单校验
rules: {
}
},
options: [{
value: '1',
label: '是'
}, {
value: '0',
label: '否'
}]
};
},
created() {
......@@ -149,6 +232,25 @@ export default {
};
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() {
this.queryParams.pageNum = 1;
......@@ -161,6 +263,15 @@ export default {
},
filedFormatter(value) {
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