文件命名与目录整理: - IM home/manager 组件文件统一 PascalCase → kebab-case,并新增各级 components/index.ts barrel 导出 - manager 选择器按业务模块就近收敛到频道、素材、群组目录,删除根 components 下的重复实现 - UserMultiSelect 改为复用 system/user/components/UserSelect,并补充多选与 getUserList 回显能力 - 合并 statistics 子组件导出,MessageContentPreview 调整为 content-preview 问题修复: - 群聊发送按钮由 Element Plus split-button 写法改为 antd DropdownButton,恢复「发送回执消息」入口 - 修复 scoped 下暗色模式选择器塌缩导致整页发红的问题 - 修复会话「+」菜单图标与文字折行问题 - 修复推荐名片、转发、添加好友弹窗冒出多余 antd 默认底栏的问题 代码规范: - 清理 IM 模块类型别名、注释和工具方法写法,保持 Vben 规范 - constants.ts 内容类型判定集合由数组改为 Set - 优化 message/image/pull 等工具函数的 lint 写法
245 lines
5.4 KiB
TypeScript
245 lines
5.4 KiB
TypeScript
import type { VbenFormSchema } from '#/adapter/form';
|
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
|
|
import { markRaw } from 'vue';
|
|
|
|
import { DICT_TYPE } from '@vben/constants';
|
|
import { getDictOptions } from '@vben/hooks';
|
|
|
|
import { getRangePickerDefaultProps } from '#/utils';
|
|
import { GroupSelect } from '#/views/im/manager/group/components';
|
|
import { UserSelect } from '#/views/system/user/components';
|
|
|
|
/** 私聊消息搜索表单 */
|
|
export function usePrivateGridFormSchema(): VbenFormSchema[] {
|
|
return [
|
|
{
|
|
fieldName: 'senderId',
|
|
label: '发送人',
|
|
component: markRaw(UserSelect),
|
|
componentProps: {
|
|
placeholder: '请选择发送人',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'receiverId',
|
|
label: '接收人',
|
|
component: markRaw(UserSelect),
|
|
componentProps: {
|
|
placeholder: '请选择接收人',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'type',
|
|
label: '内容类型',
|
|
component: 'Select',
|
|
componentProps: {
|
|
allowClear: true,
|
|
options: getDictOptions(DICT_TYPE.IM_MESSAGE_TYPE, 'number'),
|
|
placeholder: '请选择内容类型',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'content',
|
|
label: '消息内容',
|
|
component: 'Input',
|
|
componentProps: {
|
|
allowClear: true,
|
|
placeholder: '请输入消息内容',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'sendTime',
|
|
label: '发送时间',
|
|
component: 'RangePicker',
|
|
componentProps: {
|
|
...getRangePickerDefaultProps(),
|
|
allowClear: true,
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
/** 私聊消息字段 */
|
|
export function usePrivateGridColumns(showReadColumns: boolean): VxeTableGridOptions['columns'] {
|
|
return [
|
|
{
|
|
field: 'id',
|
|
title: '编号',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: '发送人',
|
|
minWidth: 160,
|
|
slots: { default: 'sender' },
|
|
},
|
|
{
|
|
title: '接收人',
|
|
minWidth: 160,
|
|
slots: { default: 'receiver' },
|
|
},
|
|
{
|
|
field: 'type',
|
|
title: '类型',
|
|
width: 100,
|
|
cellRender: {
|
|
name: 'CellDict',
|
|
props: { type: DICT_TYPE.IM_MESSAGE_TYPE },
|
|
},
|
|
},
|
|
{
|
|
title: '内容预览',
|
|
minWidth: 260,
|
|
align: 'left',
|
|
slots: { default: 'content' },
|
|
},
|
|
...(showReadColumns
|
|
? [
|
|
{
|
|
field: 'status',
|
|
title: '状态',
|
|
width: 100,
|
|
cellRender: {
|
|
name: 'CellDict',
|
|
props: { type: DICT_TYPE.IM_PRIVATE_MESSAGE_STATUS },
|
|
},
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
field: 'sendTime',
|
|
title: '发送时间',
|
|
minWidth: 180,
|
|
formatter: 'formatDateTime',
|
|
},
|
|
{
|
|
title: '操作',
|
|
width: 100,
|
|
fixed: 'right',
|
|
slots: { default: 'actions' },
|
|
},
|
|
];
|
|
}
|
|
|
|
/** 群聊消息搜索表单 */
|
|
export function useGroupGridFormSchema(): VbenFormSchema[] {
|
|
return [
|
|
{
|
|
fieldName: 'groupId',
|
|
label: '群',
|
|
component: markRaw(GroupSelect),
|
|
},
|
|
{
|
|
fieldName: 'senderId',
|
|
label: '发送人',
|
|
component: markRaw(UserSelect),
|
|
componentProps: {
|
|
placeholder: '请选择发送人',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'type',
|
|
label: '内容类型',
|
|
component: 'Select',
|
|
componentProps: {
|
|
allowClear: true,
|
|
options: getDictOptions(DICT_TYPE.IM_MESSAGE_TYPE, 'number'),
|
|
placeholder: '请选择内容类型',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'content',
|
|
label: '消息内容',
|
|
component: 'Input',
|
|
componentProps: {
|
|
allowClear: true,
|
|
placeholder: '请输入消息内容',
|
|
},
|
|
},
|
|
{
|
|
fieldName: 'sendTime',
|
|
label: '发送时间',
|
|
component: 'RangePicker',
|
|
componentProps: {
|
|
...getRangePickerDefaultProps(),
|
|
allowClear: true,
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
/** 群聊消息字段 */
|
|
export function useGroupGridColumns(showReadColumns: boolean): VxeTableGridOptions['columns'] {
|
|
return [
|
|
{
|
|
field: 'id',
|
|
title: '编号',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: '群',
|
|
minWidth: 160,
|
|
slots: { default: 'group' },
|
|
},
|
|
{
|
|
title: '发送人',
|
|
minWidth: 160,
|
|
slots: { default: 'sender' },
|
|
},
|
|
{
|
|
field: 'type',
|
|
title: '类型',
|
|
width: 100,
|
|
cellRender: {
|
|
name: 'CellDict',
|
|
props: { type: DICT_TYPE.IM_MESSAGE_TYPE },
|
|
},
|
|
},
|
|
{
|
|
title: '@用户',
|
|
minWidth: 180,
|
|
slots: { default: 'atUsers' },
|
|
},
|
|
{
|
|
title: '内容预览',
|
|
minWidth: 260,
|
|
align: 'left',
|
|
slots: { default: 'content' },
|
|
},
|
|
...(showReadColumns
|
|
? [
|
|
{
|
|
field: 'status',
|
|
title: '状态',
|
|
width: 100,
|
|
cellRender: {
|
|
name: 'CellDict',
|
|
props: { type: DICT_TYPE.IM_GROUP_MESSAGE_STATUS },
|
|
},
|
|
},
|
|
{
|
|
field: 'receiptStatus',
|
|
title: '回执',
|
|
width: 110,
|
|
cellRender: {
|
|
name: 'CellDict',
|
|
props: { type: DICT_TYPE.IM_GROUP_MESSAGE_RECEIPT_STATUS },
|
|
},
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
field: 'sendTime',
|
|
title: '发送时间',
|
|
minWidth: 180,
|
|
formatter: 'formatDateTime',
|
|
},
|
|
{
|
|
title: '操作',
|
|
width: 100,
|
|
fixed: 'right',
|
|
slots: { default: 'actions' },
|
|
},
|
|
];
|
|
}
|