Commit 4088de28 by YG8999

设备状态变更记录

parent c4f8720e
import request from '@/utils/request'
// 查询设备状态变更记录列表
export function listLog(query) {
return request({
url: '/system/statusLog/list',
method: 'get',
params: query
})
}
// 查询设备状态变更记录详细
export function getLog(id) {
return request({
url: '/system/statusLog/' + id,
method: 'get'
})
}
// 新增设备状态变更记录
export function addLog(data) {
return request({
url: '/system/statusLog',
method: 'post',
data: data
})
}
// 修改设备状态变更记录
export function updateLog(data) {
return request({
url: '/system/statusLog',
method: 'put',
data: data
})
}
// 删除设备状态变更记录
export function delLog(id) {
return request({
url: '/system/statusLog/' + id,
method: 'delete'
})
}
......@@ -103,6 +103,7 @@
<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="createBy" />
<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>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="设备id" prop="devId">
<el-input
v-model="queryParams.devId"
placeholder="请输入设备id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<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-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-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<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="设备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" >
<template slot-scope="scope">
<dict-tag :options="dict.type.device_status" :value="scope.row.previousStatus"/>
</template>
</el-table-column>
<el-table-column label="变更后状态" align="center" prop="status" >
<template slot-scope="scope">
<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="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>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listLog } from "@/api/system/statusLog";
export default {
name: "sLog",
dicts: ['device_status'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 设备状态变更记录表格数据
logList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
devId: null,
devMac: null,
isAbnormal: null,
status: null,
roomId: null,
operateLogId: null,
isSendSms: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询设备状态变更记录列表 */
getList() {
this.loading = true;
listLog(this.queryParams).then(response => {
this.logList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
devId: null,
devMac: null,
isAbnormal: null,
status: null,
roomId: null,
voltage: null,
signalValue: null,
createTime: null,
updateTime: null,
remark: null,
operateLogId: null,
isSendSms: null,
previousStatus: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
filedFormatter(value) {
return value === 1 ? '是' : '否';
}
}
};
</script>
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