From fc480b7b48795d97f87b2b63fad3bc6136a735b1 Mon Sep 17 00:00:00 2001 From: hreenshan112 Date: Tue, 15 Oct 2024 10:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AA=9C=E6=A2=AD=E6=A1=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/version1/customerApp/appControll.go | 37 +++-- api/version1/customerform/formTable.go | 128 ++------------ api/version1/customerform/formTableView.go | 157 ++++++++++++++++-- .../taskplatform/taskmanagement/ruanTask.go | 16 +- .../taskmanagement/runTaskFlow.go | 17 +- overall/publicmethod/technique.go | 18 +- 6 files changed, 219 insertions(+), 154 deletions(-) diff --git a/api/version1/customerApp/appControll.go b/api/version1/customerApp/appControll.go index bc616ab..e8671b9 100644 --- a/api/version1/customerApp/appControll.go +++ b/api/version1/customerApp/appControll.go @@ -1189,8 +1189,14 @@ func ListFields(list string, ComponentList []customerform.MasterStruct) (listStr var fileAry []interface{} for _, v := range searchDataAry { + + // fmt.Printf("处理列表字段名称变更:%v\n", v) + fieldKey, isTrue := WordToFile(v, ComponentList) // WordToFile(v,ComponentList) - fileAry = append(fileAry, WordToFile(v, ComponentList)) + if isTrue { + fileAry = append(fileAry, fieldKey) + } + } searchMap["searchData"] = fileAry @@ -1204,7 +1210,10 @@ func ListFields(list string, ComponentList []customerform.MasterStruct) (listStr if columnsAry, isOk := columns.([]interface{}); isOk { var fileTableAry []interface{} for _, v := range columnsAry { - fileTableAry = append(fileTableAry, WordToFile(v, ComponentList)) + fieldKey, isTrue := WordToFile(v, ComponentList) + if isTrue { + fileTableAry = append(fileTableAry, fieldKey) + } } tableMapInfo["columns"] = fileTableAry } @@ -1234,28 +1243,34 @@ func ListFields(list string, ComponentList []customerform.MasterStruct) (listStr @ 时间: 2024-09-14 08:46:39 @ 功能: 字段比对 */ -func WordToFile(filedInfo interface{}, ComponentList []customerform.MasterStruct) interface{} { +func WordToFile(filedInfo interface{}, ComponentList []customerform.MasterStruct) (interface{}, bool) { // var fileName string // filedMap := publicmethod.MapOut[string]() + isTrue := false if filedMap, isOk := filedInfo.(map[string]interface{}); isOk { if fileNames, isok := filedMap["id"]; isok { if fliedString, isOk := fileNames.(string); isOk { // fileName = fliedString - - // fmt.Printf("搜索列表字段-4->%T-->%v\n", fileName, fileName) - for _, v := range ComponentList { - if v.Name == fliedString { - // fmt.Printf("搜索列表字段-5->%T-->%v\n", v.Item.Label, v.Item.Label) - filedMap["label"] = v.Item.Label + if publicmethod.IsInTrue[string](fliedString, []string{"checkbox", "serialNumber", "operate", "id", "masters_key", "creater", "creater_time", "edit_time", "flow_id", "states", "flowIsOpen"}) { + isTrue = true + } else { + for _, v := range ComponentList { + if v.Name == fliedString { + // fmt.Printf("搜索列表字段-5->%T-->%v\n", v.Item.Label, v.Item.Label) + filedMap["label"] = v.Item.Label + isTrue = true + } } } + fmt.Printf("搜索列表字段-4->%T-->%v\n", fliedString, fliedString) + // fmt.Printf("搜索列表字段-6->%T-->%v\n", filedMap, filedMap) - return filedMap + return filedMap, isTrue } } } - return filedInfo + return filedInfo, isTrue } /* diff --git a/api/version1/customerform/formTable.go b/api/version1/customerform/formTable.go index 8229ca1..bc6a639 100644 --- a/api/version1/customerform/formTable.go +++ b/api/version1/customerform/formTable.go @@ -158,7 +158,7 @@ func AnalysisFormUnitClass(subUnit MasterStruct) (fieldCont AnalysisFormSubUnitC case "textarea", "tinymce": //多行文本,富文本 fieldCont.FieldType = "mediumtext" - case "signaturemap": + case "signaturemap", "lowcodeTransfer": fieldCont.FieldType = "longtext" case "radio": //单选框组 if subUnit.Config.TransformData == "number" || subUnit.Config.TransformData == "" { @@ -855,117 +855,13 @@ func TableFieldCompare(tableFieldList []Result, jsonFieldList []FormFieldInfo) ( titleInfo.InactiveValue = "" fieldList = append(fieldList, titleInfo) } else { - fieldList = append(fieldList, TableFormAttribute(v, jsonFieldList)) + tableKey, isOk := TableFormAttribute(v, jsonFieldList) + if isOk { + fieldList = append(fieldList, tableKey) + } + } } - // if len(jsonFieldList) > 0 { - // var writeTableField []string - // for _, tv := range tableFieldList { - // for _, jv := range jsonFieldList { - // if tv.Field == jv.Id { - // if !publicmethod.IsInTrue[string](tv.Field, writeTableField) { - // writeTableField = append(writeTableField, tv.Field) - // } - // var fieldInfo FormFieldInfo - // fieldInfo.Id = jv.Id - // if tv.Comment == "" { - // fieldInfo.Label = jv.Label - // } else { - // fieldInfo.Label = tv.Comment - // } - - // fieldInfo.Field = tv.Field //field"` - - // attFiled := strings.Split(tv.Type, " ") - // // fmt.Printf("attFiled---->%v=========>%v\n", tv.Type, jv.Auxiliary) - // if len(attFiled) > 0 { - // fieldInfo.Types = attFiled[0] - // } - // if len(attFiled) >= 2 { - // fieldInfo.Attribute = attFiled[1] - // } - - // patternInfo := strings.Split(tv.Type, "(") - // if len(patternInfo) >= 1 { - // fieldInfo.Pattern = patternInfo[0] - // } - // fieldInfo.Auxiliary = jv.Auxiliary - // fieldInfo.FieldClass = jv.FieldClass //fieldClass"` - // fieldInfo.ActiveValue = jv.ActiveValue //activeValue"` - // fieldInfo.InactiveValue = jv.InactiveValue //inactiveValue"` - // fieldInfo.Options = jv.Options //options"` - // fieldInfo.Control = jv.Control //control"` - // fieldInfo.Config = jv.Config //config"` - // fieldList = append(fieldList, fieldInfo) - // } - // } - // } - // if len(writeTableField) > 0 { - // for _, tv := range tableFieldList { - // if !publicmethod.IsInTrue[string](tv.Field, writeTableField) { - // var fieldInfo FormFieldInfo - // fieldInfo.Id = tv.Field - // if tv.Comment == "" { - // fieldInfo.Label = tv.Field - // } else { - // fieldInfo.Label = tv.Comment - // } - - // fieldInfo.Field = tv.Field //field"` - - // attFiled := strings.Split(tv.Type, " ") - // if len(attFiled) > 0 { - // fieldInfo.Types = attFiled[0] - // } - // if len(attFiled) >= 2 { - // fieldInfo.Attribute = attFiled[1] - - // } - // patternInfo := strings.Split(tv.Type, "(") - // if len(patternInfo) >= 1 { - // fieldInfo.Pattern = patternInfo[0] - // } - - // fieldInfo.FieldClass = tv.Field //fieldClass"` - // // fieldInfo.ActiveValue = v. //activeValue"` - // // fieldInfo.InactiveValue = v. //inactiveValue"` - // // fieldInfo.Options = v. //options"` - - // fieldList = append(fieldList, fieldInfo) - // } - // } - // for _, jv := range jsonFieldList { - // if !publicmethod.IsInTrue[string](jv.Id, writeTableField) { - // fieldList = append(fieldList, jv) - // } - // } - // } - // } else { - // for _, v := range tableFieldList { - // var fieldInfo FormFieldInfo - // fieldInfo.Id = v.Field - // fieldInfo.Label = v.Comment - // fieldInfo.Field = v.Field //field"` - - // attFiled := strings.Split(v.Type, " ") - // if len(attFiled) >= 2 { - // fieldInfo.Attribute = attFiled[1] - // fieldInfo.Types = attFiled[0] - - // } - - // patternInfo := strings.Split(v.Type, "(") - // if len(patternInfo) >= 1 { - // fieldInfo.Pattern = patternInfo[0] - // } - // // fieldInfo.FieldClass = v. //fieldClass"` - // // fieldInfo.ActiveValue = v. //activeValue"` - // // fieldInfo.InactiveValue = v. //inactiveValue"` - // // fieldInfo.Options = v. //options"` - - // fieldList = append(fieldList, fieldInfo) - // } - // } } else { fieldList = jsonFieldList } @@ -1519,9 +1415,17 @@ func (l *ListPageFields) DevelopSpecificationsSend(listData []map[string]interfa } } case "timePicker": - if timeVal, isOk := mv.(int64); isOk { - sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 6) + timeVal, _ := publicmethod.StringToInt64(mv) + if timeVal != 0 { + sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 5) + } else { + sendInfo[mi] = "" } + + // if timeVal, isOk := mv.(int64); isOk { + // sendInfo[mi] = publicmethod.UnixTimeToDay(timeVal/1000, 6) + // } + // fmt.Printf("时间显示器:%T====》%v\n", mv, mv) case "deptOrg": var orgCont modelshr.AdministrativeOrganization orgCont.GetCont(map[string]interface{}{"`id`": mv}, "`name`") diff --git a/api/version1/customerform/formTableView.go b/api/version1/customerform/formTableView.go index 53f3b54..27d73c2 100644 --- a/api/version1/customerform/formTableView.go +++ b/api/version1/customerform/formTableView.go @@ -1110,14 +1110,15 @@ func (a *ApiMethod) GainFormPageMapCont(c *gin.Context) { # */ -func TableFormAttribute(formField Result, tableFieldList []FormFieldInfo) (fieldInfo FormFieldInfo) { +func TableFormAttribute(formField Result, tableFieldList []FormFieldInfo) (fieldInfo FormFieldInfo, isTrue bool) { if len(tableFieldList) > 0 { fieldAry := strings.Split(formField.Field, "_end") - // fmt.Printf("字段数组----->%v----->%v\n", len(fieldAry), fieldAry) + fmt.Printf("字段数组----->%v----->%v\n", len(fieldAry), fieldAry) if len(fieldAry) >= 1 { isWrite := true for _, v := range tableFieldList { if fieldAry[0] == v.Id { + isTrue = true isWrite = false fieldInfo.Id = formField.Field if formField.Comment == "" { @@ -1147,21 +1148,151 @@ func TableFormAttribute(formField Result, tableFieldList []FormFieldInfo) (field } } if isWrite { - fieldInfo.Id = formField.Field - fieldInfo.Label = formField.Comment - fieldInfo.Field = formField.Field //field"` - attFiled := strings.Split(formField.Type, " ") - if len(attFiled) >= 2 { - fieldInfo.Attribute = attFiled[1] - fieldInfo.Types = attFiled[0] - } - patternInfo := strings.Split(formField.Type, "(") - if len(patternInfo) >= 1 { - fieldInfo.Pattern = patternInfo[0] + isTrue = true + // fieldInfo.Id = formField.Field + // fieldInfo.Label = formField.Comment + // fieldInfo.Field = formField.Field //field"` + // attFiled := strings.Split(formField.Type, " ") + // if len(attFiled) >= 2 { + // fieldInfo.Attribute = attFiled[1] + // fieldInfo.Types = attFiled[0] + // } + // patternInfo := strings.Split(formField.Type, "(") + // if len(patternInfo) >= 1 { + // fieldInfo.Pattern = patternInfo[0] + // } + fmt.Printf("字段数组---12-->%v----->%v\n", isWrite, formField) + switch formField.Field { + case "_lableTitle": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "id": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "masters_key": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "creater": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "creater_time": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "edit_time": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "flow_id": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "states": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + case "flowIsOpen": + fieldInfo.Id = formField.Field + fieldInfo.Label = formField.Comment + fieldInfo.Field = formField.Field //field"` + attFiled := strings.Split(formField.Type, " ") + if len(attFiled) >= 2 { + fieldInfo.Attribute = attFiled[1] + fieldInfo.Types = attFiled[0] + } + patternInfo := strings.Split(formField.Type, "(") + if len(patternInfo) >= 1 { + fieldInfo.Pattern = patternInfo[0] + } + default: + isTrue = false + // formKey := TableFormAttributeForm(v, jsonFieldList) + // if formKey.Field != "" { + // fieldList = append(fieldList, formKey) + // } + } + } } } else { + isTrue = true // var fieldInfo FormFieldInfo fieldInfo.Id = formField.Field fieldInfo.Label = formField.Comment diff --git a/api/version1/taskplatform/taskmanagement/ruanTask.go b/api/version1/taskplatform/taskmanagement/ruanTask.go index 12510a2..dd073c8 100644 --- a/api/version1/taskplatform/taskmanagement/ruanTask.go +++ b/api/version1/taskplatform/taskmanagement/ruanTask.go @@ -197,7 +197,7 @@ func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.U if uv.Key == key { acValInt, _ := strconv.Atoi(uv.ActiveValue) // InavalInt, _ := strconv.Atoi(uv.InactiveValue) - + fmt.Printf("switch---->%v-->%T---->%v\n", uv.Class, val, val) switch uv.Class { case "switch": // fmt.Printf("switch-->%T---->%v\n", val, val) @@ -295,7 +295,10 @@ func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.U } } case "select": + if auxIsTeuw, isOk := uv.Auxiliary.(bool); isOk { + tj, _ := json.Marshal(tableFormInfo) + fmt.Printf("select---->%v---->%v-->%T---->%v---->%v\n", key, auxIsTeuw, val, val, string(tj)) if auxIsTeuw { var ary []interface{} if valStr, isTrue := val.(string); isTrue { @@ -305,6 +308,7 @@ func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.U return val } } else { + fmt.Printf("select:%T--1-->%v\n", tableFormInfo, tableFormInfo) valInt, _ := publicmethod.StringToInt64(val) return valInt } @@ -314,6 +318,14 @@ func ChuLiMasterTableData(key string, val interface{}, unitCont []customerform.U return valInt } fmt.Printf("%v----->switch-->%T---->%v\n", key, uv, uv) + case "timePicker": + // timeVal, _ := publicmethod.StringToInt64(val) + // val = publicmethod.UnixTimeToDay(timeVal/1000, 5) + case "expand-user": + // valStr := publicmethod.TypeToInterface(val) + // var peopleAry []string + // json.Unmarshal([]byte(valStr), &peopleAry) + // val = strings.Join(peopleAry, ",") default: return val } @@ -2348,7 +2360,7 @@ person_in_charge */ func GainOrgManager(orgId []int64) (UserList []OperatorList) { var userInfoAry []modelshr.ManCont - overall.CONSTANT_DB_HR.Model(&modelshr.ManCont{}).Select("`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("`admin_org` IN ? AND `person_in_charge` = ?", orgId, 1).Find(&userInfoAry) + overall.CONSTANT_DB_HR.Model(&modelshr.ManCont{}).Select("`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("`admin_org` IN ? AND `person_in_charge` = ? AND `emp_type` BETWEEN ? AND ?", orgId, 1, 1, 10).Find(&userInfoAry) if len(userInfoAry) > 0 { for _, uv := range userInfoAry { UserList = append(UserList, TransformPublicUs(uv)) diff --git a/api/version1/taskplatform/taskmanagement/runTaskFlow.go b/api/version1/taskplatform/taskmanagement/runTaskFlow.go index d7f2883..8cfe56f 100644 --- a/api/version1/taskplatform/taskmanagement/runTaskFlow.go +++ b/api/version1/taskplatform/taskmanagement/runTaskFlow.go @@ -564,12 +564,14 @@ func sunContHandel(sonMapAry []map[string]interface{}, nameKey []customerform.Un } case "timePicker": timeVal, _ := publicmethod.StringToInt64(val) - taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 6) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 5) case "expand-user": - valStr := publicmethod.TypeToInterface(val) - var peopleAry []string - json.Unmarshal([]byte(valStr), &peopleAry) - taskInfo.Value = strings.Join(peopleAry, ",") + // valStr := publicmethod.TypeToInterface(val) + // fmt.Printf("用户类型:%T--->%v=====%v\n", val, val, valStr) + // var peopleAry []string + // json.Unmarshal([]byte(valStr), &peopleAry) + // taskInfo.Value = strings.Join(peopleAry, ",") + taskInfo.Value = val case "orgCentent": var orgCont modelshr.AdministrativeOrganization orgCont.GetCont(map[string]interface{}{"`id`": val}, "`name`") @@ -692,7 +694,7 @@ func HistoryValueHand(field string, val interface{}, nameKey []customerform.Unit taskInfo.Auxiliary = uv.Auxiliary taskInfo.Types = uv.Class taskInfo.Sort = uv.Sort - // fmt.Printf("key: %v, type: %T val:%v\n", field, val, val) + fmt.Printf("key: %v, type: %T val:%v Class:%v\n", field, val, val, uv.Class) switch field { case "creater": var createrInfo modelshr.ManCont @@ -839,7 +841,8 @@ func HistoryValueHand(field string, val interface{}, nameKey []customerform.Unit } case "timePicker": timeVal, _ := publicmethod.StringToInt64(val) - taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 6) + taskInfo.Value = publicmethod.UnixTimeToDay(timeVal/1000, 5) + fmt.Printf("格式---》%v---》%v\n", timeVal, taskInfo.Value) case "expand-user": valStr := publicmethod.TypeToInterface(val) var peopleAry []string diff --git a/overall/publicmethod/technique.go b/overall/publicmethod/technique.go index 67719d1..237f394 100644 --- a/overall/publicmethod/technique.go +++ b/overall/publicmethod/technique.go @@ -2832,15 +2832,15 @@ func TypeToInterface(val interface{}) string { } } - if valDataStr, ok := val.(string); ok { - if valDataStr != "" { - return valDataStr - } else { - return "" - } - } else { - return "" - } + // if valDataStr, ok := val.(string); ok { + // if valDataStr != "" { + // return valDataStr + // } else { + // return "" + // } + // } else { + // return "" + // } } /*