diff --git a/packages/app-operation/src/components/Biz/BizContainer.tsx b/packages/app-operation/src/components/Biz/BizContainer.tsx index 837c083..e51553d 100644 --- a/packages/app-operation/src/components/Biz/BizContainer.tsx +++ b/packages/app-operation/src/components/Biz/BizContainer.tsx @@ -16,6 +16,8 @@ import { DealerFormItem, DealerList, PageContainer, + PurchaseOrderFormItem, + PurchaseOrderList, Remark, RemarkFormItem, SmartActionBar, @@ -37,7 +39,7 @@ import { } from '@ant-design/pro-components'; import { Avatar, Button, message, Space, Switch, Tour, TourProps } from 'antd'; import { Dayjs } from 'dayjs'; -import React, { +import { useContext, useEffect, useImperativeHandle, @@ -845,6 +847,30 @@ export default function BizContainer< ); }, }, + purchaseOrder: { + renderFormItem: (_, props) => { + return ( + + ); + }, + render: (purchaseOrderVO: BusinessAPI.PurchaseOrderVO) => { + console.log('purchaseOrderVO', purchaseOrderVO); + return ( + purchaseOrderVO && ( + ( + + {purchaseOrderVO.orderSn} + + )} + /> + ) + ); + }, + }, user: { renderFormItem: (_, props) => { return ; diff --git a/packages/app-operation/src/components/Biz/typing.ts b/packages/app-operation/src/components/Biz/typing.ts index d2b9b9d..20ac284 100644 --- a/packages/app-operation/src/components/Biz/typing.ts +++ b/packages/app-operation/src/components/Biz/typing.ts @@ -20,6 +20,7 @@ export type BizValueType = | 'customField' | 'status' | 'remark' + | 'purchaseOrder' | 'dealer'; export type FormType = 'modal' | 'drawer' | 'step'; export type ModeType = @@ -156,7 +157,7 @@ export interface BizDragProps< ) => React.ReactNode; fieldProps?: DragTableProps; trigger?: () => React.ReactNode; - mode?: ModeType + mode?: ModeType; } export interface BizCalenderProps< diff --git a/packages/app-operation/src/components/Order/OrderCostList.tsx b/packages/app-operation/src/components/Order/OrderCostList.tsx index 9757c74..c8ed331 100644 --- a/packages/app-operation/src/components/Order/OrderCostList.tsx +++ b/packages/app-operation/src/components/Order/OrderCostList.tsx @@ -2,15 +2,24 @@ import { BizContainer, BizValueType, CompanyList, + CostList, ModeType, - PurchaseOrderList, + PurchaseOrderSelect, } from '@/components'; import { business } from '@/services'; -import { useIntl } from '@@/exports'; -import { ProColumns } from '@ant-design/pro-components'; -import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; -import React, { useState } from 'react'; import groupby from '@/utils/groupby'; +import { useIntl } from '@@/exports'; +import { + ProColumns, + ProFormDependency, + ProFormMoney, + ProFormText, +} from '@ant-design/pro-components'; +import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import { ProFormBizSelect } from '@chageable/components'; +import { ProFormBizSelectHandles } from '@chageable/components/src'; +import React, { useRef, useState } from 'react'; +import { Button, Space } from 'antd'; interface IOrderCostListProps { ghost?: boolean; @@ -32,6 +41,7 @@ export default function OrderCostList(props: IOrderCostListProps) { } = props; const intl = useIntl(); const intlPrefix = 'orderCost'; + const costRef = useRef(null); const [activeKey, setActiveKey] = useState('ALL'); @@ -109,17 +119,8 @@ export default function OrderCostList(props: IOrderCostListProps) { { title: intl.formatMessage({ id: intlPrefix + '.column.purchaseOrder' }), dataIndex: 'purchaseOrderVO', - key: 'poOrderSn', - render: (_, record) => { - return ( - {record.purchaseOrderVO.orderSn}} - /> - ); - }, + key: 'orderId', + valueType: 'purchaseOrder', }, { title: intl.formatMessage({ id: intlPrefix + '.column.orderVehicle' }), @@ -186,6 +187,144 @@ export default function OrderCostList(props: IOrderCostListProps) { }, ]; + const formContext = [ + { + const { data } = await business.cost.listCost({ + costListQry: { + type: 'LOGISTICS_TYPE', + }, + }); + + const costGroup = groupby( + data?.filter( + (item) => + item.type === 'LOGISTICS_TYPE' && + item.name !== '主运费' && + item.name !== '短驳费' && + item.name !== '草帘费', + ) || [], + (item) => item.type, + ); + + const options = Object.keys(costGroup).map((key) => ({ + label: intl.formatMessage({ + id: + 'cost.column.type.enum.' + + key + .toLowerCase() + .replace(/_([a-z])/g, (_, char) => char.toUpperCase()), + }), + title: key, + options: costGroup[key].map((item) => ({ + label: item.name, + value: item.costId, + })), + })); + + return options || []; + }} + fieldProps={{ + fetchDataOnSearch: false, + showSearch: true, + autoClearSearchValue: true, + }} + addonAfter={ + costRef.current?.reload()} + /> + } + />, + , + + {({ purchaseOrderVO }, form) => { + form.setFieldsValue({ + principal: purchaseOrderVO?.orderVehicle.driver, + }); + return ( + <> + {purchaseOrderVO && ( + + )} + {purchaseOrderVO && ( + + )} + + ); + }} + , +