duy преди 2 години
родител
ревизия
de7cefa95b
променени са 3 файла, в които са добавени 117 реда и са изтрити 51 реда
  1. 8 0
      src/api/manager/wbstree.js
  2. 53 23
      src/views/manager/projectinfo/tree.vue
  3. 56 28
      src/views/manager/wbsinfo/edit.vue

+ 8 - 0
src/api/manager/wbstree.js

@@ -360,4 +360,12 @@ export const syncCurrentFormInProject = (params) => {
         method: 'get',
         params
     })
+}
+//按类型搜索树接口
+export const getQueryValueByType = (params) => {
+    return request({
+        url: '/api/blade-manager/wbsTree/getQueryValueByType',
+        method: 'get',
+        params
+    })
 }

+ 53 - 23
src/views/manager/projectinfo/tree.vue

@@ -102,20 +102,29 @@
         <el-col :span="10" class="h-100p">
           <div class="h-100p flex flex-d-c">
             <p style="margin-top:2px">工程节点信息</p>
-            <div class="flex">
+            <div class="flex " style="align-items: center;justify-content: space-between;">
               <el-input
                 placeholder="输入关键字进行过滤"
                 v-model="filterText"
-                @input="filterChange"
                 clearable
+                style="width: 65%;margin-right: 15px;"
               ></el-input>
-              <!-- <el-button type="info" class="mg-l-20">导入划分</el-button> -->
+              <el-switch
+              v-model="searchType"
+              active-value="1"
+              inactive-value="2"
+              inline-prompt
+              active-text="按节点"
+              inactive-text="按表名"
+             
+             
+            />
+            <el-button type="primary" @click="searchTreeClick">搜索</el-button>
             </div>
             <div class="flex1 ov-hidden">
               <el-scrollbar class="h-100p">
                 <div v-loading="treeLoad">
                   <el-tree
-                  v-show="!filterText"
                   class="filter-tree"
                   lazy
                   :data="treeData"
@@ -170,7 +179,7 @@
                    </div>
                 </span>
               </el-tree>
-              <el-tree
+              <!-- <el-tree
                 v-show="filterText"
                 class="filter-tree"
                 :data="treeData"
@@ -201,7 +210,7 @@
                               ></i>
                             </el-link>
                         
-                        <!-- 因右键自定义菜单事件需要获取当前点击的位置,所以此处绑定动态样式来控制菜单实时跟踪鼠标右键点击位置 -->
+                      
                               <ul
                                 v-show="menuvisible"
                                 :style="{ left: menuleft + 'px', top: menutop + 'px' }"
@@ -216,7 +225,7 @@
                           
                     </div>
                   </span>
-                  </el-tree>
+              </el-tree> -->
                 </div>
               </el-scrollbar>
             </div>
@@ -1577,7 +1586,7 @@ import {
   updateStatus,
   getParamElements,
   specifiedParamElements,
-  delParamElements, selectPrivateFormElements,syncCurrentFormInProject
+  delParamElements, selectPrivateFormElements,syncCurrentFormInProject,getQueryValueByType
 } from "@/api/manager/wbstree";
 import {
   saveElement,
@@ -1688,6 +1697,7 @@ export default {
       projectid: "",
       filterText: "",
       treeData: [],
+      searchType:'1',
       treeLoad: false,
       menuShow: false,
       defaultProps: {
@@ -2348,22 +2358,42 @@ export default {
       this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
      
     },
-    filterChange() {
-      if (this.treeData.length > 0) {
-        this.$refs.treeall.filter(this.filterText);
-        return;
-      }
-      this.treeLoad = true;
-      getAlltree(this.projectid, this.id).then((res) => {
-        this.treeLoad = false;
-        this.treeData = res.data.data;
-        console.log(res.data.data,'res.data.data');
-        this.$nextTick(() => {
-          this.$refs.treeall.filter(this.filterText);
-        });
-      });
+    // filterChange() {
+    //   if (this.treeData.length > 0) {
+    //     this.$refs.treeall.filter(this.filterText);
+    //     return;
+    //   }
+    //   this.treeLoad = true;
+    //   getAlltree(this.projectid, this.id).then((res) => {
+    //     this.treeLoad = false;
+    //     this.treeData = res.data.data;
+    //     console.log(res.data.data,'res.data.data');
+    //     this.$nextTick(() => {
+    //       this.$refs.treeall.filter(this.filterText);
+    //     });
+    //   });
+    // },
+    //搜索树
+    searchTreeClick(){
+      this.treeLoad=true
+      getQueryValueByType({
+        queryValue:this.filterText,
+        type:this.searchType,
+        wbsId:this.id,
+        projectId: this.projectid
+       
+      }).then((res)=>{
+        let arr = [];
+        if (Array.isArray(res.data.data)) {
+          arr = res.data.data;
+          this.treeData=arr
+        }else{
+          this.treeData=[]
+        }
+       
+      })
+      this.treeLoad=false
     },
-
     importTemplate(data) {
       this.importTemplateVisible = true;
       this.curTreeData = data;

+ 56 - 28
src/views/manager/wbsinfo/edit.vue

@@ -19,20 +19,29 @@
       <el-col :span="10" class="h-100p">
         <div class="h-100p flex flex-d-c">
           <p>工程节点信息</p>
-          <div class="flex">
+          <div class="flex " style="align-items: center;justify-content: space-between;">
             <el-input
-              placeholder="输入关键字进行过滤"
+              placeholder="输入关键字进行搜索"
               v-model="filterText"
-              @input="filterChange"
               clearable
+              style="width: 70%;margin-right: 15px;"
             ></el-input>
-            <!-- <el-button type="info" class="mg-l-20">导入划分</el-button> -->
+            <el-switch
+              v-model="searchType"
+              active-value="1"
+              inactive-value="2"
+              inline-prompt
+              active-text="按节点"
+              inactive-text="按表名"
+             
+             
+            />
+            <el-button type="primary" @click="searchTreeClick">搜索</el-button>
           </div>
-          <div class="flex1 ov-hidden">
+          <div class="flex1 ov-hidden"  v-loading="treeLoad">
           <el-scrollbar class="h-100p">
-            <div v-loading="treeLoad">
+            <div>
               <el-tree
-                v-show="!filterText"
                 class="filter-tree"
                 lazy
                 :load="loadNode"
@@ -43,6 +52,7 @@
                 node-key="id"
                 ref="tree"
                 :default-expanded-keys="defaultExpandedKeys"
+                :data="treeData"
               >
                 <span
                   class="custom-tree-node"
@@ -84,7 +94,7 @@
                   </div>
                 </span>
               </el-tree>
-              <el-tree
+              <!-- <el-tree
                 v-show="filterText"
                 class="filter-tree"
                 :data="treeData"
@@ -105,9 +115,6 @@
                   <div class="pd-r-20">
                     {{ node.label }}
                     <div class="normal-black">
-                      <!-- <el-link :underline="false">
-                        <i class="el-icon-sort" @click="paixuMD(data)" v-if="node.level != 1" title="调整排序"></i>
-                      </el-link> -->
                            <div >
                               <el-link :underline="false">
                                 <i
@@ -118,7 +125,7 @@
                                 ></i>
                               </el-link>
                           
-                          <!-- 因右键自定义菜单事件需要获取当前点击的位置,所以此处绑定动态样式来控制菜单实时跟踪鼠标右键点击位置 -->
+                       
                                 <ul
                                   v-show="menuvisible"
                                   :style="{ left: menuleft + 'px', top: menutop + 'px' }"
@@ -132,7 +139,7 @@
                     </div>
                   </div>
                 </span>
-              </el-tree>
+              </el-tree> -->
             </div>
           </el-scrollbar>
           </div>
@@ -1611,7 +1618,7 @@ import FormulaEditone from '@/views/formula/edit1.vue'
 import {
   getLazytree, getDetail, update, selectByNodeTable,getParamElements,delParamElements,specifiedParamElements, getAlltree,
   saveFormAndElement, selectFormElements, removeTableById, findWbsTreeSameLevel, wbsTreeSort, findWbsTreeTableSameLevel, wbsTreeTableSort, parameters, saveOrUpdateBatch, keymap, importwbsTreeFormBatch, exportBatchTemplate, updateBatchNodeTableInfo,
-  importWbsTree, exportTemplate, remove as removeTreeNode,submitFullName,refrehPram
+  importWbsTree, exportTemplate, remove as removeTreeNode,submitFullName,refrehPram,getQueryValueByType
 } from "@/api/manager/wbstree";
 
 import {
@@ -1654,6 +1661,7 @@ export default {
       id: '',
       filterText: '',
       treeData: [],
+      searchType:'1',//搜索类型
       treeLoad: false,
       menuShow: false,
       defaultProps: {
@@ -1909,6 +1917,26 @@ export default {
         return resolve(arr);
       })
     },
+    //搜索树
+    searchTreeClick(){
+      this.treeLoad=true
+      getQueryValueByType({
+        queryValue:this.filterText,
+        type:this.searchType,
+        wbsId:this.id,
+       
+      }).then((res)=>{
+        let arr = [];
+        if (Array.isArray(res.data.data)) {
+          arr = res.data.data;
+          this.treeData=arr
+        }else{
+          this.treeData=[]
+        }
+       
+      })
+      this.treeLoad=false
+    },
 
     getNodeDetail (data, node) {
       let parentName = '';
@@ -2384,20 +2412,20 @@ export default {
       this.nodeDetail.mixRatioTestIds = this.toJoin(newarr)
       
     },
-    filterChange () {
-      if (this.treeData.length > 0) {
-        this.$refs.treeall.filter(this.filterText);
-        return;
-      }
-      this.treeLoad = true;
-      getAlltree(this.userInfo.tenant_id, 1, this.id).then((res) => {
-        this.treeLoad = false;
-        this.treeData = res.data.data;
-        this.$nextTick(() => {
-          this.$refs.treeall.filter(this.filterText);
-        })
-      })
-    },
+    // filterChange () {
+    //   if (this.treeData.length > 0) {
+    //     this.$refs.treeall.filter(this.filterText);
+    //     return;
+    //   }
+    //   this.treeLoad = true;
+    //   getAlltree(this.userInfo.tenant_id, 1, this.id).then((res) => {
+    //     this.treeLoad = false;
+    //     this.treeData = res.data.data;
+    //     this.$nextTick(() => {
+    //       this.$refs.treeall.filter(this.filterText);
+    //     })
+    //   })
+    // },
 
     importTemplate (data) {
       this.importTemplateVisible = true;