2022-12-09 14:16:11 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
|
* name: 薪资账套基本设置
|
|
|
|
|
|
* Description:
|
|
|
|
|
|
* Date: 2022/12/9
|
|
|
|
|
|
*/
|
|
|
|
|
|
import React, { Component } from "react";
|
2023-05-23 17:03:25 +08:00
|
|
|
|
import { WeaCheckbox, WeaFormItem, WeaHelpfulTip, WeaInput, WeaLocaleProvider, WeaSelect, WeaTextarea } from "ecCom";
|
2022-12-09 14:16:11 +08:00
|
|
|
|
import { Col, Row } from "antd";
|
|
|
|
|
|
import { inject, observer } from "mobx-react";
|
|
|
|
|
|
import { baseSettingFormItem } from "../config";
|
2022-12-12 10:24:07 +08:00
|
|
|
|
import { getLedgerBasicForm } from "../../../apis/ledger";
|
2023-04-17 11:53:21 +08:00
|
|
|
|
import {
|
|
|
|
|
|
generateBasicInfo,
|
|
|
|
|
|
getAddMonthYearMonth,
|
|
|
|
|
|
getCurrentYearMonth,
|
|
|
|
|
|
getMonthDays,
|
|
|
|
|
|
getSubtractMonthYearMonth,
|
|
|
|
|
|
prefixAddZero
|
|
|
|
|
|
} from "../../../util/date";
|
2023-01-18 09:22:14 +08:00
|
|
|
|
import { commonEnumList } from "../../../apis/ruleconfig";
|
2022-12-14 19:40:05 +08:00
|
|
|
|
import moment from "moment";
|
2022-12-09 14:16:11 +08:00
|
|
|
|
import "./index.less";
|
|
|
|
|
|
|
2023-05-23 17:03:25 +08:00
|
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
|
|
|
2022-12-09 14:16:11 +08:00
|
|
|
|
@inject("taxAgentStore")
|
|
|
|
|
|
@observer
|
|
|
|
|
|
class LedgerBaseSetting extends Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
this.state = {
|
2023-02-14 15:38:04 +08:00
|
|
|
|
baseForm: [],
|
2022-12-09 14:16:11 +08:00
|
|
|
|
settingBaseInfo: {
|
2022-12-12 10:24:07 +08:00
|
|
|
|
name: "",
|
|
|
|
|
|
taxAgentId: "",
|
|
|
|
|
|
taxableItems: "1",
|
|
|
|
|
|
salaryCycleType: "3",
|
|
|
|
|
|
salaryCycleFromDay: "1",
|
|
|
|
|
|
taxCycleType: "3",
|
|
|
|
|
|
attendCycleType: "3",
|
|
|
|
|
|
attendCycleFromDay: "1",
|
|
|
|
|
|
socialSecurityCycleType: "3",
|
|
|
|
|
|
description: "",
|
|
|
|
|
|
canEdit: false
|
2022-12-09 14:16:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-14 15:38:04 +08:00
|
|
|
|
componentWillMount() {
|
2022-12-09 14:16:11 +08:00
|
|
|
|
this.getTaxAgentSelectListAsAdmin();
|
2023-02-14 15:38:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
// this.getTaxAgentSelectListAsAdmin();
|
|
|
|
|
|
// this.commonEenumList();
|
2022-12-12 10:24:07 +08:00
|
|
|
|
if (this.props.visible && this.props.editId) {
|
|
|
|
|
|
this.getLedgerBasicForm(this.props.editId);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
|
|
|
|
if (nextProps.visible !== this.props.visible && nextProps.editId) {
|
|
|
|
|
|
this.getLedgerBasicForm(nextProps.editId);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (nextProps.visible !== this.props.visible && !nextProps.editId) {
|
|
|
|
|
|
this.handleResetBaseInfo();
|
|
|
|
|
|
}
|
2022-12-09 14:16:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-12 10:24:07 +08:00
|
|
|
|
handleResetBaseInfo = () => {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
settingBaseInfo: {
|
|
|
|
|
|
name: "",
|
|
|
|
|
|
taxAgentId: "",
|
|
|
|
|
|
taxableItems: "1",
|
|
|
|
|
|
salaryCycleType: "3",
|
|
|
|
|
|
salaryCycleFromDay: "1",
|
|
|
|
|
|
taxCycleType: "3",
|
|
|
|
|
|
attendCycleType: "3",
|
|
|
|
|
|
attendCycleFromDay: "1",
|
|
|
|
|
|
socialSecurityCycleType: "3",
|
|
|
|
|
|
description: "",
|
2022-12-12 11:38:43 +08:00
|
|
|
|
canEdit: "true"
|
2022-12-12 10:24:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
getLedgerBasicForm = (id) => {
|
|
|
|
|
|
getLedgerBasicForm({ id }).then(({ status, data }) => {
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
const { basicForm } = data;
|
|
|
|
|
|
const { settingBaseInfo } = this.state;
|
|
|
|
|
|
let tmpV = {};
|
|
|
|
|
|
_.map(Object.keys(settingBaseInfo), key => {
|
2022-12-16 11:05:07 +08:00
|
|
|
|
tmpV[key] = !_.isNil(basicForm[key]) ? basicForm[key].toString() : "";
|
2022-12-12 10:24:07 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
settingBaseInfo: {
|
|
|
|
|
|
...settingBaseInfo,
|
|
|
|
|
|
...tmpV
|
|
|
|
|
|
}
|
|
|
|
|
|
}, () => {
|
|
|
|
|
|
this.props.onSaveParams(this.state.settingBaseInfo);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
2022-12-09 14:16:11 +08:00
|
|
|
|
getTaxAgentSelectListAsAdmin = () => {
|
|
|
|
|
|
const { taxAgentStore } = this.props;
|
|
|
|
|
|
const { getTaxAgentSelectListAsAdmin } = taxAgentStore;
|
|
|
|
|
|
getTaxAgentSelectListAsAdmin().then(({ status, data }) => {
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
this.setState({
|
2023-02-14 15:38:04 +08:00
|
|
|
|
baseForm: _.map(baseSettingFormItem, it => {
|
2022-12-09 14:16:11 +08:00
|
|
|
|
if (it.key === "taxAgentId") {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...it,
|
|
|
|
|
|
options: _.map(data, it => ({ key: it.id, showname: it.content }))
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
return { ...it };
|
|
|
|
|
|
})
|
2023-02-14 15:38:04 +08:00
|
|
|
|
}, () => this.commonEenumList());
|
2022-12-09 14:16:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
2023-02-14 15:38:04 +08:00
|
|
|
|
commonEenumList = () => {
|
2023-01-18 09:22:14 +08:00
|
|
|
|
const payload = {
|
|
|
|
|
|
enumClass: "com.engine.salary.enums.salarysob.IncomeCategoryEnum"
|
|
|
|
|
|
};
|
|
|
|
|
|
commonEnumList(payload).then(({ status, data }) => {
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
const { baseForm } = this.state;
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
baseForm: _.map(baseForm, it => {
|
|
|
|
|
|
if (it.key === "taxableItems") {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...it,
|
|
|
|
|
|
options: _.map(data, it => ({ key: it.value.toString(), showname: it.defaultLabel }))
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
return { ...it };
|
|
|
|
|
|
})
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2023-02-14 15:38:04 +08:00
|
|
|
|
};
|
2022-12-09 14:16:11 +08:00
|
|
|
|
handleChangeField = (key, value) => {
|
|
|
|
|
|
const { onSaveParams } = this.props;
|
|
|
|
|
|
const { settingBaseInfo } = this.state;
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
settingBaseInfo: {
|
|
|
|
|
|
...settingBaseInfo,
|
|
|
|
|
|
[key]: value
|
|
|
|
|
|
}
|
|
|
|
|
|
}, () => {
|
|
|
|
|
|
onSaveParams(this.state.settingBaseInfo);
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
2023-02-15 18:47:37 +08:00
|
|
|
|
const { editId, taxAgentStore: { taxAgentOption } } = this.props;
|
2022-12-09 14:16:11 +08:00
|
|
|
|
const { baseForm, settingBaseInfo } = this.state;
|
2022-12-12 11:38:43 +08:00
|
|
|
|
const { canEdit, taxAgentId } = settingBaseInfo;
|
|
|
|
|
|
let taxAgentIdDisabled = false, taxableItemsDisabled = false;
|
2022-12-09 14:16:11 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<div className="baseSettingWrapper">
|
|
|
|
|
|
<Row gutter={20}>
|
|
|
|
|
|
<Col span={18} className="baseSettingLeft">
|
|
|
|
|
|
{
|
|
|
|
|
|
_.map(baseForm, item => {
|
2023-07-31 18:58:54 +08:00
|
|
|
|
const { key, label, lanId, type, options = [], children = [] } = item;
|
2023-01-28 10:10:00 +08:00
|
|
|
|
taxAgentIdDisabled = key === "taxAgentId" && editId && taxAgentId;
|
2022-12-12 11:38:43 +08:00
|
|
|
|
taxableItemsDisabled = key === "taxableItems" && editId;
|
2022-12-09 14:16:11 +08:00
|
|
|
|
return <WeaFormItem
|
2023-07-31 18:58:54 +08:00
|
|
|
|
key={key} label={getLabel(lanId, label)}
|
2022-12-09 14:16:11 +08:00
|
|
|
|
labelCol={{ span: 6 }} wrapperCol={{ span: 12 }}
|
|
|
|
|
|
>
|
|
|
|
|
|
{
|
|
|
|
|
|
type === "INPUT" ?
|
2022-12-12 11:38:43 +08:00
|
|
|
|
<WeaInput value={settingBaseInfo[key]} viewAttr={3} disabled={canEdit !== "true"}
|
2022-12-09 14:16:11 +08:00
|
|
|
|
onChange={(v) => this.handleChangeField(key, v)}/> :
|
|
|
|
|
|
type === "TEXTAREA" ?
|
2022-12-12 11:38:43 +08:00
|
|
|
|
<WeaTextarea value={settingBaseInfo[key]} disabled={canEdit !== "true"}
|
|
|
|
|
|
onChange={(v) => this.handleChangeField(key, v)}/> :
|
2022-12-09 14:16:11 +08:00
|
|
|
|
type === "CHECKBOX" ?
|
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
|
<WeaCheckbox value={true} viewAttr={1}
|
2023-08-04 17:45:18 +08:00
|
|
|
|
content={getLabel(544087, "【起薪日期≤薪资周期止】且【最后发薪日期≥薪资周期起】")}/>
|
2023-08-01 10:36:43 +08:00
|
|
|
|
<WeaHelpfulTip width={200} title={getLabel(543472, "提示:最后发薪日期为空,默认为无穷大")}
|
2023-07-31 18:58:54 +08:00
|
|
|
|
placement="topLeft"/>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
</React.Fragment> :
|
|
|
|
|
|
type === "SELECT" ?
|
2023-02-15 18:47:37 +08:00
|
|
|
|
<WeaSelect value={settingBaseInfo[key]}
|
2023-07-31 18:58:54 +08:00
|
|
|
|
options={((canEdit !== "true" || taxAgentIdDisabled || taxableItemsDisabled) && key === "taxAgentId") ? taxAgentOption : _.map(options, it => ({
|
|
|
|
|
|
...it,
|
|
|
|
|
|
showname: getLabel(it.lanId, it.showname)
|
|
|
|
|
|
}))}
|
2023-02-15 18:47:37 +08:00
|
|
|
|
viewAttr={3}
|
2022-12-12 11:38:43 +08:00
|
|
|
|
disabled={canEdit !== "true" || taxAgentIdDisabled || taxableItemsDisabled}
|
2022-12-09 14:16:11 +08:00
|
|
|
|
onChange={(v) => this.handleChangeField(key, v)}/> :
|
2022-12-12 10:24:07 +08:00
|
|
|
|
type === "CUSTOM" ?
|
|
|
|
|
|
<CustomSelect list={children} baseInfo={settingBaseInfo} inputStr={key}
|
|
|
|
|
|
onChange={(key, v) => this.handleChangeField(key, v)}/> : null
|
2022-12-09 14:16:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
</WeaFormItem>;
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
</Col>
|
2022-12-09 15:26:21 +08:00
|
|
|
|
<Col span={6}><MonthCycleDesc {...settingBaseInfo}/></Col>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
</Row>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default LedgerBaseSetting;
|
|
|
|
|
|
|
|
|
|
|
|
const CustomSelect = (props) => {
|
2022-12-12 10:24:07 +08:00
|
|
|
|
const { list, baseInfo, onChange, inputStr } = props;
|
2023-04-17 11:53:21 +08:00
|
|
|
|
const { canEdit } = baseInfo;
|
|
|
|
|
|
const selectInfo = buildEditBasicInfo(baseInfo);
|
2023-01-05 15:03:03 +08:00
|
|
|
|
return <Row gutter={10} key={inputStr}>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
{
|
|
|
|
|
|
_.map(list, item => {
|
|
|
|
|
|
const { key, options = [] } = item;
|
|
|
|
|
|
return <Col span={6}>
|
2023-07-31 18:58:54 +08:00
|
|
|
|
<WeaSelect value={baseInfo[key]} viewAttr={3}
|
2022-12-12 11:38:43 +08:00
|
|
|
|
disabled={canEdit !== "true"}
|
2023-07-31 18:58:54 +08:00
|
|
|
|
onChange={(v) => onChange(key, v)}
|
|
|
|
|
|
options={_.map(options, it => ({
|
|
|
|
|
|
...it,
|
|
|
|
|
|
showname: getLabel(it.lanId, it.showname)
|
|
|
|
|
|
}))}
|
|
|
|
|
|
/>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
</Col>;
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-12-12 10:24:07 +08:00
|
|
|
|
<Col span={12}
|
2023-04-17 11:53:21 +08:00
|
|
|
|
className="desc">{inputStr === "salaryCycleStrObj" ? selectInfo.salaryCycleInfo.salaryPeriodTip : selectInfo.attendCycleInfo.attendancePeriodTip}</Col>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
</Row>;
|
|
|
|
|
|
};
|
|
|
|
|
|
const MonthCycleDesc = (props) => {
|
2023-04-17 11:53:21 +08:00
|
|
|
|
const { taxCycleType, socialSecurityCycleType } = props;
|
|
|
|
|
|
const selectInfo = buildEditBasicInfo({ ...props });
|
2022-12-09 14:16:11 +08:00
|
|
|
|
return <div className="baseSettingRight">
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<div className="title">{getLabel(543473, "月份周期说明")}</div>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
<div className="descContent">
|
2022-12-09 15:26:21 +08:00
|
|
|
|
<div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
{getLabel(543479, "例:薪资所属月是")}<span
|
|
|
|
|
|
className="notice">{moment().format("YYYY-MM")}</span>({getLabel(543478, "即核算员工")}<span
|
|
|
|
|
|
className="notice">{moment().format("MM")}</span>{getLabel(543477, "月的工资")})
|
2022-12-09 15:26:21 +08:00
|
|
|
|
</div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<div>{getLabel(543474, "根据您当前的选择,相应的周期为:")}</div>
|
|
|
|
|
|
<div className="descTitle">{getLabel(543375, "薪资周期")}</div>
|
2022-12-12 10:24:07 +08:00
|
|
|
|
<div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<span className="notice">{selectInfo.salaryCycleInfo.salaryPeriodStart}</span>{getLabel(15322, "至")}
|
2023-04-17 11:53:21 +08:00
|
|
|
|
<span className="notice">{selectInfo.salaryCycleInfo.salaryPeriodEnd}</span>
|
2022-12-12 10:24:07 +08:00
|
|
|
|
</div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<div className="descTitle">{getLabel(542240, "税款所属期")}</div>
|
2022-12-09 15:26:21 +08:00
|
|
|
|
<div className="notice">{getMonth(taxCycleType)}</div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<div className="descTitle">{getLabel(543475, "考勤取值周期")}</div>
|
2022-12-12 10:24:07 +08:00
|
|
|
|
<div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<span className="notice">{selectInfo.attendCycleInfo.attendancePeriodStart}</span>{getLabel(15322, "至")}
|
2023-04-17 11:53:21 +08:00
|
|
|
|
<span className="notice">{selectInfo.attendCycleInfo.attendancePeriodEnd}</span>
|
2022-12-12 10:24:07 +08:00
|
|
|
|
</div>
|
2023-06-08 18:13:37 +08:00
|
|
|
|
<div className="descTitle">{getLabel(543466, "福利台账月份")}</div>
|
|
|
|
|
|
<div>{getLabel(19422, "引用")}<span
|
|
|
|
|
|
className="notice">{getMonth(socialSecurityCycleType)}</span>{getLabel(543476, "的福利台账数据")}</div>
|
2022-12-09 14:16:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>;
|
|
|
|
|
|
};
|
2023-04-17 11:53:21 +08:00
|
|
|
|
const buildEditBasicInfo = (editBasicInfo) => {
|
|
|
|
|
|
const { attendCycleType, salaryCycleType } = editBasicInfo;
|
|
|
|
|
|
const now = new Date();
|
|
|
|
|
|
let nowYear = now.getFullYear();
|
|
|
|
|
|
let nowMonth = now.getMonth() + 1;
|
|
|
|
|
|
let tmpV = {};
|
|
|
|
|
|
// 薪资联动
|
|
|
|
|
|
switch (salaryCycleType) {
|
|
|
|
|
|
case "1" :
|
|
|
|
|
|
tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, -2, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "2" :
|
|
|
|
|
|
tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, -1, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "3" :
|
|
|
|
|
|
tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, 0, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "4" :
|
|
|
|
|
|
tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, 1, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 考勤联动
|
|
|
|
|
|
switch (attendCycleType) {
|
|
|
|
|
|
case "1" :
|
|
|
|
|
|
tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, -2, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "2" :
|
|
|
|
|
|
tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, -1, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "3" :
|
|
|
|
|
|
tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, 0, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "4" :
|
|
|
|
|
|
tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, 1, nowYear, nowMonth);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return tmpV;
|
|
|
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
|
* Description:构建薪资周期联动信息
|
|
|
|
|
|
* Params:
|
|
|
|
|
|
* Date: 2023/4/17
|
|
|
|
|
|
*/
|
|
|
|
|
|
const buildSalaryInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => {
|
|
|
|
|
|
const { salaryCycleFromDay } = editBasicInfo;
|
|
|
|
|
|
let salaryCycleFromDayNum = Number(salaryCycleFromDay), customInfo = {};
|
|
|
|
|
|
const basicInfo = generateBasicInfo(monthCal, nowYear, nowMonth);
|
|
|
|
|
|
const { nowMonthStr, nextMonthStr, year, month } = basicInfo;
|
|
|
|
|
|
customInfo.salaryYear = year;
|
|
|
|
|
|
customInfo.salaryMonth = month;
|
2022-12-09 15:26:21 +08:00
|
|
|
|
|
2023-04-17 11:53:21 +08:00
|
|
|
|
if (salaryCycleFromDayNum === 1) {
|
2023-06-09 11:38:20 +08:00
|
|
|
|
customInfo.salaryPeriodTip = getLabel(15322, "至") + nowMonthStr + getLabel(542654, "最后一天");
|
2023-04-17 11:53:21 +08:00
|
|
|
|
customInfo.salaryPeriodStart = customInfo.salaryYear + "-"
|
|
|
|
|
|
+ prefixAddZero(customInfo.salaryMonth, 2) + "-01";
|
|
|
|
|
|
customInfo.salaryPeriodEnd = customInfo.salaryYear + "-"
|
|
|
|
|
|
+ prefixAddZero(customInfo.salaryMonth, 2) + "-"
|
|
|
|
|
|
+ prefixAddZero(getMonthDays(customInfo.salaryYear, customInfo.salaryMonth), 2);
|
|
|
|
|
|
} else {
|
2023-06-08 18:13:37 +08:00
|
|
|
|
customInfo.salaryPeriodTip = getLabel(15322, "至") + nextMonthStr + (salaryCycleFromDayNum - 1) + "号";
|
2023-04-17 11:53:21 +08:00
|
|
|
|
customInfo.salaryPeriodStart = customInfo.salaryYear + "-"
|
|
|
|
|
|
+ prefixAddZero(customInfo.salaryMonth, 2) + "-" + prefixAddZero(salaryCycleFromDayNum, 2);
|
|
|
|
|
|
let year = customInfo.salaryYear;
|
|
|
|
|
|
let month = customInfo.salaryMonth;
|
|
|
|
|
|
if (month === "12") {
|
|
|
|
|
|
year = Number(year) + 1;
|
|
|
|
|
|
month = 1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
month = Number(month) + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
customInfo.salaryPeriodEnd = year + "-"
|
|
|
|
|
|
+ prefixAddZero(month, 2) + "-"
|
|
|
|
|
|
+ prefixAddZero(salaryCycleFromDayNum - 1, 2);
|
|
|
|
|
|
}
|
|
|
|
|
|
return customInfo;
|
2022-12-12 10:24:07 +08:00
|
|
|
|
};
|
2023-04-17 11:53:21 +08:00
|
|
|
|
const buildAttendanceInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => {
|
|
|
|
|
|
const { attendCycleFromDay } = editBasicInfo;
|
|
|
|
|
|
let attendCycleFromDayNum = Number(attendCycleFromDay), customInfo = {};
|
2022-12-12 10:24:07 +08:00
|
|
|
|
|
2023-04-17 11:53:21 +08:00
|
|
|
|
const basicInfo = generateBasicInfo(monthCal, nowYear, nowMonth);
|
|
|
|
|
|
const { nowMonthStr, nextMonthStr } = basicInfo;
|
|
|
|
|
|
let year = basicInfo.year;
|
|
|
|
|
|
let month = basicInfo.month;
|
|
|
|
|
|
|
|
|
|
|
|
if (attendCycleFromDayNum === 1) {
|
2023-06-09 11:38:20 +08:00
|
|
|
|
customInfo.attendancePeriodTip = getLabel(15322, "至") + nowMonthStr + getLabel(542654, "最后一天");
|
2023-04-17 11:53:21 +08:00
|
|
|
|
|
|
|
|
|
|
customInfo.attendancePeriodStart = year + "-"
|
|
|
|
|
|
+ prefixAddZero(month, 2) + "-01";
|
|
|
|
|
|
customInfo.attendancePeriodEnd = year + "-"
|
|
|
|
|
|
+ prefixAddZero(month, 2) + "-"
|
|
|
|
|
|
+ prefixAddZero(getMonthDays(year, month), 2);
|
|
|
|
|
|
} else {
|
2023-06-09 11:38:20 +08:00
|
|
|
|
customInfo.attendancePeriodTip = getLabel(15322, "至") + nextMonthStr + (attendCycleFromDayNum - 1) + getLabel(16992, "号");
|
2023-04-17 11:53:21 +08:00
|
|
|
|
customInfo.attendancePeriodStart = year + "-"
|
|
|
|
|
|
+ prefixAddZero(month, 2) + "-" + prefixAddZero(attendCycleFromDayNum, 2);
|
|
|
|
|
|
if (month === "12") {
|
|
|
|
|
|
year = (Number(year) + 1).toString();
|
|
|
|
|
|
month = "1";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
month = (Number(month) + 1).toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
customInfo.attendancePeriodEnd = year + "-"
|
|
|
|
|
|
+ prefixAddZero(month, 2) + "-"
|
|
|
|
|
|
+ prefixAddZero(attendCycleFromDayNum - 1, 2);
|
|
|
|
|
|
}
|
|
|
|
|
|
return customInfo;
|
|
|
|
|
|
};
|
2022-12-09 15:26:21 +08:00
|
|
|
|
const getMonth = (salaryCycleType) => {
|
|
|
|
|
|
switch (salaryCycleType) {
|
|
|
|
|
|
case "1": // 上上月
|
|
|
|
|
|
return getSubtractMonthYearMonth(2);
|
|
|
|
|
|
case "2": // 上月
|
|
|
|
|
|
return getSubtractMonthYearMonth(1);
|
|
|
|
|
|
case "3": // 本月
|
|
|
|
|
|
return getCurrentYearMonth();
|
|
|
|
|
|
case "4": // 下月
|
|
|
|
|
|
return getAddMonthYearMonth(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|