diff --git a/src/components/Common/CommonNewBillEvent.js b/src/components/Common/CommonNewBillEvent.js index 18e0583..2912a2a 100644 --- a/src/components/Common/CommonNewBillEvent.js +++ b/src/components/Common/CommonNewBillEvent.js @@ -9,6 +9,7 @@ import * as commonServices from "@/services/services"; /* 服务类 */ import commonConfig from "@/utils/config"; import * as commonFunc from "@/components/Common/commonFunc"; import styles from "@/components/Common/ToolBar/index.less"; +import { sleep } from '@/utils/utils'; const { confirm } = Modal; @@ -1746,7 +1747,9 @@ export default ChildComponent => { if (billnosetting.bAutoCheck) { await this.handleAudit(1); } else { - await this.handleGetData( + // 等待状态更新完成(0毫秒,但会等到下一个事件循环) + await sleep(0); + this.handleGetData( masterConfig, slaveConfig, slave0Config, diff --git a/src/utils/utils.js b/src/utils/utils.js index 45fdfd4..d1f68ae 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -820,3 +820,12 @@ export function getSelectedDataIndex(props, tableName) { } return selectedDataIndex; } + +export const waitAndDo = (fn, delay = 0) => { + return new Promise(resolve => setTimeout(() => { + fn(); + resolve(); + }, delay)); +}; + +export const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));