From 69bf6982a08d3a8df821e12756ed18b2b8e62d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 10 Mar 2023 10:36:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E8=B5=84=E8=B4=A6=E5=A5=97-=E8=96=AA?= =?UTF-8?q?=E8=B5=84=E9=A1=B9=E7=9B=AE=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ledgerSalaryItemPreviewModal.js | 45 ++++++------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemPreviewModal.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemPreviewModal.js index 281d2257..b9c0243d 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemPreviewModal.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemPreviewModal.js @@ -5,46 +5,27 @@ export default class LedgerSalaryItemPreviewModal extends React.Component { getColumns = () => { const { empFields, itemGroups } = this.props; let columns = []; - let length = 0; empFields.map(item => { columns.push({ title: item.fieldName, - key: item.fieldId, + dataIndex: item.fieldId, width: 150 }); - length++; }); - - itemGroups.map(item => { - if (item.id !== "default") { - let columnItem = { - title: item.name, - children: item.items.map(i => { - return { - title: i.name, - key: i.id, - width: 150 - }; - length++; - }) - }; - columns.push(columnItem); - } - }); - - itemGroups.map(item => { - if (item.id === "default") { - item.items.map(i => { - columns.push({ + _.map(_.filter(itemGroups, it => !_.isEmpty(it.items)), child => { + let columnItem = { + title: child.name, + children: child.items.map(i => { + return { title: i.name, - key: i.id, + dataIndex: i.id, width: 150 - }); - length++; - }); - } + }; + }) + }; + columns.push(columnItem); }); - return { columns, length }; + return { columns }; }; render() { @@ -56,7 +37,7 @@ export default class LedgerSalaryItemPreviewModal extends React.Component { style={{ width: "80vw", height: 200 }} onCancel={onCancel} > - + ); }