Commit b1794b1a authored by 何洋's avatar 何洋

fix: 采购订单ui调整

parent 88c4cb85
...@@ -43,7 +43,7 @@ const config: any = { ...@@ -43,7 +43,7 @@ const config: any = {
// layout: {}, // layout: {},
esbuild: {}, esbuild: {},
// 打开msfu会导致样式异常, 无法获得正常的样式变量 // 打开msfu会导致样式异常, 无法获得正常的样式变量
mfsu: {}, // mfsu: {},
antd: {}, antd: {},
locale: { locale: {
default: 'zh-CN', default: 'zh-CN',
......
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
'purchaseOrder.orderCollect.schema.hasInvoiceChildren': 'Invoice required', 'purchaseOrder.orderCollect.schema.hasInvoiceChildren': 'Invoice required',
'purchaseOrder.orderCollect.schema.title6': 'Other information', 'purchaseOrder.orderCollect.schema.title6': 'Other information',
'purchaseOrder.orderCollect.schema.pack': 'Packing requirements', 'purchaseOrder.orderCollect.schema.pack': 'Packing requirements',
'purchaseOrder.orderCollect.schema.remark': 'Other requirements', 'purchaseOrder.orderCollect.schema.remark': 'Remark',
'purchaseOrder.orderCollect.schema.contractNo': 'Contract Number', 'purchaseOrder.orderCollect.schema.contractNo': 'Contract Number',
'purchaseOrder.orderCollect.schema.buyerMemberMajorId': 'Purchase Member', 'purchaseOrder.orderCollect.schema.buyerMemberMajorId': 'Purchase Member',
'purchaseOrder.orderCollect.schema.buyerMemberMajorIdPh': 'Please enter the search purchasing member', 'purchaseOrder.orderCollect.schema.buyerMemberMajorIdPh': 'Please enter the search purchasing member',
......
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
'purchaseOrder.orderCollect.schema.hasInvoiceChildren': '청구서 필요', 'purchaseOrder.orderCollect.schema.hasInvoiceChildren': '청구서 필요',
'purchaseOrder.orderCollect.schema.title6': '기타 정보', 'purchaseOrder.orderCollect.schema.title6': '기타 정보',
'purchaseOrder.orderCollect.schema.pack': '포장 요구 사항', 'purchaseOrder.orderCollect.schema.pack': '포장 요구 사항',
'purchaseOrder.orderCollect.schema.remark': '기타 요구 사항', 'purchaseOrder.orderCollect.schema.remark': '비고난',
'purchaseOrder.orderCollect.schema.contractNo': '해당 계약 번호', 'purchaseOrder.orderCollect.schema.contractNo': '해당 계약 번호',
'purchaseOrder.orderCollect.schema.buyerMemberMajorId': '구매 회원', 'purchaseOrder.orderCollect.schema.buyerMemberMajorId': '구매 회원',
'purchaseOrder.orderCollect.schema.buyerMemberMajorIdPh': '구매 회원 검색 입력', 'purchaseOrder.orderCollect.schema.buyerMemberMajorIdPh': '구매 회원 검색 입력',
......
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
'purchaseOrder.orderCollect.schema.hasInvoiceChildren': '需要发票', 'purchaseOrder.orderCollect.schema.hasInvoiceChildren': '需要发票',
'purchaseOrder.orderCollect.schema.title6': '其他信息', 'purchaseOrder.orderCollect.schema.title6': '其他信息',
'purchaseOrder.orderCollect.schema.pack': '包装要求', 'purchaseOrder.orderCollect.schema.pack': '包装要求',
'purchaseOrder.orderCollect.schema.remark': '其他要求', 'purchaseOrder.orderCollect.schema.remark': '备注',
'purchaseOrder.orderCollect.schema.contractNo': '对应合同编号', 'purchaseOrder.orderCollect.schema.contractNo': '对应合同编号',
'purchaseOrder.orderCollect.schema.buyerMemberMajorId': '采购会员', 'purchaseOrder.orderCollect.schema.buyerMemberMajorId': '采购会员',
'purchaseOrder.orderCollect.schema.buyerMemberMajorIdPh': '请输入搜索采购会员', 'purchaseOrder.orderCollect.schema.buyerMemberMajorIdPh': '请输入搜索采购会员',
......
...@@ -98,7 +98,7 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({ ...@@ -98,7 +98,7 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
// input类型 // input类型
case 'input': { case 'input': {
return <Input return <Input
style={{width: 80}} style={{width: 112}}
type='number' type='number'
ref={formItemRef} ref={formItemRef}
onChange={save} onChange={save}
...@@ -110,7 +110,7 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({ ...@@ -110,7 +110,7 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
// select选择类型 // select选择类型
case 'select': { case 'select': {
return <Select return <Select
style={{width: 80}} style={{width: 112}}
ref={formItemRef} ref={formItemRef}
onChange={(value, option) => change(value, option, dataIndex)} onChange={(value, option) => change(value, option, dataIndex)}
id={dataIndex + record.id} id={dataIndex + record.id}
...@@ -134,8 +134,10 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({ ...@@ -134,8 +134,10 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
// 备注input // 备注input
case 'remark': { case 'remark': {
return ( return (
<Input <Input.TextArea
style={{ width: 80 }} style={{ width: 144 }}
rows={1}
placeholder="请输入备注"
ref={formItemRef} ref={formItemRef}
onChange={save} onChange={save}
{...formItemProps} {...formItemProps}
...@@ -170,24 +172,33 @@ const validatorNumber = (rule, value, callback) => { ...@@ -170,24 +172,33 @@ const validatorNumber = (rule, value, callback) => {
style={{ margin: 0 }} style={{ margin: 0 }}
name={dataIndex} name={dataIndex}
initialValue={record[dataIndex] || ''} initialValue={record[dataIndex] || ''}
rules={dataIndex === 'purchaseCount' ? [ rules={(() => {
{ switch (dataIndex) {
required: true, case 'remark': // 备注非必填
message: intl.formatMessage({id: 'purchaseOrder.orderCollect.productTableCell.validator4'}).replaceAll('x', `${title}`), return []
}, case 'purchaseCount':
{ return [
pattern: /^\d+(\.\d{1,3})?$/, {
message: intl.formatMessage({id: 'purchaseOrder.orderCollect.productTableCell.validator2'}), required: true,
}, message: intl.formatMessage({id: 'purchaseOrder.orderCollect.productTableCell.validator4'}).replaceAll('x', `${title}`),
{ },
validator: validatorNumber {
}, pattern: /^\d+(\.\d{1,3})?$/,
] : [ message: intl.formatMessage({id: 'purchaseOrder.orderCollect.productTableCell.validator2'}),
{ },
required: true, {
message: intl.formatMessage({id: 'purchaseOrder.orderCollect.productTableCell.validator4'}).replaceAll('x', `${title}`), validator: validatorNumber
},
]
default:
return [
{
required: true,
message: intl.formatMessage({id: 'purchaseOrder.orderCollect.productTableCell.validator4'}).replaceAll('x', `${title}`),
}
]
} }
]} })()}
> >
{chooseFormItem(formItem, record[dataIndex] || '')} {chooseFormItem(formItem, record[dataIndex] || '')}
</Form.Item> </Form.Item>
......
...@@ -76,6 +76,7 @@ export interface OrderMaterialsDrawerProps { ...@@ -76,6 +76,7 @@ export interface OrderMaterialsDrawerProps {
export interface OrderMaterialsDrawerRef { export interface OrderMaterialsDrawerRef {
deleteItem: (record: PostOrderMaterialData) => void, deleteItem: (record: PostOrderMaterialData) => void,
deleteAll: () => void,
} }
type RequisitionListItem = GetContractManagePagePurchaseMaterielListResponseDetail['requisitionList'][0] & { type RequisitionListItem = GetContractManagePagePurchaseMaterielListResponseDetail['requisitionList'][0] & {
...@@ -390,6 +391,16 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -390,6 +391,16 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
// }); // });
}; };
const handleDeleteAll = () => {
setCheckedKeysState([]);
setHalfCheckedState([]);
form.setFieldsValue({
materials: {
requisitionList: {},
},
});
};
const handleBeforePaginationChange = async () => { const handleBeforePaginationChange = async () => {
try { try {
await form.validateFields() await form.validateFields()
...@@ -413,6 +424,7 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -413,6 +424,7 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
deleteItem: handleDelete, deleteItem: handleDelete,
deleteAll: handleDeleteAll,
})); }));
return ( return (
......
...@@ -2,6 +2,7 @@ import { formatTimeString } from '@/utils' ...@@ -2,6 +2,7 @@ import { formatTimeString } from '@/utils'
import { Row } from 'antd' import { Row } from 'antd'
import { OrderModalType } from '@/constants/order' import { OrderModalType } from '@/constants/order'
import { getIntl } from 'umi' import { getIntl } from 'umi'
import { COLUMNS_ACTION_WIDTH } from '@/constants/table'
// 简单控制价格区间的组件 // 简单控制价格区间的组件
// @todo 后续需要优化, 样式,目录文件等。 // @todo 后续需要优化, 样式,目录文件等。
...@@ -251,46 +252,48 @@ export const contractColumns: any[] = [ ...@@ -251,46 +252,48 @@ export const contractColumns: any[] = [
// 合同下单 物料列表 // 合同下单 物料列表
export const materialInfoColumns: any[] = [ export const materialInfoColumns: any[] = [
{ {
title: 'ID',
dataIndex: 'productId',
className: 'commonHide'
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.code'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.code'}),
dataIndex: 'productNo', dataIndex: 'productNo',
key: 'productNo',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.name1'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.name1'}),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
render: (t, r) => `${t}/${r.spec}` render: (t, r) => `${t}/${r.spec}`,
width: 192,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.category'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.category'}),
dataIndex: 'category', dataIndex: 'category',
key: 'category', key: 'category',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.brand'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.brand'}),
dataIndex: 'brand', dataIndex: 'brand',
key: 'brand', key: 'brand',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.unit'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.unit'}),
dataIndex: 'unit', dataIndex: 'unit',
key: 'unit', key: 'unit',
width: 64,
}, },
{ // {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.relevanceProductId'}), // title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.relevanceProductId'}),
dataIndex: 'relevanceProductId', // dataIndex: 'relevanceProductId',
key: 'relevanceProductId', // key: 'relevanceProductId',
render: (t, r) => t ? `${t}/${r.relevanceProductName || ''}/${r.relevanceProductType || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}` : '' // render: (t, r) => t ? `${t}/${r.relevanceProductName || ''}/${r.relevanceProductType || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}` : ''
}, // },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.price'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.price'}),
dataIndex: 'price', dataIndex: 'price',
align: 'left', align: 'left',
key: 'price', key: 'price',
width: 96,
render: (t) => `${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${t.toFixed(2)}` render: (t) => `${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${t.toFixed(2)}`
}, },
{ {
...@@ -299,24 +302,22 @@ export const materialInfoColumns: any[] = [ ...@@ -299,24 +302,22 @@ export const materialInfoColumns: any[] = [
key: 'quantity', key: 'quantity',
formItem: 'input', formItem: 'input',
editable: true, editable: true,
// width: 80 width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxInclusive'}), title: `${getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxInclusive'})}/${getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxRate'})}`,
dataIndex: 'tax', dataIndex: 'tax',
key: 'tax', key: 'tax',
render: (t, r) => t ? getIntl().formatMessage({id: 'purchaseOrder.yes'}) : getIntl().formatMessage({id: 'purchaseOrder.no'}) width: 96,
}, render: (t, r) => t
{ ? `${getIntl().formatMessage({id: 'purchaseOrder.yes'})}${r.taxRate ? '/' + r.taxRate + '%' : ''}`
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxRate'}), : getIntl().formatMessage({id: 'purchaseOrder.no'})
dataIndex: 'taxRate',
key: 'taxRate',
render: (t, r) => t ? `${t}%` : null
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.readyAddOrder.productInfoColumns.price'}), title: getIntl().formatMessage({id: 'purchaseOrder.readyAddOrder.productInfoColumns.price'}),
dataIndex: 'amount', dataIndex: 'amount',
key: 'amount', key: 'amount',
width: COLUMNS_ACTION_WIDTH,
render: (t, r) => t ? `${Number(t).toFixed(2)}` : null render: (t, r) => t ? `${Number(t).toFixed(2)}` : null
}, },
// 接口调用 // 接口调用
...@@ -324,13 +325,22 @@ export const materialInfoColumns: any[] = [ ...@@ -324,13 +325,22 @@ export const materialInfoColumns: any[] = [
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.logistics'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.logistics'}),
dataIndex: 'logistics', dataIndex: 'logistics',
key: 'logistics', key: 'logistics',
width: COLUMNS_ACTION_WIDTH,
formItem: 'select', formItem: 'select',
editable: true, editable: true,
}, },
{ {
title: 'ID',
dataIndex: 'productId',
key: 'productId',
width: COLUMNS_ACTION_WIDTH,
className: 'commonHide',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.operation'}), title: getIntl().formatMessage({id: 'purchaseOrder.operation'}),
dataIndex: 'ctl', dataIndex: 'ctl',
key: 'ctl', key: 'ctl',
width: 0,
align: 'center', align: 'center',
}, },
] ]
...@@ -338,69 +348,70 @@ export const materialInfoColumns: any[] = [ ...@@ -338,69 +348,70 @@ export const materialInfoColumns: any[] = [
// 合同下单 物料列表(请购单合同情况下) // 合同下单 物料列表(请购单合同情况下)
export const materialInfoColumnsByRequisition: any[] = [ export const materialInfoColumnsByRequisition: any[] = [
{ {
title: 'ID',
dataIndex: 'productId',
className: 'commonHide'
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.code'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.code'}),
dataIndex: 'productNo', dataIndex: 'productNo',
key: 'productNo',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.name1'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.name1'}),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
render: (t, r) => `${t}/${r.spec}` render: (t, r) => `${t}/${r.spec}`,
width: 192,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.category'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.category'}),
dataIndex: 'category', dataIndex: 'category',
key: 'category', key: 'category',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.brand'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.brand'}),
dataIndex: 'brand', dataIndex: 'brand',
key: 'brand', key: 'brand',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.unit'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.unit'}),
dataIndex: 'unit', dataIndex: 'unit',
key: 'unit', key: 'unit',
width: 64,
}, },
{ // {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.relevanceProductId'}), // title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.relevanceProductId'}),
dataIndex: 'relevanceProductId', // dataIndex: 'relevanceProductId',
key: 'relevanceProductId', // key: 'relevanceProductId',
render: (t, r) => t ? `${t}/${r.relevanceProductName || ''}/${r.relevanceProductType || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}` : '' // render: (t, r) => t ? `${t}/${r.relevanceProductName || ''}/${r.relevanceProductType || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}` : ''
}, // },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.price'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.price'}),
dataIndex: 'price', dataIndex: 'price',
align: 'left', align: 'left',
key: 'price', key: 'price',
width: 96,
render: (t) => `${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${t.toFixed(2)}` render: (t) => `${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${t.toFixed(2)}`
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.quantity'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.quantity'}),
dataIndex: 'quantity', dataIndex: 'quantity',
key: 'quantity', key: 'quantity',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxInclusive'}), title: `${getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxInclusive'})}/${getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxRate'})}`,
dataIndex: 'tax', dataIndex: 'tax',
key: 'tax', key: 'tax',
render: (t, r) => t ? getIntl().formatMessage({id: 'purchaseOrder.yes'}) : getIntl().formatMessage({id: 'purchaseOrder.no'}) width: 96,
}, render: (t, r) => t
{ ? `${getIntl().formatMessage({id: 'purchaseOrder.yes'})}${r.taxRate ? '/' + r.taxRate + '%' : ''}`
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.taxRate'}), : getIntl().formatMessage({id: 'purchaseOrder.no'})
dataIndex: 'taxRate',
key: 'taxRate',
render: (t, r) => t ? `${t}%` : null
}, },
{ {
title: getIntl().formatMessage({id: 'purchaseOrder.readyAddOrder.productInfoColumns.price'}), title: getIntl().formatMessage({id: 'purchaseOrder.readyAddOrder.productInfoColumns.price'}),
dataIndex: 'amount', dataIndex: 'amount',
key: 'amount', key: 'amount',
width: COLUMNS_ACTION_WIDTH,
render: (t, r) => t ? `${Number(t).toFixed(2)}` : null render: (t, r) => t ? `${Number(t).toFixed(2)}` : null
}, },
// 接口调用 // 接口调用
...@@ -408,6 +419,7 @@ export const materialInfoColumnsByRequisition: any[] = [ ...@@ -408,6 +419,7 @@ export const materialInfoColumnsByRequisition: any[] = [
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.logistics'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.constant.logistics'}),
dataIndex: 'logistics', dataIndex: 'logistics',
key: 'logistics', key: 'logistics',
width: COLUMNS_ACTION_WIDTH,
formItem: 'select', formItem: 'select',
editable: true, editable: true,
}, },
...@@ -415,12 +427,14 @@ export const materialInfoColumnsByRequisition: any[] = [ ...@@ -415,12 +427,14 @@ export const materialInfoColumnsByRequisition: any[] = [
title: '关联单据', title: '关联单据',
dataIndex: 'relative', dataIndex: 'relative',
key: 'relative', key: 'relative',
width: COLUMNS_ACTION_WIDTH,
}, },
{ {
title: '备注', title: '备注',
dataIndex: 'remark', dataIndex: 'remark',
key: 'remark', key: 'remark',
formItem: 'input', width: 160,
formItem: 'remark',
editable: true, editable: true,
formItemProps: { formItemProps: {
type: 'text', type: 'text',
...@@ -428,9 +442,17 @@ export const materialInfoColumnsByRequisition: any[] = [ ...@@ -428,9 +442,17 @@ export const materialInfoColumnsByRequisition: any[] = [
}, },
}, },
{ {
title: 'ID',
dataIndex: 'productId',
key: 'productId',
width: COLUMNS_ACTION_WIDTH,
className: 'commonHide',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.operation'}), title: getIntl().formatMessage({id: 'purchaseOrder.operation'}),
dataIndex: 'ctl', dataIndex: 'ctl',
key: 'ctl', key: 'ctl',
width: 0,
align: 'center', align: 'center',
}, },
] ]
......
...@@ -129,7 +129,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -129,7 +129,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
} }
// 订单物料 // 订单物料
const { materialAddButton, materialRef, materialColumns, materialComponents, ...surplusProps } = useMaterialTable( const { materialAddButton, materialRef, materialColumns, materialComponents, expandedRowRender, ...surplusProps } = useMaterialTable(
addSchemaAction, addSchemaAction,
addSchemaAction.getFieldValue('orderMode'), addSchemaAction.getFieldValue('orderMode'),
null, null,
...@@ -156,11 +156,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -156,11 +156,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
addSchemaAction.setFieldValue('products', _orderProductRequests) addSchemaAction.setFieldValue('products', _orderProductRequests)
addSchemaAction.setFieldValue('contract', {...data.contract}) addSchemaAction.setFieldValue('contract', {...data.contract})
addSchemaAction.setFieldState('products', productState => { addSchemaAction.setFieldState('products', productState => {
const columns = data.orderMode === OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER
? materialColumnsByRequisition
: materialColumns
productState.props["x-component-props"] = { productState.props["x-component-props"] = {
...productState.props["x-component-props"], ...productState.props["x-component-props"],
columns: data.orderMode === OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER columns,
? materialColumnsByRequisition scroll: { x: columns.reduce((total, current) => total += current.width, 0) },
: materialColumns,
prefix: productState.editable && pageStatus === PageStatus.ADD ? materialAddButton : '', prefix: productState.editable && pageStatus === PageStatus.ADD ? materialAddButton : '',
} }
}) })
...@@ -398,11 +400,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -398,11 +400,13 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
if (productState.value && productState.value.length) { if (productState.value && productState.value.length) {
productState.value = [] // 切换下单模式时,清空“订单物料”原有数据 productState.value = [] // 切换下单模式时,清空“订单物料”原有数据
} }
const columns = value === OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER
? materialColumnsByRequisition
: materialColumns
productState.props["x-component-props"] = { productState.props["x-component-props"] = {
...productState.props["x-component-props"], ...productState.props["x-component-props"],
columns: value === OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER columns,
? materialColumnsByRequisition scroll: { x: columns.reduce((total, current) => total += current.width, 0) },
: materialColumns,
prefix: editable && pageStatus === PageStatus.ADD ? materialAddButton : '', prefix: editable && pageStatus === PageStatus.ADD ? materialAddButton : '',
} }
}) })
...@@ -411,6 +415,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -411,6 +415,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
addSchemaAction.getFieldValue('vendorMemberName') && addSchemaAction.setFieldValue('vendorMemberName', ''); addSchemaAction.getFieldValue('vendorMemberName') && addSchemaAction.setFieldValue('vendorMemberName', '');
addSchemaAction.getFieldValue('vendorMemberId') && addSchemaAction.setFieldValue('vendorMemberId', ''); addSchemaAction.getFieldValue('vendorMemberId') && addSchemaAction.setFieldValue('vendorMemberId', '');
addSchemaAction.getFieldValue('vendorRoleId') && addSchemaAction.setFieldValue('vendorRoleId', ''); addSchemaAction.getFieldValue('vendorRoleId') && addSchemaAction.setFieldValue('vendorRoleId', '');
orderMaterialsDrawerRef.current?.deleteAll();
}) })
// 选择完对应合同 // 选择完对应合同
useContractChange(({ value }) => { useContractChange(({ value }) => {
...@@ -436,6 +441,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -436,6 +441,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
materialColumnsByRequisition, materialColumnsByRequisition,
materialAddButton, materialAddButton,
materialComponents, materialComponents,
expandedRowRender,
orderCombination, orderCombination,
addNewAddress, addNewAddress,
CirculationRecord: <CirculationRecord/>, CirculationRecord: <CirculationRecord/>,
......
...@@ -63,18 +63,21 @@ export const useMaterialTable = ( ...@@ -63,18 +63,21 @@ export const useMaterialTable = (
if (pageStatus === PageStatus.ADD) { if (pageStatus === PageStatus.ADD) {
// 渲染操作 // 渲染操作
tempColumn[tempColumn.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'purchaseOrder.delete'})}</Button> tempColumn[tempColumn.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'purchaseOrder.delete'})}</Button>
// 渲染单价
tempColumn[7].render = (t, r) => <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.price).toFixed(2)}</span>
} else { } else {
// 渲染单价
tempColumn[7].render = (t, r) => <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.price).toFixed(2)}</span>
// tempColumn[tempColumn.length - 1].render = (t, r) => null
tempColumn.pop() tempColumn.pop()
}
// 渲染单价
const priceIndex = tempColumn.findIndex(column => column.dataIndex === 'price')
if (priceIndex) {
tempColumn[priceIndex].render = (text, record) => (
<span>
{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}
{Number(record.price).toFixed(2)}
</span>
)
} }
// 渲染关联单据 // 渲染关联单据
const associatedIndex = tempColumn.findIndex(column => column.title === '关联单据') const associatedIndex = tempColumn.findIndex(column => column.dataIndex === 'relative')
if (tempColumn[associatedIndex]) { if (tempColumn[associatedIndex]) {
tempColumn[associatedIndex].render = (text, record) => ( tempColumn[associatedIndex].render = (text, record) => (
<Button <Button
...@@ -140,6 +143,20 @@ export const useMaterialTable = ( ...@@ -140,6 +143,20 @@ export const useMaterialTable = (
cell: MaterialTableCell cell: MaterialTableCell
} }
} }
const expandedRowRender = record => (
// TODO
<div
style={{
display: 'flex',
alignItems: 'center',
height: 56,
}}
>
{
record.relevanceProductId ? `${record.relevanceProductId}/${record.relevanceProductName || ''}/${record.relevanceProductType || ''}/${record.relevanceProductCategory || ''}/${record.relevanceProductBrand || ''}` : ''
}
</div>
)
const handleSave = row => { const handleSave = row => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -180,6 +197,7 @@ export const useMaterialTable = ( ...@@ -180,6 +197,7 @@ export const useMaterialTable = (
materialAddButton, materialAddButton,
materialColumns: materialMergeColumns, materialColumns: materialMergeColumns,
materialComponents, materialComponents,
expandedRowRender,
visible, visible,
setVisible, setVisible,
rowSelection, rowSelection,
......
...@@ -213,7 +213,10 @@ export const orderMaterials: ISchema = { ...@@ -213,7 +213,10 @@ export const orderMaterials: ISchema = {
columns: "{{materialColumns}}", columns: "{{materialColumns}}",
components: "{{materialComponents}}", components: "{{materialComponents}}",
prefix: "{{materialAddButton}}", prefix: "{{materialAddButton}}",
scroll: { x: 1200 }, scroll: { x: 1400 },
expandable: {
expandedRowRender: "{{expandedRowRender}}",
},
}, },
}, },
// 仅合同下单时备用参数数据 // 仅合同下单时备用参数数据
...@@ -341,7 +344,7 @@ const invoiceInfo: ISchema = { ...@@ -341,7 +344,7 @@ const invoiceInfo: ISchema = {
marginTop: 4, marginTop: 4,
} }
}, },
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.hasInvoice'}), // title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.hasInvoice'}),
default: false, default: false,
"x-linkages": [ "x-linkages": [
{ {
...@@ -401,7 +404,8 @@ const ortherInfo: ISchema = { ...@@ -401,7 +404,8 @@ const ortherInfo: ISchema = {
type: 'string', type: 'string',
"x-component": 'textarea', "x-component": 'textarea',
"x-component-props": { "x-component-props": {
rows: 1 rows: 1,
placeholder: '最长100个字符,50个汉字',
}, },
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.pack'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.pack'}),
"x-rules": [ "x-rules": [
...@@ -415,7 +419,8 @@ const ortherInfo: ISchema = { ...@@ -415,7 +419,8 @@ const ortherInfo: ISchema = {
type: 'string', type: 'string',
"x-component": 'textarea', "x-component": 'textarea',
"x-component-props": { "x-component-props": {
rows: 1 rows: 1,
placeholder: '最长100个字符,50个汉字',
}, },
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.remark'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.remark'}),
"x-rules": [ "x-rules": [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment