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

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

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

Loading…
Cancel
Save