diff --git a/pc4mobx/hrmSalary/apis/special.js b/pc4mobx/hrmSalary/apis/special.js index 2ae582db..0072c4e6 100644 --- a/pc4mobx/hrmSalary/apis/special.js +++ b/pc4mobx/hrmSalary/apis/special.js @@ -9,6 +9,22 @@ export const getSearchCondition = (params) => { export const specialAddDeductionList = (params) => { return postFetch('/api/bs/hrmsalary/specialAddDeduction/list', params); } +// 新增专项附加扣除 +export const specialAddDeductionCreateData = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/createData', params); +} +// 编辑专项附加扣除 +export const specialAddDeductionEditData = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/editData', params); +} +// 查看明细 +export const specialAddDeductionGetDetailList = (params) => { + return postFetch('/api/bs/hrmsalary/specialAddDeduction/getDetailList', 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); diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index 836fb1a8..b57b8860 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -51,9 +51,9 @@ class AddItems extends Component { } render() { - const { taxAgentOption = [], form, condition = [], isCum, editId } = this.props; + const { taxAgentOption = [], form, condition = [], isCum, isSpecial, editId } = this.props; const { baseInfo } = this.state; - const items = [ + let items = [ { com: PickDate({ label: "税款所属期", @@ -161,7 +161,7 @@ class AddItems extends Component { }) } ]; - + isSpecial && items.shift(); return (
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js new file mode 100644 index 00000000..7ac35116 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/components/specialAddContent.js @@ -0,0 +1,13 @@ +import React, { Component } from "react"; + +class SpecialAddContent extends Component { + render() { + return ( +
+ +
+ ); + } +} + +export default SpecialAddContent; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js index 829d62d9..bc564e65 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js @@ -1,11 +1,14 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { Button, Dropdown, Menu } from "antd"; -import { WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; +import { Button, Dropdown, Menu, message, Modal, Popover } from "antd"; +import { WeaPopoverHrm, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; import InlineForm from "./components/inlineForm"; import { getSearchs, renderLoading } from "../../../util"; import * as API from "../../../apis/special"; import SlideModalTitle from "../../../components/slideModalTitle"; +import AddItems from "../addItems"; +import SpecialAddContent from "./components/specialAddContent"; +import { condition } from "./components/condition"; import "./index.less"; @inject("specialAddStore", "taxAgentStore") @@ -22,7 +25,9 @@ class SpecialAddDeduction extends Component { condition: [] }, drawerParams: { //抽屜弹框参数 - visible: false, title: '新建' + visible: false, title: "新建", + loading: false, isView: true, + editId: {} }, dataSource: [], columns: [], @@ -32,10 +37,12 @@ class SpecialAddDeduction extends Component { } }; this.inlineForm = null; + this.addItemRef = null; } componentDidMount() { - const { taxAgentStore: { getTaxAgentSelectListAsAdmin } } = this.props; + const { taxAgentStore: { getTaxAgentSelectListAsAdmin }, specialAddStore: { addForm } } = this.props; + addForm.initFormFields(condition); getTaxAgentSelectListAsAdmin(); this.getSearchCondition(); this.specialAddDeductionList(); @@ -48,12 +55,11 @@ class SpecialAddDeduction extends Component { if (status) { const { condition } = data; this.setState({ - advanceParams: { - ...advanceParams, - condition: condition - } - }, () => advanceForm.initFormFields(this.state.advanceParams.condition) - ); + advanceParams: { + ...advanceParams, + condition: condition + } + }, () => advanceForm.initFormFields(this.state.advanceParams.condition)); } }); }; @@ -74,14 +80,145 @@ class SpecialAddDeduction extends Component { API.specialAddDeductionList(payload).then(({ status, data }) => { this.setState({ loading: { ...loading, query: false } }); if (status) { - const { columns, dataSource, pageNum: current, pageSize, total } = data; + const { columns, list: dataSource, pageNum: current, pageSize, total } = data; this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, - columns, dataSource + dataSource, + columns: _.map(columns, item => { + const { dataIndex } = item; + if (dataIndex === "username") { + return { + ...item, + render: (text, record) => { + return window.pointerXY(e)} + title={text} + > + {text} + ; + } + }; + } else if (dataIndex === "operate") { + return { + ...item, + render: (text, record) => ( +
+ { + }}> + 查看明细 + + { + this.props.taxAgentStore.showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } +
+ ) + }; + } else { + return { ...item }; + } + }) }); } }); }; + handleSaveSpecialList = (payload) => { + const { drawerParams } = this.state; + this.setState({ drawerParams: { ...drawerParams, loading: true } }); + if (!_.isEmpty(drawerParams.editId)) { + API.specialAddDeductionEditData({ ...payload, id: drawerParams.editId.id }).then(({ status, errormsg }) => { + this.setState({ drawerParams: { ...drawerParams, loading: false } }); + if (status) { + message.success("编辑成功"); + this.setState({ + drawerParams: { + ...drawerParams, + visible: false, + editId: {} + } + }, () => { + const { specialAddStore: { addForm } } = this.props; + this.specialAddDeductionList(); + addForm.resetForm(); + }); + } else { + message.error(errormsg || "编辑失败"); + } + }); + } else { + API.specialAddDeductionCreateData(payload).then(({ status, errormsg }) => { + this.setState({ drawerParams: { ...drawerParams, loading: false } }); + if (status) { + message.success("新增成功"); + this.setState({ + drawerParams: { + ...drawerParams, + visible: false, + editId: {} + } + }, () => { + const { specialAddStore: { addForm } } = this.props; + this.specialAddDeductionList(); + addForm.resetForm(); + }); + } else { + message.error(errormsg || "新增失败"); + } + }); + } + }; + handleOperate = ({ key }, row) => { + const { drawerParams } = this.state; + if (key === "edit") { + this.setState({ + drawerParams: { + ...drawerParams, + visible: true, + isView: false, + title: "编辑" + } + }, () => { + const { drawerParams: params } = this.state; + API.specialAddDeductionGetDetailList({ specialAddDeductionId: row.id }).then(({ status, data }) => { + if (status) { + this.setState({ + drawerParams: { + ...params, + editId: data + } + }); + } + }); + }); + } else if (key === "delete") { + const payload = { + ids: [row.id] + }; + Modal.confirm({ + title: "信息确认", + content: `确定删除${row.departmentName}${row.username}的专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.specialAddDeductionDeleteSelectData(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.specialAddDeductionList(); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + } + }; getSearchsAdQuick = (isAd) => { const { advanceParams } = this.state; const { taxAgentStore: { taxAgentAdminOption }, specialAddStore: { advanceForm } } = this.props; @@ -95,8 +232,8 @@ class SpecialAddDeduction extends Component { render() { const { advanceParams, dataSource, columns, loading, selectedRowKeys, pageInfo, drawerParams } = this.state; - const { taxAgentStore, specialAddStore: { advanceForm } } = this.props; - const { showOperateBtn } = taxAgentStore; + const { taxAgentStore, specialAddStore: { advanceForm, addForm } } = this.props; + const { showOperateBtn, taxAgentAdminOption } = taxAgentStore; const rowSelection = { selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) @@ -131,7 +268,14 @@ class SpecialAddDeduction extends Component { > 导出全部 , - , + , { }} @@ -192,6 +336,7 @@ class SpecialAddDeduction extends Component { searchsBaseValue={advanceForm.getFormParams().username} onSearchChange={(v) => advanceForm.updateFields({ username: v })} onAdReset={() => advanceForm.reset()} + onAdSearch={() => this.specialAddDeductionList()} onSearch={() => this.specialAddDeductionList()} searchsAdQuick={this.getSearchsAdQuick()} searchsAd={this.getSearchsAdQuick(true)} @@ -216,21 +361,60 @@ class SpecialAddDeduction extends Component { title={ { - // this.state.currentOperate == "add" ? doSave() : doUpdate(); + const { baseInfo } = this.addItemRef.state; + const bool = _.every(_.pick(baseInfo, ["taxAgentId", "employeeId"]), v => !_.isEmpty(v)); + if (!bool && _.isEmpty(drawerParams.editId)) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + const payload = { + ..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.handleSaveSpecialList(payload); }} - editable={false} + editable={!drawerParams.isView} showOperateBtn={showOperateBtn} - customOperate={showOperateBtn ? customBtns : []} + customOperate={(showOperateBtn && !drawerParams.isView) ? customBtns : []} /> } content={ -
123
+ !drawerParams.isView ? + this.addItemRef = dom} + taxAgentOption={taxAgentAdminOption} + form={addForm} + isSpecial + editId={drawerParams.editId} + condition={condition} + /> : + } - onClose={() => this.setState({ drawerParams: { ...drawerParams, visible: false } })} + onClose={() => this.setState({ + drawerParams: { + ...drawerParams, + visible: false, + isView: true, + editId: {} + } + })} showMask={true} - closeMaskOnClick={() => this.setState({ drawerParams: { ...drawerParams, visible: false } })} + closeMaskOnClick={() => this.setState({ + drawerParams: { + ...drawerParams, + visible: false, + isView: true, + editId: {} + } + })} /> + {/*人员卡片*/} +
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less index 4a617f8d..d816b67e 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.less @@ -23,32 +23,69 @@ } } } + + .linkWapper { + a { + color: #4d7ad8; + margin-right: 8px; + } + + i { + cursor: pointer; + } + + a:hover { + text-decoration: none; + } + } } -.specialAddSlideWrapper{ - .wea-slide-modal-title{ +.moreIconWrapper { + .ant-popover-inner { + min-width: 106px + } + + .ant-popover-inner-content { + padding: 0; + + .ant-menu { + .ant-menu-item { + border-right: none; + height: 30px; + line-height: 30px; + text-align: center; + padding: 0; + } + } + } +} + +.specialAddSlideWrapper { + .wea-slide-modal-title { height: initial; line-height: initial; text-align: left; } - .rodal-close{ + + .rodal-close { z-index: 99; - top: 10px!important; + top: 10px !important; } } -@media (min-width: 1260px){ - .specialAddSlideWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: 100%!important; +@media (min-width: 1260px) { + .specialAddSlideWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; } } } + @media screen and (min-width: 1060px) and (max-width: 1260px) { - .specialAddSlideWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: calc(100% - 96px)!important; + .specialAddSlideWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; } } }