From 84791cc69fc859931bc3a4d5cc17d0e39dbd06a1 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 Feb 2023 14:55:12 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E4=B8=8B=E5=AF=B9=E6=AF=94=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/calculateDetail/compareDetail.js | 43 ++++++++++---------
.../standingBookOfflineComparison/index.js | 15 ++++---
2 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/compareDetail.js b/pc4mobx/hrmSalary/pages/calculateDetail/compareDetail.js
index 89423428..cdb471d8 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/compareDetail.js
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/compareDetail.js
@@ -23,9 +23,7 @@ export default class CompareDetail extends React.Component {
}
componentWillMount() {
- let id = getQueryString("id");
- this.id = id;
-
+ this.id = getQueryString("id");
const { calculateStore: { fetchComparisonResultList } } = this.props;
const { onlyDiffEmployee, onlyDiffSalaryItem } = this.state;
let params = {
@@ -37,25 +35,31 @@ export default class CompareDetail extends React.Component {
fetchComparisonResultList(params);
}
- getColumns(columns) {
+ getColumns = (columns) => {
let newColumns = [...columns];
newColumns.map(item => {
let n = Number(item.dataIndex);
if (!isNaN(n)) { // 数字
item.render = (text, record) => {
+ const showDifference = record[`${item.dataIndex}_type`] === "number";
+ const { acctResultValue, excelResultValue } = record[item.dataIndex];
return (
-
系统值:{record[item.dataIndex].acctResultValue}
-
线下值:{record[item.dataIndex].excelResultValue}
-
差值:{calculateCompares(record[item.dataIndex].acctResultValue, record[item.dataIndex].excelResultValue)}
+
系统值:{acctResultValue}
+
线下值:{excelResultValue}
+ {
+ showDifference &&
+
+ 差值:{calculateCompares(acctResultValue, excelResultValue)}
+
+ }
);
};
}
});
return newColumns;
- }
+ };
// 导入
handleImportClick() {
@@ -218,7 +222,10 @@ export default class CompareDetail extends React.Component {
loading={loading}
dataSource={comparisonResultPageInfo.list ? comparisonResultPageInfo.list : []}
columns={this.getColumns(comparisonResultColumns ? comparisonResultColumns : [])}
- scroll={{ x: this.getColumns(comparisonResultColumns ? comparisonResultColumns : []).length * 150, y: `calc(100vh - 199px)` }}
+ scroll={{
+ x: this.getColumns(comparisonResultColumns ? comparisonResultColumns : []).length * 150,
+ y: `calc(100vh - 199px)`
+ }}
total={comparisonResultPageInfo.total}
current={comparisonResultPageInfo.pageNum}
pageSize={this.pageInfo.pageSize}
@@ -253,14 +260,8 @@ export default class CompareDetail extends React.Component {
}
// 计算差值
-export const calculateCompares=(systemValue, excelValue)=> {
- if (systemValue == null || excelValue == null) {
- return "";
- }
- let systemNum = Number(systemValue);
- let excelNum = Number(excelValue);
- if (!isNaN(systemNum) || !isNaN(excelNum)) { // 数字
- return (systemNum - excelNum).toFixed(2);
- }
- return "";
-}
+export const calculateCompares = (systemValue = 0, excelValue = 0) => {
+ const systemNum = Number(systemValue);
+ const excelNum = Number(excelValue);
+ return (systemNum - excelNum).toFixed(2);
+};
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookOfflineComparison/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookOfflineComparison/index.js
index 00e6d513..f6d366d1 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookOfflineComparison/index.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookOfflineComparison/index.js
@@ -59,12 +59,13 @@ class StandingBookOfflineComparison extends Component {
width: 150,
fixed: idx < 2 ? "left" : false,
render: (text, record) => {
+ const { acctResultValue, excelResultValue } = record[it.dataIndex] || {};
if (Object.prototype.toString.call(text) === "[object Object]") {
return
- 系统值:{record[it.dataIndex].acctResultValue || 0}
- 线下值:{record[it.dataIndex].excelResultValue || 0}
+ 系统值:{acctResultValue}
+ 线下值:{excelResultValue}
- 差值:{calculateCompares(record[it.dataIndex].acctResultValue, record[it.dataIndex].excelResultValue)}
+ 差值:{calculateCompares(acctResultValue, excelResultValue)}
;
}
@@ -77,13 +78,13 @@ class StandingBookOfflineComparison extends Component {
}
});
};
- handleExport= ()=> {
+ handleExport = () => {
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
const { onlyDiffEmployee } = this.state;
- let url= `/api/bs/hrmsalary/siaccount/comparisonresult/export?paymentStatus=0&billMonth=${billMonth}&paymentOrganization=${paymentOrganization}&onlyDiffEmployee=${onlyDiffEmployee === "1"}`;
- window.open(`${window.location.origin}${url}`)
- }
+ let url = `/api/bs/hrmsalary/siaccount/comparisonresult/export?paymentStatus=0&billMonth=${billMonth}&paymentOrganization=${paymentOrganization}&onlyDiffEmployee=${onlyDiffEmployee === "1"}`;
+ window.open(`${window.location.origin}${url}`);
+ };
render() {
const { onlyDiffEmployee, showSearchAd, pageInfo, dataSource, columns, loading, importVisible } = this.state;