CN-1351 fix: 实体列表、详情和graph的tag颜色从接口获取

This commit is contained in:
刘洪洪
2023-10-11 15:17:15 +08:00
parent ed9a2c4e1f
commit 5fbab86a80
6 changed files with 42 additions and 11 deletions

View File

@@ -86,7 +86,7 @@
<div class="entity-detail graph-basic-info__block-content">
<div class="graph-tag-list">
<div v-for="ic in $_.get(node, 'myData.tags', [])" :key="ic.value">
<div class="entity-tag graph-tag-item" :class="`entity-tag--level-two-${ic.type}`">
<div class="entity-tag graph-tag-item" :class="`entity-tag--level-two-${ic.type}`" :style="getTagColor(ic.color)">
<span>{{ic.value}}</span>
</div>
</div>
@@ -96,7 +96,7 @@
</template>
<script>
import { copySelectionText, selectElementText } from '@/utils/tools'
import { copySelectionText, selectElementText, getTagColor } from '@/utils/tools'
import { entityType, riskLevelMapping } from '@/utils/constants'
import chartMixin from '@/views/charts2/chart-mixin'
import { dateFormatByAppearance } from '@/utils/date-util'
@@ -174,6 +174,7 @@ export default {
}
},
methods: {
getTagColor,
/** 复制实体名称 */
copyEntityName () {
selectElementText(document.getElementById('entityName'))

View File

@@ -2,7 +2,7 @@ import _ from 'lodash'
import i18n from '@/i18n'
import axios from 'axios'
import { api } from '@/utils/api'
import { entityDetailTags, psiphon3IpType } from '@/utils/constants'
import { entityDefaultColor, entityDetailTags, psiphon3IpType } from '@/utils/constants'
export default class Node {
/*
@@ -91,7 +91,7 @@ export default class Node {
}
})
if (_.isArray(tags.userDefinedTags)) {
_tags = _.concat(_tags, tags.userDefinedTags.map(tag => ({ value: tag.tagValue, type: 'normal' })))
_tags = _.concat(_tags, tags.userDefinedTags.map(tag => ({ value: tag.tagValue, color: tag.knowledgeBase ? tag.knowledgeBase.color : entityDefaultColor })))
}
this.myData.tags = _tags