diff --git a/kernel/av/layout_kanban.go b/kernel/av/layout_kanban.go index 6fae105c6..c50302a77 100644 --- a/kernel/av/layout_kanban.go +++ b/kernel/av/layout_kanban.go @@ -31,6 +31,8 @@ type LayoutKanban struct { FitImage bool `json:"fitImage"` // 是否适应封面图片大小 DisplayFieldName bool `json:"displayFieldName"` // 是否显示字段名称 + FillColBackgroundColor bool `json:"fillColBackgroundColor"` // 是否填充列背景颜色 + Fields []*ViewKanbanField `json:"fields"` // 字段 } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 09615ab09..deb5520dc 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -947,6 +947,14 @@ func (tx *Transaction) doSetAttrViewDisplayFieldName(operation *Operation) (ret return } +func (tx *Transaction) doSetAttrViewFillColBackgroundColor(operation *Operation) (ret *TxErr) { + err := setAttrViewFillColBackgroundColor(operation) + if err != nil { + return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()} + } + return +} + func setAttrViewDisplayFieldName(operation *Operation) (err error) { attrView, err := av.ParseAttributeView(operation.AvID) if err != nil { @@ -971,6 +979,30 @@ func setAttrViewDisplayFieldName(operation *Operation) (err error) { return } +func setAttrViewFillColBackgroundColor(operation *Operation) (err error) { + attrView, err := av.ParseAttributeView(operation.AvID) + if err != nil { + return + } + + view, err := getAttrViewViewByBlockID(attrView, operation.BlockID) + if err != nil { + return + } + + switch view.LayoutType { + case av.LayoutTypeTable: + return + case av.LayoutTypeGallery: + return + case av.LayoutTypeKanban: + view.Kanban.FillColBackgroundColor = operation.Data.(bool) + } + + err = av.SaveAttributeView(attrView) + return +} + func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) { err := setAttrViewCardSize(operation) if err != nil { diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 6ce237450..9ffe57e01 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -293,6 +293,8 @@ func performTx(tx *Transaction) (ret *TxErr) { ret = tx.doSetAttrViewFitImage(op) case "setAttrViewDisplayFieldName": ret = tx.doSetAttrViewDisplayFieldName(op) + case "setAttrViewFillColBackgroundColor": + ret = tx.doSetAttrViewFillColBackgroundColor(op) case "setAttrViewShowIcon": ret = tx.doSetAttrViewShowIcon(op) case "setAttrViewWrapField":