Commit a75d3f7cc4bce9c3a77e128ae9ea6fc9e5f6a97e
1 parent
dc32fe14
fix: add data component custom layout
Showing
3 changed files
with
18 additions
and
1 deletions
... | ... | @@ -70,7 +70,12 @@ public class YtDataComponentController extends BaseController { |
70 | 70 | DataBoardDTO dataBoardDTO = ytDataBoardService.findDataBoardInfoById(boardId, tenantId); |
71 | 71 | List<ComponentLayoutDTO> listLayout = dataBoardDTO.getLayout(); |
72 | 72 | ResponseResult<DataComponentDTO> result = saveOrUpdate(dataComponent); |
73 | - ComponentLayoutDTO defaultLayout = new ComponentLayoutDTO(result.getData().getId()); | |
73 | + ComponentLayoutDTO defaultLayout; | |
74 | + if (null == dataComponent.getLayout()) { | |
75 | + defaultLayout = new ComponentLayoutDTO(result.getData().getId()); | |
76 | + } else { | |
77 | + defaultLayout = dataComponent.getLayout(); | |
78 | + } | |
74 | 79 | listLayout.add(defaultLayout); |
75 | 80 | ytDataBoardService.saveComponentLayout(listLayout, boardId, tenantId); |
76 | 81 | return result; | ... | ... |
1 | 1 | package org.thingsboard.server.common.data.yunteng.dto; |
2 | 2 | import io.swagger.annotations.ApiModelProperty; |
3 | 3 | import lombok.Data; |
4 | +import org.thingsboard.server.common.data.yunteng.dto.board.ComponentLayoutDTO; | |
4 | 5 | import org.thingsboard.server.common.data.yunteng.dto.board.DataSourceInfoDTO; |
5 | 6 | |
6 | 7 | import java.util.List; |
... | ... | @@ -21,4 +22,7 @@ public class DataComponentDTO extends TenantDTO { |
21 | 22 | |
22 | 23 | @ApiModelProperty(value = "备注") |
23 | 24 | private String remark; |
25 | + | |
26 | + @ApiModelProperty(value = "组件布局") | |
27 | + private ComponentLayoutDTO layout; | |
24 | 28 | } | ... | ... |
... | ... | @@ -34,4 +34,12 @@ public class ComponentLayoutDTO implements Serializable { |
34 | 34 | this.w = 6; |
35 | 35 | this.h = 6; |
36 | 36 | } |
37 | + | |
38 | + public ComponentLayoutDTO(String id, Integer x, Integer y, Integer w, Integer h) { | |
39 | + this.id = id; | |
40 | + this.x = x; | |
41 | + this.y = y; | |
42 | + this.w = w; | |
43 | + this.h = h; | |
44 | + } | |
37 | 45 | } | ... | ... |