From daaf2305e76c15145b7d4e987c8c5ce72542e71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Mon, 13 Jan 2025 16:49:50 +0800 Subject: [PATCH] fix(region): tags export (#21960) --- pkg/util/excelutils/excelutils.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/util/excelutils/excelutils.go b/pkg/util/excelutils/excelutils.go index 5b779b890d..90ef5d089b 100644 --- a/pkg/util/excelutils/excelutils.go +++ b/pkg/util/excelutils/excelutils.go @@ -26,6 +26,7 @@ import ( "yunion.io/x/jsonutils" "yunion.io/x/pkg/errors" + "yunion.io/x/pkg/gotypes" ) func decimalBaseMaxWidth(decNum int, base int) int { @@ -93,6 +94,14 @@ func exportRow(xlsx *excelize.File, data jsonutils.JSONObject, keys []string, ro var val jsonutils.JSONObject if strings.Contains(keys[i], ".") { val, _ = data.GetIgnoreCases(strings.Split(keys[i], ".")...) + // hack payment_bills + if !gotypes.IsNil(val) && strings.HasPrefix(keys[i], "tags.") { + vv := []string{} + val.Unmarshal(&vv) + if len(vv) > 0 || val.Equals(jsonutils.Marshal([]string{})) { + val = jsonutils.NewString(strings.Join(vv, ",")) + } + } } else { val, _ = data.GetIgnoreCases(keys[i]) }