feat: tool 添加资产发现

This commit is contained in:
zhangyu
2023-05-18 14:07:01 +08:00
parent cbdd88910c
commit 9c3a7a1f2c
3 changed files with 23 additions and 12 deletions

View File

@@ -253,6 +253,7 @@
margin-left: 15px;
}
.nz-select-tag {
color: $--color-text-regular;
.el-select__tags{
max-height: 128px;
overflow-y: auto;
@@ -262,7 +263,7 @@
max-width: 220px;
overflow: hidden;
.el-select__tags-text {
width: calc(100% - 10px);
width: calc(100% - 15px);
display: inline-block;
overflow: hidden;
}

View File

@@ -50,7 +50,9 @@
<div>{{scope.row[item.prop] ? scope.row[item.prop].name : '-'}}</div>
</template>
<template v-else-if="item.prop === 'state'">
<div>{{typeToStr(scope.row[item.prop])}}</div>
<div :class="{'active-icon green-bg':scope.row[item.prop] == 1,'active-icon red-bg':scope.row[item.prop]!= 1}" style="position: relative;display: inline-block;">
</div>
<div style="display: inline-block;">{{typeToStr(scope.row[item.prop])}}</div>
</template>
<template v-else-if="item.prop === 'imported'">
<span v-if="scope.row[item.prop] == 1">{{$t('tip.yes')}}</span>
@@ -115,7 +117,7 @@ export default {
show: true,
minWidth: 150
}, {
label: this.$t('overall.type'),
label: this.$t('overall.SNMP'),
prop: 'state',
show: true,
minWidth: 150
@@ -143,7 +145,9 @@ export default {
typeToStr (type) {
switch (type) {
case 1:
return 'Server'
return 'Success'
default:
return 'Failed'
}
}
}

View File

@@ -112,6 +112,7 @@
ref="dataTable"
:loading="loading"
v-my-loading="loading"
:height="'calc(100% - 80px)'"
:custom-table-title="tools.customTableTitle"
:table-data="tableData"
:api="url"
@@ -335,15 +336,20 @@ export default {
getData () {
const currentId = this.tid
this.$get('/tool/discovery/' + this.tid).then(response => {
if (currentId === this.tid && parseInt(this.process) < 100) {
this.done = response.data.task.done
this.total = response.data.task.total
this.process = response.data.task.process
this.tableData.push(...response.data.list)
// 收到数据loading取消
if (this.tableData.length) {
this.loading = false
if (response.code === 200) {
if (currentId === this.tid && parseInt(this.process) < 100) {
this.done = response.data.task.done
this.total = response.data.task.total
this.process = response.data.task.process
this.tableData.push(...response.data.list)
// 收到数据loading取消
if (this.tableData.length) {
this.loading = false
}
}
}else {
this.$message.error(response.msg || response.error)
this.clearTask()
}
})
},