7 changed files with 355 additions and 56 deletions
@ -0,0 +1,32 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function getLogData(param) { |
|||
return request({ |
|||
url: 'api/lucene/getAll', |
|||
method: 'get', |
|||
data: param |
|||
}) |
|||
} |
|||
|
|||
export function labelsValues() { |
|||
return request({ |
|||
url: 'api/loki/labels/values', |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
export function getDeviceLogType() { |
|||
return request({ |
|||
url: 'api/lucene/getDeviceLogType', |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
export function getLogTypes() { |
|||
return request({ |
|||
url: 'api/lucene/getLogTypes', |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
export default { getLogData, labelsValues, getDeviceLogType, getLogTypes } |
@ -0,0 +1,152 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div class="head-container"> |
|||
<Search |
|||
:log-types="logTypes" |
|||
:device-list="deviceList" |
|||
:device-log-types="deviceLogTypes" |
|||
@performSearch="performSearch" |
|||
/> |
|||
<crudOperation /> |
|||
</div> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column |
|||
prop="request_url" |
|||
label="请求路径" |
|||
show-overflow-tooltip |
|||
/> |
|||
<el-table-column |
|||
prop="request_param" |
|||
label="请求参数" |
|||
show-overflow-tooltip |
|||
/> |
|||
<el-table-column |
|||
prop="response_param" |
|||
label="返回参数" |
|||
show-overflow-tooltip |
|||
/> |
|||
<el-table-column |
|||
prop="status_code" |
|||
label="状态码" |
|||
show-overflow-tooltip |
|||
/> |
|||
<el-table-column prop="content" show-overflow-tooltip label="内容详情" /> |
|||
<el-table-column prop="logTime" show-overflow-tooltip label="记录时间" /> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Search from './search' |
|||
import CRUD, { crud, header, presenter } from '@crud/crud' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import { delAll } from '@/api/acs/lucene/log' |
|||
import crudDevice from '@/api/acs/device/device' |
|||
import crudLucene from './api/lucene' |
|||
|
|||
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)), new Date(new Date().setTime(new Date().getTime() + 3600 * 1000))], |
|||
logType: '接口日志' |
|||
} |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
query: { blurry: '123' }, |
|||
permission: { |
|||
add: ['admin', 'param:add'], |
|||
edit: ['admin', 'param:edit'], |
|||
del: ['admin', 'param:del'] |
|||
}, |
|||
deviceList: [], |
|||
deviceLogTypes: [], |
|||
logTypes: [], |
|||
rules: {}, |
|||
logType: '' |
|||
} |
|||
}, |
|||
created() { |
|||
this.getLogTypes() |
|||
this.getDeviceList() |
|||
this.getDeviceLogTypes() |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
}, |
|||
getLogTypes() { |
|||
crudLucene.getLogTypes().then(res => { |
|||
this.logTypes = res |
|||
}) |
|||
}, |
|||
getDeviceLogTypes() { |
|||
crudLucene.getDeviceLogType().then(res => { |
|||
this.deviceLogTypes = res |
|||
}) |
|||
}, |
|||
getDeviceList() { |
|||
crudDevice.selectDeviceList().then(res => { |
|||
this.deviceList = res |
|||
}) |
|||
}, |
|||
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(() => { |
|||
}) |
|||
}, |
|||
performSearch(value) { |
|||
console.log('Search with:' + value) |
|||
this.logType = value |
|||
this.crud.toQuery() |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,101 @@ |
|||
<template> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<el-form :model="query" class="filter-form" inline> |
|||
<el-form-item label="请求路径:"> |
|||
<el-input |
|||
v-model="query.request_url" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入任务号" |
|||
style="width: 200px;" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="内容详情:"> |
|||
<el-input |
|||
v-model="query.blurry" |
|||
clearable |
|||
size="small" |
|||
placeholder="请输入你要搜索的内容详情" |
|||
style="width: 200px;" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="记录时间:"> |
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="datetimerange" |
|||
:picker-options="pickerOptions" |
|||
format="yyyy-MM-dd HH:mm:ss" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
align="right" |
|||
/> |
|||
</el-form-item> |
|||
<rrOperation /> |
|||
</el-form> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { header } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
|
|||
export default { |
|||
components: { rrOperation }, |
|||
mixins: [header()], |
|||
props: { |
|||
deviceList: Array, |
|||
deviceLogTypes: Array |
|||
}, |
|||
data() { |
|||
return { |
|||
pickerOptions: { |
|||
shortcuts: [{ |
|||
text: '最近一周', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近一个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近三个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}] |
|||
}, |
|||
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], |
|||
value2: '' |
|||
} |
|||
}, |
|||
watch: { |
|||
logTypes: { |
|||
immediate: true, |
|||
handler(newVal) { |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
}, |
|||
methods: { |
|||
handleLogTypeChange(value) { |
|||
this.query.logType = value |
|||
this.$emit('performSearch', this.query.logType) |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,64 @@ |
|||
<template> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- |
|||
<date-range-picker v-model="query.createTime" class="date-item" /> |
|||
--> |
|||
|
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="datetimerange" |
|||
:picker-options="pickerOptions" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
align="right" |
|||
/> |
|||
<rrOperation /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { header } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
|
|||
export default { |
|||
components: { rrOperation }, |
|||
mixins: [header()], |
|||
|
|||
data() { |
|||
return { |
|||
pickerOptions: { |
|||
shortcuts: [{ |
|||
text: '最近一周', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近一个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}, { |
|||
text: '最近三个月', |
|||
onClick(picker) { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) |
|||
picker.$emit('pick', [start, end]) |
|||
} |
|||
}] |
|||
}, |
|||
value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], |
|||
value2: '' |
|||
} |
|||
}, |
|||
created() { |
|||
} |
|||
} |
|||
</script> |
Loading…
Reference in new issue