From 6ea3bfef6ee8d717f49a2513083a5cd5b0cbc5ea Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Fri, 11 Mar 2022 16:13:36 +0800 Subject: [PATCH] =?UTF-8?q?import=20modal=20=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/cumSituation.js | 26 ++++- pc4mobx/hrmSalary/apis/otherDeduct.js | 36 +++++- .../components/importModal/columns.js | 62 ---------- .../hrmSalary/components/importModal/index.js | 85 ++++---------- .../components/importModal/modalStep1.js | 2 +- .../dataAcquisition/cumDeduct/columns.js | 64 ++++++++++ .../pages/dataAcquisition/cumDeduct/index.js | 63 ++++++++-- .../dataAcquisition/cumSituation/columns.js | 109 ++++++++++++++++++ .../dataAcquisition/cumSituation/index.js | 50 ++++++-- .../dataAcquisition/otherDeduct/columns.js | 58 ++++++++++ .../dataAcquisition/otherDeduct/index.js | 50 ++++++-- pc4mobx/hrmSalary/stores/cumSituation.js | 4 +- pc4mobx/hrmSalary/stores/otherDeduct.js | 8 +- 13 files changed, 463 insertions(+), 154 deletions(-) delete mode 100644 pc4mobx/hrmSalary/components/importModal/columns.js diff --git a/pc4mobx/hrmSalary/apis/cumSituation.js b/pc4mobx/hrmSalary/apis/cumSituation.js index 295cc91c..449b9724 100644 --- a/pc4mobx/hrmSalary/apis/cumSituation.js +++ b/pc4mobx/hrmSalary/apis/cumSituation.js @@ -48,7 +48,7 @@ export const getCumSituationDetailList = params => { } //数据采集-累计情况-导出明细 -export const exportCumSituationDetailList = params => { +export const exportCumSituationDetailList = ids => { fetch('/api/bs/hrmsalary/addUpSituation/exportDetail?ids=' + ids).then(res => res.blob().then(blob => { var filename=`往期累计情况(工资、薪金).xlsx` var a = document.createElement('a'); @@ -58,4 +58,28 @@ export const exportCumSituationDetailList = params => { a.click(); window.URL.revokeObjectURL(url); })) +} + +// 数据采集-累计情况-导入 +export const importCumSituationParam = params => { + return fetch('/api/bs/hrmsalary/addUpSituation/importAddUpSituation', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} + +// 数据采集-累计情况-导入预览 +export const importCumSituationPreview = params => { + return fetch('/api/bs/hrmsalary/addUpSituation/addUpSituation', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/apis/otherDeduct.js b/pc4mobx/hrmSalary/apis/otherDeduct.js index 6612bcee..0b82f652 100644 --- a/pc4mobx/hrmSalary/apis/otherDeduct.js +++ b/pc4mobx/hrmSalary/apis/otherDeduct.js @@ -39,7 +39,14 @@ export const exportOtherDeductList = (ids = "") => { //数据采集-获取其他免税扣除记录 export const getOtherDeductDetailList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/otherDeduction/getDetailList', 'get', params); + return fetch('/api/bs/hrmsalary/otherDeduction/getDetailList', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //数据采集-其他免税扣除-导出明细 @@ -53,4 +60,29 @@ export const exportOtherDeductDetailList = ids => { a.click(); window.URL.revokeObjectURL(url); })) -} \ No newline at end of file +} + +// 数据采集-其他免税扣除-导入 +export const importOtherDeductionParam = params => { + return fetch('/api/bs/hrmsalary/otherDeduction/importData', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} + + +// 数据采集-其他免税扣除-导入预览 +export const importOtherDeductionPreview = params => { + return fetch('/api/bs/hrmsalary/otherDeduction/preview', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} diff --git a/pc4mobx/hrmSalary/components/importModal/columns.js b/pc4mobx/hrmSalary/components/importModal/columns.js deleted file mode 100644 index 447fcf06..00000000 --- a/pc4mobx/hrmSalary/components/importModal/columns.js +++ /dev/null @@ -1,62 +0,0 @@ -export const columns = [ - { - title: "姓名", - dataIndex: 'username', - key: 'username', - }, - { - title: "个税扣缴义务人", - dataIndex: 'taxAgentName', - key: 'taxAgentName', - }, - { - title: "部门", - dataIndex: 'departmentName', - key: 'departmentName', - }, - { - title: "手机号", - dataIndex: 'mobile', - key: 'mobile', - }, - { - title: "工号", - dataIndex: 'jobNum', - key: 'jobNum', - }, - { - title: "证件号码", - dataIndex: 'idNo', - key: 'idNo', - }, - { - title: "入职日期", - dataIndex: 'hiredate', - key: 'hiredate', - }, - { - title: "累计子女教育", - dataIndex: 'addUpChildEducation', - key: 'addUpChildEducation', - }, - { - title: "累计继续教育", - dataIndex: 'addUpContinuingEducation', - key: 'addUpContinuingEducation', - }, - { - title: "累计住房贷款利息", - dataIndex: 'addUpHousingLoanInterest', - key: 'addUpHousingLoanInterest', - }, - { - title: "累计住房租金", - dataIndex: 'addUpHousingRent', - key: 'addUpHousingRent', - }, - { - title: "累计赡养老人", - dataIndex: 'addUpSupportElderly', - key: 'addUpSupportElderly', - } -] diff --git a/pc4mobx/hrmSalary/components/importModal/index.js b/pc4mobx/hrmSalary/components/importModal/index.js index 4748b628..5d89a233 100644 --- a/pc4mobx/hrmSalary/components/importModal/index.js +++ b/pc4mobx/hrmSalary/components/importModal/index.js @@ -8,21 +8,16 @@ import ModalStep1 from './modalStep1' import ModalStep2 from './modalStep2' import ModalStep3 from './modalStep3' -import { columns } from './columns' - const Dragger = Upload.Dragger; const Step = WeaSteps.Step; -@inject("taxAgentStore", "cumDeductStore") +@inject("taxAgentStore") @observer export default class ImportModal extends React.Component { constructor(props) { super(props) this.state = { - currentStep: 0, - datetime: "", - taxAgentId: "", fileId: "" } } @@ -33,71 +28,40 @@ export default class ImportModal extends React.Component { } nextStep() { - const { cumDeductStore: { step, setStep }} = this.props; - setStep(step + 1) + const { step } = this.props; + this.props.setStep(step + 1) } preStep() { - const { cumDeductStore: { step, setStep }} = this.props; - setStep(step - 1); + const { step } = this.props; + this.props.setStep(step - 1); } - renderFormComponent() { - const { datetime, taxAgentId } = this.state - const { taxAgentStore: {taxAgentOption} } = this.props; - return ( - - - 税款所属期 - this.setState({ datetime: value })} - /> - - - 个税扣缴义务人 - { - this.setState({ taxAgentId: v }); - }} - /> - - - ) - } + handleStep1Next() { - const { cumDeductStore: { importFile, setStep }} = this.props; - const { fileId, datetime, taxAgentId} = this.state; - setStep(1) + this.props.setStep(1) } handlePreviewDate() { - const { cumDeductStore: { previewImport }} = this.props; - const { fileId, datetime, taxAgentId } = this.state; - previewImport({ - imageId: fileId, - declareMonth: datetime, - taxAgentId: taxAgentId + const { fileId } = this.state; + const { params } = this.props; + this.props.previewImport({ + ...params, + imageId: fileId }) } hanleImportData() { - const { cumDeductStore: { importFile }} = this.props; - const { fileId, datetime, taxAgentId } = this.state; - importFile({ + const { fileId } = this.state; + const { params } = this.props; + this.props.importFile({ + ...params, imageId: fileId, - declareMonth: datetime, - taxAgentId: taxAgentId }) } render() { - const { cumDeductStore: { step, slideDataSource, importResult, setSlideVisiable, setStep, setModalVisiable }} = this.props; + const { step, slideDataSource } = this.props; return ( { - step == 0 && ( {this.setState({fileId})}} onStep1Next={() => { this.handleStep1Next(); }}/>) } { - step == 1 && ( this.handlePreviewDate()} dataSource={slideDataSource} - columns={columns} + columns={this.props.columns} onStep2Next={() => {this.nextStep()}} onStep2Pre={() => {this.preStep()}}/>) } { - step == 2 && ( this.hanleImportData()} - importResult={toJS(importResult)} - onFinish={() => {setModalVisiable(false); setStep(0)}}/>) + importResult={toJS(this.props.importResult)} + onFinish={() => {this.props.onFinish()}}/>) } diff --git a/pc4mobx/hrmSalary/components/importModal/modalStep1.js b/pc4mobx/hrmSalary/components/importModal/modalStep1.js index d156202d..6b1d2bda 100644 --- a/pc4mobx/hrmSalary/components/importModal/modalStep1.js +++ b/pc4mobx/hrmSalary/components/importModal/modalStep1.js @@ -78,7 +78,7 @@ export default class ModalStep1 extends React.Component {
-

1. 第一步,请选择导出的Excel文件或 点击这里下载模板

+

1. 第一步,请选择导出的Excel文件或 点击这里下载模板

2. 第二步,请一定要确定Excel文档中的格式是模板中的格式,没有被修改掉;

3. 第三步,选择填写好的Excel文档,点击“下一步”按钮进行数据预览;

4. 第四步,如果以上步骤和Excel文档正确的话,数据会被正确导入,导入成功会有提示。如果有问题,则会提示Excel文档的错误之处。

diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js index 9d2ab7e0..30d36254 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js @@ -67,6 +67,70 @@ export const columns = [ ] +export const modalColumns = [ + { + title: "姓名", + dataIndex: 'username', + key: 'username', + }, + { + title: "个税扣缴义务人", + dataIndex: 'taxAgentName', + key: 'taxAgentName', + }, + { + title: "部门", + dataIndex: 'departmentName', + key: 'departmentName', + }, + { + title: "手机号", + dataIndex: 'mobile', + key: 'mobile', + }, + { + title: "工号", + dataIndex: 'jobNum', + key: 'jobNum', + }, + { + title: "证件号码", + dataIndex: 'idNo', + key: 'idNo', + }, + { + title: "入职日期", + dataIndex: 'hiredate', + key: 'hiredate', + }, + { + title: "累计子女教育", + dataIndex: 'addUpChildEducation', + key: 'addUpChildEducation', + }, + { + title: "累计继续教育", + dataIndex: 'addUpContinuingEducation', + key: 'addUpContinuingEducation', + }, + { + title: "累计住房贷款利息", + dataIndex: 'addUpHousingLoanInterest', + key: 'addUpHousingLoanInterest', + }, + { + title: "累计住房租金", + dataIndex: 'addUpHousingRent', + key: 'addUpHousingRent', + }, + { + title: "累计赡养老人", + dataIndex: 'addUpSupportElderly', + key: 'addUpSupportElderly', + } +] + + export const dataSource = []; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 098b0e1f..04308038 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; -import { Button, Table, DatePicker, Dropdown, Menu, Modal, message } from 'antd'; +import { Button, Table, DatePicker, Dropdown, Menu, Modal, message, Row, Col } from 'antd'; import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaDatePicker, WeaSelect, WeaHelpfulTip, WeaSlideModal } from 'ecCom'; import { WeaTableNew } from "comsMobx" @@ -14,7 +14,7 @@ import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据 import CustomTab from '../../../components/customTab'; import ContentWrapper from '../../../components/contentWrapper'; import ImportModal from '../../../components/importModal' -import { columns, dataSource } from './columns'; +import { columns, dataSource, modalColumns } from './columns'; const { MonthPicker } = DatePicker; @@ -35,7 +35,12 @@ export default class CumDeduct extends React.Component { selectedKey: "0", visiable: false, monthValue: moment(new Date()).format("YYYY-MM"), - taxAgentId: "" + taxAgentId: "", + datetime: "", + modalParam: { + declareMonth: "", + taxAgentId: "" + } } } @@ -88,6 +93,35 @@ export default class CumDeduct extends React.Component { ) } + renderFormComponent() { + const { modalParam } = this.state + const { taxAgentStore: {taxAgentOption} } = this.props; + return ( + + + 税款所属期 + this.setState({ modalParam: {...modalParam, declareMonth: value} })} + /> + + + 个税扣缴义务人 + { + this.setState({ modalParam: {...modalParam, taxAgentId: v} }); + }} + /> + + + ) +} + onEdit = (record) => { const { cumDeductStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList, setCurrentRecord } } = this.props; setSlideVisiable(true) @@ -134,10 +168,11 @@ export default class CumDeduct extends React.Component { }; render() { + const { modalParam } = this.state; const { cumDeductStore, taxAgentStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = cumDeductStore; - const { taxAgentOption, step } = taxAgentStore - const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore } = cumDeductStore + const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = cumDeductStore; + const { taxAgentOption } = taxAgentStore + const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore, step, setStep, slideDataSource, importResult } = cumDeductStore const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; @@ -271,7 +306,21 @@ export default class CumDeduct extends React.Component { /> - { this.handleCancel() }} /> + {setModalVisiable(false); setStep(0)}} + previewImport={(params) => {previewImport(params)}} + importFile={(params) => {importFile(params)}} + templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { this.handleCancel() }} + /> { slideVisiable && + + 税款所属期 + this.setState({ modalParam: {declareMonth: value} })} + /> + + + ) + } + onEdit = (record) => { const { cumSituationStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList, setCurrentRecord } } = this.props; setSlideVisiable(true) @@ -135,11 +156,11 @@ export default class CumSituation extends React.Component { render() { const { cumSituationStore, taxAgentStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = cumSituationStore; - const { taxAgentOption, step } = taxAgentStore - const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore } = cumSituationStore + const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = cumSituationStore; + const { taxAgentOption } = taxAgentStore + const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore, step, setStep, slideDataSource, importResult } = cumSituationStore const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - + const { modalParam } = this.state; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); @@ -271,7 +292,20 @@ export default class CumSituation extends React.Component { /> - { this.handleCancel() }} /> + {setModalVisiable(false); setStep(0)}} + slideDataSource={slideDataSource} + importResult={importResult} + previewImport={(params) => {previewImport(params)}} + importFile={(params) => {importFile(params)}} + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { this.handleCancel() }} /> { slideVisiable && + + 税款所属期 + this.setState({ modalParam: {declareMonth: value} })} + /> + + + + ) + } + render() { const { otherDeductStore, taxAgentStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = otherDeductStore; - const { taxAgentOption, step } = taxAgentStore - const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore } = otherDeductStore + const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = otherDeductStore; + const { taxAgentOption } = taxAgentStore + const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore, step, setStep, slideDataSource, importResult } = otherDeductStore const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; + const { modalParam } = this.state; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; if (!hasRight && !loading) { // 无权限处理 @@ -271,7 +293,21 @@ export default class OtherDeduct extends React.Component { /> - { this.handleCancel() }} /> + {setModalVisiable(false); setStep(0)}} + importResult={importResult} + slideDataSource={slideDataSource} + previewImport={(params) => {previewImport(params)}} + importFile={(params) => {importFile(params)}} + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { this.handleCancel() }} + /> { slideVisiable && { - API.importCumDeductParam(params).then(action(res => { + API.importCumSituationParam(params).then(action(res => { if(res.status) { this.importResult = res.data } @@ -95,7 +95,7 @@ export class CumSituationStore { // 导入预览 @action previewImport = (params) => { - API.importCumDeductPreview(params).then(action(res => { + API.importCumSituationPreview(params).then(action(res => { if(res.status) { this.slideDataSource = res.data.preview } diff --git a/pc4mobx/hrmSalary/stores/otherDeduct.js b/pc4mobx/hrmSalary/stores/otherDeduct.js index d45b932f..f522564c 100644 --- a/pc4mobx/hrmSalary/stores/otherDeduct.js +++ b/pc4mobx/hrmSalary/stores/otherDeduct.js @@ -86,7 +86,7 @@ export class OtherDeductStore { // 导入 @action importFile = (params) => { - API.importCumDeductParam(params).then(action(res => { + API.importOtherDeductionParam(params).then(action(res => { if(res.status) { this.importResult = res.data } @@ -95,7 +95,7 @@ export class OtherDeductStore { // 导入预览 @action previewImport = (params) => { - API.importCumDeductPreview(params).then(action(res => { + API.importOtherDeductionPreview(params).then(action(res => { if(res.status) { this.slideDataSource = res.data.preview } @@ -109,9 +109,9 @@ export class OtherDeductStore { // 查询明细 @action getCumDeductDetailList = (id, param = {}) => { - let requestParams = {"accumulatedSpecialAdditionalDeductionId": id}; + let requestParams = {"otherTaxExemptDeductionId": id}; requestParams = {...requestParams, ...param} - API.getCumDeductDetailList(requestParams).then(res => { + API.getOtherDeductDetailList(requestParams).then(res => { if(res.status) { if (res.status) { // 接口请求成功/失败处理 this.slideTableStore.getDatas(res.data.datas); // table 请求数据