diff --git a/pc4mobx/hrmSalary/apis/special.js b/pc4mobx/hrmSalary/apis/special.js index 0072c4e6..da0b4869 100644 --- a/pc4mobx/hrmSalary/apis/special.js +++ b/pc4mobx/hrmSalary/apis/special.js @@ -25,55 +25,19 @@ export const specialAddDeductionGetDetailList = (params) => { export const specialAddDeductionDeleteSelectData = (params) => { return postFetch('/api/bs/hrmsalary/specialAddDeduction/deleteSelectData', params); } -// 导入档案 -export const importSalaryArchive = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/importSalaryArchive', params); +// 一键清空 +export const specialAddDeductionDeleteAllData = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/deleteAllData', params); } -// 薪资档案预览 -export const salaryArchivePreview = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/preview', params); +// 查看单条信息 +export const getSpecialAddDeduction = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/getSpecialAddDeduction', params); } -// 公共枚举接口 -export const commonEnumList = (params) => { - return WeaTools.callApi('/api/bs/hrmsalary/common/enum/list', 'GET', params); +// 导入预览 +export const specialAddDeductionPreview = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/preview', params); } -// 获取导入类型 -export const getImportTypes = () => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/getImportTypes', 'GET', {}); -} -// 发起调薪地址 -export const salaryAdjustmentInfo = (params) => { - return WeaTools.callApi('/api/bs/hrmsalary/process/salaryAdjustmentInfo', 'GET', params); -} -// 一键全部设为定薪员工 -export const allGotoFixed = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/allGotoFixed', params); -} -// 设为定薪员工 -export const gotoFixed = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/gotoFixed', params); -} -// 停薪 -export const gotoStop = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/gotoStop', params); -} -//全部停薪 -export const allGotoStop = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/allGotoStop', params); -} -// 取消停薪 -export const cancelStop = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/cancelStop', params); -} -// 保存发薪设置 -export const savePaySet = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/savePaySet', params); -} -// 待定薪删除待办 -export const deletePendingTodo = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/deletePendingTodo', params); -} -// 待停薪删除待办 -export const deleteSuspendTodo = (params) => { - return postFetch('/api/bs/hrmsalary/salaryArchive/deleteSuspendTodo', params); +// 导入预览结果 +export const specialAddDeductionImportData = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/importData', params); } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js index 7ac35116..cfdfff2c 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js @@ -1,11 +1,85 @@ import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import * as API from "../../../../apis/special"; class SpecialAddContent extends Component { - render() { - return ( -
+ constructor(props) { + super(props); + this.state = { + dataSource: [], + columns: [], + loading: { + query: false + }, + selectedRowKeys: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } + }; + } -
+ componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.specialId !== this.props.specialId) { + nextProps.specialId && this.specialAddDeductionGetDetailList({ specialAddDeductionId: nextProps.specialId }); + } + } + + specialAddDeductionGetDetailList = (payload) => { + this.setState({ loading: { ...this.state.loading, query: true } }); + API.specialAddDeductionGetDetailList(payload).then(({ status, data }) => { + this.setState({ loading: { ...this.state.loading, query: false } }); + if (status) { + const { columns, list: dataSource, pageSize, pageNum, total } = data; + this.setState({ + columns, dataSource, + pageInfo: { + ...this.pageInfo, + pageSize, pageNum, total + } + }); + } + }); + }; + + render() { + const { columns, dataSource, pageInfo, selectedRowKeys, loading } = this.state; + const { specialId } = this.props; + const pagination = { + ...pageInfo, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions: ["10", "20", "50", "100"], + showSizeChanger: true, + showQuickJumper: true, + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => { + this.specialAddDeductionGetDetailList({ specialAddDeductionId: specialId, current, pageSize }); + }); + }, + onChange: (current) => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + this.specialAddDeductionGetDetailList({ specialAddDeductionId: specialId, current }); + }); + } + }; + const rowSelection = { + selectedRowKeys, + onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) + }; + return ( + ); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js index 59b9313d..99f2a477 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { Button, Dropdown, Menu, message, Modal, Popover } from "antd"; -import { WeaPopoverHrm, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; +import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; +import { WeaPopoverHrm, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; import InlineForm from "./components/inlineForm"; import { getSearchs, renderLoading } from "../../../util"; import * as API from "../../../apis/special"; @@ -9,6 +9,8 @@ import SlideModalTitle from "../../../components/slideModalTitle"; import AddItems from "../addItems"; import SpecialAddContent from "./components/specialAddContent"; import { condition } from "./components/condition"; +import ImportModal from "../../../components/importModal"; +import { modalColumns } from "../cumDeduct/columns"; import "./index.less"; @inject("specialAddStore", "taxAgentStore") @@ -29,6 +31,11 @@ class SpecialAddDeduction extends Component { loading: false, isView: true, editId: {} }, + importParams: { //导入弹框参数 + visible: false, step: 0, + importResult: [], + payload: { taxAgentId: "" } + }, dataSource: [], columns: [], selectedRowKeys: [], @@ -38,6 +45,7 @@ class SpecialAddDeduction extends Component { }; this.inlineForm = null; this.addItemRef = null; + this.specialContentRef = null; } componentDidMount() { @@ -104,6 +112,15 @@ class SpecialAddDeduction extends Component { render: (text, record) => (
{ + this.setState({ + drawerParams: { + ...this.state.drawerParams, + visible: true, + isView: true, + title: "专项附加扣除记录", + editId: record + } + }); }}> 查看明细 @@ -142,6 +159,7 @@ class SpecialAddDeduction extends Component { drawerParams: { ...drawerParams, visible: false, + isView: true, editId: {} } }, () => { @@ -162,6 +180,7 @@ class SpecialAddDeduction extends Component { drawerParams: { ...drawerParams, visible: false, + isView: true, editId: {} } }, () => { @@ -187,7 +206,7 @@ class SpecialAddDeduction extends Component { } }, () => { const { drawerParams: params } = this.state; - API.specialAddDeductionGetDetailList({ specialAddDeductionId: row.id }).then(({ status, data }) => { + API.getSpecialAddDeduction({ id: row.id }).then(({ status, data }) => { if (status) { this.setState({ drawerParams: { @@ -219,13 +238,13 @@ class SpecialAddDeduction extends Component { } }; deleteSelectAddUpDeduction = () => { - const { selectedRowKeysKey } = this.state; - if (selectedRowKeysKey.length === 0) { + const { selectedRowKeys } = this.state; + if (selectedRowKeys.length === 0) { message.warning("未选择条目"); return; } const payload = { - ids: selectedRowKeysKey + ids: selectedRowKeys }; Modal.confirm({ title: "信息确认", @@ -245,6 +264,80 @@ class SpecialAddDeduction extends Component { }); }; + specialAddDeductionDeleteAllData = () => { + const extraParams = this.inlineForm ? this.inlineForm.getFieldsValue() : {}; + const payload = { + ...extraParams + }; + Modal.confirm({ + title: "信息确认", + content: `确定清空所有专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.specialAddDeductionDeleteAllData(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.specialAddDeductionList(); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; + specialAddDeductionPreview = (payload) => { + const { importParams } = this.state; + API.specialAddDeductionPreview(payload).then(({ status, data }) => { + if (status) { + const { preview: slideDataSource } = data; + this.setState({ + importParams: { + ...importParams, + slideDataSource + } + }); + } + }); + }; + specialAddDeductionImportData = (payload) => { + const { importParams } = this.state; + API.specialAddDeductionImportData(payload).then(({ status, data: importResult }) => { + if (status) { + this.setState({ + importParams: { + ...importParams, + step: 2, + importResult + } + }); + } + }); + }; + specialAddDeductionExport = () => { + const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${this.inlineForm.getFieldsValue().taxAgentId}`; + window.open(url, "_self"); + }; + specialAddDeductionExportSelect = () => { + const { selectedRowKeys } = this.state; + if (selectedRowKeys.length === 0) { + message.warning("未选择条目"); + return; + } + const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${selectedRowKeys.join(",")}&taxAgentId=${this.inlineForm.getFieldsValue().taxAgentId}`; + window.open(url, "_self"); + }; + handleExportAllSpecialDetail = () => { + const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export`; + window.open(url, "_self"); + }; + handleExportSelectSpecialDetail = () => { + const { state: { selectedRowKeys } } = this.specialContentRef; + if (selectedRowKeys.length === 0) { + message.warning("未选择条目"); + return; + } + const url = `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${selectedRowKeys.join(",")}`; + window.open(url, "_self"); + }; getSearchsAdQuick = (isAd) => { const { advanceParams } = this.state; const { taxAgentStore: { taxAgentAdminOption }, specialAddStore: { advanceForm } } = this.props; @@ -255,9 +348,42 @@ class SpecialAddDeduction extends Component { onChange={this.specialAddDeductionList} />; }; + renderImportormComponent = () => { + const { importParams } = this.state; + const { taxAgentStore: { taxAgentAdminOption } } = this.props; + return ( + + + + 个税扣缴义务人 + + { + this.setState({ importParams: { ...importParams, payload: { taxAgentId: v } } }); + }} + /> + + + ); + }; render() { - const { advanceParams, dataSource, columns, loading, selectedRowKeys, pageInfo, drawerParams } = this.state; + const { + advanceParams, + dataSource, + columns, + loading, + selectedRowKeys, + pageInfo, + drawerParams, + importParams + } = this.state; const { taxAgentStore, specialAddStore: { advanceForm, addForm } } = this.props; const { showOperateBtn, taxAgentAdminOption } = taxAgentStore; const rowSelection = { @@ -266,11 +392,9 @@ class SpecialAddDeduction extends Component { }; const customBtns = [ { - }} + onClick={this.handleExportAllSpecialDetail} overlay={ - { - }}> + 导出选中 } @@ -280,13 +404,19 @@ class SpecialAddDeduction extends Component { ]; const btns = [ - , + , { - }} + onClick={this.specialAddDeductionExport} overlay={ - { - }}> + 导出选中 } @@ -303,8 +433,7 @@ class SpecialAddDeduction extends Component { } })}>新建, { - }} + onClick={this.specialAddDeductionDeleteAllData} overlay={ 删除所选 @@ -404,9 +533,9 @@ class SpecialAddDeduction extends Component { }; this.handleSaveSpecialList(payload); }} - editable={!drawerParams.isView} + editable={showOperateBtn && !drawerParams.isView} showOperateBtn={showOperateBtn} - customOperate={(showOperateBtn && !drawerParams.isView) ? customBtns : []} + customOperate={(showOperateBtn && drawerParams.isView) ? customBtns : []} /> } content={ @@ -419,7 +548,7 @@ class SpecialAddDeduction extends Component { editId={drawerParams.editId} condition={condition} /> : - + this.specialContentRef = dom} specialId={drawerParams.editId.id}/> } onClose={() => this.setState({ drawerParams: { @@ -441,6 +570,41 @@ class SpecialAddDeduction extends Component { /> {/*人员卡片*/} + {/* 导入模板*/} + { + importParams.visible && + this.setState({ importParams: { ...importParams, step } })} + slideDataSource={importParams.slideDataSource} + importResult={importParams.importResult} + onFinish={() => { + this.setState({ importParams: { ...importParams, step: 0, visible: false } }, () => { + this.specialAddDeductionList(); + localStorage.removeItem("fileList"); + }); + }} + previewImport={this.specialAddDeductionPreview} + importFile={this.specialAddDeductionImportData} + templateLink="/api/bs/hrmsalary/specialAddDeduction/downloadTemplate" + renderFormComponent={this.renderImportormComponent} + visiable={importParams.visible} + onCancel={() => { + localStorage.removeItem("fileList"); + this.setState({ + importParams: { + ...importParams, + step: 0, visible: false, + slideDataSource: [], importResult: [], + payload: { taxAgentId: "" } + } + }); + }} + /> + }