数据采集接口对接

This commit is contained in:
18652063575 2022-10-31 17:35:21 +08:00
parent 8008c0855a
commit d4ecfb3a1e
8 changed files with 173 additions and 88 deletions

View File

@ -107,6 +107,10 @@ export const importCumDeductPreview = (params) => {
export const createAddUpDeduction = (params) => {
return postFetch('/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction', params);
}
//查看信息
export const getAddUpDeduction = (params) => {
return postFetch('/api/bs/hrmsalary/addUpDeduction/getAddUpDeduction', params);
}
//编辑累计专项附加扣除
export const editAddUpDeduction = (params) => {
return postFetch('/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction', params);

View File

@ -111,6 +111,10 @@ export const importOtherDeductionPreview = (params) => {
export const createData = (params) => {
return postFetch('/api/bs/hrmsalary/otherDeduction/createData', params);
}
//查看信息
export const getData = (params) => {
return postFetch('/api/bs/hrmsalary/otherDeduction/getData', params);
}
//编辑其他免税扣除
export const editData = (params) => {
return postFetch('/api/bs/hrmsalary/otherDeduction/editData', params);

View File

@ -19,6 +19,7 @@ class AddItems extends Component {
taxAgentId: "",
taxAgentName: "",
employeeId: "",
employeeName: "",
personArea: "",
username: "",
idcard: ""
@ -26,18 +27,37 @@ class AddItems extends Component {
};
}
componentDidMount() {
console.log('123',this.props.editId);
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.editId !== this.props.editId) {
this.setState({
baseInfo: {
...this.state.baseInfo,
declareMonth: nextProps.editId.declareMonth,
taxAgentId: nextProps.editId.taxAgentId,
taxAgentName: nextProps.editId.taxAgentName,
employeeId: nextProps.editId.employeeId,
employeeName: nextProps.editId.username,
}
});
const fields= _.map(nextProps.condition[0].items, it =>{
return it.domkey[0]
})
fields.map(item => {
nextProps.form.updateFields({
[item]: nextProps.editId[item]
})
})
}
}
render() {
const { taxAgentOption = [], form, condition = [], isCum } = this.props;
const { taxAgentOption = [], form, condition = [], isCum, editId } = this.props;
const { baseInfo } = this.state;
const items = [
{
com: PickDate({
label: "税款所属期",
viewAttr: 3,
viewAttr: _.isEmpty(editId) ? 3 : 1,
labelCol: { span: 6 },
wrapperCol: { span: 18 },
format: "YYYY-MM",
@ -50,7 +70,7 @@ class AddItems extends Component {
{
com: Select({
label: "个税扣缴义务人",
viewAttr: 3,
viewAttr: _.isEmpty(editId) ? 3 : 1,
options: taxAgentOption,
value: baseInfo.taxAgentId,
onChange: (data) => {
@ -61,9 +81,11 @@ class AddItems extends Component {
{
com: Browser({
label: "人员",
viewAttr: 3,
onChange: (employeeId) => {
this.setState({ baseInfo: { ...baseInfo, employeeId } });
viewAttr: _.isEmpty(editId) ? 3 : 1,
value: baseInfo.employeeId,
valueSpan: baseInfo.employeeName,
onChange: ({ids, names}) => {
this.setState({ baseInfo: { ...baseInfo, employeeId: ids, employeeName: names } });
}
})
}
@ -98,7 +120,7 @@ class AddItems extends Component {
label: "人员范围",
viewAttr: 3,
options: [
{ key: "ORGANIZATION", showname: "内部人员" },
{ key: "ORGANIZATION", showname: "内部人员" }
// { key: "EXT_EMPLOYEE", showname: "非系统人员" }
],
value: baseInfo.personArea,
@ -112,8 +134,8 @@ class AddItems extends Component {
com: Browser({
label: "人员",
viewAttr: 3,
onChange: (employeeId) => {
this.setState({ baseInfo: { ...baseInfo, employeeId } });
onChange: ({ids, names}) => {
this.setState({ baseInfo: { ...baseInfo, employeeId: ids, employeeName: names } });
}
})
}];
@ -142,7 +164,7 @@ class AddItems extends Component {
<div className="addItemsWrapper">
<WeaSearchGroup
title="基础信息"
items={!isCum ? items : baseInfo.personArea === "ORGANIZATION" ? [...cumSituationitems, ...insider] : baseInfo.personArea === "EXT_EMPLOYEE" ? [...cumSituationitems, ...noSysPerson]: cumSituationitems}
items={!isCum ? items : baseInfo.personArea === "ORGANIZATION" ? [...cumSituationitems, ...insider] : baseInfo.personArea === "EXT_EMPLOYEE" ? [...cumSituationitems, ...noSysPerson] : cumSituationitems}
needTigger showGroup center/>
{
getSearchs(form, condition, 2)
@ -156,13 +178,15 @@ class AddItems extends Component {
export default AddItems;
export const Browser = payload => {
const { label, onChange, viewAttr = 3 } = payload;
const { label, onChange, viewAttr = 3, value, valueSpan } = payload;
return (
<WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
<WeaBrowser
viewAttr={viewAttr}
type={1}
onChange={onChange}/>
value={value}
valueSpan={valueSpan}
onChange={(ids, names)=> onChange({ids, names})}/>
</WeaFormItem>
);
};

View File

@ -144,7 +144,7 @@ export default class EditSlideContent extends React.Component {
<span className="username">{currentRecord.username}</span>
</Col>
<Col span={12}>
<span className="formLabel">申报月份</span>
<span className="formLabel">税款所属期</span>
<div className="weaRangePickerWrapper">
<div className="monthPickerWrapper">
<MonthPicker

View File

@ -22,7 +22,7 @@ export default class CumDeduct extends React.Component {
super(props);
this.state = {
addVisible: false,
editId: "",
editId: {},
saveLoading: false,
value: "",
selectedKey: [],
@ -64,7 +64,7 @@ export default class CumDeduct extends React.Component {
return (
<div className="searchConditionWrapper">
<div className="searchConditionItem">
<span className="conditionFormLabel">申报月份:</span>
<span className="conditionFormLabel">税款所属期:</span>
<WeaDatePicker
value={monthValue}
format="YYYY-MM"
@ -270,27 +270,52 @@ export default class CumDeduct extends React.Component {
};
//新功能
createAddUpDeduction = (payload) => {
handleSaveDeduction = (payload) => {
const { editId } = this.state;
this.setState({ saveLoading: true });
API.createAddUpDeduction(payload).then(({ status }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
this.setState({
addVisible: false
}, () => {
const { cumDeductStore: { doSearch, addForm } } = this.props;
const { monthValue, taxAgentId } = this.state;
doSearch({
declareMonth: [monthValue],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
if (!_.isEmpty(editId)) {
API.editAddUpDeduction({ ...payload, id: editId.id }).then(({ status }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("编辑成功");
this.setState({
addVisible: false,
editId: {}
}, () => {
const { cumDeductStore: { doSearch, addForm } } = this.props;
const { monthValue, taxAgentId } = this.state;
doSearch({
declareMonth: [monthValue],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
});
addForm.resetForm();
});
addForm.resetForm();
});
} else {
message.error("新增失败");
}
});
} else {
message.error("编辑成功");
}
});
} else {
API.createAddUpDeduction(payload).then(({ status }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
this.setState({
addVisible: false,
editId: {}
}, () => {
const { cumDeductStore: { doSearch, addForm } } = this.props;
const { monthValue, taxAgentId } = this.state;
doSearch({
declareMonth: [monthValue],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
});
addForm.resetForm();
});
} else {
message.error("新增失败");
}
});
}
};
deleteSelectAddUpDeduction = () => {
const { monthValue: declareMonth, taxAgentId, selectedKey } = this.state;
@ -354,8 +379,13 @@ export default class CumDeduct extends React.Component {
const { cumDeductStore: { doSearch } } = this.props;
if (key === "edit") {
this.setState({
addVisible: true,
editId: row.id
addVisible: true
}, () => {
API.getAddUpDeduction({ id: row.id }).then(({ status, data }) => {
if (status) {
this.setState({ editId: data });
}
});
});
} else if (key === "delete") {
const payload = {
@ -502,8 +532,8 @@ export default class CumDeduct extends React.Component {
onClick={() => {
this.setState({
addVisible: true,
editId: ""
});
editId: {}
},()=>addForm.resetForm());
}}>
新建
</Button>,
@ -723,12 +753,12 @@ export default class CumDeduct extends React.Component {
measure="%"
title={
<SlideModalTitle
subtitle={addVisible ? (editId ? "编辑" : "新建") : "累计专项附加扣除记录"}
subtitle={addVisible ? (!_.isEmpty(editId) ? "编辑" : "新建") : "累计专项附加扣除记录"}
loading={saveLoading}
onSave={() => {
const { baseInfo } = this.addItemRef.state;
const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v));
if (!bool) {
if (!bool && _.isEmpty(editId)) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
@ -739,7 +769,7 @@ export default class CumDeduct extends React.Component {
..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]),
...addForm.getFormParams()
};
this.createAddUpDeduction(payload);
this.handleSaveDeduction(payload);
}}
editable={!!addVisible}
showOperateBtn={showOperateBtn}
@ -766,7 +796,7 @@ export default class CumDeduct extends React.Component {
setSlideVisiable(false);
this.setState({
addVisible: false,
editId: ""
editId: {}
});
}}
showMask={true}
@ -774,7 +804,7 @@ export default class CumDeduct extends React.Component {
setSlideVisiable(false);
this.setState({
addVisible: false,
editId: ""
editId: {}
});
}}
/>

View File

@ -30,6 +30,7 @@ export default class CumSituation extends React.Component {
visiable: false,
inited: false,
monthValue: moment(new Date()).format("YYYY"),
taxYearMonth: moment(new Date()).format("YYYY-MM"),
taxAgentId: "All",
modalParam: {
taxYearMonth: ""
@ -202,14 +203,6 @@ export default class CumSituation extends React.Component {
setStep(0);
}
onOperatesClick = (record, index, operate, flag) => {
switch (operate.index.toString()) {
case "0": // 查看明细
this.onEdit(record);
break;
}
};
showColumn = () => {
const { cumSituationStore: { tableStore } } = this.props;
tableStore.setColSetVisible(true);
@ -360,7 +353,7 @@ export default class CumSituation extends React.Component {
render() {
const { cumSituationStore, taxAgentStore } = this.props;
const { slideSelectedKey, addVisible, editId, saveLoading } = this.state;
const { slideSelectedKey, addVisible, editId, saveLoading, taxYearMonth } = this.state;
const {
loading,
dataSource,
@ -713,7 +706,8 @@ export default class CumSituation extends React.Component {
return;
}
const payload = {
..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]),
taxYearMonth: baseInfo.declareMonth,
..._.pick(baseInfo, ["taxAgentId", "employeeId", "taxAgentName"]),
...addForm.getFormParams()
};
this.createAddUpSituation(payload);

View File

@ -144,7 +144,7 @@ export default class EditSlideContent extends React.Component {
<span className="username">{currentRecord.username}</span>
</Col>
<Col span={12}>
<span className="formLabel">申报月份</span>
<span className="formLabel">税款所属期</span>
<div className="weaRangePickerWrapper">
<div className="monthPickerWrapper">
<MonthPicker

View File

@ -13,7 +13,7 @@ import EditSlideContent from "./editSlideContent";
import { optionAddAll } from "../../../util/options";
import * as API from "../../../apis/otherDeduct";
import "./index.less";
import { deleteAllData, deleteSelectData } from "../../../apis/otherDeduct";
import { getData } from "../../../apis/otherDeduct";
@inject("otherDeductStore", "taxAgentStore")
@ -24,7 +24,7 @@ export default class OtherDeduct extends React.Component {
this.state = {
saveLoading: false,
addVisible: false,
editId: "",
editId: {},
value: "",
selectedKey: [],
slideSelectedKey: [], //详情表格的选中项
@ -62,7 +62,7 @@ export default class OtherDeduct extends React.Component {
return (
<div className="searchConditionWrapper">
<div className="searchConditionItem">
<span className="conditionFormLabel">申报月份:</span>
<span className="conditionFormLabel">税款所属期:</span>
<WeaDatePicker
value={monthValue}
format="YYYY-MM"
@ -242,36 +242,65 @@ export default class OtherDeduct extends React.Component {
};
//新功能
createData = (payload) => {
handleCreateData = (payload) => {
const { editId }= this.state;
this.setState({ saveLoading: true });
API.createData(payload).then(({ status }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
this.setState({
addVisible: false,
editId: ""
}, () => {
const { otherDeductStore: { doSearch, addForm } } = this.props;
const { monthValue, taxAgentId } = this.state;
doSearch({
declareMonth: [monthValue],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
if (!_.isEmpty(editId)) {
API.editData({ ...payload, id: editId.id }).then(({ status }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("编辑成功");
this.setState({
addVisible: false,
editId: {}
}, () => {
const { otherDeductStore: { doSearch, addForm } } = this.props;
const { monthValue, taxAgentId } = this.state;
doSearch({
declareMonth: [monthValue],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
});
addForm.resetForm();
});
addForm.resetForm();
});
} else {
message.error("新增失败");
}
});
} else {
message.error("编辑失败");
}
});
} else {
API.createData(payload).then(({ status }) => {
this.setState({ saveLoading: false });
if (status) {
message.success("新增成功");
this.setState({
addVisible: false,
editId: {}
}, () => {
const { otherDeductStore: { doSearch, addForm } } = this.props;
const { monthValue, taxAgentId } = this.state;
doSearch({
declareMonth: [monthValue],
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
});
addForm.resetForm();
});
} else {
message.error("新增失败");
}
});
}
};
handleOperate = ({ key }, row) => {
const { monthValue: declareMonth, taxAgentId } = this.state;
const { otherDeductStore: { doSearch } } = this.props;
if (key === "edit") {
this.setState({
addVisible: true,
editId: row.id
addVisible: true
},()=>{
API.getData({ id: row.id }).then(({ status, data }) => {
if (status) {
this.setState({ editId: data });
}
});
});
} else if (key === "delete") {
const payload = {
@ -487,8 +516,8 @@ export default class OtherDeduct extends React.Component {
onClick={() => {
this.setState({
addVisible: true,
editId: ""
});
editId: {}
},()=>addForm.resetForm());
}}>
新建
</Button>,
@ -694,11 +723,11 @@ export default class OtherDeduct extends React.Component {
measure="%"
title={
<SlideModalTitle
subtitle={addVisible ? (editId ? "编辑" : "新建") : "其他免税扣除记录"}
subtitle={addVisible ? (!_.isEmpty(editId) ? "编辑" : "新建") : "其他免税扣除记录"}
onSave={() => {
const { baseInfo } = this.addItemRef.state;
const bool = _.every(_.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId"]), v => !_.isEmpty(v));
if (!bool) {
if (!bool && _.isEmpty(editId)) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
@ -709,7 +738,7 @@ export default class OtherDeduct extends React.Component {
..._.pick(baseInfo, ["declareMonth", "taxAgentId", "employeeId", "taxAgentName"]),
...addForm.getFormParams()
};
this.createData(payload);
this.handleCreateData(payload);
}}
loading={saveLoading}
editable={!!addVisible}
@ -736,7 +765,7 @@ export default class OtherDeduct extends React.Component {
setSlideVisiable(false);
this.setState({
addVisible: false,
editId: ""
editId: {}
});
}}
showMask={true}
@ -744,7 +773,7 @@ export default class OtherDeduct extends React.Component {
setSlideVisiable(false);
this.setState({
addVisible: false,
editId: ""
editId: {}
});
}}
/>}