diff --git a/pc4mobx/hrmSalary/components/externalPersonModal/index.js b/pc4mobx/hrmSalary/components/externalPersonModal/index.js index 64f21fbf..b84a3aee 100644 --- a/pc4mobx/hrmSalary/components/externalPersonModal/index.js +++ b/pc4mobx/hrmSalary/components/externalPersonModal/index.js @@ -17,6 +17,12 @@ class Index extends Component { }; } + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.setState({ targetIds: "", targetNames: "" }); + } + } + handleExternalPersonSave = () => { const { targetIds } = this.state; const { onExternalPersonSave } = this.props; diff --git a/pc4mobx/hrmSalary/pages/salary/components/personalScope.js b/pc4mobx/hrmSalary/pages/salary/components/personalScope.js index 54ba7ccb..66070632 100644 --- a/pc4mobx/hrmSalary/pages/salary/components/personalScope.js +++ b/pc4mobx/hrmSalary/pages/salary/components/personalScope.js @@ -8,33 +8,37 @@ import React, { Component } from "react"; import { Button, message, Modal } from "antd"; import { inject, observer } from "mobx-react"; import { WeaButtonIcon, WeaInputSearch, WeaTab } from "ecCom"; -import { taxAgentRangeDelete, taxAgentRangeImportData, taxAgentRangePreview } from "../../../apis/taxAgent"; +import { + taxAgentRangeDelete, + taxAgentRangeExtDelete, + taxAgentRangeExtSave, + taxAgentRangeImportData, + taxAgentRangePreview +} from "../../../apis/taxAgent"; +import { sysinfo } from "../../../apis/ruleconfig"; import PersonalScopeTable from "./personalScopeTable"; import PersonalScopeModal from "./personalScopeModal"; import ImportModal from "../../../components/importModal"; +import ExternalPersonModal from "../../../components/externalPersonModal"; import { importEmployColumns } from "../../taxAgent/columns"; - @inject("taxAgentStore") @observer class PersonalScope extends Component { constructor(props) { super(props); this.state = { - searchValue: "", - selectedKey: "listInclude", - rowKeys: [], - personalAddModal: { - visible: false, - title: "关联人员", - includeType: "" + searchValue: "", selectedKey: "listInclude", + rowKeys: [], personalAddModal: { + visible: false, externalVisible: false, + title: "关联人员", includeType: "" }, - previewDataSource: [], - importParams: { + previewDataSource: [], importParams: { visible: false, step: 0, importResult: {} - } + }, extEmpsWitch: "1", //非系统人员开关, 1: 开启, 0:关闭 + loading: false }; this.personalScopeTableRef = null; } @@ -42,8 +46,20 @@ class PersonalScope extends Component { componentDidMount() { const { taxAgentStore: { hasIconInTax } } = this.props; hasIconInTax(); + this.getSysinfo(); } + /* + * Author: 黎永顺 + * Description:非系统人员开关查询 + * Params: + * Date: 2023/11/9 + */ + getSysinfo = () => { + sysinfo().then(({ status, data }) => { + if (status) this.setState({ extEmpsWitch: data.extEmpsWitch }); + }); + }; /* * Author: 黎永顺 * Description: 删除人员范围 @@ -55,7 +71,9 @@ class PersonalScope extends Component { title: "信息确认", content: "确认要删除吗?", onOk: () => { - taxAgentRangeDelete(this.state.rowKeys).then(({ status, errormsg }) => { + const { selectedKey } = this.state; + const API = selectedKey === "listExt" ? taxAgentRangeExtDelete : taxAgentRangeDelete; + API(this.state.rowKeys).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); this.setState({ rowKeys: [] }, () => { @@ -65,8 +83,6 @@ class PersonalScope extends Component { message.error(errormsg || "删除失败"); } }); - }, - onCancel: () => { } }); }; @@ -81,7 +97,8 @@ class PersonalScope extends Component { this.setState({ personalAddModal: { ...personalAddModal, - visible: true, + visible: selectedKey !== "listExt", + externalVisible: selectedKey === "listExt", includeType: selectedKey === "listInclude" ? 1 : 0 } }); @@ -109,9 +126,37 @@ class PersonalScope extends Component { } }); }; + /* + * Author: 黎永顺 + * Description: 保存非系统人员 + * Params: + * Date: 2023/11/9 + */ + handleSaveExtPersons = (payload = {}) => { + const { taxAgentId } = this.props; + const { personalAddModal } = this.state; + this.setState({ loading: false }); + taxAgentRangeExtSave({ taxAgentId, ...payload }).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success("新增成功"); + this.setState({ + personalAddModal: { + ...personalAddModal, + externalVisible: false + } + }, () => this.personalScopeTableRef.getPersonalScopeList()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + }; render() { - const { selectedKey, searchValue, rowKeys, personalAddModal, importParams, previewDataSource } = this.state; + const { + selectedKey, searchValue, rowKeys, personalAddModal, + importParams, previewDataSource, extEmpsWitch, loading + } = this.state; const { taxAgentStore: { hideIconInTax, showSalaryItemBtn }, taxAgentId } = this.props; const topTab = [ { @@ -121,6 +166,10 @@ class PersonalScope extends Component { { title: "从范围中排除", viewcondition: "listExclude" + }, + { + title: "非系统人员范围", + viewcondition: "listExt" } ]; const btns = (hideIconInTax || showSalaryItemBtn) ? [ @@ -151,11 +200,11 @@ class PersonalScope extends Component { placeholder="请输入对象" onSearch={() => this.personalScopeTableRef.getPersonalScopeList()} />]; - selectedKey === "listExclude" && btns.shift(); + (selectedKey === "listExclude" || selectedKey === "listExt") && btns.shift(); return (
this.setState({ rowKeys })} /> + {/*非系统人员添加*/} + this.setState({ personalAddModal: { ...personalAddModal, externalVisible: false } })} + onExternalPersonSave={this.handleSaveExtPersons} + />