2022-07-06 18:11:54 +08:00
|
|
|
|
import React from "react";
|
|
|
|
|
|
import CustomTab from "../../components/customTab";
|
|
|
|
|
|
import { inject, observer } from "mobx-react";
|
|
|
|
|
|
import { getQueryString } from "../../util/url";
|
2023-03-29 14:29:05 +08:00
|
|
|
|
import * as API from "../../apis/declare";
|
|
|
|
|
|
import { Button } from "antd";
|
|
|
|
|
|
import UnifiedTable from "../../components/UnifiedTable";
|
|
|
|
|
|
import "./index.less";
|
2022-03-18 10:38:43 +08:00
|
|
|
|
|
2023-03-29 14:29:05 +08:00
|
|
|
|
@inject("taxAgentStore")
|
2022-04-20 15:28:40 +08:00
|
|
|
|
@observer
|
2022-03-18 10:38:43 +08:00
|
|
|
|
export default class GenerateDeclarationDetail extends React.Component {
|
2022-07-06 18:11:54 +08:00
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
2023-03-29 14:29:05 +08:00
|
|
|
|
this.state = {
|
|
|
|
|
|
loading: false,
|
|
|
|
|
|
dataSource: [],
|
|
|
|
|
|
columns: [],
|
|
|
|
|
|
pageInfo: { current: 1, pageSize: 10, total: 0 },
|
|
|
|
|
|
declareInfo: {}
|
|
|
|
|
|
};
|
2022-07-06 18:11:54 +08:00
|
|
|
|
}
|
2022-04-20 15:28:40 +08:00
|
|
|
|
|
2022-07-06 18:11:54 +08:00
|
|
|
|
componentWillMount() {
|
2023-03-29 14:29:05 +08:00
|
|
|
|
this.getDetailList();
|
|
|
|
|
|
this.getDeclareInfo();
|
2022-07-06 18:11:54 +08:00
|
|
|
|
}
|
2022-06-07 09:08:36 +08:00
|
|
|
|
|
2023-03-29 14:29:05 +08:00
|
|
|
|
getDetailList = () => {
|
|
|
|
|
|
const { pageInfo } = this.state;
|
|
|
|
|
|
const payload = {
|
|
|
|
|
|
...pageInfo, taxDeclarationIdStr: getQueryString("id")
|
|
|
|
|
|
};
|
|
|
|
|
|
this.setState({ loading: true });
|
|
|
|
|
|
API.getDetailList(payload).then(({ status, data }) => {
|
|
|
|
|
|
this.setState({ loading: false });
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
dataSource,
|
|
|
|
|
|
pageInfo: {
|
|
|
|
|
|
...pageInfo,
|
|
|
|
|
|
current, pageSize, total
|
|
|
|
|
|
},
|
|
|
|
|
|
columns: _.map(_.filter(columns, it => it.dataIndex !== "jobNum"), item => {
|
|
|
|
|
|
if (item.dataIndex === "username") {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
|
return <a className="ellipsis"
|
|
|
|
|
|
href={`javaScript:openhrm(${record.employeeId});`}
|
|
|
|
|
|
onClick={e => window.pointerXY(e)}
|
|
|
|
|
|
title={text}
|
|
|
|
|
|
>
|
|
|
|
|
|
{text}
|
|
|
|
|
|
</a>;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
render: (text) => {
|
|
|
|
|
|
return <span className="ellipsis" title={text}>{text}</span>;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
})
|
|
|
|
|
|
});
|
2022-07-06 18:11:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2023-03-29 14:29:05 +08:00
|
|
|
|
};
|
|
|
|
|
|
getDeclareInfo = () => {
|
|
|
|
|
|
API.getDeclareInfo({ taxDeclarationId: getQueryString("id") }).then(({ status, data: declareInfo }) => {
|
|
|
|
|
|
if (status) this.setState({ declareInfo });
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
// 导出
|
|
|
|
|
|
handleExport = () => {
|
|
|
|
|
|
const url = `${window.location.origin}/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=${getQueryString("id")}`;
|
|
|
|
|
|
window.open(url, "_self");
|
|
|
|
|
|
};
|
2022-06-07 09:08:36 +08:00
|
|
|
|
|
2022-07-06 18:11:54 +08:00
|
|
|
|
render() {
|
2023-03-29 14:29:05 +08:00
|
|
|
|
const { declareInfo, loading, pageInfo, columns, dataSource } = this.state;
|
|
|
|
|
|
const { taxAgentStore: { showOperateBtn } } = this.props;
|
2022-06-07 09:08:36 +08:00
|
|
|
|
|
2022-07-06 18:11:54 +08:00
|
|
|
|
const renderRightOperation = () => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div style={{ display: "inline-block" }}>
|
2023-03-29 14:29:05 +08:00
|
|
|
|
<Button type="primary" onClick={this.handleExport}>导出</Button>
|
2022-07-06 18:11:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
const renderLeftOperation = () => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div style={{ display: "inline-block", lineHeight: "47px" }}>
|
2023-03-08 17:39:40 +08:00
|
|
|
|
<span>薪资所属月:{declareInfo.salaryMonth}</span>
|
2022-07-06 18:11:54 +08:00
|
|
|
|
<span style={{ marginLeft: "10px" }}>个税扣缴义务人:{declareInfo.taxAgentName}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
2023-03-29 14:29:05 +08:00
|
|
|
|
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.getDetailList());
|
|
|
|
|
|
},
|
|
|
|
|
|
onChange: (current) => {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
pageInfo: { ...pageInfo, current }
|
|
|
|
|
|
}, () => this.getDetailList());
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2022-07-06 18:11:54 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<div className="generateDeclarationDetail">
|
|
|
|
|
|
<CustomTab
|
2023-03-29 14:29:05 +08:00
|
|
|
|
searchOperationItem={showOperateBtn && renderRightOperation()}
|
|
|
|
|
|
leftOperation={renderLeftOperation()}
|
2022-07-06 18:11:54 +08:00
|
|
|
|
/>
|
|
|
|
|
|
<div className="tableWrapper">
|
2023-03-29 14:29:05 +08:00
|
|
|
|
<UnifiedTable
|
|
|
|
|
|
rowKey="id"
|
|
|
|
|
|
columns={columns}
|
|
|
|
|
|
dataSource={dataSource}
|
|
|
|
|
|
pagination={pagination}
|
|
|
|
|
|
loading={loading}
|
|
|
|
|
|
xWidth={columns.length * 120}
|
2022-07-06 18:11:54 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2022-09-29 15:45:23 +08:00
|
|
|
|
}
|