diff --git a/kernel/av/filter.go b/kernel/av/filter.go index 651148394..ab50203f1 100644 --- a/kernel/av/filter.go +++ b/kernel/av/filter.go @@ -360,10 +360,6 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa } case KeyTypeSelect, KeyTypeMSelect: if nil != value.MSelect { - if nil == other || nil == other.MSelect || 1 > len(other.MSelect) { - return true - } - switch operator { case FilterOperatorIsEqual, FilterOperatorContains: contains := false @@ -387,12 +383,7 @@ func (value *Value) filter(other *Value, relativeDate, relativeDate2 *RelativeDa } } return !contains - case FilterOperatorIsEmpty: - return 0 == len(value.MSelect) || 1 == len(value.MSelect) && "" == value.MSelect[0].Content - case FilterOperatorIsNotEmpty: - return 0 != len(value.MSelect) && !(1 == len(value.MSelect) && "" == value.MSelect[0].Content) } - return false } case KeyTypeURL: if nil != value.URL && nil != other && nil != other.URL { diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 414384a39..757c1ca7b 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1470,8 +1470,21 @@ func GetBlockAttributeViewKeys(nodeID string) (ret []*BlockAttributeViewKeys) { destKey, _ := destAv.GetKey(kv.Key.Rollup.KeyID) if nil != destKey { + var furtherCollection av.Collection + if av.KeyTypeTemplate == destKey.Type { + // 渲染目标视图,这样才能汇总渲染后的模板字段值 + viewable := sql.RenderView(destAv, destAv.Views[0], "") + if nil != viewable { + furtherCollection = viewable.(av.Collection) + } + } + for _, bID := range relVal.Relation.BlockIDs { destVal := destAv.GetValue(kv.Key.Rollup.KeyID, bID) + if nil != furtherCollection && av.KeyTypeTemplate == destKey.Type { + destVal = furtherCollection.GetValue(bID, destKey.ID) + } + if nil == destVal { if destAv.ExistItem(bID) { // 数据库中存在项目但是字段值不存在是数据未初始化,这里补一个默认值 destVal = av.GetAttributeViewDefaultValue(ast.NewNodeID(), kv.Key.Rollup.KeyID, bID, destKey.Type) diff --git a/kernel/model/export.go b/kernel/model/export.go index dd1b7cd1d..cebbdec7d 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -2618,10 +2618,6 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool, } else if av.KeyTypeTemplate == cell.Value.Type { if nil != cell.Value.Template { val = cell.Value.Template.Content - if "" == val { - val = "" - } - val = strings.ReplaceAll(val, "\\|", "|") val = strings.ReplaceAll(val, "|", "\\|") col := table.GetColumn(cell.Value.KeyID) diff --git a/kernel/sql/av.go b/kernel/sql/av.go index 398d38c02..7fc8d54bc 100644 --- a/kernel/sql/av.go +++ b/kernel/sql/av.go @@ -242,6 +242,9 @@ func RenderTemplateField(ial map[string]string, keyValues []*av.KeyValues, tplCo return } ret = buf.String() + if ret == "" { + ret = "" + } return } @@ -506,7 +509,7 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection } } -func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.Collection, ials map[string]map[string]string, items map[string][]*av.KeyValues) (err error) { +func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.Collection, ials map[string]map[string]string, items map[string][]*av.KeyValues, renderedTemplateKeyCollections map[string]av.Collection) (err error) { existTemplateField := false for _, kVals := range attrView.KeyValues { if av.KeyTypeTemplate == kVals.Key.Type {