Commit 317301fb authored by Bill's avatar Bill

fix: 修改加工单的bug

parent 5402d508
......@@ -93,6 +93,8 @@ const Detail: React.FC<{}> = () => {
const [loading, setLoading] = useState<boolean>(false);
const [deliverAddressOption, setDeliverAddressOption] = useState([]);
const [activeAddress, setActiveAddress] = useState<string | null>(null)
const [activeKey, setActiveKey] = useState<string>("1");
const hasProductNoDelievery = useMemo(() => {
let res = false
if(pathname === `${PENDING_RECEIPT_PATH}/detail`) {
......@@ -140,6 +142,12 @@ const Detail: React.FC<{}> = () => {
}
}, [id]);
useEffect(() => {
if (info?.pnoReceiveDeliverDetailDOList?.length > 0) {
setActiveKey("2");
}
}, [info.pnoReceiveDeliverDetailDOList])
// 确认生产通知单 -> 待提交审核生产通知单时需要同时提交他的发货地址
useEffect(() => {
if(isSetDeliverAddress) {
......@@ -343,6 +351,14 @@ const Detail: React.FC<{}> = () => {
})
}
/**
* tab change
*/
const handleTabChange = (tabKey) => {
console.log(tabKey)
setActiveKey(tabKey);
}
return (
<PageHeaderWrapper
title={
......@@ -444,22 +460,26 @@ const Detail: React.FC<{}> = () => {
{
info && info.outerTaskType !== 29
? <div style={{marginTop: '20px'}}>
<ReceiptDeliveryDetailsCard defaultActiveKey="1">
<StatisticsTab tabKey="1" tab="收发货统计" columns={receiveColumns(info.source === SourceEnum.order ? 'order' : 'product')} dataSource={info.details}></StatisticsTab>
{
info.pnoReceiveDeliverDetailDOList &&
info.pnoReceiveDeliverDetailDOList.length > 0
? <DetailTab
tabKey="2"
tab="收发货明细"
columns={receiptAndDeliveryDetailsColumns}
dataSource={info.pnoReceiveDeliverDetailDOList}
handleConfirm={handleConfirm}
/>
: null
}
</ReceiptDeliveryDetailsCard>
<Card bodyStyle={{padding: '10px 24px 24px 24px'}}>
<Tabs activeKey={activeKey} onChange={handleTabChange}>
<TabPane key="1" tab="收发货统计">
<StatisticsTab columns={receiveColumns(info.source === SourceEnum.order ? 'order' : 'product')} dataSource={info.details}></StatisticsTab>
</TabPane>
{
info.pnoReceiveDeliverDetailDOList &&
info.pnoReceiveDeliverDetailDOList.length > 0
?
<TabPane key="2" tab="收发货明细">
<DetailTab
columns={receiptAndDeliveryDetailsColumns}
dataSource={info.pnoReceiveDeliverDetailDOList}
handleConfirm={handleConfirm}
/>
</TabPane>
: null
}
</Tabs>
</Card>
</div>
: null
}
......
......@@ -258,6 +258,7 @@ const Query: React.FC<{}> = (props) => {
service(params).then(({data, code}) => {
setBatchLoading(false);
if(code === 1000) {
selectRowFns.setSelectedRowKeys([]);
formActions.submit();
}
})
......
......@@ -7,10 +7,10 @@ import { history, Link } from 'umi'
import { ASSIGN_PENDING_RECEIVE_DETAIL, PENDING_DELIVERD_PATH, PENDING_RECEIPT_PATH } from '../../common';
interface Iprops {
tab: string,
// tab: string,
columns: ColumnsType<any>,
dataSource: any[],
tabKey: string,
// tabKey: string,
handleConfirm: (type: string, params: any) => void
}
......@@ -80,8 +80,8 @@ const DetailTab: React.FC<Iprops> = (props) => {
}
const sorted = dataSource && dataSource.sort((a, b) => a.deliveryBatch - b.deliveryBatch ) || []
return (
<div >
<div >
<div>
<div>
<Radio.Group value={activeBatch} onChange={handleOnChange}>
{
sorted.map((item, key) => {
......
import React from 'react';
import { Card, Tabs } from 'antd';
const TabPane = Tabs.TabPane
interface Iprops {
defaultActiveKey: string
};
const ReceiptDeliveryDetailsCard: React.FC<Iprops> = (props) => {
const newChildren = React.Children.map(props.children, (child: any, index) => {
if(child) {
return (
<TabPane tab={child.props.tab} key={child.props.tabKey.toString() || index.toString()}>
{child}
</TabPane>
)
} else {
return null
}
})
console.log(props.defaultActiveKey)
return (
<Card bodyStyle={{padding: '10px 24px 24px 24px'}}>
<Tabs defaultActiveKey={props.defaultActiveKey}>
{newChildren}
</Tabs>
</Card>
)
}
export default ReceiptDeliveryDetailsCard
......@@ -2,12 +2,14 @@ import React from 'react';
import { Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
interface Iprops {
tab: string,
// tab: string,
columns: ColumnsType<any>,
dataSource: any[],
tabKey: string,
// tabKey: string,
}
const StatisticsTab: React.FC<Iprops> = (props) => {
const { columns, dataSource } = props;
return (
......
import ReceiptDeliveryDetailsCard from './ReceiptDeliveryDetailsCard';
// import ReceiptDeliveryDetailsCard from './ReceiptDeliveryDetailsCard';
import DetailTab from './DetailTab';
import StatisticsTab from './StatisticsTab';
export {
ReceiptDeliveryDetailsCard,
// ReceiptDeliveryDetailsCard,
DetailTab,
StatisticsTab
}
\ No newline at end of file
}
......@@ -93,8 +93,8 @@ const Message: React.FC<{}> = () => {
className={styles.customList}
pagination={{
onChange: handlePaginationChange,
pageSize: 10,
size: "small",
pageSize: pagination.pageSize,
showSizeChanger: true,
showQuickJumper: true,
total: dataSource.totalCount,
showTotal: showTotal,
......
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