增加普通时间类型,以及增加富文本类型

This commit is contained in:
hoteas 2022-04-25 19:58:49 +08:00
parent c3d0c8921b
commit 79d1189803
5 changed files with 38 additions and 7275 deletions

View File

@ -64,6 +64,8 @@ var ColumnNameType = []ColumnShow{
{"idcard", false, true, true, false, "", false},
{"id", true, false, true, false, "", true},
{"parent_id", true, true, true, false, "", true},
{"content", false, false, false, false, "textArea", false},
{"info", false, true, true, false, "textArea", false},
//"sn"{true,true,true,""},
{"status", true, true, true, false, "select", false},
{"state", true, true, true, false, "select", false},
@ -78,7 +80,7 @@ var ColumnNameType = []ColumnShow{
{"index", false, false, false, false, "index", false},
{"password", false, true, false, false, "password", false},
{"pwd", false, true, false, false, "password", false},
{"info", false, true, true, false, "", false},
{"version", false, false, false, false, "", false},
{"seq", false, true, true, false, "", false},
{"sort", false, true, true, false, "", false},

View File

@ -236,7 +236,6 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
coloum["label"] = coloum.GetString("label")[:indexNum]
}
for _, ColumnName := range that.RuleConfig {
if (ColumnName.GetBool("strict") && coloum.GetString("name") == ColumnName.GetString("name")) ||
(!ColumnName.GetBool("strict") && strings.Contains(coloum.GetString("name"), ColumnName.GetString("name"))) {
@ -266,7 +265,11 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
}
if ColumnName.GetString("type") != "" {
coloum["type"] = ColumnName.GetString("type")
if ColumnName.GetString("type") == "time" && coloum["type"] == "number" {
coloum["type"] = "unixTime"
} else {
coloum["type"] = ColumnName.GetString("type")
}
}
if ColumnName.GetBool("strict") && coloum.GetString("name") == ColumnName.GetString("name") {
break
@ -509,8 +512,17 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
v["value"] = "label"
continue
}
tempC := that.TableConfig.GetMap(tableName).GetSlice("columns")
isGet := true
for k2, _ := range tempC {
if strings.Contains(tempC.GetMap(k2).GetString("name"), "name") {
v["value"] = tempC.GetMap(k2).GetString("name")
isGet = false
break
}
}
if len(that.TableConfig.GetMap(tableName).GetSlice("columns")) > 2 {
if isGet && len(that.TableConfig.GetMap(tableName).GetSlice("columns")) > 2 {
v["value"] = that.TableConfig.GetMap(tableName).GetSlice("columns").GetMap(1).GetString("name")
continue
}
@ -620,7 +632,7 @@ func (that *MakeCode) Info(table string, userData Map, db *db.HoTimeDB) (string,
}
return reStr, data
}
func (that *MakeCode) Add(table string,user Map, req *http.Request) Map {
func (that *MakeCode) Add(table string, user Map, req *http.Request) Map {
data := Map{}
for _, v := range that.TableColumns[table] {
//不可使用,未在前端展示,但在内存中保持有
@ -635,12 +647,12 @@ func (that *MakeCode) Add(table string,user Map, req *http.Request) Map {
if len(req.Form[v.GetString("name")]) == 0 {
if user[v.GetString("name")]!=nil{
if user[v.GetString("name")] != nil {
data[v.GetString("name")] = user[v.GetString("name")]
continue
}
if that.FileConfig.GetString("table")+"_id"==v.GetString("name"){
if that.FileConfig.GetString("table")+"_id" == v.GetString("name") {
data[v.GetString("name")] = user["id"]
continue
}
@ -666,12 +678,22 @@ func (that *MakeCode) Add(table string,user Map, req *http.Request) Map {
}
if v.GetString("name") == "create_time" {
data[v.GetString("name")] = time.Now().Unix()
if v.GetString("type") == "unixTime" {
data[v.GetString("name")] = time.Now().Unix()
}
if v.GetString("type") == "time" {
data[v.GetString("name")] = time.Now().Format("2006-01-02 15-04-05")
}
continue
}
if v.GetString("name") == "modify_time" {
data[v.GetString("name")] = time.Now().Unix()
if v.GetString("type") == "unixTime" {
data[v.GetString("name")] = time.Now().Unix()
}
if v.GetString("type") == "time" {
data[v.GetString("name")] = time.Now().Format("2006-01-02 15-04-05")
}
}
}
if len(data) == 0 {
@ -764,8 +786,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
v.GetString("link") + "." + v.GetString("value") + " AS " +
v.GetString("link") + "_" + v.GetString("name") + "_" + v.GetString("value") + ","
if that.TableColumns[v.GetString("link")]["phone"]!=nil{
if that.TableColumns[v.GetString("link")]["phone"] != nil {
reStr += table + "." + v.GetString("name") + "," +
v.GetString("link") + ".phone AS " +
v.GetString("link") + "_" + v.GetString("name") + "_phone,"
@ -866,9 +887,9 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
//日期类型
if searchItemName == "daterange" && v.GetString("type") == "time" {
//fmt.Println(req.Form["daterange"])
if len(req.Form["daterange"])==1{
daterange[table+"."+v.GetString("name")+"[<]"]=req.FormValue("daterange")
}else{
if len(req.Form["daterange"]) == 1 {
daterange[table+"."+v.GetString("name")+"[<]"] = req.FormValue("daterange")
} else {
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
}
@ -924,7 +945,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
if len(daterange) > 1 {
//if data["AND"] == nil {
data = Map{"AND": Map{"AND": data, "OR": daterange}}
data = Map{"AND": Map{"AND": data, "OR": daterange}}
//}else{
// data = Map{"AND": Map{"AND": data, "OR": daterange}}
//}

File diff suppressed because it is too large Load Diff

View File

@ -1,344 +0,0 @@
[
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "idcard",
"strict": false,
"type": ""
},
{
"edit": false,
"info": true,
"list": true,
"must": false,
"name": "id",
"strict": true,
"type": ""
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "parent_id",
"strict": true,
"type": ""
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "status",
"strict": false,
"type": "select"
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "state",
"strict": false,
"type": "select"
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "sex",
"strict": false,
"type": "select"
},
{
"edit": false,
"info": false,
"list": false,
"must": false,
"name": "delete",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "lat",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "lng",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "latitude",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "longitude",
"strict": false,
"type": ""
},
{
"edit": false,
"info": false,
"list": false,
"must": false,
"name": "index",
"strict": false,
"type": "index"
},
{
"edit": true,
"info": false,
"list": false,
"must": false,
"name": "password",
"strict": false,
"type": "password"
},
{
"edit": true,
"info": false,
"list": false,
"must": false,
"name": "pwd",
"strict": false,
"type": "password"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "info",
"strict": false,
"type": ""
},
{
"edit": false,
"info": false,
"list": false,
"must": false,
"name": "version",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "seq",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "sort",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "note",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "description",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "abstract",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "content",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "address",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "full_name",
"strict": false,
"type": ""
},
{
"edit": false,
"info": true,
"list": false,
"must": false,
"name": "create_time",
"strict": true,
"type": "time"
},
{
"edit": false,
"info": true,
"list": true,
"must": false,
"name": "modify_time",
"strict": true,
"type": "time"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "image",
"strict": false,
"type": "image"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "img",
"strict": false,
"type": "image"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "icon",
"strict": false,
"type": "image"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "avatar",
"strict": false,
"type": "image"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "file",
"strict": false,
"type": "file"
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "age",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "email",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "time",
"strict": false,
"type": "time"
},
{
"edit": false,
"info": true,
"list": false,
"must": false,
"name": "level",
"strict": false,
"type": ""
},
{
"edit": true,
"info": true,
"list": true,
"must": false,
"name": "rule",
"strict": false,
"type": "form"
},
{
"edit": false,
"info": true,
"list": true,
"must": false,
"name": "table",
"strict": false,
"type": "table"
},
{
"edit": false,
"info": true,
"list": true,
"must": false,
"name": "table_id",
"strict": false,
"type": "table_id"
}
]

Binary file not shown.