ZaiZai 11 mesi fa
parent
commit
3653290b02
1 ha cambiato i file con 27 aggiunte e 4 eliminazioni
  1. 27 4
      src/views/file/collection.vue

+ 27 - 4
src/views/file/collection.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-body :loading="treeLoading" :project-nmae="projectInfo?.name" class="hc-file-collection-page" split>
+    <hc-body :loading="!isAppLoading" :project-nmae="projectInfo?.name" class="hc-file-collection-page" split>
         <template #tree>
             <HcTree
                 ref="treeRef" :auto-expand-keys="treeAutoExpandKeys" :contract-id="contractId" :menus="ElTreeMenu"
@@ -409,7 +409,7 @@
 <script setup>
 import { useAppStore } from '~src/store'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
-import { nextTick, onMounted, ref, watch } from 'vue'
+import { computed, nextTick, onMounted, ref, watch } from 'vue'
 import HcTree from '~src/components/tree/hc-tree.vue'
 import HcReport from './components/HcReport.vue'
 import notableform from '~src/assets/view/notableform.svg'
@@ -442,10 +442,33 @@ watch(() => [
     isCollapse.value = Collapse
 })
 
+//监听
+watch(() => [useAppState.getProjectId, useAppState.getContractId, useAppState.getProjectInfo], ([pid, cid, info]) => {
+    projectId.value = pid
+    contractId.value = cid
+    projectInfo.value = info
+}, { deep: true })
+
+//加载中
+const isAppLoading = computed(() => {
+    return !isNullES(projectId.value) && !isNullES(contractId.value)
+})
+
+//监听变化
+watch(() => isAppLoading.value, (val) => {
+    if (val) {
+        treeLoading.value = true
+        setTableColumns()
+    }
+})
+
+
 //渲染完成
 onMounted(() => {
-    treeLoading.value = true
-    setTableColumns()
+    if (isAppLoading.value) {
+        treeLoading.value = true
+        setTableColumns()
+    }
 })