소스 검색

fix: 清空缓存以避免数据残留,优化弹框打开和关闭逻辑

xieyong 1 개월 전
부모
커밋
003b9815e1
1개의 변경된 파일과 6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

+ 6 - 0
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -2222,6 +2222,9 @@
         this.activeName = '1';
 
         this.row = row;
+        // 打开弹框前先清空缓存,避免残留上次数据
+        this.rawDetailListCache = [];
+        this.outputDetailListCache = [];
         this.visible = true;
         if (this.enterprisePage.length == 0) {
           await this.getEnterprisePage();
@@ -2572,6 +2575,9 @@
         this.$emit('done');
       },
       cancel() {
+        // 先清空带料清单与产出清单的缓存,避免 nextTick 异步导致关闭事件再次触发时缓存残留
+        this.rawDetailListCache = [];
+        this.outputDetailListCache = [];
         this.$nextTick(() => {
           this.isFlag = false;
           // 关闭后,销毁所有的表单数据