import { BizContainer, BizValueType, MaterialList } from '@/components'; import { business } from '@/services'; import { formatParam } from '@/utils/formatParam'; import { useIntl } from '@@/exports'; import { ActionType, ProColumns, ProFormText, ProFormTextArea, } from '@ant-design/pro-components'; import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import { ProFormUploadMaterial } from '@chageable/components'; import { useRef } from 'react'; export default function ChannelList() { const intl = useIntl(); const intlPrefix = 'channel'; const actionRef = useRef(); const formContext = [ , , , { return { logoList: value, logo: value[0], }; }} fieldProps={{ maxCount: 1, actionRef: actionRef, toolBarRender: () => [ actionRef.current?.reload()} />, ], request: async (params, sorter, filter) => { const { data, success, totalCount } = await business.material.pageMaterial({ materialPageQry: formatParam( params, sorter, filter, ), }); return { data: data || [], total: totalCount, success, }; }, }} />, { return { backgroundImageUrlList: value, backgroundImageUrl: value[0], }; }} fieldProps={{ maxCount: 1, actionRef: actionRef, toolBarRender: () => [ actionRef.current?.reload()} />, ], request: async (params, sorter, filter) => { const { data, success, totalCount } = await business.material.pageMaterial({ materialPageQry: formatParam( params, sorter, filter, ), }); return { data: data || [], total: totalCount, success, }; }, }} />, , ]; const columns: ProColumns[] = [ { title: intl.formatMessage({ id: intlPrefix + '.column.logo' }), dataIndex: 'logo', valueType: 'image', hideInSearch: true, }, { title: intl.formatMessage({ id: intlPrefix + '.column.title' }), dataIndex: 'title', }, { title: intl.formatMessage({ id: intlPrefix + '.column.subTitle' }), dataIndex: 'subTitle', hideInSearch: true, }, { title: intl.formatMessage({ id: intlPrefix + '.column.domain' }), dataIndex: 'domain', valueType: 'text', hideInSearch: true, }, { title: intl.formatMessage({ id: intlPrefix + '.column.backgroundImageUrl', }), dataIndex: 'backgroundImageUrl', valueType: 'image', hideInSearch: true, }, { title: intl.formatMessage({ id: intlPrefix + '.column.technicalSupport', }), dataIndex: 'technicalSupport', hideInSearch: true, }, { title: intl.formatMessage({ id: intlPrefix + '.column.createdAt' }), dataIndex: 'createdAt', valueType: 'dateTime', hideInSearch: true, }, ]; const detailColumns: ProDescriptionsItemProps< BusinessAPI.ChannelVO, BizValueType >[] = columns as ProDescriptionsItemProps< BusinessAPI.ChannelVO, BizValueType >[]; return ( rowKey={'channelId'} permission={'operation-channel'} func={business.channel} method={'channel'} methodUpper={'Channel'} intlPrefix={intlPrefix} modeType={'page'} container={{}} page={{ fieldProps: {}, columns, }} create={{ formType: 'drawer', formContext, }} update={{ formType: 'drawer', formContext, // @ts-ignore transform: (value) => { return { ...value, backgroundImageUrlList: [value.backgroundImageUrl], logoList: [value.logo], }; }, }} destroy={{}} detail={{ formType: 'drawer', columns: detailColumns, }} /> ); }