浏览代码

资料查询增减参数施工方

duy 2 年之前
父节点
当前提交
2626ddd981
共有 3 个文件被更改,包括 43 次插入18 次删除
  1. 23 13
      src/views/data-fill/components/WbsTree.vue
  2. 9 3
      src/views/data-fill/query.vue
  3. 11 2
      src/views/data-fill/wbs.vue

+ 23 - 13
src/views/data-fill/components/WbsTree.vue

@@ -1,7 +1,7 @@
 <template>
     <ElTree class="hc-tree-node tree-line el-radio-group" :class="[ui,submitCounts?'tree-line1':'']" ref="ElTreeRef" :props="ElTreeProps" :load="ElTreeLoadNode" lazy highlight-current accordion node-key="primaryKeyId"
-            :default-expanded-keys="defaultExpandedCids" @node-click="ElTreeClick" @node-contextmenu="ElTreeLabelContextMenu" :indent="0" >
-        <template #default="{ node, data }">
+            :default-expanded-keys="defaultExpandedCids" @node-click="ElTreeClick" @node-contextmenu="ElTreeLabelContextMenu" :indent="0"  :key="treeKey" >
+        <template #default="{ node, data }"  >
             <div class="data-custom-tree-node" :id="`${idPrefix}${data['primaryKeyId']}`">
                 <!--树组件,节点名称-->
                 <div class="label" :class="node.level === 1?'level-name':''" style="width: 100%;display: flex;justify-content: space-between;"
@@ -89,6 +89,9 @@ const props = defineProps({
         type: String,
        
     },
+    treeKey:{
+         type: String,
+    }
 })
 
 //变量
@@ -108,7 +111,8 @@ const projectId = ref(props.projectId);
 const contractId = ref(props.contractId);
 const idPrefix = ref(props.idPrefix);
 const isSubmitCounts = ref(props.submitCounts);
-const classifyTypedata=ref(props.classifyType)
+const classifyTypedata=ref(props.classifyType);
+const treeKeyData=ref(props.treeKey)
 
 //监听
 watch(() => [
@@ -120,8 +124,9 @@ watch(() => [
     props.contractId,
     props.idPrefix,
     props.submitCounts,
-    props.classifyType
-], ([menus, isMark, AutoKeys, expandKeys, UserProjectId, UserContractId, UserIdPrefix, submitCounts,ClassifyType]) => {
+    props.classifyType,
+    props.treeKey,
+], ([menus, isMark, AutoKeys, expandKeys, UserProjectId, UserContractId, UserIdPrefix, submitCounts,ClassifyType,TreeKey]) => {
     menusData.value = menus
     menuMark.value = isMark
     isAutoKeys.value = AutoKeys
@@ -131,6 +136,7 @@ watch(() => [
     idPrefix.value = UserIdPrefix
     isSubmitCounts.value = submitCounts
     classifyTypedata.value=ClassifyType
+    treeKeyData.value=TreeKey
 })
 
 //事件
@@ -198,13 +204,17 @@ const ElTreeLoadNode = async (node, resolve) => {
     }
 }
  // 刷新tree
-  const  resetNode=async()=>{
-      const theChildren = rootNode?.value.childNodes
-      theChildren?.splice(0, theChildren.length)
-        nextTick(()=>{
-         ElTreeLoadNode(rootNode.value, rootResolve.value)
-        })
- }
+//   const  resetNode=async()=>{
+//       const theChildren = rootNode?.value.childNodes
+//       theChildren?.splice(0, theChildren.length)
+//         nextTick(()=>{
+//         // ElTreeRef?.value. ElTreeLoadNode(rootNode.value, rootResolve.value)
+//          ElTreeLoadNode(rootNode.value, rootResolve.value)
+        
+//         })
+//      return 11111111
+       
+//  }
 
 watch(classifyTypedata, (val) => {
     if(val){
@@ -303,7 +313,7 @@ const removeElTreeNode = (key) => {
 defineExpose({
     setElTreeMenuMark,
     removeElTreeNode,
-    resetNode
+    // resetNode
 })
 </script>
 

+ 9 - 3
src/views/data-fill/query.vue

@@ -34,6 +34,7 @@
                                 :projectId="projectId" 
                                 :contractId="contractId" 
                                 :submitCounts="true" 
+                                :treeKey="wbstreeKey"
                                 isColor 
                                 @nodeTap="wbsElTreeClick"
                                 :classifyType="contractTypeTabKey"
@@ -199,6 +200,7 @@ const contractInfo = ref(useAppState.getContractInfo);
 const isCollapse = ref(useAppState.getCollapse)
 //变量
 const wbstree = ref(null)
+const wbstreeKey=ref(Math.random())
 //树搜索
 const isSearchTree = ref(false)
 //监听
@@ -388,10 +390,14 @@ const keyUpEvent = (e) => {
 //搜索
 const searchClick = () => {
     searchForm.value.current = 1;
-    // getTableData()
-     wbstree.value.resetNode().then((res)=>{
+    wbstreeKey.value=Math.random()
      getTableData()
- })
+//      wbstree.value.resetNode().then((red)=>{
+//          if(red){
+//               getTableData()
+//          }
+    
+//  })
 
 }
 

+ 11 - 2
src/views/data-fill/wbs.vue

@@ -133,6 +133,7 @@
                                      @menuTap="ElTreeMenuClick"
                                       @nodeLoading="ElTreeNodeLoading"
                                       ref="wbstree"
+                                      :treeKey="wbstreeKey"
 
                                        />
                                 </template>
@@ -428,6 +429,7 @@ const isDrawType = ref(true)
 const TreeAutoExpandKeys = ref(getStoreData('wbsTreeExpandKeys') || [])
 //树搜索
 const isSearchTree = ref(false)
+const wbstreeKey=ref(Math.random())
 const getSearchTreeData=async()=>{
         const {error, code, data} = await queryApi.getTreeall({
             contractId: contractId.value,
@@ -480,6 +482,7 @@ const authBtnTabClick = (val) => {
         window?.$message?.warning('请先在左侧项目树选择一个节点')
     } else if (val['key'] !== authBtnTabKey.value) {
         authBtnTabKey.value = val['key']
+         wbstreeKey.value=new Date().toString()
         getTableDataAll()
       
         
@@ -496,10 +499,16 @@ const setContractType = (contractType) => {
 }
 
 const getTableDataAll = () => {
-    wbstree.value.resetNode().then((res)=>{
+  
       searchNodeAllTable()
       queryNodeStatus()
- })
+//     wbstree.value.resetNode().then((res)=>{
+//         if(res){
+//             searchNodeAllTable()
+//             queryNodeStatus()
+//         }
+     
+//  })
  
    
 }