From 00ad6487b62559a5983ef19215dd8b64f65b8fb7 Mon Sep 17 00:00:00 2001 From: hoteas <925970985@qq.com> Date: Wed, 16 Jun 2021 06:10:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=A0=91=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/makecode.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 } //树节点模式搜索