diff --git a/nezha-fronted/src/assets/css/components/page/integration/integration.scss b/nezha-fronted/src/assets/css/components/page/integration/integration.scss index 05eb36388..ec7493eb8 100644 --- a/nezha-fronted/src/assets/css/components/page/integration/integration.scss +++ b/nezha-fronted/src/assets/css/components/page/integration/integration.scss @@ -285,9 +285,10 @@ } } } - .right-box.right-box-chart{ + .right-box.right-box-dashboard-temp{ top: 0; height: 100%; + z-index: 2001; } } diff --git a/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue b/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue index b0d0b3be8..1af5b0ffa 100644 --- a/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue +++ b/nezha-fronted/src/components/common/rightBox/dashboardTempBox.vue @@ -1,7 +1,7 @@ @@ -55,13 +45,13 @@ import { chartCache } from '@/components/common/js/common' import chartList from '@/components/chart/chartList' import bus from '../../../../libs/bus' import { fromRoute } from '@/components/common/js/constants' -import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions' import panelVariables from '@/components/common/panel/panelVariables' +import dashboardTempBox from '@/components/common/rightBox/dashboardTempBox' import chartDataFormat from '@/components/chart/chartDataFormat' export default { name: 'integration-dashboard', props: { - dashboardTemplate: String + tempId: Number }, computed: { chartRightBoxShow () { @@ -75,6 +65,9 @@ export default { return { fromRoute, chartListLoading: true, + rightBox: { // 面板弹出框相关 + dashboardTemp: { show: false } + }, searchTime: bus.getTimezontDateRange(), panel: { // 新增panel id: '', @@ -83,7 +76,10 @@ export default { panelData: [], // ---图表相关参数--start dataList: [], // 数据列表 - filter: { + filter: { // 过滤条件 + panelId: -1, + start_time: '', + end_time: '' }, showPanel: { name: '', @@ -99,13 +95,19 @@ export default { }, components: { chartList, - topToolMoreOptions, - panelVariables // 处理panel变量的组件 + panelVariables, // 处理panel变量的组件 + dashboardTempBox }, methods: { importFn () { + this.rightBox.dashboardTemp.show = true + bus.$emit('clickModalClose', false) }, - afterImport () { + closeDashboardTempBox (refresh) { + this.rightBox.dashboardTemp.show = false + setTimeout(() => { + bus.$emit('clickModalClose', true) + }, 100) }, // 滚动事件触发下拉加载 onScroll () { @@ -126,40 +128,41 @@ export default { const findItem = unitsList.find(item => item.label.replace(/\s*/g, '') == type.replace(/\s*/g, '')) return findItem ? findItem.value : 2 }, - getData () { - let num = 0 - this.showPanel.charts.forEach(item => { - item.id = ++num - item.span = Number(item.span) - item.height = Number(item.height) - item.x = Number(item.x) - item.y = Number(item.y) - item.type = item.type.split(' ')[0].toLowerCase() - item.unit = this.getUnitValue(item.unit) - item.loaded = false - item.children && item.children.forEach(subItem => { - subItem.id = ++num - subItem.span = Number(subItem.span) - subItem.height = Number(subItem.height) - subItem.x = Number(subItem.x) - subItem.y = Number(subItem.y) - subItem.type = subItem.type.split(' ')[0].toLowerCase() - subItem.unit = this.getUnitValue(subItem.unit) - }) + getData (params) { + this.dataList = [] + this.chartListLoading = true + this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => { + if (response.code === 200) { + this.chartListLoading = false + this.dataList = response.data.list.map(item => { + return { + ...item, + loaded: false + } + }) + } }) - this.dataList = this.showPanel.charts - this.chartListLoading = false }, // 公用操作 getTableData () { - this.panelData = JSON.parse(this.dashboardTemplate) - if (this.panelData.length > 0) { - this.showPanel = this.$loadsh.cloneDeep(this.panelData[0]) - this.variables = this.$loadsh.get(this.panelData, '[0].param.variables') - this.getData() - } else { + this.$get('visual/panel', { type: 'template', ids: this.tempId }).then(response => { + if (response.code === 200) { + this.panelData = response.data.list + if (this.panelData.length > 0) { + this.filter.panelId = this.panelData[0].id + this.showPanel = this.$loadsh.cloneDeep(this.panelData[0]) + this.variables = this.$loadsh.get(this.panelData, '[0].param.variables') + this.getData(this.filter) + } + } this.chartListLoading = false - } + }).catch((error) => { + this.chartListLoading = false + if (error) { + console.error(error) + this.$message.error(error.toString()) + } + }) }, getPanelData () { this.variablesInit = true diff --git a/nezha-fronted/src/components/page/integration/integration-tabs/integration-tabs.vue b/nezha-fronted/src/components/page/integration/integration-tabs/integration-tabs.vue index 8452553f0..0f062533e 100644 --- a/nezha-fronted/src/components/page/integration/integration-tabs/integration-tabs.vue +++ b/nezha-fronted/src/components/page/integration/integration-tabs/integration-tabs.vue @@ -9,7 +9,7 @@ - + diff --git a/nezha-fronted/src/components/page/integration/integration-tabs/manual.vue b/nezha-fronted/src/components/page/integration/integration-tabs/manual.vue index a4548b759..fe878ee60 100644 --- a/nezha-fronted/src/components/page/integration/integration-tabs/manual.vue +++ b/nezha-fronted/src/components/page/integration/integration-tabs/manual.vue @@ -150,6 +150,8 @@ export default { const exception = JSON.parse(responseText) if (exception.message) { $self.$message.error(exception.message) + } else if (exception.msg) { + $self.$message.error(exception.msg) } else { console.error(error) } @@ -190,6 +192,8 @@ export default { const exception = JSON.parse(responseText) if (exception.message) { $self.$message.error(exception.message) + } else if (exception.msg) { + $self.$message.error(exception.msg) } else { console.error(error) } diff --git a/nezha-fronted/src/components/page/integration/integration.vue b/nezha-fronted/src/components/page/integration/integration.vue index 655a9407f..dea7a724b 100644 --- a/nezha-fronted/src/components/page/integration/integration.vue +++ b/nezha-fronted/src/components/page/integration/integration.vue @@ -28,6 +28,7 @@ :visible.sync="dialogVisible" :show-close="true" :append-to-body="false" + :close-on-click-modal="clickModalClose" :z-index="1000" @close="closeDialog" > @@ -43,7 +44,7 @@
- +
@@ -51,6 +52,7 @@