diff --git a/pc4mobx/hrmSalary/apis/ledger.js b/pc4mobx/hrmSalary/apis/ledger.js index 254c4643..6e7a3f17 100644 --- a/pc4mobx/hrmSalary/apis/ledger.js +++ b/pc4mobx/hrmSalary/apis/ledger.js @@ -282,3 +282,11 @@ export const getBackitemForm = params => { export const salarysobBackitemSave = params => { return postFetch("/api/bs/hrmsalary/salarysob/backitem/save", params); }; +//预览人员范围导入 +export const salarysobRangePreview = params => { + return postFetch("/api/bs/hrmsalary/salarysob/range/preview", params); +}; +//导入人员范围 +export const salarysobRangeImportData = params => { + return postFetch("/api/bs/hrmsalary/salarysob/range/importData", params); +}; diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAssociatedPersonnel.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAssociatedPersonnel.js index f77d31fa..55c61acd 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAssociatedPersonnel.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAssociatedPersonnel.js @@ -6,7 +6,7 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { message, Modal } from "antd"; +import { Button, message, Modal } from "antd"; import { WeaButtonIcon, WeaInputSearch, WeaTab } from "ecCom"; import PersonalScopeTable from "../../../components/PersonalScopeTable"; import PersonalScopeModal from "../../../components/PersonalScopeModal"; @@ -14,8 +14,13 @@ import { deleteLedgerPersonRange, getLedgerPersonRangeExclude, getLedgerPersonRangeInclude, + salarysobRangeImportData, + salarysobRangePreview, saveLedgerPersonRange } from "../../../apis/ledger"; +import ImportModal from "../../../components/importModal"; +import { importEmployColumns } from "../../taxAgent/columns"; + const APIFox = { listInclude: getLedgerPersonRangeInclude, @@ -34,6 +39,12 @@ class LedgerAssociatedPersonnel extends Component { searchValue: "", selectedKey: "listInclude", rowKeys: [], + previewDataSource: [], + importParams: { + visible: false, + step: 0, + importResult: {} + }, personalAddModal: { visible: false, title: "关联人员", @@ -82,9 +93,55 @@ class LedgerAssociatedPersonnel extends Component { } }); }; + /* + * Author: 黎永顺 + * Description:清空导入弹框列表数据 + * Params: + * Date: 2023/1/9 + */ + handleInitModal = () => { + this.setState({ + previewDataSource: [], + importParams: { + ...this.state.importParams, + importResult: {} + } + }); + }; + handleImportFile = (params) => { + const { editId: salarySobId } = this.props; + salarysobRangeImportData({ ...params, salarySobId }).then(({ status, data }) => { + if (status) { + data.errorData = data.errorNotice; + this.setState({ + importParams: { + ...this.state.importParams, + importResult: data + } + }); + } + }); + }; + salarysobRangePreview = (params) => { + salarysobRangePreview(params).then(({ status, data }) => { + if (status) { + const { preview } = data; + this.setState({ + previewDataSource: preview + }); + } + }); + }; render() { - const { selectedKey, searchValue, rowKeys, personalAddModal } = this.state; + const { + selectedKey, + searchValue, + rowKeys, + personalAddModal, + importParams, + previewDataSource + } = this.state; const { taxAgentStore: { showOperateBtn }, editId, saveSalarySobId } = this.props; const topTab = [ { @@ -97,6 +154,14 @@ class LedgerAssociatedPersonnel extends Component { } ]; const btns = showOperateBtn ? [ + , this.setState({ selectedKey })} /> this.setState({ rowKeys })} /> + {/*关联人员范围导入*/} + {importParams.visible && ( + { + this.handleInitModal(); + }} + isInit={false} + columns={importEmployColumns} + slideDataSource={previewDataSource} + step={importParams.step} + setStep={(step) => { + this.setState({ importParams: { ...this.state.importParams, step } }); + }} + importResult={importParams.importResult} + onFinish={() => { + this.setState({ + importParams: { + ...this.state.importParams, + visible: false + } + }, () => this.personalScopeTableRef.getPersonalScopeList()); + }} + previewImport={(params) => this.salarysobRangePreview(params)} + importFile={(params) => this.handleImportFile(params)} + templateLink={`/api/bs/hrmsalary/salarysob/range/downloadTemplate?salarySobId=${editId}`} + visiable={importParams.visible} + onCancel={() => { + this.setState({ importParams: { ...this.state.importParams, visible: false } }); + }} + /> + )} {/*新增人员范围*/} { taxAgentRangePreview(params).then(({ status, data }) => { if (status) { - const { headers, list } = data; + const { preview } = data; this.setState({ - previewColumns: headers.map((item, index) => { - return { - key: index, - title: item, - dataIndex: index - }; - }), - previewDataSource: list.map(item => { - let result = {}; - item.map((i, index) => { - result[index] = i; - }); - return result; - }) + previewDataSource: preview }); } }); @@ -121,7 +109,6 @@ export default class SlideTaxagentUser extends React.Component { searchValue, addTaxagentModalVisible, importParams, - previewColumns, previewDataSource } = this.state; const { @@ -279,7 +266,7 @@ export default class SlideTaxagentUser extends React.Component { this.handleInitModal(); }} isInit={false} - columns={previewColumns} + columns={importEmployColumns} slideDataSource={previewDataSource} step={importParams.step} setStep={(step) => {