提交 7ca2c410 编写于 作者: zhf's avatar zhf

feat: 更新模板

上级 ef959a47
...@@ -47,6 +47,15 @@ export const GridControl = defineComponent({ ...@@ -47,6 +47,15 @@ export const GridControl = defineComponent({
props.params, props.params,
); );
// 部件参数
const controlParam = c.model.source.getPSControlParam();
// 是否不自适应最后一列
const isNotFlex = controlParam?.ctrlParams?.IS_NOT_FLEX === 'true';
// 表格组件
const grid = ref();
const [columns] = useITableColumns(c); const [columns] = useITableColumns(c);
const { onRowClick, onDbRowClick, onSelectionChange, onSortChange } = const { onRowClick, onDbRowClick, onSelectionChange, onSortChange } =
useITableEvent(c); useITableEvent(c);
...@@ -168,6 +177,9 @@ export const GridControl = defineComponent({ ...@@ -168,6 +177,9 @@ export const GridControl = defineComponent({
); );
return item; return item;
}); });
if (!data.length) {
return data;
}
data.unshift({ data.unshift({
hiddenRow: true, hiddenRow: true,
_checked: c.items.every((item: IData) => item._checked), _checked: c.items.every((item: IData) => item._checked),
...@@ -192,6 +204,8 @@ export const GridControl = defineComponent({ ...@@ -192,6 +204,8 @@ export const GridControl = defineComponent({
gridRef, gridRef,
girdPaginationRef, girdPaginationRef,
highlight, highlight,
isNotFlex,
grid,
}; };
}, },
render() { render() {
...@@ -237,6 +251,7 @@ export const GridControl = defineComponent({ ...@@ -237,6 +251,7 @@ export const GridControl = defineComponent({
this.ns.is('show-header', !this.c.model.source.hideHeader), this.ns.is('show-header', !this.c.model.source.hideHeader),
this.ns.is('enable-page', this.c.model.source.enablePagingBar), this.ns.is('enable-page', this.c.model.source.enablePagingBar),
]} ]}
style={this.isNotFlex ? this.grid?.tableStyle : undefined}
> >
<i-table <i-table
ref={'grid'} ref={'grid'}
......
...@@ -97,7 +97,9 @@ export function useITableColumns(c: GridController) { ...@@ -97,7 +97,9 @@ export function useITableColumns(c: GridController) {
// 如果没有自适应列,深拷贝最后一个对象,改成自适应 // 如果没有自适应列,深拷贝最后一个对象,改成自适应
const flexColumn = copy.find(column => !column.width); const flexColumn = copy.find(column => !column.width);
if (!flexColumn) { const ctrlParams = c.model.source.getPSControlParam()?.ctrlParams;
const isNotFlex = ctrlParams?.IS_NOT_FLEX === 'true';
if (!flexColumn && !isNotFlex) {
// 修改自适应列的索引,默认最后一个 // 修改自适应列的索引,默认最后一个
let index = copy.length - 1; let index = copy.length - 1;
if (copy[index].key === 'rowEdit') { if (copy[index].key === 'rowEdit') {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册