修改字段页面,增加一些字段属性

This commit is contained in:
嘉泽
2023-11-30 22:21:25 +08:00
parent cbd887701b
commit db61f050d4
12 changed files with 547 additions and 168 deletions

View File

@@ -6,13 +6,16 @@
package hggen
import (
_ "hotgo/internal/library/hggen/internal/cmd/gendao"
"context"
"sort"
_ "unsafe"
"context"
_ "hotgo/internal/library/hggen/internal/cmd/gendao"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts"
"hotgo/internal/library/addons"
"hotgo/internal/library/hggen/internal/cmd"
@@ -23,7 +26,6 @@ import (
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"sort"
)
//go:linkname doGenDaoForArray hotgo/internal/library/hggen/internal/cmd/gendao.doGenDaoForArray
@@ -130,6 +132,15 @@ func TableSelects(ctx context.Context, in *sysin.GenCodesSelectsInp) (res *sysin
})
}
for k, v := range consts.ListShowMap {
res.ListShow = append(res.ListShow, &form.Select{
Value: k,
Name: v,
Label: v,
})
}
sort.Sort(res.ListShow)
res.Addons = addons.ModuleSelect()
return
}

View File

@@ -8,14 +8,16 @@ package views
import (
"context"
"fmt"
"strings"
"hotgo/internal/library/hggen/internal/cmd/gendao"
"hotgo/internal/model/input/sysin"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/text/gregex"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/library/hggen/internal/cmd/gendao"
"hotgo/internal/model/input/sysin"
"strings"
)
// DoTableColumns 获取指定表生成字段列表
@@ -40,6 +42,8 @@ func DoTableColumns(ctx context.Context, in *sysin.GenCodesColumnListInp, config
} else {
CustomAttributes(ctx, field, config)
}
field.Width = 80
field.ListShow = 1
}
return
}

View File

@@ -3,11 +3,11 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package views
import (
"github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/model/input/sysin"
)
@@ -258,3 +258,12 @@ func HasSwitch(headOps []string, masterFields []*sysin.GenCodesColumnListModel)
}
return HasColumnWithFormMode(masterFields, "Switch")
}
// HasTableSort 是否包含表排序字段
func HasTableSort(masterFields []*sysin.GenCodesColumnListModel) bool {
for _, field := range masterFields {
return gstr.InArray(field.Attribute, "sort")
}
return false
}

View File

@@ -7,12 +7,16 @@ package views
import (
"context"
"runtime"
"strings"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/os/gview"
"github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/consts"
"hotgo/internal/library/hggen/internal/cmd/gendao"
"hotgo/internal/library/hggen/internal/utility/utils"
@@ -20,8 +24,6 @@ import (
"hotgo/internal/model/input/sysin"
"hotgo/utility/convert"
"hotgo/utility/file"
"runtime"
"strings"
)
var Curd = gCurd{}
@@ -41,6 +43,7 @@ type CurdStep struct {
HasSwitch bool `json:"hasSwitch"`
HasCheck bool `json:"hasCheck"`
HasMenu bool `json:"hasMenu"`
HasSort bool `json:"hasSort"`
}
type CurdOptionsJoin struct {
@@ -152,6 +155,7 @@ func initStep(in *CurdPreviewInput) {
in.options.Step.HasSwitch = HasSwitch(in.options.ColumnOps, in.masterFields)
in.options.Step.HasCheck = gstr.InArray(in.options.ColumnOps, "check")
in.options.Step.HasMenu = gstr.InArray(in.options.AutoOps, "genMenuPermissions")
in.options.Step.HasSort = HasTableSort(in.masterFields)
}
func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) (err error) {