增加系统命令日志

This commit is contained in:
龙运模 2024-09-13 23:14:10 +08:00
parent 2812f1eef3
commit dee47f16a6
5 changed files with 307 additions and 103 deletions

View File

@ -475,6 +475,13 @@ export default {
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: {
url: `${config.API_URL}/sys.log.operation.list`,
name: "日志操作功能",

View File

@ -31,7 +31,7 @@
</el-col>
<el-col :span="12">
<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-col :span="5">
<el-form-item prop="owner">
@ -140,11 +140,14 @@ export default {
owner:[
{required: true, message: '负责人不能为空', trigger: 'blur'}
],
admin_account: [
{required: true, message: '账号不能为空', trigger: 'blur'}
],
password: [
{required: true, message: '密码不能为空', trigger: 'blur'}
// admin_account: [
// {required: true, message: '', trigger: 'blur'}
// ],
// password: [
// {required: true, message: '', trigger: 'blur'}
// ],
accord:[
{required: true, message: '系统协议不能为空', trigger: 'change'}
]
},
}

View 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>

View 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>

View File

@ -1,110 +1,119 @@
<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-container class="mainNoBack userBox">
<el-aside class="userAside" style="width: 220px;">
<el-container>
<el-main class="nopadding">
<el-menu class="menu mainMenu" :default-active="page">
<div v-for="group in menu" :key="group.groupName">
<el-menu-item-group v-if="group.show" :title="group.groupName">
<div v-for="item in group.list" :key="item.component">
<el-menu-item v-authSetup="item.actions" :index="item.component" @click="openPage">
<el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
<template #title>
<span>{{item.title}}</span>
</template>
</el-menu-item>
</div>
</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-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:[]
},
import { defineAsyncComponent } from 'vue'
infoDrawer: false,
date: [],
list:{
apiObj: this.$API.system.log.list,
column:[]
export default {
components: {
xtLog: defineAsyncComponent(() => import('./components/ability')),
commandLog: defineAsyncComponent(() => import('./components/command')),
},
data() {
return {
menu: [
{
groupName: "系统操作日志",
show:true,
list: [
{
icon: "sc-icon-UserLog",
title: "操作系统功能日志",
component: "xtLog",
actions:'logsList',
},
]
},
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)
}
{
groupName: "系统命令日志",
show:true,
list: [
{
icon: "sc-icon-Log",
title: "操作系统命令日志",
component: "commandLog",
actions:'sysLogCommandList'
},
]
},
],
user: {
avatar:this.$store.state.global.login_avatar,
name: this.$store.state.global.login_name,
role: "",
},
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)
// })
}
userNameF:'',
page: "xtLog"
}
},
// 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>
<style>
<style scoped lang="scss">
.noBorderRadius{border-radius: 0 !important;}
</style>