fix: 修改保存的参数

This commit is contained in:
zhangyu
2023-03-14 18:13:54 +08:00
parent a301c7e0c8
commit 488ba27f1c
4 changed files with 20 additions and 22 deletions

View File

@@ -20,20 +20,19 @@ export default {
if (this.currentProject.id) {
this.$get('monitor/project/topo', { projectId: this.currentProject.id }).then(res => {
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,
unit: res.data.topo.unit || 1,
statistic: res.data.topo.statistic || 'last',
timeType: res.data.topo.timeType || 5
}
} else {
this.topoData = {}
this.querysArray = []
this.params = {
timeType: 5,
unit: 1,
statistic: 'last'
timeType: 5
}
}
})

View File

@@ -100,8 +100,7 @@ export default {
/* 画布绑定事件 */
meta2d.beforeAddPens = (pens) => { // 添加画笔前
bus.$emit('changeDrawState')
const name = 'elements - ' + meta2d.store.data.pens.length
console.log('123123123123')
const name = 'elements-' + meta2d.store.data.pens.length
if (pens.length === 1) {
if (!pens[0].type) {
this.nodeInit(pens[0], name)
@@ -146,6 +145,9 @@ export default {
if (pen.data && pen.data.params) {
return
}
if (name) {
pen.text = name
}
pen.data = {
params: { // 用于编辑时 重置为节点初始状态
background: pen.background || '#22222200',
@@ -206,6 +208,9 @@ export default {
if (pen.data && pen.data.params) {
return
}
if (name) {
pen.text = name
}
pen.data = {
params: {
animateColor: pen.animateColor || '#FA901CFF',

View File

@@ -3,7 +3,7 @@
<div v-if="!isChart && !editFlag"> {{project && project.name}} </div>
<div class="tools-left" v-if="editFlag">
<topology-top-tool
v-if="editFlag&&toolShow"
v-if="editFlag&&toolShow&&!isPreview"
:meta2dId="meta2dId"
ref="topTool"
>
@@ -117,18 +117,11 @@ export default {
saveProject () {
const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
const timeType = this.$parent.$refs.meta2dProps.$refs.meta2dData.dataTimeType
const unit = this.$parent.$refs.meta2dProps.$refs.meta2dData.dataUnit
const statistic = this.$parent.$refs.meta2dProps.$refs.meta2dData.dataStatistic
const bkImageId = this.$parent.$refs.meta2dProps.$refs.meta2dCanvas.bkImageId
const params = {
topo: getTopology(this.meta2dId).data(),
elements: elements,
timeType: timeType || 1,
unit: unit || 1,
statistic: statistic || 'last',
bkImageId: bkImageId || ''
...getTopology(this.meta2dId).data()
}
params.elements = elements
params.timeType = timeType
this.$put('monitor/project/topo', { topo: JSON.stringify(params), projectId: this.project.id }).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
@@ -163,6 +156,7 @@ export default {
})
},
previewTopology () {
console.log(getTopology(this.meta2dId).data())
this.isPreview = true
const elements = this.$parent.$refs.meta2dProps.$refs.meta2dData.elements
const endTime = new Date().getTime()

View File

@@ -44,7 +44,7 @@
<div :id="meta2dId" style="height: 100%;width: 100%"></div>
</div>
<meta2dProps
v-if="editFlag || isPreview"
v-if="editFlag && !isPreview"
ref="meta2dProps"
:modules="modules"
:selectPens.sync="selectPens"