diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index 473621c9..8243f721 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -296,3 +296,7 @@ export const addDeductionAmount = (params) => { export const deleteDeductionAmount = (params) => { return postFetch("/api/bs/hrmsalary/deductionAmount/delete", params); }; +//扣除名单确认-编辑人员 +export const editDeductionAmount = (params) => { + return postFetch("/api/bs/hrmsalary/deductionAmount/edit", params); +}; diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionAmountEditDialog.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionAmountEditDialog.js new file mode 100644 index 00000000..47a97b90 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionAmountEditDialog.js @@ -0,0 +1,78 @@ +/* + * 扣除名单确认 + * 编辑是否扣除 + * @Author: 黎永顺 + * @Date: 2025/3/27 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button, message } from "antd"; +import { WeaForm } from "comsMobx"; +import FormInfo from "../../../components/FormInfo"; +import { deductConditions } from "../constants"; +import * as API from "../../../apis/declare"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; +const form = new WeaForm(); + +class DeductionAmountEditDialog extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.initForm(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) form.resetForm(); + } + + initForm = (props) => { + const { record } = props; + this.setState({ + conditions: _.map(deductConditions, item => ({ + ...item, + items: _.map(item.items, o => ({ ...o, value: record[getKey(o)] + "", label: getLabel(o.lanId, o.label) })) + })) + }, () => form.initFormFields(this.state.conditions)); + }; + save = () => { + form.validateForm().then(f => { + if (f.isValid) { + const { id } = this.props.record; + const paylaod = { id, deductFlag: form.getFormParams().deductFlag }; + this.setState({ loading: true }); + API.editDeductionAmount(paylaod).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功!")); + this.props.onCancel(this.props.onSuccess); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + + + render() { + const { conditions, loading } = this.state; + const height = _.reduce(conditions, (pre, cur) => pre + cur.items.length, 0).length * 47; + return ({getLabel(111, "确定")}, + ]}> + + ); + } +} + +export default DeductionAmountEditDialog; diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmDialog.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmDialog.js index 79440338..70f89a0f 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmDialog.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmDialog.js @@ -8,8 +8,9 @@ */ import React, { Component } from "react"; import { WeaButtonIcon, WeaDialog, WeaLocaleProvider, WeaTable, WeaTools } from "ecCom"; -import { message, Modal } from "antd"; import DeductionListConfirmEmployeeDialog from "./deductionListConfirmEmployeeDialog"; +import DeductionAmountEditDialog from "./deductionAmountEditDialog"; +import { message, Modal } from "antd"; import * as API from "../../../apis/declare"; const { getLabel } = WeaLocaleProvider, { getUrlParams } = WeaTools; @@ -19,7 +20,7 @@ class DeductionListConfirmDialog extends Component { super(props); this.state = { pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, columns: [], dataSource: [], visible: false, - selectedRowKeys: [] + selectedRowKeys: [], editDialog: { visible: false, record: {} } }; } @@ -47,7 +48,9 @@ class DeductionListConfirmDialog extends Component { return { ...o }; }), { title: getLabel(111, "操作"), dataIndex: "action", - render: (v, record) => ({getLabel(111, "编辑")}) + render: (v, record) => ( this.setState({ + editDialog: { visible: true, record } + })}>{getLabel(111, "编辑")}) }] }); } @@ -61,7 +64,7 @@ class DeductionListConfirmDialog extends Component { API.deleteDeductionAmount({ ids: this.state.selectedRowKeys }).then(({ status, errormsg }) => { if (status) { message.success(getLabel(111, "操作成功")); - this.getDeductionAmountList(); + this.setState({ selectedRowKeys: [] }, () => this.getDeductionAmountList()); } else { message.error(errormsg); } @@ -71,7 +74,7 @@ class DeductionListConfirmDialog extends Component { }; render() { - const { loading, columns, dataSource, pageInfo, visible, selectedRowKeys } = this.state; + const { loading, columns, dataSource, pageInfo, visible, selectedRowKeys, editDialog } = this.state; const pagination = { ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, @@ -96,7 +99,7 @@ class DeductionListConfirmDialog extends Component { return (
@@ -108,6 +111,10 @@ class DeductionListConfirmDialog extends Component {
+ this.setState({ + editDialog: { visible: false, record: {} } + }, () => callback && callback())}/> this.setState({ visible: false }, () => callback && callback())}/> diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmEmployeeDialog.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmEmployeeDialog.js index 66388df3..1f094b81 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmEmployeeDialog.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/deductionListConfirmEmployeeDialog.js @@ -92,14 +92,8 @@ class DeductionListConfirmEmployeeDialog extends Component { onClick={this.save}>{getLabel(111, "确认")}, ]} style={{ - width: 1150, - height: 606.6, - minHeight: 200, - minWidth: 380, - maxHeight: "90%", - maxWidth: "90%", - overflow: "hidden", - transform: "translate(0px, 0px)" + width: 1150, height: 490, minHeight: 200, minWidth: 380, maxHeight: "90%", maxWidth: "90%", + overflow: "hidden", transform: "translate(0px, 0px)" }}>