|
|
@@ -19,6 +19,7 @@ export function handleComposeTable<T>({ queryFn, tableName }: ComposeTableParam)
|
|
|
const { contextMenu, openContext, closeContext: closeContextAction } = handleContextMenu();
|
|
|
// 表头数据
|
|
|
const { columns, registerColumn, updateColumn } = getTableColumns();
|
|
|
+
|
|
|
// 右键回调函数
|
|
|
const eventsCB: TableEventCB = {
|
|
|
contextmenuCB: (record: T, value: ContextMenuTemp) => {
|
|
|
@@ -26,21 +27,26 @@ export function handleComposeTable<T>({ queryFn, tableName }: ComposeTableParam)
|
|
|
contextMenu.value = value
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 表格事件
|
|
|
- const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(eventsCB);
|
|
|
+ const { expandedRowKeys, selectedRow, rowClassName, Rowclick } = getTableEvent<T>(eventsCB);
|
|
|
+
|
|
|
// 控制异步组件
|
|
|
const { componentId, closeComponent, openComponent } = handleModalComponent(queryFn, selectedRow);
|
|
|
+
|
|
|
// 关闭右键
|
|
|
- function closeContext(value: BtnListType | null) {
|
|
|
+ const closeContext = (value: BtnListType | null) => {
|
|
|
// 打开对应的弹窗组件
|
|
|
if (value) openComponent(value, selectedRow.value)
|
|
|
// 关闭右键
|
|
|
closeContextAction()
|
|
|
}
|
|
|
+
|
|
|
onUnmounted(() => {
|
|
|
// 离开组件,手动关闭右键,防止出现bug
|
|
|
closeContextAction()
|
|
|
})
|
|
|
+
|
|
|
initData(() => {
|
|
|
// 获取列表数据
|
|
|
queryFn();
|
|
|
@@ -48,10 +54,12 @@ export function handleComposeTable<T>({ queryFn, tableName }: ComposeTableParam)
|
|
|
if (tableName) {
|
|
|
registerColumn(tableName);
|
|
|
}
|
|
|
- }); return {
|
|
|
+ })
|
|
|
+
|
|
|
+ return {
|
|
|
contextMenu, openContext, closeContext, // 右键
|
|
|
columns, registerColumn, updateColumn, // 表头
|
|
|
- expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
|
|
|
+ expandedRowKeys, selectedRow, rowClassName, Rowclick, // 表格折腾面板数据与单击、双击事件
|
|
|
componentId, closeComponent, openComponent, // 控制异步组件
|
|
|
}
|
|
|
}
|
|
|
@@ -85,7 +93,7 @@ export function handleComposeTable_detail<T>({ queryFn, tableName, menuType }: C
|
|
|
},
|
|
|
};
|
|
|
// 表格事件
|
|
|
- const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(events);
|
|
|
+ const { expandedRowKeys, selectedRow, rowClassName, Rowclick } = getTableEvent<T>(events);
|
|
|
cacheSelectedRow = selectedRow as Ref<T>
|
|
|
// 控制异步组件
|
|
|
const { componentId, closeComponent, openComponent } = handleModalComponent(queryFn, selectedRow);
|
|
|
@@ -110,7 +118,7 @@ export function handleComposeTable_detail<T>({ queryFn, tableName, menuType }: C
|
|
|
visible, openDrawer, closeDrawer, // 控制 drawer 组件是否显示
|
|
|
columns, registerColumn, updateColumn, // 表头数据
|
|
|
columnsDetail, registerColumnDetail, updateColumnDetail, detailTableList,// 明细表头数据
|
|
|
- expandedRowKeys, selectedRow, Rowclick, // 表格事件
|
|
|
+ expandedRowKeys, selectedRow, rowClassName, Rowclick, // 表格事件
|
|
|
componentId, closeComponent, openComponent, // 控制异步组件
|
|
|
tabList,
|
|
|
}
|