forked from golang/hotime
加入树节点功能
This commit is contained in:
parent
9aa836a72c
commit
00ad6487b6
@ -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
|
||||
}
|
||||
|
||||
//树节点模式搜索
|
||||
|
Loading…
Reference in New Issue
Block a user