Commit 801355f2 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

Merge branch '0518' into 'jinfa-0518'

fix: [25603] 新增请购单中的查看库存,有返回数据但是页面未展示 See merge request project/jinfa-platform!168 (cherry picked from commit a2a4e23f) 5199619a fix: [25603] 新增请购单中的查看库存,有返回数据但是页面未展示
parent f5d1b74f
import React, { useEffect, useRef, useState } from 'react';
import { useIntl } from 'umi'
import { Button, Tabs, Drawer } from 'antd';
import { Button, Drawer, Table } from 'antd';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import TableLayout from './table';
import { fetchOrderApi } from '../../apis';
import { ColumnType } from 'antd/lib/table/interface';
import moment from 'moment';
import { getProductStockGetStock } from '@/services/ProductV2Api';
export interface MemberModalTableProps {
schemaAction?: ISchemaFormActions | ISchemaFormAsyncActions,
......@@ -37,7 +36,7 @@ const ViewInventory: React.FC<MemberModalTableProps> = (props: MemberModalTableP
const { schemaAction, currentRef, confirmModal, productRef, setLik, record } = props;
const ref = useRef<any>({})
const [visible, setVisible] = useState<boolean>(false);
const [dataSource, setDataSource] = useState<any[]>([])
const format = (text, fmt?: string) => {
return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
}
......@@ -151,6 +150,21 @@ const ViewInventory: React.FC<MemberModalTableProps> = (props: MemberModalTableP
},
]
const fetchData = () => {
getProductStockGetStock({ matnr: record?.code || record?.productNo, werks: record?.factory, productGlobalId: record?.globalMQID }).then(res => {
if (res.code !== 1000) {
return
}
setDataSource(res.data)
})
}
useEffect(() => {
if (visible) {
fetchData()
}
}, [visible])
return (
<Drawer
destroyOnClose
......@@ -160,16 +174,12 @@ const ViewInventory: React.FC<MemberModalTableProps> = (props: MemberModalTableP
onClose={() => setVisible(false)}
width={900}
>
<TableLayout
currRef={ref}
customKey='memberId'
effects='name'
<Table
columns={columns}
schema={{}}
dataSource={dataSource}
scroll={{
x: '100vw'
}}
fetchdata={(params) => fetchOrderApi.getProductStock({ ...params, matnr: record?.code || record?.productNo, werks: record?.factory, productGlobalId: record?.globalMQID })}
/>
</Drawer>
)
......
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