feat: complete IM group governance actions

This commit is contained in:
richjohnrambo
2026-08-21 16:34:55 +08:00
parent 21a5b97ac8
commit 77b19a8157
12 changed files with 981 additions and 17 deletions
+60 -2
View File
@@ -32,7 +32,7 @@
import { useDialog, useMessage } from 'naive-ui';
import { BasicTable, TableAction } from '@/components/Table';
import { usePermission } from '@/hooks/web/usePermission';
import { MemberList, Mute } from '@/api/imGroup';
import { MemberList, Mute, OwnerTransfer, RoleUpdate } from '@/api/imGroup';
import { memberColumns, newState, State } from './model';
import { adaModalWidth, adaTableScrollX } from '@/utils/hotgo';
@@ -44,7 +44,7 @@
const actionRef = ref();
const dialogWidth = computed(() => adaModalWidth(980));
const actionColumn = reactive({
width: 100,
width: 210,
title: '操作',
key: 'action',
fixed: 'right',
@@ -59,6 +59,27 @@
disabled: !hasPermission(['/imGroup/mute']),
onClick: () => handleMute(record),
},
{
label: '设管理员',
type: 'primary',
ifShow: () => record.memberStatus === 'active' && record.role === 'member',
auth: ['/imGroup/roleUpdate'],
onClick: () => handleRoleUpdate(record, 'admin'),
},
{
label: '取消管理员',
type: 'default',
ifShow: () => record.memberStatus === 'active' && record.role === 'admin',
auth: ['/imGroup/roleUpdate'],
onClick: () => handleRoleUpdate(record, 'member'),
},
{
label: '转群主',
type: 'error',
ifShow: () => record.memberStatus === 'active' && record.role !== 'owner',
auth: ['/imGroup/ownerTransfer'],
onClick: () => handleOwnerTransfer(record),
},
],
});
},
@@ -102,6 +123,43 @@
});
}
function handleRoleUpdate(record, role: string) {
dialog.warning({
title: role === 'admin' ? '设置管理员' : '取消管理员',
content: role === 'admin' ? '确定将该成员设置为管理员?' : '确定取消该成员管理员身份?',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
await RoleUpdate({
tenantId: current.value.tenantId,
topic: current.value.topic,
userId: record.userId,
role,
});
message.success('操作成功');
actionRef.value?.reload();
},
});
}
function handleOwnerTransfer(record) {
dialog.error({
title: '转让群主',
content: '转让后原群主会变为管理员,是否确认?',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
await OwnerTransfer({
tenantId: current.value.tenantId,
topic: current.value.topic,
userId: record.userId,
});
message.success('操作成功');
actionRef.value?.reload();
},
});
}
// 打开弹窗
function openModal(state: State) {
current.value = newState(state);