diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index af5bbfb0..9df5fcf5 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -1,7 +1,8 @@ import React from "react"; import Route from "react-router/lib/Route"; import { WeaLocaleProvider } from "ecCom"; -import MySalary from "./pages/mySalary"; +// import MySalary from "./pages/mySalary"; +import MySalary from "./pages/mySalaryBenefits"; import Programme from "./pages/socialSecurityBenefits/programme"; import Archives from "./pages/socialSecurityBenefits/archives"; import StandingBook from "./pages/socialSecurityBenefits/standingBook"; diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/SalaryAdjustmentRecords/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/SalaryAdjustmentRecords/index.js new file mode 100644 index 00000000..ed75ad76 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/SalaryAdjustmentRecords/index.js @@ -0,0 +1,76 @@ +/* + * Author: 黎永顺 + * name: 调薪记录 + * Description: + * Date: 2023/11/13 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import Authority from "../../../mySalary/authority"; +import { recordList } from "../../../../apis/mySalaryBenefits"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("mySalaryStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false + }; + } + + componentDidMount() { + const { mySalaryStore: { initRecordData } } = this.props; + initRecordData(this.getRecordList); + } + + getRecordList = () => { + const { pageInfo } = this.state; + this.setState({ loading: true }); + recordList({ ...pageInfo }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, + columns: _.map(columns, it => ({ ...it, width: 150 })) + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { dataSource, loading, 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.getRecordList()); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getRecordList()); + } + }; + return ( + + + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js new file mode 100644 index 00000000..28fc0278 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/components/payrollTable/index.js @@ -0,0 +1,92 @@ +/* + * Author: 黎永顺 + * name: 工资单 + * Description: + * Date: 2023/11/13 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { mySalaryBillList } from "../../../../apis/mySalaryBenefits"; +import moment from "moment"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + juniorMapList: [], dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false, employeeId: "" + }; + } + + componentDidMount() { + this.getMySalaryBillList(this.props); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.salaryYearMonth !== this.props.salaryYearMonth) this.getMySalaryBillList(nextProps); + } + + getMySalaryBillList = (props) => { + this.setState({ loading: true }); + const { pageInfo, employeeId } = this.state; + const { salaryYearMonth } = props; + mySalaryBillList({ salaryYearMonth, employeeId, ...pageInfo }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, datas: dataSource, pageInfo: { pageNum: current, pageSize, total } } = data; + this.setState({ + dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, + columns: _.map(columns, it => { + if (it.column === "salaryYearMonth" || it.column === "sendTime") { + return { + dataIndex: it.column, title: it.text, width: it.width, + render: (__, record) => ({moment(record[it["column"]]).format("YYYY-MM")}) + }; + } + return { + dataIndex: it.column, title: it.text, width: it.width + }; + }) + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { juniorMapList, dataSource, loading, 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.getMySalaryBillList(this.props)); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getMySalaryBillList(this.props)); + } + }; + return ( + ({getLabel(33564, "查看")}) + }]} + /> + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js new file mode 100644 index 00000000..5f608921 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js @@ -0,0 +1,67 @@ +/* + * Author: 黎永顺 + * name: 我的薪资福利 + * Description: + * Date: 2023/11/13 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaReqTop } from "ecCom"; +import Payroll from "./components/payrollTable"; +import SalaryAdjustmentRecords from "./components/SalaryAdjustmentRecords"; +import { MonthRangePicker } from "../reportView/components/statisticalMicroSettingsSlide"; +import moment from "moment"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "1", salaryYearMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")] + }; + } + + renderContent = () => { + const { selectedKey, salaryYearMonth } = this.state; + let Dom = null; + switch (selectedKey) { + case "1": + Dom = ; + break; + case "2": + Dom = ; + break; + default: + break; + } + return Dom; + }; + + render() { + const { selectedKey, salaryYearMonth } = this.state; + const tabs = [ + { key: "1", title: getLabel(111, "工资单") }, + { key: "2", title: getLabel(543150, "调薪记录") } + ]; + const btns = [ + + {getLabel(542604, "薪资所属月")} + this.setState({ salaryYearMonth: v })}/> + + ]; + return ( + } + iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper" + buttons={selectedKey === "1" ? btns : []} buttonSpace={10} selectedKey={selectedKey} + onChange={selectedKey => this.setState({ selectedKey })} + > + {this.renderContent()} + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less new file mode 100644 index 00000000..52e92374 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.less @@ -0,0 +1,19 @@ +.mySalary_wrapper { + .wea-transfer-list-wrapper { + border: none; + } + + .flex-salary { + display: flex; + align-items: center; + margin-right: 16px; + + .mysalary-search-title { + margin-right: 8px; + } + } + + .wea-new-table { + background: #fff; + } +} diff --git a/pc4mobx/hrmSalary/stores/mySalary.js b/pc4mobx/hrmSalary/stores/mySalary.js index 8a38f31e..eaad7374 100644 --- a/pc4mobx/hrmSalary/stores/mySalary.js +++ b/pc4mobx/hrmSalary/stores/mySalary.js @@ -218,28 +218,28 @@ export class MySalaryStore { }); }; - @action initRecordData = async (payload) => { + @action initRecordData = async (callback) => { this.clear(); //1.check is need second verify if (window.doCheckSecondaryVerify4ec) { window.doCheckSecondaryVerify4ec({ mouldCode: "HRM", itemCode: "SALARY" }, (data) => this.getRecordData({ - ...data, payload + ...data, callback })); } else { - //4.loaddata - this.getRecordData({ status: "1", token: "", payload }); + this.getRecordData({ status: "1", token: "", callback }); } }; @action getRecordData = async (params = {}) => { if (_.isEmpty(params)) return; - const { status, payload, token } = params; + const { status, callback, token } = params; if (status == "1") { // Object.assign(this._reqParams, { token }); // this.getFormData({ viewAttr: 1 }); this.hasRight = true; - this.getRecordList(payload); + !callback && this.getRecordList(); + callback && callback(); } else { this.hasRight = false; }