Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel
2026-06-08 10:03:34 +08:00
parent 0129c050c0
commit b0110bc381
+19 -17
View File
@@ -434,6 +434,7 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
}
// 渲染关联
blocksCache := map[string]map[string]*av.Value{}
for _, item := range collection.GetItems() {
for _, value := range item.GetValues() {
if av.KeyTypeRelation != value.Type {
@@ -451,17 +452,21 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
}
}
if nil != destAv {
blocks := map[string]*av.Value{}
blockValues := destAv.GetBlockKeyValues()
if nil != blockValues {
for _, blockValue := range blockValues.Values {
blocks[blockValue.BlockID] = blockValue
}
for _, blockID := range value.Relation.BlockIDs {
if val := blocks[blockID]; nil != val {
value.Relation.Contents = append(value.Relation.Contents, val)
blocks := blocksCache[destAv.ID]
if nil == blocks {
blocks = map[string]*av.Value{}
blockValues := destAv.GetBlockKeyValues()
if nil != blockValues {
for _, blockValue := range blockValues.Values {
blocks[blockValue.BlockID] = blockValue
}
}
blocksCache[destAv.ID] = blocks
}
for _, blockID := range value.Relation.BlockIDs {
if val := blocks[blockID]; nil != val {
value.Relation.Contents = append(value.Relation.Contents, val)
}
}
}
}
@@ -659,15 +664,12 @@ func fillAttributeViewKeyValues(attrView *av.AttributeView, collection av.Collec
}
for keyID, values := range fieldValues {
keyValues, _ := attrView.GetKeyValues(keyID)
existingIDs := map[string]bool{}
for _, kv := range keyValues.Values {
existingIDs[kv.ID] = true
}
for _, val := range values {
exist := false
for _, kv := range keyValues.Values {
if kv.ID == val.ID {
exist = true
break
}
}
if !exist {
if !existingIDs[val.ID] {
val.IsRenderAutoFill = true
keyValues.Values = append(keyValues.Values, val)
}