线下对比页面修改

This commit is contained in:
黎永顺 2023-02-10 14:55:12 +08:00
parent d60d3db993
commit 84791cc69f
2 changed files with 30 additions and 28 deletions

View File

@ -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 (
<div>
<div>系统值{record[item.dataIndex].acctResultValue}</div>
<div>线下值{record[item.dataIndex].excelResultValue}</div>
<div
style={{ color: "red" }}>差值{calculateCompares(record[item.dataIndex].acctResultValue, record[item.dataIndex].excelResultValue)}</div>
<div>系统值{acctResultValue}</div>
<div>线下值{excelResultValue}</div>
{
showDifference &&
<div style={{ color: "red" }}>
差值{calculateCompares(acctResultValue, excelResultValue)}
</div>
}
</div>
);
};
}
});
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);
};

View File

@ -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 <React.Fragment>
<div>系统值{record[it.dataIndex].acctResultValue || 0}</div>
<div>线下值{record[it.dataIndex].excelResultValue || 0}</div>
<div>系统值{acctResultValue}</div>
<div>线下值{excelResultValue}</div>
<div style={{ color: "red" }}>
差值{calculateCompares(record[it.dataIndex].acctResultValue, record[it.dataIndex].excelResultValue)}
差值{calculateCompares(acctResultValue, excelResultValue)}
</div>
</React.Fragment>;
}
@ -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;