fix: 新建仪表板时,来回切换新建仪表板和复用仪表板再保存报错问题

This commit is contained in:
wangjiahao 2021-06-25 14:28:27 +08:00
parent ff6baf8a93
commit 8926ecbebc
2 changed files with 16 additions and 8 deletions

View File

@ -35,11 +35,12 @@
import { panelSave } from '@/api/panel/panel'
import { showTemplateList } from '@/api/system/template'
import TemplateAllList from './TemplateAllList'
import { deepCopy } from '@/components/canvas/utils/utils'
export default {
components: { TemplateAllList },
props: {
editPanel: {
editPanelOut: {
type: Object,
required: true
}
@ -55,7 +56,8 @@ export default {
templateList: [],
importTemplateInfo: {
snapshot: ''
}
},
editPanel: null
}
},
computed: {
@ -70,14 +72,20 @@ export default {
}
},
watch: {
inputType() {
this.editPanel.panelInfo.name = null
this.editPanel.panelInfo.panelStyle = null
this.editPanel.panelInfo.panelData = null
this.importTemplateInfo.snapshot = null
inputType(newVal) {
debugger
if (newVal === 'self') {
this.editPanel = deepCopy(this.editPanelOut)
} else {
this.editPanel.panelInfo.name = null
this.editPanel.panelInfo.panelStyle = null
this.editPanel.panelInfo.panelData = null
this.importTemplateInfo.snapshot = null
}
}
},
created() {
this.editPanel = deepCopy(this.editPanelOut)
// this.getTree()
},
mounted() {

View File

@ -164,7 +164,7 @@
</el-dialog>
<!--新建仪表板dialog-->
<el-dialog v-dialogDrag :title="panelDialogTitle" :visible.sync="editPanel.visible" :show-close="true" width="600px">
<edit-panel v-if="editPanel.visible" :edit-panel="editPanel" @closeEditPanelDialog="closeEditPanelDialog" @newPanelSave="newPanelSave" />
<edit-panel v-if="editPanel.visible" :edit-panel-out="editPanel" @closeEditPanelDialog="closeEditPanelDialog" @newPanelSave="newPanelSave" />
</el-dialog>
</el-col>
</el-col>