Просмотр исходного кода

客户系统 关于客户的搜索都添加筛选

ajun 5 лет назад
Родитель
Сommit
2b02fc3bc9

+ 38 - 0
resources/views/customer/project/create.blade.php

@@ -197,6 +197,14 @@
                 searchItem:{},//搜索子项集
                 searchBase:5,//搜索基数
                 hover:{},//可悬浮列表
+                filterCustomers:[],
+                filterOwnerGroups:[],
+                filterUserGroups:[],
+            },
+            created(){
+                this.filterCustomers = JSON.parse(JSON.stringify(this.customers));
+                this.filterOwnerGroups = JSON.parse(JSON.stringify(this.ownerGroups));
+                this.filterUserGroups = JSON.parse(JSON.stringify(this.userGroups));
             },
             mounted(){
                 let type = "{{$type ?? ''}}";
@@ -1557,6 +1565,36 @@
                     this.$delete(this.model.operation.total_discount_price,index);
                     this.$delete(this.model.operation.discount_count,index);
                 },
+                filterCustomer(e){
+                    let value = $(e.target).val();
+                    if (value===""){
+                        this.filterCustomers=JSON.parse(JSON.stringify(this.customers));
+                        return;
+                    }
+                    this.filterCustomers = this.customers.filter(function(item){
+                        return item.name.includes(value);
+                    })
+                },
+                filterOwnerGroup(e){
+                    let value = $(e.target).val();
+                    if (value===""){
+                        this.filterOwnerGroups=JSON.parse(JSON.stringify(this.ownerGroups));
+                        return;
+                    }
+                    this.filterOwnerGroups = this.ownerGroups.filter(function(item){
+                        return item.name.includes(value);
+                    })
+                },
+                filterUserGroup(e){
+                    let value = $(e.target).val();
+                    if (value===""){
+                        this.filterCustomers=JSON.parse(JSON.stringify(this.customers));
+                        return;
+                    }
+                    this.filterCustomers = this.customers.filter(function(item){
+                        return item.name.includes(value);
+                    })
+                },
             },
         });
     </script>

+ 4 - 2
resources/views/customer/project/index.blade.php

@@ -151,7 +151,7 @@
                             placeholder:['项目','定位或多选项目'],data:this.models},
                         {name:'contract_number',type:'input',tip: '合同号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '合同号'},
                     ],[
-                        {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
+                        {name:'customer_id',type:'select_multiple_select',tip:['客户','定位或多选项目'],placeholder: ['客户','定位或多选项目'],data:this.customers},
                         {name:'created_at_end',type:'time',tip:['选择显示创建日期的结束时间','']},
                         {name:'using_type',type:'select',placeholder: '用仓类型',data:[{name:"常温",value:"常温"},{name:"恒温",value:"恒温"}]},
                     ],
@@ -245,6 +245,8 @@
                     });
                 },
             },
+
+
         });
     </script>
-@endsection
+@endsection

+ 7 - 4
resources/views/customer/project/part/_two.blade.php

@@ -1,8 +1,9 @@
 <div class="row mt-3">
     <label for="customer_id" class="col-2 text-info">客户</label>
     <select id="customer_id" v-model="owner.customer_id" @change="selectOwner()" class="form-control form-control-sm col-4 mb-0" :class="errors.customer_id ? 'is-invalid' : ''">
-        <option v-for="customer in customers" :value="customer.id">@{{ customer.name }}</option>
+        <option v-for="customer in filterCustomers" :value="customer.id">@{{ customer.name }}</option>
     </select>
+    <input type="text" class="form-control form-control-sm ml-1 col-2" placeholder="输入关键字定位客户" @change="filterCustomer($event)">
     <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors.customer_id">
         <strong>@{{ errors.customer_id[0] }}</strong>
     </span>
@@ -10,8 +11,9 @@
 <div class="row mt-3">
     <label for="owner_group_id" class="col-2 text-info">项目小组</label>
     <select id="owner_group_id" v-model="owner.owner_group_id" @change="selectGroup()" class="form-control form-control-sm col-4 mb-0" :class="errors.owner_group_id ? 'is-invalid' : ''" >
-        <option v-for="ownerGroup in ownerGroups" :value="ownerGroup.id">@{{ ownerGroup.name }}</option>
+        <option v-for="ownerGroup in filterOwnerGroups" :value="ownerGroup.id">@{{ ownerGroup.name }}</option>
     </select>
+    <input type="text" class="form-control form-control-sm ml-1 col-2" placeholder="输入关键字项目小组" @change="filterOwnerGroup($event)">
     <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.owner_group_id">
         <strong>@{{ errors.owner_group_id[0] }}</strong>
     </span>
@@ -28,8 +30,9 @@
 <div class="row mt-3">
     <label for="user_workgroup_id" class="col-2">仓库小组</label>
     <select id="user_workgroup_id" v-model="owner.user_workgroup_id" @change="selectGroup()" class="form-control form-control-sm col-4 mb-0" :class="errors.user_workgroup_id ? 'is-invalid' : ''" >
-        <option v-for="userGroup in userGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
+        <option v-for="userGroup in filterUserGroups" :value="userGroup.id" v-if="userGroup.warehouse_id == owner.warehouse_id">@{{ userGroup.name }}</option>
     </select>
+    <input type="text" class="form-control form-control-sm ml-1 col-2" placeholder="输入关键字项目小组" @change="filterUserGroup($event)">
     <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.user_workgroup_id">
         <strong>@{{ errors.user_workgroup_id[0] }}</strong>
     </span>
@@ -59,4 +62,4 @@
 <div class="row mt-3">
     <label for="description" class="col-2">项目描述</label>
     <textarea id="description" v-model="owner.description" class="form-control form-control-sm col-7"></textarea>
-</div>
+</div>