CN-623 feat: tab类型布局调整

This commit is contained in:
chenjinsong
2022-07-26 16:44:35 +08:00
parent ef2ac4915c
commit ca9dfd9873
9 changed files with 47 additions and 18 deletions

View File

@@ -93,7 +93,7 @@
position: relative; position: relative;
.app-card-title-more-delete { .app-card-title-more-delete {
z-index: 1; z-index: 1;
font-family: Helvetica; font-family: Helvetica-Bold;
position: absolute; position: absolute;
min-width: 96px; min-width: 96px;
line-height: 32px; line-height: 32px;

View File

@@ -148,7 +148,7 @@
.el-scrollbar__view.el-select-dropdown__list { .el-scrollbar__view.el-select-dropdown__list {
.el-select-dropdown__item { .el-select-dropdown__item {
padding: 0 8px; padding: 0 8px;
font-family: Helvetica; font-family: Helvetica-Bold;
height: 24px; height: 24px;
line-height: 24px; line-height: 24px;
font-size: 12px; font-size: 12px;

View File

@@ -18,7 +18,7 @@
} }
} }
.chart-list { .chart-list {
height: calc(100% - 46px); height: calc(100% - 68px);
overflow: auto; overflow: auto;
&>.vue-grid-layout { &>.vue-grid-layout {
margin-top: -20px; margin-top: -20px;

View File

@@ -30,6 +30,14 @@
v-else-if="chart.type === typeMapping.npm.npmNetworkQuantity" v-else-if="chart.type === typeMapping.npm.npmNetworkQuantity"
:chart="chart" :chart="chart"
></npm-network-quantity> ></npm-network-quantity>
<npm-app-category-score
v-else-if="chart.type === typeMapping.npm.npmAppCategoryScore"
:chart="chart"
></npm-app-category-score>
<npm-map
v-else-if="chart.type === typeMapping.npm.npmMap"
:chart="chart"
></npm-map>
</div> </div>
</template> </template>
@@ -44,9 +52,13 @@ import NetworkOverviewTabs from '@/views/charts2/charts/NetworkOverviewTabs'
import NetworkOverviewApps from '@/views/charts2/charts/NetworkOverviewApps' import NetworkOverviewApps from '@/views/charts2/charts/NetworkOverviewApps'
import NpmTabs from '@/views/charts2/charts/NpmTabs' import NpmTabs from '@/views/charts2/charts/NpmTabs'
import NpmNetworkQuantity from '@/views/charts2/charts/NpmNetworkQuantity' import NpmNetworkQuantity from '@/views/charts2/charts/NpmNetworkQuantity'
import NpmAppCategoryScore from '@/views/charts2/charts/NpmAppCategoryScore'
import NpmMap from '@/views/charts2/charts/NpmMap'
export default { export default {
name: 'Chart', name: 'Chart',
components: { components: {
NpmMap,
NpmAppCategoryScore,
Loading, Loading,
ChartNoData, ChartNoData,
NetworkOverviewLine, NetworkOverviewLine,

View File

@@ -19,21 +19,11 @@
:h="item.h" :h="item.h"
:i="item.i" :i="item.i"
:key="item.i"> :key="item.i">
<!-- npm-tab特殊处理 -->
<template v-if="panelType === panelTypeAndRouteMapping.networkAppPerformance">
<chart
v-if="item.type === typeMapping.npm.npmTabs || item.params.tabIndex === npmTabIndex"
:time-filter="timeFilter"
:id="item.id"
:chart="item"
@npmTabChange="npmTabChange"
></chart>
</template>
<chart <chart
v-else
:time-filter="timeFilter" :time-filter="timeFilter"
:extra-params="extraParams" :extra-params="extraParams"
:id="item.id" :id="item.id"
@npmTabChange="npmTabChange"
:chart="item" :chart="item"
></chart> ></chart>
</grid-item> </grid-item>
@@ -71,13 +61,19 @@ export default {
Chart Chart
}, },
watch: { watch: {
chartList: { chartList (n) {
deep: true, if (!_.isEmpty(n)) {
handler (n) { if (this.panelType === panelTypeAndRouteMapping.networkAppPerformance) {
if (!_.isEmpty(n)) { this.layout = n.filter(c => c.type === typeMapping.npm.npmTabs || c.params.tabIndex === this.npmTabIndex)
} else {
this.layout = [...n] this.layout = [...n]
} }
} }
},
npmTabIndex (n) {
if (this.panelType === panelTypeAndRouteMapping.networkAppPerformance) {
this.layout = this.chartList.filter(c => c.type === typeMapping.npm.npmTabs || c.params.tabIndex === this.npmTabIndex)
}
} }
}, },
methods: { methods: {

View File

@@ -7,6 +7,8 @@ export const typeMapping = {
ddosDetection: 701 ddosDetection: 701
}, },
npm: { npm: {
npmMap: 1,
npmAppCategoryScore: 702,
npmTabs: 704, npmTabs: 704,
npmNetworkQuantity: 703 npmNetworkQuantity: 703
} }

View File

@@ -0,0 +1,9 @@
<template>
<div style="height: 100%;width: 100%;border: 1px solid #f0f0f0"></div>
</template>
<script>
export default {
name: 'NpmAppCategoryScore'
}
</script>

View File

@@ -0,0 +1,9 @@
<template>
<div style="height: 100%;width: 100%;border: 1px solid #f0f0f0"></div>
</template>
<script>
export default {
name: 'NpmMap'
}
</script>

View File

@@ -52,6 +52,7 @@ export default {
const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.npm-tabs .el-tabs__item.is-active') const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.npm-tabs .el-tabs__item.is-active')
const activeBar = document.querySelector('.npm-tabs .npm-tabs__active-bar') const activeBar = document.querySelector('.npm-tabs .npm-tabs__active-bar')
activeBar.style.cssText += `width: ${clientWidth + 2}px; left: ${offsetLeft + this.leftOffset + clientLeft - 1}px;` activeBar.style.cssText += `width: ${clientWidth + 2}px; left: ${offsetLeft + this.leftOffset + clientLeft - 1}px;`
console.info(activeBar.style.left)
} }
}, },
mounted () { mounted () {