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 @@
margin: 0 16px;
height: 48px;
line-height: 48px;
border-bottom: 2px solid transparent;
}
}
.ant-anchor-link-active {
......
......@@ -119,7 +119,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
return (
<ModalTable
modalTitle={intl.formatMessage({id: 'purchaseOrder.orderCollect.requisition.button2'})}
modalTitle={'选择采购合同'}
columns={contractColumns}
visible={visible}
confirm={handleConfirm}
......
......@@ -155,6 +155,15 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests)
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)
setFormLoading(false)
})
......@@ -345,7 +354,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
return (<div style={{margin: -24}}>
<FormDetailContext.Provider value={providerValue}>
<FormDetailHeader
title={id?intl.formatMessage({id: 'purchaseOrder.edit'}):intl.formatMessage({id: 'purchaseOrder.add'})}
title={ `${id ? '编辑' : '新增'}合同采购订单` }
schema={initFormSchema}
extraRight={[
<AuthButton btnCode="readyAddSrmOrder.baocun">
......
......@@ -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[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 {
// 渲染单价
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 = (
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
})
const handleShowMaterial = () => {
......
......@@ -25,42 +25,6 @@ const basicInfo: ISchema = {
columns: 2,
},
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: {
type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.digest'}),
......@@ -78,7 +42,6 @@ const basicInfo: ISchema = {
contractNo: {
type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.contractNo'}),
visible: false,
"x-component-props": {
disabled: true,
},
......@@ -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: {
type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.vendorMemberName'}),
"x-component-props": {
disabled: true,
},
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
},
vendorMemberId: {
type: 'string',
......@@ -134,6 +123,7 @@ const basicInfo: ISchema = {
type: 'string',
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.schema.type'}),
"x-component": 'text',
visible: false
},
createTime: {
type: 'string',
......@@ -186,19 +176,11 @@ const paymentInfo: ISchema = {
properties: {
currencyType: {
type: 'string',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
enum: [],
title: '币别',
},
paymentType: {
type: 'string',
'x-rules': [{
required: true,
message: getIntl().formatMessage({id: 'common.bitian'}),
}],
enum: [],
title: '付款方式',
},
......@@ -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 = {
"x-index": 2,
"x-index": 3,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
......@@ -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 = {
"x-index": 4,
......@@ -456,8 +438,8 @@ export const orderAddSchema: ISchema = {
properties: {
basicInfo,
paymentInfo,
submitInfo,
orderMaterials,
submitInfo,
invoiceInfo,
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