提交 8325476a 编写于 作者: Mosher's avatar Mosher

update:适配表格列宽度

上级 25defc75
...@@ -12,6 +12,8 @@ import net.ibizsys.model.control.IPSControl; ...@@ -12,6 +12,8 @@ import net.ibizsys.model.control.IPSControl;
import net.ibizsys.model.control.IPSControlContainer; import net.ibizsys.model.control.IPSControlContainer;
import net.ibizsys.model.control.dashboard.IPSDBContainerPortletPart; import net.ibizsys.model.control.dashboard.IPSDBContainerPortletPart;
import net.ibizsys.model.control.dashboard.IPSDBPortletPart; import net.ibizsys.model.control.dashboard.IPSDBPortletPart;
import net.ibizsys.model.control.grid.IPSDEGrid;
import net.ibizsys.model.control.grid.IPSDEGridColumn;
import net.ibizsys.model.control.toolbar.IPSDETBUIActionItem; import net.ibizsys.model.control.toolbar.IPSDETBUIActionItem;
import net.ibizsys.model.control.toolbar.IPSDEToolbar; import net.ibizsys.model.control.toolbar.IPSDEToolbar;
import net.ibizsys.model.view.IPSUIAction; import net.ibizsys.model.view.IPSUIAction;
...@@ -217,6 +219,38 @@ public class CtrlModel extends BaseModel{ ...@@ -217,6 +219,38 @@ public class CtrlModel extends BaseModel{
} }
} }
// 表格是否需要空白列
public Boolean isNeedEmptyColumn() {
if (getControl().getControlType() != null && "GRID".equals(getControl().getControlType())) {
Boolean flag = true;
for (IPSDEGridColumn column : ((IPSDEGrid)getControl()).getPSDEGridColumns()) {
// 自适应列
if (
column.getWidthUnit() != null
&& "STAR".equals(column.getWidthUnit())
&& column.getColumnType() != null
&& !"GROUPGRIDCOLUMN".equals(column.getColumnType())
) {
flag = false;
break;
}
}
return flag;
}
return false;
}
// 获取表格列总宽度
public Integer getTotalColumnWidth() {
Integer width = 10;
if (getControl().getControlType() != null && "GRID".equals(getControl().getControlType())) {
for (IPSDEGridColumn column : ((IPSDEGrid)getControl()).getPSDEGridColumns()) {
width += column.getWidth();
}
}
return width;
}
// 忽略发布 // 忽略发布
public Boolean ignore() { public Boolean ignore() {
IPSControl control = getControl(); IPSControl control = getControl();
......
...@@ -58,4 +58,11 @@ export interface GridControlState extends MDControlState { ...@@ -58,4 +58,11 @@ export interface GridControlState extends MDControlState {
*/ */
updateDefaultItems: IParam[]; updateDefaultItems: IParam[];
/**
* @description 表格列总宽度
* @type {number}
* @memberof GridControlState
*/
totalColumnWidth: number;
} }
...@@ -30,12 +30,12 @@ export class GridControl extends MDControl { ...@@ -30,12 +30,12 @@ export class GridControl extends MDControl {
* @memberof GridControl * @memberof GridControl
*/ */
public useCustom() { public useCustom() {
const { controlName, selectFirstDefault, rowEditState, rowActiveMode, isSingleSelect } = this.state; const { controlName, selectFirstDefault, rowEditState, rowActiveMode, isSingleSelect, totalColumnWidth } = this.state;
// 滚动条配置 // 滚动条配置
const useScrollOption = computed(() => { const useScrollOption = computed(() => {
return { return {
scrollToFirstRowOnChange: true, scrollToFirstRowOnChange: true,
x: '100%', x: totalColumnWidth || '150%',
y: '100%', y: '100%',
} }
}); });
...@@ -107,7 +107,7 @@ export class GridControl extends MDControl { ...@@ -107,7 +107,7 @@ export class GridControl extends MDControl {
} }
return { return {
type: isSingleSelect ? 'radio' : 'checkbox', type: isSingleSelect ? 'radio' : 'checkbox',
columnWidth: 32, columnWidth: 50,
selectedRowKeys: this.state.selectedRowKeys, selectedRowKeys: this.state.selectedRowKeys,
checkStrictly: this.props.multiple ? false : true, checkStrictly: this.props.multiple ? false : true,
onChange: (_selectedRowKeys: string[], selectedRows: IParam[]) => { onChange: (_selectedRowKeys: string[], selectedRows: IParam[]) => {
......
...@@ -16,3 +16,13 @@ ...@@ -16,3 +16,13 @@
padding-left: 0; padding-left: 0;
} }
} }
.app-grid {
.header-cell {
display: flex;
}
.not-data {
display: flex;
flex-direction: column;
align-items: center;
}
}
\ No newline at end of file
...@@ -22,6 +22,7 @@ export class ControlVO extends ControlVOBase { ...@@ -22,6 +22,7 @@ export class ControlVO extends ControlVOBase {
export const ctrlState = { export const ctrlState = {
controlCodeName: '{{ctrl.codeName}}', controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}', controlName: '{{ctrl.name}}',
totalColumnWidth: {{ctrl.totalColumnWidth}},
appEntityCodeName: '{{ctrl.appEntity.codeName}}', appEntityCodeName: '{{ctrl.appEntity.codeName}}',
appDeCodeName:'{{ctrl.appEntity.codeName}}', appDeCodeName:'{{ctrl.appEntity.codeName}}',
appDeKeyFieldName: '{{#if ctrl.appEntity.keyPSAppDEField}}{{ctrl.appEntity.keyPSAppDEField.codeName}}{{/if}}', appDeKeyFieldName: '{{#if ctrl.appEntity.keyPSAppDEField}}{{ctrl.appEntity.keyPSAppDEField.codeName}}{{/if}}',
...@@ -114,8 +115,27 @@ export const ctrlState = { ...@@ -114,8 +115,27 @@ export const ctrlState = {
}, },
{{/if}} {{/if}}
{{/if}} {{/if}}
{{!-- 适配表格操作列浮动 --}}
{{#each ctrl.psDEGridColumns as | column |}} {{#each ctrl.psDEGridColumns as | column |}}
{{#unless (eq column.columnType 'UAGRIDCOLUMN')}}
{{> @macro/front-end/widgets/grid-detail/include-grid.hbs type="COLUMNMODEL" item=column}} {{> @macro/front-end/widgets/grid-detail/include-grid.hbs type="COLUMNMODEL" item=column}}
{{/unless}}
{{/each}}
{{#if ctrl.needEmptyColumn}}
{
title: "",
columnType: "EMPTYCOLUMN",
dataIndex: "autowidthcolumn",
align: "center",
resizable: true,
ellipsis: true,
aggMode: "NONE",
},
{{/if}}
{{#each ctrl.psDEGridColumns as | column |}}
{{#if (eq column.columnType 'UAGRIDCOLUMN')}}
{{> @macro/front-end/widgets/grid-detail/include-grid.hbs type="COLUMNMODEL" item=column}}
{{/if}}
{{/each}} {{/each}}
], ],
// 是否单选 // 是否单选
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册