import React from "react"; import { inject, observer } from "mobx-react"; import { Dropdown, Menu, message, Tag } from "antd"; import moment from "moment"; import CustomPaginationTable from "../../components/customPaginationTable"; import "../calculate/index.less"; @inject("payrollStore", "taxAgentStore") @observer export default class SalarySendList extends React.Component { constructor(props) { super(props); this.searchParams = { salaryYearMonth: this.props.salaryYearMonth }; this.pageInfo = { current: 1, pageSize: 10 }; } componentDidMount() { const { payrollStore: { getPayrollList } } = this.props; getPayrollList(this.searchParams); } // 发放回调 handleGrant(record) { window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollGrant?id=${record.id}&ackFeedbackStatus=${record.ackFeedbackStatus}`); } // 查看详情 handleShowDetail(record) { window.open( "/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollDetail?id=" + record.id ); } // 更新模板 handleUpdateTemplate = (record) => { let templateRecord = {}; templateRecord.id = record.templateId; if (!record.templateId) { message.warning("请设置默认模板"); return; } this.props.onEditTemplate && this.props.onEditTemplate(templateRecord); }; // 获取表头数据 getColumns = () => { const { payrollStore: { salarySendTableStore }, taxAgentStore: { showOperateBtn } } = this.props; const { columns } = salarySendTableStore; if (!columns) return []; let result = columns.filter(item => (item.hide === "false" && item.dataIndex !== "acctTimes")); result.map(item => { if (item.dataIndex === "salaryYearMonth") { item.render = (text, record) => { return ( {moment(parseInt(text)).format("YYYY-MM")} ); }; } else if (item.dataIndex === "lastSendTime") { item.render = (text, record) => { return ( {moment(parseInt(text)).format("YYYY-MM-DD HH:mm:ss")} ); }; } else if (item.dataIndex === "salarySob") { item.width = 300; item.render = (text, record) => { return
{text}
{ record.salaryAcctType === 1 && 补发 } {`第${record.acctTimes}次`}
; }; } }); showOperateBtn ? (result = result.concat([ { title: "操作", key: "operate", width: 150, render: (text, record) => { const { sendNum, sendTotal, salaryAcctType, haveBackCalc, canSeeDetail } = record; //显示发放 const showGrant = haveBackCalc === 1 && salaryAcctType === 0; return ( this.handleGrant(record)} style={{ marginRight: 10 }}>发放 { canSeeDetail && this.handleShowDetail(record)} style={{ marginRight: 10 }}>查看详情 } { sendNum !== sendTotal && !showGrant && this.handleUpdateTemplate(record)}> 更新模板 }> } ); } } ])) : (result = result.concat([ { title: "操作", key: "operate", render: (text, record) => { const { salaryAcctType } = record; return ( { salaryAcctType === 0 && this.handleShowDetail(record)}>查看详情 } ); } } ])); return result; }; render() { const { payrollStore } = this.props; const { salarySendDataSource, pageInfo, loading } = payrollStore; return (
{ this.pageInfo.current = value; this.props.handleListDataPageChange(value, this.pageInfo); }} onShowSizeChange={(current, pageSize) => { this.pageInfo = { current, pageSize }; this.props.handleListShowSizeChange(this.pageInfo); }} />
); } }