yxh пре 4 година
родитељ
комит
86d601142a

+ 2 - 1
app/system/service/tools_gen_table.go

@@ -349,6 +349,7 @@ func (s *toolsGenTable) SaveEdit(req *dao.ToolsGenTableEditReq) (err error) {
 					dbColumn.ColumnComment = column.ColumnComment
 					dbColumn.GoType = column.GoType
 					dbColumn.HtmlType = column.HtmlType
+					dbColumn.HtmlField = column.HtmlField
 					dbColumn.QueryType = column.QueryType
 					dbColumn.GoField = column.GoField
 					dbColumn.DictType = column.DictType
@@ -426,7 +427,7 @@ func (s *toolsGenTable) GenCode(ids []int, ctx context.Context) (err error) {
 		return gerror.New("获取本地路径失败")
 	}
 	frontDir := g.Cfg().GetString("gen.frontDir")
-	if !gfile.IsDir(frontDir){
+	if !gfile.IsDir(frontDir) {
 		err = gerror.New("项目前端路径不存在,请检查是否已在配置文件中配置!")
 		return
 	}

+ 1 - 1
template/vm/go/dao.template

@@ -100,7 +100,7 @@ type {{.table.ClassName}}ListRes struct {
     {{end}}
     {{else}}
     {{range $index, $column := .table.Columns}}
-    {{if eq $column.IsList "1" }}
+    {{if or (eq $column.IsList "1") (eq $column.IsPk "1") }}
     {{$column.GoField}}  {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "images" "file" "files"}}[]*comModel.UpFile{{else}}{{$column.GoType}}{{end}}   `json:"{{$column.HtmlField}}"`
     {{end}}
     {{end}}

+ 1 - 1
template/vm/go/service.template

@@ -149,7 +149,7 @@ func (s *{{$structName}}) GetList(req *dao.{{.table.ClassName}}SearchReq) (total
             {{end}}
             {{else}}
             {{range $index, $column := .table.Columns}}
-            {{if eq $column.IsList "1"}}
+            {{if or (eq $column.IsList "1") (eq $column.IsPk "1")}}
             {{if eq $column.HtmlType "images" "file" "files"}}
             {{$column.GoField}} : {{$column.HtmlField}},
             {{else}}

+ 2 - 2
template/vm/vue/list-vue.template

@@ -97,7 +97,7 @@
     <el-table v-loading="loading" :data="{{$businessName}}List" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       {{range $index, $column := .table.Columns}}
-      {{if eq $column.IsPk "1"}}
+      {{if and (eq $column.IsPk "1") (eq $column.IsList "1")}}
       <el-table-column label="{{$column.ColumnComment}}" align="center" prop="{{$column.HtmlField}}" />
       {{else if and (eq $column.IsList "1") (eq $column.HtmlType "datetime")}}
       <el-table-column label="{{$column.ColumnComment}}" align="center" prop="{{$column.HtmlField}}" width="180">
@@ -128,7 +128,7 @@
             ></el-switch>
         </template>
       </el-table-column>
-      {{else if ne $column.LinkTableName ""}}
+      {{else if and (eq $column.IsList "1") (ne $column.LinkTableName "")}}
       <el-table-column label="{{$column.ColumnComment}}" align="center" prop="{{$column.HtmlField}}" :formatter="{{$column.HtmlField}}Format" width="100">
         <template slot-scope="scope">
           {{VueTag "{{" }} {{$column.HtmlField}}Format(scope.row) {{VueTag "}}" }}