Ver código fonte

试验自检修改

duy 1 ano atrás
pai
commit
09d4c36f3e
1 arquivos alterados com 21 adições e 6 exclusões
  1. 21 6
      src/views/tentative/detect/test-form.vue

+ 21 - 6
src/views/tentative/detect/test-form.vue

@@ -197,7 +197,7 @@
 </template>
 
 <script setup>
-import { nextTick, onDeactivated, onMounted, ref, watch } from 'vue'
+import { nextTick, onDeactivated, onMounted, onUnmounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRoute, useRouter } from 'vue-router'
 import ListItem from './components/ListItem.vue'
@@ -268,12 +268,27 @@ onMounted(() => {
     getSearchNodeTablesall(2)
     getCategoryData()
 })
-onDeactivated(() => {
-  // 更新内容
-  setTimeout(() => {
-        window?.location?.reload() //刷新页面
-    }, 1000)
+//监听路由参数改变
+watch(() => [
+    useRoutes?.query,
+], ([query]) => {
+    if (isNullES(query.key)) {
+        setTimeout(()=>{
+            window?.location?.reload() //刷新页面
+        }, 1000)
+    }
+}, { deep: true })
+
+//监听项目,合同段
+watch(() => [
+    useAppState.getProjectId,
+    useAppState.getContractId,
+], ([pid, cid]) => {
+  if (pid || cid) {
+    toBackClick()
+  }
 })
+
 //身份按钮切换数据
 const authBtnTabKey = ref(dataType)
 const authBtnTabdata = ref([