loujf
3 years ago
7 changed files with 251 additions and 4 deletions
@ -0,0 +1,183 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- <!– 搜索 –>--> |
|||
<!-- <el-input--> |
|||
<!-- v-model="query.blurry"--> |
|||
<!-- size="small"--> |
|||
<!-- clearable--> |
|||
<!-- placeholder="输入任务编码"--> |
|||
<!-- style="width: 200px;"--> |
|||
<!-- class="filter-item"--> |
|||
<!-- @keyup.enter.native="crud.toQuery"--> |
|||
<!-- />--> |
|||
<el-select |
|||
v-model="query.device_code" |
|||
clearable |
|||
filterable |
|||
size="small" |
|||
placeholder="日志类型" |
|||
class="filter-item" |
|||
style="width: 190px" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option v-for="item in deviceList" :key="item.device_id" :label="item.device_name" :value="item.device_code" /> |
|||
</el-select> |
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="datetimerange" |
|||
:picker-options="pickerOptions" |
|||
class="filter-item" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
align="right" |
|||
/> |
|||
<rrOperation /> |
|||
</div> |
|||
<crudOperation :permission="permission"/> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
size="small" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column type="selection" width="55" /> |
|||
<el-table-column prop="device_code" label="设备编码"/> |
|||
<el-table-column prop="create_time" label="创建时间" /> |
|||
<el-table-column prop="vehicle_code" label="载具号"/> |
|||
<el-table-column prop="inst_code" label="指令号" /> |
|||
<el-table-column prop="message" label="异常详情" width="300"/> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import crudLog from '@/api/log' |
|||
import CRUD, { presenter, header, form, crud } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import udOperation from '@crud/UD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import { get } from '@/api/system/dictDetail' |
|||
import Search from '@/views/monitor/lucene/search' |
|||
|
|||
const defaultForm = { |
|||
_id: null, |
|||
thread: null, |
|||
level: null, |
|||
marker: null, |
|||
log_type: null, |
|||
source: null, |
|||
logger: null, |
|||
date: null, |
|||
message: null |
|||
} |
|||
export default { |
|||
name: 'Log', |
|||
// eslint-disable-next-line vue/no-unused-components |
|||
components: { Search, pagination, crudOperation, rrOperation, udOperation }, |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '日志查询', |
|||
url: 'api/rootLog/deviceLog', |
|||
idField: 'log_uuid', |
|||
sort: 'log_uuid,desc', |
|||
crudMethod: { ...crudLog }, |
|||
optShow: { |
|||
add: false, |
|||
edit: false, |
|||
del: false, |
|||
download: false, |
|||
reset: false |
|||
} |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
permission: { |
|||
add: ['admin', 'log:add'], |
|||
edit: ['admin', 'log:edit'], |
|||
del: ['admin', 'log:del'] |
|||
}, |
|||
errorInfo: '', |
|||
dialog: false, |
|||
deviceList: [], |
|||
log_levels: [], |
|||
rules: { |
|||
log_uuid: [ |
|||
{ required: true, message: '日志标识不能为空', trigger: 'blur' } |
|||
], |
|||
task_code: [ |
|||
{ required: true, message: '任务编码不能为空', trigger: 'blur' } |
|||
], |
|||
task_id: [ |
|||
{ required: true, message: '任务标识不能为空', trigger: 'blur' } |
|||
], |
|||
log_type: [ |
|||
{ required: true, message: '日志类型不能为空', trigger: 'blur' } |
|||
], |
|||
method: [ |
|||
{ required: true, message: '方法不能为空', trigger: 'blur' } |
|||
], |
|||
requestparam: [ |
|||
{ required: true, message: '请求参数不能为空', trigger: 'blur' } |
|||
], |
|||
responseparam: [ |
|||
{ required: true, message: '返回参数不能为空', trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
this.$nextTick(() => { |
|||
// eslint-disable-next-line no-undef |
|||
debugger |
|||
crudLog.selectDeviceList().then(data => { |
|||
this.deviceList = data |
|||
}) |
|||
// 获取设备类型字典 |
|||
get('log_level').then(data => { |
|||
this.log_levels = data.content |
|||
}) |
|||
}) |
|||
}, |
|||
methods: { |
|||
// 获取异常详情 |
|||
info(row) { |
|||
this.dialog = true |
|||
const data = {} |
|||
data.message = row.message |
|||
data.marker = row.marker |
|||
crudLog.findError(data).then(res => { |
|||
this.errorInfo = res |
|||
}) |
|||
}, |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
} |
|||
// paramFormate(row, index) { |
|||
// return JSON.stringify(row.requestparam) |
|||
// }, |
|||
// paramFormate2(row, index) { |
|||
// return JSON.stringify(row.responseparam) |
|||
// } |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
Loading…
Reference in new issue