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 1/2] =?UTF-8?q?=E7=BA=BF=E4=B8=8B=E5=AF=B9=E6=AF=94?= =?UTF-8?q?=E9=A1=B5=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; From f39f70de254375743eea7e201ef68d90e65acaf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 13 Feb 2023 17:24:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E5=B0=8F=E6=95=B0=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/mySalary/index.js | 115 ++++++------------ .../archives/accumulationFundForm.js | 2 +- .../archives/otherForm.js | 9 +- .../archives/socialSecurityForm.js | 4 +- 4 files changed, 41 insertions(+), 89 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index 43e22b86..16677838 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -1,6 +1,6 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import { Button, DatePicker } from "antd"; +import { DatePicker } from "antd"; import { WeaTop } from "ecCom"; import { renderNoright } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from "../../components/customTab"; @@ -20,10 +20,10 @@ export default class MySalary extends React.Component { this.state = { value: "", selectedKey: "0", - salaryBillVisible: false + salaryBillVisible: false, + salaryInfoId: "", + salaryRange: [moment().format("YYYY-MM"), moment().format("YYYY-MM")] }; - this.salaryInfoId = ""; - this.range = []; this.pageInfo = { current: 1, pageSize: 10 }; this.historyPageInfo = { current: 1, pageSize: 10 }; } @@ -34,12 +34,12 @@ export default class MySalary extends React.Component { } // 查看工资单 - handleView(record) { - this.salaryInfoId = record.id; + handleView = (record) => { this.setState({ - salaryBillVisible: true + salaryBillVisible: true, + salaryInfoId: record.id }); - } + }; getColumns() { const { mySalaryStore: { myBillTableStore } } = this.props; @@ -71,45 +71,41 @@ export default class MySalary extends React.Component { } // 区间改变事件 - handleSalaryRangePickerChange(range) { - const { mySalaryStore: { mySalaryBillList } } = this.props; - const isNull = _.every(range, it => !!it); - if (!_.isEmpty(range) && isNull) { - this.range = range.map(item => moment(item).format("YYYY-MM")); - mySalaryBillList(this.range, this.pageInfo); - } else { - mySalaryBillList([], this.pageInfo); - } - } + handleSalaryRangePickerChange = (range) => { + this.setState({ + salaryRange: range.map(item => moment(item).format("YYYY-MM")) + }, () => { + const { mySalaryStore: { mySalaryBillList } } = this.props; + const isNull = _.every(range, it => !!it); + if (!_.isEmpty(range) && isNull) { + mySalaryBillList(this.state.salaryRange, this.pageInfo); + } else { + mySalaryBillList([], this.pageInfo); + } + }); + }; - handleTabChange(selectedKey) { + handleTabChange = (selectedKey) => { if (selectedKey == "2") { const { mySalaryStore: { getRecordList } } = this.props; getRecordList(); } - } + }; - handlePageChange() { + handlePageChange = () => { const { mySalaryStore: { mySalaryBillList } } = this.props; - mySalaryBillList(this.range, this.pageInfo); - } + mySalaryBillList(this.state.salaryRange, this.pageInfo); + }; - handleHistoryPageChange() { + handleHistoryPageChange = () => { const { mySalaryStore: { getRecordList } } = this.props; getRecordList(this.historyPageInfo); - } + }; render() { const { mySalaryStore } = this.props; - const { - loading, - hasRight, - form, - setMySalaryBill, - doSearch, - setShowSearchAd - } = mySalaryStore; + const { loading, hasRight, setMySalaryBill } = mySalaryStore; const { myBillDataSource, recordListColumns, @@ -117,41 +113,13 @@ export default class MySalary extends React.Component { recordListPageInfo, myBillPageInfo } = mySalaryStore; - const { salaryBillVisible } = this.state; - if (!hasRight && !loading) { // 无权限处理 - return renderNoright(); - } - - const rightMenu = [// 右键菜单 - // { - // key: 'BTN_COLUMN', - // icon: , - // content: '显示列定制', - // onClick: this.showColumn - // }, - ]; - const collectParams = { // 收藏功能配置 - favname: "我的薪资福利", - favouritetype: 1, - objid: 0, - link: "wui/index.html#/ns_demo03/index", - importantlevel: 1 - }; - const adBtn = [ // 高级搜索内部按钮 - , - , - - ]; - + const { salaryBillVisible, salaryRange, salaryInfoId } = this.state; + if (!hasRight && !loading) return renderNoright(); const topTab = [ { title: "工资单", viewcondition: "0" }, - // { - // title: "社保福利", - // viewcondition: "1" - // }, { title: "调薪记录", viewcondition: "2" @@ -163,23 +131,10 @@ export default class MySalary extends React.Component { return (
薪资所属月: this.handleSalaryRangePickerChange(value)} />
); - } else if (this.state.selectedKey == "1") { - return (
缴纳月份: -
-
- -
- - 至 - -
- -
-
-
); } else { return (
); } @@ -194,8 +149,6 @@ export default class MySalary extends React.Component { icon={} // 左侧图标 iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={false} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 > { - this.setState({ salaryBillVisible: false }, () => { + this.setState({ salaryBillVisible: false, salaryInfoId: "" }, () => { setMySalaryBill({}); }); }} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index ff516018..5b31f910 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -165,7 +165,7 @@ export default class AccumulationFundForm extends React.Component { { this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' }); }} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index 388c92b4..cd001750 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -1,6 +1,5 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import {toJS} from 'mobx'; import { Col, Row } from "antd"; import { WeaCheckbox, WeaDatePicker, WeaInputNumber, WeaSelect } from "ecCom"; import GroupCard from "../../../components/groupCard"; @@ -36,8 +35,8 @@ export default class OtherForm extends React.Component { let form = { ...otherForm }; form.data = request; setOtherForm(form); - Object.keys(params).length>1 && - onChangeRecordOtherSchemeId(params.otherSchemeId) + Object.keys(params).length > 1 && + onChangeRecordOtherSchemeId(params.otherSchemeId); } //基数变化 @@ -152,9 +151,9 @@ export default class OtherForm extends React.Component { { - this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' }); + this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : "0" }); }} /> diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 7f86be27..7b4fdcbc 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -167,9 +167,9 @@ export default class SocialSecurityForm extends React.Component { { - this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' }); + this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : "0" }); }} />