Commit b15898e2 authored by Asjoker's avatar Asjoker

操作日志-导出

parent 3fa32d71
...@@ -30,7 +30,8 @@ export function exportLogininfo(query) { ...@@ -30,7 +30,8 @@ export function exportLogininfo(query) {
return request({ return request({
url: '/monitor/loginInfo/export', url: '/monitor/loginInfo/export',
method: 'get', method: 'get',
params: query params: query,
responseType: 'blob'
}) })
} }
...@@ -12,7 +12,7 @@ export function list(query) { ...@@ -12,7 +12,7 @@ export function list(query) {
// 删除操作日志 // 删除操作日志
export function delOperLog(operId) { export function delOperLog(operId) {
return request({ return request({
url: '/authority/monitor/operLog/' + operId, url: '/monitor/operLog/' + operId,
method: 'delete' method: 'delete'
}) })
} }
...@@ -20,7 +20,7 @@ export function delOperLog(operId) { ...@@ -20,7 +20,7 @@ export function delOperLog(operId) {
// 清空操作日志 // 清空操作日志
export function cleanOperLog() { export function cleanOperLog() {
return request({ return request({
url: '/authority/monitor/operLog/clean/0', url: '/monitor/operLog/clean/0',
method: 'delete' method: 'delete'
}) })
} }
...@@ -28,8 +28,9 @@ export function cleanOperLog() { ...@@ -28,8 +28,9 @@ export function cleanOperLog() {
// 导出操作日志 // 导出操作日志
export function exportOperLog(query) { export function exportOperLog(query) {
return request({ return request({
url: '/authority/monitor/operLog/export', url: '/monitor/operLog/export',
method: 'get', method: 'get',
params: query params: query,
responseType: 'blob'
}) })
} }
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<!-- <el-table-column label="浏览器" align="center" prop="browser" /> <!-- <el-table-column label="浏览器" align="center" prop="browser" />
<el-table-column label="操作系统" align="center" prop="os" />--> <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="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> <el-table-column label="登录时间" align="center" prop="loginTime" width="180" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) | transformDateByFormat('YYYY-MM-DD HH:mm:ss') }}</span> <span>{{ parseTime(scope.row.loginTime) | transformDateByFormat('YYYY-MM-DD HH:mm:ss') }}</span>
...@@ -244,21 +244,33 @@ export default { ...@@ -244,21 +244,33 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = Object.assign({}, this.queryParams) // const queryParams = Object.assign({}, this.queryParams)
// queryParams.loginTime = queryParams.loginTime ? this.$parseDate(new Date(queryParams.loginTime), 'YYYY-MM-DD HH:mm:ss') : '' // // queryParams.loginTime = queryParams.loginTime ? this.$parseDate(new Date(queryParams.loginTime), 'YYYY-MM-DD HH:mm:ss') : ''
delete queryParams.page // delete queryParams.page
delete queryParams.rows // delete queryParams.rows
queryParams.ids = this.ids.join(',') || null // queryParams.ids = this.ids.join(',') || null
exportLogininfo(queryParams).then(response => { // exportLogininfo(queryParams).then(response => {
this.download(response.msg) // this.download(response.msg)
}).catch(function() {}) // }).catch(function() {})
// this.$confirm('是否确认导出所有操作日志数据项?', '提示', { const queryParams = this.queryParams
// confirmButtonText: '确定', this.$confirm('是否确认导出所有操作日志数据项?', '提示', {
// cancelButtonText: '取消', confirmButtonText: '确定',
// type: 'warning' cancelButtonText: '取消',
// }).then(function() { type: 'warning'
// return exportLogininfo(queryParams) }).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 { ...@@ -336,21 +336,33 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = Object.assign({}, this.queryParams) // const queryParams = Object.assign({}, this.queryParams)
// queryParams.operTime = queryParams.operTime ? this.$parseDate(new Date(queryParams.operTime), 'YYYY-MM-DD HH:mm:ss') : '' // // queryParams.operTime = queryParams.operTime ? this.$parseDate(new Date(queryParams.operTime), 'YYYY-MM-DD HH:mm:ss') : ''
delete queryParams.pu // delete queryParams.pu
delete queryParams.ps // delete queryParams.ps
queryParams.ids = this.ids.join(',') || null // queryParams.ids = this.ids.join(',') || null
exportOperLog(queryParams).then(response => { // exportOperLog(queryParams).then(response => {
this.download(response.msg) // this.download(response.msg)
}).catch(function() {}) // }).catch(function() {})
// this.$confirm('是否确认导出所有操作日志数据项?', '提示', { const queryParams = this.queryParams
// confirmButtonText: '确定', this.$confirm('是否确认导出所有操作日志数据项?', '提示', {
// cancelButtonText: '取消', confirmButtonText: '确定',
// type: 'warning' cancelButtonText: '取消',
// }).then(() => { type: 'warning'
// exportOperLog(queryParams) }).then(function() {
// }).catch() 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