This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/views/charts2/ChartList.vue

87 lines
1.9 KiB
Vue
Raw Normal View History

2022-07-06 21:08:12 +08:00
<template>
<div class="chart-list" ref="layoutBox">
<grid-layout
id="gridLayout"
ref="layout"
v-model:layout="layout"
:col-num="24"
:is-draggable="!panelLock"
:is-resizable="!panelLock"
:margin="[20, 20]"
:row-height="40"
:vertical-compact="true"
:use-css-transforms="false"
>
<grid-item v-for="item in layout"
:x="item.x"
:y="item.y"
:w="item.w"
:h="item.h"
:i="item.i"
:key="item.i">
2022-07-18 15:04:32 +08:00
<!-- npm-tab特殊处理 -->
<template v-if="panelType === panelTypeAndRouteMapping.networkAppPerformance">
<chart
v-if="item.type === typeMapping.npm.npmTabs || item.params.tabIndex === npmTabIndex"
:id="item.id"
:chart="item"
@npmTabChange="npmTabChange"
2022-07-18 15:04:32 +08:00
></chart>
</template>
2022-07-06 21:08:12 +08:00
<chart
2022-07-18 15:04:32 +08:00
v-else
:id="item.id"
:chart="item"
2022-07-06 21:08:12 +08:00
></chart>
</grid-item>
</grid-layout>
</div>
</template>
<script>
import VueGridLayout from 'vue-grid-layout'
import _ from 'lodash'
import Chart from '@/views/charts2/Chart'
2022-07-18 15:04:32 +08:00
import { panelTypeAndRouteMapping } from '@/utils/constants'
import { typeMapping } from '@/views/charts2/chart-tools'
2022-07-06 21:08:12 +08:00
export default {
name: 'ChartList',
props: {
timeFilter: Object,
2022-07-18 15:04:32 +08:00
panelType: Number,
2022-07-06 21:08:12 +08:00
chartList: Array,
panelLock: Boolean,
entity: Object
},
data () {
return {
2022-07-18 15:04:32 +08:00
panelTypeAndRouteMapping,
typeMapping,
layout: [],
npmTabIndex: 0
2022-07-06 21:08:12 +08:00
}
},
components: {
GridLayout: VueGridLayout.GridLayout,
GridItem: VueGridLayout.GridItem,
Chart
},
watch: {
chartList (n) {
if (!_.isEmpty(n)) {
this.layout = [...n]
}
}
},
methods: {
npmTabChange (index) {
this.npmTabIndex = parseInt(index)
}
2022-07-06 21:08:12 +08:00
}
}
</script>
<style scoped>
</style>