salary-management-front/pc4mobx/hrmSalary/pages/payroll/templatePreview/computerTemplate/index.js

77 lines
3.3 KiB
JavaScript
Raw Normal View History

2022-04-18 09:31:06 +08:00
import React from 'react'
2022-04-20 19:24:14 +08:00
import background from './background.png'
import { Row, Col } from 'antd'
2022-05-05 15:53:35 +08:00
import moment from 'moment'
2022-04-18 09:31:06 +08:00
2022-05-05 15:53:35 +08:00
import { inject, observer } from 'mobx-react';
@inject('payrollStore')
@observer
2022-04-18 09:31:06 +08:00
export default class ComputerTemplate extends React.Component {
2022-05-05 15:53:35 +08:00
constructor(props) {
super(props);
this.templateBaseData = {}
this.salaryItemSetStr = {}
this.salaryTemplateShowSet = []
}
2022-04-18 09:31:06 +08:00
2022-05-05 15:53:35 +08:00
componentWillMount() {
let templateBaseDataStr = window.localStorage.getItem("templateBaseData");
this.templateBaseData = JSON.parse(templateBaseDataStr)
let salaryTemplateShowSetStr = window.localStorage.getItem("salaryTemplateShowSet");
let salaryItemSetStr = window.localStorage.getItem("salaryItemSet");
this.salaryItemSet = JSON.parse(salaryItemSetStr)
this.salaryTemplateShowSet = JSON.parse(salaryTemplateShowSetStr)
}
2022-04-18 09:31:06 +08:00
render() {
2022-04-20 19:24:14 +08:00
const { isPC } = this.props;
2022-04-18 09:31:06 +08:00
return (
<div className="computerTemplate">
<div className="titleWrapper">
2022-05-05 15:53:35 +08:00
{this.salaryTemplateShowSet.theme.replace("${companyName}", "上海泛微").replace("${salaryMonth}", moment(new Date()).format("YYYY-MM"))}
2022-04-18 09:31:06 +08:00
</div>
<div className="background-wrapper">
2022-05-05 15:53:35 +08:00
<img className="background-img" src={this.salaryTemplateShowSet.background} />
</div>
<div className="sobItemDiv" style={{margin: "20px auto"}}>
{
this.salaryTemplateShowSet.textContentPosition == 1 && this.salaryTemplateShowSet.textContent
}
2022-04-18 09:31:06 +08:00
</div>
<div className="sobItemWrapper">
2022-05-05 15:53:35 +08:00
{
this.salaryItemSet.length > 0 &&
2022-05-05 16:10:22 +08:00
this.salaryItemSet.map((group,index) => (
2022-05-05 15:53:35 +08:00
<div className="sobItem">
<Row className="titleRow">
<Col span={24} className="sobTitle">{group.groupName}</Col>
</Row>
<Row className="contentRow">
{
group.items && group.items.map(item => (
<Col span={8}>
<Row>
<Col span={ 12 } className="contentItem">{item.name}</Col>
2022-05-05 16:10:22 +08:00
<Col span={ 12 } className="contentItem">{index == 0 ? item.salaryItemValue : 10000}</Col>
2022-05-05 15:53:35 +08:00
</Row>
</Col>
))
}
</Row>
</div>
))
}
</div>
<div style={{margin: "20px auto"}}>
{
this.salaryTemplateShowSet.textContentPosition == 2 && this.salaryTemplateShowSet.textContent
}
2022-04-18 09:31:06 +08:00
</div>
</div>
)
}
}