From 8b9bfe715e32e891e5a8b58d87166cbaeb2b8989 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Thu, 30 Apr 2026 17:07:48 +0800 Subject: [PATCH] 1.处理单据保存后 回刷拿到的数据还是上一次的单子而不是本次单子 --- src/components/Common/CommonNewBillEvent.js | 5 ++++- src/utils/utils.js | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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)); -- libgit2 0.22.2