|
|
|
@ -240,11 +240,14 @@
@@ -240,11 +240,14 @@
|
|
|
|
|
// 表格行配置 |
|
|
|
|
rowSelection: { type: 'checkbox' }, |
|
|
|
|
// 是否展示外边框和列边框 |
|
|
|
|
bordered: true |
|
|
|
|
bordered: true, |
|
|
|
|
// 表格布局 |
|
|
|
|
tableLayout: 'fixed' |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
const defineBasicTableProps = defineProps(basicProps); |
|
|
|
|
const basicTableProps = computed(() => ({ ...toRaw(defineBasicTableProps), ...state.tableProps } as unknown as BasicTableProps)); |
|
|
|
|
const dataSourceRef = computed(() => state.tableProps.dataSource); |
|
|
|
|
// 基于vben-table扩展rowSelection,实现勾选数据自主可控 |
|
|
|
|
const { |
|
|
|
|
getRowSelection, |
|
|
|
@ -254,7 +257,7 @@
@@ -254,7 +257,7 @@
|
|
|
|
|
getSelectRowKeys, |
|
|
|
|
deleteSelectRowByKey, |
|
|
|
|
setSelectedRowKeys |
|
|
|
|
} = useRowSelection(basicTableProps, ref(state.tableProps.dataSource), noop); |
|
|
|
|
} = useRowSelection(basicTableProps, dataSourceRef, noop); |
|
|
|
|
// 基于vben-table扩展分页 |
|
|
|
|
const { |
|
|
|
|
getPaginationInfo, |
|
|
|
@ -266,12 +269,11 @@
@@ -266,12 +269,11 @@
|
|
|
|
|
// 使用vben-table行斑马线 |
|
|
|
|
const { getRowClassName } = useTableStyle(basicTableProps, prefixCls); |
|
|
|
|
// 使用vben-table自动计算表格高度跟在指定区域显示滚动条 |
|
|
|
|
const { getScrollRef, redoHeight } = useTableScroll(basicTableProps, tableElRef, columns as any, getRowSelectionRef, state.tableProps.dataSource as any); |
|
|
|
|
const { getScrollRef, redoHeight } = useTableScroll(basicTableProps, tableElRef, columns as any, getRowSelectionRef, dataSourceRef); |
|
|
|
|
// 设置并绑定a-table属性 |
|
|
|
|
const getBindValues = computed(() => { |
|
|
|
|
const propsData: Recordable = { |
|
|
|
|
...state.tableProps, |
|
|
|
|
tableLayout: 'fixed', |
|
|
|
|
columns: columns, |
|
|
|
|
size: state.selectedKeys[0], |
|
|
|
|
scroll: unref(getScrollRef), |
|
|
|
@ -304,6 +306,7 @@
@@ -304,6 +306,7 @@
|
|
|
|
|
if (result) { |
|
|
|
|
state.tableProps.dataSource = result.data; |
|
|
|
|
setPagination({ total: result.total }); |
|
|
|
|
redoHeight(); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
state.tableProps.loading = false; |
|
|
|
|