Commit 317301fb authored by Bill's avatar Bill

fix: 修改加工单的bug

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