Merge pull request #639 from dataease/pr@dev@refactor_panel-edit-return

refactor:仪表板编辑视图样式优化
This commit is contained in:
王嘉豪 2021-08-16 18:33:49 +08:00 committed by GitHub
commit 7441be315c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,9 @@ export default {
httpRequest: { httpRequest: {
status: true, status: true,
msg: '' msg: ''
} },
timeMachine: null,
changeIndex: 0
} }
}, },
computed: { computed: {
@ -131,6 +133,9 @@ export default {
chartType() { chartType() {
return this.chart.type return this.chart.type
}, },
hw() {
return this.outStyle.width * this.outStyle.height
},
...mapState([ ...mapState([
'canvasStyleData', 'canvasStyleData',
'nowPanelTrackInfo' 'nowPanelTrackInfo'
@ -163,6 +168,22 @@ export default {
deep: true deep: true
}, },
// //
'hw': {
handler(newVal, oldVla) {
// console.log('hw:' + newVal + '---' + oldVla)
if (newVal !== oldVla) {
this.destroyTimeMachine()
this.changeIndex++
this.chartResize(this.changeIndex)
}
//
// if (this.$refs[this.element.propValue.id]) {
// this.$refs[this.element.propValue.id].chartResize()
// }
},
deep: true
},
//
outStyle: { outStyle: {
handler(newVal, oldVla) { handler(newVal, oldVla) {
// //
@ -392,11 +413,21 @@ export default {
} }
} }
}, },
// chart destroyTimeMachine() {
chartResize() { this.timeMachine && clearTimeout(this.timeMachine)
this.timeMachine = null
},
//
chartResize(index) {
if (this.$refs[this.element.propValue.id]) { if (this.$refs[this.element.propValue.id]) {
this.timeMachine = setTimeout(() => {
if (index === this.changeIndex) {
this.$refs[this.element.propValue.id].chartResize() this.$refs[this.element.propValue.id].chartResize()
} }
this.destroyTimeMachine()
}, 200)
}
} }
} }
} }