import React from "react"; import { inject, observer } from "mobx-react"; import { Button, DatePicker, Dropdown, Menu, message, Modal, Tag } from "antd"; import { WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaTop } from "ecCom"; import { renderNoright } from "../../util"; import CustomTab from "../../components/customTab"; import moment from "moment"; import BaseFormModal from "./baseFormModal"; import CustomPaginationTable from "../../components/customPaginationTable"; import ProgressModal from "../../components/progressModal"; import "./index.less"; const { getLabel } = WeaLocaleProvider; const MonthPicker = DatePicker.MonthPicker; @inject("calculateStore", "taxAgentStore") @observer export default class Calculate extends React.Component { constructor(props) { super(props); this.state = { progressVisible: false, progress: 0, value: "", selectedKey: "0", searchValue: "", startDate: moment(new Date()).startOf("year").format("YYYY-MM"), endDate: moment(new Date()).startOf("month").format("YYYY-MM"), current: 1 }; this.pageInfo = { current: 1, pageSize: 10 }; } componentWillMount() { const { calculateStore } = this.props; const { getSalaryAcctList } = calculateStore; getSalaryAcctList({ name: "", startMonthStr: this.state.startDate, endMonthStr: this.state.endDate }); } // 搜索 handleSearch = (value, extra = {}) => { const { calculateStore } = this.props; const { getSalaryAcctList } = calculateStore; getSalaryAcctList({ name: value, startMonthStr: this.state.startDate, endMonthStr: this.state.endDate, current: this.state.current, ...extra }); }; handleRangePickerChange(type, value) { const { calculateStore: { getSalaryAcctList } } = this.props; this.setState({ [type]: value ? moment(value).format("YYYY-MM") : moment().format("YYYY-MM") }, () => { const { startDate: startMonthStr, endDate: endMonthStr } = this.state; getSalaryAcctList({ name: this.state.searchValue, startMonthStr, endMonthStr }); }); } // 列表项核算回调 handleAccount(record) { window.open( "/spa/hrmSalary/static/index.html#/main/hrmSalary/calculateDetail?id=" + record.id ); } // 列表项删除回调 handleDeleteItem(record) { Modal.confirm({ title: "信息确认", content: "确认删除本条数据吗?", onOk: () => { const { calculateStore: { deleteSalaryacct } } = this.props; deleteSalaryacct([record.id]).then(() => { this.handleSearch(this.state.searchValue); }); }, onCancel: () => { } }); } // 列表项归档回调 handleFile(record) { const { calculateStore: { fileSalaryAcct } } = this.props; this.setState({ progressVisible: true }, () => { this.timer = setInterval(() => { if (this.state.progress !== 100) { this.setState({ progress: this.state.progress + 1 }); } else { clearInterval(this.timer); this.setState({ progressVisible: false, progress: 0 }, () => { message.success("归档成功"); this.handleSearch(this.state.searchValue); }); } }, 800); }); fileSalaryAcct(record.id).then(() => { clearInterval(this.timer); this.setState({ progressVisible: false, progress: 0 }, () => { message.success("归档成功"); this.handleSearch(this.state.searchValue); }); }).catch(() => { clearInterval(this.timer); this.setState({ progressVisible: false, progress: 0 }); }); } // 重新核算 handleReaccount(record) { const { calculateStore: { reAccounting } } = this.props; reAccounting(record.id).then(() => { this.handleSearch(this.state.searchValue); }); } // 回算 handleBackCalculate = (record) => { Modal.confirm({ title: "信息确认", content: "确定回算吗?\n 回算后,正常核算的数据会被覆盖,正常核算的工资单不能继续发放或撤回!", onOk: () => { const { calculateStore: { backCalculate } } = this.props; backCalculate(record.id).then(() => { this.handleSearch(this.state.searchValue); }); } }); }; // 查看详情回调 handleDetail(record) { window.open( "/spa/hrmSalary/static/index.html#/main/hrmSalary/placeOnFileDetail?id=" + record.id ); } // 获取列表 getColumns = () => { const { calculateStore: { salaryListColumns }, taxAgentStore: { showOperateBtn } } = this.props; let columns = [...salaryListColumns].filter(item => item.dataIndex !== "backCalcStatus" && item.dataIndex !== "acctTimes"); columns.map(item => { if (item.dataIndex === "salarySobName") { item.width = 300; item.render = (text, record) => { return