fix:修改 chartDiagram
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<!-- :isPanel="true"-->
|
<!-- :isPanel="true"-->
|
||||||
<!-- ref="diagram"-->
|
<!-- ref="diagram"-->
|
||||||
<!-- :chartInfo="chartInfo" />-->
|
<!-- :chartInfo="chartInfo" />-->
|
||||||
<meta2dMain :meta2dId="chartInfo.id + '-' + isFullscreen" :topoData="chartInfo.param.topo" :querysArray="querysArray" :params="params" :iconArray="iconArray" :isChart="true"/>
|
<meta2dMain :meta2dId="chartInfo.id + '-' + isFullscreen" :topoData="chartInfo.param.topo" :querysArray="querysArray" :params="{ timeType: 5}" :iconArray="iconArray" :isChart="true"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -41,7 +41,10 @@ export default {
|
|||||||
bus.$on('showMeta2dPreview', (params) => {
|
bus.$on('showMeta2dPreview', (params) => {
|
||||||
this.isPreview = params
|
this.isPreview = params
|
||||||
})
|
})
|
||||||
console.log(JSON.stringify(this.chartInfo.param.topo))
|
this.$get('/topology/icon').then(res => {
|
||||||
|
this.iconArray = [...res.data.list]
|
||||||
|
})
|
||||||
|
this.reload()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resize () {
|
resize () {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
nowTimeType: {
|
nowTimeType: {
|
||||||
type: Number
|
|
||||||
},
|
},
|
||||||
hiddenText: { // 隐藏图表的悬浮文字
|
hiddenText: { // 隐藏图表的悬浮文字
|
||||||
type: String
|
type: String
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
reload () {
|
reload () {
|
||||||
console.log(123213)
|
if (this.currentProject && this.currentProject.id) {
|
||||||
if (this.currentProject.id) {
|
|
||||||
this.$get('monitor/project/topo', { projectId: this.currentProject.id }).then(res => {
|
this.$get('monitor/project/topo', { projectId: this.currentProject.id }).then(res => {
|
||||||
if (res.data && res.data.topo) {
|
if (res.data && res.data.topo) {
|
||||||
this.topoData = res.data.topo || {}
|
this.topoData = res.data.topo || {}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export default {
|
|||||||
getTopology(this.meta2dId).centerView()
|
getTopology(this.meta2dId).centerView()
|
||||||
}
|
}
|
||||||
getTopology(this.meta2dId).lock(1)
|
getTopology(this.meta2dId).lock(1)
|
||||||
// this.getNodesArr()
|
this.getNodesArr()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -441,6 +441,9 @@ export default {
|
|||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
this.$emit('reload')
|
this.$emit('reload')
|
||||||
}
|
}
|
||||||
|
if (this.isChart) {
|
||||||
|
this.$emit('exit', false)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeEdit () {
|
beforeEdit () {
|
||||||
// const endTime = new Date().getTime()
|
// const endTime = new Date().getTime()
|
||||||
@@ -598,6 +601,9 @@ export default {
|
|||||||
if (key === 'asset' || key === 'alert' || key === 'endpoint') {
|
if (key === 'asset' || key === 'alert' || key === 'endpoint') {
|
||||||
this.showNodeTools()
|
this.showNodeTools()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
saveChart (params) {
|
||||||
|
this.$emit('save', params)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="pens-data right-box__container">
|
<div class="pens-data right-box__container">
|
||||||
<div class="form-row-box chart-config">
|
<div class="form-row-box chart-config">
|
||||||
<div class="form-row-item form-row-item-full">
|
<div class="form-row-item form-row-item-full" v-if="!isChart">
|
||||||
<div class="form-row-key">
|
<div class="form-row-key">
|
||||||
{{$t('project.topology.timeRange')}}
|
{{$t('project.topology.timeRange')}}
|
||||||
</div>
|
</div>
|
||||||
@@ -197,7 +197,8 @@ export default {
|
|||||||
mixins: [promqlInputMixin, rz],
|
mixins: [promqlInputMixin, rz],
|
||||||
props: {
|
props: {
|
||||||
querysArray: {},
|
querysArray: {},
|
||||||
params: {}
|
params: {},
|
||||||
|
isChart: {}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
draggable,
|
draggable,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="editFlag" class="top-tool-right float-right">
|
<div v-if="editFlag" class="top-tool-right float-right">
|
||||||
<button @click="previewTopology" class="nz-btn nz-btn-size-normal nz-btn-style-light"
|
<button @click="previewTopology" type="button" class="nz-btn nz-btn-size-normal nz-btn-style-light"
|
||||||
style="margin-right: 20px"
|
style="margin-right: 20px"
|
||||||
>
|
>
|
||||||
{{$t('overall.preview')}}
|
{{$t('overall.preview')}}
|
||||||
@@ -37,13 +37,13 @@
|
|||||||
<!-- >-->
|
<!-- >-->
|
||||||
<!-- {{$t('project.topology.previewExit')}}-->
|
<!-- {{$t('project.topology.previewExit')}}-->
|
||||||
<!-- </button>-->
|
<!-- </button>-->
|
||||||
<button class="nz-btn nz-btn-size-normal nz-btn-style-normal" @click="saveMeta2d"
|
<button class="nz-btn nz-btn-size-normal nz-btn-style-normal" type="button" @click="saveMeta2d"
|
||||||
:disabled="prevent_opt.save"
|
:disabled="prevent_opt.save"
|
||||||
:class="{'nz-btn-disabled':prevent_opt.save}"
|
:class="{'nz-btn-disabled':prevent_opt.save}"
|
||||||
style="margin-right: 20px">
|
style="margin-right: 20px">
|
||||||
{{$t('overall.save')}}
|
{{$t('overall.save')}}
|
||||||
</button>
|
</button>
|
||||||
<button class="nz-btn nz-btn-size-normal nz-btn-style-normal" style="margin-right: 20px" @click="cancelTopology">
|
<button class="nz-btn nz-btn-size-normal nz-btn-style-normal" type="button" style="margin-right: 20px" @click="cancelTopology">
|
||||||
{{$t('project.topology.exit')}}
|
{{$t('project.topology.exit')}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,7 +117,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveChart () {
|
saveChart () {
|
||||||
|
const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
|
||||||
|
const timeType = this.$parent.$refs.meta2dProps.$refs.meta2dData.dataTimeType
|
||||||
|
const params = {
|
||||||
|
...getTopology(this.meta2dId).data()
|
||||||
|
}
|
||||||
|
params.elements = elements
|
||||||
|
params.timeType = timeType
|
||||||
|
this.$emit('saveChart', params)
|
||||||
},
|
},
|
||||||
saveProject () {
|
saveProject () {
|
||||||
const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
|
const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
|
||||||
@@ -174,11 +181,13 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
timeType: topoData.timeType || 5
|
timeType: topoData.timeType || 5
|
||||||
},
|
},
|
||||||
currentProject: {
|
|
||||||
id: this.project.id
|
|
||||||
},
|
|
||||||
show: true
|
show: true
|
||||||
}
|
}
|
||||||
|
if (this.project) {
|
||||||
|
params.currentProject = {
|
||||||
|
id: this.project.id
|
||||||
|
}
|
||||||
|
}
|
||||||
bus.$emit('showMeta2dPreview', params)
|
bus.$emit('showMeta2dPreview', params)
|
||||||
// console.log(getTopology(this.meta2dId).data())
|
// console.log(getTopology(this.meta2dId).data())
|
||||||
// const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
|
// const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
@edit="beforeEdit"
|
@edit="beforeEdit"
|
||||||
@exitEdit="exitEdit"
|
@exitEdit="exitEdit"
|
||||||
@reload="reload"
|
@reload="reload"
|
||||||
|
@saveChart="saveChart"
|
||||||
@getNodesArr="getNodesArr"
|
@getNodesArr="getNodesArr"
|
||||||
/>
|
/>
|
||||||
<div class="meta2d-main" :class="isChart ? 'meta2d-chart': 'meta2d-project'" @contextmenu="onContextMenu($event)" style="position: relative">
|
<div class="meta2d-main" :class="isChart ? 'meta2d-chart': 'meta2d-project'" @contextmenu="onContextMenu($event)" style="position: relative">
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
:selectPens.sync="selectPens"
|
:selectPens.sync="selectPens"
|
||||||
:querysArray="querysArray"
|
:querysArray="querysArray"
|
||||||
:params="params"
|
:params="params"
|
||||||
|
:is-chart="isChart"
|
||||||
:meta2dId="meta2dId"
|
:meta2dId="meta2dId"
|
||||||
@updatePens="updatePens"
|
@updatePens="updatePens"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<meta2dCanvas :canvasProps="canvasProps" :params.sync="params" :meta2dId='meta2dId' @changeActiveName="changeActiveName" ref ='meta2dCanvas'/>
|
<meta2dCanvas :canvasProps="canvasProps" :params.sync="params" :meta2dId='meta2dId' @changeActiveName="changeActiveName" ref ='meta2dCanvas'/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('project.topology.data')" name="data">
|
<el-tab-pane :label="$t('project.topology.data')" name="data">
|
||||||
<meta2dData :querysArray.sync="querysArray" :params.sync="params" ref="meta2dData"/>
|
<meta2dData :querysArray.sync="querysArray" :params.sync="params" ref="meta2dData" :isChart="isChart"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,7 +33,8 @@ export default {
|
|||||||
querysArray: {},
|
querysArray: {},
|
||||||
params: {},
|
params: {},
|
||||||
meta2dId: {},
|
meta2dId: {},
|
||||||
modules: {}
|
modules: {},
|
||||||
|
isChart: {}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
meta2dElement,
|
meta2dElement,
|
||||||
|
|||||||
@@ -142,11 +142,24 @@
|
|||||||
<div class="topology-box">
|
<div class="topology-box">
|
||||||
<div class="topology-mc"></div>
|
<div class="topology-mc"></div>
|
||||||
<!-- <diagram :topoData="chartConfig.param.topo" :fromChartBox="true" :topologyIndexF="-1"/>-->
|
<!-- <diagram :topoData="chartConfig.param.topo" :fromChartBox="true" :topologyIndexF="-1"/>-->
|
||||||
<meta2dMain :meta2dId="'rightBoxChart'" :topoData="chartConfig.param.topo" :querysArray="[]" :params="params" :iconArray="iconArray" @reload="reload"/>
|
<meta2dMain :meta2dId="'rightBoxChart'" :topoData="chartConfig.param.topo" :querysArray="querysArray" :params="{timeType: 5}" :iconArray="iconArray" @reload="reloadTopo" :isChart="true"/>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!--topplogy-->
|
<!--topplogy-->
|
||||||
<diagram :topoData="chartConfig.param.topo" class="topology-dialog" v-if="topologyDialog" @change="topologyDialogChange" :topologyIndexF="-2" ref="topologyDialog" :fromTopologyDialog="true"/>
|
<meta2dMain
|
||||||
|
@save="saveTopo"
|
||||||
|
class="topology-dialog"
|
||||||
|
v-if="topologyDialog"
|
||||||
|
ref="rightBoxChartEdit"
|
||||||
|
:meta2dId="'rightBoxChartEdit'"
|
||||||
|
:topoData="chartConfig.param.topo"
|
||||||
|
:querysArray="querysArray"
|
||||||
|
:params="{timeType: 5}"
|
||||||
|
:iconArray="iconArray"
|
||||||
|
@reload="reloadTopo"
|
||||||
|
@exit="topologyDialogChange"
|
||||||
|
:isChart="true"
|
||||||
|
/>
|
||||||
<!--text-->
|
<!--text-->
|
||||||
<el-form-item v-if="isText(chartConfig.type)" :rules="{ required: true, message: $t('validate.required'), trigger: 'change' }" prop="param.text">
|
<el-form-item v-if="isText(chartConfig.type)" :rules="{ required: true, message: $t('validate.required'), trigger: 'change' }" prop="param.text">
|
||||||
<rich-text-editor ref="richTextEditor" :edit-data="chartConfig.param.text" @textChange="textChange"></rich-text-editor>
|
<rich-text-editor ref="richTextEditor" :edit-data="chartConfig.param.text" @textChange="textChange"></rich-text-editor>
|
||||||
@@ -291,23 +304,47 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<el-dialog
|
||||||
|
:title="this.chartConfig.name || 'Chart'"
|
||||||
|
:visible.sync="isPreview.show"
|
||||||
|
fullscreen
|
||||||
|
class="no-transform-dialog"
|
||||||
|
custom-class="nz-new-dialog meta2d-preview"
|
||||||
|
:append-to-body="false"
|
||||||
|
:modal-append-to-body="false"
|
||||||
|
@close="isPreview.show = false"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<div v-if="isPreview.show" style="width: 100%;height: 100%">
|
||||||
|
<meta2dMain
|
||||||
|
:meta2dId="'projectIdIsPreview'"
|
||||||
|
:is-preview="true"
|
||||||
|
:name="'preview'"
|
||||||
|
:topoData="isPreview.topoData"
|
||||||
|
:querysArray="isPreview.querysArray"
|
||||||
|
:project="isPreview.currentProject"
|
||||||
|
:params="isPreview.params"
|
||||||
|
:iconArray="iconArray"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import publicConfig from '@/components/common/rightBox/chart/publicConfig'
|
import publicConfig from '@/components/common/rightBox/chart/publicConfig'
|
||||||
import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
|
import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
|
||||||
import diagram from '@/components/common/ChartDiagram/diagram'
|
|
||||||
import richTextEditor from '@/components/chart/richTextEditor'
|
import richTextEditor from '@/components/chart/richTextEditor'
|
||||||
import beforeMeta2d from '@/components/common/mixin/beforeMeta2d'
|
import beforeMeta2d from '@/components/common/mixin/beforeMeta2d'
|
||||||
import meta2dMain from '@/components/common/project/meta2d/meta2dMain'
|
import meta2dMain from '@/components/common/project/meta2d/meta2dMain'
|
||||||
import { clearTopology } from '@/components/common/js/common'
|
import { clearTopology } from '@/components/common/js/common'
|
||||||
|
import bus from "@/libs/bus";
|
||||||
export default {
|
export default {
|
||||||
name: 'otherChartConfig',
|
name: 'otherChartConfig',
|
||||||
mixins: [publicConfig, chartTypeShow, beforeMeta2d],
|
mixins: [publicConfig, chartTypeShow],
|
||||||
components: {
|
components: {
|
||||||
diagram,
|
richTextEditor,
|
||||||
richTextEditor
|
meta2dMain
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 'chartConfig.param.text': {
|
// 'chartConfig.param.text': {
|
||||||
@@ -350,12 +387,27 @@ export default {
|
|||||||
id: 'clock',
|
id: 'clock',
|
||||||
name: this.$t('dashboard.dashboard.chartForm.typeVal.clock.label')
|
name: this.$t('dashboard.dashboard.chartForm.typeVal.clock.label')
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
topoData: {},
|
||||||
|
querysArray: [],
|
||||||
|
meta2dType: '',
|
||||||
|
iconArray: [],
|
||||||
|
isPreview: {
|
||||||
|
show: false,
|
||||||
|
topoData: {},
|
||||||
|
querysArray: {},
|
||||||
|
currentProject: {},
|
||||||
|
params: {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init () {
|
init () {
|
||||||
this.chartConfig = JSON.parse(JSON.stringify(this.params))
|
this.chartConfig = JSON.parse(JSON.stringify(this.params))
|
||||||
|
this.reloadTopo()
|
||||||
|
bus.$on('showMeta2dPreview', (params) => {
|
||||||
|
this.isPreview = params
|
||||||
|
})
|
||||||
},
|
},
|
||||||
chartTypeChange (type) {
|
chartTypeChange (type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -449,20 +501,56 @@ export default {
|
|||||||
},
|
},
|
||||||
topologyDialogChange (flag, data) {
|
topologyDialogChange (flag, data) {
|
||||||
this.topologyDialog = flag
|
this.topologyDialog = flag
|
||||||
|
if (flag) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.rightBoxChartEdit.$refs.header.editMeta2d()
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
if (data) {
|
if (data) {
|
||||||
this.chartConfig.param.topo = data
|
this.chartConfig.param.topo = data
|
||||||
this.change()
|
this.change()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
saveTopo (topo) {
|
||||||
|
this.topologyDialogChange(false, topo)
|
||||||
|
},
|
||||||
textChange (val) {
|
textChange (val) {
|
||||||
const html = `<div class="editor-core ql-container ql-snow"><div class="ql-editor">${val}</div></div>`
|
const html = `<div class="editor-core ql-container ql-snow"><div class="ql-editor">${val}</div></div>`
|
||||||
this.chartConfig.param.text = html
|
this.chartConfig.param.text = html
|
||||||
this.$refs.chartForm.validateField('param.text')
|
this.$refs.chartForm.validateField('param.text')
|
||||||
this.change()
|
this.change()
|
||||||
|
},
|
||||||
|
reloadTopo () {
|
||||||
|
const res = {
|
||||||
|
data: this.chartConfig.param
|
||||||
|
}
|
||||||
|
if (res.data && res.data.topo) {
|
||||||
|
this.topoData = res.data.topo || {}
|
||||||
|
if (res.data.topo.topo) {
|
||||||
|
this.topoData = res.data.topo.topo || {}
|
||||||
|
}
|
||||||
|
this.querysArray = res.data.topo.elements || []
|
||||||
|
// this.params = {
|
||||||
|
// timeType: res.data.topo.timeType || 5
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
this.topoData = {}
|
||||||
|
this.querysArray = []
|
||||||
|
// this.params = {
|
||||||
|
// timeType: 5
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.init()
|
this.init()
|
||||||
|
this.$get('/topology/icon').then(res => {
|
||||||
|
this.iconArray = [...res.data.list]
|
||||||
|
})
|
||||||
|
},
|
||||||
|
destroyed () {
|
||||||
|
clearTopology()
|
||||||
|
bus.$off('showMeta2dPreview')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user