diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index a8ee74c4..b0efbcef 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -246,3 +246,7 @@ export const getExportField = params => { export const customCacheExportField = (params) => { return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheExportField", params); }; +//薪资核算-批量更新 +export const salaryacctBatchUpdate = (params) => { + return postFetch("/api/bs/hrmsalary/salaryacct/acctresult/batchUpdate", params); +}; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/batchUpdateSalaryItemValDialog.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/batchUpdateSalaryItemValDialog.js index c9af3e66..92f0f532 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/batchUpdateSalaryItemValDialog.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/batchUpdateSalaryItemValDialog.js @@ -5,10 +5,11 @@ * Date: 2023/12/6 */ import React, { Component } from "react"; +import { Button, message } from "antd"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; -import { Button } from "antd"; -import { getSearchs } from "../../../../../util"; +import { getSearchs, toDecimal_n } from "../../../../../util"; +import { salaryacctBatchUpdate } from "../../../../../apis/calculate"; const getLabel = WeaLocaleProvider.getLabel; @@ -26,13 +27,35 @@ class BatchUpdateSalaryItemValDialog extends Component { if (nextProps.visible !== this.props.visibe && !nextProps.visible) nextProps.calculateStore.initBatchUpdateForm(); } + save = () => { + const { calculateStore: { batchUpdateForm }, salaryAcctRecordId, salaryItemId, idList, pattern } = this.props; + batchUpdateForm.validateForm().then(f => { + if (f.isValid) { + const { value } = batchUpdateForm.getFormParams(); + this.setState({ loading: true }); + const payload = { salaryAcctRecordId, salaryItemId, idList, value: toDecimal_n(value, pattern) }; + this.setState({ loading: false }); + salaryacctBatchUpdate(payload).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(30700, "操作成功!")); + this.props.onCancel(true); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + render() { const { loading } = this.state; const { conditions, calculateStore: { batchUpdateForm } } = this.props; return ( {getLabel(537558, "保存")} ]} diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js index f0c59ed1..9340de40 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js @@ -166,7 +166,7 @@ export const batchUpdateConditions = [ lanId: 111, labelcol: 6, value: "", - rules: "required|string", + rules: "required", viewAttr: 3 } ], diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js index 86bb622e..e8b4c67d 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js @@ -27,10 +27,9 @@ class EditCalcTable extends Component { selectedRowKeys: [], progressVisible: false, progress: 0, salaryCalcSlide: { visible: false, id: "" }, originPayloadData: {}, batchUpdateDialog: { - visible: false, salaryAcctRecordId: "", salaryAcctEmpIdList: [], salaryItemId: "", - conditions: [] - }, - editable: false + visible: false, salaryAcctRecordId: "", idList: [], salaryItemId: "", + conditions: [], pattern: 0 + } }; this.timerLock = null; } @@ -58,29 +57,9 @@ class EditCalcTable extends Component { this.props.onShowFormulaTd(dataIndex); break; case "LOCKING": - const { salaryItemId, salaryItemName, inputNode, pattern, lockType: lockStatus } = params; + const { salaryItemId, lockType: lockStatus } = params; if (lockStatus === "BATCHUPDATE") { - const { routeParams: { salaryAcctRecordId }, calculateStore: { batchUpdateForm } } = this.props; - const { selectedRowKeys: salaryAcctEmpIdList } = this.state; - this.setState({ - batchUpdateDialog: { - ...this.state.batchUpdateDialog, visible: true, salaryAcctRecordId, salaryItemId, - salaryAcctEmpIdList, conditions: _.map(batchUpdateConditions, item => ({ - ...item, items: _.map(item.items, o => { - if (getKey(o) === "value") { - const otherParams = inputNode === "number" ? { precision: pattern } : {}; - return { - ...o, ...otherParams, conditionType: inputNode === "number" ? "INPUTNUMBER" : "INPUT" - }; - } - return { ...o }; - }) - })) - } - }, () => { - batchUpdateForm.initFormFields(this.state.batchUpdateDialog.conditions); - batchUpdateForm.updateFields({ salaryItemName }); - }); + this.batchUpdateSalaryItemVal(params); return; } this.updateLockStatus({ lockStatus, salaryItemId }); @@ -142,6 +121,39 @@ class EditCalcTable extends Component { } }); }; + batchUpdateSalaryItemVal = (payload) => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content:
+
{getLabel(111, "确认编辑所有人员薪资核算记录?")}
+
, + onOk: () => { + const { salaryItemId, salaryItemName, dataType, pattern } = payload; + const { routeParams: { salaryAcctRecordId }, calculateStore: { batchUpdateForm } } = this.props; + const { selectedRowKeys: idList } = this.state; + this.setState({ + batchUpdateDialog: { + ...this.state.batchUpdateDialog, visible: true, salaryAcctRecordId, salaryItemId, + idList, pattern, conditions: _.map(batchUpdateConditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "value") { + const otherParams = dataType === "number" ? { precision: pattern } : {}; + return { + ...o, ...otherParams, label: getLabel(o.lanId, o.label), + conditionType: dataType === "number" ? "INPUTNUMBER" : "INPUT" + }; + } + return { ...o, label: getLabel(o.lanId, o.label) }; + }) + })) + } + }, () => { + batchUpdateForm.initFormFields(this.state.batchUpdateDialog.conditions); + batchUpdateForm.updateFields({ salaryItemName }); + }); + } + }); + }; componentWillUnmount() { window.removeEventListener("message", this.handleReceive, false); @@ -164,7 +176,7 @@ class EditCalcTable extends Component { childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; queryCalcResultList = () => { - const { pageInfo, editable } = this.state; + const { pageInfo } = this.state; const { calculateStore: { ECSearchForm, otherConditions }, routeParams: { salaryAcctRecordId } } = this.props; const { subcompanyIds, departmentIds, positionIds, statuses, ...extra } = ECSearchForm.getFormParams(); const payload = { @@ -184,9 +196,8 @@ class EditCalcTable extends Component { const { pageInfo, selectedRowKeys } = this.state; const sumRowlistUrl = this.props.showTotalCell ? "/api/bs/hrmsalary/salaryacct/acctresult/sum" : ""; this.postMessageToChild({ - dataSource, pageInfo, selectedRowKeys, + dataSource, pageInfo, selectedRowKeys, payload, showTotalCell: this.props.showTotalCell, sumRowlistUrl, - payload, editable, columns: _.every(traverse(columns), (it, idx) => !it.fixed) ? _.map(traverse(columns), (it, idx) => ({ ...it, fixed: idx < 2 ? "left" : false @@ -196,8 +207,7 @@ class EditCalcTable extends Component { } }).catch(() => this.setState({ loading: false })); }; - handleBatchEditing = (editable) => { - this.setState({ editable }, () => this.postMessageToChild({ ...this.state.originPayloadData, editable })); + handleBatchEditing = () => { }; @@ -213,9 +223,9 @@ class EditCalcTable extends Component { id="atdTable" /> this.setState({ + onCancel={(isRefresh) => this.setState({ batchUpdateDialog: { ...batchUpdateDialog, visible: false } - })} + }, () => isRefresh && this.queryCalcResultList())} /> this.setState({ @@ -249,13 +259,13 @@ const traverse = (arr) => { return { title: item.text, width: item.width + "px", ellipsis: true, dataIndex: item.column, children: traverse(item.children), - fixed: item.fixed || false + fixed: item.fixed || false, dataType: item.dataType }; } else { return { title: item.text, width: item.width + "px", fixed: item.fixed || false, dataIndex: item.column, ellipsis: true, lockStatus: item.lockStatus, - pattern: item.pattern + pattern: item.pattern, dataType: item.dataType }; } });