Sfoglia il codice sorgente

公式配置搜索元素字段优化

duy 2 anni fa
parent
commit
ac3ef3e444
2 ha cambiato i file con 82 aggiunte e 44 eliminazioni
  1. 3 2
      src/api/manager/wbstree.js
  2. 79 42
      src/views/formula/edit1.vue

+ 3 - 2
src/api/manager/wbstree.js

@@ -144,13 +144,14 @@ export const selectPrivateFormElements = (id, params) => {
   })
 }
 //根据表单id查询所有元素
-export const getTableElments = (id, params) => {
+export const getTableElments = (id,search ,params) => {
     return request({
       url: '/api/blade-manager/wbsTree/get-table-elements',
       method: 'get',
       params: {
         ...params,
-        id
+        id,
+        search
       }
     })
   }

+ 79 - 42
src/views/formula/edit1.vue

@@ -113,20 +113,10 @@
             </el-card>
           </el-col>
           <el-col :span="16" class="h-100p flex flex-d-c ov-hidden">
-            <!-- <el-select v-model="eleTableId" @change="getTableEle" placeholder="请选择元素表" style="width:300px">
-              <el-option v-if="paramDataList.length" label="选择节点参数2" value="选择节点参数"></el-option>
-              <el-option  v-for="item in eleTableList" :key="item.id" :label="item.tableName" :value="item.id"></el-option>
-            </el-select> -->
-            <el-select v-model="input3" filterable placeholder="请选择元素字段"  @change="getTableEle"  style="width:100%"  :popper-append-to-body="false">
-              <el-option
-
-                v-for="item in eleTableList"
-                :key="item.id"
-                :label="item.eName"
-                :value="item.eName">
-              </el-option>
-            </el-select>
-
+             <div style="display:flex">
+                      <el-input placeholder="请输入你想搜索的元素字段" v-model="inputele"  clearable  @clear="clearinput" >  </el-input>
+                        <el-button type="primary" icon="el-icon-search"  size="small"  @click="searchChange">搜索</el-button>
+               </div>
             <div class="mg-t-10 no-mb-col flex1 ov-hidden" style="height: 360px; overflow-y: auto; max-height: 360px;">
               <el-scrollbar style="height: 100%">
                 <el-row v-loading="eleListable">
@@ -262,13 +252,13 @@
                 </div>
               </div>
                 <div v-show="item.showSelectEle"  style="width:60%">
-                  <el-select v-model="eleTableIdComp" @change="getTableEleComp" placeholder="请选择元素字段" style="width:100%" filterable>
-                    <el-option v-if="paramDataList.length" label="选择节点参数1" value="选择节点参数"></el-option>
-                    <el-option  v-for="item in eleTableListComp" :key="item.id" :label="item.eName" :value="item.id"></el-option>
-                  </el-select>
+                   <div style="display:flex">
+                      <el-input placeholder="请输入你想搜索的元素字段" v-model="inputelejudge"  clearable  @clear="clearinputjudge" >  </el-input>
+                        <el-button type="primary" icon="el-icon-search"  size="small"  @click="searchChangejudge">搜索</el-button>
+                  </div>
                   <div class="mg-t-10 mg-b-10 no-mb-col" style="width:100%">
-                    <el-scrollbar style="height:520px;">
-                      <el-row>
+                    <el-scrollbar style="height:600px;">
+                      <el-row v-loading="eleListjudge">
                         <el-col :span="6" v-for="item in eleListComp" :key="item.id">
                           <div class="ele-box">
                             <span v-if="item.k">{{item.name}}</span>
@@ -335,13 +325,13 @@
           </div>
         </div>
         <div v-show="deviationRange.showSelectEle"  style="width:60%">
-          <el-select v-model="eleTableIdComp" @change="getTableEleComp" placeholder="请选择元素表" style="width:100%" filterable>
-            <el-option v-if="paramDataList.length" label="选择节点参数" value="选择节点参数"></el-option>
-            <el-option  v-for="item in eleTableListComp" :key="item.id" :label="item.eName" :value="item.id"></el-option>
-          </el-select>
+           <div style="display:flex">
+                      <el-input placeholder="请输入你想搜索的元素字段" v-model="inputelepian"  clearable  @clear="clearinputpian" >  </el-input>
+                        <el-button type="primary" icon="el-icon-search"  size="small"  @click="searchChangepian">搜索</el-button>
+            </div>
           <div class="mg-t-10 mg-b-10 no-mb-col" style="width:100%">
             <el-scrollbar style="height:520px;">
-              <el-row>
+              <el-row v-loading="eleListComploading">
                 <el-col :span="6" v-for="item in eleListComp" :key="item.id">
                   <div class="ele-box">
                     <span v-if="item.k">{{item.name}}</span>
@@ -418,11 +408,14 @@
             </el-card>
           </el-col>
           <el-col :span="16">
-            <el-select v-model="eleTableId" @change="getTableEle1" placeholder="请选择元素字段" filterable style="width:100%">
+            <!-- <el-select v-model="eleTableId" @change="getTableEle1" placeholder="请选择元素字段" filterable style="width:100%">
               <el-option v-if="paramDataList.length" label="选择节点参数3" value="选择节点参数"></el-option>
               <el-option  v-for="item in eleTableList" :key="item.id" :label="item.eName" :value="item.id"></el-option>
-            </el-select>
-
+            </el-select> -->
+             <div style="display:flex">
+                      <el-input placeholder="请输入你想搜索的元素字段" v-model="inputele"  clearable  @clear="clearinput" >  </el-input>
+                        <el-button type="primary" icon="el-icon-search"  size="small"  @click="searchChange">搜索</el-button>
+              </div>
             <div class="mg-t-10 mg-b-10 no-mb-col">
               <el-scrollbar style="height: 460px;">
                 <el-row >
@@ -647,12 +640,17 @@ export default {
         total: 2
       },
       eleListable:false,
+      eleListComploading:false,
+      eleListjudge:false,
       input3:'',
       rootNodeData: [],
       nodeZero: null,
       resolveZero: null,
       loading: false,
-      itemList:[]
+      itemList:[],
+      inputele:'',
+      inputelepian:'',
+      inputelejudge:'',
 
 
     };
@@ -1622,6 +1620,56 @@ export default {
       })
       this.eleList=arr;
     },
+    searchChange(){
+      this.eleListable=true;
+      if (this.inputele) {
+          getTableElments( this.treeId,this.inputele ).then((res)=>{
+           this.eleList=res.data.data;
+            this.eleListable=false;
+         })
+      }
+    },
+    searchChangepian(){
+      this.eleListComploading=true;
+      if (this.inputelepian) {
+          getTableElments( this.treeId,this.inputelepian ).then((res)=>{
+           this.eleListComp=res.data.data;
+            this.eleListComploading=false;
+         })
+      }
+    },
+    searchChangejudge(){
+      this.eleListjudge=true;
+      if (this.inputelejudge) {
+          getTableElments( this.treeId,this.inputelejudge ).then((res)=>{
+           this.eleListComp=res.data.data;
+            this.eleListjudge=false;
+         })
+      }
+    },
+    clearinput(){
+        this.eleListable=true;
+        getTableElments( this.treeId ).then((res)=>{
+            this.eleList=res.data.data;
+            this.eleListable=false;
+         })
+    },
+    clearinputpian(){
+      // eleListComp
+      this.eleListComploading=true;
+       getTableElments( this.treeId ).then((res)=>{
+            this.eleListComp=res.data.data;
+             this.eleListComploading=false
+           
+         })
+    },
+    clearinputjudge(){
+      this.eleListjudge=true;
+       getTableElments( this.treeId ).then((res)=>{
+            this.eleListComp=res.data.data;
+         })
+        this.eleListjudge=false;
+    },
     getTableEle1(tableId){
        let arr=[]
       arr=this.eleTableList.filter((item)=>{
@@ -1634,10 +1682,9 @@ export default {
 
 
     getNodeDetailComp(data,node) {
-      console.log(1111111111);
        this.treeId=data.initTableId;
        this.curNode=node;
-      this.curData=data;
+       this.curData=data;
        this.input3=''
         if(data.hasChildren===false){
            getTableElments(data.initTableId ).then((res)=>{
@@ -1654,22 +1701,12 @@ export default {
            })
         }
         else{
-
            this.eleListComp=[]
            this.page.total=0
-
         }
     },
 
-    getTableEleComp(tableId){
-       let arr=[]
-      arr=this.eleTableListComp.filter((item)=>{
-        if(item.id===tableId){
-          return item
-        }
-      })
-      this.eleListComp=arr;
-    },
+ 
 
     //取消方法下面 元素勾选
     unCheckEleComp(eleId){