新增登录日志分页
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/user-login-record/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@@ -137,7 +137,9 @@ export default {
|
||||
alarmDing: '任务报警钉钉',
|
||||
jobLogCode: '执行结果',
|
||||
jobLogMsg: '执行日志',
|
||||
alarmStatus: '报警状态'
|
||||
alarmStatus: '报警状态',
|
||||
ip: 'IP',
|
||||
happendTime: '发生时间'
|
||||
},
|
||||
errorLog: {
|
||||
tips: '请点击右上角bug小图标',
|
||||
|
||||
@@ -1,49 +1,31 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.jobId" placeholder="请选择" clearable>
|
||||
<el-option v-for="item in jobList" :key="item.id" :label="item.desc" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column type="index" width="100" :label="$t('table.id')"></el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.handler')" min-width="200">
|
||||
<el-table-column align="center" :label="$t('table.userName')" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.handler}}</span>
|
||||
<span>{{scope.row.userName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.jobParam')" min-width="200">
|
||||
<el-table-column align="center" :label="$t('table.ip')" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.param}}</span>
|
||||
<span>{{scope.row.ip}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.jobLogCode')" min-width="120">
|
||||
<el-table-column align="center" :label="$t('table.type')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.code | statusFilter">{{scope.row.code | statusName}}</el-tag>
|
||||
<el-tag :type="scope.row.type | typeFilter">{{scope.row.type | typeName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.jobLogMsg')" min-width="400">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.msg}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.alarmStatus')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.alarmStatus | alarmStatusFilter">{{scope.row.alarmStatus | salarmStatusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.createTime')" min-width="150">
|
||||
<el-table-column align="center" :label="$t('table.happendTime')" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" :label="$t('table.actions')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="primary" @click="handleShowClick(scope.row)">查看日志</el-button>
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.currentPage"
|
||||
@@ -54,12 +36,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList } from '@/api/jobLog'
|
||||
import { jobList } from '@/api/jobInfo'
|
||||
import { fetchList } from '@/api/loginLog'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
|
||||
export default {
|
||||
name: 'jobLog',
|
||||
name: 'loginLog',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
@@ -73,8 +54,7 @@ export default {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
jobId: undefined
|
||||
},
|
||||
jobList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -92,14 +72,19 @@ export default {
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
salarmStatusName(status) {
|
||||
const statusMap = {
|
||||
0: '-',
|
||||
1: '待发送',
|
||||
2: '发送成功',
|
||||
3: '发送失败'
|
||||
typeName(type) {
|
||||
const typeMap = {
|
||||
1: '登录',
|
||||
2: '登出'
|
||||
}
|
||||
return statusMap[status]
|
||||
return typeMap[type]
|
||||
},
|
||||
typeFilter(type) {
|
||||
const typeMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return typeMap[type]
|
||||
},
|
||||
alarmStatusFilter(status) {
|
||||
const statusMap = {
|
||||
@@ -113,10 +98,8 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getJobList()
|
||||
},
|
||||
activated() {
|
||||
this.getJobList()
|
||||
if (this.$route.query.jobId) {
|
||||
this.listQuery.jobId = this.$route.query.jobId
|
||||
console.log(this.listQuery.jobId, this.$route.query.jobId)
|
||||
@@ -132,11 +115,6 @@ export default {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getJobList() {
|
||||
jobList().then(response => {
|
||||
this.jobList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.currentPage = 1
|
||||
this.getList()
|
||||
|
||||
Reference in New Issue
Block a user