feat: add IM governance admin enhancements

This commit is contained in:
richjohnrambo
2026-08-21 16:06:29 +08:00
parent 543c7b624e
commit 21a5b97ac8
34 changed files with 2621 additions and 135 deletions
+50 -4
View File
@@ -14,6 +14,7 @@
:columns="memberColumns"
:request="loadDataTable"
:row-key="(row) => row.userId"
:actionColumn="actionColumn"
:scroll-x="scrollX"
:resizeHeightOffset="-10000"
/>
@@ -27,17 +28,42 @@
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { BasicTable } from '@/components/Table';
import { MemberList } from '@/api/imGroup';
import { computed, h, reactive, ref } from 'vue';
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 { memberColumns, newState, State } from './model';
import { adaModalWidth, adaTableScrollX } from '@/utils/hotgo';
const message = useMessage();
const dialog = useDialog();
const { hasPermission } = usePermission();
const showModal = ref(false);
const current = ref<State>(newState(null));
const actionRef = ref();
const dialogWidth = computed(() => adaModalWidth(980));
const scrollX = computed(() => adaTableScrollX(memberColumns, 0));
const actionColumn = reactive({
width: 100,
title: '操作',
key: 'action',
fixed: 'right',
render(record) {
return h(TableAction as any, {
style: 'button',
actions: [
{
label: '禁言',
type: 'warning',
ifShow: () => record.memberStatus === 'active',
disabled: !hasPermission(['/imGroup/mute']),
onClick: () => handleMute(record),
},
],
});
},
});
const scrollX = computed(() => adaTableScrollX(memberColumns, actionColumn.width));
// 加载表格数据
const loadDataTable = async (res) => {
@@ -56,6 +82,26 @@
showModal.value = false;
}
function handleMute(record) {
dialog.warning({
title: '禁言成员',
content: '将该成员禁言 24 小时,是否确认?',
positiveText: '确认',
negativeText: '取消',
onPositiveClick: async () => {
await Mute({
tenantId: current.value.tenantId,
topic: current.value.topic,
userId: record.userId,
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
reason: '后台管理员禁言',
});
message.success('操作成功');
actionRef.value?.reload();
},
});
}
// 打开弹窗
function openModal(state: State) {
current.value = newState(state);