eladmin 1.0 版本发布
This commit is contained in:
74
src/views/monitor/log/index.vue
Normal file
74
src/views/monitor/log/index.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search :query="query"/>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;">
|
||||
<el-table-column prop="username" label="用户名"/>
|
||||
<el-table-column prop="requestIp" label="IP"/>
|
||||
<el-table-column prop="description" label="描述"/>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="method" label="方法名称"/>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="params" label="参数"/>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="exceptionDetail" label="异常详细"/>
|
||||
<el-table-column prop="time" label="请求耗时" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.time <= 300">{{ scope.row.time }}ms</el-tag>
|
||||
<el-tag v-else-if="scope.row.time <= 1000" type="warning">{{ scope.row.time }}ms</el-tag>
|
||||
<el-tag v-else type="danger">{{ scope.row.time }}ms</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="logType" label="日志类型" width="100px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.logType === 'ERROR'" class="badge badge-bg-orange">{{ scope.row.logType }}</span>
|
||||
<span v-else class="badge">{{ scope.row.logType }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建日期" width="160px">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ time(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<el-pagination
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import initData from '../../../mixins/initData'
|
||||
import { parseTime } from '@/utils/index'
|
||||
import search from './module/search'
|
||||
export default {
|
||||
components: { search },
|
||||
mixins: [initData],
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
beforeInit() {
|
||||
this.url = 'api/logs'
|
||||
const sort = 'id,desc'
|
||||
const query = this.query
|
||||
const username = query.username
|
||||
const logType = query.logType
|
||||
this.params = { page: this.page, size: this.size, sort: sort }
|
||||
if (username && username) { this.params['username'] = username }
|
||||
if (logType !== '' && logType !== null) { this.params['logType'] = logType }
|
||||
return true
|
||||
},
|
||||
time(time) {
|
||||
return parseTime(time)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
36
src/views/monitor/log/module/search.vue
Normal file
36
src/views/monitor/log/module/search.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<el-input v-model="query.username" clearable placeholder="用户名" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
|
||||
<el-select v-model="query.logType" placeholder="日志类型" clearable class="filter-item" style="width: 110px" @change="toQuery">
|
||||
<el-option v-for="item in enabledTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 查询条件
|
||||
export default {
|
||||
props: {
|
||||
query: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
downloadLoading: false,
|
||||
enabledTypeOptions: [
|
||||
{ key: 'INFO', display_name: 'INFO' },
|
||||
{ key: 'ERROR', display_name: 'ERROR' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toQuery() {
|
||||
this.$parent.page = 0
|
||||
this.$parent.init()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
104
src/views/monitor/redis/index.vue
Normal file
104
src/views/monitor/redis/index.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search :query="query"/>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;">
|
||||
<el-table-column label="序号" width="80" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.$index + 1 }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="key" label="KEY"/>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="value" label="VALUE"/>
|
||||
<el-table-column label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<edit v-if="checkPermission(['ADMIN','REDIS_ALL','REDIS_EDIT'])" :data="scope.row" :sup_this="sup_this"/>
|
||||
<el-popover
|
||||
v-if="checkPermission(['ADMIN','REDIS_ALL','REDIS_DELETE'])"
|
||||
v-model="scope.row.delPopover"
|
||||
placement="top"
|
||||
width="180">
|
||||
<p>确定删除本条数据吗?</p>
|
||||
<div style="text-align: right; margin: 0">
|
||||
<el-button size="mini" type="text" @click="scope.row.delPopover = false">取消</el-button>
|
||||
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.$index, scope.row)">确定</el-button>
|
||||
</div>
|
||||
<el-button slot="reference" type="danger" size="mini" @click="scope.row.delPopover = true">删除</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<el-pagination
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import checkPermission from '@/utils/permission' // 权限判断函数
|
||||
import initData from '../../../mixins/initData'
|
||||
import { del } from '@/api/redis'
|
||||
import { getPermissionTree } from '@/api/permission'
|
||||
import { parseTime } from '@/utils/index'
|
||||
import search from './module/search'
|
||||
import edit from './module/edit'
|
||||
export default {
|
||||
components: { search, edit },
|
||||
mixins: [initData],
|
||||
data() {
|
||||
return {
|
||||
delLoading: false, sup_this: this, permissions: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getPermissions()
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
beforeInit() {
|
||||
this.url = 'api/redis'
|
||||
const query = this.query
|
||||
const value = query.value
|
||||
this.params = { page: this.page, size: this.size }
|
||||
if (value) {
|
||||
this.params['key'] = value
|
||||
} else {
|
||||
this.params['key'] = '*'
|
||||
}
|
||||
return true
|
||||
},
|
||||
subDelete(index, row) {
|
||||
this.delLoading = true
|
||||
del(row.key).then(res => {
|
||||
this.delLoading = false
|
||||
row.delPopover = false
|
||||
this.init(search.data().query)
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
})
|
||||
},
|
||||
time(time) {
|
||||
return parseTime(time)
|
||||
},
|
||||
getPermissions() {
|
||||
getPermissionTree().then(res => {
|
||||
this.permissions = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
73
src/views/monitor/redis/module/add.vue
Normal file
73
src/views/monitor/redis/module/add.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="dialog = true">新增</el-button>
|
||||
<el-dialog :visible.sync="dialog" :title="title" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="66px">
|
||||
<el-form-item label="key" prop="key">
|
||||
<el-input v-model="form.key" style="width: 370px;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="value" prop="value">
|
||||
<el-input v-model="form.value" style="width: 370px;" rows="6" type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { add } from '@/api/redis'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialog: false, title: '新增缓存',
|
||||
form: { key: '', value: '' },
|
||||
rules: {
|
||||
key: [
|
||||
{ required: true, message: '请输入Key', trigger: 'blur' }
|
||||
],
|
||||
value: [
|
||||
{ required: true, message: '请输入Value', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.resetForm()
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
add(this.form).then(res => {
|
||||
this.resetForm()
|
||||
this.$notify({
|
||||
title: '添加成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
this.$parent.$parent.init()
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.dialog = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form = { key: '', value: '' }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
div{
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
89
src/views/monitor/redis/module/edit.vue
Normal file
89
src/views/monitor/redis/module/edit.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button size="mini" type="success" @click="to">编辑</el-button>
|
||||
<el-dialog :visible.sync="dialog" :title="title" style="text-align: left" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="66px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="66px">
|
||||
<el-form-item label="key" prop="key">
|
||||
<el-input v-model="form.key" style="width: 370px;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="value" prop="value">
|
||||
<el-input v-model="form.value" style="width: 370px;" rows="6" type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { edit } from '@/api/redis'
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
sup_this: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: false, title: '编辑缓存',
|
||||
form: { key: '', value: '' },
|
||||
rules: {
|
||||
key: [
|
||||
{ required: true, message: '请输入Key', trigger: 'blur' }
|
||||
],
|
||||
value: [
|
||||
{ required: true, message: '请输入Value', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
to() {
|
||||
this.form = { key: this.data.key, value: this.data.value }
|
||||
this.dialog = true
|
||||
},
|
||||
cancel() {
|
||||
this.resetForm()
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const _this = this
|
||||
edit(this.form).then(res => {
|
||||
this.resetForm()
|
||||
this.$notify({
|
||||
title: '修改成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
_this.sup_this.init()
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.dialog = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form = { key: '', value: '' }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
div{
|
||||
display: inline-block;
|
||||
margin-right: 3px;
|
||||
}
|
||||
</style>
|
||||
44
src/views/monitor/redis/module/search.vue
Normal file
44
src/views/monitor/redis/module/search.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="head-container">
|
||||
<el-input v-model="query.value" clearable placeholder="输入关键词搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
|
||||
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
|
||||
<add v-if="checkPermission(['ADMIN','REDIS_ALL','REDIS_CREATE'])"/>
|
||||
<el-button v-if="checkPermission(['ADMIN','REDIS_ALL','REDIS_DELETE'])" :loading="deleteAllLoading" type="warning" size="mini" class="filter-item" icon="el-icon-delete" @click="deleteAll">清空缓存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import checkPermission from '@/utils/permission' // 权限判断函数
|
||||
import add from './add'
|
||||
import { delAll } from '@/api/redis'
|
||||
// 查询条件
|
||||
export default {
|
||||
components: { add },
|
||||
props: {
|
||||
query: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
deleteAllLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
toQuery() {
|
||||
this.$parent.page = 0
|
||||
this.$parent.init()
|
||||
},
|
||||
deleteAll() {
|
||||
this.deleteAllLoading = true
|
||||
delAll().then(res => {
|
||||
this.$parent.page = 0
|
||||
this.$parent.init()
|
||||
this.deleteAllLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user