Commit b15898e2 authored by Asjoker's avatar Asjoker

操作日志-导出

parent 3fa32d71
......@@ -30,7 +30,8 @@ export function exportLogininfo(query) {
return request({
url: '/monitor/loginInfo/export',
method: 'get',
params: query
params: query,
responseType: 'blob'
})
}
......@@ -12,7 +12,7 @@ export function list(query) {
// 删除操作日志
export function delOperLog(operId) {
return request({
url: '/authority/monitor/operLog/' + operId,
url: '/monitor/operLog/' + operId,
method: 'delete'
})
}
......@@ -20,7 +20,7 @@ export function delOperLog(operId) {
// 清空操作日志
export function cleanOperLog() {
return request({
url: '/authority/monitor/operLog/clean/0',
url: '/monitor/operLog/clean/0',
method: 'delete'
})
}
......@@ -28,8 +28,9 @@ export function cleanOperLog() {
// 导出操作日志
export function exportOperLog(query) {
return request({
url: '/authority/monitor/operLog/export',
url: '/monitor/operLog/export',
method: 'get',
params: query
params: query,
responseType: 'blob'
})
}
......@@ -126,7 +126,7 @@
<!-- <el-table-column label="浏览器" align="center" prop="browser" />
<el-table-column label="操作系统" align="center" prop="os" />-->
<el-table-column label="登录状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="操作信息" align="center" prop="msg" />
<el-table-column label="提示信息" align="center" prop="msg" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) | transformDateByFormat('YYYY-MM-DD HH:mm:ss') }}</span>
......@@ -244,21 +244,33 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
const queryParams = Object.assign({}, this.queryParams)
// queryParams.loginTime = queryParams.loginTime ? this.$parseDate(new Date(queryParams.loginTime), 'YYYY-MM-DD HH:mm:ss') : ''
delete queryParams.page
delete queryParams.rows
queryParams.ids = this.ids.join(',') || null
exportLogininfo(queryParams).then(response => {
this.download(response.msg)
}).catch(function() {})
// this.$confirm('是否确认导出所有操作日志数据项?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(function() {
// return exportLogininfo(queryParams)
// })
// const queryParams = Object.assign({}, this.queryParams)
// // queryParams.loginTime = queryParams.loginTime ? this.$parseDate(new Date(queryParams.loginTime), 'YYYY-MM-DD HH:mm:ss') : ''
// delete queryParams.page
// delete queryParams.rows
// queryParams.ids = this.ids.join(',') || null
// exportLogininfo(queryParams).then(response => {
// this.download(response.msg)
// }).catch(function() {})
const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志数据项?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportLogininfo(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '登录日志' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg)
})
})
}
}
}
......
......@@ -336,21 +336,33 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
const queryParams = Object.assign({}, this.queryParams)
// queryParams.operTime = queryParams.operTime ? this.$parseDate(new Date(queryParams.operTime), 'YYYY-MM-DD HH:mm:ss') : ''
delete queryParams.pu
delete queryParams.ps
queryParams.ids = this.ids.join(',') || null
exportOperLog(queryParams).then(response => {
this.download(response.msg)
}).catch(function() {})
// this.$confirm('是否确认导出所有操作日志数据项?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// exportOperLog(queryParams)
// }).catch()
// const queryParams = Object.assign({}, this.queryParams)
// // queryParams.operTime = queryParams.operTime ? this.$parseDate(new Date(queryParams.operTime), 'YYYY-MM-DD HH:mm:ss') : ''
// delete queryParams.pu
// delete queryParams.ps
// queryParams.ids = this.ids.join(',') || null
// exportOperLog(queryParams).then(response => {
// this.download(response.msg)
// }).catch(function() {})
const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志数据项?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportOperLog(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '操作日志' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg)
})
})
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment