220 lines
6.2 KiB
JavaScript
220 lines
6.2 KiB
JavaScript
/*
|
|
* Author: 黎永顺
|
|
* Description: 个税扣缴义务人-人员范围
|
|
* Date: 2022-05-31 09:51:59
|
|
* LastEditTime: 2022-06-28 17:43:30
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { message, Modal } from "antd";
|
|
import { inject, observer } from "mobx-react";
|
|
import SlideTaxagentUser from "./slideTaxagentUser";
|
|
import "./index.less";
|
|
|
|
const personScopeWarrper = {};
|
|
|
|
@inject("taxAgentStore", "ledgerStore")
|
|
@observer
|
|
export default class PersonalScope extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
queryLoading: false,
|
|
submitLoading: false,
|
|
targetTypeList: [],
|
|
employeeStatus: [],
|
|
dataSource: [],
|
|
columns: [],
|
|
pageObj: {
|
|
current: 1,
|
|
pageSize: 10,
|
|
total: 0,
|
|
},
|
|
};
|
|
}
|
|
componentDidMount() {
|
|
this.getTaxAgentRangeForm();
|
|
this.getTaxAgentRangeListInclude();
|
|
}
|
|
|
|
getTaxAgentRangeForm = () => {
|
|
const { getTaxAgentRangeForm } = this.props.taxAgentStore;
|
|
getTaxAgentRangeForm().then(({ status, data }) => {
|
|
if (status) {
|
|
const { employeeStatus, targetTypeList } = data;
|
|
this.setState({ employeeStatus, targetTypeList });
|
|
}
|
|
});
|
|
};
|
|
|
|
getTaxAgentRangeListInclude = (pageModule = {}) => {
|
|
const { taxAgentId } = this.props;
|
|
const { getTaxAgentRangeListInclude } = this.props.taxAgentStore;
|
|
this.setState({ queryLoading: true });
|
|
getTaxAgentRangeListInclude({ ...pageModule, taxAgentId }).then(
|
|
({ status, data }) => {
|
|
this.setState({ queryLoading: false });
|
|
if (status && !_.isEmpty(data)) {
|
|
const {
|
|
columns,
|
|
list: dataSource,
|
|
pageNum: current,
|
|
pageSize,
|
|
total,
|
|
} = data;
|
|
this.setState({
|
|
columns,
|
|
dataSource,
|
|
pageObj: {
|
|
current,
|
|
pageSize,
|
|
total,
|
|
},
|
|
});
|
|
}
|
|
}
|
|
);
|
|
};
|
|
getTaxAgentRangeListExclude = (pageModule = {}) => {
|
|
const { taxAgentId } = this.props;
|
|
const { getTaxAgentRangeListExclude } = this.props.taxAgentStore;
|
|
this.setState({ queryLoading: true });
|
|
getTaxAgentRangeListExclude({ ...pageModule, taxAgentId }).then(
|
|
({ status, data }) => {
|
|
this.setState({ queryLoading: false });
|
|
if (status && !_.isEmpty(data)) {
|
|
const {
|
|
columns,
|
|
list: dataSource,
|
|
pageNum: current,
|
|
pageSize,
|
|
total,
|
|
} = data;
|
|
this.setState({
|
|
columns,
|
|
dataSource,
|
|
pageObj: {
|
|
current,
|
|
pageSize,
|
|
total,
|
|
},
|
|
});
|
|
}
|
|
}
|
|
);
|
|
};
|
|
|
|
taxAgentRangeDelete = ({ ids, tab }) => {
|
|
const { taxAgentRangeDelete } = this.props.taxAgentStore;
|
|
const { pageObj } = this.state;
|
|
Modal.confirm({
|
|
title: "信息确认",
|
|
content: `确认删除该条数据吗?`,
|
|
onOk: () => {
|
|
taxAgentRangeDelete(ids).then(({ status, errorMsg }) => {
|
|
if (status) {
|
|
message.success("删除成功");
|
|
tab == "1"
|
|
? this.getTaxAgentRangeListInclude({
|
|
current: pageObj.current,
|
|
pageSize: pageObj.pageSize,
|
|
})
|
|
: this.getTaxAgentRangeListExclude({
|
|
current: pageObj.current,
|
|
pageSize: pageObj.pageSize,
|
|
});
|
|
} else {
|
|
message.error(errorMsg || "删除失败");
|
|
}
|
|
});
|
|
},
|
|
onCancel() {},
|
|
});
|
|
};
|
|
|
|
taxAgentRangeSave = (module) => {
|
|
const { taxAgentId } = this.props;
|
|
const { pageObj } = this.state;
|
|
const { includeType } = module;
|
|
const { taxAgentRangeSave } = this.props.taxAgentStore;
|
|
this.setState({ submitLoading: true });
|
|
taxAgentRangeSave({ ...module, taxAgentId }).then(
|
|
({ status, errormsg }) => {
|
|
this.setState({ submitLoading: false });
|
|
if (status) {
|
|
this.tagAgentRef.closeModal();
|
|
message.success("新增成功");
|
|
includeType == "1"
|
|
? this.getTaxAgentRangeListInclude({
|
|
current: pageObj.current,
|
|
pageSize: pageObj.pageSize,
|
|
})
|
|
: this.getTaxAgentRangeListExclude({
|
|
current: pageObj.current,
|
|
pageSize: pageObj.pageSize,
|
|
});
|
|
} else {
|
|
message.error(errormsg || "新增失败");
|
|
}
|
|
}
|
|
);
|
|
};
|
|
|
|
render() {
|
|
const {
|
|
dataSource,
|
|
columns,
|
|
pageObj,
|
|
employeeStatus,
|
|
targetTypeList,
|
|
submitLoading,
|
|
queryLoading,
|
|
} = this.state;
|
|
const { hideIconInTax, showSalaryItemBtn } = this.props.taxAgentStore;
|
|
return (
|
|
<div style={personScopeWarrper} className="slideWrapper">
|
|
<SlideTaxagentUser
|
|
ref={(dom) => (this.tagAgentRef = dom)}
|
|
dataSource={dataSource}
|
|
columns={columns}
|
|
pageObj={pageObj}
|
|
hideIconInTax={hideIconInTax}
|
|
showSalaryItemBtn={showSalaryItemBtn}
|
|
submitLoading={submitLoading}
|
|
queryLoading={queryLoading}
|
|
setPageObj={(params) => {
|
|
const { current, pageSize, tab } = params;
|
|
this.setState(
|
|
{
|
|
pageObj: {
|
|
...pageObj,
|
|
current,
|
|
pageSize,
|
|
},
|
|
},
|
|
() => {
|
|
tab == "1"
|
|
? this.getTaxAgentRangeListInclude({ ...pageObj, ...params })
|
|
: this.getTaxAgentRangeListExclude({ ...pageObj, ...params });
|
|
}
|
|
);
|
|
}}
|
|
employeeStatus={employeeStatus}
|
|
targetTypeList={targetTypeList}
|
|
onDeleteTaxAgent={this.taxAgentRangeDelete}
|
|
onTaxAgentSave={this.taxAgentRangeSave}
|
|
onTaxAngetSearch={({ targetName, tab }) => {
|
|
tab == "1"
|
|
? this.getTaxAgentRangeListInclude({ targetName })
|
|
: this.getTaxAgentRangeListExclude({ targetName });
|
|
}}
|
|
onChangeTab={(tab) => {
|
|
tab == "1"
|
|
? this.getTaxAgentRangeListInclude()
|
|
: this.getTaxAgentRangeListExclude();
|
|
}}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|