修改代码生成form表单模板
This commit is contained in:
parent
6433861fe7
commit
2cc6e1d0ec
@ -41,7 +41,9 @@
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||
<el-row>
|
||||
{VueViewFormContent}
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
@ -63,7 +65,7 @@ import {
|
||||
{VueComponentImport}
|
||||
|
||||
export default {
|
||||
name: '{ModelTypeName}',
|
||||
name: "{ModelTypeName}",
|
||||
components: { {VueComponent} },
|
||||
data() {
|
||||
return {
|
||||
@ -146,7 +148,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.{PrimaryKey});
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !=1
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
@ -187,7 +189,7 @@ export default {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.{PrimaryKey} != undefined || this.title === '修改数据') {
|
||||
if (this.form.{PrimaryKey} != undefined || this.title === "修改数据") {
|
||||
update{ModelTypeName}(this.form).then((res) => {
|
||||
if (!res.data) {
|
||||
this.msgError("修改失败");
|
||||
|
||||
@ -152,7 +152,6 @@ namespace ZR.CodeGenerator
|
||||
{
|
||||
return sb.ToString();
|
||||
}
|
||||
sb.AppendLine(" <el-row>");
|
||||
if (dbFieldInfo.HtmlType == GenConstants.HTML_INPUT_NUMBER)
|
||||
{
|
||||
sb.AppendLine(" <el-col :span=\"12\">");
|
||||
@ -173,6 +172,7 @@ namespace ZR.CodeGenerator
|
||||
else if (dbFieldInfo.HtmlType == GenConstants.HTML_IMAGE_UPLOAD)
|
||||
{
|
||||
//图片
|
||||
sb.AppendLine(" <el-col :span=\"24\">");
|
||||
sb.AppendLine($" <el-form-item label=\"{labelName}\" :label-width=\"labelWidth\" prop=\"{columnName}\">");
|
||||
sb.AppendLine($" <el-upload class=\"avatar-uploader\" name=\"file\" action=\"/api/upload/saveFile/\" :show-file-list=\"false\" :on-success=\"handleUpload{dbFieldInfo.CsharpField}Success\" :before-upload=\"beforeFileUpload\">");
|
||||
sb.AppendLine($" <img v-if=\"form.{columnName}\" :src=\"form.{columnName}\" class=\"icon\">");
|
||||
@ -188,7 +188,7 @@ namespace ZR.CodeGenerator
|
||||
sb.AppendLine(" <el-col :span=\"12\">");
|
||||
sb.AppendLine($" <el-form-item label=\"{labelName}\" :label-width=\"labelWidth\" prop=\"{columnName}\">");
|
||||
sb.AppendLine($" <el-radio-group v-model=\"form.{columnName}\">");
|
||||
sb.AppendLine($" <el-radio v-for=\"item in {columnName}Options\" :key=\"item.dictValue\" :label=\"{value}\">{{item.dictLabel}}</el-radio>");
|
||||
sb.AppendLine($" <el-radio v-for=\"item in {columnName}Options\" :key=\"item.dictValue\" :label=\"{value}\">{{{{item.dictLabel}}}}</el-radio>");
|
||||
sb.AppendLine(" </el-radio-group>");
|
||||
sb.AppendLine(" </el-form-item>");
|
||||
sb.AppendLine(" </el-col>");
|
||||
@ -241,7 +241,6 @@ namespace ZR.CodeGenerator
|
||||
sb.AppendLine(" </el-col>");
|
||||
}
|
||||
|
||||
sb.AppendLine(" </el-row>");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user