产品-个税申报表添加撤回的功能

This commit is contained in:
黎永顺 2023-06-12 14:51:09 +08:00
parent a5a481987c
commit 4d91a9b365
4 changed files with 84 additions and 24 deletions

View File

@ -1,4 +1,5 @@
import { WeaTools } from 'ecCom';
import { postFetch } from '../util/request';
//个税申报表-个税申报表列表
export const getDeclareList = params => {
@ -7,7 +8,7 @@ export const getDeclareList = params => {
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
},
body: JSON.stringify(params)
}).then(res => res.json())
}
@ -24,7 +25,7 @@ export const saveDeclare = params => {
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
},
body: JSON.stringify(params)
}).then(res => res.json())
}
@ -41,7 +42,7 @@ export const getDetailList = params => {
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
},
body: JSON.stringify(params)
}).then(res => res.json())
}
@ -52,13 +53,16 @@ export const exportSalaryArchive = (id = "") => {
fetch('/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=' + id).then(res => res.blob().then(blob => {
var filename=`个税申报表.xlsx`
var a = document.createElement('a');
var url = window.URL.createObjectURL(blob);
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
}))
}
//个税申报表-撤回申报
export const withDrawTaxDeclaration = (params) => {
return postFetch('/api/bs/hrmsalary/taxdeclaration/withDrawTaxDeclaration', params);
}

View File

@ -1,9 +1,19 @@
import React from "react";
import { WeaDatePicker, WeaDialog, WeaError, WeaFormItem, WeaHelpfulTip, WeaSelect } from "ecCom";
import {
WeaDatePicker,
WeaDialog,
WeaError,
WeaFormItem,
WeaHelpfulTip,
WeaLocaleProvider,
WeaSelect,
WeaTextarea
} from "ecCom";
import { Button } from "antd";
import { inject, observer } from "mobx-react";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
@inject("declareStore", "taxAgentStore")
@observer
export default class GenerateModal extends React.Component {
@ -12,6 +22,7 @@ export default class GenerateModal extends React.Component {
this.state = {
date: "",
taxAgentId: "",
description: "",
loading: false
};
}
@ -19,7 +30,7 @@ export default class GenerateModal extends React.Component {
// 生成申报表
handleGenerate = () => {
const { declareStore: { saveDeclare } } = this.props;
const { date, taxAgentId } = this.state;
const { date, taxAgentId, description } = this.state;
if (_.isEmpty(date) && _.isEmpty(taxAgentId)) {
this.refs.weaError.showError();
this.refs.weaError1.showError();
@ -36,7 +47,7 @@ export default class GenerateModal extends React.Component {
return;
}
this.setState({ loading: true });
saveDeclare({ salaryMonthStr: date, taxAgentId }).then(() => {
saveDeclare({ salaryMonthStr: date, taxAgentId, description }).then(() => {
this.setState({ loading: false });
this.props.onGenerate();
}).catch(() => {
@ -116,13 +127,23 @@ export default class GenerateModal extends React.Component {
}}
/>
<WeaHelpfulTip
style={{ position: "absolute", bottom: "8px", right: 0 }}
style={{ position: "absolute", bottom: 8, right: -35 }}
width={200}
title="提示:可选择单个个税扣缴义务人进行申报,若不选择,则批量对管理下的所有个税扣缴义务人进行申报;"
placement="topLeft"
/>
</WeaError>
</WeaFormItem>
<WeaFormItem
label={getLabel(536726, "备注")}
style={{ marginBottom: 10 }}
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<WeaTextarea
value={this.state.description}
onChange={(description) => this.setState({ description })}
/>
</WeaFormItem>
</div>
</WeaDialog>
);

View File

@ -1,13 +1,15 @@
import React from "react";
import { inject, observer } from "mobx-react";
import { Button, DatePicker } from "antd";
import { WeaNewScroll, WeaTop } from "ecCom";
import { Button, DatePicker, message, Modal } from "antd";
import { WeaLocaleProvider, WeaNewScroll, WeaTop } from "ecCom";
import CustomTab from "../../components/customTab";
import CustomTable from "../../components/customTable";
import GenerateModal from "./generateModal";
import { getDeclareList } from "../../apis/declare";
import { getDeclareList, withDrawTaxDeclaration } from "../../apis/declare";
import { sysConfCodeRule } from "../../apis/ruleconfig";
import moment from "moment";
const getLabel = WeaLocaleProvider.getLabel;
const { MonthPicker } = DatePicker;
@inject("taxAgentStore")
@observer
@ -15,6 +17,7 @@ export default class Declare extends React.Component {
constructor(props) {
super(props);
this.state = {
showWithDrawBtn: false,
declarationModalVisible: false,
startDate: moment(new Date()).startOf("year").format("YYYY-MM"),
endDate: moment(new Date()).startOf("month").format("YYYY-MM"),
@ -32,6 +35,7 @@ export default class Declare extends React.Component {
componentWillMount() {
const { taxAgentStore: { getTaxAgentSelectListAsAdmin } } = this.props;
this.getDeclareList();
this.sysConfCodeRule();
getTaxAgentSelectListAsAdmin();
}
@ -56,7 +60,21 @@ export default class Declare extends React.Component {
}
}).catch(() => this.setState({ loading: false }));
};
sysConfCodeRule = () => {
sysConfCodeRule({ code: "WITHDRAW_TAX_DECLARATION" }).then(({ status, data }) => {
if (status && data === "1") this.setState({ showWithDrawBtn: data === "1" });
});
};
withDrawTaxDeclaration = (taxDeclarationId) => {
withDrawTaxDeclaration({ taxDeclarationId }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(111, "撤回成功"));
this.getDeclareList();
} else {
message.error(errormsg || getLabel(111, "撤回失败"));
}
});
};
// 日期区间改变事件
handleRangePickerChange = (type, value) => {
this.setState({
@ -81,7 +99,7 @@ export default class Declare extends React.Component {
render() {
const { taxAgentStore: { showOperateBtn } } = this.props;
const { loading, columns, dataSource, pageInfo } = this.state;
const { loading, columns, dataSource, pageInfo, showWithDrawBtn } = this.state;
const renderRightOperation = () => {
const { startDate, endDate } = this.state;
return (
@ -135,15 +153,32 @@ export default class Declare extends React.Component {
dataIndex: "operate",
render: (text, record) => {
return (
<a href="javascript:void(0);"
onClick={() => {
window.open(
"/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail?id=" +
record.id
);
}}>
查看
</a>
<React.Fragment>
<a href="javascript:void(0);"
onClick={() => {
window.open(
"/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail?id=" +
record.id
);
}}>
查看
</a>
{
showWithDrawBtn &&
<a
href="javascript:void(0);" style={{ marginLeft: 10 }}
onClick={() => {
Modal.confirm({
title: getLabel(111, "信息确认"),
content: getLabel(111, "确认撤回该条数据吗?"),
onOk: () => this.withDrawTaxDeclaration(record.id)
});
}}
>
{getLabel(111, "撤回")}
</a>
}
</React.Fragment>
);
}
}

View File

@ -15,7 +15,7 @@
.wea-select {
.ant-select {
width: 90% !important;
width: 100% !important;
.ant-select-selection {
border-radius: 0 !important;