import React from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTable, WeaTop } from "ecCom";
import { getQueryString } from "../../util/url";
import { sysinfo } from "../../apis/ruleconfig";
import * as API from "../../apis/declare";
import { Button } from "antd";
import "./index.less";
const { getLabel } = WeaLocaleProvider;
@inject("taxAgentStore")
@observer
export default class GenerateDeclarationDetail extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: false, dataSource: [], columns: [], declareInfo: {},
pageInfo: { current: 1, pageSize: 10, total: 0 }, sysinfo: {}
};
}
componentDidMount() {
this.getDetailList();
this.getDeclareInfo();
this.getSysinfo();
}
getSysinfo = () => {
sysinfo().then(({ status, data: sysinfo }) => {
if (status) this.setState({ sysinfo });
});
};
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, width: 180,
render: (text, record) => ( window.pointerXY(e)}
title={text}>{text})
};
}
return {
...item, width: (item.dataIndex === "cardType" || item.dataIndex === "cardNum") ? 180 : 100,
render: (text) => ({text})
};
})
});
}
});
};
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");
};
renderTitle = () => {
const { declareInfo, sysinfo } = this.state;
const title = sysinfo["TAX_DECLARATION_DATE_TYPE"] === "1" ? getLabel(111, "税款所属期") : getLabel(111, "薪资所属月");
return (