合并1101的代码以及添加个税扣缴义务人中的非系统人员配置

This commit is contained in:
黎永顺 2023-11-09 10:27:20 +08:00
parent 62704f5825
commit b1ac23227a
3 changed files with 83 additions and 21 deletions

View File

@ -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;

View File

@ -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 (
<div>
<WeaTab
datas={topTab}
datas={(extEmpsWitch === "0" || !extEmpsWitch) ? topTab.slice(0, -1) : topTab}
keyParam="viewcondition" //主键
selectedKey={selectedKey}
buttons={btns}
@ -168,6 +217,12 @@ class PersonalScope extends Component {
searchValue={searchValue}
onChangeSelectKey={rowKeys => this.setState({ rowKeys })}
/>
{/*非系统人员添加*/}
<ExternalPersonModal
visible={personalAddModal.externalVisible} loading={loading}
onCancel={() => this.setState({ personalAddModal: { ...personalAddModal, externalVisible: false } })}
onExternalPersonSave={this.handleSaveExtPersons}
/>
<PersonalScopeModal
{...personalAddModal}
taxAgentId={taxAgentId}

View File

@ -6,13 +6,14 @@
*/
import React, { Component } from "react";
import { WeaTable } from "ecCom";
import { getTaxAgentRangeListExclude, getTaxAgentRangeListInclude } from "../../../apis/taxAgent";
import { getTaxAgentRangeListExclude, getTaxAgentRangeListInclude, taxAgentRangelistExt } from "../../../apis/taxAgent";
import "./index.less";
import { calcPageNo } from "../../../util";
const APIFox = {
listInclude: getTaxAgentRangeListInclude,
listExclude: getTaxAgentRangeListExclude
listExclude: getTaxAgentRangeListExclude,
listExt: taxAgentRangelistExt
};
class PersonalScopeTable extends Component {