Commit cdf0265d authored by zhuangxinwei's avatar zhuangxinwei

操作日志

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