diff --git a/code/makecode.go b/code/makecode.go index 1e42642..239029b 100644 --- a/code/makecode.go +++ b/code/makecode.go @@ -365,6 +365,7 @@ func (that *MakeCode) Db2JSON(name string, path string, db db.HoTimeDB) { sv["value"] = nil sv["options"] = append(sv.GetSlice("options"), Map{"name": "全部", "value": nil}) that.TableConfig.GetMap(fk)["search"] = append(search, sv) + that.SearchColumns[fk][k] = sv } //虚招后缀是_id结尾的表字段 假设org_id @@ -440,6 +441,21 @@ func (that *MakeCode) Db2JSON(name string, path string, db db.HoTimeDB) { } } + //搜索增加树节点 + for fk, fv := range that.TableColumns { + for k, v := range fv { + if v.GetString("link") != "" && that.SearchColumns[fk][k] == nil && + that.TableColumns[v.GetString("link")]["parent_id"] != nil { + //搜索服务 + search := that.TableConfig.GetMap(fk).GetSlice("search") + sv := Map{"type": "tree", "label": v["label"], "name": v["name"], "value": v["value"], "link": v["link"]} + that.TableConfig.GetMap(fk)["search"] = append(search, sv) + + that.SearchColumns[fk][k] = sv + } + } + } + fmt.Println(id, "---", that.Config.GetString("id")) that.Config["id"] = id //init文件初始化 @@ -610,7 +626,7 @@ func (that *MakeCode) Search(table string, req *http.Request, db *db.HoTimeDB) ( continue } - data[searchItemName] = reqValue + data[table+"."+searchItemName] = reqValue } //树节点模式搜索