Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Bug: 导入数据功能bug修复
Browse files Browse the repository at this point in the history
1.修复关闭弹窗未清空数据bug
2.更改 ‘返回编辑’ 按钮逻辑
  • Loading branch information
Wisenl committed Feb 6, 2020
1 parent 626b9bd commit f654119
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/app-main/components/main-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
>生成数据</el-button
>
<el-button @click="isShowCodePen = true" icon="el-icon-download" type="text"
>导入代码</el-button
>导入数据</el-button
>
<el-button @click="isShowCode = true" icon="el-icon-tickets" type="text"
>生成代码</el-button
Expand Down Expand Up @@ -47,6 +47,7 @@

<!-- 导入数据弹框 -->
<el-dialog
@close="handleJsonPenClose"
:visible.sync="isShowCodePen"
append-to-body
title="导入数据"
Expand All @@ -58,7 +59,7 @@
title="预览表单"
:visible.sync="innerDialogShow"
append-to-body>
<el-card class="box-card">
<el-card shadow="hover" class="box-card">
<ele-form
v-if="innerDialogShow"
:form-desc="jsonFormDesc"
Expand All @@ -70,7 +71,7 @@
</el-card>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmGen">生成表单</el-button>
<el-button @click="(innerDialogShow = isShowCodePen = false)">返回编辑</el-button>
<el-button @click="(innerDialogShow = false)">返回编辑</el-button>
</div>
</el-dialog>
<json-editor @input="jsonInput" :value="jsonPenData"></json-editor>
Expand Down Expand Up @@ -225,6 +226,13 @@ export default {
this.clearList()
this.updateFormAttr(formAttrDefault)
},
// 关闭 jsonPen 弹窗,清空数据
handleJsonPenClose() {
this.isShowCodePen = false
this.innerDialogShow = false
this.jsonData = {}
this.jsonFormDesc = {}
},
// 处理粘贴的json
handleJson() {
if (typeof this.jsonData !== 'object') {
Expand All @@ -243,8 +251,7 @@ export default {
// 确认生成表单
confirmGen() {
this.json2Form()
this.isShowCodePen = false
this.innerDialogShow = false
this.handleJsonPenClose()
},
// 处理json数据,将json 映射到操作面板 (list)
json2Form() {
Expand Down

0 comments on commit f654119

Please sign in to comment.