| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 { z } from '#/adapter/form'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { ChannelSelect } from '#/views/im/manager/channel/list/components'; |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'channelId', |
| | | label: 'æå±é¢é', |
| | | component: markRaw(ChannelSelect), |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'å
容类å', |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.IM_CHANNEL_MATERIAL_TYPE, 'number'), |
| | | buttonStyle: 'solid', |
| | | optionType: 'button', |
| | | }, |
| | | rules: z.number().default(1), |
| | | }, |
| | | { |
| | | fieldName: 'title', |
| | | label: 'æ é¢', |
| | | component: 'Input', |
| | | componentProps: { |
| | | maxlength: 128, |
| | | placeholder: '请è¾å
¥æ é¢', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'coverUrl', |
| | | label: 'å°é¢å¾', |
| | | component: 'ImageUpload', |
| | | componentProps: { |
| | | maxNumber: 1, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'summary', |
| | | label: 'æè¦', |
| | | component: 'Textarea', |
| | | componentProps: { |
| | | maxlength: 255, |
| | | placeholder: '请è¾å
¥æè¦', |
| | | rows: 2, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'content', |
| | | label: 'æ£æ', |
| | | component: 'RichTextarea', |
| | | dependencies: { |
| | | triggerFields: ['type'], |
| | | show: (values) => values.type === 1, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'url', |
| | | label: 'è·³è½¬é¾æ¥', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: 'https://example.com/...', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['type'], |
| | | show: (values) => values.type !== 1, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'channelId', |
| | | label: 'é¢é', |
| | | component: markRaw(ChannelSelect), |
| | | componentProps: { |
| | | placeholder: 'å
¨é¨', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'title', |
| | | label: 'æ é¢', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: 'æ é¢å
³é®å', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions['columns'] { |
| | | return [ |
| | | { |
| | | field: 'id', |
| | | title: 'ç¼å·', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'coverUrl', |
| | | title: 'å°é¢', |
| | | width: 80, |
| | | slots: { default: 'cover' }, |
| | | }, |
| | | { |
| | | field: 'channelName', |
| | | title: 'é¢é', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'type', |
| | | title: 'å
容类å', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.IM_CHANNEL_MATERIAL_TYPE }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'title', |
| | | title: 'æ é¢', |
| | | minWidth: 180, |
| | | }, |
| | | { |
| | | field: 'summary', |
| | | title: 'æè¦', |
| | | minWidth: 180, |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'å建æ¶é´', |
| | | minWidth: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** é¢éæ¶æ¯æç´¢è¡¨å */ |
| | | export function useMessageGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'channelId', |
| | | label: 'é¢é', |
| | | component: markRaw(ChannelSelect), |
| | | componentProps: { |
| | | placeholder: 'å
¨é¨', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sendTime', |
| | | label: 'åéæ¶é´', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** é¢éæ¶æ¯å段 */ |
| | | export function useMessageGridColumns(): VxeTableGridOptions['columns'] { |
| | | return [ |
| | | { |
| | | field: 'id', |
| | | title: 'ç¼å·', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'materialCoverUrl', |
| | | title: 'å°é¢', |
| | | width: 80, |
| | | slots: { default: 'cover' }, |
| | | }, |
| | | { |
| | | field: 'channelName', |
| | | title: 'é¢é', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'materialTitle', |
| | | title: 'ç´ ææ é¢', |
| | | minWidth: 180, |
| | | }, |
| | | { |
| | | field: 'receiverUserIds', |
| | | title: 'æ¥æ¶äºº', |
| | | width: 120, |
| | | slots: { default: 'receivers' }, |
| | | }, |
| | | { |
| | | field: 'sendTime', |
| | | title: 'åéæ¶é´', |
| | | minWidth: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 100, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |