import { BizContainer, BizValueType, CostItemList, ModeType, ProFormBizSelect, ProFormBizSelectHandles, } from '@/components'; import { business } from '@/services'; import groupby from '@/utils/groupby'; import { useIntl } from '@@/exports'; import { ProColumns, ProFormDependency, ProFormMoney, ProFormRadio, ProFormSelect, ProFormText, } from '@ant-design/pro-components'; import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import React, { useRef, useState } from 'react'; interface ICostListProps { ghost?: boolean; costId?: BusinessAPI.CostVO['costId']; search?: boolean; onValueChange?: () => void; mode?: ModeType; trigger?: () => React.ReactNode; } export default function CostList(props: ICostListProps) { const { ghost = false, costId, search = true, mode = 'drag', trigger, onValueChange, } = props; const intl = useIntl(); const intlPrefix = 'cost'; const [type, setType] = useState('MATERIAL_TYPE'); const costRef = useRef(null); const columns: ProColumns[] = [ { title: intl.formatMessage({ id: intlPrefix + '.column.name' }), dataIndex: 'name', key: 'name', renderText: (text: string) => {text}, }, { title: intl.formatMessage({ id: intlPrefix + '.column.unit' }), dataIndex: 'unit', key: 'unit', search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.price' }), dataIndex: 'price', key: 'price', valueType: 'money', search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.type' }), dataIndex: 'type', key: 'type', valueType: 'select', valueEnum: { MATERIAL_TYPE: intl.formatMessage({ id: intlPrefix + '.column.type.enum.materialType', }), ARTIFICIAL_TYPE: intl.formatMessage({ id: intlPrefix + '.column.type.enum.artificialType', }), PRODUCTION_TYPE: intl.formatMessage({ id: intlPrefix + '.column.type.enum.productionType', }), OTHER_TYPE: intl.formatMessage({ id: intlPrefix + '.column.type.enum.otherType', }), LOGISTICS_TYPE: intl.formatMessage({ id: intlPrefix + '.column.type.enum.logisticsType', }), }, search: false, }, { title: intl.formatMessage({ id: intlPrefix + '.column.belong' }), dataIndex: 'belong', key: 'belong', valueType: 'select', valueEnum: { NONE_TYPE: intl.formatMessage({ id: intlPrefix + '.column.belong.enum.noneType', }), WORKER_TYPE: intl.formatMessage({ id: intlPrefix + '.column.belong.enum.workerType', }), PRODUCTION_TYPE: intl.formatMessage({ id: intlPrefix + '.column.belong.enum.productionType', }), DRIVER_TYPE: intl.formatMessage({ id: intlPrefix + '.form.belong.enum.driverType', }), }, }, { title: intl.formatMessage({ id: intlPrefix + '.column.costItemIds', }), dataIndex: 'constItemVOList', key: 'costItemIds', valueType: 'text', render: (_, record) => (
{record.costItemVOList?.map((item) => item.name).join(',')}
), search: false, hidden: type === 'PRODUCTION_TYPE' || type === 'OTHER_TYPE' || type === 'LOGISTICS_TYPE', }, ]; const formContext = [