feat: 完成鸽达达后台安全与审计改造
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { FormSchema } from '@/components/Form';
|
||||
import { defRangeShortcuts } from '@/utils/dateUtil';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import { imQueryTenantOptions } from '@/views/imAdminQueryShared';
|
||||
|
||||
const dict = useDictStore();
|
||||
|
||||
export function createMessageSchemas(group: boolean) {
|
||||
const items: FormSchema[] = [
|
||||
{
|
||||
field: 'tenantId',
|
||||
component: 'NSelect',
|
||||
label: '租户',
|
||||
componentProps: {
|
||||
clearable: false,
|
||||
options: computed(() => imQueryTenantOptions.value),
|
||||
placeholder: '请选择租户',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'topic',
|
||||
component: 'NInput',
|
||||
label: group ? '群Topic' : '会话Topic',
|
||||
componentProps: { placeholder: '请输入Topic' },
|
||||
},
|
||||
{
|
||||
field: group ? 'senderUserId' : 'fromUserId',
|
||||
component: 'NInput',
|
||||
label: '发送用户',
|
||||
componentProps: { placeholder: '请输入用户ID' },
|
||||
},
|
||||
];
|
||||
if (!group)
|
||||
items.push({
|
||||
field: 'toUserId',
|
||||
component: 'NInput',
|
||||
label: '接收用户',
|
||||
componentProps: { placeholder: '请输入用户ID' },
|
||||
});
|
||||
items.push(
|
||||
{
|
||||
field: 'contentType',
|
||||
component: 'NSelect',
|
||||
label: '消息类型',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
options: dict.getOption('ImMessageContentTypeOptions'),
|
||||
placeholder: '全部类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
component: 'NSelect',
|
||||
label: '消息状态',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
options: dict.getOption('ImMessageStatusOptions'),
|
||||
placeholder: '全部状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'keyword',
|
||||
component: 'NInput',
|
||||
label: '关键词',
|
||||
componentProps: { placeholder: '请输入内容关键词' },
|
||||
},
|
||||
{
|
||||
field: 'createdAt',
|
||||
component: 'NDatePicker',
|
||||
label: '发送时间',
|
||||
componentProps: { type: 'datetimerange', clearable: true, shortcuts: defRangeShortcuts() },
|
||||
}
|
||||
);
|
||||
return ref(items);
|
||||
}
|
||||
|
||||
export function createMessageColumns(group: boolean) {
|
||||
const columns: any[] = [
|
||||
{ title: '消息序号', key: 'seqId', width: 110 },
|
||||
{
|
||||
title: '发送人',
|
||||
key: 'fromUserId',
|
||||
width: 190,
|
||||
render: (row) =>
|
||||
row.senderNickname
|
||||
? `${row.senderNickname} / ${row.senderUsername || row.fromUserId}`
|
||||
: row.senderUsername || row.fromUserId,
|
||||
},
|
||||
];
|
||||
if (group)
|
||||
columns.push({
|
||||
title: '群名称',
|
||||
key: 'groupName',
|
||||
width: 190,
|
||||
render: (row) =>
|
||||
row.groupName ? `${row.groupName} / ${row.groupNo || row.topic}` : row.topic,
|
||||
});
|
||||
else
|
||||
columns.push({
|
||||
title: '接收人',
|
||||
key: 'toUserId',
|
||||
width: 190,
|
||||
render: (row) =>
|
||||
row.receiverNickname
|
||||
? `${row.receiverNickname} / ${row.receiverUsername || row.toUserId}`
|
||||
: row.receiverUsername || row.toUserId,
|
||||
});
|
||||
columns.push(
|
||||
{
|
||||
title: '类型',
|
||||
key: 'contentType',
|
||||
width: 100,
|
||||
render: (row) =>
|
||||
dict.getLabel('ImMessageContentTypeOptions', row.contentType) || row.contentType,
|
||||
},
|
||||
{ title: '内容', key: 'contentExcerpt', width: 300, ellipsis: { tooltip: true } },
|
||||
{
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
width: 110,
|
||||
render: (row) => dict.getLabel('ImMessageStatusOptions', row.status) || row.status,
|
||||
},
|
||||
{ title: '发送时间', key: 'createdAt', width: 180 }
|
||||
);
|
||||
return columns;
|
||||
}
|
||||
|
||||
export function loadMessageOptions() {
|
||||
dict.loadOptions(['ImMessageContentTypeOptions', 'ImMessageStatusOptions']);
|
||||
}
|
||||
Reference in New Issue
Block a user