增加系统命令日志
This commit is contained in:
parent
2812f1eef3
commit
dee47f16a6
@ -475,6 +475,13 @@ export default {
|
|||||||
return await http.post(this.url, params);
|
return await http.post(this.url, params);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
commandLog: {
|
||||||
|
url: `${config.API_URL}/sys.log.command.list`,
|
||||||
|
name: "日志命令列表",
|
||||||
|
get: async function (params) {
|
||||||
|
return await http.post(this.url, params);
|
||||||
|
},
|
||||||
|
},
|
||||||
operation: {
|
operation: {
|
||||||
url: `${config.API_URL}/sys.log.operation.list`,
|
url: `${config.API_URL}/sys.log.operation.list`,
|
||||||
name: "日志操作功能",
|
name: "日志操作功能",
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<div class="dialogBoxTitle"><span class="make"></span><span class="name">企业管理员信息</span></div>
|
<div class="dialogBoxTitle"><span class="make"></span><span class="name">企业管理员信息</span></div>
|
||||||
<el-form-item label="负责人/联系方式" required>
|
<el-form-item label="负责人/联系方式">
|
||||||
<el-row justify="space-between">
|
<el-row justify="space-between">
|
||||||
<el-col :span="5">
|
<el-col :span="5">
|
||||||
<el-form-item prop="owner">
|
<el-form-item prop="owner">
|
||||||
@ -140,11 +140,14 @@ export default {
|
|||||||
owner:[
|
owner:[
|
||||||
{required: true, message: '负责人不能为空', trigger: 'blur'}
|
{required: true, message: '负责人不能为空', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
admin_account: [
|
// admin_account: [
|
||||||
{required: true, message: '账号不能为空', trigger: 'blur'}
|
// {required: true, message: '账号不能为空', trigger: 'blur'}
|
||||||
],
|
// ],
|
||||||
password: [
|
// password: [
|
||||||
{required: true, message: '密码不能为空', trigger: 'blur'}
|
// {required: true, message: '密码不能为空', trigger: 'blur'}
|
||||||
|
// ],
|
||||||
|
accord:[
|
||||||
|
{required: true, message: '系统协议不能为空', trigger: 'change'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
110
src/views/setting/log/components/ability.vue
Normal file
110
src/views/setting/log/components/ability.vue
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<el-container class="mainBox mainBoxHeaderNoBorder">
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<div class="searchMain">
|
||||||
|
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
|
||||||
|
|
||||||
|
<div class="searchItem searchBtn">
|
||||||
|
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
|
||||||
|
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
||||||
|
<scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="8">
|
||||||
|
<el-button v-auth="'sysLogExport'" :size="size" icon="sc-icon-Download" @click="exportData">下载</el-button>
|
||||||
|
</scExport>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick">
|
||||||
|
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
|
||||||
|
<el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
|
||||||
|
<info ref="info"></info>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import info from '../info'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
info,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
size:"small",
|
||||||
|
setMap:{
|
||||||
|
name:[]
|
||||||
|
},
|
||||||
|
|
||||||
|
infoDrawer: false,
|
||||||
|
date: [],
|
||||||
|
list:{
|
||||||
|
apiObj: this.$API.system.log.list,
|
||||||
|
column:[]
|
||||||
|
},
|
||||||
|
exportShow:false,
|
||||||
|
searchList:[
|
||||||
|
{name:'操作日期',type:'date',code:'created_at',show:true},
|
||||||
|
{name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true},
|
||||||
|
{name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true},
|
||||||
|
],
|
||||||
|
params: {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getSelectData(item){
|
||||||
|
let {data,params} = item;
|
||||||
|
this.params = params;
|
||||||
|
if(data.code == "type"){
|
||||||
|
this.getTypeList(data,params)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getTypeList(data,params) {
|
||||||
|
const res = await this.$API.system.log.operation.post(params);
|
||||||
|
if(res.code == 200){
|
||||||
|
res.data.forEach(item=>{
|
||||||
|
item.id = item.type;
|
||||||
|
item.label = item.log_title;
|
||||||
|
})
|
||||||
|
this.searchList.forEach(item=>{
|
||||||
|
if(item.code == data.code){
|
||||||
|
item.data = res.data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下载导出
|
||||||
|
exportChangeShow(params){
|
||||||
|
if(params.type == 8){
|
||||||
|
this.exportShow = params.status==0?true:false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async exportData() {
|
||||||
|
if(this.exportShow) return
|
||||||
|
const res = await this.$API.system.log.export.post(this.params);
|
||||||
|
if(res.code == 200){
|
||||||
|
this.$message.success('开始导出');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
upSearch(){
|
||||||
|
this.$refs.table.upData(this.params);
|
||||||
|
},
|
||||||
|
reset(){
|
||||||
|
this.params = {};
|
||||||
|
this.$refs.scSearch.reload();
|
||||||
|
this.$refs.table.reload();
|
||||||
|
},
|
||||||
|
rowClick(){
|
||||||
|
// row
|
||||||
|
// this.infoDrawer = true
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// this.$refs.info.setData(row)
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
75
src/views/setting/log/components/command.vue
Normal file
75
src/views/setting/log/components/command.vue
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<el-container class="mainBox mainBoxHeaderNoBorder">
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<div class="searchMain">
|
||||||
|
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
|
||||||
|
|
||||||
|
<div class="searchItem searchBtn">
|
||||||
|
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
|
||||||
|
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick">
|
||||||
|
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
|
||||||
|
<el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
|
||||||
|
<info ref="info"></info>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import info from '../info'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
info,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
size:"small",
|
||||||
|
setMap:{
|
||||||
|
name:[]
|
||||||
|
},
|
||||||
|
|
||||||
|
infoDrawer: false,
|
||||||
|
date: [],
|
||||||
|
list:{
|
||||||
|
apiObj: this.$API.system.log.commandLog,
|
||||||
|
column:[]
|
||||||
|
},
|
||||||
|
exportShow:false,
|
||||||
|
searchList:[
|
||||||
|
{name:'操作日期',type:'date',code:'created_at',show:true},
|
||||||
|
{name:'关键字',type:'text',code:['job_name','content'],keyword:true,show:true},
|
||||||
|
],
|
||||||
|
params: {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getSelectData(item){
|
||||||
|
let {params} = item;
|
||||||
|
this.params = params;
|
||||||
|
},
|
||||||
|
upSearch(){
|
||||||
|
this.$refs.table.upData(this.params);
|
||||||
|
},
|
||||||
|
reset(){
|
||||||
|
this.params = {};
|
||||||
|
this.$refs.scSearch.reload();
|
||||||
|
this.$refs.table.reload();
|
||||||
|
},
|
||||||
|
rowClick(){
|
||||||
|
// row
|
||||||
|
// this.infoDrawer = true
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// this.$refs.info.setData(row)
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@ -1,110 +1,119 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container class="mainBox mainBoxHeaderNoBorder">
|
<el-container class="mainNoBack userBox">
|
||||||
<el-main class="nopadding">
|
<el-aside class="userAside" style="width: 220px;">
|
||||||
<div class="searchMain">
|
<el-container>
|
||||||
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
|
<el-main class="nopadding">
|
||||||
|
<el-menu class="menu mainMenu" :default-active="page">
|
||||||
<div class="searchItem searchBtn">
|
<div v-for="group in menu" :key="group.groupName">
|
||||||
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
|
<el-menu-item-group v-if="group.show" :title="group.groupName">
|
||||||
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
<div v-for="item in group.list" :key="item.component">
|
||||||
<scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="8">
|
<el-menu-item v-authSetup="item.actions" :index="item.component" @click="openPage">
|
||||||
<el-button v-auth="'sysLogExport'" :size="size" icon="sc-icon-Download" @click="exportData">下载</el-button>
|
<el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
|
||||||
</scExport>
|
<template #title>
|
||||||
</div>
|
<span>{{item.title}}</span>
|
||||||
</div>
|
</template>
|
||||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick">
|
</el-menu-item>
|
||||||
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
|
</div>
|
||||||
</scTable>
|
</el-menu-item-group>
|
||||||
|
</div>
|
||||||
|
</el-menu>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-aside>
|
||||||
|
<el-main class="userMain userMainPadding_0">
|
||||||
|
<Suspense>
|
||||||
|
<template #default>
|
||||||
|
<component :is="page" />
|
||||||
|
</template>
|
||||||
|
<template #fallback>
|
||||||
|
<el-skeleton :rows="3" />
|
||||||
|
</template>
|
||||||
|
</Suspense>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
||||||
<el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
|
|
||||||
<info ref="info"></info>
|
|
||||||
</el-drawer>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import info from './info'
|
import { defineAsyncComponent } from 'vue'
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
info,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
size:"small",
|
|
||||||
setMap:{
|
|
||||||
name:[]
|
|
||||||
},
|
|
||||||
|
|
||||||
infoDrawer: false,
|
export default {
|
||||||
date: [],
|
components: {
|
||||||
list:{
|
xtLog: defineAsyncComponent(() => import('./components/ability')),
|
||||||
apiObj: this.$API.system.log.list,
|
commandLog: defineAsyncComponent(() => import('./components/command')),
|
||||||
column:[]
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
menu: [
|
||||||
|
{
|
||||||
|
groupName: "系统操作日志",
|
||||||
|
show:true,
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
icon: "sc-icon-UserLog",
|
||||||
|
title: "操作系统功能日志",
|
||||||
|
component: "xtLog",
|
||||||
|
actions:'logsList',
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
exportShow:false,
|
{
|
||||||
searchList:[
|
groupName: "系统命令日志",
|
||||||
{name:'操作日期',type:'date',code:'created_at',show:true},
|
show:true,
|
||||||
{name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true},
|
list: [
|
||||||
{name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true},
|
{
|
||||||
],
|
icon: "sc-icon-Log",
|
||||||
params: {},
|
title: "操作系统命令日志",
|
||||||
}
|
component: "commandLog",
|
||||||
},
|
actions:'sysLogCommandList'
|
||||||
methods: {
|
},
|
||||||
getSelectData(item){
|
]
|
||||||
let {data,params} = item;
|
},
|
||||||
this.params = params;
|
],
|
||||||
if(data.code == "type"){
|
user: {
|
||||||
this.getTypeList(data,params)
|
avatar:this.$store.state.global.login_avatar,
|
||||||
}
|
name: this.$store.state.global.login_name,
|
||||||
|
role: "",
|
||||||
},
|
},
|
||||||
async getTypeList(data,params) {
|
userNameF:'',
|
||||||
const res = await this.$API.system.log.operation.post(params);
|
page: "xtLog"
|
||||||
if(res.code == 200){
|
|
||||||
res.data.forEach(item=>{
|
|
||||||
item.id = item.type;
|
|
||||||
item.label = item.log_title;
|
|
||||||
})
|
|
||||||
this.searchList.forEach(item=>{
|
|
||||||
if(item.code == data.code){
|
|
||||||
item.data = res.data;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 下载导出
|
|
||||||
exportChangeShow(params){
|
|
||||||
if(params.type == 8){
|
|
||||||
this.exportShow = params.status==0?true:false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async exportData() {
|
|
||||||
if(this.exportShow) return
|
|
||||||
const res = await this.$API.system.log.export.post(this.params);
|
|
||||||
if(res.code == 200){
|
|
||||||
this.$message.success('开始导出');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
upSearch(){
|
|
||||||
this.$refs.table.upData(this.params);
|
|
||||||
},
|
|
||||||
reset(){
|
|
||||||
this.params = {};
|
|
||||||
this.$refs.scSearch.reload();
|
|
||||||
this.$refs.table.reload();
|
|
||||||
},
|
|
||||||
rowClick(){
|
|
||||||
// row
|
|
||||||
// this.infoDrawer = true
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.$refs.info.setData(row)
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
//路由跳转进来 判断from是否有特殊标识做特殊处理
|
||||||
|
beforeRouteEnter (to, from, next){
|
||||||
|
next((vm)=>{
|
||||||
|
if(from.is){
|
||||||
|
//删除特殊标识,防止标签刷新重复执行
|
||||||
|
delete from.is
|
||||||
|
//执行特殊方法
|
||||||
|
vm.$alert('路由跳转过来后含有特殊标识,做特殊处理', '提示', {
|
||||||
|
type: 'success',
|
||||||
|
center: true
|
||||||
|
}).then(() => {}).catch(() => {})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const userInfo = this.$TOOL.data.get('USER_INFO');
|
||||||
|
this.user.role = userInfo.user_roles && userInfo.user_roles.role_names.length>0?userInfo.user_roles.role_names[0]:'';
|
||||||
|
const permissions = this.$TOOL.data.get("PERMISSIONS");
|
||||||
|
this.menu.forEach(item=>{
|
||||||
|
item.show = false;
|
||||||
|
item.list.forEach(em=>{
|
||||||
|
if(permissions.auth.indexOf(em.actions)!=-1){
|
||||||
|
item.show = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
let pageView = this.menu.find(item=> item.show === true).list.find(em=> permissions.auth.indexOf(em.actions)!=-1);
|
||||||
|
this.page = pageView.component;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openPage(item){
|
||||||
|
this.page = item.index
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
<style>
|
.noBorderRadius{border-radius: 0 !important;}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user