CN-1273 自定义library增加tag颜色选择功能
This commit is contained in:
@@ -1156,7 +1156,6 @@ height: 100%;
|
|||||||
.el-form {
|
.el-form {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
width: 620px;
|
width: 620px;
|
||||||
|
|
||||||
label {
|
label {
|
||||||
padding-bottom: 6px;
|
padding-bottom: 6px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -1191,6 +1190,7 @@ height: 100%;
|
|||||||
|
|
||||||
.el-input__inner {
|
.el-input__inner {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
padding-left: 22px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1872,3 +1872,24 @@ height:300px !important;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.knowledge-color {
|
||||||
|
display:flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
.knowledge-color__icon {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-right:6px;
|
||||||
|
margin-left:2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
background-color:rgb(119,131,145)
|
||||||
|
}
|
||||||
|
.benign {
|
||||||
|
background-color:rgb(116,159,77)
|
||||||
|
}
|
||||||
|
.malicious {
|
||||||
|
background-color:rgb(226,97,84)
|
||||||
|
}
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ export default {
|
|||||||
this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
|
this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let path = this.$route.path;
|
const path = this.$route.path
|
||||||
if (path.indexOf('panel') > -1 && path.indexOf('linkMonitor') === -1) {
|
if (path.indexOf('panel') > -1 && path.indexOf('linkMonitor') === -1) {
|
||||||
await this.initDropdownList()
|
await this.initDropdownList()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,11 @@
|
|||||||
>
|
>
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="item.prop === 'color'">
|
||||||
|
<div class="knowledge-color">
|
||||||
|
<span class="knowledge-color__icon" :class="colorName(scope.row[item.prop])"></span> <span>{{colorText(scope.row[item.prop])}}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<span v-else>{{scope.row[item.prop] || '-'}}</span>
|
<span v-else>{{scope.row[item.prop] || '-'}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -117,7 +122,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import table from '@/mixins/table'
|
import table from '@/mixins/table'
|
||||||
import { knowledgeBaseCategory, knowledgeBaseSource } from '@/utils/constants'
|
import { knowledgeBaseCategory, knowledgeBaseSource, knowledgeBaseColor } from '@/utils/constants'
|
||||||
export default {
|
export default {
|
||||||
name: 'KnowledgeBaseTableForRow',
|
name: 'KnowledgeBaseTableForRow',
|
||||||
props: {
|
props: {
|
||||||
@@ -153,6 +158,11 @@ export default {
|
|||||||
prop: 'reference',
|
prop: 'reference',
|
||||||
width: 180,
|
width: 180,
|
||||||
show: true
|
show: true
|
||||||
|
}, {
|
||||||
|
label: this.$t('overall.color'),
|
||||||
|
prop: 'color',
|
||||||
|
width: 180,
|
||||||
|
show: true
|
||||||
}, {
|
}, {
|
||||||
label: this.$t('overall.remark'),
|
label: this.$t('overall.remark'),
|
||||||
prop: 'description',
|
prop: 'description',
|
||||||
@@ -189,7 +199,8 @@ export default {
|
|||||||
show: true,
|
show: true,
|
||||||
width: 80
|
width: 80
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
knowledgeBaseColor
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -221,6 +232,18 @@ export default {
|
|||||||
const t = knowledgeBaseSource.find(t => t.value === type)
|
const t = knowledgeBaseSource.find(t => t.value === type)
|
||||||
return t ? t.name : ''
|
return t ? t.name : ''
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
colorText () {
|
||||||
|
return function (color) {
|
||||||
|
const t = knowledgeBaseColor.find(t => t.value === color)
|
||||||
|
return t ? t.label : knowledgeBaseColor[0].label
|
||||||
|
}
|
||||||
|
},
|
||||||
|
colorName () {
|
||||||
|
return function (color) {
|
||||||
|
const t = knowledgeBaseColor.find(t => t.value === color)
|
||||||
|
return t ? t.name : knowledgeBaseColor[0].name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,6 +338,25 @@ export const knowledgeBaseType = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const knowledgeBaseColor = [
|
||||||
|
{
|
||||||
|
label: 'Info',
|
||||||
|
value: 'rgb(119,131,145)',
|
||||||
|
name: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Benign',
|
||||||
|
value: 'rgb(116,159,77)',
|
||||||
|
name: 'benign'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Malicious',
|
||||||
|
value: 'rgb(226,97,84)',
|
||||||
|
name: 'malicious'
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
export const knowledgeBaseCategory = [
|
export const knowledgeBaseCategory = [
|
||||||
{
|
{
|
||||||
name: 'WebSketch',
|
name: 'WebSketch',
|
||||||
@@ -1000,7 +1019,7 @@ export const networkAppPerformanceTabList = [
|
|||||||
label: 'network.countries',
|
label: 'network.countries',
|
||||||
prop: 'countryRegion',
|
prop: 'countryRegion',
|
||||||
queryCycleTotalProp: 'countries',
|
queryCycleTotalProp: 'countries',
|
||||||
dillDownProp: ['client_country_region','server_country_region'],
|
dillDownProp: ['client_country_region', 'server_country_region'],
|
||||||
lineQueryCondition: ['country_region = \'$param\''], // 曲线图:查询条件q
|
lineQueryCondition: ['country_region = \'$param\''], // 曲线图:查询条件q
|
||||||
checked: true,
|
checked: true,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -1009,7 +1028,7 @@ export const networkAppPerformanceTabList = [
|
|||||||
label: 'network.asns',
|
label: 'network.asns',
|
||||||
prop: 'asn',
|
prop: 'asn',
|
||||||
queryCycleTotalProp: 'asns',
|
queryCycleTotalProp: 'asns',
|
||||||
dillDownProp: ['client_asn','server_asn'],
|
dillDownProp: ['client_asn', 'server_asn'],
|
||||||
lineQueryCondition: ['asn = \'$param\''],
|
lineQueryCondition: ['asn = \'$param\''],
|
||||||
checked: true,
|
checked: true,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -1063,7 +1082,7 @@ export const networkAppPerformanceTabList = [
|
|||||||
label: 'network.regions',
|
label: 'network.regions',
|
||||||
prop: 'superAdminArea',
|
prop: 'superAdminArea',
|
||||||
queryCycleTotalProp: 'regions',
|
queryCycleTotalProp: 'regions',
|
||||||
dillDownProp: ['client_super_admin_area','server_super_admin_area'],
|
dillDownProp: ['client_super_admin_area', 'server_super_admin_area'],
|
||||||
lineQueryCondition: ['super_admin_area = \'$param\''],
|
lineQueryCondition: ['super_admin_area = \'$param\''],
|
||||||
checked: false,
|
checked: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -1072,7 +1091,7 @@ export const networkAppPerformanceTabList = [
|
|||||||
label: 'network.cities',
|
label: 'network.cities',
|
||||||
prop: 'adminArea',
|
prop: 'adminArea',
|
||||||
queryCycleTotalProp: 'cities',
|
queryCycleTotalProp: 'cities',
|
||||||
dillDownProp: ['client_admin_area','server_admin_area'],
|
dillDownProp: ['client_admin_area', 'server_admin_area'],
|
||||||
lineQueryCondition: ['admin_area = \'$param\''],
|
lineQueryCondition: ['admin_area = \'$param\''],
|
||||||
checked: false,
|
checked: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -1081,7 +1100,7 @@ export const networkAppPerformanceTabList = [
|
|||||||
label: 'network.isps',
|
label: 'network.isps',
|
||||||
prop: 'isp',
|
prop: 'isp',
|
||||||
queryCycleTotalProp: 'isps',
|
queryCycleTotalProp: 'isps',
|
||||||
dillDownProp: ['client_isp','server_isp'],
|
dillDownProp: ['client_isp', 'server_isp'],
|
||||||
lineQueryCondition: ['isp = \'$param\''],
|
lineQueryCondition: ['isp = \'$param\''],
|
||||||
checked: false,
|
checked: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
|||||||
@@ -471,9 +471,9 @@ export default {
|
|||||||
let checkedGroup = this.customTableTitles.filter(item => item.checked)
|
let checkedGroup = this.customTableTitles.filter(item => item.checked)
|
||||||
let checkedNum = checkedGroup.length
|
let checkedNum = checkedGroup.length
|
||||||
if (columnType === 'dillDown') {
|
if (columnType === 'dillDown') {
|
||||||
if(checkedNum === 1){
|
if (checkedNum === 1) {
|
||||||
return 'auto'
|
return 'auto'
|
||||||
}else if(checkedNum > 1){
|
} else if (checkedNum > 1) {
|
||||||
return '217px'
|
return '217px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ export default {
|
|||||||
name: this.dropDownValue ? this.dropDownValue : ''
|
name: this.dropDownValue ? this.dropDownValue : ''
|
||||||
}
|
}
|
||||||
let url = curTableInCode.url.drilldownList
|
let url = curTableInCode.url.drilldownList
|
||||||
if(this.isDrilldown() || this.tableType === fromRoute.linkMonitor){
|
if (this.isDrilldown() || this.tableType === fromRoute.linkMonitor) {
|
||||||
url = curTableInCode.url.relationTabDrilldownList
|
url = curTableInCode.url.relationTabDrilldownList
|
||||||
const condition = this.getQueryCondition()
|
const condition = this.getQueryCondition()
|
||||||
if (condition) {
|
if (condition) {
|
||||||
@@ -601,8 +601,8 @@ export default {
|
|||||||
this.curPageNum = 1
|
this.curPageNum = 1
|
||||||
this.initDropdownList(prop)
|
this.initDropdownList(prop)
|
||||||
},
|
},
|
||||||
scrollList (prop,tabProp) {
|
scrollList (prop, tabProp) {
|
||||||
const obj = document.getElementById('tabSearchSelectDropdown'+tabProp)
|
const obj = document.getElementById('tabSearchSelectDropdown' + tabProp)
|
||||||
if ((obj.scrollTop + obj.clientHeight === obj.scrollHeight) && obj.scrollHeight !== 0) {
|
if ((obj.scrollTop + obj.clientHeight === obj.scrollHeight) && obj.scrollHeight !== 0) {
|
||||||
this.initDropdownList(prop)
|
this.initDropdownList(prop)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,28 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('overall.color')" prop="color">
|
||||||
|
<el-select v-model="editObject.colorLabel"
|
||||||
|
class="form-select__enable"
|
||||||
|
placeholder=" "
|
||||||
|
popper-class="form-select-popper"
|
||||||
|
size="mini"
|
||||||
|
@change="changeColor"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<div class="knowledge-color">
|
||||||
|
<span class="knowledge-color__icon info" :class="editObject.colorName"></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-for="color in knowledgeBaseColor" :key="color.name">
|
||||||
|
<el-option :value="color.label" >
|
||||||
|
<div class="knowledge-color">
|
||||||
|
<span class="knowledge-color__icon" :class="color.name"></span> <span>{{color.label}}</span>
|
||||||
|
</div>
|
||||||
|
</el-option>
|
||||||
|
</template>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item :label="$t('overall.remark')" prop="description">
|
<el-form-item :label="$t('overall.remark')" prop="description">
|
||||||
<el-input maxlength="255" show-word-limit :rows="4" size='mini' type="textarea" resize='none'
|
<el-input maxlength="255" show-word-limit :rows="4" size='mini' type="textarea" resize='none'
|
||||||
v-model="editObject.description" id="role-box-input-remark"/>
|
v-model="editObject.description" id="role-box-input-remark"/>
|
||||||
@@ -214,7 +236,7 @@
|
|||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { nextTick, reactive, ref } from 'vue'
|
import { nextTick, reactive, ref } from 'vue'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { knowledgeBaseType, storageKey, unitTypes, knowledgeSourceValue, itemListHeight, knowledgeCategoryValue } from '@/utils/constants'
|
import { knowledgeBaseType, storageKey, unitTypes, knowledgeSourceValue, itemListHeight, knowledgeCategoryValue, knowledgeBaseColor } from '@/utils/constants'
|
||||||
import Pagination from '@/components/common/Pagination'
|
import Pagination from '@/components/common/Pagination'
|
||||||
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
@@ -497,6 +519,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
changeColor (label) {
|
||||||
|
const curColorObj = knowledgeBaseColor.find(item => item.label === this.editObject.colorLabel)
|
||||||
|
this.editObject.color = curColorObj.value
|
||||||
|
this.editObject.colorName = curColorObj.name
|
||||||
|
},
|
||||||
tagNameBlur () {
|
tagNameBlur () {
|
||||||
if (!this.tagNameFirstBlur) {
|
if (!this.tagNameFirstBlur) {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate(valid => {
|
||||||
@@ -832,6 +859,7 @@ export default {
|
|||||||
const postData = {
|
const postData = {
|
||||||
name: this.editObject.name,
|
name: this.editObject.name,
|
||||||
category: knowledgeCategoryValue.userDefined,
|
category: knowledgeCategoryValue.userDefined,
|
||||||
|
color: this.editObject.color,
|
||||||
source: this.editObject.source,
|
source: this.editObject.source,
|
||||||
description: this.editObject.description,
|
description: this.editObject.description,
|
||||||
status: this.editObject.status,
|
status: this.editObject.status,
|
||||||
@@ -1187,6 +1215,16 @@ export default {
|
|||||||
throw new Error('No data found, id: ' + this.knowledgeBaseId)
|
throw new Error('No data found, id: ' + this.knowledgeBaseId)
|
||||||
}
|
}
|
||||||
this.editObject = response.data.data
|
this.editObject = response.data.data
|
||||||
|
if (response.data.data.color) {
|
||||||
|
const curColorObj = knowledgeBaseColor.find(item => item.value === response.data.data.color)
|
||||||
|
this.editObject.color = curColorObj.value
|
||||||
|
this.editObject.colorName = curColorObj.name
|
||||||
|
this.editObject.colorLabel = curColorObj.label
|
||||||
|
} else {
|
||||||
|
this.editObject.color = knowledgeBaseColor[0].value
|
||||||
|
this.editObject.colorName = knowledgeBaseColor[0].name
|
||||||
|
this.editObject.colorLabel = knowledgeBaseColor[0].label
|
||||||
|
}
|
||||||
this.importedData = this.handleSpeticalTypeData(this.editObject.itemList)
|
this.importedData = this.handleSpeticalTypeData(this.editObject.itemList)
|
||||||
this.importedData.forEach(item => {
|
this.importedData.forEach(item => {
|
||||||
this.oldItemIds.push(item.id)
|
this.oldItemIds.push(item.id)
|
||||||
@@ -1283,7 +1321,10 @@ export default {
|
|||||||
source: 'cn_ip_tag_user_defined',
|
source: 'cn_ip_tag_user_defined',
|
||||||
description: '',
|
description: '',
|
||||||
updateTime: '',
|
updateTime: '',
|
||||||
status: 1
|
status: 1,
|
||||||
|
color: knowledgeBaseColor[0].value,
|
||||||
|
colorLabel: knowledgeBaseColor[0].label,
|
||||||
|
colorName: knowledgeBaseColor[0].name
|
||||||
}
|
}
|
||||||
/* 将组织后的数据还原拉平 */
|
/* 将组织后的数据还原拉平 */
|
||||||
const revertImportedData = (data) => {
|
const revertImportedData = (data) => {
|
||||||
@@ -1366,6 +1407,7 @@ export default {
|
|||||||
stepHeightConstant,
|
stepHeightConstant,
|
||||||
stepHeights,
|
stepHeights,
|
||||||
knowledgeBaseType,
|
knowledgeBaseType,
|
||||||
|
knowledgeBaseColor,
|
||||||
importedData,
|
importedData,
|
||||||
showImportedData,
|
showImportedData,
|
||||||
addItemList,
|
addItemList,
|
||||||
|
|||||||
Reference in New Issue
Block a user