Commit cdf0265d authored by zhuangxinwei's avatar zhuangxinwei

操作日志

parent c2dead9b
import request from '@/utils/request'
import Qs from 'qs'
// 查询异常日志列表
export function list(query) {
......@@ -10,18 +11,22 @@ export function list(query) {
}
// 删除异常日志
export function delErrLog(operId) {
export function delErrLog(data) {
data = Qs.stringify(data)
return request({
url: '/monitor/errorLog/' + operId,
method: 'delete'
url: '/monitor/errorLog/delete',
method: 'post',
data
})
}
// 清空异常日志
export function cleanErrLog() {
export function cleanErrLog(data) {
data = Qs.stringify(data)
return request({
url: '/monitor/errorLog/clean',
method: 'delete'
method: 'post',
data
})
}
......
import request from '@/utils/request'
import Qs from 'qs'
// 查询登录日志列表
export function list(query) {
......@@ -10,18 +11,22 @@ export function list(query) {
}
// 删除登录日志
export function delLogininfo(infoId) {
export function delLogininfo(data) {
data = Qs.stringify(data)
return request({
url: '/monitor/loginInfo/' + infoId,
method: 'delete'
url: '/monitor/loginInfo/delete',
method: 'post',
data
})
}
// 清空登录日志
export function cleanLogininfo() {
export function cleanLogininfo(data) {
data = Qs.stringify(data)
return request({
url: '/monitor/loginInfo/clean',
method: 'delete'
method: 'post',
data
})
}
......
import request from '@/utils/request'
import Qs from 'qs'
// 查询操作日志列表
export function list(query) {
......@@ -10,18 +11,22 @@ export function list(query) {
}
// 删除操作日志
export function delOperLog(operId) {
export function delOperLog(data) {
data = Qs.stringify(data)
return request({
url: '/monitor/operLog/' + operId,
method: 'delete'
url: '/monitor/operLog/delete',
method: 'post',
data
})
}
// 清空操作日志
export function cleanOperLog() {
export function cleanOperLog(data) {
data = Qs.stringify(data)
return request({
url: '/monitor/operLog/clean',
method: 'delete'
method: 'post',
data
})
}
......
......@@ -66,7 +66,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column :show-overflow-tooltip="true" label="日志编号" width="100" align="center" prop="businessId">
<template slot-scope="scope">
{{ scope.row.operId || '-' }}
{{ scope.row.businessId || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="系统模块" align="center" prop="systemMode">
......@@ -207,6 +207,11 @@ export default {
getList() {
this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
if (response.code === 200) {
this.list = []
this.total = 0
this.loading = false
} else {
this.list = response.rows.map(item => {
const title = item.title
if (title) {
......@@ -223,6 +228,7 @@ export default {
this.total = response.total
this.loading = false
}
}
)
},
// 操作日志状态字典翻译
......@@ -246,7 +252,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.operId)
this.ids = selection.map(item => item.businessId)
},
/** 详细按钮操作 */
handleView(row) {
......@@ -260,12 +266,14 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return delErrLog(this.ids)
}).then(() => {
const data = {
deleteIds: this.ids,
loginTime: this.queryParams.loginTime
}
delErrLog(data).then(() => {
this.getList()
this.$message.success('删除成功')
this.ids = []
this.multiple = true
})
}).catch(function() {})
},
/** 清空按钮操作 */
......@@ -274,11 +282,14 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return cleanErrLog()
}).then(() => {
const data = {
loginTime: this.queryParams.loginTime
}
cleanErrLog(data).then(() => {
this.getList()
this.$message.success('清空成功')
})
}).catch(function() {})
},
/** 导出按钮操作 */
......
......@@ -116,7 +116,7 @@
<!-- &lt;!&ndash; </el-table-column>&ndash;&gt;-->
<!-- <el-table-column label="登录状态" align="center" prop="status" :formatter="statusFormat" />-->
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="访问编号" align="center" prop="infoId" />
<el-table-column label="访问编号" align="center" prop="businessId" />
<el-table-column label="用户名称" align="center" prop="username" />
<el-table-column label="登录地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
<el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
......@@ -204,9 +204,15 @@ export default {
// const query = Object.assign({}, this.queryParams)
// query.loginTime = query.loginTime ? this.$parseDate(new Date(query.loginTime), 'YYYY-MM-DD HH:mm:ss') : ''
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
if (response.code === 200) {
this.list = []
this.total = 0
this.loading = false
} else {
this.list = response.rows
this.total = response.total
this.loading = false
}
})
},
// 登录状态字典翻译
......@@ -226,7 +232,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.infoId)
this.ids = selection.map(item => item.businessId)
this.multiple = !selection.length
},
/** 删除按钮操作 */
......@@ -236,12 +242,16 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return delLogininfo(this.ids)
}).then(() => {
const data = {
deleteIds: this.ids,
loginTime: this.queryParams.loginTime
}
delLogininfo(data).then(() => {
this.getList()
this.$message.success('删除成功')
this.ids = []
this.multiple = true
})
}).catch(function() {})
},
/** 清空按钮操作 */
......@@ -250,11 +260,14 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return cleanLogininfo()
}).then(() => {
const data = {
loginTime: this.queryParams.loginTime
}
cleanLogininfo(data).then(() => {
this.getList()
this.$message.success('清空成功')
})
}).catch(function() {})
},
/** 导出按钮操作 */
......
......@@ -64,9 +64,9 @@
<div class="mb12 font-small-bold">操作日志列表</div>
<el-table v-loading="loading" border :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :show-overflow-tooltip="true" label="日志编号" width="100" align="center" prop="operId">
<el-table-column :show-overflow-tooltip="true" label="日志编号" width="100" align="center" prop="businessId">
<template slot-scope="scope">
{{ scope.row.operId || '-' }}
{{ scope.row.businessId || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="系统模块" align="center" prop="systemMode">
......@@ -96,7 +96,7 @@
</el-table-column>
<el-table-column label="操作时间" align="center" prop="operTime" width="180" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.operTime | transformDateByFormat('YYYY-MM') }}</span>
<span>{{ scope.row.operTime | transformDateByFormat('yyyy-MM-DD HH:mm:ss') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
......@@ -147,6 +147,7 @@
<script>
import { list, delOperLog, cleanOperLog, exportOperLog } from '@/api/monitor/operLog'
import { delErrLog } from '@/api/monitor/errorLog'
export default {
name: 'Operlog',
......@@ -215,6 +216,11 @@ export default {
// const query = Object.assign({}, this.queryParams)
// query.operTime = query.operTime ? this.$parseDate(new Date(query.operTime), 'YYYY-MM-DD HH:mm:ss') : ''
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
if (response.code === 200) {
this.list = []
this.total = 0
this.loading = false
} else {
this.list = response.rows.map(item => {
const title = item.title
if (title) {
......@@ -231,6 +237,7 @@ export default {
this.total = response.total
this.loading = false
}
}
)
},
// 操作日志状态字典翻译
......@@ -254,7 +261,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.operId)
this.ids = selection.map(item => item.businessId)
},
/** 详细按钮操作 */
handleView(row) {
......@@ -268,12 +275,14 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return delOperLog(this.ids)
}).then(() => {
const data = {
deleteIds: this.ids,
loginTime: this.queryParams.loginTime
}
delOperLog(data).then(() => {
this.getList()
this.$message.success('删除成功')
this.ids = []
this.multiple = true
})
}).catch(function() {})
},
/** 清空按钮操作 */
......@@ -283,7 +292,10 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
cleanOperLog().then(() => {
const data = {
loginTime: this.queryParams.loginTime
}
cleanOperLog(data).then(() => {
this.getList()
this.$message.success('清空成功')
}).catch(function() {})
......
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