add: 日志管理、mes测试接口、多数据源
This commit is contained in:
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
export function getLogData(param) {
|
||||
return request({
|
||||
url: 'api/lucene/getAll',
|
||||
method: 'get',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,102 +1,141 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<Search />
|
||||
<crudOperation />
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="日志级别">
|
||||
<el-select
|
||||
v-model="query.level"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="日志级别"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in levelOptions"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模糊搜索">
|
||||
<el-input
|
||||
v-model="query.message"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="日志内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="链路ID">
|
||||
<el-input
|
||||
v-model="query.tlogTraceId"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入链路ID"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="mini" @click="queryData">
|
||||
查询
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55"/>-->
|
||||
<!-- <el-table-column v-if="false" prop="id" label="id"/>-->
|
||||
<el-table-column prop="operate" width="50" label="操作" />
|
||||
<el-table-column prop="device_code" label="设备号" />
|
||||
<el-table-column prop="task_code" label="任务编号" />
|
||||
<el-table-column prop="instruct_code" label="指令编号" />
|
||||
<el-table-column prop="method" label="方法" />
|
||||
<el-table-column prop="status_code" label="状态码" />
|
||||
<el-table-column prop="requestparam" label="请求参数" />
|
||||
<el-table-column prop="responseparam" label="返回参数" />
|
||||
<el-table-column prop="logTime" width="170" label="记录时间" />
|
||||
<el-table-column prop="content" width="500" label="内容详情" />
|
||||
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<el-card shadow="hover" style="width: 100%" class="log-warpper">
|
||||
<div style="width: 100%">
|
||||
<div v-for="(log, index) in logs" :key="index">
|
||||
<div style="margin-bottom: 5px; font-size: 14px;" v-html="log" />
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
:page-sizes="[100, 500, 1000]"
|
||||
:page-size.sync="query.size"
|
||||
:total="query.total"
|
||||
:current-page.sync="query.page"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Search from './search.vue'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
import luceneOperation from '@/views/lucene/api/lucene'
|
||||
import { default as AnsiUp } from 'ansi_up'
|
||||
export default {
|
||||
name: 'LuceneLog',
|
||||
components: { Search, pagination, crudOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds: function() {
|
||||
return CRUD({
|
||||
title: '系统参数', url: 'api/lucene/getAll', idField: 'id', sort: 'id,desc',
|
||||
queryOnPresenterCreated: true,
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false
|
||||
},
|
||||
page: {
|
||||
size: 40,
|
||||
total: 0,
|
||||
page: 0
|
||||
},
|
||||
query: {
|
||||
createTime: [new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24)), new Date()]
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
query: { blurry: '123' },
|
||||
permission: {
|
||||
add: ['admin', 'param:add'],
|
||||
edit: ['admin', 'param:edit'],
|
||||
del: ['admin', 'param:del']
|
||||
},
|
||||
|
||||
rules: {}
|
||||
levelOptions: [{
|
||||
value: 'DEBUG',
|
||||
label: 'DEBUG'
|
||||
}, {
|
||||
value: 'INFO',
|
||||
label: 'INFO'
|
||||
}, {
|
||||
value: 'ERROR',
|
||||
label: 'ERROR'
|
||||
}, {
|
||||
value: 'WARN',
|
||||
label: 'WARN'
|
||||
}],
|
||||
rules: {},
|
||||
logs: [],
|
||||
query: {
|
||||
tlogTraceId: '',
|
||||
message: '',
|
||||
page: 0,
|
||||
size: 100,
|
||||
total: 0,
|
||||
createTime: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.queryData()
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
handleSizeChange(val) {
|
||||
this.query.size = val
|
||||
this.queryData()
|
||||
},
|
||||
confirmDelAll() {
|
||||
this.$confirm(`确认清空所有操作日志吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.crud.delAllLoading = true
|
||||
delAll('device_execute').then(res => {
|
||||
this.crud.delAllLoading = false
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.delSuccessNotify()
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
this.crud.delAllLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}).catch(() => {
|
||||
handleCurrentChange(val) {
|
||||
this.query.page = val
|
||||
this.queryData()
|
||||
},
|
||||
queryData() {
|
||||
luceneOperation.getLogData(this.query).then(res => {
|
||||
this.logs = [] // 清空
|
||||
var ansi_up = new AnsiUp()
|
||||
// 数据初始化
|
||||
for (const i in res.content) {
|
||||
this.logs[i] = ansi_up.ansi_to_html(res.content[i])
|
||||
}
|
||||
// this.logs = res.content
|
||||
this.query.total = res.totalElements
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user