Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-04-20 22:43:46 +08:00
commit 01072dde42
2 changed files with 15 additions and 11 deletions

View file

@ -114,10 +114,6 @@ func addAttributeViewValues(c *gin.Context) {
if blockIDArg := arg["blockID"]; nil != blockIDArg {
blockID = blockIDArg.(string)
}
var srcIDs []string
for _, v := range arg["srcIDs"].([]interface{}) {
srcIDs = append(srcIDs, v.(string))
}
var previousID string
if nil != arg["previousID"] {
previousID = arg["previousID"].(string)
@ -129,11 +125,19 @@ func addAttributeViewValues(c *gin.Context) {
}
var srcs []map[string]interface{}
for _, srcID := range srcIDs {
src := map[string]interface{}{
"id": srcID,
if nil != arg["srcIDs"] {
var srcIDs []string
for _, v := range arg["srcIDs"].([]interface{}) {
srcIDs = append(srcIDs, v.(string))
}
srcs = append(srcs, src)
for _, srcID := range srcIDs {
src := map[string]interface{}{
"id": srcID,
}
srcs = append(srcs, src)
}
} else {
srcs = arg["srcs"].([]map[string]interface{})
}
err := model.AddAttributeViewBlock(nil, srcs, avID, blockID, previousID, isDetached, ignoreFillFilter)
if nil != err {

View file

@ -2193,7 +2193,7 @@ func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID,
tree, loadErr = LoadTreeByBlockID(srcID)
}
if nil != loadErr {
logging.LogErrorf("load tree [%s] failed: %s", srcID, err)
logging.LogErrorf("load tree [%s] failed: %s", srcID, loadErr)
return loadErr
}
}
@ -3166,12 +3166,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
// 将游离行绑定到新建的块上
bindBlockAv(tx, avID, rowID)
}
} else { // 之前绑定了块
} else { // 之前绑定了块
if isUpdatingBlockKey { // 正在更新主键
if val.IsDetached { // 现在是游离行
// 将绑定的块从属性视图中移除
unbindBlockAv(tx, avID, rowID)
} else { // 现在绑定了块
} else { // 现在绑定了块
if oldBoundBlockID != val.BlockID { // 之前绑定的块和现在绑定的块不一样
// 换绑块
unbindBlockAv(tx, avID, oldBoundBlockID)