gaoluyang
2026-06-29 27cd042df9aca0383a49f3514bc21958dd890912
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<script lang="ts" setup>
import type { ImManagerGroupApi } from '#/api/im/manager/group';
 
import { computed, ref } from 'vue';
 
import { CommonStatusEnum, DICT_TYPE } from '#/packages/constants/src';
 
import {
  Avatar,
  Checkbox,
  Descriptions,
  DescriptionsItem,
  Drawer,
  Table,
  Tag,
} from 'ant-design-vue';
 
import { getManagerGroupMemberList } from '#/api/im/manager/group';
import { DictTag } from '#/components/dict-tag';
import {
  formatDateTimeText,
  formatUserLabel,
} from '#/views/im/manager/utils/format';
 
const visible = ref(false);
const detail = ref<ImManagerGroupApi.Group>({} as ImManagerGroupApi.Group);
const loading = ref(false);
const activeOnly = ref(true);
const memberList = ref<ImManagerGroupApi.GroupMember[]>([]);
 
const filteredMembers = computed(() =>
  activeOnly.value
    ? memberList.value.filter((item) => item.status === CommonStatusEnum.ENABLE)
    : memberList.value,
);
 
const columns = [
  { title: '头像', dataIndex: 'avatar', width: 80 },
  { title: '用户编号', dataIndex: 'userId', width: 100 },
  { title: '角色', dataIndex: 'role', width: 100 },
  { title: '昵称', dataIndex: 'nickname' },
  { title: '组内显示名', dataIndex: 'displayUserName' },
  { title: '群备注', dataIndex: 'groupRemark' },
  { title: '免打扰', dataIndex: 'silent', width: 90 },
  { title: '状态', dataIndex: 'status', width: 100 },
  { title: '入群时间', dataIndex: 'joinTime', width: 180 },
  { title: '退群时间', dataIndex: 'quitTime', width: 180 },
  { title: '禁言状态', dataIndex: 'muteEndTime', width: 180 },
];
 
/** 打开详情 */
async function open(row: ImManagerGroupApi.Group) {
  detail.value = row;
  visible.value = true;
  activeOnly.value = true;
  loading.value = true;
  try {
    memberList.value = await getManagerGroupMemberList(row.id);
  } finally {
    loading.value = false;
  }
}
 
defineExpose({ open });
</script>
 
<template>
  <Drawer v-model:open="visible" destroy-on-close title="群详情" width="900">
    <Descriptions bordered :column="2">
      <DescriptionsItem label="群编号">{{ detail.id }}</DescriptionsItem>
      <DescriptionsItem label="群名称">{{ detail.name }}</DescriptionsItem>
      <DescriptionsItem label="头像">
        <Avatar :src="detail.avatar" :size="36">
          {{ detail.name?.charAt(0) || '?' }}
        </Avatar>
      </DescriptionsItem>
      <DescriptionsItem label="群主">
        {{ formatUserLabel(detail.ownerNickname, detail.ownerUserId) }}
      </DescriptionsItem>
      <DescriptionsItem label="成员数">{{ detail.memberCount || 0 }}</DescriptionsItem>
      <DescriptionsItem label="群状态">
        <DictTag :type="DICT_TYPE.IM_GROUP_STATUS" :value="detail.status" />
      </DescriptionsItem>
      <DescriptionsItem label="封禁状态">
        <DictTag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="detail.banned" />
        <span v-if="detail.banned" class="ml-2 text-gray-400">
          {{ detail.bannedReason }}
        </span>
      </DescriptionsItem>
      <DescriptionsItem label="全群禁言">
        <Tag v-if="detail.mutedAll" color="error">已禁言</Tag>
        <Tag v-else>未禁言</Tag>
      </DescriptionsItem>
      <DescriptionsItem label="群公告" :span="2">
        {{ detail.notice || '-' }}
      </DescriptionsItem>
      <DescriptionsItem label="创建时间" :span="2">
        {{ formatDateTimeText(detail.createTime) }}
      </DescriptionsItem>
    </Descriptions>
 
    <div class="mb-4 mt-5 flex items-center justify-between">
      <span class="font-bold">群成员</span>
      <Checkbox v-model:checked="activeOnly">仅展示当前群内的成员</Checkbox>
    </div>
    <Table
      :columns="columns"
      :data-source="filteredMembers"
      :loading="loading"
      :pagination="false"
      bordered
      row-key="userId"
      size="small"
    >
      <template #bodyCell="{ column, record, text }">
        <template v-if="column.dataIndex === 'avatar'">
          <Avatar :src="record.avatar" :size="40">
            {{ record.nickname?.charAt(0) || '?' }}
          </Avatar>
        </template>
        <template v-else-if="column.dataIndex === 'role'">
          <DictTag :type="DICT_TYPE.IM_GROUP_MEMBER_ROLE" :value="record.role" />
        </template>
        <template v-else-if="column.dataIndex === 'silent'">
          <DictTag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="record.silent" />
        </template>
        <template v-else-if="column.dataIndex === 'status'">
          <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="record.status" />
        </template>
        <template v-else-if="column.dataIndex === 'joinTime'">
          {{ formatDateTimeText(record.joinTime) }}
        </template>
        <template v-else-if="column.dataIndex === 'quitTime'">
          {{ formatDateTimeText(record.quitTime) }}
        </template>
        <template v-else-if="column.dataIndex === 'muteEndTime'">
          <template v-if="record.muteEndTime && new Date(record.muteEndTime) > new Date()">
            <Tag color="error">禁言中</Tag>
            <div class="mt-1 text-xs text-gray-400">
              {{ formatDateTimeText(record.muteEndTime) }}
            </div>
          </template>
          <span v-else>-</span>
        </template>
        <template v-else>
          {{ text || '-' }}
        </template>
      </template>
    </Table>
  </Drawer>
</template>