NEZ-2634 feat:集成详情页面dashboard更新
This commit is contained in:
@@ -285,9 +285,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.right-box.right-box-chart{
|
.right-box.right-box-dashboard-temp{
|
||||||
top: 0;
|
top: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
z-index: 2001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-clickoutside="{obj: editDashboard, func: esc}" class="right-box right-box-dashboard-temp">
|
<div v-clickoutside="{obj: editDashboard, func: esc}" class="right-box right-box-dashboard-temp">
|
||||||
<div class="right-box__header">
|
<div class="right-box__header">
|
||||||
<div class="header__title">{{$t("dashboard.panel.createPanelTitle")}}</div>
|
<div class="header__title">{{from==='integration'?$t("overall.tempImport"):$t("dashboard.panel.createPanelTitle")}}</div>
|
||||||
<div class="header__operation">
|
<div class="header__operation">
|
||||||
<span v-cancel="{obj: editDashboard, func: esc}"><i class="nz-icon nz-icon-close" :title="$t('overall.close')"></i></span>
|
<span v-cancel="{obj: editDashboard, func: esc}"><i class="nz-icon nz-icon-close" :title="$t('overall.close')"></i></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<!-- dashboardTemplate -->
|
<!-- dashboardTemplate -->
|
||||||
<el-form-item :label="$t('upload.template')" prop="tmplId">
|
<el-form-item :label="$t('upload.template')" prop="tmplId">
|
||||||
<v-selectpage
|
<v-selectpage
|
||||||
|
:disabled="from==='integration'"
|
||||||
:data="templateList"
|
:data="templateList"
|
||||||
:tb-columns="ChartSearchShowFields"
|
:tb-columns="ChartSearchShowFields"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
@@ -75,6 +76,7 @@ import bus from '@/libs/bus'
|
|||||||
import editRigthBox from '../mixin/editRigthBox'
|
import editRigthBox from '../mixin/editRigthBox'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
from: String
|
||||||
},
|
},
|
||||||
mixins: [editRigthBox],
|
mixins: [editRigthBox],
|
||||||
data () {
|
data () {
|
||||||
@@ -224,11 +226,16 @@ export default {
|
|||||||
}, 50),
|
}, 50),
|
||||||
// 获取dashboard模板列表
|
// 获取dashboard模板列表
|
||||||
getDashboardTempData () {
|
getDashboardTempData () {
|
||||||
this.$get('visual/panel', { type: 'template', pageSize: -1 }).then(response => {
|
if (this.from === 'integration') {
|
||||||
if (response.code === 200) {
|
this.editDashboard.tmplId = String(this.$parent.tempId)
|
||||||
this.templateList = response.data.list
|
this.templateList = this.$loadsh.cloneDeep(this.$parent.panelData)
|
||||||
}
|
} else {
|
||||||
})
|
this.$get('visual/panel', { type: 'template', pageSize: -1 }).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.templateList = response.data.list
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 根据选中模板vartype请求数据
|
// 根据选中模板vartype请求数据
|
||||||
getTableData () {
|
getTableData () {
|
||||||
@@ -265,13 +272,13 @@ export default {
|
|||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 模板varType ≠ 0时link有效且必填
|
// 模板varType ≠ 0时link有效且必填
|
||||||
if (this.templateType == 0) {
|
if (!this.templateType) {
|
||||||
delete params.link
|
delete params.link
|
||||||
}
|
}
|
||||||
this.$post(this.url, params).then(response => {
|
this.$post(this.url, params).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.from === 'integration' ? this.$t('overall.result.successfully') : this.$t('tip.saveSuccess') })
|
||||||
this.esc(true)
|
this.esc(true)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(response.msg)
|
this.$message.error(response.msg)
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.variablesInit = false
|
this.variablesInit = false
|
||||||
this.showPanel = val
|
this.showPanel = val
|
||||||
this.variables = this.$loadsh.get(this, 'showPanel.param.variables', []) || []
|
this.variables = this.$loadsh.cloneDeep(this.$loadsh.get(this, 'showPanel.param.variables', []) || [])
|
||||||
this.showPanel.type = 'dashboard'
|
this.showPanel.type = 'dashboard'
|
||||||
this.filter.panelId = this.showPanel.id
|
this.filter.panelId = this.showPanel.id
|
||||||
this.panelId = this.showPanel.id
|
this.panelId = this.showPanel.id
|
||||||
|
|||||||
@@ -3,25 +3,10 @@
|
|||||||
<div class="integration-tool" style="padding: 0 10px;">
|
<div class="integration-tool" style="padding: 0 10px;">
|
||||||
<h3>{{showPanel.name}}</h3>
|
<h3>{{showPanel.name}}</h3>
|
||||||
|
|
||||||
<top-tool-more-options
|
<button class="nz-btn el-button--small nz-btn-style-normal" @click="importFn">
|
||||||
type='integration'
|
<i class="nz-icon nz-icon-upload"></i>
|
||||||
ref="topTool"
|
<span>{{$t('overall.importExcel')}}</span>
|
||||||
id="integration-dashboard-tool"
|
</button>
|
||||||
:params="filter"
|
|
||||||
:params-type="'template'"
|
|
||||||
class="top-tool-export margin-r-10"
|
|
||||||
export-url="/visual/panel/export"
|
|
||||||
import-url="/visual/panel/import"
|
|
||||||
export-file-name="dashboard-temp"
|
|
||||||
@afterImport="afterImport"
|
|
||||||
>
|
|
||||||
<template>
|
|
||||||
<button class="nz-btn el-button--small nz-btn-style-normal" @click="importFn">
|
|
||||||
<i class="nz-icon nz-icon-upload"></i>
|
|
||||||
<span>{{$t('overall.importExcel')}}</span>
|
|
||||||
</button>
|
|
||||||
</template>
|
|
||||||
</top-tool-more-options>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dashboard-container">
|
<div class="dashboard-container">
|
||||||
@@ -46,6 +31,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- dashboard模板 -->
|
||||||
|
<transition name="right-box">
|
||||||
|
<dashboardTempBox v-if="rightBox.dashboardTemp.show" :from="fromRoute.integration" @close="closeDashboardTempBox"></dashboardTempBox>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -55,13 +45,13 @@ import { chartCache } from '@/components/common/js/common'
|
|||||||
import chartList from '@/components/chart/chartList'
|
import chartList from '@/components/chart/chartList'
|
||||||
import bus from '../../../../libs/bus'
|
import bus from '../../../../libs/bus'
|
||||||
import { fromRoute } from '@/components/common/js/constants'
|
import { fromRoute } from '@/components/common/js/constants'
|
||||||
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
|
||||||
import panelVariables from '@/components/common/panel/panelVariables'
|
import panelVariables from '@/components/common/panel/panelVariables'
|
||||||
|
import dashboardTempBox from '@/components/common/rightBox/dashboardTempBox'
|
||||||
import chartDataFormat from '@/components/chart/chartDataFormat'
|
import chartDataFormat from '@/components/chart/chartDataFormat'
|
||||||
export default {
|
export default {
|
||||||
name: 'integration-dashboard',
|
name: 'integration-dashboard',
|
||||||
props: {
|
props: {
|
||||||
dashboardTemplate: String
|
tempId: Number
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
chartRightBoxShow () {
|
chartRightBoxShow () {
|
||||||
@@ -75,6 +65,9 @@ export default {
|
|||||||
return {
|
return {
|
||||||
fromRoute,
|
fromRoute,
|
||||||
chartListLoading: true,
|
chartListLoading: true,
|
||||||
|
rightBox: { // 面板弹出框相关
|
||||||
|
dashboardTemp: { show: false }
|
||||||
|
},
|
||||||
searchTime: bus.getTimezontDateRange(),
|
searchTime: bus.getTimezontDateRange(),
|
||||||
panel: { // 新增panel
|
panel: { // 新增panel
|
||||||
id: '',
|
id: '',
|
||||||
@@ -83,7 +76,10 @@ export default {
|
|||||||
panelData: [],
|
panelData: [],
|
||||||
// ---图表相关参数--start
|
// ---图表相关参数--start
|
||||||
dataList: [], // 数据列表
|
dataList: [], // 数据列表
|
||||||
filter: {
|
filter: { // 过滤条件
|
||||||
|
panelId: -1,
|
||||||
|
start_time: '',
|
||||||
|
end_time: ''
|
||||||
},
|
},
|
||||||
showPanel: {
|
showPanel: {
|
||||||
name: '',
|
name: '',
|
||||||
@@ -99,13 +95,19 @@ export default {
|
|||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
chartList,
|
chartList,
|
||||||
topToolMoreOptions,
|
panelVariables, // 处理panel变量的组件
|
||||||
panelVariables // 处理panel变量的组件
|
dashboardTempBox
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
importFn () {
|
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 () {
|
onScroll () {
|
||||||
@@ -126,40 +128,41 @@ export default {
|
|||||||
const findItem = unitsList.find(item => item.label.replace(/\s*/g, '') == type.replace(/\s*/g, ''))
|
const findItem = unitsList.find(item => item.label.replace(/\s*/g, '') == type.replace(/\s*/g, ''))
|
||||||
return findItem ? findItem.value : 2
|
return findItem ? findItem.value : 2
|
||||||
},
|
},
|
||||||
getData () {
|
getData (params) {
|
||||||
let num = 0
|
this.dataList = []
|
||||||
this.showPanel.charts.forEach(item => {
|
this.chartListLoading = true
|
||||||
item.id = ++num
|
this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => {
|
||||||
item.span = Number(item.span)
|
if (response.code === 200) {
|
||||||
item.height = Number(item.height)
|
this.chartListLoading = false
|
||||||
item.x = Number(item.x)
|
this.dataList = response.data.list.map(item => {
|
||||||
item.y = Number(item.y)
|
return {
|
||||||
item.type = item.type.split(' ')[0].toLowerCase()
|
...item,
|
||||||
item.unit = this.getUnitValue(item.unit)
|
loaded: false
|
||||||
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)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
this.dataList = this.showPanel.charts
|
|
||||||
this.chartListLoading = false
|
|
||||||
},
|
},
|
||||||
// 公用操作
|
// 公用操作
|
||||||
getTableData () {
|
getTableData () {
|
||||||
this.panelData = JSON.parse(this.dashboardTemplate)
|
this.$get('visual/panel', { type: 'template', ids: this.tempId }).then(response => {
|
||||||
if (this.panelData.length > 0) {
|
if (response.code === 200) {
|
||||||
this.showPanel = this.$loadsh.cloneDeep(this.panelData[0])
|
this.panelData = response.data.list
|
||||||
this.variables = this.$loadsh.get(this.panelData, '[0].param.variables')
|
if (this.panelData.length > 0) {
|
||||||
this.getData()
|
this.filter.panelId = this.panelData[0].id
|
||||||
} else {
|
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
|
this.chartListLoading = false
|
||||||
}
|
}).catch((error) => {
|
||||||
|
this.chartListLoading = false
|
||||||
|
if (error) {
|
||||||
|
console.error(error)
|
||||||
|
this.$message.error(error.toString())
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getPanelData () {
|
getPanelData () {
|
||||||
this.variablesInit = true
|
this.variablesInit = true
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<automatic v-if="tabId==='automatic'"></automatic>
|
<automatic v-if="tabId==='automatic'"></automatic>
|
||||||
<!-- module -->
|
<!-- module -->
|
||||||
<configuration v-if="tabId==='configuration'" :configuration="detailsObj.configuration"></configuration>
|
<configuration v-if="tabId==='configuration'" :configuration="detailsObj.configuration"></configuration>
|
||||||
<dashboard v-if="tabId==='dashboard'" :dashboardTemplate="detailsObj.dashboardTemplate"></dashboard>
|
<dashboard ref="dashboard" v-if="tabId==='dashboard'" :tempId="detailsObj.tempId"></dashboard>
|
||||||
<alert v-if="tabId==='alert'" :moduleId="detailsObj.id"></alert>
|
<alert v-if="tabId==='alert'" :moduleId="detailsObj.id"></alert>
|
||||||
<metric v-if="tabId==='metric'" :moduleId="detailsObj.id"></metric>
|
<metric v-if="tabId==='metric'" :moduleId="detailsObj.id"></metric>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -150,6 +150,8 @@ export default {
|
|||||||
const exception = JSON.parse(responseText)
|
const exception = JSON.parse(responseText)
|
||||||
if (exception.message) {
|
if (exception.message) {
|
||||||
$self.$message.error(exception.message)
|
$self.$message.error(exception.message)
|
||||||
|
} else if (exception.msg) {
|
||||||
|
$self.$message.error(exception.msg)
|
||||||
} else {
|
} else {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
@@ -190,6 +192,8 @@ export default {
|
|||||||
const exception = JSON.parse(responseText)
|
const exception = JSON.parse(responseText)
|
||||||
if (exception.message) {
|
if (exception.message) {
|
||||||
$self.$message.error(exception.message)
|
$self.$message.error(exception.message)
|
||||||
|
} else if (exception.msg) {
|
||||||
|
$self.$message.error(exception.msg)
|
||||||
} else {
|
} else {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
:show-close="true"
|
:show-close="true"
|
||||||
:append-to-body="false"
|
:append-to-body="false"
|
||||||
|
:close-on-click-modal="clickModalClose"
|
||||||
:z-index="1000"
|
:z-index="1000"
|
||||||
@close="closeDialog"
|
@close="closeDialog"
|
||||||
>
|
>
|
||||||
@@ -43,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- tabs -->
|
<!-- tabs -->
|
||||||
<div class="integration-dialog-content">
|
<div class="integration-dialog-content">
|
||||||
<integration-tabs :type="type" :detailsObj="detailsObj"></integration-tabs>
|
<integration-tabs ref="tabs" :type="type" :detailsObj="detailsObj"></integration-tabs>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import integrationTabs from './integration-tabs/integration-tabs.vue'
|
import integrationTabs from './integration-tabs/integration-tabs.vue'
|
||||||
|
import bus from '../../../libs/bus'
|
||||||
export default {
|
export default {
|
||||||
name: 'integration',
|
name: 'integration',
|
||||||
components: {
|
components: {
|
||||||
@@ -67,9 +69,16 @@ export default {
|
|||||||
// 模块列表
|
// 模块列表
|
||||||
dataList: [],
|
dataList: [],
|
||||||
type: '',
|
type: '',
|
||||||
detailsObj: {}
|
detailsObj: {},
|
||||||
|
clickModalClose: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
this.getDataList()
|
||||||
|
bus.$on('clickModalClose', (val) => {
|
||||||
|
this.clickModalClose = val
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getDataList () {
|
async getDataList () {
|
||||||
const res = await this.$get('/integration/module', { pageSize: -1 })
|
const res = await this.$get('/integration/module', { pageSize: -1 })
|
||||||
@@ -92,8 +101,8 @@ export default {
|
|||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
beforeDestroy () {
|
||||||
this.getDataList()
|
bus.$off('clickModalClose')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user