diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index cbaf1ff0..ca8f7464 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -15,7 +15,8 @@ import CumSituation from "./pages/dataAcquisition/cumSituation"; import Attendance from "./pages/dataAcquisition/attendance"; import SpecialAddDeduction from "./pages/dataAcquisition/specialAddDeduction"; import Ledger from "./pages/ledgerPage"; -import Calculate from "./pages/calculate"; +// import Calculate from "./pages/calculate"; +import Calculate from "./pages/calculate/calculate"; //重构的薪资核算页面 import Payroll from "./pages/payroll"; import PayrollGrant from "./pages/payroll/payrollGrant"; import PayrollDetail from "./pages/payroll/payrollDetail"; diff --git a/pc4mobx/hrmSalary/pages/calculate/calculate.js b/pc4mobx/hrmSalary/pages/calculate/calculate.js new file mode 100644 index 00000000..901f0ea0 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/calculate.js @@ -0,0 +1,59 @@ +/* + * Author: 黎永顺 + * name: 薪资核算-重构页面 + * Description: + * Date: 2023/10/9 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaTop } from "ecCom"; +import { Button } from "antd"; +import moment from "moment"; +import CalculateQuery from "./components/calculateQuery"; +import CalculateTablelist from "./components/calculateTablelist"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("calculateStore", "taxAgentStore") +@observer +class Calculate extends Component { + constructor(props) { + super(props); + this.state = { + queryParams: { + name: "", + dateRange: [ + moment(new Date()).startOf("year").format("YYYY-MM"), + moment(new Date()).startOf("month").format("YYYY-MM") + ] + } + }; + } + + renderCalculateOpts = () => { + const { taxAgentStore: { showOperateBtn } } = this.props; + const { queryParams } = this.state; + let calculateOpts = [ + , + { + }} onChange={v => this.setState({ queryParams: { ...queryParams, ...v } })}/> + ]; + return !showOperateBtn ? calculateOpts.slice(1) : calculateOpts; + }; + + render() { + const { queryParams } = this.state; + return ( + } iconBgcolor="#F14A2D" + buttons={this.renderCalculateOpts()} + > +
+ +
+
+ ); + } +} + +export default Calculate; diff --git a/pc4mobx/hrmSalary/pages/calculate/columns.js b/pc4mobx/hrmSalary/pages/calculate/columns.js deleted file mode 100644 index 17c4adc3..00000000 --- a/pc4mobx/hrmSalary/pages/calculate/columns.js +++ /dev/null @@ -1,56 +0,0 @@ -export const columns = [ - { - title: "薪资所属月", - dataIndex: 'title', - key: 'title', - }, - { - title: "薪资账套", - dataIndex: 'title', - key: 'title', - }, - { - title: "状态", - dataIndex: 'title', - key: 'title', - }, - { - title: "税款所属期", - dataIndex: 'title', - key: 'title', - }, - { - title: "核算人数", - dataIndex: 'title', - key: 'title', - }, - { - title: "核算人", - dataIndex: 'title', - key: 'title', - }, - { - title: "最后操作时间", - dataIndex: 'title', - key: 'title', - }, - { - title: "备注", - dataIndex: 'title', - key: 'title', - }, - { - title: "操作", - dataIndex: 'cz', - key: 'cz', - } -] - -export const dataSource = [{ - title: "测试" -}]; - - - - - diff --git a/pc4mobx/hrmSalary/pages/calculate/components/calculateQuery/index.js b/pc4mobx/hrmSalary/pages/calculate/components/calculateQuery/index.js new file mode 100644 index 00000000..00cd202d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/components/calculateQuery/index.js @@ -0,0 +1,34 @@ +/* + * Author: 黎永顺 + * name: 薪资核算-查询 + * Description: + * Date: 2023/10/9 + */ +import React, { Component } from "react"; +import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; +import { MonthRangePicker } from "../../../reportView/components/statisticalMicroSettingsSlide"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + render() { + const { queryParams } = this.props; + const { dateRange, name } = queryParams; + return ( +
+
+ {getLabel(543549, "薪资所属月:")} + this.props.onChange({ dateRange: v })}/> +
+ this.props.onChange({ name: v })} + onSearch={this.props.onSearch} + /> +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/components/calculateTablelist/index.js b/pc4mobx/hrmSalary/pages/calculate/components/calculateTablelist/index.js new file mode 100644 index 00000000..2848af2e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/components/calculateTablelist/index.js @@ -0,0 +1,110 @@ +/* + * Author: 黎永顺 + * name: 薪资核算-列表 + * Description: + * Date: 2023/10/9 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +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() { + const { queryParams } = this.props; + const { dateRange, ...extra } = queryParams; + const [startMonthStr, endMonthStr] = dateRange || []; + const params = { startMonthStr, endMonthStr, ...extra }; + this.getSalaryAcctList(params); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.queryParams !== this.props.queryParams) { + const { queryParams } = nextProps; + const { dateRange, ...extra } = queryParams; + const [startMonthStr, endMonthStr] = dateRange || []; + const params = { startMonthStr, endMonthStr, ...extra }; + this.getSalaryAcctList(params); + } + } + + getSalaryAcctList = (params) => { + const { pageInfo } = this.state; + const payload = { ...pageInfo, ...params }; + 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 "taxCycle": + case "description": + width = "15%"; + break; + default: + width = "10%"; + break; + } + if (dataIndex === "operate") { + } + return { ...o, width }; + }) + }); + } + }).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 } + }, () => { + }); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + }); + } + }; + return ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/index.less b/pc4mobx/hrmSalary/pages/calculate/index.less index 2a274b60..03f4218d 100644 --- a/pc4mobx/hrmSalary/pages/calculate/index.less +++ b/pc4mobx/hrmSalary/pages/calculate/index.less @@ -43,3 +43,39 @@ } } } + +//重构薪资核算页 +.salary-btn-flex { + display: flex; + align-items: center; + + .mounth-range { + display: flex; + align-items: center; + margin-right: 10px; + + .label { + color: #999; + } + } + + .wea-input-focus { + margin-top: -4px; + } +} + +.calculate-body { + background: #f6f6f6; + height: 100%; + width: 100%; + padding: 16px; + + .ant-table-tbody { + td { + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } +}