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