feat: 优化关系图
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -365,102 +365,102 @@ export default {
|
||||
}
|
||||
this.$get('/stat/rel', params).then(res => {
|
||||
this.loading = false
|
||||
console.log(res)
|
||||
const parentId = 'asset-1' || this.chartInfo.id
|
||||
res = {
|
||||
msg: 'success',
|
||||
code: 200,
|
||||
data: {
|
||||
nodes: [{
|
||||
id: 'asset-1',
|
||||
type: 'asset',
|
||||
category: 'asset',
|
||||
name: 'dddeee',
|
||||
hasChildren: false,
|
||||
alert: [{
|
||||
priority: 'P2',
|
||||
num: 7
|
||||
}, {
|
||||
priority: 'P3',
|
||||
num: 5
|
||||
}]
|
||||
}, {
|
||||
id: 'endpoint-1',
|
||||
type: 'endpoint',
|
||||
category: 'endpoint',
|
||||
name: 'ddd',
|
||||
hasChildren: true,
|
||||
alert: [{
|
||||
priority: 'P3',
|
||||
num: 1
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: 'asset-2',
|
||||
type: 'dc',
|
||||
category: 'asset',
|
||||
name: 'ddd',
|
||||
hasChildren: false,
|
||||
alert: [{
|
||||
priority: 'P1',
|
||||
num: 10
|
||||
}]
|
||||
}, {
|
||||
id: 'endpoint-2',
|
||||
type: 'project',
|
||||
category: 'endpoint',
|
||||
name: 'ddd',
|
||||
hasChildren: true,
|
||||
alert: [{
|
||||
priority: 'P1',
|
||||
num: 30
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: 'asset-3',
|
||||
type: 'module',
|
||||
category: 'asset',
|
||||
name: 'ddd',
|
||||
hasChildren: false,
|
||||
alert: [{
|
||||
priority: 'P1',
|
||||
num: 10
|
||||
}]
|
||||
}, {
|
||||
id: 'endpoint-3',
|
||||
type: 'endpoint',
|
||||
category: 'endpoint',
|
||||
name: 'ddd',
|
||||
hasChildren: true,
|
||||
alert: [{
|
||||
priority: 'P3',
|
||||
num: 10
|
||||
}]
|
||||
}
|
||||
],
|
||||
links: [{
|
||||
source: 'asset-1',
|
||||
target: 'endpoint-1'
|
||||
},
|
||||
{
|
||||
source: 'asset-1',
|
||||
target: 'endpoint-2'
|
||||
},
|
||||
{
|
||||
source: 'asset-1',
|
||||
target: 'endpoint-3'
|
||||
},
|
||||
{
|
||||
source: 'asset-1',
|
||||
target: 'asset-2'
|
||||
},
|
||||
{
|
||||
source: 'asset-1',
|
||||
target: 'asset-3'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
console.log(this.chartInfo,this.chartInfo.id)
|
||||
const parentId = this.chartInfo.linkType + '-' + this.chartInfo.id
|
||||
// res = {
|
||||
// msg: 'success',
|
||||
// code: 200,
|
||||
// data: {
|
||||
// nodes: [{
|
||||
// id: 'asset-1',
|
||||
// type: 'asset',
|
||||
// category: 'asset',
|
||||
// name: 'dddeee',
|
||||
// hasChildren: false,
|
||||
// alert: [{
|
||||
// priority: 'P2',
|
||||
// num: 7
|
||||
// }, {
|
||||
// priority: 'P3',
|
||||
// num: 5
|
||||
// }]
|
||||
// }, {
|
||||
// id: 'endpoint-1',
|
||||
// type: 'endpoint',
|
||||
// category: 'endpoint',
|
||||
// name: 'ddd',
|
||||
// hasChildren: true,
|
||||
// alert: [{
|
||||
// priority: 'P3',
|
||||
// num: 1
|
||||
// }]
|
||||
// },
|
||||
// {
|
||||
// id: 'asset-2',
|
||||
// type: 'dc',
|
||||
// category: 'asset',
|
||||
// name: 'ddd',
|
||||
// hasChildren: false,
|
||||
// alert: [{
|
||||
// priority: 'P1',
|
||||
// num: 10
|
||||
// }]
|
||||
// }, {
|
||||
// id: 'endpoint-2',
|
||||
// type: 'project',
|
||||
// category: 'endpoint',
|
||||
// name: 'ddd',
|
||||
// hasChildren: true,
|
||||
// alert: [{
|
||||
// priority: 'P1',
|
||||
// num: 30
|
||||
// }]
|
||||
// },
|
||||
// {
|
||||
// id: 'asset-3',
|
||||
// type: 'module',
|
||||
// category: 'asset',
|
||||
// name: 'ddd',
|
||||
// hasChildren: false,
|
||||
// alert: [{
|
||||
// priority: 'P1',
|
||||
// num: 10
|
||||
// }]
|
||||
// }, {
|
||||
// id: 'endpoint-3',
|
||||
// type: 'endpoint',
|
||||
// category: 'endpoint',
|
||||
// name: 'ddd',
|
||||
// hasChildren: true,
|
||||
// alert: [{
|
||||
// priority: 'P3',
|
||||
// num: 10
|
||||
// }]
|
||||
// }
|
||||
// ],
|
||||
// links: [{
|
||||
// source: 'asset-1',
|
||||
// target: 'endpoint-1'
|
||||
// },
|
||||
// {
|
||||
// source: 'asset-1',
|
||||
// target: 'endpoint-2'
|
||||
// },
|
||||
// {
|
||||
// source: 'asset-1',
|
||||
// target: 'endpoint-3'
|
||||
// },
|
||||
// {
|
||||
// source: 'asset-1',
|
||||
// target: 'asset-2'
|
||||
// },
|
||||
// {
|
||||
// source: 'asset-1',
|
||||
// target: 'asset-3'
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
res.data.nodes.forEach(item => {
|
||||
item.parentId = parentId
|
||||
if (item.id === parentId) {
|
||||
@@ -607,7 +607,7 @@ export default {
|
||||
arr.push(alert.priority)
|
||||
})
|
||||
this.severityDataWeight.forEach(severity => {
|
||||
if (arr.indexOf(severity.name) !== -1 && !color) {
|
||||
if (arr.indexOf(severity.name) !== -1 && !color && severity.num > 0) {
|
||||
color = severity.color
|
||||
}
|
||||
})
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
||||
<el-dropdown-item v-has="'dc_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'dc_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'asset_add'" :command="['topology', scope.row, 'dc']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'asset_add'" :command="['topology', scope.row, 'datacenter']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user