Commit 9989de66 authored by 陈智峰's avatar 陈智峰

fix: 采购数量在关联订单回显问题

parent a0591ee6
......@@ -9,7 +9,7 @@
"start:dev": "cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev",
"start:analyze": "ANALYZE=1 umi dev",
"clean": "rimraf node_modules",
"start": "yarn api && yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=8192 UMI_ENV=local umi dev",
"start": "yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=8192 UMI_ENV=local umi dev",
"start-noApi": "yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=8192 UMI_ENV=local umi dev",
"start-fast": "cross-env NODE_OPTIONS=--max_old_space_size=8192 UMI_ENV=local umi dev",
"build": "yarn && yarn api && yarn scripts:build && yarn build:clean",
......@@ -27,8 +27,7 @@
"start:jinfa-0518": "cross-env PRO_ENV=jinfa-0518 yarn start",
"start-noApi:jinfa-221102": "cross-env PRO_ENV=jinfa-1102 yarn start-noApi",
"start-fast:jinfa-221102": "cross-env PRO_ENV=jinfa-1102 yarn start-fast",
"start:jinfa-221102": "cross-env PRO_ENV=jinfa-1102 yarn start",
"fstart":"umi dev"
"start:jinfa-221102": "cross-env PRO_ENV=jinfa-1102 yarn start"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
......
......@@ -477,8 +477,32 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => {
mergeArr.push({
...convertOrderMaterialData(item),
...entity, //原来数据优先
//以下是需要更新的
quantity: item.requisitionList?.reduce((pre, now) => Number(Number((now as any).orderQuantity + pre).toFixed(3)), 0) || 0,
requisitions: (() => {
const result = []
item.requisitionList?.forEach(({ detailId, ...rest }) => {
const existedRequisition = result.find(requisition => requisition.requisitionId === detailId)
if (existedRequisition) {
existedRequisition.orderQuantity += (rest as any).orderQuantity || 0
existedRequisition.salesManRequests.push({
...rest.purchaseProductSalesManResponse,
purchaseOrderQuantity: (rest as any).orderQuantity || 0,
})
} else {
result.push({
requisitionId: detailId,
orderQuantity: (rest as any).orderQuantity || 0,
requisitionNo: (rest as any).requisitionNo,
salesManRequests: [{
...rest.purchaseProductSalesManResponse,
purchaseOrderQuantity: (rest as any).orderQuantity || 0,
}]
})
}
})
return result
})(),
});
} else {
mergeArr.push({ ...convertOrderMaterialData(item) });
......
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