diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFilesEditSlide/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFilesEditSlide/index.js index d93c4aba..8e6aa1c5 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFilesEditSlide/index.js +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFilesEditSlide/index.js @@ -211,11 +211,12 @@ class Index extends Component { } this.setState({ + onSuccess={() => this.props.onClose(false)} + onCancel={(callback) => this.setState({ adjLogRecordDialog: { ...adjLogRecordDialog, visible: false, title: "", salaryArchiveId: "" } - })} + }, () => callback && callback())} /> } /> diff --git a/pc4mobx/hrmSalary/pages/salaryFile/columns.js b/pc4mobx/hrmSalary/pages/salaryFile/columns.js index a34d95bf..88a313b4 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/columns.js @@ -75,6 +75,17 @@ export const adjCondition = [ labelcol: 6, value: "", viewAttr: 2 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["sumVal"], + fieldcol: 18, + label: "工资总额", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 1 } ], title: "调薪信息", diff --git a/pc4mobx/hrmSalary/pages/salaryFile/salaryArchiveEditAdjLogRecord.js b/pc4mobx/hrmSalary/pages/salaryFile/salaryArchiveEditAdjLogRecord.js index 6975ee63..390d4f43 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/salaryArchiveEditAdjLogRecord.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/salaryArchiveEditAdjLogRecord.js @@ -16,7 +16,8 @@ import { } from "../../apis/archive"; import { inject, observer } from "mobx-react"; import { adjCondition } from "./columns"; -import { getDomkes, getSearchs, toDecimal_n } from "../../util"; +import { getDomkes, toDecimal_n } from "../../util"; +import FormInfo from "../../components/FormInfo"; import moment from "moment"; const { getLabel } = WeaLocaleProvider; @@ -52,17 +53,20 @@ class SalaryArchiveEditAdjLogRecordDialog extends Component { getSingleSalaryItemInfo = (props) => { const { salaryFileStore: { adjForm }, id, salaryArchiveId: salaryArchiveItemId } = props; this.setState({ loading: true }); - APIFox[id ? "editForm" : "saveForm"](id ? { id } : { salaryArchiveItemId }) + APIFox[id ? "editForm" : "saveForm"](id ? { id } : { salaryArchiveItemId, salaryArchiveId: salaryArchiveItemId }) .then(({ status, data }) => { this.setState({ loading: false }); if (status) { - const { salaryArchiveItemForm, salaryArchiveItemDetail, canOperator } = data; + const { salaryArchiveItemForm, salaryArchiveItemDetail, currentEffectiveList, sumVal, canOperator } = data; const { adjustReasonList } = salaryArchiveItemForm; + const datas = id ? salaryArchiveItemDetail.list : _.map(currentEffectiveList, o => ({ + salaryItem: String(o.id), salaryBefore: o.value, adjustAfter: o.value + })); this.setState({ canOperator, salaryArchiveItemDetail: { ...salaryArchiveItemDetail, - list: _.map(salaryArchiveItemDetail.list, o => ({ + list: _.map(datas, o => ({ ...o, dataType: _.find(salaryArchiveItemDetail.salaryItemList, g => g.id === o.salaryItem).dataType, pattern: _.find(salaryArchiveItemDetail.salaryItemList, g => g.id === o.salaryItem).pattern })) @@ -78,16 +82,22 @@ class SalaryArchiveEditAdjLogRecordDialog extends Component { options: _.map(adjustReasonList, it => ({ key: it.id, showname: it.content })) }; } - return { ...o }; + return { ...o, hide: id && getKey(o) === "sumVal" }; }) }; }) }, () => { adjForm.initFormFields(this.state.conditions); _.map(getDomkes(this.state.conditions), domkey => { - adjForm.updateFields({ - [domkey]: salaryArchiveItemForm[domkey] || "" - }); + if (domkey !== "sumVal") { + adjForm.updateFields({ + [domkey]: salaryArchiveItemForm[domkey] || "" + }); + } else { + adjForm.updateFields({ + sumVal: sumVal || "" + }); + } }); }); } @@ -121,7 +131,7 @@ class SalaryArchiveEditAdjLogRecordDialog extends Component { }); }; handleChangeAdjustAfter = (record, v) => { - const { salaryArchiveItemDetail } = this.state; + const { salaryArchiveItemDetail } = this.state, { salaryFileStore: { adjForm } } = this.props; const { list } = salaryArchiveItemDetail; this.setState({ salaryArchiveItemDetail: { @@ -135,6 +145,13 @@ class SalaryArchiveEditAdjLogRecordDialog extends Component { return { ...o }; }) } + }, () => { + const { salaryArchiveItemDetail } = this.state; + adjForm.updateFields({ + sumVal: _.reduce(salaryArchiveItemDetail.list, (pre, cur) => { + return pre + parseFloat(cur.adjustAfter || 0); + }, 0).toString() + }); }); }; save = () => { @@ -162,7 +179,7 @@ class SalaryArchiveEditAdjLogRecordDialog extends Component { this.setState({ saveLoading: false }); if (status) { message.success(getLabel(22619, "保存成功!")); - this.props.onCancel(); + this.props.onCancel(this.props.onSuccess); fetchSingleSalaryItemList({ salaryArchiveId }); getArchiveForm(salaryArchiveId); } else { @@ -209,6 +226,7 @@ class SalaryArchiveEditAdjLogRecordDialog extends Component { width: "30%" } ]; + const itemRender = {}; return ( { !loading ? - {getSearchs(adjForm, conditions, 1)} + {/*{getSearchs(adjForm, conditions, 1)}*/} + this.tableEdit = dom} deleteConfirm