This commit is contained in:
Daniel 2025-08-11 09:44:38 +08:00
parent 31667b0964
commit e871f4913f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 22 additions and 2 deletions

View file

@ -200,7 +200,7 @@ type View struct {
GroupVal *Value `json:"groupVal,omitempty"` // 分组值
GroupFolded bool `json:"groupFolded"` // 分组是否折叠
GroupHidden int `json:"groupHidden"` // 分组是否隐藏0显示1空白隐藏2手动隐藏
GroupSort int `json:"groupSort"` // 分组排序值
GroupSort int `json:"groupSort"` // 分组排序值,用于手动排序
}
// GetGroupValue 获取分组视图的分组值。

View file

@ -1742,11 +1742,11 @@ func genAttrViewGroups(view *av.View, attrView *av.AttributeView) {
v.GroupVal.MSelect = []*av.ValueSelect{{Content: opt.Name, Color: opt.Color}}
}
}
v.GroupSort = -1
view.Groups = append(view.Groups, v)
}
view.GroupCreated = time.Now().UnixMilli()
setAttrViewGroupStates(view, groupStates)
}
@ -1784,6 +1784,26 @@ func setAttrViewGroupStates(view *av.View, groupStates map[string]*GroupState) {
groupView.GroupSort = state.Sort
}
}
defaultGroup := view.GetGroupByGroupValue(groupValueDefault)
if nil != defaultGroup {
if -1 == defaultGroup.GroupSort {
view.RemoveGroupByID(defaultGroup.ID)
} else {
defaultGroup = nil
}
}
for i, groupView := range view.Groups {
if i != groupView.GroupSort && -1 == groupView.GroupSort {
groupView.GroupSort = i
}
}
if nil != defaultGroup {
view.Groups = append(view.Groups, defaultGroup)
defaultGroup.GroupSort = len(view.Groups) - 1
}
}
func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, err error) {