feat: complete IM group governance actions
This commit is contained in:
@@ -102,10 +102,22 @@
|
||||
:columns="joinRequestColumns"
|
||||
:request="joinRequestData"
|
||||
:row-key="(row) => row.requestId"
|
||||
:actionColumn="joinRequestActionColumn"
|
||||
:scroll-x="joinRequestScrollX"
|
||||
:resizeHeightOffset="-10000"
|
||||
/>
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="files" tab="群文件">
|
||||
<BasicTable
|
||||
ref="fileRef"
|
||||
:columns="groupFileColumns"
|
||||
:request="fileData"
|
||||
:row-key="(row) => row.groupFileId"
|
||||
:actionColumn="fileActionColumn"
|
||||
:scroll-x="fileScrollX"
|
||||
:resizeHeightOffset="-10000"
|
||||
/>
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="invitations" tab="群邀请">
|
||||
<BasicTable
|
||||
ref="invitationRef"
|
||||
@@ -183,10 +195,14 @@
|
||||
AdminLogList,
|
||||
AnnouncementList,
|
||||
Dissolve,
|
||||
FileDelete,
|
||||
FileList,
|
||||
Governance,
|
||||
GovernanceUpdate,
|
||||
InvitationList,
|
||||
JoinRequestApprove,
|
||||
JoinRequestList,
|
||||
JoinRequestReject,
|
||||
MuteList,
|
||||
Unmute,
|
||||
} from '@/api/imGroup';
|
||||
@@ -194,6 +210,7 @@
|
||||
adminLogColumns,
|
||||
announcementColumns,
|
||||
GovernanceState,
|
||||
groupFileColumns,
|
||||
invitationColumns,
|
||||
joinRequestColumns,
|
||||
muteColumns,
|
||||
@@ -222,10 +239,58 @@
|
||||
);
|
||||
|
||||
const joinRequestRef = ref();
|
||||
const fileRef = ref();
|
||||
const invitationRef = ref();
|
||||
const announcementRef = ref();
|
||||
const muteRef = ref();
|
||||
const adminLogRef = ref();
|
||||
const joinRequestActionColumn = reactive({
|
||||
width: 150,
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
render(record) {
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '通过',
|
||||
type: 'primary',
|
||||
ifShow: () => record.status === 'pending',
|
||||
auth: ['/imGroup/joinRequestApprove'],
|
||||
onClick: () => handleJoinRequestApprove(record),
|
||||
},
|
||||
{
|
||||
label: '拒绝',
|
||||
type: 'error',
|
||||
ifShow: () => record.status === 'pending',
|
||||
auth: ['/imGroup/joinRequestReject'],
|
||||
onClick: () => handleJoinRequestReject(record),
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
const fileActionColumn = reactive({
|
||||
width: 100,
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
render(record) {
|
||||
return h(TableAction as any, {
|
||||
style: 'button',
|
||||
actions: [
|
||||
{
|
||||
label: '删除',
|
||||
type: 'error',
|
||||
ifShow: () => record.status === 'active',
|
||||
auth: ['/imGroup/fileDelete'],
|
||||
onClick: () => handleFileDelete(record),
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
const muteActionColumn = reactive({
|
||||
width: 110,
|
||||
title: '操作',
|
||||
@@ -247,7 +312,10 @@
|
||||
},
|
||||
});
|
||||
|
||||
const joinRequestScrollX = computed(() => adaTableScrollX(joinRequestColumns, 0));
|
||||
const joinRequestScrollX = computed(() =>
|
||||
adaTableScrollX(joinRequestColumns, joinRequestActionColumn.width)
|
||||
);
|
||||
const fileScrollX = computed(() => adaTableScrollX(groupFileColumns, fileActionColumn.width));
|
||||
const invitationScrollX = computed(() => adaTableScrollX(invitationColumns, 0));
|
||||
const announcementScrollX = computed(() => adaTableScrollX(announcementColumns, 0));
|
||||
const muteScrollX = computed(() => adaTableScrollX(muteColumns, muteActionColumn.width));
|
||||
@@ -265,6 +333,10 @@
|
||||
return await JoinRequestList(baseParams(res));
|
||||
}
|
||||
|
||||
async function fileData(res) {
|
||||
return await FileList(baseParams(res));
|
||||
}
|
||||
|
||||
async function invitationData(res) {
|
||||
return await InvitationList(baseParams(res));
|
||||
}
|
||||
@@ -361,9 +433,65 @@
|
||||
});
|
||||
}
|
||||
|
||||
function handleJoinRequestApprove(record) {
|
||||
dialog.success({
|
||||
title: '通过入群申请',
|
||||
content: '确定通过该入群申请?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await JoinRequestApprove({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
requestId: record.requestId,
|
||||
});
|
||||
message.success('操作成功');
|
||||
joinRequestRef.value?.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleJoinRequestReject(record) {
|
||||
dialog.error({
|
||||
title: '拒绝入群申请',
|
||||
content: '确定拒绝该入群申请?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await JoinRequestReject({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
requestId: record.requestId,
|
||||
rejectReason: '后台管理员拒绝',
|
||||
});
|
||||
message.success('操作成功');
|
||||
joinRequestRef.value?.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleFileDelete(record) {
|
||||
dialog.error({
|
||||
title: '删除群文件',
|
||||
content: '删除后该群文件会被标记为已删除,并写入群事件等待 IM 服务端同步,是否确认?',
|
||||
positiveText: '确认',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
await FileDelete({
|
||||
tenantId: current.value.tenantId,
|
||||
topic: current.value.topic,
|
||||
groupFileId: record.groupFileId,
|
||||
});
|
||||
message.success('操作成功');
|
||||
fileRef.value?.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function reloadActiveTable() {
|
||||
const refs = {
|
||||
joinRequests: joinRequestRef,
|
||||
files: fileRef,
|
||||
invitations: invitationRef,
|
||||
announcements: announcementRef,
|
||||
mutes: muteRef,
|
||||
|
||||
Reference in New Issue
Block a user