Forráskód Böngészése

exceltab/get-buss-pdfs

duy 2 éve
szülő
commit
ccd56b4ba7

+ 8 - 0
src/api/modules/data-fill/query.js

@@ -90,6 +90,14 @@ export default {
             params: form
         }, msg)
     },
+    //获取合同段树所有数据
+    async getTreeall(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/contractInfo/tree-all',
+            method: 'get',
+            params: form
+        }, msg)
+    },
     //获取流程状态
     async getFirstTaskStatus(form, msg = true) {
         return httpApi({

+ 47 - 6
src/views/data-fill/components/HcTreeData.vue

@@ -1,6 +1,6 @@
 <template>
     <ElTree class="hc-tree-node tree-line" ref="ElTreeRef" :props="ElTreeProps" :data="datas" highlight-current accordion node-key="primaryKeyId"
-            :default-expanded-keys="TreeExpandKey" @node-click="ElTreeClick" @node-contextmenu="ElTreeLabelContextMenu" :indent="0">
+            :default-expanded-keys="TreeExpandKey" @node-click="ElTreeClick" @node-contextmenu="ElTreeLabelContextMenu" :indent="0"  :filter-node-method="filterNode">
         <template #default="{ node, data }">
             <div class="data-custom-tree-node" :id="`${idPrefix}${data['primaryKeyId']}`">
                 <!--树组件,节点名称-->
@@ -33,7 +33,7 @@
 </template>
 
 <script setup>
-import {ref,watch} from "vue";
+import {ref,watch,nextTick} from "vue";
 import {getArrValue,getObjValue} from "vue-utils-plus"
 //参数
 const props = defineProps({
@@ -73,6 +73,10 @@ const props = defineProps({
         type: Boolean,
         default: false
     },
+    searchTreeVal:{
+      type: String,
+        default: '11'  
+    }
 })
 
 //变量
@@ -90,6 +94,7 @@ const isAutoKeys = ref(props.isAutoKeys)
 const TreeExpandKey = ref(props.autoExpandKeys)
 const idPrefix = ref(props.idPrefix);
 const isSubmitCounts = ref(props.submitCounts);
+const searchInfo=ref(props.searchTreeVal)
 
 //监听
 watch(() => [
@@ -99,17 +104,33 @@ watch(() => [
     props.autoExpandKeys,
     props.idPrefix,
     props.submitCounts,
-], ([menus, isMark, AutoKeys, expandKeys, UserIdPrefix, submitCounts]) => {
+    props.searchTreeVal
+], ([menus, isMark, AutoKeys, expandKeys, UserIdPrefix, submitCounts,searchTreeVal]) => {
     menusData.value = menus
     menuMark.value = isMark
     isAutoKeys.value = AutoKeys
     TreeExpandKey.value = expandKeys
     idPrefix.value = UserIdPrefix
     isSubmitCounts.value = submitCounts
+    searchInfo.value=searchTreeVal
 })
+watch(searchInfo, (val) => {
+    if(val){
+        nextTick(()=> {
+            ElTreeRef?.value.filter(val)
+        })
+        
+    }else{
+        emit('changeSearch')
+    }
+   
+},
 
+{immediate:true}
+
+)
 //事件
-const emit = defineEmits(['menuTap','nodeTap'])
+const emit = defineEmits(['menuTap','nodeTap','changeSearch'])
 
 //节点被点击
 const ElTreeClick = async (data,node) => {
@@ -178,11 +199,31 @@ const removeElTreeNode = (key) => {
     //删除 Tree 中的一个节点,使用此方法必须设置 node-key 属性
     ElTreeRef.value.remove(node)
 }
-
+ const getReturnNode=(node,_array,value)=>{
+        let isPass = node.data &&  node.data.title && node.data.title.indexOf(value) !== -1;
+        isPass?_array.push(isPass):'';
+        if(!isPass && node.level!=1 && node.parent){
+          getReturnNode(node.parent,_array,value);
+        }
+ }
+const filterNode = (value, data,node) => {
+    if(!value){
+            return true;
+        }
+        let level = node.title;
+        let _array = [];//这里使用数组存储 只是为了存储值。
+        getReturnNode(node,_array,value);
+        let result = false;
+        _array.forEach((item)=>{
+            result = result || item;
+        });
+        return result;
+    }
 // 暴露出去
 defineExpose({
     setElTreeMenuMark,
-    removeElTreeNode
+    removeElTreeNode,
+    filterNode
 })
 </script>
 

+ 26 - 19
src/views/data-fill/query.vue

@@ -12,7 +12,7 @@
             </div>
             <div class="hc-tree-box">
                 <div class="hc-search-tree-val">
-                    <el-input v-model="searchTreeVal" block size="large" placeholder="请输入名称关键词检索" clearable @keyup="searchTreeKeyUp">
+                    <el-input v-model="searchTreeVal" block size="large" placeholder="请输入名称关键词检索" clearable @keyup="searchTreeKeyUp" >
                         <template #suffix>
                             <HcIcon name="search-2" ui="text-xl" @click="searchTreeClick"/>
                         </template>
@@ -22,7 +22,11 @@
                     <el-scrollbar>
                         <KeepAlive>
                             <template v-if="isSearchTree">
-                                <HcTreeData :datas="searchTreeData" :autoExpandKeys="treeAutoExpandKeys" submitCounts isColor @nodeTap="wbsElTreeClick"/>
+                                <HcTreeData :datas="searchTreeData" :autoExpandKeys="treeAutoExpandKeys" submitCounts isColor 
+                                @nodeTap="wbsElTreeClick" 
+                                :searchTreeVal="searchTreeVal"
+                                @changeSearch="changeisSearch"
+                                />
                             </template>
                             <template v-else>
                                 <WbsTree :autoExpandKeys="treeAutoExpandKeys" :projectId="projectId" :contractId="contractId" submitCounts isColor @nodeTap="wbsElTreeClick"/>
@@ -187,8 +191,8 @@ const isCollapse = ref(useAppState.getCollapse)
 
 //监听
 watch(() => [
-    useAppState.getCollapse
-], ([Collapse]) => {
+    useAppState.getCollapse,
+], ([Collapse,newsearchTreeVal]) => {
     isCollapse.value = Collapse
 })
 
@@ -201,6 +205,8 @@ onMounted(() => {
     getReportNumber()
     getFirstTaskStatus()
     getDictBizClassify()
+     getSearchTreeData()
+
 })
 
 //树搜索
@@ -210,18 +216,11 @@ const searchTreeData = ref([])
 
 //回车
 const treeLoading = ref(false)
-const searchTreeKeyUp = (e) => {
-    if (e.key === "Enter") {
-        searchTreeClick()
-    }
-}
-const searchTreeClick = async () => {
-    if (searchTreeVal.value) {
-        isSearchTree.value = true
-        treeLoading.value = true
-        const {error, code, data} = await queryApi.searchContractTree({
+const getSearchTreeData=async()=>{
+        const {error, code, data} = await queryApi.getTreeall({
             contractId: contractId.value,
-            queryValue: searchTreeVal.value
+            projectId: projectId.value,
+            wbsId:projectInfo?.value.referenceWbsTemplateId
         })
         //判断状态
         if (!error && code === 200) {
@@ -231,17 +230,25 @@ const searchTreeClick = async () => {
             treeLoading.value = false
             searchTreeData.value = []
         }
-    } else {
-        treeLoading.value = false
-        isSearchTree.value = false
+    
+}
+const searchTreeKeyUp = (e) => {
+    if (e.key === "Enter") {
+        searchTreeClick()
     }
 }
 
+const searchTreeClick = async () => {
+    isSearchTree.value=true
+}
+
 //树相关的变量
 const primaryKeyId = ref('')
 const nodeItemInfo = ref({})
 const nodeDataInfo = ref({})
-
+const changeisSearch=()=>{
+    isSearchTree.value=false
+}
 //树被点击
 const wbsElTreeClick = ({node, data, keys}) => {
     nodeItemInfo.value = node