diff --git a/pc4mobx/hrmSalary/pages/declare/components/declareDialog/condition.js b/pc4mobx/hrmSalary/pages/declare/components/declareDialog/condition.js index d880c3f1..2537486e 100644 --- a/pc4mobx/hrmSalary/pages/declare/components/declareDialog/condition.js +++ b/pc4mobx/hrmSalary/pages/declare/components/declareDialog/condition.js @@ -4,7 +4,7 @@ export const declareConditions = [ { colSpan: 1, conditionType: "MONTHPICKER", - domkey: ["salaryMonthStr"], + domkey: ["salaryMonth"], fieldcol: 14, label: "薪资所属月", lanId: 542604, diff --git a/pc4mobx/hrmSalary/pages/declare/components/declareDialog/index.js b/pc4mobx/hrmSalary/pages/declare/components/declareDialog/index.js index a2ce2936..10a56a67 100644 --- a/pc4mobx/hrmSalary/pages/declare/components/declareDialog/index.js +++ b/pc4mobx/hrmSalary/pages/declare/components/declareDialog/index.js @@ -10,7 +10,7 @@ import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; import { Button, message } from "antd"; import { getSearchs } from "../../../../util"; import { getTaxAgentSelectListAsAdmin } from "../../../../apis/taxAgent"; -import { saveDeclare } from "../../../../apis/declare"; +import { saveDeclare, taxdeclarationGetRate } from "../../../../apis/declare"; import { declareConditions } from "./condition"; const getKey = WeaTools.getKey; @@ -56,17 +56,40 @@ class Index extends Component { const { declareStore: { declareForm } } = this.props; declareForm.validateForm().then(f => { if (f.isValid) { - const payload = declareForm.getFormParams(); + const { salaryMonth, ...payload } = declareForm.getFormParams(); this.setState({ loading: true }); - saveDeclare({ ...payload }).then(({ status, errormsg }) => { + saveDeclare({ ...payload, salaryMonth: salaryMonth + "-01" }) + .then(async ({ status, data, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.destroy(); + message.loading(getLabel(111, "生成中..."), 0); + this.timer = setInterval(async () => { + const { status: resStatus, data: result } = await taxdeclarationGetRate({ index: data }); + const { status: rateStatus, finish, msg } = result; + if (resStatus && rateStatus) { + if (finish) { + clearInterval(this.timer); + message.destroy(); + message.success(getLabel(30700, "操作成功")); + this.props.onCancel("refresh"); + } + } else { + clearInterval(this.timer); + message.destroy(); + message.warning(msg); + } + }, 1000); + } else { + clearInterval(this.timer); + message.destroy(); + message.warning(errormsg); + } + }).catch(() => { + message.destroy(); + clearInterval(this.timer); this.setState({ loading: false }); - if (status) { - message.success(getLabel(30700, "操作成功")); - this.props.onCancel("refresh"); - } else { - message.error(errormsg); - } - }).catch(() => this.setState({ loading: false })); + }); } else { f.showErrors(); }