瀏覽代碼

代码生成前端页面错误修复

yxh 5 年之前
父節點
當前提交
f6620c08d8
共有 3 個文件被更改,包括 7 次插入7 次删除
  1. 3 3
      template/vm/go/crud/model.template
  2. 2 2
      template/vm/html/vue_crud.template
  3. 2 2
      template/vm/html/vue_tree.template

+ 3 - 3
template/vm/go/crud/model.template

@@ -108,13 +108,13 @@ func SelectListByPage(req *SelectPageReq) (total int, page int64, list []*Entity
 		{{range $index, $column := .table.Columns}} {{if eq $column.IsQuery "1"}}
 		{{if eq $column.QueryType "LIKE"}}
 			if req.{{$column.GoField}} != "" {
-				model.Where("{{$column.ColumnName}} like ?", "%"+req.{{$column.GoField}}+"%")
+				model = model.Where("{{$column.ColumnName}} like ?", "%"+req.{{$column.GoField}}+"%")
 			} {{else if eq $column.QueryType "EQ"}} {{if eq $column.GoType "string"}}
 			if req.{{$column.GoField}} != "" {
-				model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}})
+				model = model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}})
 			} {{else if eq $column.GoType "int" "int64"}}
 			if req.{{$column.GoField}} != 0 {
-				model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}})
+				model = model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}})
 			}
 		{{end}} {{end}} {{end}} {{end}}
 	}

+ 2 - 2
template/vm/html/vue_crud.template

@@ -383,7 +383,7 @@ export default {
 {{end}}
           if (this.form.{{$pkColumnName}} != null) {
             update{{.table.BusinessName|UcFirst}}(this.form).then(response => {
-              if (response.code === 200) {
+              if (response.code === 0) {
                 this.msgSuccess("修改成功");
                 this.open = false;
                 this.getList();
@@ -391,7 +391,7 @@ export default {
             });
           } else {
             add{{.table.BusinessName|UcFirst}}(this.form).then(response => {
-              if (response.code === 200) {
+              if (response.code === 0) {
                 this.msgSuccess("新增成功");
                 this.open = false;
                 this.getList();

+ 2 - 2
template/vm/html/vue_tree.template

@@ -383,7 +383,7 @@ export default {
 {{end}}
           if (this.form.{{$pkColumnName}} != null) {
             update{{.table.BusinessName|UcFirst}}(this.form).then(response => {
-              if (response.code === 200) {
+              if (response.code === 0) {
                 this.msgSuccess("修改成功");
                 this.open = false;
                 this.getList();
@@ -391,7 +391,7 @@ export default {
             });
           } else {
             add{{.table.BusinessName|UcFirst}}(this.form).then(response => {
-              if (response.code === 200) {
+              if (response.code === 0) {
                 this.msgSuccess("新增成功");
                 this.open = false;
                 this.getList();