diff --git a/pc4mobx/hrmSalary/pages/declare/generateModal.js b/pc4mobx/hrmSalary/pages/declare/generateModal.js index 8157c487..bc0f5c45 100644 --- a/pc4mobx/hrmSalary/pages/declare/generateModal.js +++ b/pc4mobx/hrmSalary/pages/declare/generateModal.js @@ -58,7 +58,7 @@ export default class GenerateModal extends React.Component { this.setState({ loading: false }); this.props.onCancel(); message.destroy(); - message.loading(getLabel(22619, "正在生成中..."), 0); + message.loading(getLabel(111, "正在生成中..."), 0); this.timer = setInterval(async () => { const { status: resStatus, data: result } = await this.taxdeclarationGetRate(data); const { status: rateStatus, finish, msg } = result; @@ -70,9 +70,12 @@ export default class GenerateModal extends React.Component { this.props.onGenerate(); } } else { + clearInterval(this.timer); + message.destroy(); message.warning(msg || getLabel(111, "生成申报表失败!")); + this.props.onGenerate(); } - }, 800); + }, 1000); }).catch(() => { message.destroy(); clearInterval(this.timer); diff --git a/pc4mobx/hrmSalary/pages/declareDetail/index.js b/pc4mobx/hrmSalary/pages/declareDetail/index.js index d4b0015c..c47d1fcc 100644 --- a/pc4mobx/hrmSalary/pages/declareDetail/index.js +++ b/pc4mobx/hrmSalary/pages/declareDetail/index.js @@ -29,9 +29,9 @@ class Index extends Component { loading: { query: false, refresh: false, declare: false }, declareInfo: {}, pageInfo: { current: 0, pageSize: 10, total: 0 } }; + this.timer = null; } - componentDidMount() { const promise = this.init(); } @@ -96,44 +96,81 @@ class Index extends Component { taxdeclarationRefreshData({ taxDeclareRecordId: getQueryString("id") }).then(async ({ status, data, errormsg }) => { this.setState({ loading: { ...this.state.loading, refresh: false } }); if (status) { - const { status: resStatus, data: result } = await this.taxdeclarationGetRate(data); - if (resStatus) { - const { status: rateStatus, msg } = result; - if (rateStatus) { - message.success(getLabel(111, "刷新数据成功!")); - const promise = this.init(); + message.destroy(); + message.loading(getLabel(111, "刷新中..."), 0); + this.timer = setInterval(async () => { + const { status: resStatus, data: result } = await this.taxdeclarationGetRate(data); + const { status: rateStatus, finish, msg } = result; + if (resStatus && rateStatus) { + if (finish) { + clearInterval(this.timer); + message.destroy(); + message.success(getLabel(111, "刷新数据成功!")); + const promise = this.init(); + } } else { + clearInterval(this.timer); + message.destroy(); message.warning(msg || getLabel(111, "刷新数据失败!")); + const promise = this.init(); } - } + }, 1000); } else { + clearInterval(this.timer); + message.destroy(); message.warning(errormsg); } - }).catch(() => this.setState({ loading: { ...this.state.loading, refresh: false } })); + }).catch(() => { + message.destroy(); + clearInterval(this.timer); + this.setState({ loading: { ...this.state.loading, refresh: false } }); + }); }; taxdeclarationDeclare = () => { this.setState({ loading: { ...this.state.loading, declare: true } }); taxdeclarationDeclare({ taxDeclareRecordId: getQueryString("id") }).then(async ({ status, data, errormsg }) => { this.setState({ loading: { ...this.state.loading, declare: false } }); if (status) { - const { status: resStatus, data: result } = await this.taxdeclarationGetRate(data); - if (resStatus) { - const { status: rateStatus, msg } = result; - if (rateStatus) { - message.success(getLabel(111, "在线申报成功!")); - const promise = this.declare(); + message.destroy(); + message.loading(getLabel(111, "申报中..."), 0); + this.timer = setInterval(async () => { + const { status: resStatus, data: result } = await this.taxdeclarationGetRate(data); + const { status: rateStatus, finish, msg } = result; + if (resStatus && rateStatus) { + if (finish) { + clearInterval(this.timer); + message.destroy(); + message.success(getLabel(111, "在线申报成功!")); + const promise = this.declare(); + } } else { + clearInterval(this.timer); + message.destroy(); message.warning(msg || getLabel(111, "在线申报失败!")); + const promise = this.declare(); } - } + }, 1000); } else { + clearInterval(this.timer); + message.destroy(); message.warning(errormsg); } - }).catch(() => this.setState({ loading: { ...this.state.loading, declare: false } })); + }).catch(() => { + message.destroy(); + clearInterval(this.timer); + this.setState({ loading: { ...this.state.loading, declare: false } }); + }); }; render() { const { tabs, selectedKey, columns, pageInfo, dataSource, loading, declareInfo } = this.state; + let btns = [ + , + , + + ]; const pagination = { ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, @@ -151,19 +188,15 @@ class Index extends Component { }, () => this.getDetailList()); } }; + declareInfo.declareStatus === "DECLARING" && (btns.splice(1, 2, )); return (