diff --git a/pc4mobx/hrmSalary/apis/standingBook.js b/pc4mobx/hrmSalary/apis/standingBook.js index c4ae0be0..5182ea00 100644 --- a/pc4mobx/hrmSalary/apis/standingBook.js +++ b/pc4mobx/hrmSalary/apis/standingBook.js @@ -197,3 +197,11 @@ export const getBalancePaymentGroup = params => { export const addNewBalance = params => { return postFetch("/api/bs/hrmsalary/siaccount/detail/addNewBalance", params); }; +// 导入社保台账添加表头字段缓存-正常缴纳以及补缴 +export const cacheWelfareListField = (params) => { + return postFetch("/api/bs/hrmsalary/siaccount/cacheWelfareList", params); +}; +// 导入社保台账添加表头字段缓存-补差缓存 +export const cacheBalanceWelfareList = (params) => { + return postFetch("/api/bs/hrmsalary/siaccount/cacheBalanceWelfareList", params); +}; diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js b/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js index f288cc35..99d55f54 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js @@ -116,6 +116,7 @@ export default class SelectFieldModal extends React.Component { this.props.onAdd(this.fieldData); this.props.onCancel(); }; + //薪资核算导入缓存字段 cacheImportField = () => { const salaryItemList = _.reduce(_.keys(this.fieldData), (pre, cur) => ([...pre, ...this.fieldData[cur]]), []); const salaryItems = _.map(_.filter(salaryItemList, it => !!it.checked), item => item.salaryItemId); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/importHeaderSetDialog.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/importHeaderSetDialog.js new file mode 100644 index 00000000..2fe7cb3d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/importHeaderSetDialog.js @@ -0,0 +1,86 @@ +/* + * Author: 黎永顺 + * name: 社保福利台账-核算-导入表头设置 + * Description: + * Date: 2024/3/5 + */ +import React, { Component } from "react"; +import { Button, Col, Row } from "antd"; +import { WeaCheckbox, WeaDialog, WeaLocaleProvider } from "ecCom"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class ImportHeaderSetDialog 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: nextProps.selectItems }); + } else { + this.setState({ itemsCheckeds: [], showOnlyChecked: false }); + } + } + + handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) }); + handleSelectAll = (checked) => { + const { itemsByGroup } = this.props; + if (checked === "1") { + this.setState({ itemsCheckeds: _.map(itemsByGroup, it => it.fieldId) }); + } else { + this.setState({ itemsCheckeds: [] }); + } + }; + + render() { + const { showOnlyChecked, itemsCheckeds } = this.state; + const { itemsByGroup } = this.props; + let dataSource = _.map(itemsByGroup, it => { + return { ...it, checked: itemsCheckeds.includes(it.fieldId) }; + }); + if (showOnlyChecked) { + dataSource = _.filter(dataSource, it => !!it.checked); + } + return ( + this.props.onAdd(itemsCheckeds)}>{getLabel(111, "添加")}, + + ]} + bottomLeft={ + + + + + } + > + { + + { + !_.isEmpty(dataSource) ? + _.map(dataSource, it => { + const { fieldId, salaryItemName, checked } = it; + return + this.setState({ itemsCheckeds: _.xorWith(itemsCheckeds, [fieldId], _.isEqual) })}/> + ; + }) : 暂无数据 + } + + } + + ); + } +} + +export default ImportHeaderSetDialog; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less index 2ceecea0..235eba25 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less @@ -290,3 +290,21 @@ } } } + +//导入头部设置 +.headerSetWrapper { + .ant-modal-body { + .ant-row { + padding: 16px 25px; + } + } + + .ant-col-8 { + padding: 0 8px !important; + } + + .wea-content { + padding: 8px 16px 0; + } +} + diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/makeupDifference.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/makeupDifference.js index 057f8379..9ff5fb28 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/makeupDifference.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/makeupDifference.js @@ -13,15 +13,23 @@ import * as API from "../../../../apis/standingBook"; import { calcPageNo } from "../../../../util"; import RegList from "./regList"; import RegEditDetial from "./regEditDetial"; -import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal"; import AddCompensationPersonnelDialog from "./addCompensationPersonnelDialog"; +import StandingBookCalcImportDialog from "./standingBookCalcImportDialog"; import "./index.less"; class MakeupDifference extends Component { constructor(props) { super(props); this.state = { - selectKey: [], fieldData: {}, loading: { save: false }, importDiffModal: { visible: false }, + selectKey: [], loading: { save: false }, + importDiffModal: { + visible: false, + fieldUrl: "getBalanceWelfareList", + tmpUrl: "exportSiaccountWelfarebalanceimporttemplatetetemplate", + cacheUrl: "cacheBalanceWelfareList", + importUrl: "importBalanceInsuranceDetail", + importparams: {} + }, returnEditPersonSlide: { title: "", editId: "", visible: false }, @@ -65,7 +73,12 @@ class MakeupDifference extends Component { }); break; case "import": - this.setState({ importDiffModal: { ...importDiffModal, visible: true } }); + this.setState({ + importDiffModal: { + ...importDiffModal, visible: true, + importparams: { billMonth: getQueryString("billMonth") } + } + }); break; case "export": const url = `${window.location.origin}/api/bs/hrmsalary/welfare/balance/export?billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`; @@ -103,7 +116,7 @@ class MakeupDifference extends Component { render() { const billMonth = getQueryString("billMonth"); - const { selectKey, importDiffModal, fieldData, returnEditPersonSlide, addPersonalDialog } = this.state; + const { selectKey, importDiffModal, returnEditPersonSlide, addPersonalDialog } = this.state; return (
isRefresh && this.diffListRef.recessionList())} /> {/*导入补差*/} - { - importDiffModal.visible && - this.setState({ fieldData })} - onCancel={() => { - this.setState({ importDiffModal: { ...importDiffModal, visible: false }, fieldData: {} }, () => { - const name = this.regTopRef.state.name; - this.diffListRef.recessionList({ userName: name }); - }); - }} - isStandingBook - standingBookType="difference" - /> - } + this.setState({ + importDiffModal: { ...importDiffModal, visible: false } + }, () => isInit && this.diffListRef.recessionList())}/>
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js index 2fe404a5..45f1a728 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js @@ -11,7 +11,7 @@ import { WeaFormItem, WeaInput, WeaSearchGroup, WeaTab } from "ecCom"; import { calcPageNo } from "../../../../util"; import { getQueryString } from "../../../../util/url"; import ProgressModal from "../../../../components/progressModal"; -import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal"; +import StandingBookCalcImportDialog from "./standingBookCalcImportDialog"; import AdjustmentSlide from "./adjustmentSlide"; import { getCalculateProgress } from "../../../../apis/calculate"; import RegEditDetial from "./regEditDetial"; @@ -48,7 +48,8 @@ export default class NormalIndex extends Component { progress: 0, fieldData: {}, //选中的表单头信息 importParams: { //导入信息的弹框表示 - visible: false + visible: false, fieldUrl: "getWelfareList", tmpUrl: "exportSiaccountWelfareImporttemplate", + cacheUrl: "cacheWelfareListField", importUrl: "importInsuranceAcctDetail", importparams: {} }, returnEditPersonSlide: { title: "", @@ -473,7 +474,12 @@ export default class NormalIndex extends Component { ]; const btn4 = [ + onClick={() => this.setState({ + importParams: { + ...importParams, visible: true, + tmpUrl: selectedKey === "1" ? "exportSiaccountWelfareImporttemplate" : "exportSiaccountWelfaresupplyimporttemplatetemplate" + } + })}>导入数据 ]; const btn5 = [ @@ -544,29 +550,10 @@ export default class NormalIndex extends Component { progress={this.state.progress} /> {/*导入弹框*/} - { - importParams.visible && - { - this.setState({ - fieldData - }); - }} - onCancel={() => { - this.setState({ importParams: { ...importParams, visible: false }, fieldData: {} }, () => { - const { billMonth, selectedKey, paymentOrganization } = this.props; - const { current } = this.state; - selectedKey === "1" - ? this.getNormalList({ billMonth, current, paymentOrganization }) - : this.getSupplementaryList({ billMonth, current, paymentOrganization }); - }); - }} - isStandingBook - standingBookTabKey={selectedKey} - /> - } + this.setState({ + importParams: { ...importParams, visible: false } + }, () => isInit && this.handleSearch())}/> {/* table */}
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/standingBookCalcImportDialog.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/standingBookCalcImportDialog.js new file mode 100644 index 00000000..0dc97e42 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/standingBookCalcImportDialog.js @@ -0,0 +1,136 @@ +/* + * Author: 黎永顺 + * name: 社保福利台账-核算-导入 + * Description: + * Date: 2024/3/5 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { Badge, Button, message } from "antd"; +import ImportDialog from "../../../../components/importDialog"; +import ImportHeaderSetDialog from "./importHeaderSetDialog"; +import * as API from "../../../../apis/standingBook"; +import { getQueryString } from "../../../../util/url"; + +const getLabel = WeaLocaleProvider.getLabel; + +class StandingBookCalcImportDialog extends Component { + constructor(props) { + super(props); + this.state = { + headerFieldsDialog: { visible: false, itemsByGroup: [], selectItems: [] }, + importDialog: { + visible: false, title: "", nextloading: false, + link: null, importResult: {}, imageId: "", + previewUrl: "/api/bs/hrmsalary/siaccount/welfare/preview" + } + }; + } + + async componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { fieldUrl } = nextProps; + const { data } = await API[fieldUrl](); + this.setState({ + importDialog: { + ...this.state.importDialog, link: this.handleExportTemp, title: getLabel(24023, "数据导入") + }, + headerFieldsDialog: { + ...this.state.headerFieldsDialog, itemsByGroup: data, + selectItems: _.map(_.filter(data, k => k.checked), o => o.fieldId) + } + }); + } + this.setState({ importDialog: { ...this.state.importDialog, visible: nextProps.visible } }); + } + + handleImport = (payload) => { + const { importDialog, headerFieldsDialog: { selectItems } } = this.state; + if (_.isEmpty(selectItems)) { + message.error(getLabel(111, "请选择表头字段")); + } else { + const { importUrl, importparams = {} } = this.props; + this.setState({ importDialog: { ...importDialog, nextloading: true } }); + API[importUrl]({ ...payload, ...importparams }).then(({ data, status, errormsg }) => { + this.setState({ importDialog: { ...importDialog, nextloading: false } }); + if (status) { + this.setState({ + importDialog: { ...importDialog, ...payload, importResult: data } + }); + } else { + message.warning(errormsg); + } + }).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } })); + } + }; + handleExportTemp = () => { + const { tmpUrl } = this.props; + const { headerFieldsDialog: { selectItems, itemsByGroup } } = this.state; + if (_.isEmpty(selectItems)) { + message.error(getLabel(111, "请选择表头字段")); + } else { + const billMonth = getQueryString("billMonth"); + const paymentOrganization = getQueryString("paymentOrganization"); + const payload = { + billMonth, + welfareNames: _.map(_.filter(itemsByGroup, k => selectItems.includes(k.fieldId)), o => o.salaryItemName), + paymentOrganization: Number(paymentOrganization) + }; + const promise = API[tmpUrl](payload); + } + }; + handleSelectedField = () => { + this.setState({ + headerFieldsDialog: { + ...this.state.headerFieldsDialog, visible: true + } + }); + }; + /* + * Author: 黎永顺 + * Description:表单选项 + * Params: + * Date: 2023/9/18 + */ + renderFormComponent = () => { + const { selectItems } = this.state.headerFieldsDialog; + return
+ + + +
; + }; + + render() { + const { importDialog, headerFieldsDialog } = this.state; + const { cacheUrl } = this.props; + return ( + + this.setState(({ + importDialog: { ...importDialog, importResult: {}, imageId: "" } + }))} + nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })} + nextUplaodCallback={imageId => this.handleImport({ imageId })} + /> + {/*表头设置*/} + this.setState({ + headerFieldsDialog: { ...headerFieldsDialog, visible: false } + })} + onAdd={selectItems => this.setState({ + headerFieldsDialog: { ...headerFieldsDialog, visible: false, selectItems } + }, () => { + const { selectItems: welfareNames } = this.state.headerFieldsDialog; + const promise = API[cacheUrl]({ welfareNames }); + })} + /> + + ); + } +} + +export default StandingBookCalcImportDialog;