增加表关联新建功能,同时修复数据库bug
This commit is contained in:
parent
ada4a926c0
commit
d736a74198
@ -234,26 +234,34 @@ func (that *MakeCode) Db2JSON(name string, path string, db db.HoTimeDB) {
|
|||||||
coloum["sortable"] = true
|
coloum["sortable"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果是select类型需要设置options
|
|
||||||
if coloum.GetString("type") == "select" {
|
|
||||||
|
|
||||||
options := Slice{}
|
|
||||||
comments := strings.Split(info.GetString("label"), " ")
|
|
||||||
if len(comments) >= 2 {
|
|
||||||
optionComment := strings.Split(comments[1], ",")
|
|
||||||
for _, v := range optionComment {
|
|
||||||
optionSlice := strings.Split(v, "-")
|
|
||||||
if len(optionSlice) >= 2 {
|
|
||||||
options = append(options, Map{"name": optionSlice[1], "value": optionSlice[0]})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
coloum["options"] = options
|
|
||||||
}
|
|
||||||
|
|
||||||
if !coloum.GetBool("notUse") {
|
if !coloum.GetBool("notUse") {
|
||||||
that.TableConfig.GetMap(v.GetString("name"))["columns"] = append(that.TableConfig.GetMap(v.GetString("name")).GetSlice("columns"), coloum)
|
that.TableConfig.GetMap(v.GetString("name"))["columns"] = append(that.TableConfig.GetMap(v.GetString("name")).GetSlice("columns"), coloum)
|
||||||
}
|
}
|
||||||
|
//如果是select类型需要设置options
|
||||||
|
//if coloum.GetString("type") == "select" {
|
||||||
|
|
||||||
|
options := Slice{}
|
||||||
|
comments := strings.Split(info.GetString("label"), " ")
|
||||||
|
if len(comments) >= 2 {
|
||||||
|
optionComment := strings.Split(comments[1], ",")
|
||||||
|
for _, v := range optionComment {
|
||||||
|
optionSlice := strings.Split(v, "-")
|
||||||
|
if len(optionSlice) >= 2 {
|
||||||
|
options = append(options, Map{"name": optionSlice[1], "value": optionSlice[0]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if coloum.GetString("type") == "select" {
|
||||||
|
coloum["must"] = true
|
||||||
|
coloum["options"] = options
|
||||||
|
} else if len(options) > 0 {
|
||||||
|
coloum["must"] = true
|
||||||
|
coloum["options"] = options
|
||||||
|
coloum["type"] = "select"
|
||||||
|
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
//else {
|
//else {
|
||||||
|
Loading…
Reference in New Issue
Block a user