[update] table & form default actions
This commit is contained in:
parent
5fbf84bf8e
commit
1aa0fc49e4
2 changed files with 91 additions and 64 deletions
|
|
@ -19,20 +19,42 @@ func (layout *LayoutDSL) BindModel(m *model.Model, formID string, fields *Fields
|
|||
if layout.Actions == nil {
|
||||
layout.Actions = []component.ActionDSL{
|
||||
{
|
||||
Title: "::Save",
|
||||
Icon: "icon-check",
|
||||
Style: "primary",
|
||||
ShowWhenAdd: true,
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Submit",
|
||||
"type": "Form.submit",
|
||||
"payload": map[string]interface{}{},
|
||||
}},
|
||||
}, {
|
||||
Title: "::Delete",
|
||||
Icon: "icon-trash-2",
|
||||
Style: "danger",
|
||||
Action: component.ActionNodes{
|
||||
{
|
||||
"name": "Delete",
|
||||
"type": "Form.delete",
|
||||
"payload": map[string]interface{}{"model": formID},
|
||||
},
|
||||
},
|
||||
Confirm: &component.ConfirmActionDSL{
|
||||
Title: "::Confirm",
|
||||
Desc: "::Please confirm, the data cannot be recovered",
|
||||
},
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Confirm",
|
||||
"type": "Common.confirm",
|
||||
"payload": map[string]interface{}{"title": "::Confirm", "content": "::Please confirm, the data cannot be recovered"},
|
||||
}, {
|
||||
"name": "Delete",
|
||||
"type": "Form.delete",
|
||||
"payload": map[string]interface{}{"model": formID},
|
||||
}, {
|
||||
"name": "Back",
|
||||
"type": "Common.historyBack",
|
||||
"payload": map[string]interface{}{},
|
||||
}},
|
||||
}, {
|
||||
Title: "::Back",
|
||||
Icon: "icon-arrow-left",
|
||||
ShowWhenAdd: true,
|
||||
ShowWhenView: true,
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Back",
|
||||
"type": "Common.historyBack",
|
||||
"payload": map[string]interface{}{},
|
||||
}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -95,20 +117,42 @@ func (layout *LayoutDSL) BindTable(tab *table.DSL, formID string, fields *Fields
|
|||
if layout.Actions == nil {
|
||||
layout.Actions = []component.ActionDSL{
|
||||
{
|
||||
Title: "::Save",
|
||||
Icon: "icon-check",
|
||||
Style: "primary",
|
||||
ShowWhenAdd: true,
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Submit",
|
||||
"type": "Form.submit",
|
||||
"payload": map[string]interface{}{},
|
||||
}},
|
||||
}, {
|
||||
Title: "::Delete",
|
||||
Icon: "icon-trash-2",
|
||||
Style: "danger",
|
||||
Action: component.ActionNodes{
|
||||
{
|
||||
"name": "Delete",
|
||||
"type": "Form.delete",
|
||||
"payload": map[string]interface{}{"model": formID},
|
||||
},
|
||||
},
|
||||
Confirm: &component.ConfirmActionDSL{
|
||||
Title: "::Confirm",
|
||||
Desc: "::Please confirm, the data cannot be recovered",
|
||||
},
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Confirm",
|
||||
"type": "Common.confirm",
|
||||
"payload": map[string]interface{}{"title": "::Confirm", "content": "::Please confirm, the data cannot be recovered"},
|
||||
}, {
|
||||
"name": "Delete",
|
||||
"type": "Form.delete",
|
||||
"payload": map[string]interface{}{"model": formID},
|
||||
}, {
|
||||
"name": "Back",
|
||||
"type": "Common.historyBack",
|
||||
"payload": map[string]interface{}{},
|
||||
}},
|
||||
}, {
|
||||
Title: "::Back",
|
||||
Icon: "icon-arrow-left",
|
||||
ShowWhenAdd: true,
|
||||
ShowWhenView: true,
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Back",
|
||||
"type": "Common.historyBack",
|
||||
"payload": map[string]interface{}{},
|
||||
}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,57 +79,40 @@ func (layout *LayoutDSL) BindModel(m *model.Model, fields *FieldsDSL, option map
|
|||
layout.Table.Operation.Hide = false
|
||||
layout.Table.Operation.Actions = append(
|
||||
layout.Table.Operation.Actions,
|
||||
|
||||
component.ActionDSL{
|
||||
[]component.ActionDSL{{
|
||||
Title: "::View",
|
||||
Icon: "icon-eye",
|
||||
Action: component.ActionNodes{
|
||||
{
|
||||
"name": "OpenModal",
|
||||
"type": "Common.openModal",
|
||||
"payload": map[string]interface{}{
|
||||
"Form": map[string]interface{}{
|
||||
"type": "view",
|
||||
"model": formName,
|
||||
},
|
||||
},
|
||||
Action: component.ActionNodes{{
|
||||
"name": "OpenModal",
|
||||
"type": "Common.openModal",
|
||||
"payload": map[string]interface{}{
|
||||
"Form": map[string]interface{}{"type": "view", "model": formName},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
component.ActionDSL{
|
||||
}},
|
||||
}, {
|
||||
Title: "::Edit",
|
||||
Icon: "icon-edit-2",
|
||||
Action: component.ActionNodes{
|
||||
{
|
||||
"name": "OpenModal",
|
||||
"type": "Common.openModal",
|
||||
"payload": map[string]interface{}{
|
||||
"Form": map[string]interface{}{
|
||||
"type": "edit",
|
||||
"model": formName,
|
||||
},
|
||||
},
|
||||
Action: component.ActionNodes{{
|
||||
"name": "OpenModal",
|
||||
"type": "Common.openModal",
|
||||
"payload": map[string]interface{}{
|
||||
"Form": map[string]interface{}{"type": "edit", "model": formName},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
component.ActionDSL{
|
||||
}},
|
||||
}, {
|
||||
Title: "::Delete",
|
||||
Icon: "icon-trash-2",
|
||||
Style: "danger",
|
||||
Action: component.ActionNodes{
|
||||
{
|
||||
"name": "Delete",
|
||||
"type": "Table.delete",
|
||||
"payload": map[string]interface{}{"model": formName},
|
||||
},
|
||||
},
|
||||
Confirm: &component.ConfirmActionDSL{
|
||||
Title: "::Confirm",
|
||||
Desc: "::Please confirm, the data cannot be recovered",
|
||||
},
|
||||
},
|
||||
Action: component.ActionNodes{{
|
||||
"name": "Confirm",
|
||||
"type": "Common.confirm",
|
||||
"payload": map[string]interface{}{"title": "::Confirm", "content": "::Please confirm, the data cannot be recovered"},
|
||||
}, {
|
||||
"name": "Delete",
|
||||
"type": "Table.delete",
|
||||
"payload": map[string]interface{}{"model": formName},
|
||||
}},
|
||||
}}...,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue