diff --git a/pc4mobx/hrmSalary/apis/standingBook.js b/pc4mobx/hrmSalary/apis/standingBook.js index 5182ea00..592597ac 100644 --- a/pc4mobx/hrmSalary/apis/standingBook.js +++ b/pc4mobx/hrmSalary/apis/standingBook.js @@ -205,3 +205,11 @@ export const cacheWelfareListField = (params) => { export const cacheBalanceWelfareList = (params) => { return postFetch("/api/bs/hrmsalary/siaccount/cacheBalanceWelfareList", params); }; +// 社保福利台账正常缴纳-增加人员并核算 +export const addSocialAcctEmp = (params) => { + return postFetch("/api/bs/hrmsalary/siaccount/addSocialAcctEmp", params); +}; +// 社保福利台账正常缴纳-增加人员并核算 +export const deleteSocialAcctEmp = (params) => { + return postFetch("/api/bs/hrmsalary/siaccount/deleteSocialAcctEmp", params); +}; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js index 1da82c0b..fa802cdc 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js @@ -16,8 +16,8 @@ import AdjustmentSlide from "./adjustmentSlide"; import { getCalculateProgress } from "../../../../apis/calculate"; import RegEditDetial from "./regEditDetial"; import SupplementarySlide from "./supplementarySlide"; -import _ from "lodash"; import "./index.less"; +import { addSocialAcctEmp, deleteSocialAcctEmp } from "../../../../apis/standingBook"; const getLabel = WeaLocaleProvider.getLabel; @inject("standingBookStore") @@ -61,7 +61,8 @@ export default class NormalIndex extends Component { }, showSum: false, siaccountSum: {}, - showSearchAd: false + showSearchAd: false, + normalPayer: "" }; this.timer = null; this.timerDelete = null; @@ -167,85 +168,11 @@ export default class NormalIndex extends Component { }); }; - handleSave = () => { - const { - siaccountCommonSave, - siaccountSupplementarySave, - form - } = this.props.standingBookStore; - const { billMonth, selectedKey, paymentOrganization } = this.props; - if (selectedKey === "1") { - const { includes, excludes } = form.getFormParams(); - const payload = { - billMonth, - includes: includes.split(","), - excludes: _.isEmpty(excludes) ? excludes.split(",") : [] - }; - siaccountCommonSave(payload).then(() => { - message.success("添加成功"); - this.getNormalList({ - billMonth, - paymentOrganization, - current: this.state.current - }); - this.setState({ - addProps: { - ...this.state.addProps, - title: "", - visible: false - } - }); - }); - } else { - const paymentOrganization = getQueryString("paymentOrganization"); - form.validateForm().then(f => { - if (f.isValid) { - const { - includes, - billMonth: billMonthList, - excludes, - projects - } = form.getFormParams(); - const payload = { - billMonth, - billMonthList: billMonthList.split(","), - includes: includes.split(","), - // excludes: excludes.split(","), - projects: projects.split(","), - paymentOrganization - }; - siaccountSupplementarySave(payload).then(() => { - message.success("添加成功"); - this.getSupplementaryList({ - billMonth, - current: this.state.current, - paymentOrganization - }); - this.setState( - { - addProps: { - ...this.state.addProps, - title: "", - visible: false - } - }, - () => { - form.resetForm(); - } - ); - }); - } else { - f.showErrors(); - this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新 - } - }); - } - }; getNormalList = async (payload = {}) => { const { getNormalList } = this.props.standingBookStore; getNormalList({ ...payload, pageSize: this.state.pageSize }).then(({ list, columns = [], total }) => { this.setState({ - tableData: { list, total, columns } + tableData: { list, total, columns }, normalPayer: "" }, () => this.postMessageToChild()); }); }; @@ -341,16 +268,7 @@ export default class NormalIndex extends Component { }); } }; - handleAdd = () => { - this.setState({ - addProps: { - ...this.state.addProps, - title: "添加缴纳人员", - visible: true - } - }); - }; - + handleAdd = () => this.setState({ addProps: { ...this.state.addProps, title: "添加缴纳人员", visible: true } }); handleCommonAccountClick = () => { const { billMonth, selectedKey, paymentOrganization } = this.props; const { commonAccount } = this.props.standingBookStore; @@ -410,7 +328,43 @@ export default class NormalIndex extends Component { }, 600); }); }; + handleAddSocialAcctEmp = () => { + const { billMonth, paymentOrganization } = this.props, { normalPayer } = this.state; + addSocialAcctEmp({ billMonth, paymentOrganization, includes: normalPayer.split(",") }) + .then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功")); + this.getNormalList({ + billMonth, paymentOrganization, + current: calcPageNo(this.state.tableData.total, this.state.current, 10, normalPayer.split(",").length) + }); + } else { + message.error(errormsg); + } + }); + }; + handleDeleteNormalPayer = () => { + Modal.confirm({ + title: getLabel(111, "确认信息"), + content: getLabel(111, "确认删除勾选的数据吗?"), + onOk: () => { + const { billMonth, paymentOrganization } = this.props, { selectedRowKeys: ids } = this.state; + deleteSocialAcctEmp({ billMonth, paymentOrganization, ids }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.getNormalList({ + billMonth, + paymentOrganization, + current: calcPageNo(this.state.tableData.total, this.state.current, 10, ids.length) + }); + } else { + message.error(errormsg); + } + }); + } + }); + }; handleExport = () => { const { billMonth, selectedKey, paymentOrganization } = this.props; const urlObj = { @@ -485,8 +439,12 @@ export default class NormalIndex extends Component { ]; const btn2 = [ , - , + onClick={this.handleDeleteNormalPayer}/>, + this.setState({ normalPayer: ids }, () => this.handleAddSocialAcctEmp())} + > + + , ,