import { BizContainer, BizValueType, CompanyPaymentAccountList, ModeType, ProFormUploadMaterial, } from '@/components'; import { business } from '@/services'; import { useIntl } from '@@/exports'; import { ProColumns, ProFormText } from '@ant-design/pro-components'; import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import React from 'react'; interface ICompanyListProps { ghost?: boolean; companyId?: BusinessAPI.CompanyVO['companyId']; search?: boolean; onValueChange?: () => void; mode?: ModeType; trigger?: () => React.ReactNode; } export default function CompanyList(props: ICompanyListProps) { const { ghost = false, companyId, search = true, mode = 'page', trigger, onValueChange, } = props; const intl = useIntl(); const intlPrefix = 'company'; const columns: ProColumns[] = [ { title: intl.formatMessage({ id: intlPrefix + '.column.logo' }), dataIndex: 'logo', key: 'logo', valueType: 'image', search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.shortName' }), dataIndex: 'shortName', key: 'shortName', renderText: (text: string) => {text}, }, { title: intl.formatMessage({ id: intlPrefix + '.column.fullName' }), dataIndex: 'fullName', key: 'fullName', renderText: (text: string) => {text}, }, { title: intl.formatMessage({ id: intlPrefix + '.column.taxNumber' }), dataIndex: 'taxNumber', key: 'taxNumber', valueType: 'text', }, { title: intl.formatMessage({ id: intlPrefix + '.column.contactPerson' }), dataIndex: 'contactPerson', key: 'contactPerson', valueType: 'text', search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.contactPhone' }), dataIndex: 'contactPhone', key: 'contactPhone', valueType: 'text', search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.address' }), dataIndex: 'address', key: 'address', valueType: 'text', search: false, }, ]; const formContext = [ { console.log('transform', value); return { logoList: value, logo: value[0], }; }} fieldProps={{ maxCount: 1, }} />, , , , , , , ]; const detailColumns: ProDescriptionsItemProps< BusinessAPI.CompanyVO, BizValueType >[] = columns as ProDescriptionsItemProps< BusinessAPI.CompanyVO, BizValueType >[]; const detailContext = ( companyVO: BusinessAPI.CompanyVO, onValueChange: () => void, ) => { return [ { label: `付款账户`, key: 'companyPaymentAccountList', children: ( ), }, ]; }; return ( rowKey={'companyId'} permission={'operation-company'} func={business.company} method={'company'} methodUpper={'Company'} intlPrefix={intlPrefix} modeType={mode} onValueChange={onValueChange} container={{ ghost, }} remark={{ mode: 'editor', }} status page={{ fieldProps: { bordered: true, ghost, //@ts-ignore search, }, columns, }} create={{ formType: 'drawer', formContext, initValues: { status: true, }, }} update={{ formType: 'drawer', formContext, }} destroy={{}} detail={{ rowId: companyId, formType: 'drawer', columns: detailColumns, formContext: detailContext, trigger, }} /> ); }