Commit 6d04b3cf authored by 卢均锐's avatar 卢均锐

fix: [22887] 中标明细增加金额

parent 02bc8edf
import React, { useRef } from 'react';
import React, { useRef, useState, useMemo } from 'react';
import StandardTable from '@/components/StandardTable';
import { priceFormat } from '@/utils/numberFomat';
......@@ -26,6 +26,13 @@ const transforType = {
const TableCommonLayout: React.FC<TableCommonLayoutProps> = (props: any) => {
const { layoutId, layoutTitle, id, number, fetch } = props;
const currentRef = useRef({});
const [tableData, setTableData] = useState<any[]>([]);
const _totalPrice = useMemo(() => {
let _val = 0;
tableData?.forEach((item) => { return _val = _val + item.price});
return _val;
}, [tableData])
const columns = [
{
......@@ -80,19 +87,25 @@ const TableCommonLayout: React.FC<TableCommonLayoutProps> = (props: any) => {
title: intl.formatMessage({ id: 'detail.purchase.taxUnitPrice' }),
key: 'unitPrice',
dataIndex: 'unitPrice',
render: (text: any, record: any) => <Text type='secondary'>{intl.formatMessage({id: 'common.money'})}{priceFormat(text)}</Text>
render: (text: any, record: any) => <Text type='secondary'>{intl.formatMessage({ id: 'common.money' })}{priceFormat(text)}</Text>
},
{
title: intl.formatMessage({ id: 'detail.purchase.taxPrice' }),
title: (
<>
<p>{intl.formatMessage({ id: 'detail.purchase.taxPrice' })}</p>
{_totalPrice && <p>({intl.formatMessage({ id: 'common.money' })}{priceFormat(_totalPrice)})</p>}
</>
),
key: 'price',
dataIndex: 'price',
render: (text: any, record: any) => <Text type='secondary'>{intl.formatMessage({id: 'common.money'})}{priceFormat(text)}</Text>
render: (text: any, record: any) => <Text type='secondary'>{intl.formatMessage({ id: 'common.money' })}{priceFormat(text)}</Text>
},
];
const fetchData = (params: any) => {
return new Promise(resolve => {
fetch && fetch({ id, number, ...params }).then((res: any) => {
setTableData(res.data.data)
resolve(res.data)
})
})
......
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