diff --git a/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js b/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js index 251b8e7e..82be3188 100644 --- a/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js +++ b/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js @@ -2,10 +2,12 @@ import React from "react"; import { WeaCheckbox, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSearchGroup, WeaSelect, WeaTimePicker } from "ecCom"; import { inject, observer } from "mobx-react"; import { getReplenishRuleSetOptions } from "../../../apis/payroll"; +import { commonEnumList } from "../../../apis/payrollFiles"; import moment from "moment"; import { toJS } from "mobx"; import "./index.less"; + const getLabel = WeaLocaleProvider.getLabel; @inject("payrollStore") @observer @@ -16,6 +18,7 @@ export default class BaseInformForm extends React.Component { inited: false, options: [], replenishRuleOptions: [], + salaryMonthOptions: [], request: {} }; } @@ -24,6 +27,7 @@ export default class BaseInformForm extends React.Component { const { payrollStore } = this.props; const { getPayrollBaseForm } = payrollStore; const templateBaseData = window.localStorage.getItem("template-basedata") || "{}"; + this.commonEnumList(); getPayrollBaseForm(this.props.id).then(data => { this.setState( { @@ -73,9 +77,19 @@ export default class BaseInformForm extends React.Component { } }); }; + commonEnumList = () => { + commonEnumList({ enumClass: "com.engine.salary.enums.salarysend.SalaryAutoSendCycleTypeEnum" }) + .then(({ status, data }) => { + if (status && !_.isEmpty(data)) { + this.setState({ + salaryMonthOptions: _.map(data, it => ({ key: it.value.toString(), showname: it.defaultLabel })) + }); + } + }); + }; render() { - const { request, options, replenishRuleOptions } = this.state; + const { request, options, replenishRuleOptions, salaryMonthOptions } = this.state; const { salarySob, name, @@ -87,7 +101,8 @@ export default class BaseInformForm extends React.Component { emailStatus, autoSendStatus, autoSendDayOfMonth, - autoSendTimeOfDay + autoSendTimeOfDay, + autoSendCycleType } = request; return ( @@ -185,7 +200,8 @@ export default class BaseInformForm extends React.Component { this.handleChange({ autoSendStatus: value === "1", autoSendDayOfMonth: value === "1" ? "1" : null, - autoSendTimeOfDay: value === "1" ? "09:00" : null + autoSendTimeOfDay: value === "1" ? "09:00" : null, + autoSendCycleType: 0 }); }}/> @@ -193,9 +209,11 @@ export default class BaseInformForm extends React.Component { autoSendStatus && @@ -208,18 +226,23 @@ export default class BaseInformForm extends React.Component { } const SendTimeComp = (props) => { - const { value, onChange } = props; - const { autoSendDayOfMonth, autoSendTimeOfDay } = value; + const { value, onChange, salaryMonthOptions } = props; + const { autoSendDayOfMonth, autoSendTimeOfDay, autoSendCycleType } = value; const handleChangeSendtime = (key, val) => { - onChange({ autoSendDayOfMonth, autoSendTimeOfDay, [key]: val }); + onChange({ autoSendDayOfMonth, autoSendTimeOfDay, autoSendCycleType, [key]: val }); }; return
- {getLabel(111, "每月")} + {getLabel(542604, "薪资所属月")} + handleChangeSendtime("autoSendCycleType", Number(v))} + /> ({ key: item, showname: item }))} + options={_.map(getDay(autoSendCycleType), item => ({ key: item, showname: item }))} onChange={v => handleChangeSendtime("autoSendDayOfMonth", v)} /> {getLabel(16992, "号")} @@ -229,15 +252,14 @@ const SendTimeComp = (props) => {
; }; -const getDay = () => { +const getDay = (num = 1) => { let days = []; - let day = getDaysInMonth(moment().year(), moment().month() + 1); + let day = getDaysInMonth(moment().year(), moment().month() + num); for (let i = 1; i <= day; i++) { days.push(i); } return days; }; - const getDaysInMonth = (year, month) => { month = parseInt(month, 10); let d = new Date(year, month, 0);