فهرست منبع

抽检提示修改

duy 2 هفته پیش
والد
کامیت
68bc812e98
2فایلهای تغییر یافته به همراه25 افزوده شده و 47 حذف شده
  1. 12 16
      src/views/archives/manage/inspects.vue
  2. 13 31
      src/views/transfer/components/carry-spot-checks.vue

+ 12 - 16
src/views/archives/manage/inspects.vue

@@ -329,14 +329,7 @@ const tableRowClick = async ({ row }) => {
     //     pdfUrl.value = url
     console.log(row, 'row')
     
-        if (pdfUrl.value && pdfUrl?.value.length > 0 && isCarrySpotChecksDrawer.value) {
-            setTimeout(() => {
-                if (isCarrySpotChecksDrawer.value) {
-                    serReviewFile()
-                }
-
-            }, 30000)
-        }
+   
 }
 //获取卷内文件数据
 const getArchiveFileListData = async ()=>{
@@ -406,17 +399,20 @@ const changePdf = (row)=>{
     ishowAllopinion.value = true
 
     getopiniondata()
-    if (pdfUrl.value && pdfUrl?.value.length > 0 && isCarrySpotChecksDrawer.value) {
-            setTimeout(() => {
-                if (isCarrySpotChecksDrawer.value) {
-                    serReviewFile()
-                }
-
-            }, 30000)
-     }
 
 
 }
+// 监控pdfUrl和shouldCarryOutSpotChecks的变化
+watch([pdfUrl, isCarrySpotChecksDrawer], ([newPdfUrl, newShouldCarryOutSpotChecks]) => {
+  if (newPdfUrl && newPdfUrl.length > 0 && newShouldCarryOutSpotChecks) {
+    // 设置一个30秒的定时器,在定时器到期时检查pdfUrl是否仍然相同
+    setTimeout(() => {
+      if (pdfUrl.value === newPdfUrl && isCarrySpotChecksDrawer.value) {
+        serReviewFile()
+      }
+    }, 30000)
+  }
+}, { deep: true })
 const opid = ref('')
 
 //获取抽检意见

+ 13 - 31
src/views/transfer/components/carry-spot-checks.vue

@@ -252,21 +252,7 @@ watch(() => [
 
     if (fileId.value && isDrawer.value) {
         getArchiveFileListData()
-        // let url
-        // viewPdf(fileId.value).then((res) => {
-        //     console.log(res, 'res')
-        //     url = res
-        //     pdfUrl.value = url
-        //     if (pdfUrl.value && pdfUrl?.value.length > 0) {
-        //         setTimeout(() => {
-
-        //             if (isDrawer.value) {
-        //                 serReviewFile()
-        //             }
-
-        //         }, 30000)
-        //     }
-        // })
+
 
     }
     if (isO) {
@@ -331,15 +317,7 @@ const getArchiveFileListData = async () => {
             let rawUrl = cscTableData1.value[0].pdfFileUrl
  
         pdfUrl.value = rawUrl
-         if (pdfUrl.value && pdfUrl?.value.length > 0) {
-                setTimeout(() => {
-
-                    if (isDrawer.value) {
-                        serReviewFile()
-                    }
 
-                }, 30000)
-            }
             checkId.value = cscTableData1.value[0].id
             getmetaInfo()
         }
@@ -385,17 +363,21 @@ const changePdf = (row) => {
     ishowAllopinion.value = true
 
     getopiniondata()
-    if (pdfUrl.value && pdfUrl?.value.length > 0) {
-        setTimeout(() => {
-            if (isDrawer.value) {
-                serReviewFile()
-            }
-
-        }, 30000)
-    }
 
 
 }
+
+// 监控pdfUrl和shouldCarryOutSpotChecks的变化
+watch([pdfUrl, isDrawer], ([newPdfUrl, newShouldCarryOutSpotChecks]) => {
+  if (newPdfUrl && newPdfUrl.length > 0 && newShouldCarryOutSpotChecks) {
+    // 设置一个30秒的定时器,在定时器到期时检查pdfUrl是否仍然相同
+    setTimeout(() => {
+      if (pdfUrl.value === newPdfUrl && isDrawer.value) {
+        serReviewFile()
+      }
+    }, 30000)
+  }
+}, { deep: true })
 //设置为已查阅
 const serReviewFile = async () => {
     const { error, code, data, msg } = await initialgApi.updateInspectStatus({