Commit 3518b8d4 authored by XieZhiXiong's avatar XieZhiXiong

Merge branch 'v2-220518-order' into 'v2-220518'

fix: 修复采购订单bug See merge request linkseeks-design/pro-platform!663
parents 3471e0cb 35e97df0
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
margin: 0 16px; margin: 0 16px;
height: 48px; height: 48px;
line-height: 48px; line-height: 48px;
border-bottom: 2px solid transparent;
} }
} }
.ant-anchor-link-active { .ant-anchor-link-active {
......
...@@ -119,7 +119,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => { ...@@ -119,7 +119,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
return ( return (
<ModalTable <ModalTable
modalTitle={intl.formatMessage({id: 'purchaseOrder.orderCollect.requisition.button2'})} modalTitle={'选择采购合同'}
columns={contractColumns} columns={contractColumns}
visible={visible} visible={visible}
confirm={handleConfirm} confirm={handleConfirm}
......
...@@ -155,6 +155,15 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -155,6 +155,15 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setTimeout(() => { setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests) addSchemaAction.setFieldValue('products', _orderProductRequests)
addSchemaAction.setFieldValue('contract', {...data.contract}) addSchemaAction.setFieldValue('contract', {...data.contract})
addSchemaAction.setFieldState('products', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
columns: data.orderMode === OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER
? materialColumnsByRequisition
: materialColumns,
prefix: productState.editable && pageStatus === PageStatus.ADD ? materialAddButton : '',
}
})
}, 1000) }, 1000)
setFormLoading(false) setFormLoading(false)
}) })
...@@ -345,7 +354,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -345,7 +354,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
return (<div style={{margin: -24}}> return (<div style={{margin: -24}}>
<FormDetailContext.Provider value={providerValue}> <FormDetailContext.Provider value={providerValue}>
<FormDetailHeader <FormDetailHeader
title={id?intl.formatMessage({id: 'purchaseOrder.edit'}):intl.formatMessage({id: 'purchaseOrder.add'})} title={ `${id ? '编辑' : '新增'}合同采购订单` }
schema={initFormSchema} schema={initFormSchema}
extraRight={[ extraRight={[
<AuthButton btnCode="readyAddSrmOrder.baocun"> <AuthButton btnCode="readyAddSrmOrder.baocun">
......
...@@ -64,18 +64,6 @@ export const useMaterialTable = ( ...@@ -64,18 +64,6 @@ export const useMaterialTable = (
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> tempColumn[7].render = (t, r) => <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.price).toFixed(2)}</span>
// 渲染关联单据
const associatedIndex = tempColumn.findIndex(column => column.title === '关联单据')
if (tempColumn[associatedIndex]) {
tempColumn[associatedIndex].render = (text, record) => (
<Button
type="link"
onClick={() => requisitionRef.current?.show(record.requisitions || [])}
>
关联请购单
</Button>
)
}
} 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[7].render = (t, r) => <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.price).toFixed(2)}</span>
...@@ -84,6 +72,18 @@ export const useMaterialTable = ( ...@@ -84,6 +72,18 @@ export const useMaterialTable = (
tempColumn.pop() tempColumn.pop()
} }
// 渲染关联单据
const associatedIndex = tempColumn.findIndex(column => column.title === '关联单据')
if (tempColumn[associatedIndex]) {
tempColumn[associatedIndex].render = (text, record) => (
<Button
type="link"
onClick={() => requisitionRef.current?.show(record.requisitions || [])}
>
关联请购单
</Button>
)
}
return tempColumn return tempColumn
}) })
const handleShowMaterial = () => { const handleShowMaterial = () => {
......
...@@ -25,42 +25,6 @@ const basicInfo: ISchema = { ...@@ -25,42 +25,6 @@ const basicInfo: ISchema = {
columns: 2, columns: 2,
}, },
properties: { properties: {
orderMode: {
type: 'string',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
enum: [],
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.orderMode'}),
"x-linkages": [
// 联动显示合同编号字段
{
type: 'value:visible',
"target": "contractNo",
"condition": `{{orderCombination.showPurchaseContractField.includes($value)}}`
},
// 联动显示选择合同按钮
{
type: "value:schema",
"target": "contractNo",
condition: `{{!!$value && orderCombination.showPurchaseContractBtn.includes($value)}}`,
schema: {
"x-component-props": {
disabled: true,
addonAfter: "{{orderContract}}"
}
},
otherwise: {
visible: true,
"x-component-props": {
disabled: true,
addonAfter: ""
}
}
},
],
},
digest: { digest: {
type: 'string', type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.digest'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.digest'}),
...@@ -78,7 +42,6 @@ const basicInfo: ISchema = { ...@@ -78,7 +42,6 @@ const basicInfo: ISchema = {
contractNo: { contractNo: {
type: 'string', type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.contractNo'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.contractNo'}),
visible: false,
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
}, },
...@@ -96,16 +59,42 @@ const basicInfo: ISchema = { ...@@ -96,16 +59,42 @@ const basicInfo: ISchema = {
} }
], ],
}, },
orderMode: {
type: 'string',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
enum: [],
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.orderMode'}),
"x-linkages": [
// 联动显示选择合同按钮
{
type: "value:schema",
"target": "contractNo",
condition: `{{!!$value && orderCombination.showPurchaseContractBtn.includes($value)}}`,
schema: {
"x-component-props": {
disabled: true,
addonAfter: "{{orderContract}}"
}
},
otherwise: {
visible: true,
"x-component-props": {
disabled: true,
addonAfter: ""
}
}
},
],
},
vendorMemberName: { vendorMemberName: {
type: 'string', type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.vendorMemberName'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.vendorMemberName'}),
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
}, },
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
}, },
vendorMemberId: { vendorMemberId: {
type: 'string', type: 'string',
...@@ -134,6 +123,7 @@ const basicInfo: ISchema = { ...@@ -134,6 +123,7 @@ const basicInfo: ISchema = {
type: 'string', type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.type'}), title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.type'}),
"x-component": 'text', "x-component": 'text',
visible: false
}, },
createTime: { createTime: {
type: 'string', type: 'string',
...@@ -186,19 +176,11 @@ const paymentInfo: ISchema = { ...@@ -186,19 +176,11 @@ const paymentInfo: ISchema = {
properties: { properties: {
currencyType: { currencyType: {
type: 'string', type: 'string',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
enum: [], enum: [],
title: '币别', title: '币别',
}, },
paymentType: { paymentType: {
type: 'string', type: 'string',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
enum: [], enum: [],
title: '付款方式', title: '付款方式',
}, },
...@@ -207,9 +189,49 @@ const paymentInfo: ISchema = { ...@@ -207,9 +189,49 @@ const paymentInfo: ISchema = {
} }
} }
// 合同下单 订单物料
export const orderMaterials: ISchema = {
"x-index": 2,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.requisition.requisitionMaterial'}),
id: 'orderMaterials',
showTotal: true,
},
properties: {
products: {
type: 'array',
"x-component": 'MultTable',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
"x-component-props": {
// rowKey: 'materialId',
rowKey: 'productId',
columns: "{{materialColumns}}",
components: "{{materialComponents}}",
prefix: "{{materialAddButton}}",
scroll: { x: 1200 },
},
},
// 仅合同下单时备用参数数据
ordeProducts: {
type: 'array',
title: '合同下单记录',
visible: false
},
NO_SUBMIT_SPY: {
type: 'object',
"x-component": "moneyTotalBox"
}
}
}
// 送货信息 // 送货信息
const submitInfo: ISchema = { const submitInfo: ISchema = {
"x-index": 2, "x-index": 3,
type: 'object', type: 'object',
"x-component": 'MellowCard', "x-component": 'MellowCard',
"x-component-props": { "x-component-props": {
...@@ -287,46 +309,6 @@ const submitInfo: ISchema = { ...@@ -287,46 +309,6 @@ const submitInfo: ISchema = {
} }
} }
// 合同下单 订单物料
export const orderMaterials: ISchema = {
"x-index": 3,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.requisition.requisitionMaterial'}),
id: 'orderMaterials',
showTotal: true,
},
properties: {
products: {
type: 'array',
"x-component": 'MultTable',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
"x-component-props": {
// rowKey: 'materialId',
rowKey: 'productId',
columns: "{{materialColumns}}",
components: "{{materialComponents}}",
prefix: "{{materialAddButton}}",
scroll: { x: 1200 },
},
},
// 仅合同下单时备用参数数据
ordeProducts: {
type: 'array',
title: '合同下单记录',
visible: false
},
NO_SUBMIT_SPY: {
type: 'object',
"x-component": "moneyTotalBox"
}
}
}
// 发票信息 // 发票信息
const invoiceInfo: ISchema = { const invoiceInfo: ISchema = {
"x-index": 4, "x-index": 4,
...@@ -456,8 +438,8 @@ export const orderAddSchema: ISchema = { ...@@ -456,8 +438,8 @@ export const orderAddSchema: ISchema = {
properties: { properties: {
basicInfo, basicInfo,
paymentInfo, paymentInfo,
submitInfo,
orderMaterials, orderMaterials,
submitInfo,
invoiceInfo, invoiceInfo,
ortherInfo, ortherInfo,
} }
......
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