Commit 8b9bfe715e32e891e5a8b58d87166cbaeb2b8989
1 parent
bfbb5739
1.处理单据保存后 回刷拿到的数据还是上一次的单子而不是本次单子
Showing
2 changed files
with
13 additions
and
1 deletions
src/components/Common/CommonNewBillEvent.js
| @@ -9,6 +9,7 @@ import * as commonServices from "@/services/services"; /* 服务类 */ | @@ -9,6 +9,7 @@ import * as commonServices from "@/services/services"; /* 服务类 */ | ||
| 9 | import commonConfig from "@/utils/config"; | 9 | import commonConfig from "@/utils/config"; |
| 10 | import * as commonFunc from "@/components/Common/commonFunc"; | 10 | import * as commonFunc from "@/components/Common/commonFunc"; |
| 11 | import styles from "@/components/Common/ToolBar/index.less"; | 11 | import styles from "@/components/Common/ToolBar/index.less"; |
| 12 | +import { sleep } from '@/utils/utils'; | ||
| 12 | 13 | ||
| 13 | const { confirm } = Modal; | 14 | const { confirm } = Modal; |
| 14 | 15 | ||
| @@ -1746,7 +1747,9 @@ export default ChildComponent => { | @@ -1746,7 +1747,9 @@ export default ChildComponent => { | ||
| 1746 | if (billnosetting.bAutoCheck) { | 1747 | if (billnosetting.bAutoCheck) { |
| 1747 | await this.handleAudit(1); | 1748 | await this.handleAudit(1); |
| 1748 | } else { | 1749 | } else { |
| 1749 | - await this.handleGetData( | 1750 | + // 等待状态更新完成(0毫秒,但会等到下一个事件循环) |
| 1751 | + await sleep(0); | ||
| 1752 | + this.handleGetData( | ||
| 1750 | masterConfig, | 1753 | masterConfig, |
| 1751 | slaveConfig, | 1754 | slaveConfig, |
| 1752 | slave0Config, | 1755 | slave0Config, |
src/utils/utils.js
| @@ -820,3 +820,12 @@ export function getSelectedDataIndex(props, tableName) { | @@ -820,3 +820,12 @@ export function getSelectedDataIndex(props, tableName) { | ||
| 820 | } | 820 | } |
| 821 | return selectedDataIndex; | 821 | return selectedDataIndex; |
| 822 | } | 822 | } |
| 823 | + | ||
| 824 | +export const waitAndDo = (fn, delay = 0) => { | ||
| 825 | + return new Promise(resolve => setTimeout(() => { | ||
| 826 | + fn(); | ||
| 827 | + resolve(); | ||
| 828 | + }, delay)); | ||
| 829 | +}; | ||
| 830 | + | ||
| 831 | +export const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)); |