mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-27 02:59:26 +08:00
修改字段页面,增加一些字段属性
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package consts
|
||||
|
||||
// 生成代码类型
|
||||
@@ -79,3 +78,18 @@ const (
|
||||
GenCodesIndexPK = "PRI" // 主键索引
|
||||
GenCodesIndexUNI = "UNI" // 唯一索引
|
||||
)
|
||||
|
||||
// 表格字段显示位置
|
||||
const (
|
||||
ListShowHide = 1
|
||||
ListShowLeft = 2
|
||||
ListShowCenter = 3
|
||||
ListShowRight = 4
|
||||
)
|
||||
|
||||
var ListShowMap = map[int]string{
|
||||
ListShowHide: "不显示",
|
||||
ListShowLeft: "居左显示",
|
||||
ListShowCenter: "居中显示",
|
||||
ListShowRight: "居右显示",
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -20,19 +20,24 @@ type GenCodesColumn struct {
|
||||
Extra string `json:"extra" dc:"额外选项"`
|
||||
// 自定义生成属性
|
||||
// Alias string `json:"alias" dc:"字段别名"`
|
||||
GoName string `json:"goName" dc:"Go属性"`
|
||||
GoType string `json:"goType" dc:"Go类型"`
|
||||
TsName string `json:"tsName" dc:"Ts属性"`
|
||||
TsType string `json:"tsType" dc:"Ts类型"`
|
||||
IsList bool `json:"isList" dc:"列表"`
|
||||
IsExport bool `json:"isExport" dc:"导出"`
|
||||
IsSort bool `json:"isSort" dc:"排序"`
|
||||
IsQuery bool `json:"isQuery" dc:"查询"`
|
||||
QueryWhere string `json:"queryWhere" dc:"查询条件"`
|
||||
IsEdit bool `json:"isEdit" dc:"编辑"`
|
||||
Required bool `json:"required" dc:"必填"`
|
||||
Unique bool `json:"unique" dc:"唯一性"`
|
||||
FormMode string `json:"formMode" dc:"表单组件"`
|
||||
FormRole string `json:"formRole" dc:"表单验证"`
|
||||
DictType int64 `json:"dictType" dc:"字典类型ID"`
|
||||
GoName string `json:"goName" dc:"Go属性"`
|
||||
GoType string `json:"goType" dc:"Go类型"`
|
||||
TsName string `json:"tsName" dc:"Ts属性"`
|
||||
TsType string `json:"tsType" dc:"Ts类型"`
|
||||
IsList bool `json:"isList" dc:"列表"`
|
||||
IsExport bool `json:"isExport" dc:"导出"`
|
||||
IsSort bool `json:"isSort" dc:"排序"`
|
||||
IsQuery bool `json:"isQuery" dc:"查询"`
|
||||
QueryWhere string `json:"queryWhere" dc:"查询条件"`
|
||||
IsEdit bool `json:"isEdit" dc:"编辑"`
|
||||
Required bool `json:"required" dc:"必填"`
|
||||
Unique bool `json:"unique" dc:"唯一性"`
|
||||
FormMode string `json:"formMode" dc:"表单组件"`
|
||||
FormRole string `json:"formRole" dc:"表单验证"`
|
||||
DictType int64 `json:"dictType" dc:"字典类型ID"`
|
||||
ListShow int64 `json:"listShow" dc:"显示状态"`
|
||||
Width int64 `json:"width" dc:"单元格宽度"`
|
||||
Placeholder string `json:"placeholder" dc:"占位符"`
|
||||
ShowCondition string `json:"showCondition" dc:"显示条件"`
|
||||
Attribute []string `json:"attribute" dc:"其他属性"`
|
||||
}
|
||||
|
||||
@@ -7,9 +7,11 @@ package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/text/gregex"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model"
|
||||
"hotgo/internal/model/entity"
|
||||
@@ -89,6 +91,7 @@ type GenCodesSelectsModel struct {
|
||||
FormRole form.Selects `json:"formRole" dc:"表单验证"`
|
||||
DictMode []*DictTypeTree `json:"dictMode" dc:"字典类型"`
|
||||
WhereMode form.Selects `json:"whereMode" dc:"查询条件"`
|
||||
ListShow form.Selects `json:"listShow" dc:"显示位置"`
|
||||
Addons form.Selects `json:"addons" dc:"插件选项"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user