工资单发放页面报错的bug处理

This commit is contained in:
18652063575 2022-10-24 11:24:09 +08:00
parent c3d72e9fae
commit 7384d124b2
2 changed files with 13 additions and 10 deletions

View File

@ -11,9 +11,10 @@ import "../payroll/templatePreview/index.less";
export default class MobilePayroll extends React.Component {
constructor(props) {
super(props);
this.state= {
this.state = {
mySalaryBillData: {
employeeInformation: {}
employeeInformation: {},
salaryTemplate: []
}
};
this.id = "";
@ -31,13 +32,13 @@ export default class MobilePayroll extends React.Component {
getMySalaryBill(id).then(result => {
this.setState({
mySalaryBillData: result
})
})
}
});
});
};
render() {
const { mySalaryBillData }= this.state;
const { mySalaryBillData } = this.state;
const type = getQueryString("type");
const employeeInformation = mySalaryBillData.employeeInformation ? mySalaryBillData.employeeInformation : {};
const salaryGroups = mySalaryBillData.salaryGroups ? mySalaryBillData.salaryGroups : [];
@ -64,7 +65,7 @@ export default class MobilePayroll extends React.Component {
isPreview
isMsgPreview
salaryTemplateShowSet={JSON.stringify(mySalaryBillData.salaryTemplate)}
salaryItemSet={!_.isEmpty(salaryGroups) ? JSON.stringify([employeeInformation, ...salaryGroups]) : []}
salaryItemSet={!_.isEmpty(salaryGroups) ? JSON.stringify([employeeInformation, ...salaryGroups]) : JSON.stringify([])}
/>
}
</div>

View File

@ -73,9 +73,11 @@ export default class ComputerTemplate extends React.Component {
const { salaryTemplateShowSet, salaryItemSet } = this.state;
return (
<div className="computerTemplate">
<div className="titleWrapper">
{salaryTemplateShowSet.theme.replace("${companyName}", "").replace("${salaryMonth}", moment(new Date()).format("YYYY-MM"))}
</div>
{salaryTemplateShowSet.theme &&
<div className="titleWrapper">
{salaryTemplateShowSet.theme.replace("${companyName}", "").replace("${salaryMonth}", moment(new Date()).format("YYYY-MM"))}
</div>
}
{
salaryTemplateShowSet.background && <div className="background-wrapper">
<img className="background-img" src={salaryTemplateShowSet.background} alt=""/>