This commit is contained in:
Daniel 2025-08-11 21:25:53 +08:00
parent c3c467e3ee
commit 93fdc69bec
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 8 additions and 3 deletions

View file

@ -1493,12 +1493,14 @@ func GetBlockAttributeViewKeys(nodeID string) (ret []*BlockAttributeViewKeys) {
switch kv.Key.Type { switch kv.Key.Type {
case av.KeyTypeTemplate: case av.KeyTypeTemplate:
if 0 < len(kv.Values) { if 0 < len(kv.Values) {
ial := map[string]string{} var ial map[string]string
block := av.GetKeyBlockValue(keyValues) block := av.GetKeyBlockValue(keyValues)
if nil != block && !block.IsDetached { if nil != block && !block.IsDetached {
ial = sql.GetBlockAttrs(block.BlockID) ial = sql.GetBlockAttrs(block.BlockID)
} }
if nil == ial {
ial = map[string]string{}
}
if nil == kv.Values[0].Template { if nil == kv.Values[0].Template {
kv.Values[0] = av.GetAttributeViewDefaultValue(kv.Values[0].ID, kv.Key.ID, nodeID, kv.Key.Type) kv.Values[0] = av.GetAttributeViewDefaultValue(kv.Values[0].ID, kv.Key.ID, nodeID, kv.Key.Type)
} }

View file

@ -488,11 +488,14 @@ func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.C
switch value.Type { switch value.Type {
case av.KeyTypeTemplate: // 渲染模板字段 case av.KeyTypeTemplate: // 渲染模板字段
keyValues := items[itemID] keyValues := items[itemID]
ial := map[string]string{} var ial map[string]string
blockVal := item.GetBlockValue() blockVal := item.GetBlockValue()
if nil != blockVal { if nil != blockVal {
ial = ials[blockVal.Block.ID] ial = ials[blockVal.Block.ID]
} }
if nil == ial {
ial = map[string]string{}
}
content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content) content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content)
value.Template.Content = content value.Template.Content = content
if nil != renderErr { if nil != renderErr {