在线日志

This commit is contained in:
邱贞招 2024-07-15 10:16:09 +08:00
parent b5e92e4e4f
commit bda10f0ff1
7 changed files with 396 additions and 89 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询在线/离线日志列表
export function listOnlineLog(query) {
return request({
url: '/system/onlineLog/list',
method: 'get',
params: query
})
}
// 查询在线/离线日志详细
export function getOnlineLog(id) {
return request({
url: '/system/onlineLog/' + id,
method: 'get'
})
}
// 新增在线/离线日志
export function addOnlineLog(data) {
return request({
url: '/system/onlineLog',
method: 'post',
data: data
})
}
// 修改在线/离线日志
export function updateOnlineLog(data) {
return request({
url: '/system/onlineLog',
method: 'put',
data: data
})
}
// 删除在线/离线日志
export function delOnlineLog(id) {
return request({
url: '/system/onlineLog/' + id,
method: 'delete'
})
}

View File

@ -232,6 +232,34 @@ export const dynamicRoutes = [
}
]
},
{
path: '/system/commandLog',
component: Layout,
hidden: true,
permissions: ['system:commandLog:query'],
children: [
{
path: 'index/:sn',
component: () => import('@/views/system/commandLog'),
name: 'Data',
meta: { title: '命令日志', activeMenu: '/system/commandLog' }
}
]
},
{
path: '/system/commandLog/orderNo',
component: Layout,
hidden: true,
permissions: ['system:commandLog:query'],
children: [
{
path: 'index/:orderNo',
component: () => import('@/views/system/commandLog'),
name: 'Data',
meta: { title: '命令日志', activeMenu: '/system/commandLog' }
}
]
},
{
path: '/tool/gen-edit',
component: Layout,

View File

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="操作地址" prop="operIp">
<el-form-item label="请求参数" prop="operParam">
<el-input
v-model="queryParams.operIp"
placeholder="请输入操作地址"
v-model="queryParams.operParam"
placeholder="请输入请求参数"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
@ -115,6 +115,7 @@
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="日志编号" align="center" prop="operId" />
<el-table-column label="系统模块" align="center" prop="title" :show-overflow-tooltip="true" />
<el-table-column label="请求参数" align="center" prop="operParam" :show-overflow-tooltip="true" />
<el-table-column label="操作类型" align="center" prop="businessType">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_oper_type" :value="scope.row.businessType"/>

View File

@ -33,90 +33,62 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="回调状态" prop="callStatus">
<el-select v-model="queryParams.callStatus" placeholder="请选择回调状态" clearable>
<el-option
v-for="dict in dict.type.onenet_call_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="订单号" prop="orderNo">
<el-input
v-model="queryParams.orderNo"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</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">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:commandLog:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:commandLog:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:commandLog:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:commandLog:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="commandLogList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="请求url" align="center" prop="url" />
<el-table-column label="请求url" align="center" prop="url" :show-overflow-tooltip="true"/>
<el-table-column label="命令" align="center" prop="command" />
<el-table-column label="类型" align="center" prop="type" />
<el-table-column label="mac" align="center" prop="mac" />
<el-table-column label="sn" align="center" prop="sn" />
<el-table-column label="响应" align="center" prop="result" />
<el-table-column label="订单号" align="center" prop="orderNo" :show-overflow-tooltip="true"/>
<el-table-column label="响应" align="center" prop="result" :show-overflow-tooltip="true"/>
<el-table-column label="回调状态" align="center" prop="callStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.onenet_call_status" :value="scope.row.callStatus"/>
</template>
</el-table-column>
<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-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:commandLog:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['system:commandLog:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row,scope.index)"
v-hasPermi="['system:commandLog:query']"
>详细</el-button>
</template>
</el-table-column>
</el-table>
<pagination
@ -128,24 +100,37 @@
/>
<!-- 添加或修改命令日志对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="请求url" prop="url">
<el-input v-model="form.url" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="命令" prop="command">
<el-input v-model="form.command" placeholder="请输入命令" />
</el-form-item>
<el-form-item label="mac" prop="mac">
<el-input v-model="form.mac" placeholder="请输入mac" />
</el-form-item>
<el-form-item label="响应" prop="result">
<el-input v-model="form.result" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-dialog title="命令日志详细" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" label-width="100px">
<el-col :span="24">
<el-form-item label="请求url">{{ form.url }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="命令">{{ form.command }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item style="color: #12d2ac;font-weight: 700" label="类型">{{ form.type }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="MAC">{{ form.mac }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="SN">{{ form.sn }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="响应">{{ form.result }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="回调状态">
<dict-tag :options="dict.type.onenet_call_status" :value="form.callStatus"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="创建时间">{{ parseTime(form.createTime) }}</el-form-item>
</el-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</div>
@ -156,6 +141,7 @@ import { listCommandLog, getCommandLog, delCommandLog, addCommandLog, updateComm
export default {
name: "CommandLog",
dicts: ['onenet_call_status'],
data() {
return {
//
@ -183,6 +169,8 @@ export default {
url: null,
command: null,
mac: null,
sn: null,
orderNo: null,
result: null
},
//
@ -193,6 +181,14 @@ export default {
};
},
created() {
const sn = this.$route.params && this.$route.params.sn;
if (sn != null) {
this.queryParams.sn = sn;
}
const orderNo = this.$route.params && this.$route.params.orderNo;
if (orderNo != null) {
this.queryParams.orderNo = orderNo;
}
this.getList();
},
methods: {
@ -221,6 +217,11 @@ export default {
};
this.resetForm("form");
},
/** 详细按钮操作 */
handleView(row) {
this.open = true;
this.form = row;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;

View File

@ -238,6 +238,13 @@
@click="ring(scope.row)"
v-hasPermi="['system:device:ring']"
>响铃</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-document"
@click="toLog(scope.row)"
v-hasPermi="['system:device:log']"
>日志</el-button>
<el-button
size="mini"
type="text"
@ -794,6 +801,9 @@ export default {
});
});
},
toLog(row){
this.$router.push(`/system/commandLog/index/${row.sn}`);
},
ring(row) {
this.reset();
const deviceId = row.deviceId || this.ids

View File

@ -0,0 +1,218 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="MAC" prop="mac">
<el-input
v-model="queryParams.mac"
placeholder="请输入MAC"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="SN" prop="sn">
<el-input
v-model="queryParams.sn"
placeholder="请输入SN"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="在线状态" prop="onlineStatus">
<el-select v-model="queryParams.onlineStatus" placeholder="请选择在线状态" clearable>
<el-option
v-for="dict in dict.type.as_online_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</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-table v-loading="loading" :data="onlineLogList" @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="mac" />
<el-table-column label="SN" align="center" prop="sn" />
<el-table-column label="在线状态" align="center" prop="onlineStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.as_online_status" :value="scope.row.onlineStatus"/>
</template>
</el-table-column>
<el-table-column label="经度" align="center" prop="longitude" />
<el-table-column label="纬度" align="center" prop="latitude" />
<el-table-column label="记录时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改在线/离线日志对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listOnlineLog, getOnlineLog, delOnlineLog, addOnlineLog, updateOnlineLog } from "@/api/system/onlineLog";
export default {
name: "OnlineLog",
dicts: ['as_online_status'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 线/线
onlineLogList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
mac: null,
sn: null,
onlineStatus: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询在线/离线日志列表 */
getList() {
this.loading = true;
listOnlineLog(this.queryParams).then(response => {
this.onlineLogList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
mac: null,
sn: null,
onlineStatus: null,
longitude: null,
latitude: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加在线/离线日志";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getOnlineLog(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改在线/离线日志";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateOnlineLog(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addOnlineLog(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除在线/离线日志编号为"' + ids + '"的数据项?').then(function() {
return delOnlineLog(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/onlineLog/export', {
...this.queryParams
}, `onlineLog_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -123,11 +123,6 @@
<dict-tag :options="dict.type.et_pay_type" :value="scope.row.payType"/>
</template>
</el-table-column>
<!-- <el-table-column label="类型" align="center" prop="type">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.et_order_type" :value="scope.row.type"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="金额(元)" align="center" prop="totalFee" width="70"/>
<el-table-column label="备注" align="center" prop="mark" />
<el-table-column label="订单时长" align="center" prop="duration" :formatter="formatDuration"/>
@ -174,6 +169,13 @@
@click="returnVehicle(scope.row)"
v-hasPermi="['system:order:edit']"
>辅助还车</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-document"
@click="toLog(scope.row)"
v-hasPermi="['system:order:log']"
>日志</el-button>
</template>
</el-table-column>
</el-table>
@ -456,6 +458,9 @@ export default {
this.getAreaList();
},
methods: {
toLog(row){
this.$router.push(`/system/commandLog/orderNo/index/${row.orderNo}`);
},
getTypeText(type) {
switch (type) {
case '1':