2021-04-08 20:28:54 +08:00
|
|
|
|
<template>
|
2021-11-01 17:23:01 +08:00
|
|
|
|
<nz-bottom-data-list
|
2021-10-11 14:05:07 +08:00
|
|
|
|
:showTitle='showTitle'
|
2021-11-29 16:19:13 +08:00
|
|
|
|
:obj='obj'
|
|
|
|
|
|
:targetTab="targetTab"
|
2021-04-14 18:35:42 +08:00
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
|
:layout="['searchInput', 'elementSet']"
|
|
|
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
|
:tabs="tabs"
|
2021-04-23 20:06:58 +08:00
|
|
|
|
@search="search"
|
2021-04-14 18:35:42 +08:00
|
|
|
|
@changeTab="changeTab"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-slot:title><span :title="obj.name">{{obj.name}}</span></template>
|
|
|
|
|
|
<template v-slot>
|
|
|
|
|
|
<terminal-log-table
|
|
|
|
|
|
ref="dataTable"
|
2022-03-09 14:26:11 +08:00
|
|
|
|
:orderByFa="'id'"
|
2022-03-25 15:40:05 +08:00
|
|
|
|
v-my-loading="tools.loading"
|
2021-10-22 19:39:49 +08:00
|
|
|
|
:loading="tools.loading"
|
2021-04-14 18:35:42 +08:00
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:height="subTableHeight"
|
|
|
|
|
|
:now-time="nowTime"
|
|
|
|
|
|
:table-data="tableData"
|
2021-06-25 14:09:18 +08:00
|
|
|
|
:terminaLogTab="true"
|
2021-04-14 18:35:42 +08:00
|
|
|
|
@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-10-11 14:05:07 +08:00
|
|
|
|
import detailViewRightMixin from '@/components/common/mixin/detailViewRightMixin'
|
2021-04-08 20:28:54 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'terminalLogTab',
|
2021-10-11 14:05:07 +08:00
|
|
|
|
mixins: [dataListMixin, subDataListMixin, detailViewRightMixin],
|
2021-04-14 18:35:42 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
nzBottomDataList,
|
|
|
|
|
|
terminalLogTable
|
|
|
|
|
|
},
|
2021-06-21 19:12:25 +08:00
|
|
|
|
props: {
|
2021-10-11 14:05:07 +08:00
|
|
|
|
obj: Object,
|
|
|
|
|
|
showTitle: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: true
|
|
|
|
|
|
}
|
2021-06-21 19:12:25 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
obj (n) {
|
|
|
|
|
|
this.searchLabel = { userId: n.id }
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
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,
|
2021-04-23 20:06:58 +08:00
|
|
|
|
name: this.$t('config.terminallog.loginHost'),
|
2021-04-08 20:28:54 +08:00
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'host',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 12,
|
2021-04-23 20:06:58 +08:00
|
|
|
|
name: this.$t('config.terminallog.loginUser'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'loginUser',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 13,
|
2022-06-17 10:39:36 +08:00
|
|
|
|
name: this.$t('ping.sourceIp'),
|
2021-04-23 20:06:58 +08:00
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'remoteAddr',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 14,
|
|
|
|
|
|
name: this.$t('config.terminallog.sourceUser'),
|
2021-04-08 20:28:54 +08:00
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'username',
|
|
|
|
|
|
disabled: false
|
2021-04-23 20:06:58 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
id: 15,
|
|
|
|
|
|
name: this.$t('config.terminallog.uuid'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'uuid',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 16,
|
2022-06-16 15:58:17 +08:00
|
|
|
|
name: this.$t('webshell.protocol'),
|
2021-04-23 20:06:58 +08:00
|
|
|
|
type: 'selectString',
|
|
|
|
|
|
label: 'protocol',
|
2021-09-27 18:06:41 +08:00
|
|
|
|
readonly: true,
|
2021-04-23 20:06:58 +08:00
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 17,
|
2022-06-16 15:58:17 +08:00
|
|
|
|
name: this.$t('overall.state'),
|
2021-04-23 20:06:58 +08:00
|
|
|
|
type: 'terminalStatus',
|
|
|
|
|
|
label: 'state',
|
2021-09-27 18:06:41 +08:00
|
|
|
|
readonly: true,
|
2021-04-23 20:06:58 +08:00
|
|
|
|
disabled: false
|
2021-04-08 20:28:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
2021-04-22 17:43:13 +08:00
|
|
|
|
nowTime: '',
|
2021-04-22 18:03:56 +08:00
|
|
|
|
searchLabel: { userId: this.obj.id }
|
2021-04-08 20:28:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2021-06-30 17:56:37 +08:00
|
|
|
|
getTableData (params) {
|
|
|
|
|
|
if (params && Object.keys(params).length > 0) {
|
|
|
|
|
|
for (const key in params) {
|
|
|
|
|
|
this.$set(this.searchLabel, key, params[key])
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-10-13 18:24:09 +08:00
|
|
|
|
if (this.orderBy) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', this.orderBy)
|
2022-03-03 17:35:42 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
delete this.searchLabel.orderBy
|
2021-10-13 18:24:09 +08:00
|
|
|
|
}
|
2021-06-30 17:56:37 +08:00
|
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
|
|
|
|
|
this.tools.loading = true
|
|
|
|
|
|
if (this.obj) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'userId', this.obj.id)
|
2021-04-08 20:28:54 +08:00
|
|
|
|
}
|
2021-06-30 17:56:37 +08:00
|
|
|
|
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
|
2021-04-08 20:28:54 +08:00
|
|
|
|
this.tools.loading = false
|
|
|
|
|
|
if (response.code === 200) {
|
2021-06-30 17:56:37 +08:00
|
|
|
|
for (let i = 0; i < response.data.list.length; i++) {
|
|
|
|
|
|
response.data.list[i].status = response.data.list[i].status + ''
|
|
|
|
|
|
}
|
2021-04-08 20:28:54 +08:00
|
|
|
|
this.tableData = response.data.list
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
2022-03-07 09:37:27 +08:00
|
|
|
|
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
|
2021-04-08 20:28:54 +08:00
|
|
|
|
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) {
|
2022-06-16 15:58:17 +08:00
|
|
|
|
this.$message.success(this.$t('overall.result.success'))
|
2021-04-08 20:28:54 +08:00
|
|
|
|
this.bottomBox.showSubList = false
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(this.$t('config.terminallog.killErrorTip'))
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|