Merge pull request #3371 from dataease/pr@dev@fix_task_report_viewIds

fix(定时报告): 表单中视图数据无法回显
This commit is contained in:
dataeaseShu 2022-10-18 12:32:14 +08:00 committed by GitHub
commit 707976266f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,28 +112,11 @@ export default {
value(val, old) {
this.innerValues = val
},
innerValues(val, old) {
if (val !== old) {
this.$emit('input', val)
}
},
panelId(val, old) {
if (val !== old) {
this.innerValues = []
this.loadView()
}
},
selectedViews: {
handler(val) {
if (!val || !JSON.stringify(val)) {
this.innerValues = []
return
}
const viewIds = JSON.parse(JSON.stringify(val))
this.innerValues = JSON.parse(JSON.stringify(viewIds))
},
deep: true
}
},
mounted() {
@ -147,7 +130,6 @@ export default {
},
methods: {
loadView() {
this._selectClearFun()
this.innerValues = this.value
this.viewLoaded = false
this.panelId && findOne(this.panelId).then(response => {
@ -198,10 +180,15 @@ export default {
this.$store.dispatch('task/delView', { 'panelId': this.panelId, 'viewId': item })
}
})
const viewIds = JSON.parse(JSON.stringify(this.$store.getters.panelViews[this.panelId]))
this.$emit('input', viewIds)
},
_selectClearFun() {
this.$store.dispatch('task/delPanelViews', this.panelId)
const viewIds = JSON.parse(JSON.stringify(this.$store.getters.panelViews[this.panelId]))
this.$emit('input', viewIds)
},
init() {
if (this.value && this.value.length) {
const viewIds = JSON.parse(JSON.stringify(this.value))
@ -219,6 +206,7 @@ export default {
},
sureDialog() {
this.innerValues = JSON.parse(JSON.stringify(this.$store.getters.panelViews[this.panelId]))
this.$emit('input', this.innerValues)
this.closeDialog()
},
cancelDialog() {