Merge branch 'feature/2.8.3.2307.02-工资单模板添加发放薪资项目名称修改的功能' into develop

This commit is contained in:
黎永顺 2023-07-21 10:16:12 +08:00
commit bf7a1478c5
3 changed files with 13 additions and 8 deletions

View File

@ -245,7 +245,7 @@ class SalaryItemSettings extends Component {
}, () => document.getElementById("salaryItemInput") && document.getElementById("salaryItemInput").focus());
};
handleChangeSalaryItemShowName = (item, field, name) => {
const { groupId } = item, { salaryItemId } = field, { dataList, itemShowNamesetting } = this.state;
const { groupId } = item, { salaryItemId, originName } = field, { dataList, itemShowNamesetting } = this.state;
this.setState({
dataList: _.map(dataList, item => {
if (item.groupId === groupId) {
@ -261,7 +261,10 @@ class SalaryItemSettings extends Component {
}
return { ...item };
}),
itemShowNamesetting: _.unionBy([{ salaryItemId, salaryItemShowName: name }], itemShowNamesetting, "salaryItemId")
itemShowNamesetting: _.unionBy([{
salaryItemId,
salaryItemShowName: originName === name ? "" : name
}], itemShowNamesetting, "salaryItemId")
}, () => {
this.props.onChangeSalaryItem(this.state.dataList);
this.props.onChangeSalaryItemShowNamesetting(this.state.itemShowNamesetting);
@ -308,7 +311,7 @@ class SalaryItemSettings extends Component {
title={
(item.groupId !== "111111111111111111" && (!_.isEmpty(salaryBillItemNameObj) || (filed.salaryItemShowName !== filed.originName))) ?
`${filed.salaryItemShowName}(${filed.originName})` :
filed.salaryItemShowName
filed.name
}
>
{
@ -328,7 +331,7 @@ class SalaryItemSettings extends Component {
{
(item.groupId !== "111111111111111111" && (!_.isEmpty(salaryBillItemNameObj) || (filed.salaryItemShowName !== filed.originName))) ?
`${filed.salaryItemShowName}(${filed.originName})` :
filed.salaryItemShowName
filed.name
}
</div>
}

View File

@ -49,7 +49,7 @@ export default class ComputerTemplate extends React.Component {
}
renderTableTr = (data) => {
renderTableTr = (data, groupId) => {
const tables = [];
const len = data.length;
const rowNum = 3;
@ -61,8 +61,9 @@ export default class ComputerTemplate extends React.Component {
iLen = iLen > len ? len : iLen;
tables.push("<tr class='descriptions-row'>");
for (let i = j * rowNum; i < iLen; i++) {
const key = (!this.props.isPreview && groupId !== "111111111111111111") ? data[i].salaryItemShowName : data[i].name;
const value = data[i].salaryItemValue || "-";
tables.push("<th class=\"descriptions-item-label\">" + data[i].name + "</th>" + "<td class=\"descriptions-item-content\">" + value + "</td>");
tables.push("<th class=\"descriptions-item-label\">" + key + "</th>" + "<td class=\"descriptions-item-content\">" + value + "</td>");
}
tables.push("</tr>");
}
@ -98,7 +99,7 @@ export default class ComputerTemplate extends React.Component {
<div className="descript-title">{group.groupName}</div>
<div className="descriptions-view">
<table
dangerouslySetInnerHTML={{ __html: this.renderTableTr(group.items).join(",").replace(/,/g, "") }}/>
dangerouslySetInnerHTML={{ __html: this.renderTableTr(group.items, group.groupId).join(",").replace(/,/g, "") }}/>
</div>
</div>;
})

View File

@ -83,7 +83,8 @@ export default class PhoneTemplate extends React.Component {
{
_.map(group.items, item => {
return <tr className="descriptions-row">
<th className="descriptions-item-label">{item.name}</th>
<th
className="descriptions-item-label">{(!this.props.isPreview && group.groupId !== "111111111111111111") ? item.salaryItemShowName : item.name}</th>
<td className="descriptions-item-content">{item.salaryItemValue || "-"}</td>
</tr>;
})