2021-04-08 20:28:54 +08:00
|
|
|
|
<template>
|
2021-04-14 18:35:42 +08:00
|
|
|
|
<nz-bottom-data-list
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
|
:layout="['searchInput', 'elementSet']"
|
|
|
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
|
:tabs="tabs"
|
|
|
|
|
|
@changeTab="changeTab"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-slot:title><span :title="obj.name">{{obj.name}}</span></template>
|
|
|
|
|
|
<template v-slot>
|
|
|
|
|
|
<terminal-log-table
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
v-loading="tools.loading"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:height="subTableHeight"
|
|
|
|
|
|
:now-time="nowTime"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
@del="del"
|
|
|
|
|
|
@edit="edit"
|
|
|
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
|
@reload="getTableData"
|
|
|
|
|
|
@selectionChange="selectionChange"></terminal-log-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
|
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</nz-bottom-data-list>
|
2021-04-08 20:28:54 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-04-14 18:35:42 +08:00
|
|
|
|
import dataListMixin from '@/components/common/mixin/dataList'
|
|
|
|
|
|
import subDataListMixin from '@/components/common/mixin/subDataList'
|
|
|
|
|
|
import nzBottomDataList from '@/components/common/bottomBox/nzBottomDataList'
|
|
|
|
|
|
import terminalLogTable from '@/components/common/table/settings/terminalLogTable'
|
2021-04-08 20:28:54 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'terminalLogTab',
|
2021-04-14 18:35:42 +08:00
|
|
|
|
mixins: [dataListMixin, subDataListMixin],
|
|
|
|
|
|
components: {
|
|
|
|
|
|
nzBottomDataList,
|
|
|
|
|
|
terminalLogTable
|
|
|
|
|
|
},
|
2021-04-08 20:28:54 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2021-04-14 18:35:42 +08:00
|
|
|
|
url: 'terminal/session',
|
2021-04-08 20:28:54 +08:00
|
|
|
|
tableId: 'terminalLogTable', // 需要分页的table的id,用于记录每页数量
|
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: 11,
|
|
|
|
|
|
name: this.$t('config.terminallog.host'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'host',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 12,
|
|
|
|
|
|
name: this.$t('config.terminallog.user'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'username',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
2021-04-22 17:43:13 +08:00
|
|
|
|
nowTime: '',
|
|
|
|
|
|
searchLabel:{userId:this.obj.id}
|
2021-04-08 20:28:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getTableData () {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
...this.searchLabel,
|
|
|
|
|
|
pageNo: this.pageObj.pageNo,
|
|
|
|
|
|
pageSize: this.pageObj.pageSize
|
|
|
|
|
|
}
|
2021-04-14 18:35:42 +08:00
|
|
|
|
this.$get(this.url, params).then(response => {
|
2021-04-08 20:28:54 +08:00
|
|
|
|
this.tools.loading = false
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.tableData = response.data.list
|
|
|
|
|
|
this.nowTime = this.utcTimeToTimezoneStr(response.time)
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
if (!this.scrollbarWrap) {
|
|
|
|
|
|
this.$nextTick(() => {
|
2021-04-14 18:35:42 +08:00
|
|
|
|
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
|
2021-04-08 20:28:54 +08:00
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
shutdown (record) {
|
|
|
|
|
|
this.$confirm(this.$t('tip.killTerm'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$put('/terminal/kill', { uuid: record.uuid }).then(res => {
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.$message.success(this.$t('config.terminallog.success'))
|
|
|
|
|
|
this.bottomBox.showSubList = false
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(this.$t('config.terminallog.killErrorTip'))
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|