From 778ca2655b6da3b8a22b3e6b0f5858b564a2ef6d 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, 17 Jul 2023 11:26:13 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=96=AA=E8=B5=84=E6=A0=B8=E7=AE=97?=
=?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=97=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hrmSalary/pages/calculateDetail/index.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/index.js b/pc4mobx/hrmSalary/pages/calculateDetail/index.js
index 72ce7a6b..c81deac9 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/index.js
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/index.js
@@ -3,14 +3,24 @@ import UserSure from "./userSure";
import { inject, observer } from "mobx-react";
import SalaryDetail from "./salaryDetail";
import { Button, Dropdown, Menu, message, Modal } from "antd";
-import { WeaBrowser, WeaCheckbox, WeaDropdown, WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect, WeaTab } from "ecCom";
+import {
+ WeaBrowser,
+ WeaCheckbox,
+ WeaDropdown,
+ WeaFormItem,
+ WeaInput,
+ WeaLocaleProvider,
+ WeaSearchGroup,
+ WeaSelect,
+ WeaTab
+} from "ecCom";
import { convertToUrlString, getQueryString } from "../../util/url";
import AcctResultImportModal from "./acctResult/importModal/acctResultImportModal";
import ProgressModal from "../../components/progressModal";
import { salaryacctAcctresultCheckAuth } from "../../apis/calculate";
import Authority from "../mySalary/authority";
-
+const getLabel = WeaLocaleProvider.getLabel;
const { ButtonSelect } = WeaDropdown;
@inject("calculateStore", "salaryFileStore", "taxAgentStore")
@@ -239,6 +249,9 @@ export default class CalculateDetail extends React.Component {
window.open(
`/api/bs/hrmsalary/salaryacct/acctresult/export?salaryAcctRecordId=${this.id}&ids=&${convertToUrlString(payload)}`
);
+ } else if (e.key === "4") {
+ // 自定义导出
+
}
};
@@ -291,6 +304,7 @@ export default class CalculateDetail extends React.Component {
导入
线下对比
导出全部
+ {getLabel(111, "自定义导出")}
);
From 57958f9bf909f52506387a5989ff56b4f9845092 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, 17 Jul 2023 16:49:02 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E8=B5=84?=
=?UTF-8?q?=E6=A0=B8=E7=AE=97=E6=8C=89=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=97?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/calculate.js | 17 +++
.../calculateDetail/customExportDialog.js | 127 ++++++++++++++++++
.../hrmSalary/pages/calculateDetail/index.js | 44 +++++-
3 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 pc4mobx/hrmSalary/pages/calculateDetail/customExportDialog.js
diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js
index 2ffee227..b14015a7 100644
--- a/pc4mobx/hrmSalary/apis/calculate.js
+++ b/pc4mobx/hrmSalary/apis/calculate.js
@@ -568,3 +568,20 @@ export const cacheImportField = (params) => {
export const salaryacctAcctresultCheckAuth = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/acctresult/checkAuth", "GET", params);
};
+
+//薪资核算-导出核算结果前生成可选的薪资项目
+export const getExportField = params => {
+ return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/acctresult/exportField", "GET", params);
+};
+
+//薪资核算-导出薪资核算添加表头字段缓存
+export const customCacheExportField = (params) => {
+ return fetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheExportField", {
+ method: "POST",
+ mode: "cors",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(params)
+ }).then(res => res.json());
+};
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/customExportDialog.js b/pc4mobx/hrmSalary/pages/calculateDetail/customExportDialog.js
new file mode 100644
index 00000000..601890a1
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/customExportDialog.js
@@ -0,0 +1,127 @@
+/*
+ * Author: 黎永顺
+ * name: 薪资核算-自定义导出字段弹框
+ * Description:
+ * Date: 2023/7/17
+ */
+import React, { Component } from "react";
+import { Button, Col, message, Row } from "antd";
+import { WeaCheckbox, WeaDialog, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
+import { customCacheExportField } from "../../apis/calculate";
+import { convertToUrlString, getQueryString } from "../../util/url";
+import "./acctResult/importModal/index.less";
+
+
+const { getLabel } = WeaLocaleProvider;
+
+class CustomExportDialog extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ itemsCheckeds: [],
+ showOnlyChecked: false
+ };
+ }
+
+ componentWillReceiveProps(nextProps, nextContext) {
+ if (nextProps.visible !== this.props.visible && nextProps.visible) {
+ this.setState({
+ itemsCheckeds: !_.isEmpty(nextProps.checkItems) ? nextProps.checkItems : []
+ });
+ }
+ }
+
+ customExportClick = () => {
+ const { searchItemsValue } = this.props;
+ const { itemsCheckeds } = this.state;
+ customCacheExportField({ salaryItems: _.map(itemsCheckeds, it => it.toString()) }).then(({ status, errorMsg }) => {
+ if (status) {
+ const { consolidatedTaxation, ...extra } = searchItemsValue;
+ const payload = { ...extra, consolidatedTaxation: consolidatedTaxation === "0" ? "" : consolidatedTaxation };
+ window.open(
+ `/api/bs/hrmsalary/salaryacct/acctresult/exportWithCustomFields?salaryAcctRecordId=${getQueryString("id")}&ids=&${convertToUrlString(payload)}&salaryItemIds=${itemsCheckeds.join(",")}`
+ );
+ } else {
+ message.error(errorMsg);
+ }
+ });
+ };
+ handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) });
+ handleSelectGroupAll = (groupId, checked) => {
+ const { itemsCheckeds } = this.state;
+ const { itemsByGroup } = this.props;
+ _.map(itemsByGroup, item => {
+ if (item.salarySobItemGroupId === groupId) {
+ if (!!Number(checked)) {
+ this.setState({
+ itemsCheckeds: [...itemsCheckeds, ..._.map(item.salaryItems, child => child.salaryItemId)]
+ });
+ } else {
+ this.setState({
+ itemsCheckeds: _.differenceWith(itemsCheckeds, _.map(item.salaryItems, child => child.salaryItemId), _.isEqual)
+ });
+ }
+ }
+ });
+ };
+
+ render() {
+ const { showOnlyChecked, itemsCheckeds } = this.state;
+ const { itemsByGroup } = this.props;
+ let dataSource = _.map(itemsByGroup, item => {
+ return {
+ ...item,
+ salaryItems: _.map(item.salaryItems, child => {
+ return { ...child, checked: itemsCheckeds.includes(child.salaryItemId) };
+ })
+ };
+ });
+ if (showOnlyChecked) {
+ dataSource = _.map(dataSource, item => {
+ return { ...item, salaryItems: _.filter(item.salaryItems, it => !!it.checked) };
+ });
+ }
+ return (
+ {getLabel(17416, "导出")},
+
+ ]}
+ bottomLeft={}
+ >
+ {
+ _.map(dataSource, item => {
+ const { salarySobItemGroupName, salaryItems, salarySobItemGroupId } = item;
+ const value = _.every(salaryItems, it => !!it.checked) ? "1" : "0";
+ return this.handleSelectGroupAll(salarySobItemGroupId, val)}/>}>
+
+ {
+ !_.isEmpty(salaryItems) ?
+ _.map(salaryItems, it => {
+ const { salaryItemId, salaryItemName, checked } = it;
+ return
+ this.setState({ itemsCheckeds: _.xorWith(itemsCheckeds, [salaryItemId], _.isEqual) })}/>
+ ;
+ }) : {getLabel(83553, "暂无数据")}
+ }
+
+ ;
+ })
+ }
+
+ );
+ }
+}
+
+export default CustomExportDialog;
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/index.js b/pc4mobx/hrmSalary/pages/calculateDetail/index.js
index c81deac9..d43cfb66 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/index.js
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/index.js
@@ -17,7 +17,8 @@ import {
import { convertToUrlString, getQueryString } from "../../util/url";
import AcctResultImportModal from "./acctResult/importModal/acctResultImportModal";
import ProgressModal from "../../components/progressModal";
-import { salaryacctAcctresultCheckAuth } from "../../apis/calculate";
+import { getExportField, salaryacctAcctresultCheckAuth } from "../../apis/calculate";
+import CustomExportDialog from "./customExportDialog";
import Authority from "../mySalary/authority";
const getLabel = WeaLocaleProvider.getLabel;
@@ -46,7 +47,10 @@ export default class CalculateDetail extends React.Component {
progress: 0,
accountIds: [],
accountExceptInfo: "",
- calculateAuth: false
+ calculateAuth: false,
+ customExportParams: {
+ visible: false, checkItems: [], itemsByGroup: []
+ }
};
this.id = "";
this.timer = null;
@@ -251,10 +255,24 @@ export default class CalculateDetail extends React.Component {
);
} else if (e.key === "4") {
// 自定义导出
-
+ this.getExportField();
}
};
+ getExportField = () => {
+ getExportField({ salaryAcctRecordId: getQueryString("id") }).then(({ status, data }) => {
+ if (status) {
+ const { checkItems, itemsByGroup } = data;
+ this.setState({
+ customExportParams: {
+ visible: true,
+ checkItems, itemsByGroup
+ }
+ });
+ }
+ });
+ };
+
// 导入表单添加表头回调
handleAcctModalAdd(fieldData) {
this.setState({
@@ -297,7 +315,14 @@ export default class CalculateDetail extends React.Component {
};
render() {
- const { selectedKey, acctResultImportVisiable, showSearchAd, calculateAuth } = this.state;
+ const {
+ selectedKey,
+ acctResultImportVisiable,
+ showSearchAd,
+ calculateAuth,
+ customExportParams,
+ searchItemsValue
+ } = this.state;
const { taxAgentStore: { payrollPermission } } = this.props;
const menu = (