提交 8926ecbe authored 作者: wangjiahao's avatar wangjiahao

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

上级 ff6baf8a
...@@ -35,11 +35,12 @@ ...@@ -35,11 +35,12 @@
import { panelSave } from '@/api/panel/panel' import { panelSave } from '@/api/panel/panel'
import { showTemplateList } from '@/api/system/template' import { showTemplateList } from '@/api/system/template'
import TemplateAllList from './TemplateAllList' import TemplateAllList from './TemplateAllList'
import { deepCopy } from '@/components/canvas/utils/utils'
export default { export default {
components: { TemplateAllList }, components: { TemplateAllList },
props: { props: {
editPanel: { editPanelOut: {
type: Object, type: Object,
required: true required: true
} }
...@@ -55,7 +56,8 @@ export default { ...@@ -55,7 +56,8 @@ export default {
templateList: [], templateList: [],
importTemplateInfo: { importTemplateInfo: {
snapshot: '' snapshot: ''
} },
editPanel: null
} }
}, },
computed: { computed: {
...@@ -70,14 +72,20 @@ export default { ...@@ -70,14 +72,20 @@ export default {
} }
}, },
watch: { watch: {
inputType() { inputType(newVal) {
this.editPanel.panelInfo.name = null debugger
this.editPanel.panelInfo.panelStyle = null if (newVal === 'self') {
this.editPanel.panelInfo.panelData = null this.editPanel = deepCopy(this.editPanelOut)
this.importTemplateInfo.snapshot = null } else {
this.editPanel.panelInfo.name = null
this.editPanel.panelInfo.panelStyle = null
this.editPanel.panelInfo.panelData = null
this.importTemplateInfo.snapshot = null
}
} }
}, },
created() { created() {
this.editPanel = deepCopy(this.editPanelOut)
// this.getTree() // this.getTree()
}, },
mounted() { mounted() {
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
</el-dialog> </el-dialog>
<!--新建仪表板dialog--> <!--新建仪表板dialog-->
<el-dialog v-dialogDrag :title="panelDialogTitle" :visible.sync="editPanel.visible" :show-close="true" width="600px"> <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-dialog>
</el-col> </el-col>
</el-col> </el-col>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论