2021-04-13 20:33:12 +08:00
|
|
|
<template>
|
|
|
|
|
<el-table
|
|
|
|
|
id="roleTable"
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:height="height"
|
|
|
|
|
border
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
@selection-change="selectionChange"
|
2021-05-25 15:37:33 +08:00
|
|
|
@row-dblclick="(row)=>{showBottomBox(row.status==0 ? 'monitorTab' : 'cmdTab', row)}"
|
2021-04-13 20:33:12 +08:00
|
|
|
>
|
|
|
|
|
<el-table-column
|
|
|
|
|
:resizable="false"
|
|
|
|
|
align="center"
|
|
|
|
|
type="selection"
|
|
|
|
|
width="55">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
v-for="(item, index) in customTableTitle"
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
:resizable="true"
|
2021-09-17 11:52:41 +08:00
|
|
|
:sortable="item.sortable"
|
2021-04-13 20:33:12 +08:00
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
class="data-column"
|
|
|
|
|
>
|
|
|
|
|
<template slot="header">
|
2021-05-25 17:58:38 +08:00
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
<span v-if="item.prop === 'time'">{{utcTimeToTimezoneStr(scope.row[item.prop])}}</span>
|
2021-09-17 11:52:41 +08:00
|
|
|
<template v-else-if="item.prop === 'state'">
|
2021-04-13 20:33:12 +08:00
|
|
|
<span>{{getStatusText(scope.row.status)}}</span>
|
|
|
|
|
</template>
|
2021-06-10 11:38:22 +08:00
|
|
|
<template v-else-if="item.prop === 'uuid'">
|
|
|
|
|
<el-popover
|
|
|
|
|
placement="right-start"
|
|
|
|
|
width="200"
|
|
|
|
|
trigger="hover"
|
|
|
|
|
:content="scope.row.uuid">
|
|
|
|
|
<span slot="reference">{{scope.row.uuid.substring(0, 8).toUpperCase()}}</span>
|
|
|
|
|
</el-popover>
|
2021-04-13 20:33:12 +08:00
|
|
|
</template>
|
2021-09-17 11:52:41 +08:00
|
|
|
<span v-else-if="item.prop === 'sourceIp'">{{scope.row.remoteAddr}}</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
<template v-else-if="item.prop === 'remote'">
|
|
|
|
|
<span>{{getRemoteText(scope.row)}}</span>
|
|
|
|
|
</template>
|
2021-05-10 13:49:27 +08:00
|
|
|
<template v-else-if="item.prop === 'startTime'">
|
|
|
|
|
<span> {{utcTimeToTimezoneStr(scope.row.startTime)}}</span>
|
|
|
|
|
</template>
|
2021-04-13 20:33:12 +08:00
|
|
|
<template v-else-if="item.prop === 'duration'">
|
|
|
|
|
<el-tooltip :disabled="!scope.row.status" effect="light" placement="right">
|
|
|
|
|
<div slot="content">
|
|
|
|
|
{{$t('config.terminallog.endTime')}}<br/>
|
2021-05-10 13:49:27 +08:00
|
|
|
{{utcTimeToTimezoneStr(scope.row.endTime)}}
|
2021-04-13 20:33:12 +08:00
|
|
|
</div>
|
|
|
|
|
<span>{{getDuration(scope.row)}}</span>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'authType'">
|
2021-04-27 20:31:54 +08:00
|
|
|
<span v-if="scope.row.authType == 1">{{$t('config.terminallog.pin')}}</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
<span v-else-if="scope.row.authType == 2">{{$t('config.terminallog.key')}}</span>
|
|
|
|
|
</template>
|
2021-07-09 15:35:58 +08:00
|
|
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
|
|
|
|
<span v-else>-</span>
|
2021-04-13 20:33:12 +08:00
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
2021-06-25 14:09:18 +08:00
|
|
|
v-if="terminalLogTab || terminalLog"
|
2021-04-13 20:33:12 +08:00
|
|
|
:resizable="false"
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
fixed="right">
|
|
|
|
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
<div slot-scope="scope" class="table-operation-items">
|
|
|
|
|
<template v-if="scope.row.status == 0">
|
2021-05-12 19:36:51 +08:00
|
|
|
<button :title="$t('config.terminallog.monitor.monitor')" class="table-operation-item" @click="showBottomBox('monitorTab', scope.row)"><i class="nz-icon nz-icon-JC"></i></button>
|
2021-04-13 20:33:12 +08:00
|
|
|
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
|
|
|
|
|
<div class="table-operation-item table-operation-item--more">
|
2021-05-27 13:53:42 +08:00
|
|
|
<i class="nz-icon nz-icon-more3"></i>
|
2021-04-13 20:33:12 +08:00
|
|
|
</div>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
<el-dropdown-item :command="['shutdown', scope.row]"><i class="nz-icon nz-icon-ZD"></i><span class="operation-dropdown-text">Kill</span></el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
2021-04-29 22:24:38 +08:00
|
|
|
<button class="table-operation-item" @click="showBottomBox('cmdTab', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
2021-04-13 20:33:12 +08:00
|
|
|
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
|
|
|
|
|
<div class="table-operation-item table-operation-item--more">
|
2021-05-27 15:14:14 +08:00
|
|
|
<i class="nz-icon nz-icon-more3"></i>
|
2021-04-13 20:33:12 +08:00
|
|
|
</div>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-04-29 22:24:38 +08:00
|
|
|
<el-dropdown-item :command="['recordTab', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('config.terminallog.record.record')}}</span></el-dropdown-item>
|
2021-04-13 20:33:12 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { terminalLog } from '@/components/common/js/constants'
|
|
|
|
|
import { calcDurationByStringTimeB } from '@/components/common/js/tools'
|
|
|
|
|
import table from '@/components/common/mixin/table'
|
|
|
|
|
export default {
|
2021-06-17 11:24:38 +08:00
|
|
|
name: 'terminalLogTable',
|
2021-04-13 20:33:12 +08:00
|
|
|
mixins: [table],
|
2021-05-12 19:36:51 +08:00
|
|
|
props: {
|
2021-06-25 14:09:18 +08:00
|
|
|
nowTime: {},
|
|
|
|
|
terminalLogTab: Boolean,
|
|
|
|
|
terminalLog: Boolean
|
2021-05-12 19:36:51 +08:00
|
|
|
},
|
2021-04-13 20:33:12 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
tableTitle: [
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.id'),
|
|
|
|
|
prop: 'id',
|
|
|
|
|
show: true,
|
2021-09-17 11:52:41 +08:00
|
|
|
width: 80,
|
|
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}, {
|
2021-05-14 17:51:02 +08:00
|
|
|
label: this.$t('config.terminallog.SessionID'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'uuid',
|
2021-07-22 10:00:29 +08:00
|
|
|
minWidth: 200,
|
2021-04-13 20:33:12 +08:00
|
|
|
show: true
|
|
|
|
|
}, {
|
2021-05-14 17:51:02 +08:00
|
|
|
label: this.$t('config.terminallog.username'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'username',
|
2021-07-22 10:00:29 +08:00
|
|
|
minWidth: 200,
|
2021-04-13 20:33:12 +08:00
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.source'),
|
2021-09-17 11:52:41 +08:00
|
|
|
prop: 'sourceIp',
|
2021-07-28 14:12:58 +08:00
|
|
|
minWidth: 100,
|
2021-09-17 11:52:41 +08:00
|
|
|
show: true,
|
|
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.remote'),
|
|
|
|
|
prop: 'remote',
|
|
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.protocol'),
|
|
|
|
|
prop: 'protocol',
|
|
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.startTime'),
|
|
|
|
|
prop: 'startTime',
|
2021-07-28 14:12:58 +08:00
|
|
|
minWidth: 100,
|
2021-04-13 20:33:12 +08:00
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.duration'),
|
|
|
|
|
prop: 'duration',
|
|
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-05-14 17:51:02 +08:00
|
|
|
label: this.$t('config.terminallog.authtype'),
|
2021-04-13 20:33:12 +08:00
|
|
|
prop: 'authType',
|
2021-08-02 15:41:43 +08:00
|
|
|
minWidth: 100,
|
2021-04-13 20:33:12 +08:00
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: this.$t('config.terminallog.status'), // killusername鼠标悬停形式
|
2021-09-17 11:52:41 +08:00
|
|
|
prop: 'state',
|
2021-04-13 20:33:12 +08:00
|
|
|
show: true,
|
2021-09-17 11:52:41 +08:00
|
|
|
width: 150,
|
|
|
|
|
sortable: 'custom'
|
2021-04-13 20:33:12 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
getStatusText () {
|
|
|
|
|
return function (status) {
|
|
|
|
|
return terminalLog.status[status]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getRemoteText () {
|
|
|
|
|
return function (record) {
|
|
|
|
|
return `${record.loginUser}@${record.host}:${record.port}`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getDuration () {
|
|
|
|
|
return function (record) {
|
|
|
|
|
if (record.endTime) {
|
|
|
|
|
return calcDurationByStringTimeB(record.startTime, record.endTime)
|
|
|
|
|
}
|
2021-05-13 09:34:32 +08:00
|
|
|
return ''
|
2021-04-13 20:33:12 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|