Browse Source

树加载

ZaiZai 2 years ago
parent
commit
c7b400c353
2 changed files with 15 additions and 6 deletions
  1. 14 6
      src/views/file/collection.vue
  2. 1 0
      src/views/file/components/hc-tree.vue

+ 14 - 6
src/views/file/collection.vue

@@ -10,9 +10,9 @@
                     <div class="text-xs text-cut project-name">{{projectInfo['name']}}</div>
                 </div>
             </div>
-            <div class="hc-tree-box">
+            <div class="hc-tree-box" v-loading="treeLoading">
                 <el-scrollbar>
-                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick"/>
+                    <HcTree :projectId="projectId" :contractId="contractId" @nodeTap="projectTreeClick" @nodeLoading="treeNodeLoading"/>
                 </el-scrollbar>
             </div>
             <!--左右拖动-->
@@ -389,9 +389,17 @@ watch(() => [
 
 //渲染完成
 onMounted(() => {
+    treeLoading.value = true
     setTableColumns()
 })
 
+//树相关的变量
+const treeLoading = ref(false)
+const treeNodeLoading = () => {
+    treeLoading.value = false
+}
+
+
 //审批状态
 const approvalStatus = ref([
     {label: '未上报', value: '1'},
@@ -528,7 +536,7 @@ const sortingClick = async() => {
                 sortingNoneModal.value = true
             }
         }
-        
+
     } else {
         window?.$message?.warning('请先选择一个子节点')
     }
@@ -547,7 +555,7 @@ const sortingOldData = ref([])//旧数据,用来对比是否修改名字
 //获取数据
 const sortingItemLoading = ref(false)
 const getSortingItemData = () => {
-    
+
 }
 
 //校验
@@ -693,7 +701,7 @@ const sortingModalSave = async() => {
         }else{
             obj.ids = item.ids;
         }
-        
+
         rows.push(obj)
     })
 
@@ -835,7 +843,7 @@ const movesModalSave = async() => {
     } else {
         window.$message?.error('保存失败')
     }
-    
+
 }
 
 //关闭

+ 1 - 0
src/views/file/components/hc-tree.vue

@@ -180,6 +180,7 @@ const ElTreeLoadNode = async (node, resolve) => {
             resolve([])
         }
     } else {
+        emit('nodeLoading')
         resolve([])
     }
 }