| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '#/packages/constants/src'; |
| | | import { getDictOptions } from '#/packages/effects/hooks/src'; |
| | | |
| | | 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_CONTENT_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_CONTENT_TYPE }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'å
容é¢è§', |
| | | minWidth: 260, |
| | | align: 'left', |
| | | slots: { default: 'content' }, |
| | | }, |
| | | ...(showReadColumns |
| | | ? [ |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.IM_MESSAGE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'receiptStatus', |
| | | title: 'åæ§', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | // åæ§ç¶æï¼ç§è / 群èå
±ç¨ im_message_receipt_statusï¼ï¼ä¸æºç«¯ãåæ§ãåå¯¹é½ |
| | | props: { type: DICT_TYPE.IM_MESSAGE_RECEIPT_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_CONTENT_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_CONTENT_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_MESSAGE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'receiptStatus', |
| | | title: 'åæ§', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.IM_MESSAGE_RECEIPT_STATUS }, |
| | | }, |
| | | }, |
| | | ] |
| | | : []), |
| | | { |
| | | field: 'sendTime', |
| | | title: 'åéæ¶é´', |
| | | minWidth: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 100, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |