diff --git a/widgets/table/layout.go b/widgets/table/layout.go index 32aab556..52fc09cb 100644 --- a/widgets/table/layout.go +++ b/widgets/table/layout.go @@ -181,7 +181,6 @@ func (layout *LayoutDSL) Xgen() (map[string]interface{}, error) { // replace import if layout.Header != nil && layout.Header.Preset != nil && layout.Header.Preset.Import != nil { name := layout.Header.Preset.Import.Name - operation := layout.Header.Preset.Import.Operation res["header"].(map[string]interface{})["preset"].(map[string]interface{})["import"] = map[string]interface{}{ "api": map[string]interface{}{ "setting": fmt.Sprintf("/api/xiang/import/%s/setting", name), @@ -191,7 +190,7 @@ func (layout *LayoutDSL) Xgen() (map[string]interface{}, error) { "mapping_setting_model": fmt.Sprintf("import_%s_mapping", name), "preview_setting_model": fmt.Sprintf("import_%s_preview", name), }, - "operation": operation, + "actions": layout.Header.Preset.Import.Actions, } } diff --git a/widgets/table/process_test.go b/widgets/table/process_test.go index 428cc7d7..7174aaac 100644 --- a/widgets/table/process_test.go +++ b/widgets/table/process_test.go @@ -351,7 +351,8 @@ func TestProcessSetting(t *testing.T) { data := any.Of(res).MapStr().Dot() assert.Equal(t, "/api/xiang/import/pet", data.Get("header.preset.import.api.import")) - // assert.Equal(t, "跳转", data.Get("header.preset.import.operation.0.title")) + assert.Equal(t, "查看详情1", data.Get("header.preset.import.actions[0].title")) + assert.Equal(t, "查看详情2", data.Get("header.preset.import.actions[1].title")) assert.Equal(t, "/api/__yao/table/pet/component/fields.table.入院状态.view.props.xProps/remote", data.Get("fields.table.入院状态.view.props.xProps.remote.api")) assert.Equal(t, "/api/__yao/table/pet/component/fields.table.入院状态.edit.props.xProps/remote", data.Get("fields.table.入院状态.edit.props.xProps.remote.api")) } @@ -368,7 +369,8 @@ func TestProcessXgen(t *testing.T) { data := any.Of(res).MapStr().Dot() assert.Equal(t, "/api/xiang/import/pet", data.Get("header.preset.import.api.import")) - // assert.Equal(t, "跳转", data.Get("header.preset.import.operation.0.title")) + assert.Equal(t, "查看详情1", data.Get("header.preset.import.actions[0].title")) + assert.Equal(t, "查看详情2", data.Get("header.preset.import.actions[1].title")) assert.Equal(t, "/api/__yao/table/pet/component/fields.table.入院状态.view.props.xProps/remote", data.Get("fields.table.入院状态.view.props.xProps.remote.api")) assert.Equal(t, "/api/__yao/table/pet/component/fields.table.入院状态.edit.props.xProps/remote", data.Get("fields.table.入院状态.edit.props.xProps.remote.api")) } diff --git a/widgets/table/types.go b/widgets/table/types.go index 68a3d5f6..6608859e 100644 --- a/widgets/table/types.go +++ b/widgets/table/types.go @@ -101,14 +101,8 @@ type BatchPresetDSL struct { // ImportPresetDSL layout.header.preset.import type ImportPresetDSL struct { - Name string `json:"name,omitempty"` - Operation []OperationImportDSL `json:"operation,omitempty"` -} - -// OperationImportDSL layout.header.preset.import.operation[*] -type OperationImportDSL struct { - Title string `json:"title,omitempty"` - Link string `json:"link,omitempty"` + Name string `json:"name,omitempty"` + Actions []component.ActionDSL `json:"actions,omitempty"` } // FilterLayoutDSL layout.filter