diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index ada3f3b9..f7a094e6 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -1,4 +1,5 @@ import { WeaTools } from "ecCom"; +import { postFetch } from '../util/request'; //数据采集-累计专项附加扣除列表 export const getCumDeductList = (params) => { @@ -100,3 +101,21 @@ export const importCumDeductPreview = (params) => { body: JSON.stringify(params), }).then((res) => res.json()); }; + + +//新增累计专项附加扣除 +export const createAddUpDeduction = (params) => { + return postFetch('/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction', params); +} +//编辑累计专项附加扣除 +export const editAddUpDeduction = (params) => { + return postFetch('/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction', params); +} +//批量删除累计专项附加扣除 +export const deleteSelectAddUpDeduction = (params) => { + return postFetch('/api/bs/hrmsalary/addUpDeduction/deleteSelectAddUpDeduction', params); +} +//一键清空累计专项附加扣除 +export const deleteAllAddUpDeduction = (params) => { + return postFetch('/api/bs/hrmsalary/addUpDeduction/deleteAllAddUpDeduction', params); +} diff --git a/pc4mobx/hrmSalary/apis/cumSituation.js b/pc4mobx/hrmSalary/apis/cumSituation.js index 237d81ac..d8f84017 100644 --- a/pc4mobx/hrmSalary/apis/cumSituation.js +++ b/pc4mobx/hrmSalary/apis/cumSituation.js @@ -1,4 +1,5 @@ import { WeaTools } from "ecCom"; +import { postFetch } from '../util/request'; //数据采集-累计情况列表 export const getCumSituationList = (params) => { @@ -100,3 +101,19 @@ export const importCumSituationPreview = (params) => { body: JSON.stringify(params), }).then((res) => res.json()); }; +//新建往期累计情况 +export const createAddUpSituation = (params) => { + return postFetch('/api/bs/hrmsalary/addUpSituation/createAddUpSituation', params); +} +//编辑往期累计情况 +export const editAddUpSituation = (params) => { + return postFetch('/api/bs/hrmsalary/addUpSituation/editAddUpSituation', params); +} +//删除所选往期累计情况 +export const deleteSelectAddUpSituation = (params) => { + return postFetch('/api/bs/hrmsalary/addUpSituation/deleteSelectAddUpSituation', params); +} +//一键清空往期累计情况 +export const deleteAllAddUpSituation = (params) => { + return postFetch('/api/bs/hrmsalary/addUpSituation/deleteAllAddUpSituation', params); +} diff --git a/pc4mobx/hrmSalary/apis/otherDeduct.js b/pc4mobx/hrmSalary/apis/otherDeduct.js index 972c641a..4b8fa0a9 100644 --- a/pc4mobx/hrmSalary/apis/otherDeduct.js +++ b/pc4mobx/hrmSalary/apis/otherDeduct.js @@ -1,4 +1,5 @@ import { WeaTools } from "ecCom"; +import { postFetch } from '../util/request'; //数据采集-其他免税扣除列表 export const getOtherDeductList = (params) => { @@ -105,3 +106,20 @@ export const importOtherDeductionPreview = (params) => { body: JSON.stringify(params), }).then((res) => res.json()); }; + +//新增其他免税扣除 +export const createData = (params) => { + return postFetch('/api/bs/hrmsalary/otherDeduction/createData', params); +} +//编辑其他免税扣除 +export const editData = (params) => { + return postFetch('/api/bs/hrmsalary/otherDeduction/editData', params); +} +//批量删除其他免税扣除 +export const deleteSelectData = (params) => { + return postFetch('/api/bs/hrmsalary/otherDeduction/deleteSelectData', params); +} +//一键清空其他免税扣除 +export const deleteAllData = (params) => { + return postFetch('/api/bs/hrmsalary/otherDeduction/deleteAllData', params); +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index bca10c14..a9ee5124 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -15,9 +15,10 @@ class AddItems extends Component { super(props); this.state = { baseInfo: { - taxablePeriod: "", - taxAgentor: "", - employee: "", + declareMonth: "", + taxAgentId: "", + taxAgentName: "", + employeeId: "", personArea: "", username: "", idcard: "" @@ -25,6 +26,10 @@ class AddItems extends Component { }; } + componentDidMount() { + console.log('123',this.props.editId); + } + render() { const { taxAgentOption = [], form, condition = [], isCum } = this.props; const { baseInfo } = this.state; @@ -36,9 +41,9 @@ class AddItems extends Component { labelCol: { span: 6 }, wrapperCol: { span: 18 }, format: "YYYY-MM", - value: baseInfo.taxablePeriod, + value: baseInfo.declareMonth, onChange: (data) => { - this.setState({ baseInfo: { ...baseInfo, taxablePeriod: data.date } }); + this.setState({ baseInfo: { ...baseInfo, declareMonth: data.date } }); } }) }, @@ -47,9 +52,9 @@ class AddItems extends Component { label: "个税扣缴义务人", viewAttr: 3, options: taxAgentOption, - value: baseInfo.taxAgentor, + value: baseInfo.taxAgentId, onChange: (data) => { - this.setState({ baseInfo: { ...baseInfo, taxAgentor: data.selected } }); + this.setState({ baseInfo: { ...baseInfo, taxAgentId: data.selected, taxAgentName: data.showName } }); } }) }, @@ -57,8 +62,8 @@ class AddItems extends Component { com: Browser({ label: "人员", viewAttr: 3, - onChange: (employee) => { - this.setState({ baseInfo: { ...baseInfo, employee } }); + onChange: (employeeId) => { + this.setState({ baseInfo: { ...baseInfo, employeeId } }); } }) } @@ -71,9 +76,9 @@ class AddItems extends Component { labelCol: { span: 6 }, wrapperCol: { span: 18 }, format: "YYYY-MM", - value: baseInfo.taxablePeriod, + value: baseInfo.declareMonth, onChange: (data) => { - this.setState({ baseInfo: { ...baseInfo, taxablePeriod: data.date } }); + this.setState({ baseInfo: { ...baseInfo, declareMonth: data.date } }); } }) }, @@ -82,9 +87,9 @@ class AddItems extends Component { label: "个税扣缴义务人", viewAttr: 3, options: taxAgentOption, - value: baseInfo.taxAgentor, + value: baseInfo.taxAgentId, onChange: (data) => { - this.setState({ baseInfo: { ...baseInfo, taxAgentor: data.selected } }); + this.setState({ baseInfo: { ...baseInfo, taxAgentId: data.selected, taxAgentName: data.showName } }); } }) }, @@ -93,7 +98,9 @@ class AddItems extends Component { label: "人员范围", viewAttr: 3, options: [ - { key: "ORGANIZATION", showname: "内部人员" }, { key: "EXT_EMPLOYEE", showname: "非系统人员" }], + { key: "ORGANIZATION", showname: "内部人员" }, + // { key: "EXT_EMPLOYEE", showname: "非系统人员" } + ], value: baseInfo.personArea, onChange: (data) => { this.setState({ baseInfo: { ...baseInfo, personArea: data.selected } }); @@ -105,8 +112,8 @@ class AddItems extends Component { com: Browser({ label: "人员", viewAttr: 3, - onChange: (employee) => { - this.setState({ baseInfo: { ...baseInfo, employee } }); + onChange: (employeeId) => { + this.setState({ baseInfo: { ...baseInfo, employeeId } }); } }) }]; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 95631d17..2b2ab785 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,7 +1,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd"; +import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; import { WeaDatePicker, WeaHelpfulTip, WeaRightMenu, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; import moment from "moment"; import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 @@ -11,6 +11,7 @@ import { optionAddAll } from "../../../util/options"; import SlideModalTitle from "../../../components/slideModalTitle"; import EditSlideContent from "./components/editSlideContent"; import AddItems from "../addItems"; +import * as API from "../../../apis/cumDeduct"; import "./index.less"; @@ -21,6 +22,8 @@ export default class CumDeduct extends React.Component { super(props); this.state = { addVisible: false, + editId: "", + saveLoading: false, value: "", selectedKey: [], slideSelectedKey: [], //详情表格的选中项 @@ -253,7 +256,7 @@ export default class CumDeduct extends React.Component { }); }; - handleSearch() { + handleSearch = () => { const { cumDeductStore: { getTableDatas } } = this.props; const { monthValue, taxAgentId } = this.state; let params = {}; @@ -264,10 +267,123 @@ export default class CumDeduct extends React.Component { params.taxAgentId = taxAgentId; } getTableDatas(params); - } + }; + + //新功能 + createAddUpDeduction = (payload) => { + this.setState({ saveLoading: true }); + API.createAddUpDeduction(payload).then(({ status }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("新增成功"); + this.setState({ + addVisible: false + }, () => { + const { cumDeductStore: { doSearch, addForm } } = this.props; + const { monthValue, taxAgentId } = this.state; + doSearch({ + declareMonth: [monthValue], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + addForm.resetForm(); + }); + } else { + message.error("新增失败"); + } + }); + }; + deleteSelectAddUpDeduction = () => { + const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + if (selectedKey.length === 0) { + message.warning("未选择条目"); + return; + } + const payload = { + declareMonth, + ids: selectedKey + }; + Modal.confirm({ + title: "信息确认", + content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + onOk: () => { + API.deleteSelectAddUpDeduction(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + }, + onCancel: () => { + } + }); + + }; + deleteAllAddUpDeduction = () => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + const payload = { + declareMonth, + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }; + Modal.confirm({ + title: "信息确认", + content: `确定清空税款所属期为${declareMonth}的所有累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteAllAddUpDeduction(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + } + }); + }; + handleOperate = ({ key }, row) => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumDeductStore: { doSearch } } = this.props; + if (key === "edit") { + this.setState({ + addVisible: true, + editId: row.id + }); + } else if (key === "delete") { + const payload = { + declareMonth, + ids: [row.id] + }; + Modal.confirm({ + title: "信息确认", + content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的累计专项附加扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteSelectAddUpDeduction(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + } + }); + } + }; render() { - const { modalParam, slideSelectedKey, monthValue, taxAgentId, addVisible } = this.state; + const { modalParam, slideSelectedKey, monthValue, taxAgentId, addVisible, editId, saveLoading } = this.state; const { cumDeductStore, taxAgentStore } = this.props; const { loading, @@ -385,15 +501,16 @@ export default class CumDeduct extends React.Component { type="primary" onClick={() => { this.setState({ - addVisible: true + addVisible: true, + editId: "" }); }}> 新建 , + 删除所选 } @@ -497,6 +614,18 @@ export default class CumDeduct extends React.Component { this.onEdit(record)}> 查看明细 + { + showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } ) }; @@ -594,10 +723,11 @@ export default class CumDeduct extends React.Component { measure="%" title={ { const { baseInfo } = this.addItemRef.state; - const bool = _.every(baseInfo, v => !_.isEmpty(v)); + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); if (!bool) { Modal.warning({ title: "信息确认", @@ -605,7 +735,11 @@ export default class CumDeduct extends React.Component { }); return; } - console.log(baseInfo); + const payload = { + ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.createAddUpDeduction(payload); }} editable={!!addVisible} showOperateBtn={showOperateBtn} @@ -614,8 +748,13 @@ export default class CumDeduct extends React.Component { } content={ addVisible ? - this.addItemRef = dom} taxAgentOption={taxAgentOption} form={addForm} - condition={dataCollectCondition}/> : + this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + editId={editId} + condition={dataCollectCondition} + /> : @@ -626,14 +765,16 @@ export default class CumDeduct extends React.Component { onClose={() => { setSlideVisiable(false); this.setState({ - addVisible: false + addVisible: false, + editId: "" }); }} showMask={true} closeMaskOnClick={() => { setSlideVisiable(false); this.setState({ - addVisible: false + addVisible: false, + editId: "" }); }} /> diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less index d6caad16..dc458e34 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less @@ -37,6 +37,11 @@ .linkWapper { a { color: #4d7ad8; + margin-right: 8px; + } + + i { + cursor: pointer; } a:hover { @@ -45,6 +50,26 @@ } } +.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; + } + } + } +} + .wea-new-table { .ant-table-tbody { tr { @@ -56,30 +81,32 @@ } } -.slideOuterWrapper{ - .wea-slide-modal-title{ +.slideOuterWrapper { + .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){ - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: 100%!important; +@media (min-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; } } } + @media screen and (min-width: 1060px) and (max-width: 1260px) { - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: calc(100% - 96px)!important; + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; } } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index 26f64f75..265385d2 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -1,7 +1,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd"; +import { Button, Col, Dropdown, Menu, message, Modal, Row, Popover } from "antd"; import { WeaDatePicker, WeaHelpfulTip, WeaRightMenu, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; import moment from "moment"; import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 @@ -11,6 +11,7 @@ import { optionAddAll } from "../../../util/options"; import SlideModalTitle from "../../../components/slideModalTitle"; import EditSlideContent from "./editSlideContent"; import AddItems from "../addItems"; +import * as API from "../../../apis/cumSituation"; import "./index.less"; @@ -20,7 +21,9 @@ export default class CumSituation extends React.Component { constructor(props) { super(props); this.state = { + saveLoading: false, addVisible: false, + editId: "", value: "", selectedKey: [], slideSelectedKey: [], //详情表格的选中项 @@ -229,7 +232,7 @@ export default class CumSituation extends React.Component { }; // 搜索 - handleSearch() { + handleSearch = () => { const { cumSituationStore: { getTableDatas } } = this.props; const { monthValue, taxAgentId } = this.state; let params = {}; @@ -240,11 +243,124 @@ export default class CumSituation extends React.Component { params.taxAgentId = taxAgentId; } getTableDatas(params); + }; + //新功能 + createAddUpSituation= (payload)=>{ + this.setState({ saveLoading: true }); + API.createAddUpSituation(payload).then(({ status }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("新增成功"); + this.setState({ + addVisible: false, + editId: "" + }, () => { + const { cumSituationStore: { doSearch, addForm } } = this.props; + const { monthValue, taxAgentId } = this.state; + doSearch({ + declareMonth: [monthValue], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + addForm.resetForm(); + }); + } else { + message.error("新增失败"); + } + }); } + handleOperate = ({ key }, row) => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumSituationStore: { doSearch } } = this.props; + if (key === "edit") { + this.setState({ + addVisible: true, + editId: row.id + }); + } else if (key === "delete") { + const payload = { + declareMonth, + ids: [row.id] + }; + Modal.confirm({ + title: "信息确认", + content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的往期累计情况数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteSelectAddUpSituation(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + } + }); + } + }; + deleteSelectAddUpSituation = () => { + const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; + const { cumSituationStore: { doSearch } } = this.props; + if (selectedKey.length === 0) { + message.warning("未选择条目"); + return; + } + const payload = { + declareMonth, + ids: selectedKey + }; + Modal.confirm({ + title: "信息确认", + content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + onOk: () => { + API.deleteSelectAddUpSituation(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + }, + onCancel: () => { + } + }); + + }; + deleteAllAddUpSituation = () => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { cumSituationStore: { doSearch } } = this.props; + const payload = { + declareMonth, + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }; + Modal.confirm({ + title: "信息确认", + content: `确定清空税款所属期为${declareMonth}的所有往期累计情况的数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteAllAddUpSituation(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + } + }); + }; render() { const { cumSituationStore, taxAgentStore } = this.props; - const { slideSelectedKey, addVisible } = this.state; + const { slideSelectedKey, addVisible, editId, saveLoading } = this.state; const { loading, dataSource, @@ -382,9 +498,9 @@ export default class CumSituation extends React.Component { 新建 , + 删除所选 } @@ -487,6 +603,18 @@ export default class CumSituation extends React.Component { this.onEdit(record)}> 查看明细 + { + showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + } }; } else { @@ -572,10 +700,11 @@ export default class CumSituation extends React.Component { measure="%" title={ { const { baseInfo } = this.addItemRef.state; - const bool = _.every(baseInfo, v => !_.isEmpty(v)); + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); if (!bool) { Modal.warning({ title: "信息确认", @@ -583,7 +712,11 @@ export default class CumSituation extends React.Component { }); return; } - console.log(baseInfo); + const payload = { + ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.createAddUpSituation(payload); }} editable={!!addVisible} showOperateBtn={showOperateBtn} @@ -607,14 +740,16 @@ export default class CumSituation extends React.Component { onClose={() => { setSlideVisiable(false); this.setState({ - addVisible: false + addVisible: false, + editId: "" }); }} showMask={true} closeMaskOnClick={() => { setSlideVisiable(false); this.setState({ - addVisible: false + addVisible: false, + editId: "" }); }} />} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less index 8049f9cb..833b1df9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.less @@ -1,27 +1,64 @@ -.slideOuterWrapper{ - .wea-slide-modal-title{ +.slideOuterWrapper { + .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; + } + + .linkWapper { + a { + color: #4d7ad8; + margin-right: 8px; + } + + i { + cursor: pointer; + } + + a:hover { + text-decoration: none; + } } } -@media (min-width: 1260px){ - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: 100%!important; +.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; + } } } } + +@media (min-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; + } + } +} + @media screen and (min-width: 1060px) and (max-width: 1260px) { - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: calc(100% - 96px)!important; + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; } } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index c5aeb54d..9728b74d 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -1,7 +1,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd"; +import { Button, Col, Dropdown, Menu, message, Modal, Popover, Row } from "antd"; import { WeaDatePicker, WeaHelpfulTip, WeaRightMenu, WeaSelect, WeaSlideModal, WeaTab, WeaTable, WeaTop } from "ecCom"; import moment from "moment"; import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 @@ -11,7 +11,9 @@ import AddItems from "../addItems"; import SlideModalTitle from "../../../components/slideModalTitle"; import EditSlideContent from "./editSlideContent"; import { optionAddAll } from "../../../util/options"; +import * as API from "../../../apis/otherDeduct"; import "./index.less"; +import { deleteAllData, deleteSelectData } from "../../../apis/otherDeduct"; @inject("otherDeductStore", "taxAgentStore") @@ -20,7 +22,9 @@ export default class OtherDeduct extends React.Component { constructor(props) { super(props); this.state = { + saveLoading: false, addVisible: false, + editId: "", value: "", selectedKey: [], slideSelectedKey: [], //详情表格的选中项 @@ -224,7 +228,7 @@ export default class OtherDeduct extends React.Component { }); }; - handleSearch() { + handleSearch = () => { const { otherDeductStore: { getTableDatas } } = this.props; const { monthValue, taxAgentId } = this.state; let params = {}; @@ -235,7 +239,121 @@ export default class OtherDeduct extends React.Component { params.taxAgentId = taxAgentId; } getTableDatas(params); - } + }; + + //新功能 + createData = (payload) => { + this.setState({ saveLoading: true }); + API.createData(payload).then(({ status }) => { + this.setState({ saveLoading: false }); + if (status) { + message.success("新增成功"); + this.setState({ + addVisible: false, + editId: "" + }, () => { + const { otherDeductStore: { doSearch, addForm } } = this.props; + const { monthValue, taxAgentId } = this.state; + doSearch({ + declareMonth: [monthValue], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + addForm.resetForm(); + }); + } else { + message.error("新增失败"); + } + }); + }; + handleOperate = ({ key }, row) => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { otherDeductStore: { doSearch } } = this.props; + if (key === "edit") { + this.setState({ + addVisible: true, + editId: row.id + }); + } else if (key === "delete") { + const payload = { + declareMonth, + ids: [row.id] + }; + Modal.confirm({ + title: "信息确认", + content: `确定删除${row.departmentName}${row.username}(税款所属期:${declareMonth})的其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteSelectData(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + } + }); + } + }; + deleteSelectData = () => { + const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state; + const { otherDeductStore: { doSearch } } = this.props; + if (selectedKey.length === 0) { + message.warning("未选择条目"); + return; + } + const payload = { + declareMonth, + ids: selectedKey + }; + Modal.confirm({ + title: "信息确认", + content: "确定删除所选数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。", + onOk: () => { + API.deleteSelectData(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + }, + onCancel: () => { + } + }); + + }; + deleteAllData = () => { + const { monthValue: declareMonth, taxAgentId } = this.state; + const { otherDeductStore: { doSearch } } = this.props; + const payload = { + declareMonth, + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }; + Modal.confirm({ + title: "信息确认", + content: `确定清空税款所属期为${declareMonth}的所有其他免税扣除数据吗?若数据已参与核算,已参与核算的数据不会受影响,点击核算将会按当前列表最新数据重新核算。`, + onOk: () => { + API.deleteAllData(payload).then(({ status }) => { + if (status) { + message.success("删除成功"); + doSearch({ + declareMonth: [declareMonth], + taxAgentId: taxAgentId === "All" ? "" : taxAgentId + }); + } else { + message.error("删除失败"); + } + }); + } + }); + }; render() { const { otherDeductStore, taxAgentStore } = this.props; @@ -270,7 +388,7 @@ export default class OtherDeduct extends React.Component { setPageObj } = otherDeductStore; const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - const { modalParam, monthValue, taxAgentId, slideSelectedKey, addVisible } = this.state; + const { modalParam, monthValue, taxAgentId, slideSelectedKey, addVisible, editId, saveLoading } = this.state; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; @@ -368,15 +486,16 @@ export default class OtherDeduct extends React.Component { type="primary" onClick={() => { this.setState({ - addVisible: true + addVisible: true, + editId: "" }); }}> 新建 , + 删除所选 } @@ -455,8 +574,6 @@ export default class OtherDeduct extends React.Component { if (item.dataIndex === "username") { return { ...item, - width: 100, - fixed: "left", render: (text, record) =>
this.onEdit(record)}> @@ -466,20 +583,28 @@ export default class OtherDeduct extends React.Component { }; } else if (item.dataIndex === "taxAgentName") { return { - ...item, - width: 180, - fixed: "left" + ...item }; } else if (item.dataIndex === "operate") { return { ...item, - width: 100, - fixed: "right", render: (text, record) =>
this.onEdit(record)}> 查看明细 + { + showOperateBtn && + this.handleOperate(e, record)}> + 编辑 + 删除 + } title=""> + + + }
}; } else { @@ -522,7 +647,6 @@ export default class OtherDeduct extends React.Component { dataSource={dataSource} pagination={pagination} loading={loading} - scroll={{ x: 1300 }} /> @@ -570,10 +694,10 @@ export default class OtherDeduct extends React.Component { measure="%" title={ { const { baseInfo } = this.addItemRef.state; - const bool = _.every(baseInfo, v => !_.isEmpty(v)); + const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v)); if (!bool) { Modal.warning({ title: "信息确认", @@ -581,8 +705,13 @@ export default class OtherDeduct extends React.Component { }); return; } - console.log(baseInfo); + const payload = { + ..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]), + ...addForm.getFormParams() + }; + this.createData(payload); }} + loading={saveLoading} editable={!!addVisible} showOperateBtn={showOperateBtn} customOperate={(showOperateBtn && !addVisible) ? renderBtns() : []} @@ -590,8 +719,13 @@ export default class OtherDeduct extends React.Component { } content={ addVisible ? - this.addItemRef = dom} taxAgentOption={taxAgentOption} form={addForm} - condition={dataCollectCondition}/> : + this.addItemRef = dom} + taxAgentOption={taxAgentOption} + form={addForm} + editId={editId} + condition={dataCollectCondition} + /> : @@ -601,14 +735,16 @@ export default class OtherDeduct extends React.Component { onClose={() => { setSlideVisiable(false); this.setState({ - addVisible: false + addVisible: false, + editId: "" }); }} showMask={true} closeMaskOnClick={() => { setSlideVisiable(false); this.setState({ - addVisible: false + addVisible: false, + editId: "" }); }} />} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less index eba96b4d..081d0280 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less @@ -2,6 +2,11 @@ .linkWapper { a { color: #4d7ad8; + margin-right: 8px; + } + + i { + cursor: pointer; } a:hover { @@ -9,30 +14,54 @@ } } } -.slideOuterWrapper{ - .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; + } + } + } +} + + +.slideOuterWrapper { + .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){ - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: 100%!important; +@media (min-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; } } } + @media screen and (min-width: 1060px) and (max-width: 1260px) { - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: calc(100% - 96px)!important; + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; } } } diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/index.js b/pc4mobx/hrmSalary/pages/ruleConfig/index.js index bafd5e0f..590aebc4 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/index.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/index.js @@ -282,7 +282,7 @@ export const Select = payload => { return ( onChange({ type: label, selected })}/> + onChange={(selected, showName) => onChange({ type: label, selected, showName })}/> ); }; diff --git a/pc4mobx/hrmSalary/stores/otherDeduct.js b/pc4mobx/hrmSalary/stores/otherDeduct.js index 91457537..2f413560 100644 --- a/pc4mobx/hrmSalary/stores/otherDeduct.js +++ b/pc4mobx/hrmSalary/stores/otherDeduct.js @@ -4,7 +4,6 @@ import { WeaForm, WeaTableNew } from "comsMobx"; import { removePropertyCondition } from "../util/response"; import * as API from "../apis/otherDeduct"; // 引入API接口文件 -import * as TaxAgentApi from "../apis/taxAgent"; const { TableStore } = WeaTableNew;