Commit af6247bc authored by shenshaokai's avatar shenshaokai

Merge branch 'jinfa-0518' of…

Merge branch 'jinfa-0518' of ssh://gitlab.shushangyun.com:8122/project/jinfa-platform into fix-jinfa-0518
parents fcea6aba bff81167
...@@ -65,6 +65,13 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => { ...@@ -65,6 +65,13 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
const secondColumns = () => { const secondColumns = () => {
const alreadyColumns = baseOrderListColumns('orderList.chakan') const alreadyColumns = baseOrderListColumns('orderList.chakan')
if(alreadyColumns) { if(alreadyColumns) {
alreadyColumns.splice(1, 0, {
title: 'SAP订单编号',
dataIndex: 'sapOrderNo',
key: 'sapOrderNo',
ellipsis: true,
width: COLUMNS_ACTION_WIDTH,
})
alreadyColumns.splice(6, 0, { alreadyColumns.splice(6, 0, {
title: intl.formatMessage({id:'purchaseOrder.addressTitle'}), title: intl.formatMessage({id:'purchaseOrder.addressTitle'}),
dataIndex: 'deliverAddress', dataIndex: 'deliverAddress',
......
...@@ -120,10 +120,13 @@ const normalizeMaterialsList = (dataSource: GetContractManagePagePurchaseMaterie ...@@ -120,10 +120,13 @@ const normalizeMaterialsList = (dataSource: GetContractManagePagePurchaseMaterie
ret.push({ ret.push({
...rest, ...rest,
key: `m_${rest.id}`, key: `m_${rest.id}`,
children: requisitionList?.map((requisition, index) => ({ children: requisitionList?.map((requisition, index) => {
...requisition, console.log(requisition.purchaseProductSalesManResponse?.userId, !!requisition.purchaseProductSalesManResponse?.userId)
key: `r_${requisition.detailId}_${requisition.purchaseProductSalesManResponse?.userId || index}_${requisition.purchaseProductSalesManResponse?.rawNO}`, return {
})), ...requisition,
key: `r_${requisition.detailId}_${requisition.purchaseProductSalesManResponse?.userId || index}_${requisition.purchaseProductSalesManResponse?.rawNO}`,
}
}),
}); });
}); });
return ret; return ret;
...@@ -220,6 +223,28 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -220,6 +223,28 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
if (!selected) { } if (!selected) { }
}; };
const defaultMaterialsList = (dataSource: MaterialsListItem[]) => {
console.log(requisitionListValue.current, 'requisitionListValue.current')
const requisitionValue: { [key: string]: string } = {};
dataSource.forEach(({ children }) => {
children.forEach(child => {
requisitionValue[child.key] = requisitionListValue.current[child.key] as string || child?.purchaseProductSalesManResponse?.purchaseRemainingQuantity + ''
})
})
if (Object.keys(requisitionValue).length) {
form.setFieldsValue({
materials: {
requisitionList: requisitionValue,
},
});
requisitionListValue.current = {
...requisitionListValue.current,
...(requisitionValue || {}),
};
}
}
const fetchMaterialsList = async (params: ExtraFetchType) => { const fetchMaterialsList = async (params: ExtraFetchType) => {
if (!contractId) { if (!contractId) {
return { data: [], totalCount: 0 }; return { data: [], totalCount: 0 };
...@@ -243,7 +268,9 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -243,7 +268,9 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
if (initCheckeds.current.length > 0) { if (initCheckeds.current.length > 0) {
handleInitSelectRows(initCheckeds.current, true); handleInitSelectRows(initCheckeds.current, true);
} }
console.log(dataSource, 'dataSource')
defaultMaterialsList(dataSource)
return { return {
data: dataSource, data: dataSource,
totalCount: res.data.totalCount, totalCount: res.data.totalCount,
...@@ -331,16 +358,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -331,16 +358,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
dataIndex: 'materielNo', dataIndex: 'materielNo',
width: 372, width: 372,
render: (text, record, index) => { render: (text, record, index) => {
const max = record.purchaseProductSalesManResponse?.purchaseRemainingQuantity || 0 const max = record.purchaseProductSalesManResponse?.purchaseRemainingQuantity || 0;
if (requisitionListValue && isEmpty(requisitionListValue.current)) { console.log(requisitionListValue.current)
form.setFieldsValue({
materials: {
requisitionList: {
[record.key]: max
},
},
})
}
return ( return (
<div className={styles['member-rights-editable']}> <div className={styles['member-rights-editable']}>
<Form.Item <Form.Item
...@@ -518,11 +537,11 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR ...@@ -518,11 +537,11 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
const item = normalized[i]; const item = normalized[i];
if (item.children && item.children.length) { if (item.children && item.children.length) {
item.children.forEach((child) => { item.children.forEach((child) => {
requisitionValue[child.key] = child.orderQuantity as string; requisitionValue[child.key] = child.orderQuantity as string || child?.purchaseProductSalesManResponse?.purchaseRemainingQuantity + '';
}); });
} }
} }
console.log(dataSource, requisitionValue, 'requisitionValue')
// 没有值的话跳过设置 // 没有值的话跳过设置
if (Object.keys(requisitionValue).length) { if (Object.keys(requisitionValue).length) {
form.setFieldsValue({ form.setFieldsValue({
......
...@@ -114,10 +114,11 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -114,10 +114,11 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => {
const { pageStatus, id, modelType } = usePageStatus() const { pageStatus, id, modelType } = usePageStatus()
const [initFormSchema, setInitFormSchema] = useState<any>(() => ({ ...mergeAllSchemas })) const [initFormSchema, setInitFormSchema] = useState<any>(() => ({ ...mergeAllSchemas }))
const [initFormValue, setInitFormValue] = useState<any>(() => { const [initFormValue, setInitFormValue] = useState<any>(() => {
let resultState = { orderMode: OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER } let resultState = { orderMode: OrderModalType.PURCHASE_REQUISITION_CONTRACT_ORDER, hasInvoice: true }
if (modelType) { if (modelType) {
resultState = { resultState = {
orderMode: parseInt(modelType) orderMode: parseInt(modelType),
hasInvoice: true
} }
} }
return resultState return resultState
...@@ -380,7 +381,6 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -380,7 +381,6 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => {
const productDataValue = addSchemaAction.getFieldValue('products'); const productDataValue = addSchemaAction.getFieldValue('products');
const contractValue = addSchemaAction.getFieldValue('contract'); const contractValue = addSchemaAction.getFieldValue('contract');
let mergeArr = []; let mergeArr = [];
value.forEach((item) => { value.forEach((item) => {
const entity = productDataValue.find((material) => material.id === item.id); const entity = productDataValue.find((material) => material.id === item.id);
if (entity) { if (entity) {
...@@ -392,6 +392,8 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -392,6 +392,8 @@ const PurchaseOrderDetail: React.FC<PurchaseOrderDetailProps> = (props) => {
mergeArr.push({ ...convertOrderMaterialData(item) }); mergeArr.push({ ...convertOrderMaterialData(item) });
} }
}); });
console.log(value, 'value')
console.log(mergeArr, 'mergeArr')
mergeArr = mergeArr.map((item) => ({ mergeArr = mergeArr.map((item) => ({
...item, ...item,
// 兼容之前订单物料数据 // 兼容之前订单物料数据
......
...@@ -35,6 +35,7 @@ export const convertOrderMaterialData = (dataSource: OrderMaterialsConfirmValue[ ...@@ -35,6 +35,7 @@ export const convertOrderMaterialData = (dataSource: OrderMaterialsConfirmValue[
result.push({ result.push({
requisitionId: detailId, requisitionId: detailId,
orderQuantity: (rest as any).orderQuantity || 0, orderQuantity: (rest as any).orderQuantity || 0,
requisitionNo: (rest as any).requisitionNo,
salesManRequests: [{ salesManRequests: [{
...rest.purchaseProductSalesManResponse, ...rest.purchaseProductSalesManResponse,
purchaseOrderQuantity: (rest as any).orderQuantity || 0, purchaseOrderQuantity: (rest as any).orderQuantity || 0,
......
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