From 661c3e6a9f3b6ac61a0171650a17620598c39e25 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 26 Oct 2024 20:26:21 +0800 Subject: [PATCH] Optimize upload component --- widgets/component/component.go | 2 +- widgets/table/process.go | 2 +- widgets/table/table.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/widgets/component/component.go b/widgets/component/component.go index d7b4548e9..db3b8f278 100644 --- a/widgets/component/component.go +++ b/widgets/component/component.go @@ -29,7 +29,7 @@ func (dsl DSL) Map() map[string]interface{} { } // Add Default Value for Upload api - if dsl.Type == "Upload" && dsl.Props != nil && !dsl.Props.Has("api") { + if (dsl.Type == "Upload" || dsl.Type == "Image") && dsl.Props != nil && !dsl.Props.Has("api") { res["props"].(map[string]interface{})["$api"] = map[string]interface{}{"process": "fs.data.Upload"} } diff --git a/widgets/table/process.go b/widgets/table/process.go index 090390334..e54a3d800 100644 --- a/widgets/table/process.go +++ b/widgets/table/process.go @@ -164,7 +164,7 @@ func processComponent(process *gouProcess.Process) interface{} { // :query query := map[string]interface{}{} if process.NumOfArgsIs(4) { - query = process.ArgsMap(3) + query = process.ArgsMap(3, map[string]interface{}{}) } // execute query diff --git a/widgets/table/table.go b/widgets/table/table.go index a2250f68d..f2634d893 100644 --- a/widgets/table/table.go +++ b/widgets/table/table.go @@ -344,7 +344,7 @@ func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (map for _, cProp := range dsl.CProps { err := cProp.Replace(setting, func(cProp component.CloudPropsDSL) interface{} { - if cProp.Type == "Upload" || cProp.Type == "WangEditor" { + if cProp.Type == "Upload" || cProp.Type == "WangEditor" || cProp.Type == "Image" { return fmt.Sprintf("/api/__yao/table/%s%s", dsl.ID, cProp.UploadPath()) }