操作日志页面提交

This commit is contained in:
sonake
2020-04-08 22:31:07 +08:00
parent f47f322bae
commit abd9c5e00a
16 changed files with 362 additions and 36 deletions

View File

@@ -34,7 +34,7 @@
<!--alertMessage页的详情-->
<template v-if="from == 'alertMessage'">
<common-detail-tab v-show="subResizeShow" :from="from" :targetTab="targetTab" v-for="item, index in tabList"
<common-detail-tab v-show="subResizeShow" :from="from" :targetTab="targetTab" v-for="(item, index) in tabList" :key="index"
v-if="targetTab == item" @changeTab="changeTab"></common-detail-tab>
</template>
</div>

View File

@@ -74,7 +74,7 @@
<template v-else-if="item.prop == 'labels'">
<el-tag v-if="key != 'alertname' && key != 'severity'"
type="info"
size="mini" v-for="(value, key) in scope.row.labels" class="alert-message-tag">{{key}}{{value}}</el-tag>
size="mini" v-for="(value, key) in scope.row.labels" :key="key" class="alert-message-tag">{{key}}{{value}}</el-tag>
</template>
<div v-else-if="item.prop == 'state'">
<span class="">

View File

@@ -116,6 +116,9 @@
<el-menu-item index="5-6">
<div @click="jumpTo('terminallog')" :class="{'menu-item-active' :(activeIndex == 'terminallog' )}">{{$t('config.terminallog.terminallog')}}</div>
</el-menu-item>
<el-menu-item index="5-7">
<div @click="jumpTo('operationlog')" :class="{'menu-item-active' :(activeIndex == 'operationlog' )}">{{$t('config.operationlog.operationlog')}}</div>
</el-menu-item>
</el-submenu>
<el-submenu index="6" popper-class="nz-submenu">
<template slot="title">

View File

@@ -373,7 +373,7 @@ const cn = {
checkTime: '检查时间'
},
terminallog: {
terminallog: '终端',
terminallog: '终端日志',
status: '状态',//"可用"
option: '操作',//"操作",
host: '主机',

View File

@@ -566,6 +566,15 @@ const en = {
success: 'Success',
fail: 'Fail'
},
operationlog: {
operationlog: 'Operation Log',
id : 'ID',
username: 'User',
operation: 'Operation',
type: 'Type',
createDate: 'CreateDate',
ip: "IP"
},
mib:{
mib:'Mib',
fileName:'FileName',

View File

@@ -68,7 +68,7 @@
label:i18n.t('alert.list.expired')
}
],
terminalProtocol:[
protocol:[
{
value: 'SSH',
label: i18n.t('config.terminallog.SSH')

View File

@@ -85,6 +85,7 @@
</div>-->
<template v-else-if="item.prop == 'labels'">
<el-tag @click="showTagDetail(scope.row.labels, key)"
:key="key"
:class="{'link': key == 'asset' || key == 'endpoint' || key == 'project' || key == 'module' || key == 'datacenter'}"
v-if="key != 'alertname' && key != 'severity'"
:type="tagType(key)"

View File

@@ -27,6 +27,9 @@
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="account-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('operationlog')" id="account-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<div class="content-right">

View File

@@ -57,6 +57,9 @@
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="dc-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('operationlog')" id="account-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<!--dc table start-->

View File

@@ -27,6 +27,9 @@
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="mib-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('operationlog')" id="account-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<div class="content-right">

View File

@@ -27,6 +27,9 @@
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="modeel-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('operationlog')" id="account-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<div class="content-right">

View File

@@ -0,0 +1,291 @@
<style scoped>
.operationlog {
height: 100%;
}
</style>
<template>
<div class="operationlog">
<div class="content-left">
<div class="sidebar-title">{{$t('overall.config')}}</div>
<div class="sidebar-info">
<div class="sidebar-info-item sidebar-info-top" @click="jumpTo('account')" id="prom-jump-account">
{{$t('config.account.account')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('promServer')" id="account-jump-promserver">
{{$t('config.promServer.promServerList')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('dc')" id="operation-jump-dc">
{{$t('config.dc.dc')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('model')" id="operation-jump-model">
{{$t('config.model.model')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('mib')" id="operation-jump-mib">
{{$t('config.mib.mib')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('system')" id="operation-jump-system">
{{$t('config.system.system')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="operation-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item sidebar-info-item-active" @click="jumpTo('operationlog')" id="operation-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<div class="content-right">
<div class="top-tools">
<div></div>
<div>
<div class="top-tool-search float-right">
<search-input :searchMsg="searchMsg" @search="search"></search-input>
</div>
</div>
</div>
<el-table
class="nz-table"
:data="tableData"
border
ref="operationLogTable"
:height="$tableHeight.normal"
v-scrollBar:el-table
style="width: 100%;">
<el-table-column
:resizable="false"
v-for="(item, index) in tablelable"
v-if="item.show"
:width="item.width"
:key="`col-${index}`"
:label="item.label"
>
<template slot-scope="scope" :column="item">
<span v-if="item.prop == 'lang'">
{{scope.row[item.prop] == 'en' ? 'English' : ''}}
{{scope.row[item.prop] == 'zh' ? '中文' : ''}}
{{scope.row[item.prop] == 'ru' ? 'русский' : ''}}
</span>
<span v-else>{{scope.row[item.prop]}}</span>
</template>
</el-table-column>
<!-- <el-table-column width="28">-->
<!-- <template slot="header" slot-scope="scope">-->
<!-- <span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear">-->
<!-- <i class="nz-icon nz-icon-gear"></i>-->
<!-- </span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
<button class="to-top" v-show="showTopBtn" @click="$toTop"><i class="nz-icon nz-icon-top"></i></button>
</div>
<element-set
v-clickoutside="elementsetHide"
:dropCol="dropCol"
@tablelable="tablelabelEmit"
:table-title="tableTitle"
ref="elementset"
></element-set>
</div>
</template>
<script>
import bus from '../../../libs/bus';
export default {
name: "oparetionlog",
data() {
return {
tableId: 'operationLogTable', //需要分页的table的id用于记录每页数量
showTopBtn: false,
rightBox: { //弹出框相关
show: false,
isEdit: false, //false查看true编辑
title: ''
},
rightBoxResize: { //resize弹出框相关
show: false,
isAdd: false, //falsetrueresize
title: ''
},
rightBoxDownload: { //下载弹出框相关
show: false,
isAdd: false, //falsetrueresize
title: ''
},
rightBoxUpload: { //上传弹出框相关
show: false,
isAdd: false, //falsetrueresize
title: ''
},
pageObj: {
pageNo: 1,
pageSize: 20,
total: 0
},
tableTitle: [
{
label: this.$t("config.operationlog.id"),
prop: 'id',
show: true,
width: 80
}, {
label: this.$t('config.operationlog.username'),
prop: 'username',
show: true,
},
{
label: this.$t('config.operationlog.ip'),
prop: 'ip',
show: true,
},
{
label: this.$t('config.operationlog.operation'),
prop: 'operation',
show: true,
},
{
label: this.$t('config.operationlog.type'),
prop: 'type',
show: true,
},
{
label: this.$t('config.operationlog.createDate'),
prop: 'createDate',
show: true,
}
],
tablelable: [],
dropCol: [],
tableData: [],
searchMsg: { //给搜索框子组件传递的信息
zheze_none: true,
searchLabelList: [
{
id: 11,
name: this.$t('config.operationlog.type'),
type: 'input',
label: 'type',
disabled: false
},{
id: 12,
name: this.$t('config.operationlog.username'),
type: 'input',
label: 'username',
disabled: false
},{
id: 13,
name: this.$t('config.operationlog.operation'),
type: 'input',
label: 'operation',
disabled: false
}
],
},
searchLabel: {}, //搜索参数
}
},
methods: {
elementsetHide() {
//悬浮点击空白隐藏
this.$refs.elementset.elementsetHide();
},
tablelabelEmit(data) {
//获取子组件传过来的参数
this.$store.commit('setHeaderTable', data);
this.tablelable = data;
},
getTableData: function () {
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo);
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
this.$get('sys/log/list', this.searchLabel).then(response => {
if (response.code === 200) {
// for (let i = 0; i < response.data.list.length; i++) {
// response.data.list[i].status = response.data.list[i].status + "";
// }
this.tableData = response.data.list;
this.pageObj.total = response.data.total
}
})
},
jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({
path: "/" + data,
query: {
t: +new Date()
}
});
},
toEditReceiver: function (item) {
if (!item.isEdit) {
//如果不在编辑状态,那么其他项如果有改动,则还原改动,最后开始编辑
this.blurEditReceiver();
item.isEdit = true;
} else {
//如果已在编辑状态判断name是否有变更有变更则发请求
if (item.name != item.oldName) {
if (this.updateReceiverName(item) == 200) {
item.isEdit = false;
}
} else {
item.errorMessage = '';
item.isEdit = false;
}
}
},
pageNo(val) {
this.pageObj.pageNo = val;
this.getTableData();
},
pageSize(val) {
this.pageObj.pageSize = val;
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val);
this.getTableData();
},
search: function (searchObj) {
this.searchLabel = {};
this.pageObj.pageNo = 1;
for (let item in searchObj) {
if (searchObj[item]) {
this.$set(this.searchLabel, item, searchObj[item]);
}
}
this.getTableData();
}
},
computed: {
isCurrentUser() {
return function(username) {
return localStorage.getItem('nz-username') == username;
}
}
},
mounted() {
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize && pageSize != 'undefined') {
this.pageObj.pageSize = pageSize
}
this.getTableData();
this.$nextTick(() => {
//绑定滚动条事件控制top按钮
let el = this.$refs.operationLogTable.$el.querySelector(".el-table__body-wrapper");
if (el._ps_) {
el.addEventListener("ps-scroll-y", () => {
if (el._ps_.scrollbarYTop > 50) {
this.showTopBtn = true;
} else {
this.showTopBtn = false;
}
});
}
});
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
: this.tableTitle;
this.dropCol = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
: this.tableTitle;
}
}
</script>

View File

@@ -27,6 +27,9 @@
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="prom-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('operationlog')" id="account-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<div class="content-right">

View File

@@ -22,6 +22,9 @@
<div class="sidebar-info-item" @click="jumpTo('terminallog')" id="system-jump-terminallog">
{{$t('config.terminallog.terminallog')}}
</div>
<div class="sidebar-info-item" @click="jumpTo('operationlog')" id="account-jump-operation">
{{$t('config.operationlog.operationlog')}}
</div>
</div>
</div>
<div class="content-right system-tabs">
@@ -54,7 +57,7 @@
<el-form-item :label="$t('config.system.basic.timezone')" prop="timezone">
<!-- <el-input v-model.number="basic.timezone" ></el-input>-->
<el-select v-model="basic.timezone">
<el-option v-for="(item,index) in timezoneOption" :label="item.label" :value="item.value"></el-option>
<el-option v-for="(item,index) in timezoneOption" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>

View File

@@ -74,13 +74,13 @@
<span v-else>{{scope.row[item.prop]}}</span>
</template>
</el-table-column>
<el-table-column width="28">
<template slot="header" slot-scope="scope">
<span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear">
<i class="nz-icon nz-icon-gear"></i>
</span>
</template>
</el-table-column>
<!-- <el-table-column width="28">-->
<!-- <template slot="header" slot-scope="scope">-->
<!-- <span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear">-->
<!-- <i class="nz-icon nz-icon-gear"></i>-->
<!-- </span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
<button class="to-top" v-show="showTopBtn" @click="$toTop"><i class="nz-icon nz-icon-top"></i></button>
@@ -200,8 +200,8 @@
// {
// id: 10,
// name: this.$t('config.terminallog.protocol'),
// type: 'selectString',
// label: 'terminalProtocol',
// type: 'selectType',
// label: 'protocol',
// disabled: false
// },
{
@@ -235,27 +235,27 @@
}
},
methods: {
elementsetShow(s, e) {
var eventfixed = {
shezhi: 0,
screen: 0
};
eventfixed[s] = 1;
e.preventDefault();
this.$store.commit('setHeaderTable', this.tablelable);
this.$store.commit('setEventfixed', eventfixed);
const h = document.documentElement.clientHeight;
const w = document.documentElement.clientWidth;
const dw = this.$refs.elementset.$el.offsetWidth;
const dh = this.$refs.elementset.$el.offsetHeight;
let positionx =
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
let positiony =
e.clientY + dh <= h - 10
? e.clientY + 20
: e.clientY + 20 - (e.clientY + dh - h);
this.$store.commit('setPosition', {positionx, positiony});
},
// elementsetShow(s, e) {
// var eventfixed = {
// shezhi: 0,
// screen: 0
// };
// eventfixed[s] = 1;
// e.preventDefault();
// this.$store.commit('setHeaderTable', this.tablelable);
// this.$store.commit('setEventfixed', eventfixed);
// const h = document.documentElement.clientHeight;
// const w = document.documentElement.clientWidth;
// const dw = this.$refs.elementset.$el.offsetWidth;
// const dh = this.$refs.elementset.$el.offsetHeight;
// let positionx =
// e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
// let positiony =
// e.clientY + dh <= h - 10
// ? e.clientY + 20
// : e.clientY + 20 - (e.clientY + dh - h);
// this.$store.commit('setPosition', {positionx, positiony});
// },
elementsetHide() {
//悬浮点击空白隐藏
this.$refs.elementset.elementsetHide();

View File

@@ -72,6 +72,10 @@ export default new Router({
path: '/terminallog',
component: resolve => require(['../components/page/config/terminallog.vue'], resolve),
},
{
path: '/operationlog',
component: resolve => require(['../components/page/config/operationlog.vue'], resolve),
},
{
path: '/mib',
component: resolve => require(['../components/page/config/mib.vue'], resolve),