/* * Author: 黎永顺 * name: 薪资核算-列表 * Description: * Date: 2023/10/9 */ import React, { Component } from "react"; import { WeaHelpfulTip, WeaLocaleProvider, WeaTable } from "ecCom"; import { Dropdown, Menu, Tag } from "antd"; import { getSalaryAcctList } from "../../../../apis/calculate"; const getLabel = WeaLocaleProvider.getLabel; class Index extends Component { constructor(props) { super(props); this.state = { loading: false, columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 } }; } componentDidMount() { this.getSalaryAcctList(this.props); } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.isRefresh !== this.props.isRefresh) this.getSalaryAcctList(nextProps); } getSalaryAcctList = (props) => { const { pageInfo } = this.state, { queryParams, form } = props; const { taxAgentIds } = form.getFormParams(); const { dateRange, ...extra } = queryParams; const [startMonthStr, endMonthStr] = dateRange || []; const params = { startMonthStr, endMonthStr, ...extra }; const payload = { ...pageInfo, ...params, taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : [] }; this.setState({ loading: true }); getSalaryAcctList(payload).then(({ status, data }) => { this.setState({ loading: false }); if (status) { const { columns, list: dataSource, pageNum, pageSize, total } = data; this.setState({ dataSource, pageInfo: { ...pageInfo, pageNum, pageSize, total }, columns: _.map(_.filter(columns, it => (it.dataIndex !== "backCalcStatus" && it.dataIndex !== "acctTimes")), o => { const { dataIndex } = o; let width = ""; switch (dataIndex) { case "status": case "employeeSize": width = "5%"; break; case "salarySobName": width = "20%"; break; case "description": width = "15%"; break; default: width = "10%"; break; } if (dataIndex === "operate") { return { ...o, width: 170, title: {getLabel(30585, "操作")} , render: (__, record) => { const { operate: opts = [] } = record; const operate = [...opts, { index: "log", text: getLabel(30586, "查看日志") }]; return { _.map(operate.slice(0, 2), f => ( this.props.onCalcOpts({ key: f.index }, record)}>{f.text} )) } { !_.isEmpty(operate.slice(2)) && this.props.onCalcOpts(e, record)}> { _.map(operate.slice(2), g => ({g.text})) } } > } ; } }; } else if (dataIndex === "salarySobName") { return { ...o, width, render: (text, record) => { const { acctTimes, backCalcStatus } = record; return
{text}
{ backCalcStatus === 1 && } {`${getLabel(15323, "第")}${acctTimes}${getLabel(18929, "次")}`}
; } }; } return { ...o, width, render: (txt) => ({txt}) }; }) }); } }).catch(() => this.setState({ loading: false })); }; render() { const { loading, dataSource, columns, pageInfo } = this.state; const pagination = { ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, showQuickJumper: true, showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange: (current, pageSize) => { this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.getSalaryAcctList(this.props)); }, onChange: current => { this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getSalaryAcctList(this.props)); } }; return ( ); } } export default Index;