duy hai 3 semanas
pai
achega
8eafe38cb4

+ 33 - 27
src/views/archives/manage/inspects.vue

@@ -184,6 +184,7 @@ import tuningApi from '~api/archiveConfig/tuning.js'
 import archiveQueryApi from '~api/using/query.js'
 import inspectApi from '~api/transfer/inspects.js'
 import tuning from '../../../api/modules/archiveConfig/tuning'
+import { useRouter } from 'vue-router'
 
 
 //变量
@@ -194,6 +195,16 @@ const projectInfo = ref(useAppState.getProjectInfo)
 const isCollapse = ref(useAppState.getCollapse)
 const isBubble = ref(useAppState.getBubble)
 const userInfo = ref(useAppState.getUserInfo)
+const router = useRouter()
+// 方案1:监听路由离开(最可靠)
+router.beforeEach((to, from, next) => {
+  // 判断是否从案卷检查页面离开
+  if (from.path === '/archives/manage/inspects' && pdfTimer.value) {
+    clearTimeout(pdfTimer.value)
+    pdfTimer.value = null
+  }
+  next()
+})
 
 //监听
 watch(() => [
@@ -407,19 +418,27 @@ const pdfShowTime = ref(0)
 const getPdfTime = (val)=>{
     pdfShowTime.value = val
 }
-
+// 新增:用于存储定时器ID
+const pdfTimer = ref(null)
 // 监控pdfUrl和shouldCarryOutSpotChecks的变化
 watch([pdfUrl, isCarrySpotChecksDrawer], ([newPdfUrl, newShouldCarryOutSpotChecks]) => {
+  // 清除之前的定时器
+  if (pdfTimer.value) {
+    clearTimeout(pdfTimer.value)
+    pdfTimer.value = null
+  }
+  
   if (newPdfUrl && newPdfUrl.length > 0 && newShouldCarryOutSpotChecks) {
-    // 设置一个30秒的定时器,在定时器到期时检查pdfUrl是否仍然相同
-    setTimeout(() => {
+    // 设置新的定时器并保存ID
+    pdfTimer.value = setTimeout(() => {
       if (pdfUrl.value === newPdfUrl && isCarrySpotChecksDrawer.value) {
         serReviewFile()
       }
-      
     }, pdfShowTime.value ? pdfShowTime.value + 30000 : 30000)
   }
 }, { deep: true })
+
+
 const opid = ref('')
 
 //获取抽检意见
@@ -567,12 +586,7 @@ const cscTableColumn51 = [
     { key:'val', name: '摘要' },
 ]
 const cscTableData5 = ref([
-    // {id: 1, user: '051@王海军@0422431197502148151@1', time: '2022-05-13 08:54:15', val: '签名有效。由051@王海军@0422431197502148151@1签名。自应用本签名以来,文档未被修改过。签名者身份有效。'},
-    // {id: 2, user: '051@王海军@0422431197502148151@1', time: '2022-05-13 08:54:15', val: '签名有效。由051@王海军@0422431197502148151@1签名。自应用本签名以来,文档未被修改过。签名者身份有效。'},
-    // {id: 3, user: '051@王海军@0422431197502148151@1', time: '2022-05-13 08:54:15', val: '签名有效。由051@王海军@0422431197502148151@1签名。自应用本签名以来,文档未被修改过。签名者身份有效。'},
-    // {id: 4, user: '051@王海军@0422431197502148151@1', time: '2022-05-13 08:54:15', val: '签名有效。由051@王海军@0422431197502148151@1签名。自应用本签名以来,文档未被修改过。签名者身份有效。'},
-    // {id: 5, user: '051@王海军@0422431197502148151@1', time: '2022-05-13 08:54:15', val: '签名有效。由051@王海军@0422431197502148151@1签名。自应用本签名以来,文档未被修改过。签名者身份有效。'},
-    // {id: 6, user: '051@王海军@0422431197502148151@1', time: '2022-05-13 08:54:15', val: '签名有效。由051@王海军@0422431197502148151@1签名。自应用本签名以来,文档未被修改过。签名者身份有效。'}
+  
 ])
 
 
@@ -625,6 +639,11 @@ const cscTableDataModalClose = () => {
 
 //关闭抽查
 const onCarrySpotChecksDrawerClose = () => {
+      // 清除定时器
+  if (pdfTimer.value) {
+    clearTimeout(pdfTimer.value)
+    pdfTimer.value = null
+  }
     isCarrySpotChecksDrawer.value = false
     pdfUrl.value = ''
     ishowFile.value = false
@@ -635,21 +654,8 @@ const onCarrySpotChecksDrawerClose = () => {
 }
 
 
-//左右拖动,改变树形结构宽度
-const leftWidth = ref(382)
-const onmousedown = () => {
-    const leftNum = isCollapse.value ? 142 : 272
-    document.onmousemove = (ve) => {
-        let diffVal = ve.clientX - leftNum
-        if (diffVal >= 310 && diffVal <= 900) {
-            leftWidth.value = diffVal
-        }
-    }
-    document.onmouseup = () => {
-        document.onmousemove = null
-        document.onmouseup = null
-    }
-}
+
+
 //获取元数据
 const cscmetaTableLoading = ref(false)
 const cscmetaDataTabledata = ref([])
@@ -690,11 +696,11 @@ const downloadArchiveAutoExcelClick = async () => {
 }
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
 @import '~style/transfer/scoped/inspects.scss';
 </style>
 
-<style lang="scss">
+<style lang="scss" scoped>
 @import '~style/transfer/inspects.scss';
 @import '~src/styles/theme/transfer/inspect.scss';
 .act-border{

+ 25 - 6
src/views/transfer/components/carry-spot-checks.vue

@@ -173,7 +173,7 @@ import archiveQueryApi from '~api/using/query.js'
 import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
 import tuningApi from '~api/archiveConfig/tuning.js'
 import initialgApi from '~api/initial/initial'
-
+import { useRouter } from 'vue-router'
 
 //参数
 const props = defineProps({
@@ -230,7 +230,7 @@ const fileId = ref(props.fileId)//案卷ID
 const fileInfo = ref(props.fileInfo)//案卷ID
 const userInfo = ref(useAppState.getUserInfo)
 const currentId = ref(props.currentId)
-
+const router = useRouter()
 //监听
 watch(() => [
     props.show,
@@ -371,12 +371,27 @@ const pdfShowTime = ref(0)
 const getPdfTime = (val)=>{
     pdfShowTime.value = val
 }
-// 监控pdfUrl和shouldCarryOutSpotChecks的变化
+const pdfTimer = ref(null)
+// 方案1:监听路由离开(最可靠)
+router.beforeEach((to, from, next) => {
+  // 判断是否从专家页面离开
+  if (from.path === '/transfer/leader-sampling' && pdfTimer.value) {
+    clearTimeout(pdfTimer.value)
+    pdfTimer.value = null
+  }
+  next()
+})
 watch([pdfUrl, isDrawer], ([newPdfUrl, newShouldCarryOutSpotChecks]) => {
+  // 清除之前的定时器
+  if (pdfTimer.value) {
+    clearTimeout(pdfTimer.value)
+    pdfTimer.value = null
+  }
+  
   if (newPdfUrl && newPdfUrl.length > 0 && newShouldCarryOutSpotChecks) {
-    // 设置一个30秒的定时器,在定时器到期时检查pdfUrl是否仍然相同
-    setTimeout(() => {
-      if (pdfUrl.value === newPdfUrl && isDrawer.value) {
+    // 设置新的定时器并保存ID
+    pdfTimer.value = setTimeout(() => {
+      if (pdfUrl.value === newPdfUrl && newShouldCarryOutSpotChecks.value) {
         serReviewFile()
       }
     }, pdfShowTime.value ? pdfShowTime.value + 30000 : 30000)
@@ -509,6 +524,10 @@ const cscTableDataModalClose = () => {
 
 //关闭抽查
 const onCarrySpotChecksDrawerClose = () => {
+      if (pdfTimer.value) {
+        clearTimeout(pdfTimer.value)
+        pdfTimer.value = null
+    }
     isDrawer.value = false
     ishowFile.value = false
     checkmetaFileId.value = ''