提交 220d764f 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

修改模板默认绑定key

上级 07ee7a48
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div> <div>
<div class="search-term"> <div class="search-term">
<el-form :inline="true" :model="searchInfo" class="demo-form-inline"> <el-form :inline="true" :model="searchInfo" class="demo-form-inline">
此处可使用表单生成器生成搜索条件 此处请使用表单生成器生成form填充 表单默认绑定 formData 如手动修改过请自行修改key
<el-form-item> <el-form-item>
<el-button @click="openDialog" type="primary">新增</el-button> <el-button @click="openDialog" type="primary">新增</el-button>
</el-form-item> </el-form-item>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
></el-pagination> ></el-pagination>
<el-dialog :before-close="closeDialog" :visible.sync="dialogFormVisible" title="弹窗操作"> <el-dialog :before-close="closeDialog" :visible.sync="dialogFormVisible" title="弹窗操作">
此处请使用表单生成器生成form填充 此处请使用表单生成器生成form填充 表单默认绑定 formData 如手动修改过请自行修改key
<div class="dialog-footer" slot="footer"> <div class="dialog-footer" slot="footer">
<el-button @click="closeDialog">取 消</el-button> <el-button @click="closeDialog">取 消</el-button>
<el-button @click="enterDialog" type="primary">确 定</el-button> <el-button @click="enterDialog" type="primary">确 定</el-button>
...@@ -79,7 +79,7 @@ export default { ...@@ -79,7 +79,7 @@ export default {
dialogFormVisible: false, dialogFormVisible: false,
visible: false, visible: false,
type: "", type: "",
form: { formData: {
{{range .Fields}}{{.FieldJson}}:null,{{ end }} {{range .Fields}}{{.FieldJson}}:null,{{ end }}
} }
}; };
...@@ -99,13 +99,13 @@ export default { ...@@ -99,13 +99,13 @@ export default {
const res = await find{{.StructName}}({ ID: row.ID }); const res = await find{{.StructName}}({ ID: row.ID });
this.type = "update"; this.type = "update";
if (res.code == 0) { if (res.code == 0) {
this.form = res.data.re{{.Abbreviation}}; this.formData = res.data.re{{.Abbreviation}};
this.dialogFormVisible = true; this.dialogFormVisible = true;
} }
}, },
closeDialog() { closeDialog() {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.form = { this.formData = {
{{range .Fields}} {{range .Fields}}
{{.FieldJson}}:null,{{ end }} {{.FieldJson}}:null,{{ end }}
}; };
...@@ -125,13 +125,13 @@ export default { ...@@ -125,13 +125,13 @@ export default {
let res; let res;
switch (this.type) { switch (this.type) {
case "create": case "create":
res = await create{{.StructName}}(this.form); res = await create{{.StructName}}(this.formData);
break; break;
case "update": case "update":
res = await update{{.StructName}}(this.form); res = await update{{.StructName}}(this.formData);
break; break;
default: default:
res = await create{{.StructName}}(this.form); res = await create{{.StructName}}(this.formData);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册