From d736a741989ea98ee50ceb4fda81bfa266a9ccb0 Mon Sep 17 00:00:00 2001 From: hoteas <925970985@qq.com> Date: Wed, 14 Jul 2021 00:48:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A1=A8=E5=85=B3=E8=81=94?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/makecode.go | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/code/makecode.go b/code/makecode.go index af94b97..9ab1827 100644 --- a/code/makecode.go +++ b/code/makecode.go @@ -234,26 +234,34 @@ func (that *MakeCode) Db2JSON(name string, path string, db db.HoTimeDB) { 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") { 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 {