diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index 8cf65377..360c8b62 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -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); +} diff --git a/pc4mobx/hrmSalary/pages/declare/generateModal.js b/pc4mobx/hrmSalary/pages/declare/generateModal.js index a8f41b37..cde3f435 100644 --- a/pc4mobx/hrmSalary/pages/declare/generateModal.js +++ b/pc4mobx/hrmSalary/pages/declare/generateModal.js @@ -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 { }} /> + + this.setState({ description })} + /> + ); diff --git a/pc4mobx/hrmSalary/pages/declare/index.js b/pc4mobx/hrmSalary/pages/declare/index.js index b56d1f1a..57e37c37 100644 --- a/pc4mobx/hrmSalary/pages/declare/index.js +++ b/pc4mobx/hrmSalary/pages/declare/index.js @@ -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 ( - { - window.open( - "/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail?id=" + - record.id - ); - }}> - 查看 - + + { + window.open( + "/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail?id=" + + record.id + ); + }}> + 查看 + + { + showWithDrawBtn && + { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认撤回该条数据吗?"), + onOk: () => this.withDrawTaxDeclaration(record.id) + }); + }} + > + {getLabel(111, "撤回")} + + } + ); } } diff --git a/pc4mobx/hrmSalary/pages/declare/index.less b/pc4mobx/hrmSalary/pages/declare/index.less index d83fc525..81e72b6f 100644 --- a/pc4mobx/hrmSalary/pages/declare/index.less +++ b/pc4mobx/hrmSalary/pages/declare/index.less @@ -15,7 +15,7 @@ .wea-select { .ant-select { - width: 90% !important; + width: 100% !important; .ant-select-selection { border-radius: 0 !important;