2023-02-21 09:57:44 +08:00
|
|
|
/*
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
* name: 数据采集-详情记录页面
|
|
|
|
|
* Description:
|
|
|
|
|
* Date: 2023/2/20
|
|
|
|
|
*/
|
|
|
|
|
import React, { Component } from "react";
|
2025-02-13 13:28:28 +08:00
|
|
|
import { WeaLocaleProvider, WeaSearchGroup, WeaTable } from "ecCom";
|
2023-02-21 09:57:44 +08:00
|
|
|
import { getTableRecordDate } from "../../../apis/cumDeduct";
|
|
|
|
|
import { DataCollectionDateRangePick, DataCollectionSelect, Input } from "../cumDeduct";
|
|
|
|
|
import "./index.less";
|
|
|
|
|
|
2025-02-13 13:28:28 +08:00
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
|
|
2023-02-21 09:57:44 +08:00
|
|
|
class TableRecord extends Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
loading: {
|
|
|
|
|
query: false
|
|
|
|
|
},
|
2023-06-30 10:17:23 +08:00
|
|
|
width: 0,
|
2023-02-21 09:57:44 +08:00
|
|
|
dataSource: [],
|
|
|
|
|
columns: [],
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
|
pageInfo: {
|
|
|
|
|
current: 1, pageSize: 10, total: 0
|
|
|
|
|
},
|
|
|
|
|
recordPayload: {
|
|
|
|
|
accumulatedSpecialAdditionalDeductionId: "",
|
|
|
|
|
otherTaxExemptDeductionId: "",
|
|
|
|
|
accumulatedSituationId: "",
|
|
|
|
|
specialAddDeductionId: "",
|
|
|
|
|
taxAgentId: "",
|
2023-02-21 18:05:54 +08:00
|
|
|
declareMonth: null,
|
|
|
|
|
taxYearMonth: null
|
2023-02-21 09:57:44 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
2023-06-30 10:17:23 +08:00
|
|
|
this.setState({ width: window.innerWidth });
|
2023-02-21 18:05:54 +08:00
|
|
|
this.convertData(this.props);
|
2023-06-30 10:17:23 +08:00
|
|
|
window.addEventListener("resize", this.resizeWidth);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
window.removeEventListener("resize", this.resizeWidth);
|
2023-02-21 09:57:44 +08:00
|
|
|
}
|
|
|
|
|
|
2023-02-21 18:05:54 +08:00
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
|
|
|
this.convertData(nextProps);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-30 10:17:23 +08:00
|
|
|
resizeWidth = (e) => {
|
|
|
|
|
this.setState({ width: e.target.innerWidth });
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-21 18:05:54 +08:00
|
|
|
convertData = (props) => {
|
|
|
|
|
const { recordPayload } = this.state;
|
|
|
|
|
const { record, screenParams } = props;
|
|
|
|
|
const modules = _.reduce(screenParams, (pre, cur) => (_.assign(pre, {
|
|
|
|
|
[cur]: record[cur],
|
|
|
|
|
[screenParams[0]]: record.id
|
|
|
|
|
})), {});
|
|
|
|
|
this.setState({
|
|
|
|
|
recordPayload: {
|
|
|
|
|
...recordPayload,
|
|
|
|
|
...modules
|
2023-03-02 17:23:23 +08:00
|
|
|
},
|
|
|
|
|
pageInfo: {
|
|
|
|
|
current: 1, pageSize: 10, total: 0
|
2023-06-20 14:25:30 +08:00
|
|
|
}
|
2023-02-21 18:05:54 +08:00
|
|
|
}, () => this.getTableRecordData());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getTableRecordData = () => {
|
|
|
|
|
const { loading, pageInfo, recordPayload } = this.state;
|
|
|
|
|
const { url, screenParams } = this.props;
|
|
|
|
|
const monthkey = screenParams[screenParams.length - 1];
|
|
|
|
|
const module = {
|
|
|
|
|
...pageInfo, ...recordPayload, url,
|
|
|
|
|
[monthkey]: Object.prototype.toString.call(recordPayload[monthkey]) === "[object Array]" ? _.compact(recordPayload[monthkey]) : recordPayload[monthkey]
|
|
|
|
|
};
|
2023-02-21 09:57:44 +08:00
|
|
|
this.setState({ loading: { ...loading, query: true } });
|
2023-02-21 18:05:54 +08:00
|
|
|
getTableRecordDate(_.pick(module, [...screenParams, "current", "pageSize", "url"])).then(({ status, data }) => {
|
2023-02-21 09:57:44 +08:00
|
|
|
this.setState({ loading: { ...loading, query: false } });
|
|
|
|
|
if (status) {
|
|
|
|
|
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
|
|
|
|
|
this.setState({
|
2024-10-31 10:22:16 +08:00
|
|
|
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource,
|
|
|
|
|
columns: _.map(columns, (o, i) => {
|
|
|
|
|
let col = {
|
|
|
|
|
...o, width: 110,
|
|
|
|
|
render: text => (<span className="dataAc-ellipsis" title={text}>{text}</span>)
|
|
|
|
|
};
|
|
|
|
|
switch (o.dataIndex) {
|
|
|
|
|
case "taxAgentName":
|
|
|
|
|
col = { ...col, width: 180 };
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
col = { ...col };
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return i === 0 ? { ...col, fixed: "left" } : col;
|
|
|
|
|
})
|
2023-02-21 09:57:44 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
* Description: 详情页面-筛选操作
|
|
|
|
|
* Params:
|
|
|
|
|
* Date: 2023/2/20
|
|
|
|
|
*/
|
|
|
|
|
handleTablerecordScreen = ({ key, value }) => {
|
|
|
|
|
const { recordPayload } = this.state;
|
2023-02-21 18:05:54 +08:00
|
|
|
this.setState({
|
|
|
|
|
recordPayload: {
|
|
|
|
|
...recordPayload,
|
|
|
|
|
[key]: value
|
|
|
|
|
}
|
|
|
|
|
}, () => this.getTableRecordData());
|
|
|
|
|
};
|
|
|
|
|
handleResetSelectKeys = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
|
recordPayload: {
|
|
|
|
|
accumulatedSpecialAdditionalDeductionId: "",
|
|
|
|
|
otherTaxExemptDeductionId: "",
|
|
|
|
|
accumulatedSituationId: "",
|
|
|
|
|
specialAddDeductionId: "",
|
|
|
|
|
taxAgentId: "",
|
|
|
|
|
declareMonth: null,
|
|
|
|
|
taxYearMonth: null
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-02-21 09:57:44 +08:00
|
|
|
};
|
2023-02-21 18:05:54 +08:00
|
|
|
|
2023-02-21 09:57:44 +08:00
|
|
|
render() {
|
2023-02-21 18:05:54 +08:00
|
|
|
const { className, screenParams, taxAgentOption, record } = this.props;
|
2023-06-30 10:17:23 +08:00
|
|
|
const { columns, dataSource, loading, selectedRowKeys, pageInfo, recordPayload, width } = this.state;
|
2023-02-21 09:57:44 +08:00
|
|
|
const rowSelection = {
|
|
|
|
|
selectedRowKeys,
|
|
|
|
|
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys })
|
|
|
|
|
};
|
|
|
|
|
const pagination = {
|
|
|
|
|
...pageInfo,
|
|
|
|
|
showTotal: (total) => `共 ${total} 条`,
|
|
|
|
|
pageSizeOptions: ["10", "20", "50", "100"],
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
onShowSizeChange: (current, pageSize) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
pageInfo: { ...pageInfo, current, pageSize }
|
|
|
|
|
}, () => {
|
|
|
|
|
this.getTableRecordData();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onChange: (current) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
pageInfo: { ...pageInfo, current }
|
|
|
|
|
}, () => {
|
|
|
|
|
this.getTableRecordData();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
2023-02-21 18:05:54 +08:00
|
|
|
const items = screenParams.length === 1 ? [
|
|
|
|
|
{
|
2025-02-13 13:28:28 +08:00
|
|
|
com: Input({ label: getLabel(111, "姓名"), value: record.username })
|
2023-02-21 18:05:54 +08:00
|
|
|
}
|
|
|
|
|
] : [
|
2023-02-21 09:57:44 +08:00
|
|
|
{
|
2025-02-13 13:28:28 +08:00
|
|
|
com: Input({ label: getLabel(111, "姓名"), value: record.username })
|
2023-02-21 09:57:44 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
com: DataCollectionSelect({
|
|
|
|
|
label: "个税扣缴义务人",
|
|
|
|
|
value: !_.isNil(recordPayload.taxAgentId) ? recordPayload.taxAgentId.toString() : "",
|
|
|
|
|
options: [{ key: "", showname: "全部" }, ...taxAgentOption],
|
|
|
|
|
onChange: this.handleTablerecordScreen,
|
|
|
|
|
key: "taxAgentId"
|
|
|
|
|
})
|
2024-10-31 10:22:16 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
com: DataCollectionDateRangePick({
|
|
|
|
|
label: "税款所属期",
|
|
|
|
|
range: recordPayload[screenParams[screenParams.length - 1]] || [],
|
|
|
|
|
onChange: this.handleTablerecordScreen,
|
|
|
|
|
key: screenParams[screenParams.length - 1]
|
|
|
|
|
})
|
2023-02-21 09:57:44 +08:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
return (
|
|
|
|
|
<div className="tableRecordWrapper">
|
2023-02-21 18:05:54 +08:00
|
|
|
{
|
|
|
|
|
!_.isEmpty(screenParams) &&
|
2024-10-31 10:22:16 +08:00
|
|
|
<div className="form-dialog-layout">
|
|
|
|
|
<WeaSearchGroup className={className} showGroup needTigger={false} items={items} col={2}/>
|
|
|
|
|
</div>
|
2023-02-21 18:05:54 +08:00
|
|
|
}
|
2024-10-31 10:22:16 +08:00
|
|
|
<WeaTable rowKey="id" rowSelection={rowSelection} bordered dataSource={dataSource} pagination={pagination}
|
|
|
|
|
loading={loading.query} scroll={{ x: 1200, y: `calc(100vh - 310px)` }} columns={columns}/>
|
2023-02-21 09:57:44 +08:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default TableRecord;
|