diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js
index 59b1819a..bd42edd9 100644
--- a/pc4mobx/hrmSalary/apis/calculate.js
+++ b/pc4mobx/hrmSalary/apis/calculate.js
@@ -472,4 +472,8 @@ export const exportComparisonResult = (salaryAcctRecordId) => {
}))
}
+// 核算进度条
+export const getCalculateProgress = (id) => {
+ return WeaTools.callApi('/api/bs/hrmsalary/progress/getRate?cacheKey=ACCT_PROGRESS_' + id, 'get', {});
+}
diff --git a/pc4mobx/hrmSalary/components/progressModal/index.js b/pc4mobx/hrmSalary/components/progressModal/index.js
new file mode 100644
index 00000000..64ba0d3a
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/progressModal/index.js
@@ -0,0 +1,17 @@
+import React from 'react'
+import { Modal } from 'antd'
+import { WeaProgress } from 'ecCom'
+
+export default class ProgressModal extends React.Component {
+ render() {
+ return (
+
+
{this.props.onCancel()}} footer={null}>
+
+
+
+
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/index.js b/pc4mobx/hrmSalary/pages/calculateDetail/index.js
index a050f3dd..43add5ff 100644
--- a/pc4mobx/hrmSalary/pages/calculateDetail/index.js
+++ b/pc4mobx/hrmSalary/pages/calculateDetail/index.js
@@ -3,10 +3,11 @@ import UserSure from './userSure'
import { inject, observer } from 'mobx-react';
import CustomTab from '../../components/customTab'
import SalaryDetail from './salaryDetail'
-import { Button, Menu, Dropdown, Modal } from 'antd'
+import { Button, Menu, Dropdown, Modal, message } from 'antd'
import { WeaInputSearch } from "ecCom"
import { getQueryString } from '../../util/url'
import AcctResultImportModal from './acctResult/importModal/acctResultImportModal';
+import ProgressModal from '../../components/progressModal'
@inject('calculateStore')
@observer
@@ -16,9 +17,12 @@ export default class CalculateDetail extends React.Component {
this.state = {
selectedKey: "0",
fieldData: {},
- acctResultImportVisiable: false
+ acctResultImportVisiable: false,
+ progressVisible: false,
+ progress: 0
}
this.id = ""
+ this.timer
}
componentWillMount() {
@@ -33,13 +37,43 @@ export default class CalculateDetail extends React.Component {
// 核算点击事件
handleAccount() {
const { calculateStore } = this.props;
- const { acctresultAccounting, acctResultList } = calculateStore;
+ const { acctresultAccounting, acctResultList, getCalculateProgress } = calculateStore;
Modal.confirm({
title: "信息确认",
content: "点击核算,公式项将按照公式逻辑核算,核算结果将覆盖原数据",
onOk: () => {
+ this.setState({progress: 0})
acctresultAccounting(this.id).then(() => {
- acctResultList(this.id)
+ this.setState({
+ progressVisible: true
+ })
+ if(this.timer) {
+ clearInterval(this.timer)
+ }
+ this.timer = setInterval(() => {
+ getCalculateProgress(this.id).then(data => {
+ let progress = data.progress
+ console.log("progress: " + progress)
+ if(progress == 1 && this.timer) {
+ clearInterval(this.timer)
+ this.timer = null
+ this.setState({
+ progressVisible: false
+ })
+ message.success("核算完成")
+ acctResultList(this.id)
+ } else if(!data.status) {
+ clearInterval(this.timer)
+ this.timer = null
+ this.setState({
+ progressVisible: false
+ })
+ message.success(data.message)
+ }
+ this.setState({progress: Number(progress) * 100})
+ })
+ }, 300)
+
})
},
onCancel() {}
@@ -74,8 +108,17 @@ export default class CalculateDetail extends React.Component {
acctResultList(this.id, value)
}
+ componentWillUnmount() {
+ // 清除轮询
+ if(this.timer) {
+ clearInterval(this.timer)
+ }
+ }
+
render() {
const { selectedKey, modalParam, acctResultImportVisiable } = this.state;
+ const { calculateStore } = this.props;
+ const { calculateProgress } = calculateStore
const menu = (