fix: 将class移入公共css中,修改编辑器报红线的代码格式

This commit is contained in:
刘洪洪
2022-11-07 15:48:46 +08:00
parent 21e0f94d19
commit 809a6b5562
3 changed files with 182 additions and 124 deletions

View File

@@ -99,6 +99,25 @@
line-height: 14px;
margin-left: 5px;
}
.detection-event-severity-color-block {
width: 5px;
height: 20px;
border-radius: 2.5px;
margin-left: -16px;
margin-right: 12px;
}
.detection-event-severity-block {
font-family: NotoSansHans-Medium;
font-size: 12px;
color: #046EC9;
font-weight: 500;
padding: 2px 10px;
background: rgba(56,172,210,0.10);
border: 1px solid #ADC7DB;
box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02);
border-radius: 3px;
margin-right: 10px;
}
}
.cn-detection__body {

View File

@@ -2,7 +2,8 @@
<div class="cn-header">
<div class="cn-header__banner">
<div class="banner__left">
<span @click="shrink" class="shrink-button" :class="{'shrink-button--collapse': showMenu}"><i class="cn-icon cn-icon-navigation"></i></span>
<span @click="shrink" class="shrink-button" :class="{'shrink-button--collapse': showMenu}"><i
class="cn-icon cn-icon-navigation"></i></span>
<img alt="loading..." height="26" :src="logo?logo:require('../../assets/img/logo-header.svg')"/>
</div>
<!--个人操作-->
@@ -12,23 +13,27 @@
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<div id="header-to-english" :style="language === 'en'?'color:#0091ff':''" @click="changeLocal('en')">English</div>
<div id="header-to-english" :style="language === 'en'?'color:#0091ff':''" @click="changeLocal('en')">
English
</div>
</el-dropdown-item>
<el-dropdown-item>
<div id="header-to-chinese" :style="language === 'cn'?'color:#0091ff':''" @click="changeLocal('cn')">中文</div>
<div id="header-to-chinese" :style="language === 'cn'?'color:#0091ff':''" @click="changeLocal('cn')">
中文
</div>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-dropdown>
<div class='login-user header-menu--item'>{{username}}&nbsp;<i class="cn-icon cn-icon-arrow-down"></i></div>
<div class='login-user header-menu--item'>{{ username }}&nbsp;<i class="cn-icon cn-icon-arrow-down"></i></div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<div id="header-to-changepin" @click="showPinDialog">{{$t('overall.changePassword')}}</div>
<div id="header-to-changepin" @click="showPinDialog">{{ $t('overall.changePassword') }}</div>
</el-dropdown-item>
<el-dropdown-item>
<div id="header-to-logout" @click="logout">{{$t('overall.logout')}}</div>
<div id="header-to-logout" @click="logout">{{ $t('overall.logout') }}</div>
</el-dropdown-item>
</el-dropdown-menu>
</template>
@@ -38,7 +43,8 @@
<div class="cn-header__nav">
<i class="cn-icon cn-icon-a-NetworkAnalytics"></i>
<el-breadcrumb class="header__left-breadcrumb" :separator="route.indexOf('detection') === -1 ? '>' : ''">
<el-breadcrumb-item class="header__left-breadcrumb-item" :id="`breadcrumb${item}`" :title="item" v-for="(item,index) in breadcrumb" :key="item">
<el-breadcrumb-item class="header__left-breadcrumb-item" :id="`breadcrumb${item}`" :title="item"
v-for="(item,index) in breadcrumb" :key="item">
<template v-if="index===3">
<div class="header__left-breadcrumb-item-select">
<el-popover placement="bottom-start"
@@ -52,16 +58,17 @@
@hide="hideBreadcrumbPopover()"
trigger="click">
<template #reference>
<div class="breadcrumb-button" id="breadcrumbButton" :class="showBackground?'breadcrumb-button__active':''" >
<div class="breadcrumb-button" id="breadcrumbButton"
:class="showBackground?'breadcrumb-button__active':''">
<span id="breadcrumbValue">
<template v-if="curTabProp === 'qtype'">
<span>{{dnsQtypeMapData.get(item) ? dnsQtypeMapData.get(item):item}}</span>
<span>{{ dnsQtypeMapData.get(item) ? dnsQtypeMapData.get(item) : item }}</span>
</template>
<template v-else-if="curTabProp === 'rcode'">
<span>{{dnsRcodeMapData.get(item) ? dnsRcodeMapData.get(item):item}}</span>
<span>{{ dnsRcodeMapData.get(item) ? dnsRcodeMapData.get(item) : item }}</span>
</template>
<template v-else>
<span>{{item}}</span>
<span>{{ item }}</span>
</template>
</span><i class="cn-icon-xiala cn-icon"></i>
</div>
@@ -74,15 +81,16 @@
@input="dropDownSearch"></el-input>
</div>
<ul class="select-dropdown" id="breadcrumbSelectDropdown" @scroll="scrollList()">
<li v-for="item in breadcrumbColumnValueListShow" title='' :key="item" :id="item" class="select-dropdown__item" @click="changeValue(item)" :class="selected?'':''">
<li v-for="item in breadcrumbColumnValueListShow" title='' :key="item" :id="item"
class="select-dropdown__item" @click="changeValue(item)" :class="selected?'':''">
<template v-if="curTabProp === 'qtype'">
<span>{{dnsQtypeMapData.get(item) ? dnsQtypeMapData.get(item):item}}</span>
<span>{{ dnsQtypeMapData.get(item) ? dnsQtypeMapData.get(item) : item }}</span>
</template>
<template v-else-if="curTabProp === 'rcode'">
<span>{{dnsRcodeMapData.get(item) ? dnsRcodeMapData.get(item):item}}</span>
<span>{{ dnsRcodeMapData.get(item) ? dnsRcodeMapData.get(item) : item }}</span>
</template>
<template v-else>
<span>{{item}}</span>
<span>{{ item }}</span>
</template>
</li>
</ul>
@@ -91,38 +99,39 @@
</div>
</template>
<template v-else-if="index===2">
<span v-if="route===wholeScreenRouterMapping.dns" >{{$t(item)}}</span>
<span v-else class="route-menu" @click="jump(route,item,'',3)">{{$t(item)}}</span>
<span v-if="route===wholeScreenRouterMapping.dns">{{ $t(item) }}</span>
<span v-else class="route-menu" @click="jump(route,item,'',3)">{{ $t(item) }}</span>
</template>
<template v-else-if="index===1">
<span class="route-menu" @click="jump(route,'','',2)" v-if="route.indexOf('detection') === -1">{{item}}</span>
<!-- <div class="header__left-breadcrumb-item-select" v-if="route.indexOf('detection') > -1">-->
<!-- <el-popover placement="bottom-start"-->
<!-- v-if="route.indexOf('detection') > -1"-->
<!-- ref="breadcrumbPopover"-->
<!-- :show-arrow="false"-->
<!-- :append-to-body="false"-->
<!-- :hide-after="0"-->
<!-- :show-after="0"-->
<!-- popper-class="breadcrumb__popper"-->
<!-- trigger="click">-->
<!-- <template #reference>-->
<!-- <div class="breadcrumb-button" id="breadcrumbButton2" :class="showBackground?'breadcrumb-button__active':''" v-if="route.indexOf('detection') > -1">-->
<!-- <span id="breadcrumbValue2"> {{item}}</span><i class="cn-icon-xiala cn-icon"></i>-->
<!-- </div>-->
<!-- </template>-->
<!-- <el-row type="flex" justify="center" style="width: fit-content;flex-direction: column;">-->
<!-- <ul class="select-dropdown" id="breadcrumbSelectDropdown2">-->
<!-- <li v-for="item in detectionMenuList" title='' :key="item.name" :id="item.name" class="select-dropdown__item" @click="jump(item.path,'','',2)">-->
<!-- <span>{{$t(item.i18n)}}</span>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </el-row>-->
<!-- </el-popover>-->
<!-- </div>-->
<span class="route-menu" @click="jump(route,'','',2)"
v-if="route.indexOf('detection') === -1">{{ item }}</span>
<!-- <div class="header__left-breadcrumb-item-select" v-if="route.indexOf('detection') > -1">-->
<!-- <el-popover placement="bottom-start"-->
<!-- v-if="route.indexOf('detection') > -1"-->
<!-- ref="breadcrumbPopover"-->
<!-- :show-arrow="false"-->
<!-- :append-to-body="false"-->
<!-- :hide-after="0"-->
<!-- :show-after="0"-->
<!-- popper-class="breadcrumb__popper"-->
<!-- trigger="click">-->
<!-- <template #reference>-->
<!-- <div class="breadcrumb-button" id="breadcrumbButton2" :class="showBackground?'breadcrumb-button__active':''" v-if="route.indexOf('detection') > -1">-->
<!-- <span id="breadcrumbValue2"> {{item}}</span><i class="cn-icon-xiala cn-icon"></i>-->
<!-- </div>-->
<!-- </template>-->
<!-- <el-row type="flex" justify="center" style="width: fit-content;flex-direction: column;">-->
<!-- <ul class="select-dropdown" id="breadcrumbSelectDropdown2">-->
<!-- <li v-for="item in detectionMenuList" title='' :key="item.name" :id="item.name" class="select-dropdown__item" @click="jump(item.path,'','',2)">-->
<!-- <span>{{$t(item.i18n)}}</span>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </el-row>-->
<!-- </el-popover>-->
<!-- </div>-->
</template>
<template v-else>
<span>{{item}}</span>
<span>{{ item }}</span>
</template>
</el-breadcrumb-item>
</el-breadcrumb>
@@ -140,22 +149,26 @@
<div class="cn-menu__left">
<div class="left-menu" v-for="menu in otherMenu" :key="menu.id" @click="jump(menu.route,'','',0)">
<i :class="menu.icon"></i>
<span>{{$t(menu.i18n || menu.name)}}</span>
<span>{{ $t(menu.i18n || menu.name) }}</span>
<i class="cn-icon cn-icon-right"></i>
</div>
</div>
<div class="cn-menu__middle">
<div class="middle-menus middle-menus--network-analytics">
<div class="middle-menus__header">{{$t('overall.networkAnalytics')}}</div>
<div class="middle-menus__header">{{ $t('overall.networkAnalytics') }}</div>
<div class="middle-menus__body">
<div style="width: 260px;">
<template v-for="(menu, index) in networkAnalyticsMenu.children" :key="index">
<div class="middle-menu" v-if="index < 5" @click="jump(menu.route,'','',2)">{{$t(menu.i18n || menu.name)}}</div>
<div class="middle-menu" v-if="index < 5" @click="jump(menu.route,'','',2)">
{{ $t(menu.i18n || menu.name) }}
</div>
</template>
</div>
<div>
<template v-for="(menu, index) in networkAnalyticsMenu.children" :key="index">
<div class="middle-menu" v-if="index >= 5 && index < 10" @click="jump(menu.route,'','',2)">{{$t(menu.i18n || menu.name)}}</div>
<div class="middle-menu" v-if="index >= 5 && index < 10" @click="jump(menu.route,'','',2)">
{{ $t(menu.i18n || menu.name) }}
</div>
</template>
</div>
</div>
@@ -188,8 +201,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showChangePin = false">{{$t('overall.cancel')}}</el-button>
<el-button type="primary" @click="submit">{{$t('overall.update')}}</el-button>
<el-button @click="showChangePin = false">{{ $t('overall.cancel') }}</el-button>
<el-button type="primary" @click="submit">{{ $t('overall.update') }}</el-button>
</span>
</template>
</el-dialog>
@@ -197,14 +210,10 @@
</template>
<script>
import { useRoute } from 'vue-router'
import { get, put } from '@/utils/http'
import {
curTabState,
dbDrilldownTableConfig,
entityType,
networkOverviewSearchUrl,
networkOverviewTabList,
networkTable,
operationType,
storageKey,
@@ -213,9 +222,16 @@ import {
} from '@/utils/constants'
import { api } from '@/utils/api'
import { ref } from 'vue'
import { combineTabList, getDefaultCurTab, getTabList, overwriteUrl, urlParamsHandler, combinDrilldownTableWithUserConfig,getDnsMapData } from '@/utils/tools'
import {
combineTabList,
getDefaultCurTab,
getTabList,
overwriteUrl,
urlParamsHandler,
combinDrilldownTableWithUserConfig,
getDnsMapData
} from '@/utils/tools'
import { getNowTime, getSecond } from '@/utils/date-util'
import { db } from '@/indexedDB'
export default {
name: 'Header',
@@ -238,17 +254,32 @@ export default {
newPwd2: ''
},
changePassFormRules: {
oldPwd: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
newPwd: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
newPwd2: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: passwordComparison, trigger: 'blur' }]
oldPwd: [{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}],
newPwd: [{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}],
newPwd2: [{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}, {
validator: passwordComparison,
trigger: 'blur'
}]
},
showMenu: false,
dropDownValue: '',
breadcrumbColumnValueListShow: [],
curTabProp:'',
dnsRcodeMapData:[],
dnsQtypeMapData:[],
isDnsMapType:false,
curTabProp: '',
dnsRcodeMapData: [],
dnsQtypeMapData: [],
isDnsMapType: false,
valueMeta: [],
showBackground: false,
selected: false,
@@ -297,10 +328,21 @@ export default {
this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
this.$store.getters.menuList.forEach(menu => {
if (this.$_.isEmpty(menu.children) && menu.route) {
breadcrumbMap.push({ name: this.$t(menu.i18n), path: menu.route, columnName: menu.columnName, columnValue: menu.columnValue })
breadcrumbMap.push({
name: this.$t(menu.i18n),
path: menu.route,
columnName: menu.columnName,
columnValue: menu.columnValue
})
} else if (!this.$_.isEmpty(menu.children)) {
menu.children.forEach(child => {
breadcrumbMap.push({ name: child.i18n ? this.$t(child.i18n) : child.name, parentName: menu.i18n ? this.$t(menu.i18n) : menu.name, path: child.route, columnName: child.columnName, columnValue: child.columnValue })
breadcrumbMap.push({
name: child.i18n ? this.$t(child.i18n) : child.name,
parentName: menu.i18n ? this.$t(menu.i18n) : menu.name,
path: child.route,
columnName: child.columnName,
columnValue: child.columnValue
})
})
}
})
@@ -345,8 +387,15 @@ export default {
},
setup () {
const dateRangeValue = 60
const { startTime, endTime } = getNowTime(dateRangeValue)
const chartTimeFilter = ref({ startTime, endTime, dateRangeValue })
const {
startTime,
endTime
} = getNowTime(dateRangeValue)
const chartTimeFilter = ref({
startTime,
endTime,
dateRangeValue
})
return {
chartTimeFilter,
entityType // 所有entity类型用于header下拉框选择
@@ -377,25 +426,25 @@ export default {
window.location.reload()
})
},
getCurTabByLabel(label){
getCurTabByLabel (label) {
let curTab = null
let tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
let curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
if (curTableInCode && curTableInCode.tabList) {
curTab = curTableInCode.tabList.find(item => item.label == label)
}
return curTab
},
async initDropdownList () {
//是否需要dns的qtype和rcode的数据字典
// 是否需要dns的qtype和rcode的数据字典
this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
let currentValue = document.getElementById('breadcrumbValue') ? document.getElementById('breadcrumbValue').innerText : ''
let columnName = this.getUrlParam(this.curTabState.thirdMenu, '')
const currentValue = document.getElementById('breadcrumbValue') ? document.getElementById('breadcrumbValue').innerText : ''
const columnName = this.getUrlParam(this.curTabState.thirdMenu, '')
let type = 'ip'
let tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
let curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
if (curTableInCode && curTableInCode.tabList) {
let curTab = curTableInCode.tabList.find(item => item.label == columnName)
const curTab = curTableInCode.tabList.find(item => item.label == columnName)
if (curTab) {
type = curTab.prop
}
@@ -417,9 +466,9 @@ export default {
const selectedDom = document.getElementById(item)
if (selectedDom) {
let itemName = item
if(this.curTabProp === 'qtype'){
if (this.curTabProp === 'qtype') {
itemName = this.dnsQtypeMapData.get(item)
}else if(this.curTabProp === 'rcode'){
} else if (this.curTabProp === 'rcode') {
itemName = this.dnsRcodeMapData.get(item)
}
if (itemName === currentValue) {
@@ -454,34 +503,34 @@ export default {
changeValue (value) {
// 设置面包屑显示的内容及hover时的title
let valName = value
if(this.tab === 'qtype'){
valName =this.dnsQtypeMapData.get(value)
}else if(this.tab === 'rcode'){
valName =this.dnsRcodeMapData.get(value)
if (this.tab === 'qtype') {
valName = this.dnsQtypeMapData.get(value)
} else if (this.tab === 'rcode') {
valName = this.dnsRcodeMapData.get(value)
}
this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
document.getElementById('breadcrumbValue').innerText = value
//document.getElementById('breadcrumbButton').setAttribute('title', valName)
// document.getElementById('breadcrumbButton').setAttribute('title', valName)
document.getElementById(this.valueMenuId).setAttribute('title', valName)
document.getElementById('breadcrumbButton').click()
// const columnName = this.$store.getters.getBreadcrumbColumnName
const columnName = this.getUrlParam(this.curTabState.thirdMenu, '')
//const tabObjGroup = networkOverviewTabList.filter(item => item.label == columnName)
let curTab = this.getCurTabByLabel()
// const tabObjGroup = networkOverviewTabList.filter(item => item.label == columnName)
const curTab = this.getCurTabByLabel()
if (curTab) {
const queryCondition = []
const searchProps = curTab.dillDownProp
if (curTab.prop === 'protocolPort') {
const valueGroup = value.split(':')
if (valueGroup) {
queryCondition.push("common_l7_protocol='" + valueGroup[0] + "'")
queryCondition.push('common_l7_protocol=\'' + valueGroup[0] + '\'')
queryCondition.push('common_server_port=' + valueGroup[1])
}
console.log(queryCondition.join(' AND '))
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ')
} else {
searchProps.forEach(item => {
queryCondition.push(item + "='" + value.replaceAll("'", "\\\\'") + "'")
queryCondition.push(item + '=\'' + value.replaceAll('\'', '\\\\\'') + '\'')
})
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ')
}
@@ -495,7 +544,10 @@ export default {
submit () {
this.$refs.changePassForm.validate((valid) => {
if (valid) {
put(api.pin, { oldPin: this.changePassForm.oldPwd, newPin: this.changePassForm.newPwd }).then(res => {
put(api.pin, {
oldPin: this.changePassForm.oldPwd,
newPin: this.changePassForm.newPwd
}).then(res => {
if (res.code === 200) {
this.$message.success('Success')
this.showChangePin = false
@@ -517,7 +569,7 @@ export default {
this.urlChangeParams = {}
},
async handleCurDrilldownTableConfig (thirdMenu, fourthMenu) {
const userId = localStorage.getItem(storageKey.userId)
// const userId = localStorage.getItem(storageKey.userId)
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
const drillDownTableConfigs = await combinDrilldownTableWithUserConfig()
const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType)
@@ -564,11 +616,11 @@ export default {
child.columnName = columnName
this.urlChangeParams[this.curTabState.thirdMenu] = columnName
this.urlChangeParams[this.curTabState.fourthMenu] = columnValue
//const tabObjGroup = networkOverviewTabList.filter(item => item.label == columnName)
//let curTab = this.getCurTabByLabel()
//const type = curTab ? curTab.prop : ''
//this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
//this.urlChangeParams[this.curTabState.dimensionType] = type
// const tabObjGroup = networkOverviewTabList.filter(item => item.label == columnName)
// let curTab = this.getCurTabByLabel()
// const type = curTab ? curTab.prop : ''
// this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
// this.urlChangeParams[this.curTabState.dimensionType] = type
this.urlChangeParams[this.curTabState.panelName] = columnValue
} else if (columnName) { // 点击的为列名
child.columnValue = ''
@@ -605,11 +657,20 @@ export default {
})
} else if (opeType === 3) {
this.$router.push({
query: { ...this.$route.query, fourthPanel: '', t: +new Date() }
query: {
...this.$route.query,
fourthPanel: '',
t: +new Date()
}
})
} else if (opeType != 4) {
this.$router.push({
query: { ...this.$route.query, fourthPanel: '', thirdPanel: '', t: +new Date() }
query: {
...this.$route.query,
fourthPanel: '',
thirdPanel: '',
t: +new Date()
}
})
}
if (route === this.route) {

View File

@@ -178,25 +178,3 @@ export default {
}
}
</script>
<style>
.detection-event-severity-color-block {
width: 5px;
height: 20px;
border-radius: 2.5px;
margin-left: -16px;
margin-right: 12px;
}
.detection-event-severity-block {
font-family: NotoSansHans-Medium;
font-size: 12px;
color: #046EC9;
font-weight: 500;
padding: 2px 10px;
background: rgba(56,172,210,0.10);
border: 1px solid #ADC7DB;
box-shadow: 0 2px 0.28571rem 0 rgb(51 51 51 / 2%);
border-radius: 3px;
margin-right: 10px;
}
</style>