From 4fd6e1f8784b765ee531ecc8f3a15d5bdd5d3898 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 16 May 2023 16:56:20 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC=E6=A0=B8?=
=?UTF-8?q?=E7=AE=97=E9=A1=B5=E9=9D=A2=E7=BC=96=E8=BE=91=E8=96=AA=E8=B5=84?=
=?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A1=B9=E5=90=8C=E6=AD=A5e10=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/calculateDetail/editSalaryDetail.js | 112 ++++--------------
.../pages/calculateDetail/index.less | 44 ++-----
.../calculateDetail/issuedAndReissueTable.js | 2 +-
.../calculateDetail/payrollItemsTable.js | 79 ++++++++++++
pc4mobx/hrmSalary/stores/calculate.js | 31 +++--
5 files changed, 123 insertions(+), 145 deletions(-)
create mode 100644 pc4mobx/hrmSalary/pages/calculateDetail/payrollItemsTable.js
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js b/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js
index 075c55a1..2051451d 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js
@@ -1,10 +1,9 @@
import React from "react";
-import { WeaHelpfulTip, WeaInput, WeaTab } from "ecCom";
+import { WeaHelpfulTip, WeaTab } from "ecCom";
import IssuedAndReissueTable from "./issuedAndReissueTable";
-import { Col, Row } from "antd";
+import PayrollItemsTable from "./payrollItemsTable";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
-import cs from "classnames";
import "./index.less";
@inject("calculateStore")
@@ -22,25 +21,23 @@ export default class EditSalaryDetail extends React.Component {
acctresultDetail(this.props.id);
}
- handleItemValueChange = (field, value, isInput) => {
- console.log(field, value, isInput);
+ handleItemValueChange = (field, value, isInput, groupId) => {
const { calculateStore: { acctresultDetailForm, setAcctresultDetailForm } } = this.props;
let form = { ...acctresultDetailForm };
- if (isInput === "inputItems") {
- form.inputItems = acctresultDetailForm.inputItems.map(item => {
- item = { ...item };
- if (item.salaryItemName === field) {
- item.resultValue = value;
+ if (isInput === "itemsByGroup") {
+ form.itemsByGroup = acctresultDetailForm.itemsByGroup.map(item => {
+ if (item.salarySobItemGroupId === groupId) {
+ return {
+ ...item,
+ salaryItems: _.map(item.salaryItems, it => {
+ if (it.salaryItemId === field) {
+ return { ...it, resultValue: value };
+ }
+ return { ...it };
+ })
+ };
}
- return item;
- });
- } else if (isInput === "formulaItems") {
- form.formulaItems = acctresultDetailForm.formulaItems.map(item => {
- item = { ...item };
- if (item.salaryItemName === field) {
- item.resultValue = value;
- }
- return item;
+ return { ...item };
});
} else if (isInput === "issuedAndReissueItems") {
form.issuedAndReissueItems = acctresultDetailForm.issuedAndReissueItems.map(item => {
@@ -53,7 +50,6 @@ export default class EditSalaryDetail extends React.Component {
}
setAcctresultDetailForm(form);
};
-
renderTableTr = (data, isInput) => {
const tables = [];
const len = data.length;
@@ -77,10 +73,10 @@ export default class EditSalaryDetail extends React.Component {
return tables;
};
-
render() {
const { calculateStore: { acctresultDetailForm } } = this.props;
const { selectedKey } = this.state;
+ const { itemsByGroup = [] } = toJS(acctresultDetailForm);
const topTab = [
{
title: "正常工资薪金所得",
@@ -96,14 +92,8 @@ export default class EditSalaryDetail extends React.Component {
基本信息
-
+
-
{
!_.isEmpty(acctresultDetailForm.employeeInfos) &&
@@ -123,69 +113,9 @@ export default class EditSalaryDetail extends React.Component {
/>
}
{
- selectedKey === "0" &&
-
-
-
输入项
-
-
- {
- acctresultDetailForm.inputItems && acctresultDetailForm.inputItems.map((item, index) => {
- const len = acctresultDetailForm.inputItems.length;
- return (
-
-
- {item.salaryItemName}
- {
- this.handleItemValueChange(item.salaryItemName, value, "inputItems");
- }}/>
-
-
- );
- })
- }
-
-
-
-
-
- 公式项
-
-
-
-
- {
- acctresultDetailForm.formulaItems && acctresultDetailForm.formulaItems.map((item, index) => {
- const len = acctresultDetailForm.formulaItems.length;
- return (
-
-
- {item.salaryItemName}
- {
- this.handleItemValueChange(item.salaryItemName, value, "formulaItems");
- }}/>
-
-
- );
- })
- }
-
-
-
-
+ selectedKey === "0" && _.map(itemsByGroup, item => {
+ return
;
+ })
}
{
selectedKey === "1" &&
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/index.less b/pc4mobx/hrmSalary/pages/calculateDetail/index.less
index 7cbb9b42..d0e161fd 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/index.less
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/index.less
@@ -127,44 +127,8 @@
}
}
}
-
- & > .ant-row {
- border: 1px solid rgba(0, 0, 0, .06);
- }
-
- .itemLabel {
- background-color: #fafafa;
- padding: 12px 6px;
- height: 45px;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- border-right: 1px solid rgba(0, 0, 0, .06);
- border-bottom: 1px solid rgba(0, 0, 0, .06);
- }
-
- .borderB-none {
- border-bottom: none !important;
- }
-
- .borderR-none {
- border-right: none !important;
- }
-
- .itemValue {
- padding: 12px 6px;
- display: flex;
- align-items: center;
- height: 45px;
- border-right: 1px solid rgba(0, 0, 0, .06);
- border-bottom: 1px solid rgba(0, 0, 0, .06);
- }
}
}
-
- .itemRow {
- line-height: 40px;
- }
}
.placeOnFileDetail {
@@ -255,6 +219,14 @@
top: 10px !important;
}
+ .wea-search-group {
+ padding: 0 !important;
+
+ .wea-title {
+ padding: 0 !important;
+ }
+ }
+
}
@media (min-width: 1260px) {
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/issuedAndReissueTable.js b/pc4mobx/hrmSalary/pages/calculateDetail/issuedAndReissueTable.js
index f18e620f..666c774a 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/issuedAndReissueTable.js
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/issuedAndReissueTable.js
@@ -40,7 +40,7 @@ class IssuedAndReissueTable extends Component {
}
},
{
- dataIndex: "salaryBackItemFormula",
+ dataIndex: "itemFormulaContent",
title:
核算公式
{
+ return {text};
+ }
+ },
+ {
+ dataIndex: "resultValue",
+ title:
+ {getLabel(111, "项目值")}
+
+ ,
+ width: "20%",
+ render: (text, record) => {
+ const { canEdit } = record;
+ return onChangeIssueReissueValue(record.salaryItemId, value, "itemsByGroup", salarySobItemGroupId)}
+ />;
+ }
+ },
+ {
+ dataIndex: "itemFormulaContent",
+ title:
+ {getLabel(111, "核算公式")}
+
+ ,
+ width: "65%",
+ render: (text, record) => {
+ return {_.isNil(text) ? "输入" : text};
+ }
+ }
+ ];
+ return (
+
+
+
+ );
+ }
+}
+
+export default PayrollItemsTable;
diff --git a/pc4mobx/hrmSalary/stores/calculate.js b/pc4mobx/hrmSalary/stores/calculate.js
index c5fb9a94..f842d9f0 100644
--- a/pc4mobx/hrmSalary/stores/calculate.js
+++ b/pc4mobx/hrmSalary/stores/calculate.js
@@ -3,7 +3,6 @@ import { message } from "antd";
import { WeaForm, WeaTableNew } from "comsMobx";
import * as API from "../apis/calculate";
-import { backCalculate } from "../apis/calculate";
const { TableStore } = WeaTableNew;
@@ -487,28 +486,26 @@ export class calculateStore {
// 薪资结果-编辑表单保存
@action
saveAcctResult = (recordId) => {
- let inputItems = this.acctresultDetailForm.inputItems.map(item => {
+ const itemsByGroupItems = _.reduce(this.acctresultDetailForm.itemsByGroup, (pre, cur) => {
+ return [
+ ...pre,
+ ..._.map(cur.salaryItems, it => {
+ return {
+ salaryItemId: it.salaryItemId,
+ resultValue: it.resultValue
+ };
+ })
+ ];
+ }, []);
+
+ const issuedAndReissueItems = this.acctresultDetailForm.issuedAndReissueItems.map(item => {
let record = {};
record.salaryItemId = item.salaryItemId;
record.resultValue = item.resultValue;
return record;
});
- let formulaItems = this.acctresultDetailForm.formulaItems.map(item => {
- let record = {};
- record.salaryItemId = item.salaryItemId;
- record.resultValue = item.resultValue;
- return record;
- });
-
- let issuedAndReissueItems = this.acctresultDetailForm.issuedAndReissueItems.map(item => {
- let record = {};
- record.salaryItemId = item.salaryItemId;
- record.resultValue = item.resultValue;
- return record;
- });
-
- let items = inputItems.concat(formulaItems).concat(issuedAndReissueItems);
+ let items = itemsByGroupItems.concat(issuedAndReissueItems);
let params = {
salaryAcctEmpId: recordId,
items