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 new file mode 100644 index 00000000..7f92a0cb --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/batchUpdateSalaryItemValDialog.js @@ -0,0 +1,75 @@ +/* + * Author: 黎永顺 + * name: 批量更新-薪资项目的值 + * Description: + * 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 { getSearchs, toDecimal_n } from "../../../../../util"; +import { salaryacctBatchUpdate } from "../../../../../apis/calculate"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("calculateStore") +@observer +class BatchUpdateSalaryItemValDialog extends Component { + constructor(props) { + super(props); + this.state = { + loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visibe && !nextProps.visible) nextProps.calculateStore.initBatchUpdateForm(); + } + + save = () => { + const { + calculateStore: { batchUpdateForm }, salaryAcctRecordId, salaryItemId, + idList, pattern, dataType + } = this.props; + batchUpdateForm.validateForm().then(f => { + if (f.isValid) { + const { value } = batchUpdateForm.getFormParams(); + this.setState({ loading: true }); + const payload = { + salaryAcctRecordId, salaryItemId, idList, + value: dataType === "number" ? toDecimal_n(value, pattern) : value + }; + 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, "保存")} + ]} + > +
{getSearchs(batchUpdateForm, conditions, 1, false)}
+
+ ); + } +} + +export default BatchUpdateSalaryItemValDialog; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js index 59fcb015..9340de40 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js @@ -143,3 +143,34 @@ export const editCalcSearchConditions = [ title: "常用条件" } ]; +export const batchUpdateConditions = [ + { + items: [ + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["salaryItemName"], + fieldcol: 14, + label: "批量编辑项目", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 1 + }, + { + colSpan: 1, + conditionType: "INPUTNUMBER", + domkey: ["value"], + fieldcol: 14, + label: "批量编辑为", + lanId: 111, + labelcol: 6, + value: "", + rules: "required", + viewAttr: 3 + } + ], + defaultshow: true, + title: "" + } +]; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js index 5a3e2aa3..7c0124f9 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js @@ -5,14 +5,17 @@ * Date: 2023/9/14 */ import React, { Component } from "react"; -import { WeaLocaleProvider } from "ecCom"; +import { WeaLocaleProvider, WeaTools } from "ecCom"; import { message, Modal, Spin } from "antd"; import { inject, observer } from "mobx-react"; import { acctResultList, updateLockStatus } from "../../../../../apis/calculate"; import ProgressModal from "../../../../../components/progressModal"; +import BatchUpdateSalaryItemValDialog from "./batchUpdateSalaryItemValDialog"; import EditSalaryCalcSlide from "./editSalaryCalcSlide"; +import { batchUpdateConditions } from "./condition"; const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; @inject("calculateStore") @observer @@ -22,7 +25,11 @@ class EditCalcTable extends Component { this.state = { loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [], progressVisible: false, progress: 0, - salaryCalcSlide: { visible: false, id: "" } + salaryCalcSlide: { visible: false, id: "" }, originPayloadData: {}, + batchUpdateDialog: { + visible: false, salaryAcctRecordId: "", idList: [], salaryItemId: "", + conditions: [], pattern: 0, dataType: "" + } }; this.timerLock = null; } @@ -51,6 +58,10 @@ class EditCalcTable extends Component { break; case "LOCKING": const { salaryItemId, lockType: lockStatus } = params; + if (lockStatus === "BATCHUPDATE") { + this.batchUpdateSalaryItemVal(params); + return; + } this.updateLockStatus({ lockStatus, salaryItemId }); break; case "EDIT": @@ -110,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, dataType, 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); @@ -125,8 +169,9 @@ class EditCalcTable extends Component { "当前状态未锁定,点击锁定": getLabel(111, "当前状态未锁定,点击锁定"), "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), "总计": getLabel(523, "总计"), "批量解锁": getLabel(111, "批量解锁"), - "批量锁定": getLabel(111, "批量锁定") + "批量锁定": getLabel(111, "批量锁定"), "批量更新": getLabel(111, "批量更新") }; + this.setState({ originPayloadData: { ...payload, i18n } }); const childFrameObj = document.getElementById("atdTable"); childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; @@ -151,7 +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, showTotalCell: this.props.showTotalCell, sumRowlistUrl, payload, + dataSource, pageInfo, selectedRowKeys, payload, + showTotalCell: this.props.showTotalCell, sumRowlistUrl, columns: _.every(traverse(columns), (it, idx) => !it.fixed) ? _.map(traverse(columns), (it, idx) => ({ ...it, fixed: idx < 2 ? "left" : false @@ -161,9 +207,12 @@ class EditCalcTable extends Component { } }).catch(() => this.setState({ loading: false })); }; + handleBatchEditing = () => { + }; + render() { - const { loading, progressVisible, progress, salaryCalcSlide } = this.state; + const { loading, progressVisible, progress, salaryCalcSlide, batchUpdateDialog } = this.state; return (
@@ -173,6 +222,11 @@ class EditCalcTable extends Component { src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/calcTable" id="atdTable" /> + this.setState({ + batchUpdateDialog: { ...batchUpdateDialog, visible: false } + }, () => isRefresh && this.queryCalcResultList())} + /> this.setState({ salaryCalcSlide: { @@ -205,12 +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, align: "center" }; } else { return { title: item.text, width: item.width + "px", fixed: item.fixed || false, - dataIndex: item.column, ellipsis: true, lockStatus: item.lockStatus + dataIndex: item.column, ellipsis: true, lockStatus: item.lockStatus, + pattern: item.pattern, dataType: item.dataType, align: "center" }; } }); diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js index 8618f667..caf11158 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js @@ -6,6 +6,7 @@ */ import React, { Component } from "react"; import { WeaHelpfulTip, WeaLocaleProvider } from "ecCom"; +import { Button } from "antd"; import { getColumnDesc, getSalarySobCycle } from "../../../../../apis/calculate"; import { sysConfCodeRule } from "../../../../../apis/ruleconfig"; import EditCalcAdvanceSearchPannel from "./editCalcAdvanceSearchPannel"; @@ -48,6 +49,9 @@ class Index extends Component { } }; handleShowFormulaTa = (dataIndex) => this.setState({ formulaTd: dataIndex }); + handleBatchEditing = (editable) => { + this.calcTableRef.wrappedInstance.handleBatchEditing(editable); + }; render() { const { salarySobCycle, showSearchAd, formulaTd, columnDesc, showTotalCell } = this.state; @@ -72,7 +76,10 @@ class Index extends Component { {getLabel(18125, "公式")}= {formulaObj.formulaContent}
-
+
+ {/**/} +
this.batchUpdateForm = new WeaForm(); @observable tableStore = new TableStore(); // new table @observable form = new WeaForm(); // nrew 一个form