From 110c1668da8173362f267d83c89a717314419cad Mon Sep 17 00:00:00 2001 From: 1iyc <5212514+liycone@user.noreply.gitee.com> Date: Thu, 7 Nov 2024 15:49:21 +0800 Subject: [PATCH] v 1.2.2 Signed-off-by: 1iyc <5212514+liycone@user.noreply.gitee.com> --- src/components/TabComponent/index.vue | 11 ++++++ src/components/Table/index.vue | 34 +++++++++++++++---- src/views/gather/pool/index.vue | 48 +++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/src/components/TabComponent/index.vue b/src/components/TabComponent/index.vue index 390bb76..53967ef 100644 --- a/src/components/TabComponent/index.vue +++ b/src/components/TabComponent/index.vue @@ -55,6 +55,7 @@ :loading="loading" @sort-change="handleSortChange" @page-change="handlePageChange" + @operation-click="handleOperationClick" /> @@ -65,6 +66,7 @@ + + diff --git a/src/views/gather/pool/index.vue b/src/views/gather/pool/index.vue index b312701..1c54ba9 100644 --- a/src/views/gather/pool/index.vue +++ b/src/views/gather/pool/index.vue @@ -16,6 +16,7 @@ @query="handleQuery" @reset="handleReset" @toggle="getRows" + @operation-click="handleOperationClick" /> @@ -83,6 +84,20 @@ export default { {label: '表注', prop: 'tableDescription', sortable: true}, {label: '启用', prop: 'enable', formatter: (value) => (value ? '启用' : '禁用'), sortable: true}, {label: '定时', prop: 'cron'}, + { + label: '操作', + prop: 'operations', + width: '150', + fixed: 'right', + scopedSlots: { + customRender: 'operations', + buttons: [ + {text: '编辑', operation: 'edit'}, + {text: '删除', operation: 'delete'}, + {text: '同步', operation: 'sync'}, + ] + } + } ], tabs: [], loading: false, // 添加 loading 属性 @@ -118,6 +133,7 @@ export default { // 查询 handleQuery() { this.getRows(); + }, // 重置 handleReset() { @@ -149,6 +165,38 @@ export default { this.loading = false; // 加载完成后设置 loading 为 false }); }, + // 处理操作列点击事件 + handleOperationClick(operation, row) { + // 根据操作类型执行相应逻辑 + switch (operation) { + case 'edit': + this.handleEdit(row); + break; + case 'delete': + this.handleDelete(row); + break; + case 'sync': + this.handleSync(row); + break; + default: + console.log('未知操作'); + } + }, + // 编辑操作 + handleEdit(row) { + console.log('编辑行:', row); + // 实现编辑逻辑 + }, + // 删除操作 + handleDelete(row) { + console.log('删除行:', row); + // 实现删除逻辑 + }, + // 删除操作 + handleSync(row) { + console.log('同步操作:', row); + // 实现删除逻辑 + }, } };