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
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ImManagerRtcApi } from '#/api/im/manager/rtc';
 
import { ref } from 'vue';
 
import { Page } from '#/packages/effects/common-ui/src';
import { DICT_TYPE } from '#/packages/constants/src';
 
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getManagerRtcCallPage } from '#/api/im/manager/rtc';
import { DictTag } from '#/components/dict-tag';
import {
  formatGroupLabel,
  formatUserLabel,
} from '#/views/im/manager/utils/format';
import { resolveCallDuration } from '#/views/im/utils/time';
 
import { useRtcGridColumns, useRtcGridFormSchema } from './data';
import Detail from './modules/detail.vue';
 
defineOptions({ name: 'ImManagerRtcCall' });
 
const detailRef = ref<InstanceType<typeof Detail>>();
 
/** 打开详情 */
function handleDetail(row: ImManagerRtcApi.RtcCall) {
  detailRef.value?.open(row);
}
 
const [Grid] = useVbenVxeGrid({
  formOptions: {
    schema: useRtcGridFormSchema(),
  },
  gridOptions: {
    columns: useRtcGridColumns(),
    height: 'auto',
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async ({ page }, formValues) => {
          return await getManagerRtcCallPage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            ...formValues,
          });
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
      search: true,
    },
  } as VxeTableGridOptions<ImManagerRtcApi.RtcCall>,
});
</script>
 
<template>
  <Page auto-content-height>
    <Detail ref="detailRef" />
    <Grid table-title="通话记录列表">
      <template #inviter="{ row }">
        {{ formatUserLabel(row.inviterNickname, row.inviterUserId) }}
      </template>
      <template #group="{ row }">
        {{ formatGroupLabel(row.groupName, row.groupId) }}
      </template>
      <template #endReason="{ row }">
        <DictTag
          v-if="row.endReason"
          :type="DICT_TYPE.IM_RTC_CALL_END_REASON"
          :value="row.endReason"
        />
        <span v-else>-</span>
      </template>
      <template #duration="{ row }">
        {{ resolveCallDuration(row.acceptTime, row.endTime) }}
      </template>
      <template #actions="{ row }">
        <TableAction
          :actions="[
            {
              label: '详情',
              type: 'link',
              icon: ACTION_ICON.VIEW,
              auth: ['im:manager:rtc:query'],
              onClick: handleDetail.bind(null, row),
            },
          ]"
        />
      </template>
    </Grid>
  </Page>
</template>