Daniel 2025-08-13 17:23:27 +08:00
parent 7595477257
commit e0f1f789c3
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -4707,10 +4707,26 @@ func updateAttributeViewColumnOptions(operation *Operation) (err error) {
return
}
for _, keyValues := range attrView.KeyValues {
if keyValues.Key.ID == operation.ID {
keyValues.Key.Options = options
break
selectKey, _ := attrView.GetKey(operation.ID)
if nil == selectKey {
return
}
existingOptions := map[string]*av.SelectOption{}
for _, opt := range selectKey.Options {
existingOptions[opt.Name] = opt
}
for _, opt := range options {
if existingOpt, exists := existingOptions[opt.Name]; exists {
// 如果选项已经存在则更新颜色和描述
existingOpt.Color = opt.Color
existingOpt.Desc = opt.Desc
} else {
// 如果选项不存在则添加新选项
selectKey.Options = append(selectKey.Options, &av.SelectOption{
Name: opt.Name,
Color: opt.Color,
Desc: opt.Desc,
})
}
}