release/2.19.1.2503.01-业务线个税
黎永顺 1 year ago
parent 58152f0528
commit 4380ebb8e8

@ -15,6 +15,7 @@ interface OwnProps {
columns: ColumnType<any>[];
dataSourceUrl: string;
payload: any;
sumRow: Partial<{}>;
}
type Props = OwnProps;
@ -37,15 +38,17 @@ const calcFixedTotal: FunctionComponent<Props> = (props) => {
return API.CalculateService.getAcctResultsum(props.dataSourceUrl, payload);
}, [props.dataSourceUrl]);
useEffect(() => {
if (!_.isEmpty(props.payload)) {
if (!_.isEmpty(props.payload) && !props.sumRow) {
setLoading(true);
dataSourceUrl(props.payload).then(({ data }) => {
setLoading(false);
const { data: result, status } = data;
if (status) setSumRow(result.sumRow || {});
});
} else {
setSumRow(props.sumRow);
}
}, [props.payload]);
}, [props.payload, props.sumRow]);
return (<>
{
_.map(columns, (item: any, index) => {

@ -35,6 +35,7 @@ const index: FunctionComponent<Props> = (props) => {
const [tableScrollHeight, setTableScrollHeight] = useState<Number>(0);
const [payload, setPayload] = useState<string>("");
const [fixed, setFixed] = useState<fixedProps>(true);
const [sumRow, setSumRow] = useState<Partial<{}>>({});//总计行数据
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
@ -49,7 +50,7 @@ const index: FunctionComponent<Props> = (props) => {
const {
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {},
showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail,
fixed = true, tableScrollHeight
fixed = true, tableScrollHeight, sumRow
} = data;
setSumRowlistUrl(sumRowlistUrl);
setShowTotalCell(showTotalCell);
@ -57,6 +58,7 @@ const index: FunctionComponent<Props> = (props) => {
setI18n(i18nRes);
setPayload(payload);
setFixed(fixed);
setSumRow(sumRow);
setPageInfo(pageInfo);
setDataSource(dataSource);
setSelectedRowKeys(selectedRowKeys);
@ -140,16 +142,16 @@ const index: FunctionComponent<Props> = (props) => {
scroll={{ x: 1200, y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)` }}
columns={!isDetailTable ? columns : _.filter(columns, o => o.dataIndex !== "operate")}
footer={() => !isDetailTable ? <CalcExplainFooter i18n={i18n}/> : null}
pagination={{
pagination={!_.isNil(pageInfo) ? {
...paginationFun(pageInfo, sizeChange, onChange, i18n),
size: "default"
}}
} : false}
summary={() => (
!showTotalCell ? <></> :
<Table.Summary fixed={fixed}>
<Table.Summary.Row>
<Table.Summary.Cell index={0} align="center"><Text type="danger">{i18n["总计"]}</Text></Table.Summary.Cell>
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload}/>
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload} sumRow={sumRow}/>
</Table.Summary.Row>
</Table.Summary>
)}

Loading…
Cancel
Save