salary-management-front/pc4mobx/hrmSalary/pages/ledgerPage/index.js

91 lines
2.4 KiB
JavaScript
Raw Normal View History

2022-12-06 16:06:35 +08:00
/*
* Author: 黎永顺
* name: 薪资账套
* Description:
* Date: 2022/12/6
*/
import React, { Component } from "react";
2022-12-08 15:48:46 +08:00
import { inject, observer } from "mobx-react";
2022-12-07 14:40:07 +08:00
import { WeaInputSearch, WeaTop } from "ecCom";
import { Button } from "antd";
import LedgerTable from "./components/ledgerTable";
2022-12-09 14:16:11 +08:00
import LedgerSlide from "./components/ledgerSlide";
import "./index.less";
2022-12-06 16:06:35 +08:00
2022-12-08 15:48:46 +08:00
@inject("taxAgentStore")
@observer
2022-12-06 16:06:35 +08:00
class Index extends Component {
2022-12-07 14:40:07 +08:00
constructor(props) {
super(props);
this.state = {
2022-12-08 16:43:55 +08:00
searchVal: "",
2022-12-08 17:18:56 +08:00
doSearch: false,
slideparams: {
visible: false,
2022-12-09 14:16:11 +08:00
title: "新建账套",
editId: ""
2022-12-08 17:18:56 +08:00
}
2022-12-07 14:40:07 +08:00
};
}
2023-02-15 18:47:37 +08:00
componentDidMount() {
const { taxAgentStore } = this.props;
const { fetchTaxAgentOption } = taxAgentStore;
fetchTaxAgentOption();
}
2022-12-09 14:16:11 +08:00
handleEditLedger = (record) => {
const { slideparams } = this.state;
const { id } = record;
this.setState({ slideparams: { ...slideparams, visible: true, title: "编辑账套", editId: id } });
};
handleResetLedger = () => {
const { slideparams } = this.state;
this.setState({
slideparams: {
...slideparams,
visible: false,
title: "新建账套",
editId: ""
}
});
};
2022-12-06 16:06:35 +08:00
render() {
2022-12-08 17:18:56 +08:00
const { searchVal, doSearch, slideparams } = this.state;
2022-12-08 15:48:46 +08:00
const { taxAgentStore } = this.props;
const { showOperateBtn } = taxAgentStore;
2022-12-07 14:40:07 +08:00
const btns = [
2022-12-08 17:18:56 +08:00
<Button
type="primary"
onClick={() => this.setState({ slideparams: { ...slideparams, visible: true } })}
>新建</Button>,
2022-12-07 14:40:07 +08:00
<WeaInputSearch
value={searchVal} placeholder="请输入薪资账套名称"
onChange={searchVal => this.setState({ searchVal })}
2022-12-08 16:43:55 +08:00
onSearch={() => this.setState({ doSearch: !doSearch })}
2022-12-07 14:40:07 +08:00
/>
];
2022-12-06 16:06:35 +08:00
return (
2022-12-07 14:40:07 +08:00
<WeaTop
title="薪资账套" className="ledgerOuter"
2022-12-07 14:40:07 +08:00
icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D"
showDropIcon={false}
2022-12-08 15:48:46 +08:00
buttons={showOperateBtn ? btns : btns.slice(-1)}
2022-12-07 14:40:07 +08:00
>
<div className="ledgerWrapper">
2022-12-09 14:16:11 +08:00
<LedgerTable name={searchVal} doSearch={doSearch} onEditLedger={this.handleEditLedger}/>
<LedgerSlide
{...slideparams}
onCancel={this.handleResetLedger}
onRefreshList={() => this.setState({ doSearch: !doSearch })}
/>
2022-12-07 14:40:07 +08:00
</div>
</WeaTop>
2022-12-06 16:06:35 +08:00
);
}
}
export default Index;