import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import moment from "moment";
import { dealTemplate } from "./index";
const getLabel = WeaLocaleProvider.getLabel;
class Content extends Component {
render() {
const { theme, background, tip, tipPosi, itemTypeList, sendTime = new Date() } = this.props;
const { onlyOneGrup, showData } = dealTemplate(itemTypeList, "pc");
return (
{theme || ""}
{moment(sendTime).format("YYYY-MM-DD HH:mm:ss")}
{
background &&
}
{
!onlyOneGrup && tipPosi.toString() === "1" && tip &&
{tip}
}
{
showData.map((groupItem, index) => {
// 如果当前组下没有条目 当前组直接不展示。
if (!groupItem) return null;
const { groupId, groupName, items = [] } = groupItem;
return (
{
groupName ?
{groupName}
: null
}
{
(onlyOneGrup && tipPosi.toString() === "1" && tip) && (
{getLabel(111, "发放说明")}
{tip}
)
}
{
items.map((templatItem, index) => {
const { salaryItemValue, name, salaryItemShowName } = templatItem || {};
return
{salaryItemShowName || name || ""}
{salaryItemValue || ""}
;
})
}
{
(onlyOneGrup && tipPosi.toString() === "2" && tip) && (
{getLabel(111, "发放说明")}
{tip}
)
}
);
})
}
{
!onlyOneGrup && tipPosi.toString() === "2" && tip &&
{tip}
}
{this.props.children}
);
}
}
export default Content;